diff --git a/.gitattributes b/.gitattributes index f794b65755dc1ca46416735ce7e8f84f52b55bfe..7c7f84e5ab4789441f141a2b3615905732304f12 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2219,3 +2219,229 @@ miniconda3/lib/libnghttp2.so.14.29.1 filter=lfs diff=lfs merge=lfs -text miniconda3/lib/libpcre2-16.a filter=lfs diff=lfs merge=lfs -text miniconda3/lib/libpcre2-16.so filter=lfs diff=lfs merge=lfs -text miniconda3/lib/libpcre2-16.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-16.so.0.14.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-32.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-32.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-32.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-32.so.0.14.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-8.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-8.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-8.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpcre2-8.so.0.14.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpython3.13.so.1.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libpython3.13.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libquadmath.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libquadmath.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libquadmath.so.0.0.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libreadline.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libreadline.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libreadline.so.8 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libreadline.so.8.3 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsimdjson.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsimdjson.so.23 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsimdjson.so.23.0.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsolv.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsolv.so.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsolvext.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsolvext.so.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsqlite3.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsqlite3.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libsqlite3.so.3.51.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libssh2.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libssh2.so.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libssh2.so.1.0.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libssl.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libssl.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libssl.so.3 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libstdc++.so.6 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libstdc++.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtcl8.6.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libstdc++.so.6.0.34 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtextstyle.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtextstyle.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtextstyle.so.0.2.5 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfo.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfo.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfo.so.6 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfo.so.6.5 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfow.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfow.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfow.so.6 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtinfow.so.6.5 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libunistring.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libunistring.so.5 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libunistring.so.5.2.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libtk8.6.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-glx.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-glx.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-glx.so.0.0.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-xinput.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-xinput.so.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-xinput.so.0.1.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-xkb.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-xkb.so.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb-xkb.so.1.0.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb.so.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxcb.so.1.1.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxml2.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxml2.so.2 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libxml2.so.2.13.9 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libyaml-cpp.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libyaml-cpp.so.0.8 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libyaml-cpp.so.0.8.0 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libz.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libz.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libz.so.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libz.so.1.3.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libzstd.a filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libzstd.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libzstd.so.1 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/libzstd.so.1.5.7 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/itcl4.3.0/libitcl4.3.0.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/ensurepip/_bundled/pip-25.3-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_asyncio.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_blake2.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_codecs_cn.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_codecs_hk.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_codecs_jp.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_codecs_kr.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_codecs_tw.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_csv.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_ctypes.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_curses.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_datetime.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_decimal.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_elementtree.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_hashlib.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_heapq.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_interpchannels.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_interpqueues.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_interpreters.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_json.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_lsprof.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_lzma.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_md5.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_multibytecodec.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_multiprocessing.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_pickle.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_posixsubprocess.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_sha3.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_sha2.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_socket.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_sqlite3.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_struct.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_testbuffer.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_testcapi.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_testclinic.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_testinternalcapi.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_testlimitedcapi.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_tkinter.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/_zoneinfo.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/array.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/binascii.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/cmath.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/math.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/mmap.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/pyexpat.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/readline.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/select.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/syslog.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/unicodedata.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/lib-dynload/zlib.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/_ruamel_yaml.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/brotlicffi/_brotlicffi.abi3.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/conda/shell/conda_icon.ico filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/cryptography/hazmat/bindings/_rust.abi3.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/libmambapy/bindings.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_arm64 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_x86_64 filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/msgpack/_cmsgpack.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/zstandard/backend_c.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/python3.13/site-packages/zstandard/_cffi.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/sqlite3.45.3/libsqlite3.45.3.so filter=lfs diff=lfs merge=lfs -text +miniconda3/lib/tk8.6/demos/images/teapot.ppm filter=lfs diff=lfs merge=lfs -text +miniconda3/libexec/dbus-daemon-launch-helper filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/anaconda-auth-0.13.0-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/anyio-4.10.0-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/c-ares-1.34.6-hd44998d_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/ca-certificates-2025.12.2-h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/certifi-2026.01.04-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/cffi-2.0.0-py313h4eded50_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/charset-normalizer-3.4.4-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/click-8.2.1-py313h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/conda-26.1.1-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/conda-package-handling-2.4.0-py313h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/cpp-expected-1.1.0-hdb19cb5_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/cryptography-46.0.5-py313h04fe016_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/dbus-1.16.2-h5bd4931_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/fmt-11.2.0-hca5f364_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/gettext-0.25.1-h92eb808_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/gettext-tools-0.25.1-h6a67909_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/httpcore-1.0.9-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/httpx-0.28.1-py313h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/idna-3.11-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/icu-73.1-h6a678d5_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/ld_impl_linux-64-2.44-h153f514_2.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/ld_impl_linux-64-2.44-h9e0c5a2_3.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libarchive-3.8.2-h3ec8f01_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libbrotlienc-1.2.0-h2e96acb_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libcurl-8.18.0-h3506a8c_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libev-4.33-h7f8727e_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libexpat-2.7.4-h7354ed3_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libffi-3.4.4-h6a678d5_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libgcc-15.2.0-h69a1729_7.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libgettextpo-0.25.1-hf2ab22a_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libgomp-15.2.0-h4751f2c_7.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libiconv-1.18-h75a1612_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libkrb5-1.22.1-h6d2bf13_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libmambapy-2.3.2-py313h3f77f5b_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libmamba-2.3.2-h860b5fb_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libnghttp2-1.67.1-h697f920_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libsolv-0.7.30-h6f1ccf3_2.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libssh2-1.11.1-h251f7ec_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libunistring-1.3-hb25bd0a_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libstdcxx-15.2.0-h39759b7_7.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libxcb-1.17.0-h9b100fa_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/libxml2-2.13.9-h2c43086_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/lmdb-0.9.31-hb25bd0a_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/lz4-c-1.9.4-h6a678d5_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/markdown-it-py-4.0.0-py313h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/menuinst-2.4.2-py313h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/more-itertools-10.8.0-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/msgpack-python-1.1.1-py313h6a678d5_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/ncurses-6.5-h7934f7d_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/nlohmann_json-3.11.2-h6a678d5_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/packaging-25.0-py310h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/packaging-25.0-py313h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/pcre2-10.46-hf426167_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/openssl-3.5.5-h1b28b03_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/pip-26.0.1-pyhc872135_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/pycparser-2.23-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/pydantic-2.12.4-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/pydantic-core-2.41.5-py313h498d7c9_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/pydantic-settings-2.12.0-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/pygments-2.19.2-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/python-3.10.20-h741d88c_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/readline-8.3-hc2a1206_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/python-3.13.12-hb7b561f_100_cp313.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/requests-2.32.5-py313h06a4308_1.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/ruamel.yaml-0.18.16-py313h4aee224_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/rich-14.2.0-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/ruamel.yaml.clib-0.2.14-py313h4aee224_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/setuptools-80.10.2-py310h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/setuptools-80.10.2-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/simdjson-3.10.1-hdb19cb5_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/sqlite-3.51.1-he0a8d7e_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/sqlite-3.51.2-h3e8d24a_0.conda filter=lfs diff=lfs merge=lfs -text +miniconda3/pkgs/tomlkit-0.13.3-py313h06a4308_0.conda filter=lfs diff=lfs merge=lfs -text diff --git a/miniconda3/lib/itcl4.3.0/libitcl4.3.0.so b/miniconda3/lib/itcl4.3.0/libitcl4.3.0.so new file mode 100644 index 0000000000000000000000000000000000000000..c9624bcb2f6ea65e8005ba4d116594689dedc08f --- /dev/null +++ b/miniconda3/lib/itcl4.3.0/libitcl4.3.0.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1764f24042ddab382f4df0cf3eb5cb4675d147404ec202a1894b53fe2e8924f1 +size 318840 diff --git a/miniconda3/lib/libpcre2-16.so.0.14.0 b/miniconda3/lib/libpcre2-16.so.0.14.0 new file mode 100644 index 0000000000000000000000000000000000000000..25c49da8e81a9f79c14fce766593b720791adeb0 --- /dev/null +++ b/miniconda3/lib/libpcre2-16.so.0.14.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef74620fddb080073569182e363cc7dad54ff98a26164d6bdc3d605a6096615c +size 669320 diff --git a/miniconda3/lib/libpcre2-32.a b/miniconda3/lib/libpcre2-32.a new file mode 100644 index 0000000000000000000000000000000000000000..5bed08fcb58c1bbd286201829255834ef313b6db --- /dev/null +++ b/miniconda3/lib/libpcre2-32.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00d9901eba196e1328a71955dc2d8e25bedb36bb8b859ddcde9593e681ba6c43 +size 925474 diff --git a/miniconda3/lib/libpcre2-32.so b/miniconda3/lib/libpcre2-32.so new file mode 100644 index 0000000000000000000000000000000000000000..d17212af0b425f56f6d93dd22b53284827da085a --- /dev/null +++ b/miniconda3/lib/libpcre2-32.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a5d1dee2aa875bcf2982d1b3604121ed5b077e958e4a33225f48694fb6b1b6d +size 636520 diff --git a/miniconda3/lib/libpcre2-32.so.0 b/miniconda3/lib/libpcre2-32.so.0 new file mode 100644 index 0000000000000000000000000000000000000000..d17212af0b425f56f6d93dd22b53284827da085a --- /dev/null +++ b/miniconda3/lib/libpcre2-32.so.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a5d1dee2aa875bcf2982d1b3604121ed5b077e958e4a33225f48694fb6b1b6d +size 636520 diff --git a/miniconda3/lib/libpcre2-32.so.0.14.0 b/miniconda3/lib/libpcre2-32.so.0.14.0 new file mode 100644 index 0000000000000000000000000000000000000000..d17212af0b425f56f6d93dd22b53284827da085a --- /dev/null +++ b/miniconda3/lib/libpcre2-32.so.0.14.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a5d1dee2aa875bcf2982d1b3604121ed5b077e958e4a33225f48694fb6b1b6d +size 636520 diff --git a/miniconda3/lib/libpcre2-8.a b/miniconda3/lib/libpcre2-8.a new file mode 100644 index 0000000000000000000000000000000000000000..cb52389a998b5eb4055826101064b629b35d40f6 --- /dev/null +++ b/miniconda3/lib/libpcre2-8.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9946e8d0875080722c597f70cbb5089f75e9ab75c3f848157c31222814cc22ac +size 1028336 diff --git a/miniconda3/lib/libpcre2-8.so b/miniconda3/lib/libpcre2-8.so new file mode 100644 index 0000000000000000000000000000000000000000..f7d1df0e1499dfc212f05b2d7662d8eb85a89333 --- /dev/null +++ b/miniconda3/lib/libpcre2-8.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bebef1a08a2a59a3b10e00c928d68bb2d5835819a48ef1e15153b3bf495b5b7 +size 731264 diff --git a/miniconda3/lib/libpcre2-8.so.0 b/miniconda3/lib/libpcre2-8.so.0 new file mode 100644 index 0000000000000000000000000000000000000000..f7d1df0e1499dfc212f05b2d7662d8eb85a89333 --- /dev/null +++ b/miniconda3/lib/libpcre2-8.so.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bebef1a08a2a59a3b10e00c928d68bb2d5835819a48ef1e15153b3bf495b5b7 +size 731264 diff --git a/miniconda3/lib/libpcre2-8.so.0.14.0 b/miniconda3/lib/libpcre2-8.so.0.14.0 new file mode 100644 index 0000000000000000000000000000000000000000..f7d1df0e1499dfc212f05b2d7662d8eb85a89333 --- /dev/null +++ b/miniconda3/lib/libpcre2-8.so.0.14.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bebef1a08a2a59a3b10e00c928d68bb2d5835819a48ef1e15153b3bf495b5b7 +size 731264 diff --git a/miniconda3/lib/libpython3.13.so b/miniconda3/lib/libpython3.13.so new file mode 100644 index 0000000000000000000000000000000000000000..10d74fdcbf96e1198f7776b5d0967c6b211e5332 --- /dev/null +++ b/miniconda3/lib/libpython3.13.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9222b82cdbcf2ef306083d223579cb7d36c55b6d7e29451e22b4384c7143ebb +size 31949680 diff --git a/miniconda3/lib/libpython3.13.so.1.0 b/miniconda3/lib/libpython3.13.so.1.0 new file mode 100644 index 0000000000000000000000000000000000000000..10d74fdcbf96e1198f7776b5d0967c6b211e5332 --- /dev/null +++ b/miniconda3/lib/libpython3.13.so.1.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9222b82cdbcf2ef306083d223579cb7d36c55b6d7e29451e22b4384c7143ebb +size 31949680 diff --git a/miniconda3/lib/libquadmath.so b/miniconda3/lib/libquadmath.so new file mode 100644 index 0000000000000000000000000000000000000000..587976a70d370ef3d3a1c60f6487c9f514c11692 --- /dev/null +++ b/miniconda3/lib/libquadmath.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5179930816df6751b7a118f1e29eabf7021a92d12db8c6920416e231682fb1bc +size 773304 diff --git a/miniconda3/lib/libquadmath.so.0 b/miniconda3/lib/libquadmath.so.0 new file mode 100644 index 0000000000000000000000000000000000000000..587976a70d370ef3d3a1c60f6487c9f514c11692 --- /dev/null +++ b/miniconda3/lib/libquadmath.so.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5179930816df6751b7a118f1e29eabf7021a92d12db8c6920416e231682fb1bc +size 773304 diff --git a/miniconda3/lib/libquadmath.so.0.0.0 b/miniconda3/lib/libquadmath.so.0.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..587976a70d370ef3d3a1c60f6487c9f514c11692 --- /dev/null +++ b/miniconda3/lib/libquadmath.so.0.0.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5179930816df6751b7a118f1e29eabf7021a92d12db8c6920416e231682fb1bc +size 773304 diff --git a/miniconda3/lib/libreadline.a b/miniconda3/lib/libreadline.a new file mode 100644 index 0000000000000000000000000000000000000000..8d66ebd8d512e241dfaa2c74b5ae4c6f4329cb8b --- /dev/null +++ b/miniconda3/lib/libreadline.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2152fb16bced27b27afe89781277814c2f6d03e775abb7ff1a90ce9c6d1ae0ee +size 796336 diff --git a/miniconda3/lib/libreadline.so b/miniconda3/lib/libreadline.so new file mode 100644 index 0000000000000000000000000000000000000000..cb7e397eac1c08ef1944f53eb470d31360848c21 --- /dev/null +++ b/miniconda3/lib/libreadline.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4f8e11f9697c71faeaa42de41da4b0ae59d182f47e9d95720288efa4c412ad1 +size 430464 diff --git a/miniconda3/lib/libreadline.so.8 b/miniconda3/lib/libreadline.so.8 new file mode 100644 index 0000000000000000000000000000000000000000..cb7e397eac1c08ef1944f53eb470d31360848c21 --- /dev/null +++ b/miniconda3/lib/libreadline.so.8 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4f8e11f9697c71faeaa42de41da4b0ae59d182f47e9d95720288efa4c412ad1 +size 430464 diff --git a/miniconda3/lib/libreadline.so.8.3 b/miniconda3/lib/libreadline.so.8.3 new file mode 100644 index 0000000000000000000000000000000000000000..cb7e397eac1c08ef1944f53eb470d31360848c21 --- /dev/null +++ b/miniconda3/lib/libreadline.so.8.3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4f8e11f9697c71faeaa42de41da4b0ae59d182f47e9d95720288efa4c412ad1 +size 430464 diff --git a/miniconda3/lib/libsimdjson.so b/miniconda3/lib/libsimdjson.so new file mode 100644 index 0000000000000000000000000000000000000000..ed59a32135b7374e1a961c268fd6286682663cd7 --- /dev/null +++ b/miniconda3/lib/libsimdjson.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:594d33f7e22af14c9f6b47f5acdb178b077f6ae78cc27011eaf69006aa8959c1 +size 217928 diff --git a/miniconda3/lib/libsimdjson.so.23 b/miniconda3/lib/libsimdjson.so.23 new file mode 100644 index 0000000000000000000000000000000000000000..ed59a32135b7374e1a961c268fd6286682663cd7 --- /dev/null +++ b/miniconda3/lib/libsimdjson.so.23 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:594d33f7e22af14c9f6b47f5acdb178b077f6ae78cc27011eaf69006aa8959c1 +size 217928 diff --git a/miniconda3/lib/libsimdjson.so.23.0.0 b/miniconda3/lib/libsimdjson.so.23.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..ed59a32135b7374e1a961c268fd6286682663cd7 --- /dev/null +++ b/miniconda3/lib/libsimdjson.so.23.0.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:594d33f7e22af14c9f6b47f5acdb178b077f6ae78cc27011eaf69006aa8959c1 +size 217928 diff --git a/miniconda3/lib/libsolv.so b/miniconda3/lib/libsolv.so new file mode 100644 index 0000000000000000000000000000000000000000..678e708904fdd7819542539c8d75fca8c23308dd --- /dev/null +++ b/miniconda3/lib/libsolv.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29a82dc332f12e8abb2ec70570894886589cd0dc6df2c231575f54684829de99 +size 706280 diff --git a/miniconda3/lib/libsolv.so.1 b/miniconda3/lib/libsolv.so.1 new file mode 100644 index 0000000000000000000000000000000000000000..678e708904fdd7819542539c8d75fca8c23308dd --- /dev/null +++ b/miniconda3/lib/libsolv.so.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29a82dc332f12e8abb2ec70570894886589cd0dc6df2c231575f54684829de99 +size 706280 diff --git a/miniconda3/lib/libsolvext.so b/miniconda3/lib/libsolvext.so new file mode 100644 index 0000000000000000000000000000000000000000..c2f7aee70e574cd6e950674f8c0dc96c48b32739 --- /dev/null +++ b/miniconda3/lib/libsolvext.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b89c5730bd9e12ef50fb354e0ff719256f402f0df88a3f0c9cc2fea523ea978 +size 112720 diff --git a/miniconda3/lib/libsolvext.so.1 b/miniconda3/lib/libsolvext.so.1 new file mode 100644 index 0000000000000000000000000000000000000000..c2f7aee70e574cd6e950674f8c0dc96c48b32739 --- /dev/null +++ b/miniconda3/lib/libsolvext.so.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b89c5730bd9e12ef50fb354e0ff719256f402f0df88a3f0c9cc2fea523ea978 +size 112720 diff --git a/miniconda3/lib/libsqlite3.so b/miniconda3/lib/libsqlite3.so new file mode 100644 index 0000000000000000000000000000000000000000..5291aa98347bedabc7adb96335188a0a72546ed5 --- /dev/null +++ b/miniconda3/lib/libsqlite3.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ff176fff66e4a603f4b6f709f64d90a35d74cf12a3c1ee2a18919446f32489a +size 1488352 diff --git a/miniconda3/lib/libsqlite3.so.0 b/miniconda3/lib/libsqlite3.so.0 new file mode 100644 index 0000000000000000000000000000000000000000..5291aa98347bedabc7adb96335188a0a72546ed5 --- /dev/null +++ b/miniconda3/lib/libsqlite3.so.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ff176fff66e4a603f4b6f709f64d90a35d74cf12a3c1ee2a18919446f32489a +size 1488352 diff --git a/miniconda3/lib/libsqlite3.so.3.51.1 b/miniconda3/lib/libsqlite3.so.3.51.1 new file mode 100644 index 0000000000000000000000000000000000000000..5291aa98347bedabc7adb96335188a0a72546ed5 --- /dev/null +++ b/miniconda3/lib/libsqlite3.so.3.51.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ff176fff66e4a603f4b6f709f64d90a35d74cf12a3c1ee2a18919446f32489a +size 1488352 diff --git a/miniconda3/lib/libssh2.so b/miniconda3/lib/libssh2.so new file mode 100644 index 0000000000000000000000000000000000000000..97b81df44778231fae68bf6cad0f4785e0019d13 --- /dev/null +++ b/miniconda3/lib/libssh2.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40d7337e163108c07a261ca5fd825513063c9c3e7b5c748207892c981be6e32c +size 331760 diff --git a/miniconda3/lib/libssh2.so.1 b/miniconda3/lib/libssh2.so.1 new file mode 100644 index 0000000000000000000000000000000000000000..97b81df44778231fae68bf6cad0f4785e0019d13 --- /dev/null +++ b/miniconda3/lib/libssh2.so.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40d7337e163108c07a261ca5fd825513063c9c3e7b5c748207892c981be6e32c +size 331760 diff --git a/miniconda3/lib/libssh2.so.1.0.1 b/miniconda3/lib/libssh2.so.1.0.1 new file mode 100644 index 0000000000000000000000000000000000000000..97b81df44778231fae68bf6cad0f4785e0019d13 --- /dev/null +++ b/miniconda3/lib/libssh2.so.1.0.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40d7337e163108c07a261ca5fd825513063c9c3e7b5c748207892c981be6e32c +size 331760 diff --git a/miniconda3/lib/libssl.a b/miniconda3/lib/libssl.a new file mode 100644 index 0000000000000000000000000000000000000000..4183ac5f339634e4ac3878beb19826f31d346b9f --- /dev/null +++ b/miniconda3/lib/libssl.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f7e2480e5a9bc54aaf7bb4bef58e5c1c82eaa69c2ac42751c68c2d7bd695914 +size 2473092 diff --git a/miniconda3/lib/libssl.so b/miniconda3/lib/libssl.so new file mode 100644 index 0000000000000000000000000000000000000000..911dc1632c2c0daf2897e74315370002ff8d4d8c --- /dev/null +++ b/miniconda3/lib/libssl.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32ab2466919492e728b8cfff3437c2f9f95d9abef17e0b8411aff02fbb55c160 +size 1202056 diff --git a/miniconda3/lib/libssl.so.3 b/miniconda3/lib/libssl.so.3 new file mode 100644 index 0000000000000000000000000000000000000000..911dc1632c2c0daf2897e74315370002ff8d4d8c --- /dev/null +++ b/miniconda3/lib/libssl.so.3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32ab2466919492e728b8cfff3437c2f9f95d9abef17e0b8411aff02fbb55c160 +size 1202056 diff --git a/miniconda3/lib/libstdc++.so b/miniconda3/lib/libstdc++.so new file mode 100644 index 0000000000000000000000000000000000000000..76c774a3a412995f14851c31dbfa40efd74b69dd --- /dev/null +++ b/miniconda3/lib/libstdc++.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f1293e2d2161711b793ab445cfcf579e6fd45e6dd03ae2b70ddf6be2f9c3c7 +size 14196512 diff --git a/miniconda3/lib/libstdc++.so.6 b/miniconda3/lib/libstdc++.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..76c774a3a412995f14851c31dbfa40efd74b69dd --- /dev/null +++ b/miniconda3/lib/libstdc++.so.6 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f1293e2d2161711b793ab445cfcf579e6fd45e6dd03ae2b70ddf6be2f9c3c7 +size 14196512 diff --git a/miniconda3/lib/libstdc++.so.6.0.34 b/miniconda3/lib/libstdc++.so.6.0.34 new file mode 100644 index 0000000000000000000000000000000000000000..76c774a3a412995f14851c31dbfa40efd74b69dd --- /dev/null +++ b/miniconda3/lib/libstdc++.so.6.0.34 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f1293e2d2161711b793ab445cfcf579e6fd45e6dd03ae2b70ddf6be2f9c3c7 +size 14196512 diff --git a/miniconda3/lib/libtcl8.6.so b/miniconda3/lib/libtcl8.6.so new file mode 100644 index 0000000000000000000000000000000000000000..382d547f9d27b7a17b87eafa2c993b7f657550da --- /dev/null +++ b/miniconda3/lib/libtcl8.6.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28221052282cd191697b76b09dd6d01e921965cfbc65ae43abac581fec951ac6 +size 1987776 diff --git a/miniconda3/lib/libtextstyle.so b/miniconda3/lib/libtextstyle.so new file mode 100644 index 0000000000000000000000000000000000000000..e33e182be57800c670930e0605f49470d92156e3 --- /dev/null +++ b/miniconda3/lib/libtextstyle.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a4f3827bdd64bde94e59984403b6b1dfef3ec56b4c8f9fc60fc0d525d206c9e +size 389896 diff --git a/miniconda3/lib/libtextstyle.so.0 b/miniconda3/lib/libtextstyle.so.0 new file mode 100644 index 0000000000000000000000000000000000000000..e33e182be57800c670930e0605f49470d92156e3 --- /dev/null +++ b/miniconda3/lib/libtextstyle.so.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a4f3827bdd64bde94e59984403b6b1dfef3ec56b4c8f9fc60fc0d525d206c9e +size 389896 diff --git a/miniconda3/lib/libtextstyle.so.0.2.5 b/miniconda3/lib/libtextstyle.so.0.2.5 new file mode 100644 index 0000000000000000000000000000000000000000..e33e182be57800c670930e0605f49470d92156e3 --- /dev/null +++ b/miniconda3/lib/libtextstyle.so.0.2.5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a4f3827bdd64bde94e59984403b6b1dfef3ec56b4c8f9fc60fc0d525d206c9e +size 389896 diff --git a/miniconda3/lib/libtinfo.a b/miniconda3/lib/libtinfo.a new file mode 100644 index 0000000000000000000000000000000000000000..44875dab1cd50518eedc829df92566e71e42b454 --- /dev/null +++ b/miniconda3/lib/libtinfo.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d3fc57bf444ab390edbaffeaaac9c3d6e1b75207477c7b369fd379ec54a04ba +size 506336 diff --git a/miniconda3/lib/libtinfo.so b/miniconda3/lib/libtinfo.so new file mode 100644 index 0000000000000000000000000000000000000000..f0b8aa7ec764512a266e09eb70a0cb4db86adda7 --- /dev/null +++ b/miniconda3/lib/libtinfo.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c982bd1222f6f6ca41d503c8b04431b19b0e42a4a0cdf7fa79db7aeddcc74234 +size 299896 diff --git a/miniconda3/lib/libtinfo.so.6 b/miniconda3/lib/libtinfo.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..f0b8aa7ec764512a266e09eb70a0cb4db86adda7 --- /dev/null +++ b/miniconda3/lib/libtinfo.so.6 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c982bd1222f6f6ca41d503c8b04431b19b0e42a4a0cdf7fa79db7aeddcc74234 +size 299896 diff --git a/miniconda3/lib/libtinfo.so.6.5 b/miniconda3/lib/libtinfo.so.6.5 new file mode 100644 index 0000000000000000000000000000000000000000..f0b8aa7ec764512a266e09eb70a0cb4db86adda7 --- /dev/null +++ b/miniconda3/lib/libtinfo.so.6.5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c982bd1222f6f6ca41d503c8b04431b19b0e42a4a0cdf7fa79db7aeddcc74234 +size 299896 diff --git a/miniconda3/lib/libtinfow.a b/miniconda3/lib/libtinfow.a new file mode 100644 index 0000000000000000000000000000000000000000..44875dab1cd50518eedc829df92566e71e42b454 --- /dev/null +++ b/miniconda3/lib/libtinfow.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d3fc57bf444ab390edbaffeaaac9c3d6e1b75207477c7b369fd379ec54a04ba +size 506336 diff --git a/miniconda3/lib/libtinfow.so b/miniconda3/lib/libtinfow.so new file mode 100644 index 0000000000000000000000000000000000000000..f0b8aa7ec764512a266e09eb70a0cb4db86adda7 --- /dev/null +++ b/miniconda3/lib/libtinfow.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c982bd1222f6f6ca41d503c8b04431b19b0e42a4a0cdf7fa79db7aeddcc74234 +size 299896 diff --git a/miniconda3/lib/libtinfow.so.6 b/miniconda3/lib/libtinfow.so.6 new file mode 100644 index 0000000000000000000000000000000000000000..f0b8aa7ec764512a266e09eb70a0cb4db86adda7 --- /dev/null +++ b/miniconda3/lib/libtinfow.so.6 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c982bd1222f6f6ca41d503c8b04431b19b0e42a4a0cdf7fa79db7aeddcc74234 +size 299896 diff --git a/miniconda3/lib/libtinfow.so.6.5 b/miniconda3/lib/libtinfow.so.6.5 new file mode 100644 index 0000000000000000000000000000000000000000..f0b8aa7ec764512a266e09eb70a0cb4db86adda7 --- /dev/null +++ b/miniconda3/lib/libtinfow.so.6.5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c982bd1222f6f6ca41d503c8b04431b19b0e42a4a0cdf7fa79db7aeddcc74234 +size 299896 diff --git a/miniconda3/lib/libtk8.6.so b/miniconda3/lib/libtk8.6.so new file mode 100644 index 0000000000000000000000000000000000000000..3962e15d686378ce5b2c1c6fe3aadb15c11863c1 --- /dev/null +++ b/miniconda3/lib/libtk8.6.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:683189caa5543909c64fd6af77f8b594a8821d9d29c2507dafa4af65cee95272 +size 1617880 diff --git a/miniconda3/lib/libunistring.so b/miniconda3/lib/libunistring.so new file mode 100644 index 0000000000000000000000000000000000000000..dc09d5a2e612067c8a46a9d39c19189551a4fc59 --- /dev/null +++ b/miniconda3/lib/libunistring.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d69a3fdfbd5581d0d8d89fdffdec46ac2cba8cb81b27c39f9e51e906433a03ed +size 2086760 diff --git a/miniconda3/lib/libunistring.so.5 b/miniconda3/lib/libunistring.so.5 new file mode 100644 index 0000000000000000000000000000000000000000..dc09d5a2e612067c8a46a9d39c19189551a4fc59 --- /dev/null +++ b/miniconda3/lib/libunistring.so.5 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d69a3fdfbd5581d0d8d89fdffdec46ac2cba8cb81b27c39f9e51e906433a03ed +size 2086760 diff --git a/miniconda3/lib/libunistring.so.5.2.0 b/miniconda3/lib/libunistring.so.5.2.0 new file mode 100644 index 0000000000000000000000000000000000000000..dc09d5a2e612067c8a46a9d39c19189551a4fc59 --- /dev/null +++ b/miniconda3/lib/libunistring.so.5.2.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d69a3fdfbd5581d0d8d89fdffdec46ac2cba8cb81b27c39f9e51e906433a03ed +size 2086760 diff --git a/miniconda3/lib/libxcb-glx.so b/miniconda3/lib/libxcb-glx.so new file mode 100644 index 0000000000000000000000000000000000000000..63ab8871e4118612952e689e8b2bbd4f0aaa377f --- /dev/null +++ b/miniconda3/lib/libxcb-glx.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f46066a978b974e39c0a914c4c80ea320f8f7ed0daec1286ecbc19e4d65dbc +size 161320 diff --git a/miniconda3/lib/libxcb-glx.so.0 b/miniconda3/lib/libxcb-glx.so.0 new file mode 100644 index 0000000000000000000000000000000000000000..63ab8871e4118612952e689e8b2bbd4f0aaa377f --- /dev/null +++ b/miniconda3/lib/libxcb-glx.so.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f46066a978b974e39c0a914c4c80ea320f8f7ed0daec1286ecbc19e4d65dbc +size 161320 diff --git a/miniconda3/lib/libxcb-glx.so.0.0.0 b/miniconda3/lib/libxcb-glx.so.0.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..63ab8871e4118612952e689e8b2bbd4f0aaa377f --- /dev/null +++ b/miniconda3/lib/libxcb-glx.so.0.0.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3f46066a978b974e39c0a914c4c80ea320f8f7ed0daec1286ecbc19e4d65dbc +size 161320 diff --git a/miniconda3/lib/libxcb-xinput.so b/miniconda3/lib/libxcb-xinput.so new file mode 100644 index 0000000000000000000000000000000000000000..d626de3af93987411887851754761f96e2622332 --- /dev/null +++ b/miniconda3/lib/libxcb-xinput.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85e651c4ab531237b48feadc3ba13c9cc076cf3dc50c6d070413a381c5a9f1f7 +size 201736 diff --git a/miniconda3/lib/libxcb-xinput.so.0 b/miniconda3/lib/libxcb-xinput.so.0 new file mode 100644 index 0000000000000000000000000000000000000000..d626de3af93987411887851754761f96e2622332 --- /dev/null +++ b/miniconda3/lib/libxcb-xinput.so.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85e651c4ab531237b48feadc3ba13c9cc076cf3dc50c6d070413a381c5a9f1f7 +size 201736 diff --git a/miniconda3/lib/libxcb-xinput.so.0.1.0 b/miniconda3/lib/libxcb-xinput.so.0.1.0 new file mode 100644 index 0000000000000000000000000000000000000000..d626de3af93987411887851754761f96e2622332 --- /dev/null +++ b/miniconda3/lib/libxcb-xinput.so.0.1.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85e651c4ab531237b48feadc3ba13c9cc076cf3dc50c6d070413a381c5a9f1f7 +size 201736 diff --git a/miniconda3/lib/libxcb-xkb.so b/miniconda3/lib/libxcb-xkb.so new file mode 100644 index 0000000000000000000000000000000000000000..b42bc531bc94835eb41a1d424d6218128aebfc38 --- /dev/null +++ b/miniconda3/lib/libxcb-xkb.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b676f3827de9acddd1a912384a00cc71f6e8ed1d0c5c3667204368f7fde8df7 +size 162496 diff --git a/miniconda3/lib/libxcb-xkb.so.1 b/miniconda3/lib/libxcb-xkb.so.1 new file mode 100644 index 0000000000000000000000000000000000000000..b42bc531bc94835eb41a1d424d6218128aebfc38 --- /dev/null +++ b/miniconda3/lib/libxcb-xkb.so.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b676f3827de9acddd1a912384a00cc71f6e8ed1d0c5c3667204368f7fde8df7 +size 162496 diff --git a/miniconda3/lib/libxcb-xkb.so.1.0.0 b/miniconda3/lib/libxcb-xkb.so.1.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..b42bc531bc94835eb41a1d424d6218128aebfc38 --- /dev/null +++ b/miniconda3/lib/libxcb-xkb.so.1.0.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b676f3827de9acddd1a912384a00cc71f6e8ed1d0c5c3667204368f7fde8df7 +size 162496 diff --git a/miniconda3/lib/libxcb.so b/miniconda3/lib/libxcb.so new file mode 100644 index 0000000000000000000000000000000000000000..23654d7d79b65d38707fcd343b8fd0e2aee2b18b --- /dev/null +++ b/miniconda3/lib/libxcb.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1829db06915fa25760d65e99b9224bcb7b29760d36677dc09c6a8ec16957c67e +size 228800 diff --git a/miniconda3/lib/libxcb.so.1 b/miniconda3/lib/libxcb.so.1 new file mode 100644 index 0000000000000000000000000000000000000000..23654d7d79b65d38707fcd343b8fd0e2aee2b18b --- /dev/null +++ b/miniconda3/lib/libxcb.so.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1829db06915fa25760d65e99b9224bcb7b29760d36677dc09c6a8ec16957c67e +size 228800 diff --git a/miniconda3/lib/libxcb.so.1.1.0 b/miniconda3/lib/libxcb.so.1.1.0 new file mode 100644 index 0000000000000000000000000000000000000000..23654d7d79b65d38707fcd343b8fd0e2aee2b18b --- /dev/null +++ b/miniconda3/lib/libxcb.so.1.1.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1829db06915fa25760d65e99b9224bcb7b29760d36677dc09c6a8ec16957c67e +size 228800 diff --git a/miniconda3/lib/libxml2.so b/miniconda3/lib/libxml2.so new file mode 100644 index 0000000000000000000000000000000000000000..1bf475ca00d70f43b8e30de828d25ad513ae521a --- /dev/null +++ b/miniconda3/lib/libxml2.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15a19e5cce8631f13e33aab86fd9dc3255e2e8b1091d7b26a71c407abf6cd281 +size 1578016 diff --git a/miniconda3/lib/libxml2.so.2 b/miniconda3/lib/libxml2.so.2 new file mode 100644 index 0000000000000000000000000000000000000000..1bf475ca00d70f43b8e30de828d25ad513ae521a --- /dev/null +++ b/miniconda3/lib/libxml2.so.2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15a19e5cce8631f13e33aab86fd9dc3255e2e8b1091d7b26a71c407abf6cd281 +size 1578016 diff --git a/miniconda3/lib/libxml2.so.2.13.9 b/miniconda3/lib/libxml2.so.2.13.9 new file mode 100644 index 0000000000000000000000000000000000000000..1bf475ca00d70f43b8e30de828d25ad513ae521a --- /dev/null +++ b/miniconda3/lib/libxml2.so.2.13.9 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15a19e5cce8631f13e33aab86fd9dc3255e2e8b1091d7b26a71c407abf6cd281 +size 1578016 diff --git a/miniconda3/lib/libyaml-cpp.so b/miniconda3/lib/libyaml-cpp.so new file mode 100644 index 0000000000000000000000000000000000000000..5241f46ab70d192219ebd9503fce0ee76e7ccb61 --- /dev/null +++ b/miniconda3/lib/libyaml-cpp.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbc6c4297430b66011b61ded35723283f56c218137637e94b1f2f6d58ee2a58a +size 562816 diff --git a/miniconda3/lib/libyaml-cpp.so.0.8 b/miniconda3/lib/libyaml-cpp.so.0.8 new file mode 100644 index 0000000000000000000000000000000000000000..5241f46ab70d192219ebd9503fce0ee76e7ccb61 --- /dev/null +++ b/miniconda3/lib/libyaml-cpp.so.0.8 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbc6c4297430b66011b61ded35723283f56c218137637e94b1f2f6d58ee2a58a +size 562816 diff --git a/miniconda3/lib/libyaml-cpp.so.0.8.0 b/miniconda3/lib/libyaml-cpp.so.0.8.0 new file mode 100644 index 0000000000000000000000000000000000000000..5241f46ab70d192219ebd9503fce0ee76e7ccb61 --- /dev/null +++ b/miniconda3/lib/libyaml-cpp.so.0.8.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbc6c4297430b66011b61ded35723283f56c218137637e94b1f2f6d58ee2a58a +size 562816 diff --git a/miniconda3/lib/libz.a b/miniconda3/lib/libz.a new file mode 100644 index 0000000000000000000000000000000000000000..96fae6ec480afef803ab65861370324d36b25791 --- /dev/null +++ b/miniconda3/lib/libz.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a87faa8280f7cb45c61376d4c71c5be94f3068b12162416c8b7b18e355f01a2d +size 153844 diff --git a/miniconda3/lib/libz.so b/miniconda3/lib/libz.so new file mode 100644 index 0000000000000000000000000000000000000000..e6e5b7ce2279be75ec347487651819bea6f8c534 --- /dev/null +++ b/miniconda3/lib/libz.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96b55bbfb48f50af95da290c4cce33d0724e6565715bfc2e859de7d9efde3cbc +size 108688 diff --git a/miniconda3/lib/libz.so.1 b/miniconda3/lib/libz.so.1 new file mode 100644 index 0000000000000000000000000000000000000000..e6e5b7ce2279be75ec347487651819bea6f8c534 --- /dev/null +++ b/miniconda3/lib/libz.so.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96b55bbfb48f50af95da290c4cce33d0724e6565715bfc2e859de7d9efde3cbc +size 108688 diff --git a/miniconda3/lib/libz.so.1.3.1 b/miniconda3/lib/libz.so.1.3.1 new file mode 100644 index 0000000000000000000000000000000000000000..e6e5b7ce2279be75ec347487651819bea6f8c534 --- /dev/null +++ b/miniconda3/lib/libz.so.1.3.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96b55bbfb48f50af95da290c4cce33d0724e6565715bfc2e859de7d9efde3cbc +size 108688 diff --git a/miniconda3/lib/libzstd.a b/miniconda3/lib/libzstd.a new file mode 100644 index 0000000000000000000000000000000000000000..c1946d1c0f2ee0055dde617c51ccbf198c227501 --- /dev/null +++ b/miniconda3/lib/libzstd.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26cb92217e517fc23a4d7309be72eb031436b618ae357aee36988afcd4d44998 +size 1508092 diff --git a/miniconda3/lib/libzstd.so b/miniconda3/lib/libzstd.so new file mode 100644 index 0000000000000000000000000000000000000000..30e9839a57e64cf17ff4ccca85fc20aa1ac771e5 --- /dev/null +++ b/miniconda3/lib/libzstd.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04386b17742680c97e5c4a9da31414238477d4951ec04f5c9499a0728e41ba3d +size 1187048 diff --git a/miniconda3/lib/libzstd.so.1 b/miniconda3/lib/libzstd.so.1 new file mode 100644 index 0000000000000000000000000000000000000000..30e9839a57e64cf17ff4ccca85fc20aa1ac771e5 --- /dev/null +++ b/miniconda3/lib/libzstd.so.1 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04386b17742680c97e5c4a9da31414238477d4951ec04f5c9499a0728e41ba3d +size 1187048 diff --git a/miniconda3/lib/libzstd.so.1.5.7 b/miniconda3/lib/libzstd.so.1.5.7 new file mode 100644 index 0000000000000000000000000000000000000000..30e9839a57e64cf17ff4ccca85fc20aa1ac771e5 --- /dev/null +++ b/miniconda3/lib/libzstd.so.1.5.7 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04386b17742680c97e5c4a9da31414238477d4951ec04f5c9499a0728e41ba3d +size 1187048 diff --git a/miniconda3/lib/python3.13/ensurepip/_bundled/pip-25.3-py3-none-any.whl b/miniconda3/lib/python3.13/ensurepip/_bundled/pip-25.3-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..cad5b10cd1247ac54c172acf62a9b6ef5fae6bc1 --- /dev/null +++ b/miniconda3/lib/python3.13/ensurepip/_bundled/pip-25.3-py3-none-any.whl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9655943313a94722b7774661c21049070f6bbb0a1516bf02f7c8d5d9201514cd +size 1778622 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/folder.gif b/miniconda3/lib/python3.13/idlelib/Icons/folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..b8f417629c16e88c45393133a5a2bddadb065dd7 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/folder.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c98d566a13fd599d1c11a375f387fef69b6c595c4f18c5d88c188a860be0e55 +size 120 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/idle_16.gif b/miniconda3/lib/python3.13/idlelib/Icons/idle_16.gif new file mode 100644 index 0000000000000000000000000000000000000000..45f0c2ca179d883c56d835a230b64b03b699bc90 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/idle_16.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe3af292b38660a8a58b1a8b4fa4240aa190602e7e9a700ea0536b3181fc968e +size 634 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/idle_16.png b/miniconda3/lib/python3.13/idlelib/Icons/idle_16.png new file mode 100644 index 0000000000000000000000000000000000000000..46cc2af81a39625ec111aaa2bed58fdda1717793 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/idle_16.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78fb3fb0ec11f61bc6cf0947f3c3923aa18e1c6513684058ed0fa01ac858143e +size 1031 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/idle_256.png b/miniconda3/lib/python3.13/idlelib/Icons/idle_256.png new file mode 100644 index 0000000000000000000000000000000000000000..4ec4ae94cabd662ac9e4476172fa5d606679a5f1 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/idle_256.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6f573efc06f2b2edce284c5758bd94344114547eb4c5e26baa8453eeaa91cf1 +size 31216 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/idle_32.gif b/miniconda3/lib/python3.13/idlelib/Icons/idle_32.gif new file mode 100644 index 0000000000000000000000000000000000000000..89a600532f00e4d206bbc8a59b6baad82fd9dab1 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/idle_32.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe70991cfccd1267922e94d91e02e9a58d2d29fd3382a2f4975280b9023cb7b9 +size 1019 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/idle_32.png b/miniconda3/lib/python3.13/idlelib/Icons/idle_32.png new file mode 100644 index 0000000000000000000000000000000000000000..464aceda8b1fa6e98d3553572e40ebe7d2de2ccb --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/idle_32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:797cd05f1964d57c4c6c248ac7f7ea6a38019ada32a9ab7e6c28d060f87b03de +size 2036 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/idle_48.gif b/miniconda3/lib/python3.13/idlelib/Icons/idle_48.gif new file mode 100644 index 0000000000000000000000000000000000000000..8c44232f6288f2948637bf3c44522cf7230637a3 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/idle_48.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37484901eb40eefa846308e1da3ff6f240ea98f769a2afc3cf4fdba00327ecbe +size 1388 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/idle_48.png b/miniconda3/lib/python3.13/idlelib/Icons/idle_48.png new file mode 100644 index 0000000000000000000000000000000000000000..fbc92eb6d2d6815ba8c9e1bfd38bccc643da84c1 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/idle_48.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a09f433197c8870b12bb7859cc4c3fe2068908cb1ddbd4880ab0f6fee91b6c23 +size 3977 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/minusnode.gif b/miniconda3/lib/python3.13/idlelib/Icons/minusnode.gif new file mode 100644 index 0000000000000000000000000000000000000000..98541201db0e2935a0d113f67171d253473005e2 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/minusnode.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efa5aa1d1e3439ab85425bd2aa3a25b9e6c21309e672690cfb32219e1eb7a7f3 +size 75 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/openfolder.gif b/miniconda3/lib/python3.13/idlelib/Icons/openfolder.gif new file mode 100644 index 0000000000000000000000000000000000000000..91b37619cc0326db6bfc6faafcafde0322fb69b5 --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/openfolder.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a59e2abf1840156e9db8f85a38822fd56ab79a139eb95ec86f1fba1bb87326b +size 125 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/plusnode.gif b/miniconda3/lib/python3.13/idlelib/Icons/plusnode.gif new file mode 100644 index 0000000000000000000000000000000000000000..c4c7e864238f9fcfe272ea6754ea84c7798add1e --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/plusnode.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ace9e90a2bcb16d06c4d78837137f2c14bc26b3bd9f24b7b6afeadb689bdafb +size 78 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/python.gif b/miniconda3/lib/python3.13/idlelib/Icons/python.gif new file mode 100644 index 0000000000000000000000000000000000000000..2d73d19be477b8af5f50c7712a2ce1be9db9c20d --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/python.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:158c31382f8e5b41fded0c2aa9cc66a382928b003cdd8b5b0518836ad9c89377 +size 380 diff --git a/miniconda3/lib/python3.13/idlelib/Icons/tk.gif b/miniconda3/lib/python3.13/idlelib/Icons/tk.gif new file mode 100644 index 0000000000000000000000000000000000000000..666c5cc86c65a985eb2a962f850bdad58178d64a --- /dev/null +++ b/miniconda3/lib/python3.13/idlelib/Icons/tk.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f16cb2e322891dbd9101302c09ffda0c2a3a72d053bb8c0927d507414c59cad +size 72 diff --git a/miniconda3/lib/python3.13/lib-dynload/_asyncio.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_asyncio.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..f6fce9be14c9f19720856a615624f1ab57ba4460 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_asyncio.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59071fd9f38f29bdf8eb209766a772c539bb36e039e93b02d496fc2ce5502285 +size 378360 diff --git a/miniconda3/lib/python3.13/lib-dynload/_blake2.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_blake2.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..1d5aed437f32216f39fdef6795cc49af87bc7359 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_blake2.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:057752d8bafde05229935293f4e762dd855863a2a2e76650d0fec5a2a715b120 +size 399720 diff --git a/miniconda3/lib/python3.13/lib-dynload/_codecs_cn.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_codecs_cn.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..fece76f33b66b71adc507090381397c48f9ca60d --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_codecs_cn.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9469d64f3ef8f60b46df8268f6a5e7a822b2686c2982233fdcfe7f7ec405a182 +size 195008 diff --git a/miniconda3/lib/python3.13/lib-dynload/_codecs_hk.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_codecs_hk.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..76b38a9482984c19155aa99eee9600843afebb9c --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_codecs_hk.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:240f317b1fd7a6eae0ad8c6bcc6316f0f522be1b25b48578251415aa6d69d4ce +size 193840 diff --git a/miniconda3/lib/python3.13/lib-dynload/_codecs_jp.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_codecs_jp.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..8a2760f18da3ec0bc8efb694316f3b14dceb70fb --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_codecs_jp.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb48bee1bbfa44df066d7815c6ea7f7cc3a92a43cb95d0da17c696589fccf316 +size 326528 diff --git a/miniconda3/lib/python3.13/lib-dynload/_codecs_kr.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_codecs_kr.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..e702eab2b2a69209fc068357276fe30d7947814a --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_codecs_kr.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43f74bf14ae692e9cd3c61162deea72d995f2360c6a3c744b8c17ecfd47b6c82 +size 179832 diff --git a/miniconda3/lib/python3.13/lib-dynload/_codecs_tw.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_codecs_tw.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..abf3187d900c476678696c17bb3c47167681b4fd --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_codecs_tw.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:005e8a3bea9d343410f75a46b99a7d757e39cbb7cf3b008512bfc077983a9e11 +size 143184 diff --git a/miniconda3/lib/python3.13/lib-dynload/_csv.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_csv.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..ea7aa4edc1fde8db2b3afa9e6d4f31e7d0b50f52 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_csv.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1308dc29ca055484eecffc5dee60374da92f7e82efe6a20928c89143986b3a5f +size 144576 diff --git a/miniconda3/lib/python3.13/lib-dynload/_ctypes.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_ctypes.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..ba242e258625624288bb96d71b653be165f731a2 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_ctypes.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c23fe6e227e0091f0acb2a19d86229542e4889181917de3059434e43ef9443c8 +size 948176 diff --git a/miniconda3/lib/python3.13/lib-dynload/_curses.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_curses.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..b84cefdfbeaa87234d6e29457be6ee8e31ce36ec --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_curses.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:034d217ed1c9f28a6c174d941a4f9476271cadd8d194a0e596e8c138728711ac +size 576024 diff --git a/miniconda3/lib/python3.13/lib-dynload/_datetime.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_datetime.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..19330bd0e028b6fc69efd957331d5200c80c4b17 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_datetime.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b952c3ac5ca131e73039bc55e7d81e0ac8894d63e322af5d5e2a0cf1d2baf40a +size 785784 diff --git a/miniconda3/lib/python3.13/lib-dynload/_decimal.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_decimal.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..b605c5895612f264ef752b9b311530017c5ab41d --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_decimal.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:735a38e0f82e403e4348906633d6f73733ac60bcd4756eec577aba1acb7344f7 +size 910824 diff --git a/miniconda3/lib/python3.13/lib-dynload/_elementtree.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_elementtree.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..a1142314a0741a729a5c541980282cf568b638fe --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_elementtree.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f235cecdf551ae94257247c0fba368048df517bbabc92f8b38e963481379f62 +size 501648 diff --git a/miniconda3/lib/python3.13/lib-dynload/_hashlib.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_hashlib.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..7c4d961acc6bb0ff3c5d8f8959e04f4bc18d44a7 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_hashlib.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8daf317f09f9302710bf5aa6e5fe3b65959880502c3be9e1b57bdee0b86b104e +size 236024 diff --git a/miniconda3/lib/python3.13/lib-dynload/_heapq.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_heapq.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..0dd00812205a7003ab81b04654352c1870a2436e --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_heapq.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbf49e24b96ea1f2fa98356cd1ca3f0f82e6f6bf1b7c854248422b18a604d470 +size 113128 diff --git a/miniconda3/lib/python3.13/lib-dynload/_interpchannels.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_interpchannels.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..3882c92e0730670470075ce0fe441a8a953ba541 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_interpchannels.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97188debeed6faf6fe1623e6f6fe084cf78488f6af7bd29d718f5c5fe49a4c9e +size 303528 diff --git a/miniconda3/lib/python3.13/lib-dynload/_interpqueues.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_interpqueues.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..a16c91df6d40c7431b6d980a72a80e42e9c2019f --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_interpqueues.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5a881eb3a45c63c2d377cb21a56bbad71d4def9ebf98c520fd50e8343860b9d +size 127648 diff --git a/miniconda3/lib/python3.13/lib-dynload/_interpreters.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_interpreters.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..4d870274b558186f98efe24086b6c415c824fc1b --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_interpreters.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abfb65c21fc379027d9732a31aad39cadfdcd9c23727d81213ca9f4835b9336d +size 201048 diff --git a/miniconda3/lib/python3.13/lib-dynload/_json.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_json.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..987d8ef0e6551d91970ff5443a2f493dc91c30fd --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_json.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c87ff1007b521b82a8f43165016981857622af7a2a6d18a6f6a5a3339d10bec +size 299848 diff --git a/miniconda3/lib/python3.13/lib-dynload/_lsprof.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_lsprof.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..ea5900a6655e53fff01109e2b2669510437993fe --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_lsprof.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a710534e8f13100e6e9a11643085c156e2b665fefd2042a02006b7d79e54e04b +size 208032 diff --git a/miniconda3/lib/python3.13/lib-dynload/_lzma.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_lzma.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..fcf62768ef0272cf509735948154799a62b9933c --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_lzma.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4f6bd8499913b8ff622e3ccdb1232a3158be9f81dbead5d6df2a56f38562870 +size 161912 diff --git a/miniconda3/lib/python3.13/lib-dynload/_md5.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_md5.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..242a9f76623d6e9b276fa00bada799837ed9d8e6 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_md5.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc6480f75da4ed3e1ecaa88b81ee6b805a7e471d51464cea477ee9a3def3dd90 +size 140656 diff --git a/miniconda3/lib/python3.13/lib-dynload/_multibytecodec.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_multibytecodec.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..92ae284b0250fd3b7f1ef375a22460a1eb34db4f --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_multibytecodec.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed0cd28b6049edf770c25801ffa52d65d8e7ad9929ca48ae5524076b8b8edd56 +size 225160 diff --git a/miniconda3/lib/python3.13/lib-dynload/_multiprocessing.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_multiprocessing.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..de681aba15263983df8a286c6ef35be35a47feb1 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_multiprocessing.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bad32ba1bbfe837e30a0387757c60592a9993ba70c6871909606d74d0ca62aa5 +size 163608 diff --git a/miniconda3/lib/python3.13/lib-dynload/_pickle.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_pickle.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..d5dd2f7356457cbc696e422692a0b5fed1705049 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_pickle.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4238cc322109edf369df169ee39e2de27488e5391fa9aa0679dc1f922ef916a7 +size 685784 diff --git a/miniconda3/lib/python3.13/lib-dynload/_posixsubprocess.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_posixsubprocess.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..bed6d36b92d7d39288ce3b6aad986c75d944eec8 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_posixsubprocess.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ebc61dc040710a0a4fac8648d14a78d1c139362341fced74e0cb0725dc8ceac +size 188832 diff --git a/miniconda3/lib/python3.13/lib-dynload/_sha2.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_sha2.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..13740000f491849c0451658fee4006d79edde0d0 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_sha2.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e58cde0033ebf41f765428f9c551dcde06a5eef7f3611d5fc48e62bbd1d2fc49 +size 1172184 diff --git a/miniconda3/lib/python3.13/lib-dynload/_sha3.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_sha3.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..b04d5d910ab996b71cb4bd7b623752f50461c02f --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_sha3.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e4cc4e8f15fd0a2fa16e09096c818dacdc5fc213f775d65e9d82c8fe48ecfa5 +size 214968 diff --git a/miniconda3/lib/python3.13/lib-dynload/_socket.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_socket.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..e03d44f507e0ec269f58cf28ebd28c3aecdfc27c --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_socket.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a70b9471f1ecd5a2e6eda1247060b9228a9c475bd6dc59297e883701003d8a8 +size 323008 diff --git a/miniconda3/lib/python3.13/lib-dynload/_sqlite3.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_sqlite3.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..a1ed5f2094108663584715411a05955048b2efdc --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_sqlite3.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbe1e966a682ad68eaf106ff0b0129465692e5ac3d390e8c3ca8e70185a496a3 +size 907864 diff --git a/miniconda3/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..576feee2594af98537f9e993b3045adeb1df67f6 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82d3643a577987548f2079892f4a448bdcd0f97d482f3f6a5e140a8e84dfdeb6 +size 638296 diff --git a/miniconda3/lib/python3.13/lib-dynload/_struct.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_struct.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..91a276222b0fd5d770aa4c400ff684aa6451c1a8 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_struct.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a213e28d3ad83ff68a04427a08ca715059d250cf1f1db6b4c97e180b51f40b5 +size 221656 diff --git a/miniconda3/lib/python3.13/lib-dynload/_testbuffer.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_testbuffer.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..c806685d556e8acd713bd7408b6ab6015006b582 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_testbuffer.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2629e364fe78ad7e417501341aee04fbc91f1a8ed6a6d6129490661b4f345cdc +size 211528 diff --git a/miniconda3/lib/python3.13/lib-dynload/_testcapi.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_testcapi.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..2300e2afb8046958e5b04112bfd1116d3f9654aa --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_testcapi.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06ea856d477f0c443b6ccd52d5aab5cd0e6ad341de0bfd7241605d0888195047 +size 1207992 diff --git a/miniconda3/lib/python3.13/lib-dynload/_testclinic.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_testclinic.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..0d473d2a5a6d1801e8444093841105f37269c4df --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_testclinic.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a369256b0fe0c4454b4bd1ce0d215db6e384bed8a5a80a6b85071b4c1b6a2384 +size 501176 diff --git a/miniconda3/lib/python3.13/lib-dynload/_testinternalcapi.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_testinternalcapi.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..3b5c4b67c3f49a1cdda5c80e487979b6372d70e3 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_testinternalcapi.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1b7a2ae2d20d69672b700e32b11839620d2413623af26af8ac5f81b7b27c480 +size 430488 diff --git a/miniconda3/lib/python3.13/lib-dynload/_testlimitedcapi.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_testlimitedcapi.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..ef98bbef71ac1b853a4bf2b4bd152af3f8c45897 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_testlimitedcapi.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8df707975fa10030a994e6ccb73f8711ae81ef76408f97d6fe033aef166bd0a +size 709640 diff --git a/miniconda3/lib/python3.13/lib-dynload/_tkinter.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_tkinter.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..4e4632a978a350c903683763f6c9ba03128861fe --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_tkinter.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b46e6a9b5c41e93790fabb50d0bd0d5d0beb1a4c53bfd8f301f936e886e77baf +size 324352 diff --git a/miniconda3/lib/python3.13/lib-dynload/_zoneinfo.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/_zoneinfo.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..ab79f7d3839a8615ab9af4309b3e47dc566f843e --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/_zoneinfo.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53cf6bed717c327ce0ca3694c5b0b18cc2d0fdfa020e3a0186262ffce428fbc0 +size 263616 diff --git a/miniconda3/lib/python3.13/lib-dynload/array.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/array.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..5b75f75778fb23e5744f8115d9c03ab3b6902f5c --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/array.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7566ee387561ea61ff83381eda0df9f044d1cd4bf183252337757c0cdaeecca +size 268200 diff --git a/miniconda3/lib/python3.13/lib-dynload/binascii.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/binascii.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..8212f485e246daf67252f58604a0c1fca44498ef --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/binascii.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:761de4c45331416a8b12ea77eced4f27548338fa6c50f4750368255f17589b02 +size 193976 diff --git a/miniconda3/lib/python3.13/lib-dynload/cmath.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/cmath.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..1cd3ad3ecb66117f6283767cb380bbb1ba5286c2 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/cmath.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b83228fb47e0e308e3fd57dd597573addfe2ab2e4e94bd275d0a14bb3a3f6da0 +size 166576 diff --git a/miniconda3/lib/python3.13/lib-dynload/math.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/math.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..404562a6e0f9d4b2379ac8fccbcde6e68604e79e --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/math.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a344cfb66bccab084cc36c14e23a62b23d041cbeea7f414e410c9e4ba03e0c81 +size 390648 diff --git a/miniconda3/lib/python3.13/lib-dynload/mmap.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/mmap.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..3f44666f46f0c768f47fe9f50737d48f2dbad7f4 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/mmap.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f76d37f3d011c68da3aeb6416bafe62f57782946f2413b94120ee1eec5b690ff +size 193208 diff --git a/miniconda3/lib/python3.13/lib-dynload/pyexpat.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/pyexpat.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..ee9dce48ee39f5f1eec556de5299d06dec581323 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/pyexpat.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4647320d007cfced69ff80e3c7c3ae81d63f37d9e446d63cd2b73c4fd9bc502f +size 334320 diff --git a/miniconda3/lib/python3.13/lib-dynload/readline.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/readline.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..10e0a28744c35c4f3f95cffe34b8672dfe456820 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/readline.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e802adf9efbd79e39d91b76bff82ac718d4be834578037acc7d46f1b2388af2 +size 210384 diff --git a/miniconda3/lib/python3.13/lib-dynload/select.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/select.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..cc13e5a39b0d72612c7940af5acad4de7407a0a5 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/select.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb57a6cb7288fd5ef8c70965c43629ce5cb5bc4e2907f2845983691928f6a7b7 +size 211912 diff --git a/miniconda3/lib/python3.13/lib-dynload/syslog.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/syslog.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..1bd6eea2f04d3471eba3a65fc89da008ccf56b21 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/syslog.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c9c1db955ad910871f687b51a78a35db535d3a6357a168d36eb7f9d1138f620 +size 147984 diff --git a/miniconda3/lib/python3.13/lib-dynload/unicodedata.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/unicodedata.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..7ccc8924e10787918b3af223815c22a0b2e3fde6 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/unicodedata.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff91c0bd712ee04ec887e5899b633a5b16290ccb296a096a911164e51af0286b +size 818104 diff --git a/miniconda3/lib/python3.13/lib-dynload/zlib.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/lib-dynload/zlib.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..cbf26b09da9a96f732b6a1f490a7ec86067942b3 --- /dev/null +++ b/miniconda3/lib/python3.13/lib-dynload/zlib.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19a2df0de1659c098ddc0f636788aaf29c78b74fe670f1a67afef9780cf4a0b6 +size 165360 diff --git a/miniconda3/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..9fc6d75eb22fe4922050ce155d46b7b5076a3b7e --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55fdf0fed14c5689a1a22da73f1e4f685d995c5c62dd18eabaf8058fe6da4093 +size 224152 diff --git a/miniconda3/lib/python3.13/site-packages/_ruamel_yaml.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/site-packages/_ruamel_yaml.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..f8655979003b215126183751f7210a9edd0301cf --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/_ruamel_yaml.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee449f85f308e5b5296f1f9601dee1c3febffccc443150e835f105fc9ddc547e +size 395376 diff --git a/miniconda3/lib/python3.13/site-packages/brotlicffi/_brotlicffi.abi3.so b/miniconda3/lib/python3.13/site-packages/brotlicffi/_brotlicffi.abi3.so new file mode 100644 index 0000000000000000000000000000000000000000..c932cef7eefca9bce480ce19efec685e010ff7b5 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/brotlicffi/_brotlicffi.abi3.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:127085fae8f4a7d5a50754018518e4e67e6feb931920fd85fa14ed2fe0d11783 +size 899376 diff --git a/miniconda3/lib/python3.13/site-packages/conda/shell/conda_icon.ico b/miniconda3/lib/python3.13/site-packages/conda/shell/conda_icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..89de64788e2ee81549bed65c6de68f93903a7bec --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/conda/shell/conda_icon.ico @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39d850d516920fce197442d64558344f1b0f69c0db6b207b9fa0421730f54901 +size 126355 diff --git a/miniconda3/lib/python3.13/site-packages/cryptography/hazmat/bindings/_rust.abi3.so b/miniconda3/lib/python3.13/site-packages/cryptography/hazmat/bindings/_rust.abi3.so new file mode 100644 index 0000000000000000000000000000000000000000..209a555a7fd5b81ca2b98e084fdac93ddee028d1 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/cryptography/hazmat/bindings/_rust.abi3.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6301e6a079fcf84855778382e3924da3a008e70055a4c984a8d933cd2ce43da +size 5194896 diff --git a/miniconda3/lib/python3.13/site-packages/distutils-precedence.pth b/miniconda3/lib/python3.13/site-packages/distutils-precedence.pth new file mode 100644 index 0000000000000000000000000000000000000000..c659194195f07bd6f19b5522515551309af14a3d --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/distutils-precedence.pth @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2638ce9e2500e572a5e0de7faed6661eb569d1b696fcba07b0dd223da5f5d224 +size 151 diff --git a/miniconda3/lib/python3.13/site-packages/libmambapy/bindings.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/site-packages/libmambapy/bindings.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..8947b313c39aa8672b0f6c0e5e7f62280e201181 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/libmambapy/bindings.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b76882704b7e0697f075adb418c83b585bbb56666fc1765e937990f8a72529bd +size 2628304 diff --git a/miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_arm64 b/miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_arm64 new file mode 100644 index 0000000000000000000000000000000000000000..082b0e495b9bf965484d0d96b7eb75a4f6a2611a --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_arm64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b698d34ebc702ddfcdcc6f1fc4d3c18109b220a48b363fdb5eafc2436e6a495 +size 112012 diff --git a/miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_x86_64 b/miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_x86_64 new file mode 100644 index 0000000000000000000000000000000000000000..d3871a3233128a3a3ba94bdf46ac187a7f0da1f3 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/menuinst/data/appkit_launcher_x86_64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:579e20340ab76800c92d28a1f49c34074abf51a8baf71e38a3faefc89bc666ed +size 100192 diff --git a/miniconda3/lib/python3.13/site-packages/msgpack/_cmsgpack.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/site-packages/msgpack/_cmsgpack.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..e0af8b0b1ec9334809d007e83aa0fb5427ac2526 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/msgpack/_cmsgpack.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1acd85dc8e06a5563f62eb2aed2954cc7047dd43933e10d9fa41f19ae86d9f5 +size 210336 diff --git a/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe new file mode 100644 index 0000000000000000000000000000000000000000..4c236ed0ab8253ceee9276ddc3cf5ed9a7ea6a4c --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebc4c06b7d95e74e315419ee7e88e1d0f71e9e9477538c00a93a9ff8c66a6cfc +size 182784 diff --git a/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe new file mode 100644 index 0000000000000000000000000000000000000000..3fd3d2df6541617229f21bdbb49fbbfc880b7f50 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81a618f21cb87db9076134e70388b6e9cb7c2106739011b6a51772d22cae06b7 +size 108032 diff --git a/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe new file mode 100644 index 0000000000000000000000000000000000000000..bc02472528a32bd70ebfa2b0eca26e34a83fa264 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5dc9884a8f458371550e09bd396e5418bf375820a31b9899f6499bf391c7b2e +size 168448 diff --git a/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe new file mode 100644 index 0000000000000000000000000000000000000000..daebd1c30353b2d9b016069da83ad5b4c8ee86bd --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a319ffaba23a017d7b1e18ba726ba6c54c53d6446db55f92af53c279894f8ad +size 101888 diff --git a/miniconda3/lib/python3.13/site-packages/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip b/miniconda3/lib/python3.13/site-packages/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip new file mode 100644 index 0000000000000000000000000000000000000000..400905eecf0385de4d3b8e50b9892e1302b2b894 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01845c437f4655e3cf9cc4fc4e49cfd607431f22675e1b611129a90239f34822 +size 1809 diff --git a/miniconda3/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..c53f0a5c537dc9f0190394bb614a380a61d30b92 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8f9f965cd65f50a7392a7ec6ad98202c24ec96460cf409b3d5013655746f612 +size 5337152 diff --git a/miniconda3/lib/python3.13/site-packages/zstandard/_cffi.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/site-packages/zstandard/_cffi.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..372b96a61d6febd77cce96aa5d473f41732e1ff1 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/zstandard/_cffi.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b727e73927bc3b07d3c8aa5e726ce6ea0ff51d1c2e8c27c3d77f1a2aa30659b +size 952432 diff --git a/miniconda3/lib/python3.13/site-packages/zstandard/backend_c.cpython-313-x86_64-linux-gnu.so b/miniconda3/lib/python3.13/site-packages/zstandard/backend_c.cpython-313-x86_64-linux-gnu.so new file mode 100644 index 0000000000000000000000000000000000000000..6e395e066c9dafd45d487d27d7abd397ba4e6e11 --- /dev/null +++ b/miniconda3/lib/python3.13/site-packages/zstandard/backend_c.cpython-313-x86_64-linux-gnu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a78336d2580fdafb3af6c929b0dcb47019d9f451839adf9d5b57ac24d28dba0 +size 145176 diff --git a/miniconda3/lib/sqlite3.45.3/libsqlite3.45.3.so b/miniconda3/lib/sqlite3.45.3/libsqlite3.45.3.so new file mode 100644 index 0000000000000000000000000000000000000000..1b6cfe0ef88c85b927c920025782ed7794cf7305 --- /dev/null +++ b/miniconda3/lib/sqlite3.45.3/libsqlite3.45.3.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2700af09320a58e113e33aa1af72ff2d3d4ff3b52c1d57bb5c8fafe80a1829f +size 1623720 diff --git a/miniconda3/lib/tk8.6/demos/images/earth.gif b/miniconda3/lib/tk8.6/demos/images/earth.gif new file mode 100644 index 0000000000000000000000000000000000000000..4261c334b50676b1528252b6ecbb29a5e322c469 --- /dev/null +++ b/miniconda3/lib/tk8.6/demos/images/earth.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf29c94949f125a04fee6bdf93ba8f358f26e9e39aa7a4977466834b3133fcb7 +size 51559 diff --git a/miniconda3/lib/tk8.6/demos/images/earthmenu.png b/miniconda3/lib/tk8.6/demos/images/earthmenu.png new file mode 100644 index 0000000000000000000000000000000000000000..5e8870f9cb699c1f8fe06cf091be65c5549fbe4e --- /dev/null +++ b/miniconda3/lib/tk8.6/demos/images/earthmenu.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bf8d96016039d7fdb2ffc506743724636a70ed5925199aab64ca20820963bde +size 8157 diff --git a/miniconda3/lib/tk8.6/demos/images/earthris.gif b/miniconda3/lib/tk8.6/demos/images/earthris.gif new file mode 100644 index 0000000000000000000000000000000000000000..a104d736b72a048dd959acf484cda77ac58aa84b --- /dev/null +++ b/miniconda3/lib/tk8.6/demos/images/earthris.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2da473e55d8317bd1f983638adb729bff1461de590d76f99d8b3430c71e0f6e +size 6343 diff --git a/miniconda3/lib/tk8.6/demos/images/ouster.png b/miniconda3/lib/tk8.6/demos/images/ouster.png new file mode 100644 index 0000000000000000000000000000000000000000..9063c076c2df8672404ca52bbe9fac6160163438 --- /dev/null +++ b/miniconda3/lib/tk8.6/demos/images/ouster.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2fe354dfcb09b9eeb488128f4ac0b498766faf4a8becf65bbcd779bdb9c4c8f +size 54257 diff --git a/miniconda3/lib/tk8.6/demos/images/tcllogo.gif b/miniconda3/lib/tk8.6/demos/images/tcllogo.gif new file mode 100644 index 0000000000000000000000000000000000000000..1594bc2df6786ff7e444f5eddb3bdc298d5f260d --- /dev/null +++ b/miniconda3/lib/tk8.6/demos/images/tcllogo.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72f6b34d3c8f424ff0a290a793fcfbf34fd5630a916cd02e0a5dda0144b5957f +size 2341 diff --git a/miniconda3/lib/tk8.6/demos/images/teapot.ppm b/miniconda3/lib/tk8.6/demos/images/teapot.ppm new file mode 100644 index 0000000000000000000000000000000000000000..59307eb96ee451f7682034add2d2737673ef04c2 --- /dev/null +++ b/miniconda3/lib/tk8.6/demos/images/teapot.ppm @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:786f29b88771e439187dd2e86ad4d255dd185e0c1ea3f8c37d21770fd1df253a +size 196623 diff --git a/miniconda3/lib/tk8.6/images/logo100.gif b/miniconda3/lib/tk8.6/images/logo100.gif new file mode 100644 index 0000000000000000000000000000000000000000..1594bc2df6786ff7e444f5eddb3bdc298d5f260d --- /dev/null +++ b/miniconda3/lib/tk8.6/images/logo100.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72f6b34d3c8f424ff0a290a793fcfbf34fd5630a916cd02e0a5dda0144b5957f +size 2341 diff --git a/miniconda3/lib/tk8.6/images/logo64.gif b/miniconda3/lib/tk8.6/images/logo64.gif new file mode 100644 index 0000000000000000000000000000000000000000..1401554ec80451603fbf50973d2ed612e415cc4f --- /dev/null +++ b/miniconda3/lib/tk8.6/images/logo64.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:138c240382304f350383b02ed56c69103a9431c0544eb1ec5dcd7dec7a555dd9 +size 1670 diff --git a/miniconda3/lib/tk8.6/images/logoLarge.gif b/miniconda3/lib/tk8.6/images/logoLarge.gif new file mode 100644 index 0000000000000000000000000000000000000000..b41b8a09800766fa7b915c0f825d79929196c253 --- /dev/null +++ b/miniconda3/lib/tk8.6/images/logoLarge.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f404764d07a6ae2ef9e1e0e8eaac278b7d488d61cf1c084146f2f33b485f2ed +size 11000 diff --git a/miniconda3/lib/tk8.6/images/logoMed.gif b/miniconda3/lib/tk8.6/images/logoMed.gif new file mode 100644 index 0000000000000000000000000000000000000000..d55684babccf7e0be627fbddd3acdaac970a88fd --- /dev/null +++ b/miniconda3/lib/tk8.6/images/logoMed.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d0bd3228ab4cc3e5159f4337be969ec7b7334e265c99b7633e3daf3c3fcfb62 +size 3889 diff --git a/miniconda3/lib/tk8.6/images/pwrdLogo100.gif b/miniconda3/lib/tk8.6/images/pwrdLogo100.gif new file mode 100644 index 0000000000000000000000000000000000000000..fc42b0335005a22bd368352017a9d84045745120 --- /dev/null +++ b/miniconda3/lib/tk8.6/images/pwrdLogo100.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcc0e6458249433e8cba6c58122b7c0efa9557cbc8fb5f9392eed5d2579fc70b +size 1615 diff --git a/miniconda3/lib/tk8.6/images/pwrdLogo150.gif b/miniconda3/lib/tk8.6/images/pwrdLogo150.gif new file mode 100644 index 0000000000000000000000000000000000000000..e8eb2d43ff9648869a6e77cd691cef3e0b44d72e --- /dev/null +++ b/miniconda3/lib/tk8.6/images/pwrdLogo150.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fc25c30aee76477f1c4e922931cc806823df059525583ff5705705d9e913c1c +size 2489 diff --git a/miniconda3/lib/tk8.6/images/pwrdLogo175.gif b/miniconda3/lib/tk8.6/images/pwrdLogo175.gif new file mode 100644 index 0000000000000000000000000000000000000000..7e90f13b82f54a4c5388cc71ccd8bc0ffea375fe --- /dev/null +++ b/miniconda3/lib/tk8.6/images/pwrdLogo175.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62866e95501c436b329a15432355743c6efd64a37cfb65bcece465ab63ecf240 +size 2981 diff --git a/miniconda3/lib/tk8.6/images/pwrdLogo200.gif b/miniconda3/lib/tk8.6/images/pwrdLogo200.gif new file mode 100644 index 0000000000000000000000000000000000000000..64fc3bbb41fa399ea8bc12b720934b3efd9a2f29 --- /dev/null +++ b/miniconda3/lib/tk8.6/images/pwrdLogo200.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bad9116386343f4a4c394bdb87146e49f674f687d52bb847bd9e8198fda382cc +size 3491 diff --git a/miniconda3/lib/tk8.6/images/pwrdLogo75.gif b/miniconda3/lib/tk8.6/images/pwrdLogo75.gif new file mode 100644 index 0000000000000000000000000000000000000000..5247cb56c953663cd5608a6a19c78475b6b9a4c4 --- /dev/null +++ b/miniconda3/lib/tk8.6/images/pwrdLogo75.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:462a8ff8fd051a8100e8c6c086f497e4056ace5b20b44791f4aab964b010a448 +size 1171 diff --git a/miniconda3/lib/tk8.6/images/tai-ku.gif b/miniconda3/lib/tk8.6/images/tai-ku.gif new file mode 100644 index 0000000000000000000000000000000000000000..57fe342da7b1602baf6bde52c87a6a0e14f86d75 --- /dev/null +++ b/miniconda3/lib/tk8.6/images/tai-ku.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e538f8f4934ca6e1ce29416d292171f28e67da6c72ed9d236ba42f37445ea41e +size 5473 diff --git a/miniconda3/libexec/dbus-daemon-launch-helper b/miniconda3/libexec/dbus-daemon-launch-helper new file mode 100644 index 0000000000000000000000000000000000000000..bc1076cd6914335001e4010f478901210dd0a9c4 --- /dev/null +++ b/miniconda3/libexec/dbus-daemon-launch-helper @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ffdd03b274f7d2c3c182a430386461314f55df3affa6920a4dcd2440e4eaba03 +size 206880 diff --git a/miniconda3/pkgs/anaconda-auth-0.13.0-py313h06a4308_0.conda b/miniconda3/pkgs/anaconda-auth-0.13.0-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..cb4a4136f716fb9931024f40fe084692354a15e9 --- /dev/null +++ b/miniconda3/pkgs/anaconda-auth-0.13.0-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65e1eb7ca1260fe9e4bf6d7938e7d77f2f55a842ea668a184af80acad235423d +size 123443 diff --git a/miniconda3/pkgs/anyio-4.10.0-py313h06a4308_0.conda b/miniconda3/pkgs/anyio-4.10.0-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..6186b4b2a5a2e103c5ed1c6cadb50e90566eed02 --- /dev/null +++ b/miniconda3/pkgs/anyio-4.10.0-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcc15a749625218b77cd38622128edb7177d1579d919aaefce5244edae109ba6 +size 299196 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/recipe/meta.yaml b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/recipe/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6a452f7f17380c71e319186177466b546bd6e890 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/recipe/meta.yaml @@ -0,0 +1,81 @@ +# This file created by conda-build 25.1.2 +# meta.yaml template originally from: +# /home/task_175812491784513/archspec-feedstock/recipe, last modified Wed Sep 17 16:02:17 2025 +# ------------------------------------------------ + +package: + name: archspec + version: 0.2.5 +source: + sha256: 5bec8dfc5366ff299071200466dc9572d56db4e43abca3c66bdd62bc2b731a2a + url: https://pypi.io/packages/source/a/archspec/archspec-0.2.5.tar.gz +build: + entry_points: + - archspec = archspec.cli:main + noarch: python + number: '0' + script: /home/task_175812491784513/conda-bld/archspec_1758124989039/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/bin/python + -m pip install . -vv --no-deps --no-build-isolation + string: pyhd3eb1b0_0 +requirements: + host: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - bzip2 1.0.8 h5eee18b_6 + - ca-certificates 2025.9.9 h06a4308_0 + - expat 2.7.1 h6a678d5_0 + - ld_impl_linux-64 2.40 h12ee557_0 + - libffi 3.4.4 h6a678d5_1 + - libgcc-ng 11.2.0 h1234567_1 + - libgomp 11.2.0 h1234567_1 + - libmpdec 4.0.0 h5eee18b_0 + - libstdcxx-ng 11.2.0 h1234567_1 + - libuuid 1.41.5 h5eee18b_0 + - libxcb 1.17.0 h9b100fa_0 + - libzlib 1.3.1 hb25bd0a_0 + - ncurses 6.5 h7934f7d_0 + - openssl 3.0.17 h5eee18b_0 + - pip 25.2 pyhc872135_0 + - poetry-core 2.2.0 py313h06a4308_0 + - pthread-stubs 0.3 h0ce48e5_1 + - python 3.13.7 h7e8bc2b_100_cp313 + - python_abi 3.13 1_cp313 + - readline 8.3 hc2a1206_0 + - setuptools 78.1.1 py313h06a4308_0 + - sqlite 3.50.2 hb25bd0a_1 + - tk 8.6.15 h54e0aa7_0 + - tzdata 2025b h04d1e81_0 + - wheel 0.45.1 py313h06a4308_0 + - xorg-libx11 1.8.12 h9b100fa_1 + - xorg-libxau 1.0.12 h9b100fa_0 + - xorg-libxdmcp 1.1.5 h9b100fa_0 + - xorg-xorgproto 2024.1 h5eee18b_1 + - xz 5.6.4 h5eee18b_1 + - zlib 1.3.1 hb25bd0a_0 + run: + - python >=3.7 +test: + commands: + - pip check + - archspec --help + imports: + - archspec + - archspec.cpu + requires: + - pip +about: + description: A library to query system architecture + dev_url: https://github.com/archspec/archspec/ + doc_url: https://archspec.readthedocs.io/ + home: https://pypi.org/project/archspec/ + license: MIT OR Apache-2.0 + license_file: + - LICENSE-APACHE + - LICENSE-MIT + summary: A library to query system architecture +extra: + copy_test_source_files: true + final: true + recipe-maintainers: + - anthchirp + - isuruf diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/recipe/meta.yaml.template b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/recipe/meta.yaml.template new file mode 100644 index 0000000000000000000000000000000000000000..1b251d66986792a9b82efe091bef41b19231af91 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/recipe/meta.yaml.template @@ -0,0 +1,53 @@ +{% set name = "archspec" %} +{% set version = "0.2.5" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/archspec-{{ version }}.tar.gz + sha256: 5bec8dfc5366ff299071200466dc9572d56db4e43abca3c66bdd62bc2b731a2a + +build: + number: 0 + noarch: python + entry_points: + - archspec = archspec.cli:main + script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation + +requirements: + host: + - pip + - python >=3.7 + - poetry-core + run: + # According to the upstream `pyproject.toml`, python==3.6.15 is also + # supported, but including that here seems more trouble than it's worth. + - python >=3.7 + +test: + imports: + - archspec + - archspec.cpu + commands: + - pip check + - archspec --help + requires: + - pip + +about: + home: https://pypi.org/project/archspec/ + summary: A library to query system architecture + description: A library to query system architecture + license: MIT OR Apache-2.0 + license_file: + - LICENSE-MIT + - LICENSE-APACHE + dev_url: https://github.com/archspec/archspec/ + doc_url: https://archspec.readthedocs.io/ + +extra: + recipe-maintainers: + - anthchirp + - isuruf diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.bat b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.bat new file mode 100644 index 0000000000000000000000000000000000000000..fba3cfda54ca7296f3cebf688198fb6a34cc7e1a --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.bat @@ -0,0 +1,9 @@ + + + + +pip check +IF %ERRORLEVEL% NEQ 0 exit /B 1 +archspec --help +IF %ERRORLEVEL% NEQ 0 exit /B 1 +exit /B 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.py new file mode 100644 index 0000000000000000000000000000000000000000..9c14db9e54d8c6ab28bbca64b1f075a9e7b630c0 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.py @@ -0,0 +1,6 @@ +print("import: 'archspec'") +import archspec + +print("import: 'archspec.cpu'") +import archspec.cpu + diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.sh b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..2fd217f9327166e19e81e31148613f590e5427d4 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/run_test.sh @@ -0,0 +1,9 @@ + + +set -ex + + + +pip check +archspec --help +exit 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/test_time_dependencies.json b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/test_time_dependencies.json new file mode 100644 index 0000000000000000000000000000000000000000..215362c1832b66eb448cdeeadbb1db3470d5adb4 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/info/test/test_time_dependencies.json @@ -0,0 +1 @@ +["pip"] \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/INSTALLER b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..f79e4cb9aaf0b2d9e8ba78861e2071317b2384b3 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/INSTALLER @@ -0,0 +1 @@ +conda \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/METADATA b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..499927d778be66a399ff512b866409c4ba7a7c8c --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/METADATA @@ -0,0 +1,123 @@ +Metadata-Version: 2.4 +Name: archspec +Version: 0.2.5 +Summary: A library to query system architecture +License: Apache-2.0 OR MIT +License-File: LICENSE-APACHE +License-File: LICENSE-MIT +License-File: NOTICE +Author: archspec developers +Author-email: maintainers@spack.io +Maintainer: Greg Becker +Maintainer-email: maintainers@spack.io +Requires-Python: >=3.6, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.* +Classifier: Development Status :: 3 - Alpha +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Information Technology +Classifier: Intended Audience :: Science/Research +Classifier: License :: Other/Proprietary License +Classifier: Operating System :: MacOS +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: Unix +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Project-URL: Documentation, https://archspec.readthedocs.io +Project-URL: Homepage, https://github.com/archspec/archspec +Project-URL: Repository, https://github.com/archspec/archspec.git +Description-Content-Type: text/markdown + +# Archspec (Python bindings) + +[![CI](https://github.com/archspec/archspec/workflows/Unit%20tests/badge.svg)](https://github.com/archspec/archspec/actions) +[![CodeCov](https://codecov.io/gh/archspec/archspec/branch/master/graph/badge.svg)](https://codecov.io/gh/archspec/archspec) +[![Documentation Status](https://readthedocs.org/projects/archspec/badge/?version=latest)](https://archspec.readthedocs.io/en/latest/?badge=latest) + +Archspec aims at providing a standard set of human-understandable labels for +various aspects of a system architecture like CPU, network fabrics, etc. and +APIs to detect, query and compare them. + +This project grew out of [Spack](https://spack.io/) and is currently under +active development. At present it supports APIs to detect and model +compatibility relationships among different CPU microarchitectures. + +## Getting started with development + +The `archspec` Python package needs [poetry](https://python-poetry.org/) to +be installed from VCS sources. The preferred method to install it is via +its custom installer outside of any virtual environment: + +```console +curl -sSL https://install.python-poetry.org | python3 - +``` + +You can refer to [Poetry's documentation](https://python-poetry.org/docs/#installation) +for further details or for other methods to install this tool. You'll also need `tox` +to run unit test: + +```console +pip install --user tox +``` + +Finally, you'll need to clone the repository: + +```console +git clone --recursive https://github.com/archspec/archspec.git +``` + +### Running unit tests + +Once you have your environment ready you can run `archspec` unit tests +using ``tox`` from the root of the repository: + +```console +$ tox + [ ... ] + py27: commands succeeded + py35: commands succeeded + py36: commands succeeded + py37: commands succeeded + py38: commands succeeded + pylint: commands succeeded + flake8: commands succeeded + black: commands succeeded + congratulations :) +``` + +## Citing Archspec + +If you are referencing `archspec` in a publication, please cite the following +paper: + +* Massimiliano Culpo, Gregory Becker, Carlos Eduardo Arango Gutierrez, Kenneth + Hoste, and Todd Gamblin. + [**`archspec`: A library for detecting, labeling, and reasoning about + microarchitectures**](https://tgamblin.github.io/pubs/archspec-canopie-hpc-2020.pdf). + In *2nd International Workshop on Containers and New Orchestration Paradigms + for Isolated Environments in HPC (CANOPIE-HPC'20)*, Online Event, November + 12, 2020. + +## License + +Archspec is distributed under the terms of both the MIT license and the +Apache License (Version 2.0). Users may choose either license, at their +option. + +All new contributions must be made under both the MIT and Apache-2.0 +licenses. + +See [LICENSE-MIT](https://github.com/archspec/archspec/blob/master/LICENSE-MIT), +[LICENSE-APACHE](https://github.com/archspec/archspec/blob/master/LICENSE-APACHE), +[COPYRIGHT](https://github.com/archspec/archspec/blob/master/COPYRIGHT), and +[NOTICE](https://github.com/archspec/archspec/blob/master/NOTICE) for details. + +SPDX-License-Identifier: (Apache-2.0 OR MIT) + +LLNL-CODE-811653 + diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/RECORD b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..f75096c401fa947de902b18930f9f2b5ca819262 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/RECORD @@ -0,0 +1,88 @@ +../../../bin/archspec,sha256=GF-Fy76-9whVsvLe1qu63xMH8EWOcvd65f29nRJUgZc,467 +archspec-0.2.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +archspec-0.2.5.dist-info/METADATA,sha256=Rsa-lHKler8MX_jhHwyafwQu95u8tA0gqBBneIocKJ4,4565 +archspec-0.2.5.dist-info/RECORD,, +archspec-0.2.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +archspec-0.2.5.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88 +archspec-0.2.5.dist-info/direct_url.json,sha256=tEankn611kBkC1j5rz91rAIMmzz4mcUiVeCbDiiHDmw,98 +archspec-0.2.5.dist-info/entry_points.txt,sha256=v6umiu5eQSD6088Viyvkjlc1WVSHKK0LADMa7rMpNm4,46 +archspec-0.2.5.dist-info/licenses/LICENSE-APACHE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358 +archspec-0.2.5.dist-info/licenses/LICENSE-MIT,sha256=kAGtmaZiB1oOWmqaU5_HUEDYBjw_clHWg5ykC1I0BU4,1171 +archspec-0.2.5.dist-info/licenses/NOTICE,sha256=9CR93geVKl_4ZrJORbXN0fzkEM2y4DglWhY1hn9ZwQw,1167 +archspec/__init__.py,sha256=l_vGH4wKXB5bmg7ZqNh-xA8EVUkpJpAS5l7V07ic0kE,67 +archspec/__main__.py,sha256=lZu3C2P9FbOlE5GBeoSTqgdPycvcQcL7N8ihsdZGXYM,97 +archspec/__pycache__/__init__.cpython-313.pyc,, +archspec/__pycache__/__main__.cpython-313.pyc,, +archspec/__pycache__/cli.cpython-313.pyc,, +archspec/cli.py,sha256=qgqXH-9b1bbssm00LOQmeiZkTuZJIgymXwAbtCDVk9Y,1691 +archspec/cpu/__init__.py,sha256=OEkFUxPe0veRJL2bd4kYwzE8fJ8_V9UAtMB2bEyAVsM,727 +archspec/cpu/__pycache__/__init__.cpython-313.pyc,, +archspec/cpu/__pycache__/alias.cpython-313.pyc,, +archspec/cpu/__pycache__/detect.cpython-313.pyc,, +archspec/cpu/__pycache__/microarchitecture.cpython-313.pyc,, +archspec/cpu/__pycache__/schema.cpython-313.pyc,, +archspec/cpu/alias.py,sha256=GrJPaWX6-FtoepF3z2G8RwikaB-_slHVT54yFQtOLU0,2506 +archspec/cpu/detect.py,sha256=zId1RmKtEk3658M3SVD1_xED_9UsKRIWMTsOS5Ei5hw,16302 +archspec/cpu/microarchitecture.py,sha256=I_XqoIumN4lnMb61x_PQEsIVEIndsvET4md5sI7jEJE,15210 +archspec/cpu/schema.py,sha256=8CnUUDGzXaaGqbhSOQCTYT3wfoFLj4qFvFeedBtE5bM,3687 +archspec/json/COPYRIGHT,sha256=nXDFqDfvpi337jffHHDd_8C7OOON8p3f3PoBRiQHzfs,805 +archspec/json/LICENSE-APACHE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358 +archspec/json/LICENSE-MIT,sha256=kAGtmaZiB1oOWmqaU5_HUEDYBjw_clHWg5ykC1I0BU4,1171 +archspec/json/NOTICE,sha256=9CR93geVKl_4ZrJORbXN0fzkEM2y4DglWhY1hn9ZwQw,1167 +archspec/json/README.md,sha256=izG7TOmPb760cBmVawnPszxUtBlyyvHmKoxFrf3fK-g,1531 +archspec/json/cpu/cpuid.json,sha256=gAWR57GoganHupdZX57v2CwXLVohSkx2hxkFL_r0-O0,20572 +archspec/json/cpu/cpuid_schema.json,sha256=wIHbIUMywtjeBnZHGwL2g62sbagp6wrONj2x9y36pzg,3129 +archspec/json/cpu/microarchitectures.json,sha256=upWYxLbsThV_YJQ5GPXXAL6d0VD6ytPW-WVqBIKU2YM,85601 +archspec/json/cpu/microarchitectures_schema.json,sha256=EkHYbWfHs2k765QYU2gsoExocV_k9xt-_3LqAsGqhpU,3025 +archspec/json/tests/targets/bgq-rhel6-power7,sha256=78gpbVDtmaehxm-I53_JD9_tYr8mkDJfUD9dA95akFg,116 +archspec/json/tests/targets/darwin-bigsur-m1,sha256=ccXDP4oGNbOtTA16Zl9ntuh5R5JqnBlvZQT6m3U44Tw,534 +archspec/json/tests/targets/darwin-mojave-haswell,sha256=x2dqKo4PYyQjA4O29lmGSuJuvbPwsT4LHYt60Pt0_sM,553 +archspec/json/tests/targets/darwin-mojave-ivybridge,sha256=YEUVaxRSZmNa2Np5DpjAWdFwFG-o82njVKmwQDKVldw,2356 +archspec/json/tests/targets/darwin-mojave-skylake,sha256=Hemmh6M0BvHs04nu2NELy20COML_94G1zH4bAumU_dg,598 +archspec/json/tests/targets/darwin-monterey-m1,sha256=WSG9O446Q_SSD9vHuYj1SaI2zA6DhGtF3UU20xbnZ9s,3307 +archspec/json/tests/targets/darwin-monterey-m2,sha256=ExCs3mYsAb3Lt6ZXDLI1pam9WrEfDNVhodphfVA7K6w,3307 +archspec/json/tests/targets/linux-amazon-cortex_a72,sha256=P7YAipvudlo2U1PvUa01dDR2HKQURPeB2PHNu7kHRes,221 +archspec/json/tests/targets/linux-amazon-neoverse_n1,sha256=zvHJOqLzHf4cTscllomBX2iSZNK45MiZ0z2jJ9AeDqk,276 +archspec/json/tests/targets/linux-amazon-neoverse_v1,sha256=2RsWvKEIyHxVQunBRg_X71rdvq2dhPKRhKcsYdWb824,361 +archspec/json/tests/targets/linux-amazon2-sapphirerapids,sha256=aRgatOvQJqJKnI62YC6FCuHxiMWtnwmba20_Ko0XI-k,1519 +archspec/json/tests/targets/linux-asahi-m1,sha256=hKEOlbpmkV41_18D-XMig8TZV2FiZJLnBjYwZtpNrIQ,363 +archspec/json/tests/targets/linux-asahi-m2,sha256=SKEtv3AhM-Zzzyr94GFirrF5UJKJTOOZqK33KulaBiI,381 +archspec/json/tests/targets/linux-centos7-cascadelake,sha256=YYdo8G0bP85bn4dGdWePNDthEtAhhjKVRSXs3M7Yjg8,1408 +archspec/json/tests/targets/linux-centos7-power8le,sha256=KgkGSkHLpk2vP4j0W3m7iHe559f-pxa2riWtAkIMRxo,111 +archspec/json/tests/targets/linux-centos7-thunderx2,sha256=K8xsnq3W7EC-PXv5j3MsGrauowOARGOKj3_7-oOsNJI,238 +archspec/json/tests/targets/linux-rhel6-piledriver,sha256=3YnQpTBgBi7FZtSCrJjAgx9DjFe92-sYoVJAprMBK_o,1411 +archspec/json/tests/targets/linux-rhel7-broadwell,sha256=HBWEiyE2uKDYRS3C0rKspIb_5QypY5fs94NHEDSaPL0,1187 +archspec/json/tests/targets/linux-rhel7-haswell,sha256=kq2qku54qPic_q-CnOw-RUj1nXTG6sZHBUDMhMyZz9g,1095 +archspec/json/tests/targets/linux-rhel7-ivybridge,sha256=PC1NLw9ATBrCN7zHQszxbvHVvMHL1xUFpV1on94UM6Q,1009 +archspec/json/tests/targets/linux-rhel7-skylake_avx512,sha256=3FI8aT-6OwBWE15FKoRDzTiz5BXqXYR5nFNTBg7Y9Qw,1286 +archspec/json/tests/targets/linux-rhel7-x86_64_v3,sha256=D6iKhk9KQlb9qYetPdUBmDVNAVr-hGV297vDHLwe2FM,1172 +archspec/json/tests/targets/linux-rhel7-zen,sha256=icybZCA-bXuasnJHS_qnU0tBpQgjy6-jDRitSC20J1E,1319 +archspec/json/tests/targets/linux-rhel8-neoverse_v1,sha256=gtC-6MNgpPThX_HYYYHEivhqtirB32IlPscVI7kX3D0,351 +archspec/json/tests/targets/linux-rhel8-power9,sha256=Ly0l0wku80CMdizv1UCKEx2Sip9S_0Bd0PTCfQPYHLc,135 +archspec/json/tests/targets/linux-rhel9-neoverse_n2,sha256=tpQ9eG72iCemwazMMW_fGemCgTaSvn3JIUfJW74wyJw,429 +archspec/json/tests/targets/linux-rhel9-neoverse_v2,sha256=XDV98FvAo7RdmI-RpS_ah8pdMWAcmO_sniJ5j1iVIHA,444 +archspec/json/tests/targets/linux-rocky8-a64fx,sha256=rVo-uqYEJnlgPXAhbt-La1W25CR_xfb03rh0t520_1M,256 +archspec/json/tests/targets/linux-rocky8.5-zen4,sha256=y4UDQdOxsg0Hl461XlBD_tPb_TX8EcXV7bwiHQn6zFM,1750 +archspec/json/tests/targets/linux-rocky9-zen5,sha256=_HcNkfT5QjYOl2_55xJA-gd2DFvmhCHOZxK3q63rF5o,1882 +archspec/json/tests/targets/linux-scientific7-k10,sha256=xEhQCc5CIqBWOoe28rvrW-BnjZSkOEBv0gXLQM5yAnE,1111 +archspec/json/tests/targets/linux-scientific7-piledriver,sha256=kKCspg6gamWgMe9h9Mx5hP5O1DXgXOI6iH2B2BfwjDg,1149 +archspec/json/tests/targets/linux-scientificfermi6-bulldozer,sha256=ZmboNqzZEsWWwOwBV_vmrNIi6x1E3E76Uz4Ej15Fu2s,1201 +archspec/json/tests/targets/linux-scientificfermi6-piledriver,sha256=5pVZpVPXtKmqKK1Ps2LmYagCWhWTbjI5co_1QjYjZxI,1099 +archspec/json/tests/targets/linux-sifive-u74mc,sha256=NGnvrcK3VP4qmWk7eZNIAgNED6yvyfcEBasMTmsHgck,124 +archspec/json/tests/targets/linux-ubuntu18.04-broadwell,sha256=Azb3xc9WvgxBvQRNC5m83SJpqr73iLrGSJVJ5s4_zNI,1190 +archspec/json/tests/targets/linux-ubuntu20.04-zen3,sha256=Y7Cws4kwzBlNupQhGl_2woA_1_SWxRqwgzn9NaT3_kg,1531 +archspec/json/tests/targets/linux-ubuntu22.04-neoverse_n2,sha256=TR6C4HX2QRciUAwzaJSfTxL7K427NnC_SlfnUTqxFe4,396 +archspec/json/tests/targets/linux-ubuntu22.04-neoverse_v2,sha256=FrkEGxnf-indDzUhuyxoMLiURAuC-2Wdk5-FYf0pOSg,458 +archspec/json/tests/targets/linux-unknown-neoverse_v2,sha256=hQfDm2tcyRf3-kwhMTUow2aZujxqbVlnzUEjNaxQC3g,447 +archspec/json/tests/targets/linux-unknown-power10,sha256=7ntCWmXGCTJkfZMMB0mIAk7fe2J7NlO11j0kjKkaSUM,83 +archspec/json/tests/targets/linux-unknown-sapphirerapids,sha256=8AAkJoXaLkNhmcMqUp725T_MIWeyxkarU4poi_Zb0YE,2187 +archspec/json/tests/targets/windows-cpuid-broadwell,sha256=ph0TRQor1s33j9IVjtbE6ZD4-wq7iilty2vnVb4UHDk,395 +archspec/json/tests/targets/windows-cpuid-icelake,sha256=b2JlmnPiUF5JBl3jHCmkRPvon9vCE7_s5NjPph5EGrI,432 +archspec/vendor/cpuid/.git,sha256=hrvgEKtXq8SEhWOQXV_vXrt0dSbrahQy_qNQ1j4aswo,52 +archspec/vendor/cpuid/.gitignore,sha256=JRpFSUVfuHv5eFgg3iaMvtq0hO-MNrYKq1pVwlrXp9M,12 +archspec/vendor/cpuid/LICENSE,sha256=DfgRNgMm2fRV3fECBVNI_aDAMYxc06vKr-Kq0rttsu4,1079 +archspec/vendor/cpuid/README.md,sha256=UPKqGnVjslsiGR2GgXJv-twnYdnFnmCF3_t5CLXmY0Q,2400 +archspec/vendor/cpuid/__pycache__/cpuid.cpython-313.pyc,, +archspec/vendor/cpuid/__pycache__/example.cpython-313.pyc,, +archspec/vendor/cpuid/cpuid.py,sha256=hywlKGTKtPXySyJy67d4OLpaQLfwfsPgUvSPdaxanRQ,6037 +archspec/vendor/cpuid/example.py,sha256=g3EUANGuzhu61l6Z-5iLedPEe_vfObKxys-R5qnI6MY,1855 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/REQUESTED b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/WHEEL b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..9f0d68ff7fc3c1ff6da960ed2ffd70dd8ea16896 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: poetry-core 2.2.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/direct_url.json b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/direct_url.json new file mode 100644 index 0000000000000000000000000000000000000000..a6165286c803f9d8801a84db325aa9a341ebc9d5 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/direct_url.json @@ -0,0 +1 @@ +{"dir_info": {}, "url": "file:///home/task_175812491784513/conda-bld/archspec_1758124989039/work"} \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/entry_points.txt b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f3dc153b53f4ca570f5707b5e12f0401d98ec7d --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] +archspec=archspec.cli:main + diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/LICENSE-APACHE b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/LICENSE-APACHE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/LICENSE-MIT b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/LICENSE-MIT new file mode 100644 index 0000000000000000000000000000000000000000..03be635ad5df4567a85180c7a03a54ee96e1ee98 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/LICENSE-MIT @@ -0,0 +1,20 @@ +Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +Archspec Project Developers. See the top-level COPYRIGHT file for details. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/NOTICE b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..3737d5a86ddc20bfd04ce225fff2d34407df06f9 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec-0.2.5.dist-info/licenses/NOTICE @@ -0,0 +1,21 @@ +This work was produced under the auspices of the U.S. Department of +Energy by Lawrence Livermore National Laboratory under Contract +DE-AC52-07NA27344. + +This work was prepared as an account of work sponsored by an agency of +the United States Government. Neither the United States Government nor +Lawrence Livermore National Security, LLC, nor any of their employees +makes any warranty, expressed or implied, or assumes any legal liability +or responsibility for the accuracy, completeness, or usefulness of any +information, apparatus, product, or process disclosed, or represents that +its use would not infringe privately owned rights. + +Reference herein to any specific commercial product, process, or service +by trade name, trademark, manufacturer, or otherwise does not necessarily +constitute or imply its endorsement, recommendation, or favoring by the +United States Government or Lawrence Livermore National Security, LLC. + +The views and opinions of authors expressed herein do not necessarily +state or reflect those of the United States Government or Lawrence +Livermore National Security, LLC, and shall not be used for advertising +or product endorsement purposes. diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/__init__.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2425354e623ab3e58c65ab9aa67e4c7d884053b4 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/__init__.py @@ -0,0 +1,3 @@ +"""Init file to avoid namespace packages""" + +__version__ = "0.2.5" diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/__main__.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..45fbe12704517a629bf56fa10fbb6e32672c9d74 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/__main__.py @@ -0,0 +1,9 @@ +""" +Run the `archspec` CLI as a module. +""" + +import sys + +from .cli import main + +sys.exit(main()) diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cli.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cli.py new file mode 100644 index 0000000000000000000000000000000000000000..eaddaf5d77bef895fc6a6104c0f4b6b16ff83735 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cli.py @@ -0,0 +1,70 @@ +# Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +# Archspec Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +""" +archspec command line interface +""" + +import argparse +import typing + +import archspec +import archspec.cpu + + +def _make_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + "archspec", + description="archspec command line interface", + add_help=False, + ) + parser.add_argument( + "--version", + "-V", + help="Show the version and exit.", + action="version", + version=f"archspec, version {archspec.__version__}", + ) + parser.add_argument("--help", "-h", help="Show the help and exit.", action="help") + + subcommands = parser.add_subparsers( + title="command", + metavar="COMMAND", + dest="command", + ) + + cpu_command = subcommands.add_parser( + "cpu", + help="archspec command line interface for CPU", + description="archspec command line interface for CPU", + ) + cpu_command.set_defaults(run=cpu) + + return parser + + +def cpu() -> int: + """Run the `archspec cpu` subcommand.""" + try: + print(archspec.cpu.host()) + except FileNotFoundError as exc: + print(exc) + return 1 + return 0 + + +def main(argv: typing.Optional[typing.List[str]] = None) -> int: + """Run the `archspec` command line interface.""" + parser = _make_parser() + + try: + args = parser.parse_args(argv) + except SystemExit as err: + return err.code + + if args.command is None: + parser.print_help() + return 0 + + return args.run() diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/__init__.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6fbb43b785db83b1639f8cb9c0b228ab10741eeb --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/__init__.py @@ -0,0 +1,27 @@ +# Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +# Archspec Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +"""The "cpu" package permits to query and compare different +CPU microarchitectures. +""" +from .detect import brand_string, host +from .microarchitecture import ( + TARGETS, + InvalidCompilerVersion, + Microarchitecture, + UnsupportedMicroarchitecture, + generic_microarchitecture, + version_components, +) + +__all__ = [ + "brand_string", + "host", + "TARGETS", + "InvalidCompilerVersion", + "Microarchitecture", + "UnsupportedMicroarchitecture", + "generic_microarchitecture", + "version_components", +] diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/alias.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/alias.py new file mode 100644 index 0000000000000000000000000000000000000000..783a67d3ea9563f05f23ab6cba45ffc7b261aff1 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/alias.py @@ -0,0 +1,87 @@ +# Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +# Archspec Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +"""Aliases for microarchitecture features.""" +from .schema import TARGETS_JSON, LazyDictionary + +_FEATURE_ALIAS_PREDICATE = {} + + +class FeatureAliasTest: + """A test that must be passed for a feature alias to succeed. + + Args: + rules (dict): dictionary of rules to be met. Each key must be a + valid alias predicate + """ + + # pylint: disable=too-few-public-methods + def __init__(self, rules): + self.rules = rules + self.predicates = [] + for name, args in rules.items(): + self.predicates.append(_FEATURE_ALIAS_PREDICATE[name](args)) + + def __call__(self, microarchitecture): + return all(feature_test(microarchitecture) for feature_test in self.predicates) + + +def _feature_aliases(): + """Returns the dictionary of all defined feature aliases.""" + json_data = TARGETS_JSON["feature_aliases"] + aliases = {} + for alias, rules in json_data.items(): + aliases[alias] = FeatureAliasTest(rules) + return aliases + + +FEATURE_ALIASES = LazyDictionary(_feature_aliases) + + +def alias_predicate(func): + """Decorator to register a predicate that can be used to evaluate + feature aliases. + """ + name = func.__name__ + + # Check we didn't register anything else with the same name + if name in _FEATURE_ALIAS_PREDICATE: + msg = f'the alias predicate "{name}" already exists' + raise KeyError(msg) + + _FEATURE_ALIAS_PREDICATE[name] = func + + return func + + +@alias_predicate +def reason(_): + """This predicate returns always True and it's there to allow writing + a documentation string in the JSON file to explain why an alias is needed. + """ + return lambda x: True + + +@alias_predicate +def any_of(list_of_features): + """Returns a predicate that is True if any of the feature in the + list is in the microarchitecture being tested, False otherwise. + """ + + def _impl(microarchitecture): + return any(x in microarchitecture for x in list_of_features) + + return _impl + + +@alias_predicate +def families(list_of_families): + """Returns a predicate that is True if the architecture family of + the microarchitecture being tested is in the list, False otherwise. + """ + + def _impl(microarchitecture): + return str(microarchitecture.family) in list_of_families + + return _impl diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/detect.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/detect.py new file mode 100644 index 0000000000000000000000000000000000000000..f9f095f78a6c05fb42dbe21b0e2515e76fdcd5a7 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/detect.py @@ -0,0 +1,459 @@ +# Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +# Archspec Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +"""Detection of CPU microarchitectures""" +import collections +import os +import platform +import re +import struct +import subprocess +import warnings +from typing import Dict, List, Optional, Set, Tuple, Union + +from ..vendor.cpuid.cpuid import CPUID +from .microarchitecture import TARGETS, Microarchitecture, generic_microarchitecture +from .schema import CPUID_JSON, TARGETS_JSON + +#: Mapping from operating systems to chain of commands +#: to obtain a dictionary of raw info on the current cpu +INFO_FACTORY = collections.defaultdict(list) + +#: Mapping from micro-architecture families (x86_64, ppc64le, etc.) to +#: functions checking the compatibility of the host with a given target +COMPATIBILITY_CHECKS = {} + +# Constants for commonly used architectures +X86_64 = "x86_64" +AARCH64 = "aarch64" +PPC64LE = "ppc64le" +PPC64 = "ppc64" +RISCV64 = "riscv64" + + +def detection(operating_system: str): + """Decorator to mark functions that are meant to return partial information on the current cpu. + + Args: + operating_system: operating system where this function can be used. + """ + + def decorator(factory): + INFO_FACTORY[operating_system].append(factory) + return factory + + return decorator + + +def partial_uarch( + name: str = "", + vendor: str = "", + features: Optional[Set[str]] = None, + generation: int = 0, + cpu_part: str = "", +) -> Microarchitecture: + """Construct a partial microarchitecture, from information gathered during system scan.""" + return Microarchitecture( + name=name, + parents=[], + vendor=vendor, + features=features or set(), + compilers={}, + generation=generation, + cpu_part=cpu_part, + ) + + +@detection(operating_system="Linux") +def proc_cpuinfo() -> Microarchitecture: + """Returns a partial Microarchitecture, obtained from scanning ``/proc/cpuinfo``""" + data = {} + with open("/proc/cpuinfo") as file: # pylint: disable=unspecified-encoding + for line in file: + key, separator, value = line.partition(":") + + # If there's no separator and info was already populated + # according to what's written here: + # + # http://www.linfo.org/proc_cpuinfo.html + # + # we are on a blank line separating two cpus. Exit early as + # we want to read just the first entry in /proc/cpuinfo + if separator != ":" and data: + break + + data[key.strip()] = value.strip() + + architecture = _machine() + if architecture == X86_64: + return partial_uarch( + vendor=data.get("vendor_id", "generic"), features=_feature_set(data, key="flags") + ) + + if architecture == AARCH64: + return partial_uarch( + vendor=_canonicalize_aarch64_vendor(data), + features=_feature_set(data, key="Features"), + cpu_part=data.get("CPU part", ""), + ) + + if architecture in (PPC64LE, PPC64): + generation_match = re.search(r"POWER(\d+)", data.get("cpu", "")) + try: + generation = int(generation_match.group(1)) + except AttributeError: + # There might be no match under emulated environments. For instance + # emulating a ppc64le with QEMU and Docker still reports the host + # /proc/cpuinfo and not a Power + generation = 0 + return partial_uarch(generation=generation) + + if architecture == RISCV64: + if data.get("uarch") == "sifive,u74-mc": + data["uarch"] = "u74mc" + return partial_uarch(name=data.get("uarch", RISCV64)) + + return generic_microarchitecture(architecture) + + +class CpuidInfoCollector: + """Collects the information we need on the host CPU from cpuid""" + + # pylint: disable=too-few-public-methods + def __init__(self): + self.cpuid = CPUID() + + registers = self.cpuid.registers_for(**CPUID_JSON["vendor"]["input"]) + self.highest_basic_support = registers.eax + self.vendor = struct.pack("III", registers.ebx, registers.edx, registers.ecx).decode( + "utf-8" + ) + + registers = self.cpuid.registers_for(**CPUID_JSON["highest_extension_support"]["input"]) + self.highest_extension_support = registers.eax + + self.features = self._features() + + def _features(self): + result = set() + + def check_features(data): + registers = self.cpuid.registers_for(**data["input"]) + for feature_check in data["bits"]: + current = getattr(registers, feature_check["register"]) + if self._is_bit_set(current, feature_check["bit"]): + result.add(feature_check["name"]) + + for call_data in CPUID_JSON["flags"]: + if call_data["input"]["eax"] > self.highest_basic_support: + continue + check_features(call_data) + + for call_data in CPUID_JSON["extension-flags"]: + if call_data["input"]["eax"] > self.highest_extension_support: + continue + check_features(call_data) + + return result + + def _is_bit_set(self, register: int, bit: int) -> bool: + mask = 1 << bit + return register & mask > 0 + + def brand_string(self) -> Optional[str]: + """Returns the brand string, if available.""" + if self.highest_extension_support < 0x80000004: + return None + + r1 = self.cpuid.registers_for(eax=0x80000002, ecx=0) + r2 = self.cpuid.registers_for(eax=0x80000003, ecx=0) + r3 = self.cpuid.registers_for(eax=0x80000004, ecx=0) + result = struct.pack( + "IIIIIIIIIIII", + r1.eax, + r1.ebx, + r1.ecx, + r1.edx, + r2.eax, + r2.ebx, + r2.ecx, + r2.edx, + r3.eax, + r3.ebx, + r3.ecx, + r3.edx, + ).decode("utf-8") + return result.strip("\x00") + + +@detection(operating_system="Windows") +def cpuid_info(): + """Returns a partial Microarchitecture, obtained from running the cpuid instruction""" + architecture = _machine() + if architecture == X86_64: + data = CpuidInfoCollector() + return partial_uarch(vendor=data.vendor, features=data.features) + + return generic_microarchitecture(architecture) + + +def _check_output(args, env): + with subprocess.Popen(args, stdout=subprocess.PIPE, env=env) as proc: + output = proc.communicate()[0] + return str(output.decode("utf-8")) + + +WINDOWS_MAPPING = { + "AMD64": X86_64, + "ARM64": AARCH64, +} + + +def _machine(): + """Return the machine architecture we are on""" + operating_system = platform.system() + + # If we are not on Darwin or Windows, trust what Python tells us + if operating_system not in ("Darwin", "Windows"): + return platform.machine() + + # Normalize windows specific names + if operating_system == "Windows": + platform_machine = platform.machine() + return WINDOWS_MAPPING.get(platform_machine, platform_machine) + + # On Darwin it might happen that we are on M1, but using an interpreter + # built for x86_64. In that case "platform.machine() == 'x86_64'", so we + # need to fix that. + # + # See: https://bugs.python.org/issue42704 + output = _check_output( + ["sysctl", "-n", "machdep.cpu.brand_string"], env=_ensure_bin_usrbin_in_path() + ).strip() + + if "Apple" in output: + # Note that a native Python interpreter on Apple M1 would return + # "arm64" instead of "aarch64". Here we normalize to the latter. + return AARCH64 + + return X86_64 + + +@detection(operating_system="Darwin") +def sysctl_info() -> Microarchitecture: + """Returns a raw info dictionary parsing the output of sysctl.""" + child_environment = _ensure_bin_usrbin_in_path() + + def sysctl(*args: str) -> str: + return _check_output(["sysctl"] + list(args), env=child_environment).strip() + + if _machine() == X86_64: + features = ( + f'{sysctl("-n", "machdep.cpu.features").lower()} ' + f'{sysctl("-n", "machdep.cpu.leaf7_features").lower()}' + ) + features = set(features.split()) + + # Flags detected on Darwin turned to their linux counterpart + for darwin_flag, linux_flag in TARGETS_JSON["conversions"]["darwin_flags"].items(): + if darwin_flag in features: + features.update(linux_flag.split()) + + return partial_uarch(vendor=sysctl("-n", "machdep.cpu.vendor"), features=features) + + model = "unknown" + model_str = sysctl("-n", "machdep.cpu.brand_string").lower() + if "m2" in model_str: + model = "m2" + elif "m1" in model_str: + model = "m1" + elif "apple" in model_str: + model = "m1" + + return partial_uarch(name=model, vendor="Apple") + + +def _ensure_bin_usrbin_in_path(): + # Make sure that /sbin and /usr/sbin are in PATH as sysctl is usually found there + child_environment = dict(os.environ.items()) + search_paths = child_environment.get("PATH", "").split(os.pathsep) + for additional_path in ("/sbin", "/usr/sbin"): + if additional_path not in search_paths: + search_paths.append(additional_path) + child_environment["PATH"] = os.pathsep.join(search_paths) + return child_environment + + +def _canonicalize_aarch64_vendor(data: Dict[str, str]) -> str: + """Adjust the vendor field to make it human-readable""" + if "CPU implementer" not in data: + return "generic" + + # Mapping numeric codes to vendor (ARM). This list is a merge from + # different sources: + # + # https://github.com/karelzak/util-linux/blob/master/sys-utils/lscpu-arm.c + # https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile + # https://github.com/gcc-mirror/gcc/blob/master/gcc/config/aarch64/aarch64-cores.def + # https://patchwork.kernel.org/patch/10524949/ + arm_vendors = TARGETS_JSON["conversions"]["arm_vendors"] + arm_code = data["CPU implementer"] + return arm_vendors.get(arm_code, arm_code) + + +def _feature_set(data: Dict[str, str], key: str) -> Set[str]: + return set(data.get(key, "").split()) + + +def detected_info() -> Microarchitecture: + """Returns a partial Microarchitecture with information on the CPU of the current host. + + This function calls all the viable factories one after the other until there's one that is + able to produce the requested information. Falls-back to a generic microarchitecture, if none + of the calls succeed. + """ + # pylint: disable=broad-except + for factory in INFO_FACTORY[platform.system()]: + try: + return factory() + except Exception as exc: + warnings.warn(str(exc)) + + return generic_microarchitecture(_machine()) + + +def compatible_microarchitectures(info: Microarchitecture) -> List[Microarchitecture]: + """Returns an unordered list of known micro-architectures that are compatible with the + partial Microarchitecture passed as input. + """ + architecture_family = _machine() + # If a tester is not registered, assume no known target is compatible with the host + tester = COMPATIBILITY_CHECKS.get(architecture_family, lambda x, y: False) + return [x for x in TARGETS.values() if tester(info, x)] or [ + generic_microarchitecture(architecture_family) + ] + + +def host(): + """Detects the host micro-architecture and returns it.""" + # Retrieve information on the host's cpu + info = detected_info() + + # Get a list of possible candidates for this micro-architecture + candidates = compatible_microarchitectures(info) + + # Sorting criteria for candidates + def sorting_fn(item): + return len(item.ancestors), len(item.features) + + # Get the best generic micro-architecture + generic_candidates = [c for c in candidates if c.vendor == "generic"] + best_generic = max(generic_candidates, key=sorting_fn) + + # Relevant for AArch64. Filter on "cpu_part" if we have any match + if info.cpu_part != "" and any(c for c in candidates if info.cpu_part == c.cpu_part): + candidates = [c for c in candidates if info.cpu_part == c.cpu_part] + + # Filter the candidates to be descendant of the best generic candidate. + # This is to avoid that the lack of a niche feature that can be disabled + # from e.g. BIOS prevents detection of a reasonably performant architecture + candidates = [c for c in candidates if c > best_generic] + + # If we don't have candidates, return the best generic micro-architecture + if not candidates: + return best_generic + + # Reverse sort of the depth for the inheritance tree among only targets we + # can use. This gets the newest target we satisfy. + return max(candidates, key=sorting_fn) + + +def compatibility_check(architecture_family: Union[str, Tuple[str, ...]]): + """Decorator to register a function as a proper compatibility check. + + A compatibility check function takes a partial Microarchitecture object as a first argument, + and an arbitrary target Microarchitecture as the second argument. It returns True if the + target is compatible with first argument, False otherwise. + + Args: + architecture_family: architecture family for which this test can be used + """ + # Turn the argument into something iterable + if isinstance(architecture_family, str): + architecture_family = (architecture_family,) + + def decorator(func): + COMPATIBILITY_CHECKS.update({family: func for family in architecture_family}) + return func + + return decorator + + +@compatibility_check(architecture_family=(PPC64LE, PPC64)) +def compatibility_check_for_power(info, target): + """Compatibility check for PPC64 and PPC64LE architectures.""" + # We can use a target if it descends from our machine type and our + # generation (9 for POWER9, etc) is at least its generation. + arch_root = TARGETS[_machine()] + return ( + target == arch_root or arch_root in target.ancestors + ) and target.generation <= info.generation + + +@compatibility_check(architecture_family=X86_64) +def compatibility_check_for_x86_64(info, target): + """Compatibility check for x86_64 architectures.""" + # We can use a target if it descends from our machine type, is from our + # vendor, and we have all of its features + arch_root = TARGETS[X86_64] + return ( + (target == arch_root or arch_root in target.ancestors) + and target.vendor in (info.vendor, "generic") + and target.features.issubset(info.features) + ) + + +@compatibility_check(architecture_family=AARCH64) +def compatibility_check_for_aarch64(info, target): + """Compatibility check for AARCH64 architectures.""" + # At the moment, it's not clear how to detect compatibility with + # a specific version of the architecture + if target.vendor == "generic" and target.name != AARCH64: + return False + + arch_root = TARGETS[AARCH64] + arch_root_and_vendor = arch_root == target.family and target.vendor in ( + info.vendor, + "generic", + ) + + # On macOS it seems impossible to get all the CPU features + # with syctl info, but for ARM we can get the exact model + if platform.system() == "Darwin": + model = TARGETS[info.name] + return arch_root_and_vendor and (target == model or target in model.ancestors) + + return arch_root_and_vendor and target.features.issubset(info.features) + + +@compatibility_check(architecture_family=RISCV64) +def compatibility_check_for_riscv64(info, target): + """Compatibility check for riscv64 architectures.""" + arch_root = TARGETS[RISCV64] + return (target == arch_root or arch_root in target.ancestors) and ( + target.name == info.name or target.vendor == "generic" + ) + + +def brand_string() -> Optional[str]: + """Returns the brand string of the host, if detected, or None.""" + if platform.system() == "Darwin": + return _check_output( + ["sysctl", "-n", "machdep.cpu.brand_string"], env=_ensure_bin_usrbin_in_path() + ).strip() + + if host().family == X86_64: + return CpuidInfoCollector().brand_string() + + return None diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/microarchitecture.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/microarchitecture.py new file mode 100644 index 0000000000000000000000000000000000000000..bb85b9f37c0966b3a7eb30b0a811d4db83a74eed --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/microarchitecture.py @@ -0,0 +1,416 @@ +# Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +# Archspec Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +"""Types and functions to manage information on CPU microarchitectures.""" +import functools +import platform +import re +import warnings + +import archspec +import archspec.cpu.alias +import archspec.cpu.schema + +from .alias import FEATURE_ALIASES +from .schema import LazyDictionary + + +def coerce_target_names(func): + """Decorator that automatically converts a known target name to a proper + Microarchitecture object. + """ + + @functools.wraps(func) + def _impl(self, other): + if isinstance(other, str): + if other not in TARGETS: + msg = '"{0}" is not a valid target name' + raise ValueError(msg.format(other)) + other = TARGETS[other] + + return func(self, other) + + return _impl + + +class Microarchitecture: + """Represents a specific CPU micro-architecture. + + Args: + name (str): name of the micro-architecture (e.g. skylake). + parents (list): list of parents micro-architectures, if any. + Parenthood is considered by cpu features and not + chronologically. As such each micro-architecture is + compatible with its ancestors. For example "skylake", + which has "broadwell" as a parent, supports running binaries + optimized for "broadwell". + vendor (str): vendor of the micro-architecture + features (set of str): supported CPU flags. Note that the semantic + of the flags in this field might vary among architectures, if + at all present. For instance x86_64 processors will list all + the flags supported by a given CPU while Arm processors will + list instead only the flags that have been added on top of the + base model for the current micro-architecture. + compilers (dict): compiler support to generate tuned code for this + micro-architecture. This dictionary has as keys names of + supported compilers, while values are list of dictionaries + with fields: + + * name: name of the micro-architecture according to the + compiler. This is the name passed to the ``-march`` option + or similar. Not needed if the name is the same as that + passed in as argument above. + * versions: versions that support this micro-architecture. + + generation (int): generation of the micro-architecture, if relevant. + cpu_part (str): cpu part of the architecture, if relevant. + """ + + # pylint: disable=too-many-arguments,too-many-instance-attributes + #: Aliases for micro-architecture's features + feature_aliases = FEATURE_ALIASES + + def __init__(self, name, parents, vendor, features, compilers, generation=0, cpu_part=""): + self.name = name + self.parents = parents + self.vendor = vendor + self.features = features + self.compilers = compilers + # Only relevant for PowerPC + self.generation = generation + # Only relevant for AArch64 + self.cpu_part = cpu_part + + # Cache the "ancestor" computation + self._ancestors = None + # Cache the "generic" computation + self._generic = None + # Cache the "family" computation + self._family = None + + @property + def ancestors(self): + """All the ancestors of this microarchitecture.""" + if self._ancestors is None: + value = self.parents[:] + for parent in self.parents: + value.extend(a for a in parent.ancestors if a not in value) + self._ancestors = value + return self._ancestors + + def _to_set(self): + """Returns a set of the nodes in this microarchitecture DAG.""" + # This function is used to implement subset semantics with + # comparison operators + return set([str(self)] + [str(x) for x in self.ancestors]) + + @coerce_target_names + def __eq__(self, other): + if not isinstance(other, Microarchitecture): + return NotImplemented + + return ( + self.name == other.name + and self.vendor == other.vendor + and self.features == other.features + and self.parents == other.parents # avoid ancestors here + and self.compilers == other.compilers + and self.generation == other.generation + and self.cpu_part == other.cpu_part + ) + + def __hash__(self): + return hash(self.name) + + @coerce_target_names + def __ne__(self, other): + return not self == other + + @coerce_target_names + def __lt__(self, other): + if not isinstance(other, Microarchitecture): + return NotImplemented + + return self._to_set() < other._to_set() + + @coerce_target_names + def __le__(self, other): + return (self == other) or (self < other) + + @coerce_target_names + def __gt__(self, other): + if not isinstance(other, Microarchitecture): + return NotImplemented + + return self._to_set() > other._to_set() + + @coerce_target_names + def __ge__(self, other): + return (self == other) or (self > other) + + def __repr__(self): + cls_name = self.__class__.__name__ + fmt = ( + cls_name + "({0.name!r}, {0.parents!r}, {0.vendor!r}, " + "{0.features!r}, {0.compilers!r}, generation={0.generation!r}, " + "cpu_part={0.cpu_part!r})" + ) + return fmt.format(self) + + def __str__(self): + return self.name + + def __contains__(self, feature): + # Feature must be of a string type, so be defensive about that + if not isinstance(feature, str): + msg = "only objects of string types are accepted [got {0}]" + raise TypeError(msg.format(str(type(feature)))) + + # Here we look first in the raw features, and fall-back to + # feature aliases if not match was found + if feature in self.features: + return True + + # Check if the alias is defined, if not it will return False + match_alias = Microarchitecture.feature_aliases.get(feature, lambda x: False) + return match_alias(self) + + @property + def family(self): + """Returns the architecture family a given target belongs to""" + if self._family is None: + roots = [x for x in [self] + self.ancestors if not x.ancestors] + msg = "a target is expected to belong to just one architecture family" + msg += f"[found {', '.join(str(x) for x in roots)}]" + assert len(roots) == 1, msg + self._family = roots.pop() + + return self._family + + @property + def generic(self): + """Returns the best generic architecture that is compatible with self""" + if self._generic is None: + generics = [x for x in [self] + self.ancestors if x.vendor == "generic"] + self._generic = max(generics, key=lambda x: len(x.ancestors)) + return self._generic + + def to_dict(self): + """Returns a dictionary representation of this object.""" + return { + "name": str(self.name), + "vendor": str(self.vendor), + "features": sorted(str(x) for x in self.features), + "generation": self.generation, + "parents": [str(x) for x in self.parents], + "compilers": self.compilers, + "cpupart": self.cpu_part, + } + + @staticmethod + def from_dict(data) -> "Microarchitecture": + """Construct a microarchitecture from a dictionary representation.""" + return Microarchitecture( + name=data["name"], + parents=[TARGETS[x] for x in data["parents"]], + vendor=data["vendor"], + features=set(data["features"]), + compilers=data.get("compilers", {}), + generation=data.get("generation", 0), + cpu_part=data.get("cpupart", ""), + ) + + def optimization_flags(self, compiler, version): + """Returns a string containing the optimization flags that needs + to be used to produce code optimized for this micro-architecture. + + The version is expected to be a string of dot separated digits. + + If there is no information on the compiler passed as argument the + function returns an empty string. If it is known that the compiler + version we want to use does not support this architecture the function + raises an exception. + + Args: + compiler (str): name of the compiler to be used + version (str): version of the compiler to be used + + Raises: + UnsupportedMicroarchitecture: if the requested compiler does not support + this micro-architecture. + ValueError: if the version doesn't match the expected format + """ + # If we don't have information on compiler at all return an empty string + if compiler not in self.family.compilers: + return "" + + # If we have information but it stops before this + # microarchitecture, fall back to the best known target + if compiler not in self.compilers: + best_target = [x for x in self.ancestors if compiler in x.compilers][0] + msg = ( + "'{0}' compiler is known to optimize up to the '{1}'" + " microarchitecture in the '{2}' architecture family" + ) + msg = msg.format(compiler, best_target, best_target.family) + raise UnsupportedMicroarchitecture(msg) + + # Check that the version matches the expected format + if not re.match(r"^(?:\d+\.)*\d+$", version): + msg = ( + "invalid format for the compiler version argument. " + "Only dot separated digits are allowed." + ) + raise InvalidCompilerVersion(msg) + + # If we have information on this compiler we need to check the + # version being used + compiler_info = self.compilers[compiler] + + def satisfies_constraint(entry, version): + min_version, max_version = entry["versions"].split(":") + + # Check version suffixes + min_version, _ = version_components(min_version) + max_version, _ = version_components(max_version) + version, _ = version_components(version) + + # Assume compiler versions fit into semver + def tuplify(ver): + return tuple(int(y) for y in ver.split(".")) + + version = tuplify(version) + if min_version: + min_version = tuplify(min_version) + if min_version > version: + return False + + if max_version: + max_version = tuplify(max_version) + if max_version < version: + return False + + return True + + for compiler_entry in compiler_info: + if satisfies_constraint(compiler_entry, version): + flags_fmt = compiler_entry["flags"] + # If there's no field name, use the name of the + # micro-architecture + compiler_entry.setdefault("name", self.name) + + # Check if we need to emit a warning + warning_message = compiler_entry.get("warnings", None) + if warning_message: + warnings.warn(warning_message) + + flags = flags_fmt.format(**compiler_entry) + return flags + + msg = "cannot produce optimized binary for micro-architecture '{0}' with {1}@{2}" + if compiler_info: + versions = [x["versions"] for x in compiler_info] + msg += f' [supported compiler versions are {", ".join(versions)}]' + else: + msg += " [no supported compiler versions]" + msg = msg.format(self.name, compiler, version) + raise UnsupportedMicroarchitecture(msg) + + +def generic_microarchitecture(name): + """Returns a generic micro-architecture with no vendor and no features. + + Args: + name (str): name of the micro-architecture + """ + return Microarchitecture(name, parents=[], vendor="generic", features=set(), compilers={}) + + +def version_components(version): + """Decomposes the version passed as input in version number and + suffix and returns them. + + If the version number or the suffix are not present, an empty + string is returned. + + Args: + version (str): version to be decomposed into its components + """ + match = re.match(r"([\d.]*)(-?)(.*)", str(version)) + if not match: + return "", "" + + version_number = match.group(1) + suffix = match.group(3) + + return version_number, suffix + + +def _known_microarchitectures(): + """Returns a dictionary of the known micro-architectures. If the + current host platform is unknown adds it too as a generic target. + """ + + def fill_target_from_dict(name, data, targets): + """Recursively fills targets by adding the micro-architecture + passed as argument and all its ancestors. + + Args: + name (str): micro-architecture to be added to targets. + data (dict): raw data loaded from JSON. + targets (dict): dictionary that maps micro-architecture names + to ``Microarchitecture`` objects + """ + values = data[name] + + # Get direct parents of target + parent_names = values["from"] + for parent in parent_names: + # Recursively fill parents so they exist before we add them + if parent in targets: + continue + fill_target_from_dict(parent, data, targets) + parents = [targets.get(parent) for parent in parent_names] + + vendor = values["vendor"] + features = set(values["features"]) + compilers = values.get("compilers", {}) + generation = values.get("generation", 0) + cpu_part = values.get("cpupart", "") + + targets[name] = Microarchitecture( + name, parents, vendor, features, compilers, generation=generation, cpu_part=cpu_part + ) + + known_targets = {} + data = archspec.cpu.schema.TARGETS_JSON["microarchitectures"] + for name in data: + if name in known_targets: + # name was already brought in as ancestor to a target + continue + fill_target_from_dict(name, data, known_targets) + + # Add the host platform if not present + host_platform = platform.machine() + known_targets.setdefault(host_platform, generic_microarchitecture(host_platform)) + + return known_targets + + +#: Dictionary of known micro-architectures +TARGETS = LazyDictionary(_known_microarchitectures) + + +class ArchspecError(Exception): + """Base class for errors within archspec""" + + +class UnsupportedMicroarchitecture(ArchspecError, ValueError): + """Raised if a compiler version does not support optimization for a given + micro-architecture. + """ + + +class InvalidCompilerVersion(ArchspecError, ValueError): + """Raised when an invalid format is used for compiler versions in archspec.""" diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/schema.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/schema.py new file mode 100644 index 0000000000000000000000000000000000000000..0ffc2231650b6952d3b9ad2fe6674632100d6607 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/cpu/schema.py @@ -0,0 +1,112 @@ +# Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +# Archspec Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) +"""Global objects with the content of the microarchitecture +JSON file and its schema +""" +import collections.abc +import json +import os +import pathlib +from typing import Tuple + + +class LazyDictionary(collections.abc.MutableMapping): + """Lazy dictionary that gets constructed on first access to any object key + + Args: + factory (callable): factory function to construct the dictionary + """ + + def __init__(self, factory, *args, **kwargs): + self.factory = factory + self.args = args + self.kwargs = kwargs + self._data = None + + @property + def data(self): + """Returns the lazily constructed dictionary""" + if self._data is None: + self._data = self.factory(*self.args, **self.kwargs) + return self._data + + def __getitem__(self, key): + return self.data[key] + + def __setitem__(self, key, value): + self.data[key] = value + + def __delitem__(self, key): + del self.data[key] + + def __iter__(self): + return iter(self.data) + + def __len__(self): + return len(self.data) + + +#: Environment variable that might point to a directory with a user defined JSON file +DIR_FROM_ENVIRONMENT = "ARCHSPEC_CPU_DIR" + +#: Environment variable that might point to a directory with extensions to JSON files +EXTENSION_DIR_FROM_ENVIRONMENT = "ARCHSPEC_EXTENSION_CPU_DIR" + + +def _json_file(filename: str, allow_custom: bool = False) -> Tuple[pathlib.Path, pathlib.Path]: + """Given a filename, returns the absolute path for the main JSON file, and an + optional absolute path for an extension JSON file. + + Args: + filename: filename for the JSON file + allow_custom: if True, allows overriding the location where the file resides + """ + json_dir = pathlib.Path(__file__).parent / ".." / "json" / "cpu" + if allow_custom and DIR_FROM_ENVIRONMENT in os.environ: + json_dir = pathlib.Path(os.environ[DIR_FROM_ENVIRONMENT]) + json_dir = json_dir.absolute() + json_file = json_dir / filename + + extension_file = None + if allow_custom and EXTENSION_DIR_FROM_ENVIRONMENT in os.environ: + extension_dir = pathlib.Path(os.environ[EXTENSION_DIR_FROM_ENVIRONMENT]) + extension_dir.absolute() + extension_file = extension_dir / filename + + return json_file, extension_file + + +def _load(json_file: pathlib.Path, extension_file: pathlib.Path): + with open(json_file, "r", encoding="utf-8") as file: + data = json.load(file) + + if not extension_file or not extension_file.exists(): + return data + + with open(extension_file, "r", encoding="utf-8") as file: + extension_data = json.load(file) + + top_level_sections = list(data.keys()) + for key in top_level_sections: + if key not in extension_data: + continue + + data[key].update(extension_data[key]) + + return data + + +#: In memory representation of the data in microarchitectures.json, +#: loaded on first access +TARGETS_JSON = LazyDictionary(_load, *_json_file("microarchitectures.json", allow_custom=True)) + +#: JSON schema for microarchitectures.json, loaded on first access +TARGETS_JSON_SCHEMA = LazyDictionary(_load, *_json_file("microarchitectures_schema.json")) + +#: Information on how to call 'cpuid' to get information on the HOST CPU +CPUID_JSON = LazyDictionary(_load, *_json_file("cpuid.json", allow_custom=True)) + +#: JSON schema for cpuid.json, loaded on first access +CPUID_JSON_SCHEMA = LazyDictionary(_load, *_json_file("cpuid_schema.json")) diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/COPYRIGHT b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/COPYRIGHT new file mode 100644 index 0000000000000000000000000000000000000000..4164e98de77169c98f258c4ac8eff4daf9f78f4e --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/COPYRIGHT @@ -0,0 +1,22 @@ +Intellectual Property Notice +------------------------------ + +Archspec is licensed under the Apache License, Version 2.0 (LICENSE-APACHE +or http://www.apache.org/licenses/LICENSE-2.0) or the MIT license, +(LICENSE-MIT or http://opensource.org/licenses/MIT), at your option. + +Copyrights and patents in the Archspec project are retained by contributors. +No copyright assignment is required to contribute to Archspec. + + +SPDX usage +------------ + +Individual files contain SPDX tags instead of the full license text. +This enables machine processing of license information based on the SPDX +License Identifiers that are available here: https://spdx.org/licenses/ + +Files that are dual-licensed as Apache-2.0 OR MIT contain the following +text in the license header: + + SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/LICENSE-APACHE b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/LICENSE-APACHE new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/LICENSE-MIT b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/LICENSE-MIT new file mode 100644 index 0000000000000000000000000000000000000000..03be635ad5df4567a85180c7a03a54ee96e1ee98 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/LICENSE-MIT @@ -0,0 +1,20 @@ +Copyright 2019-2020 Lawrence Livermore National Security, LLC and other +Archspec Project Developers. See the top-level COPYRIGHT file for details. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/NOTICE b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..3737d5a86ddc20bfd04ce225fff2d34407df06f9 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/NOTICE @@ -0,0 +1,21 @@ +This work was produced under the auspices of the U.S. Department of +Energy by Lawrence Livermore National Laboratory under Contract +DE-AC52-07NA27344. + +This work was prepared as an account of work sponsored by an agency of +the United States Government. Neither the United States Government nor +Lawrence Livermore National Security, LLC, nor any of their employees +makes any warranty, expressed or implied, or assumes any legal liability +or responsibility for the accuracy, completeness, or usefulness of any +information, apparatus, product, or process disclosed, or represents that +its use would not infringe privately owned rights. + +Reference herein to any specific commercial product, process, or service +by trade name, trademark, manufacturer, or otherwise does not necessarily +constitute or imply its endorsement, recommendation, or favoring by the +United States Government or Lawrence Livermore National Security, LLC. + +The views and opinions of authors expressed herein do not necessarily +state or reflect those of the United States Government or Lawrence +Livermore National Security, LLC, and shall not be used for advertising +or product endorsement purposes. diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/README.md b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/README.md new file mode 100644 index 0000000000000000000000000000000000000000..78c424a86fa348b1b48001b649df8530fa3da2ac --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/README.md @@ -0,0 +1,36 @@ +[![](https://github.com/archspec/archspec-json/workflows/JSON%20Validation/badge.svg)](https://github.com/archspec/archspec-json/actions) + +# Archspec-json + +The [archspec-json](https://github.com/archspec/archspec-json) repository is part of the +[Archspec](https://github.com/archspec) project. It contains data on various architectural +aspects of a platform stored in JSON format and is meant to be used as a base to develop +language specific APIs. + +Currently the repository contains the following JSON files: +```console +cpu/ +├── cpuid.json # Contains information on CPUID calls to retrieve vendor and features on x86_64 +├── cpuid_schema.json # Schema for the file above +├── microarchitectures.json # Contains information on CPU microarchitectures +└── microarchitectures_schema.json # Schema for the file above + ``` + + +## License + +Archspec is distributed under the terms of both the MIT license and the +Apache License (Version 2.0). Users may choose either license, at their +option. + +All new contributions must be made under both the MIT and Apache-2.0 +licenses. + +See [LICENSE-MIT](https://github.com/archspec/archspec-json/blob/master/LICENSE-MIT), +[LICENSE-APACHE](https://github.com/archspec/archspec-json/blob/master/LICENSE-APACHE), +[COPYRIGHT](https://github.com/archspec/archspec-json/blob/master/COPYRIGHT), and +[NOTICE](https://github.com/archspec/archspec-json/blob/master/NOTICE) for details. + +SPDX-License-Identifier: (Apache-2.0 OR MIT) + +LLNL-CODE-811653 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/cpuid.json b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/cpuid.json new file mode 100644 index 0000000000000000000000000000000000000000..594e435383ad50c0cd6f71f965b27b54343f502a --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/cpuid.json @@ -0,0 +1,1050 @@ +{ + "vendor": { + "description": "https://en.wikipedia.org/wiki/CPUID#EAX=0:_Highest_Function_Parameter_and_Manufacturer_ID", + "input": { + "eax": 0, + "ecx": 0 + } + }, + "highest_extension_support": { + "description": "https://en.wikipedia.org/wiki/CPUID#EAX=80000000h:_Get_Highest_Extended_Function_Implemented", + "input": { + "eax": 2147483648, + "ecx": 0 + } + }, + "flags": [ + { + "description": "https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits", + "input": { + "eax": 1, + "ecx": 0 + }, + "bits": [ + { + "name": "fpu", + "register": "edx", + "bit": 0 + }, + { + "name": "vme", + "register": "edx", + "bit": 1 + }, + { + "name": "de", + "register": "edx", + "bit": 2 + }, + { + "name": "pse", + "register": "edx", + "bit": 3 + }, + { + "name": "tsc", + "register": "edx", + "bit": 4 + }, + { + "name": "msr", + "register": "edx", + "bit": 5 + }, + { + "name": "pae", + "register": "edx", + "bit": 6 + }, + { + "name": "mce", + "register": "edx", + "bit": 7 + }, + { + "name": "cx8", + "register": "edx", + "bit": 8 + }, + { + "name": "apic", + "register": "edx", + "bit": 9 + }, + { + "name": "sep", + "register": "edx", + "bit": 11 + }, + { + "name": "mtrr", + "register": "edx", + "bit": 12 + }, + { + "name": "pge", + "register": "edx", + "bit": 13 + }, + { + "name": "mca", + "register": "edx", + "bit": 14 + }, + { + "name": "cmov", + "register": "edx", + "bit": 15 + }, + { + "name": "pat", + "register": "edx", + "bit": 16 + }, + { + "name": "pse36", + "register": "edx", + "bit": 17 + }, + { + "name": "pn", + "register": "edx", + "bit": 18 + }, + { + "name": "clflush", + "register": "edx", + "bit": 19 + }, + { + "name": "dts", + "register": "edx", + "bit": 21 + }, + { + "name": "acpi", + "register": "edx", + "bit": 22 + }, + { + "name": "mmx", + "register": "edx", + "bit": 23 + }, + { + "name": "fxsr", + "register": "edx", + "bit": 24 + }, + { + "name": "sse", + "register": "edx", + "bit": 25 + }, + { + "name": "sse2", + "register": "edx", + "bit": 26 + }, + { + "name": "ss", + "register": "edx", + "bit": 27 + }, + { + "name": "ht", + "register": "edx", + "bit": 28 + }, + { + "name": "tm", + "register": "edx", + "bit": 29 + }, + { + "name": "ia64", + "register": "edx", + "bit": 30 + }, + { + "name": "pbe", + "register": "edx", + "bit": 31 + }, + { + "name": "pni", + "register": "ecx", + "bit": 0 + }, + { + "name": "pclmulqdq", + "register": "ecx", + "bit": 1 + }, + { + "name": "dtes64", + "register": "ecx", + "bit": 2 + }, + { + "name": "monitor", + "register": "ecx", + "bit": 3 + }, + { + "name": "ds_cpl", + "register": "ecx", + "bit": 4 + }, + { + "name": "vmx", + "register": "ecx", + "bit": 5 + }, + { + "name": "smx", + "register": "ecx", + "bit": 6 + }, + { + "name": "est", + "register": "ecx", + "bit": 7 + }, + { + "name": "tm2", + "register": "ecx", + "bit": 8 + }, + { + "name": "ssse3", + "register": "ecx", + "bit": 9 + }, + { + "name": "cid", + "register": "ecx", + "bit": 10 + }, + { + "name": "fma", + "register": "ecx", + "bit": 12 + }, + { + "name": "cx16", + "register": "ecx", + "bit": 13 + }, + { + "name": "xtpr", + "register": "ecx", + "bit": 14 + }, + { + "name": "pdcm", + "register": "ecx", + "bit": 15 + }, + { + "name": "pcid", + "register": "ecx", + "bit": 17 + }, + { + "name": "dca", + "register": "ecx", + "bit": 18 + }, + { + "name": "sse4_1", + "register": "ecx", + "bit": 19 + }, + { + "name": "sse4_2", + "register": "ecx", + "bit": 20 + }, + { + "name": "x2apic", + "register": "ecx", + "bit": 21 + }, + { + "name": "movbe", + "register": "ecx", + "bit": 22 + }, + { + "name": "popcnt", + "register": "ecx", + "bit": 23 + }, + { + "name": "tscdeadline", + "register": "ecx", + "bit": 24 + }, + { + "name": "aes", + "register": "ecx", + "bit": 25 + }, + { + "name": "xsave", + "register": "ecx", + "bit": 26 + }, + { + "name": "osxsave", + "register": "ecx", + "bit": 27 + }, + { + "name": "avx", + "register": "ecx", + "bit": 28 + }, + { + "name": "f16c", + "register": "ecx", + "bit": 29 + }, + { + "name": "rdrand", + "register": "ecx", + "bit": 30 + }, + { + "name": "hypervisor", + "register": "ecx", + "bit": 31 + } + ] + }, + { + "description": "https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features", + "input": { + "eax": 7, + "ecx": 0 + }, + "bits": [ + { + "name": "fsgsbase", + "register": "ebx", + "bit": 0 + }, + { + "name": "sgx", + "register": "ebx", + "bit": 2 + }, + { + "name": "bmi1", + "register": "ebx", + "bit": 3 + }, + { + "name": "hle", + "register": "ebx", + "bit": 4 + }, + { + "name": "avx2", + "register": "ebx", + "bit": 5 + }, + { + "name": "fdp-excptn-only", + "register": "ebx", + "bit": 6 + }, + { + "name": "smep", + "register": "ebx", + "bit": 7 + }, + { + "name": "bmi2", + "register": "ebx", + "bit": 8 + }, + { + "name": "erms", + "register": "ebx", + "bit": 9 + }, + { + "name": "invpcid", + "register": "ebx", + "bit": 10 + }, + { + "name": "rtm", + "register": "ebx", + "bit": 11 + }, + { + "name": "pqm", + "register": "ebx", + "bit": 12 + }, + { + "name": "mpx", + "register": "ebx", + "bit": 14 + }, + { + "name": "pqe", + "register": "ebx", + "bit": 15 + }, + { + "name": "avx512f", + "register": "ebx", + "bit": 16 + }, + { + "name": "avx512dq", + "register": "ebx", + "bit": 17 + }, + { + "name": "rdseed", + "register": "ebx", + "bit": 18 + }, + { + "name": "adx", + "register": "ebx", + "bit": 19 + }, + { + "name": "smap", + "register": "ebx", + "bit": 20 + }, + { + "name": "avx512ifma", + "register": "ebx", + "bit": 21 + }, + { + "name": "pcommit", + "register": "ebx", + "bit": 22 + }, + { + "name": "clflushopt", + "register": "ebx", + "bit": 23 + }, + { + "name": "clwb", + "register": "ebx", + "bit": 24 + }, + { + "name": "intel_pt", + "register": "ebx", + "bit": 25 + }, + { + "name": "avx512pf", + "register": "ebx", + "bit": 26 + }, + { + "name": "avx512er", + "register": "ebx", + "bit": 27 + }, + { + "name": "avx512cd", + "register": "ebx", + "bit": 28 + }, + { + "name": "sha_ni", + "register": "ebx", + "bit": 29 + }, + { + "name": "avx512bw", + "register": "ebx", + "bit": 30 + }, + { + "name": "avx512vl", + "register": "ebx", + "bit": 31 + }, + { + "name": "prefetchwt1", + "register": "ecx", + "bit": 0 + }, + { + "name": "avx512vbmi", + "register": "ecx", + "bit": 1 + }, + { + "name": "umip", + "register": "ecx", + "bit": 2 + }, + { + "name": "pku", + "register": "ecx", + "bit": 3 + }, + { + "name": "ospke", + "register": "ecx", + "bit": 4 + }, + { + "name": "waitpkg", + "register": "ecx", + "bit": 5 + }, + { + "name": "avx512_vbmi2", + "register": "ecx", + "bit": 6 + }, + { + "name": "cet_ss", + "register": "ecx", + "bit": 7 + }, + { + "name": "gfni", + "register": "ecx", + "bit": 8 + }, + { + "name": "vaes", + "register": "ecx", + "bit": 9 + }, + { + "name": "vpclmulqdq", + "register": "ecx", + "bit": 10 + }, + { + "name": "avx512_vnni", + "register": "ecx", + "bit": 11 + }, + { + "name": "avx512_bitalg", + "register": "ecx", + "bit": 12 + }, + { + "name": "tme", + "register": "ecx", + "bit": 13 + }, + { + "name": "avx512_vpopcntdq", + "register": "ecx", + "bit": 14 + }, + { + "name": "rdpid", + "register": "ecx", + "bit": 22 + }, + { + "name": "cldemote", + "register": "ecx", + "bit": 25 + }, + { + "name": "movdiri", + "register": "ecx", + "bit": 27 + }, + { + "name": "movdir64b", + "register": "ecx", + "bit": 28 + }, + { + "name": "enqcmd", + "register": "ecx", + "bit": 29 + }, + { + "name": "sgx_lc", + "register": "ecx", + "bit": 30 + }, + { + "name": "pks", + "register": "ecx", + "bit": 31 + }, + { + "name": "fsrm", + "register": "edx", + "bit": 4 + }, + { + "name": "avx512_vp2intersect", + "register": "edx", + "bit": 8 + }, + { + "name": "md_clear", + "register": "edx", + "bit": 10 + }, + { + "name": "serialize", + "register": "edx", + "bit": 14 + }, + { + "name": "tsxldtrk", + "register": "edx", + "bit": 16 + }, + { + "name": "amx_bf16", + "register": "edx", + "bit": 22 + }, + { + "name": "avx512_fp16", + "register": "edx", + "bit": 23 + }, + { + "name": "amx_tile", + "register": "edx", + "bit": 24 + }, + { + "name": "amx_int8", + "register": "edx", + "bit": 25 + }, + { + "name": "ssbd", + "register": "edx", + "bit": 31 + } + ] + }, + { + "description": "https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features", + "input": { + "eax": 7, + "ecx": 1 + }, + "bits": [ + { + "name": "sha512", + "register": "eax", + "bit": 0 + }, + { + "name": "sm3", + "register": "eax", + "bit": 1 + }, + { + "name": "sm4", + "register": "eax", + "bit": 2 + }, + { + "name": "rao_int", + "register": "eax", + "bit": 3 + }, + { + "name": "avx_vnni", + "register": "eax", + "bit": 4 + }, + { + "name": "avx512_bf16", + "register": "eax", + "bit": 5 + }, + { + "name": "cmpccxadd", + "register": "eax", + "bit": 7 + }, + { + "name": "arch_perfmon_ext", + "register": "eax", + "bit": 8 + }, + { + "name": "fzrm", + "register": "eax", + "bit": 10 + }, + { + "name": "fsrs", + "register": "eax", + "bit": 11 + }, + { + "name": "fsrc", + "register": "eax", + "bit": 12 + }, + { + "name": "lkgs", + "register": "eax", + "bit": 18 + }, + { + "name": "amx_fp16", + "register": "eax", + "bit": 21 + }, + { + "name": "avx_ifma", + "register": "eax", + "bit": 23 + }, + { + "name": "lam", + "register": "eax", + "bit": 26 + } + ] + }, + { + "description": "https://en.wikipedia.org/wiki/CPUID#EAX=0Dh:_XSAVE_features_and_state-components", + "input": { + "eax": 13, + "ecx": 1 + }, + "bits": [ + { + "name": "xsaveopt", + "register": "eax", + "bit": 0 + }, + { + "name": "xsavec", + "register": "eax", + "bit": 1 + }, + { + "name": "xgetbv1", + "register": "eax", + "bit": 2 + }, + { + "name": "xsaves", + "register": "eax", + "bit": 3 + }, + { + "name": "xfd", + "register": "eax", + "bit": 4 + } + ] + } + ], + "extension-flags": [ + { + "description": "https://en.wikipedia.org/wiki/CPUID#EAX=0Dh:_XSAVE_features_and_state-components", + "input": { + "eax": 2147483649, + "ecx": 0 + }, + "bits": [ + { + "name": "fpu", + "register": "edx", + "bit": 0 + }, + { + "name": "vme", + "register": "edx", + "bit": 1 + }, + { + "name": "de", + "register": "edx", + "bit": 2 + }, + { + "name": "pse", + "register": "edx", + "bit": 3 + }, + { + "name": "tsc", + "register": "edx", + "bit": 4 + }, + { + "name": "msr", + "register": "edx", + "bit": 5 + }, + { + "name": "pae", + "register": "edx", + "bit": 6 + }, + { + "name": "mce", + "register": "edx", + "bit": 7 + }, + { + "name": "cx8", + "register": "edx", + "bit": 8 + }, + { + "name": "apic", + "register": "edx", + "bit": 9 + }, + { + "name": "syscall", + "register": "edx", + "bit": 10 + }, + { + "name": "syscall", + "register": "edx", + "bit": 11 + }, + { + "name": "mtrr", + "register": "edx", + "bit": 12 + }, + { + "name": "pge", + "register": "edx", + "bit": 13 + }, + { + "name": "mca", + "register": "edx", + "bit": 14 + }, + { + "name": "cmov", + "register": "edx", + "bit": 15 + }, + { + "name": "pat", + "register": "edx", + "bit": 16 + }, + { + "name": "pse36", + "register": "edx", + "bit": 17 + }, + { + "name": "mp", + "register": "edx", + "bit": 19 + }, + { + "name": "nx", + "register": "edx", + "bit": 20 + }, + { + "name": "mmxext", + "register": "edx", + "bit": 22 + }, + { + "name": "mmx", + "register": "edx", + "bit": 23 + }, + { + "name": "fxsr", + "register": "edx", + "bit": 24 + }, + { + "name": "fxsr_opt", + "register": "edx", + "bit": 25 + }, + { + "name": "pdpe1gp", + "register": "edx", + "bit": 26 + }, + { + "name": "rdtscp", + "register": "edx", + "bit": 27 + }, + { + "name": "lm", + "register": "edx", + "bit": 29 + }, + { + "name": "3dnowext", + "register": "edx", + "bit": 30 + }, + { + "name": "3dnow", + "register": "edx", + "bit": 31 + }, + { + "name": "lahf_lm", + "register": "ecx", + "bit": 0 + }, + { + "name": "cmp_legacy", + "register": "ecx", + "bit": 1 + }, + { + "name": "svm", + "register": "ecx", + "bit": 2 + }, + { + "name": "extapic", + "register": "ecx", + "bit": 3 + }, + { + "name": "cr8_legacy", + "register": "ecx", + "bit": 4 + }, + { + "name": "abm", + "register": "ecx", + "bit": 5 + }, + { + "name": "sse4a", + "register": "ecx", + "bit": 6 + }, + { + "name": "misalignsse", + "register": "ecx", + "bit": 7 + }, + { + "name": "3dnowprefetch", + "register": "ecx", + "bit": 8 + }, + { + "name": "osvw", + "register": "ecx", + "bit": 9 + }, + { + "name": "ibs", + "register": "ecx", + "bit": 10 + }, + { + "name": "xop", + "register": "ecx", + "bit": 11 + }, + { + "name": "skinit", + "register": "ecx", + "bit": 12 + }, + { + "name": "wdt", + "register": "ecx", + "bit": 13 + }, + { + "name": "lwp", + "register": "ecx", + "bit": 15 + }, + { + "name": "fma4", + "register": "ecx", + "bit": 16 + }, + { + "name": "tce", + "register": "ecx", + "bit": 17 + }, + { + "name": "nodeid_msr", + "register": "ecx", + "bit": 19 + }, + { + "name": "tbm", + "register": "ecx", + "bit": 21 + }, + { + "name": "topoext", + "register": "ecx", + "bit": 22 + }, + { + "name": "perfctr_core", + "register": "ecx", + "bit": 23 + }, + { + "name": "perfctr_nb", + "register": "ecx", + "bit": 24 + }, + { + "name": "dbx", + "register": "ecx", + "bit": 26 + }, + { + "name": "perftsc", + "register": "ecx", + "bit": 27 + }, + { + "name": "pci_l2i", + "register": "ecx", + "bit": 28 + }, + { + "name": "mwaitx", + "register": "ecx", + "bit": 29 + } + ] + } + ] +} diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/cpuid_schema.json b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/cpuid_schema.json new file mode 100644 index 0000000000000000000000000000000000000000..8dc5b982eac66a8230a107962882a11d4982240a --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/cpuid_schema.json @@ -0,0 +1,134 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Schema for microarchitecture definitions and feature aliases", + "type": "object", + "additionalProperties": false, + "properties": { + "vendor": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": false, + "properties": { + "eax": { + "type": "integer" + }, + "ecx": { + "type": "integer" + } + } + } + } + }, + "highest_extension_support": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": false, + "properties": { + "eax": { + "type": "integer" + }, + "ecx": { + "type": "integer" + } + } + } + } + }, + "flags": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": false, + "properties": { + "eax": { + "type": "integer" + }, + "ecx": { + "type": "integer" + } + } + }, + "bits": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "register": { + "type": "string" + }, + "bit": { + "type": "integer" + } + } + } + } + } + } + }, + "extension-flags": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "input": { + "type": "object", + "additionalProperties": false, + "properties": { + "eax": { + "type": "integer" + }, + "ecx": { + "type": "integer" + } + } + }, + "bits": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "register": { + "type": "string" + }, + "bit": { + "type": "integer" + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/microarchitectures.json b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/microarchitectures.json new file mode 100644 index 0000000000000000000000000000000000000000..9275422ef4da53a21daf0b774f9d6ecb622c1d3e --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/microarchitectures.json @@ -0,0 +1,3644 @@ +{ + "microarchitectures": { + "x86": { + "from": [], + "vendor": "generic", + "features": [] + }, + "i686": { + "from": ["x86"], + "vendor": "GenuineIntel", + "features": [] + }, + "pentium2": { + "from": ["i686"], + "vendor": "GenuineIntel", + "features": [ + "mmx" + ] + }, + "pentium3": { + "from": ["pentium2"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse" + ] + }, + "pentium4": { + "from": ["pentium3"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2" + ] + }, + "prescott": { + "from": ["pentium4"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "sse3" + ] + }, + "x86_64": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "4.2.0:", + "name": "x86-64", + "flags": "-march={name} -mtune=generic" + }, + { + "versions": ":4.1.2", + "name": "x86-64", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": ":", + "name": "x86-64", + "flags": "-march={name}" + } + ], + "clang": [ + { + "versions": ":", + "name": "x86-64", + "flags": "-march={name} -mtune=generic" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "x86-64", + "flags": "-march={name} -mtune=generic" + } + ], + "intel": [ + { + "versions": ":", + "name": "pentium4", + "flags": "-march={name} -mtune=generic" + } + ], + "oneapi": [ + { + "versions": ":", + "name": "x86-64", + "flags": "-march={name} -mtune=generic" + } + ], + "dpcpp": [ + { + "versions": ":", + "name": "x86-64", + "flags": "-march={name} -mtune=generic" + } + ], + "nvhpc": [] + } + }, + "x86_64_v2": { + "from": ["x86_64"], + "vendor": "generic", + "features": [ + "cx16", + "lahf_lm", + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt" + ], + "compilers": { + "gcc": [ + { + "versions": "11.1:", + "name": "x86-64-v2", + "flags": "-march={name} -mtune=generic" + }, + { + "versions": "4.6:11.0", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3" + } + ], + "clang": [ + { + "versions": "12.0:", + "name": "x86-64-v2", + "flags": "-march={name} -mtune=generic" + }, + { + "versions": "3.9:11.1", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3" + } + ], + "intel": [ + { + "versions": "16.0:", + "name": "corei7", + "flags": "-march={name} -mtune=generic -mpopcnt" + } + ], + "oneapi": [ + { + "versions": "2021.2.0:", + "name": "x86-64-v2", + "flags": "-march={name} -mtune=generic" + } + ], + "dpcpp": [ + { + "versions": "2021.2.0:", + "name": "x86-64-v2", + "flags": "-march={name} -mtune=generic" + } + ], + "nvhpc": [] + } + }, + "x86_64_v3": { + "from": ["x86_64_v2"], + "vendor": "generic", + "features": [ + "cx16", + "lahf_lm", + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "avx", + "avx2", + "bmi1", + "bmi2", + "f16c", + "fma", + "abm", + "movbe", + "xsave" + ], + "compilers": { + "gcc": [ + { + "versions": "11.1:", + "name": "x86-64-v3", + "flags": "-march={name} -mtune=generic" + }, + { + "versions": "4.8:11.0", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave" + } + ], + "clang": [ + { + "versions": "12.0:", + "name": "x86-64-v3", + "flags": "-march={name} -mtune=generic" + }, + { + "versions": "3.9:11.1", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave" + } + ], + "intel": [ + { + "versions": "16.0:", + "name": "core-avx2", + "flags": "-march={name} -mtune={name} -fma -mf16c" + } + ], + "oneapi": [ + { + "versions": "2021.2.0:", + "name": "x86-64-v3", + "flags": "-march={name} -mtune=generic" + } + ], + "dpcpp": [ + { + "versions": "2021.2.0:", + "name": "x86-64-v3", + "flags": "-march={name} -mtune=generic" + } + ], + "nvhpc" : [ + { + "versions": ":", + "name": "px", + "flags": "-tp {name} -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mxsave" + } + ] + } + }, + "x86_64_v4": { + "from": ["x86_64_v3"], + "vendor": "generic", + "features": [ + "cx16", + "lahf_lm", + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "avx", + "avx2", + "bmi1", + "bmi2", + "f16c", + "fma", + "abm", + "movbe", + "xsave", + "avx512f", + "avx512bw", + "avx512cd", + "avx512dq", + "avx512vl" + ], + "compilers": { + "gcc": [ + { + "versions": "11.1:", + "name": "x86-64-v4", + "flags": "-march={name} -mtune=generic" + }, + { + "versions": "6.0:11.0", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave -mavx512f -mavx512bw -mavx512cd -mavx512dq -mavx512vl" + } + ], + "clang": [ + { + "versions": "12.0:", + "name": "x86-64-v4", + "flags": "-march={name} -mtune=generic" + }, + { + "versions": "3.9:11.1", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave -mavx512f -mavx512bw -mavx512cd -mavx512dq -mavx512vl" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "name": "x86-64", + "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave -mavx512f -mavx512bw -mavx512cd -mavx512dq -mavx512vl" + } + ], + "intel": [ + { + "versions": "16.0:", + "name": "skylake-avx512", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": "2021.2.0:", + "name": "x86-64-v4", + "flags": "-march={name} -mtune=generic" + } + ], + "dpcpp": [ + { + "versions": "2021.2.0:", + "name": "x86-64-v4", + "flags": "-march={name} -mtune=generic" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "px", + "flags": "-tp {name} -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mxsave -mavx512f -mavx512bw -mavx512cd -mavx512dq -mavx512vl" + } + ] + } + }, + "nocona": { + "from": ["x86_64"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "sse3" + ], + "compilers": { + "gcc": [ + { + "versions": "4.0.4:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [] + } + }, + "core2": { + "from": ["nocona"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3" + ], + "compilers": { + "gcc": [ + { + "versions": "4.3.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [] + } + }, + "nehalem": { + "from": ["core2", "x86_64_v2"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt" + ], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "4.6:4.8.5", + "name": "corei7", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "name": "corei7", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "name": "corei7", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "name": "corei7", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [] + } + }, + "westmere": { + "from": ["nehalem"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq" + ], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "name": "corei7", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "name": "corei7", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "name": "corei7", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [] + } + }, + "sandybridge": { + "from": ["westmere"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx" + ], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "4.6:4.8.5", + "name": "corei7-avx", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:17.9.0", + "name": "corei7-avx", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "18.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } + ] + } + }, + "ivybridge": { + "from": ["sandybridge"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c" + ], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "4.6:4.8.5", + "name": "core-avx-i", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:17.9.0", + "name": "core-avx-i", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "18.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } + ] + } + }, + "haswell": { + "from": ["ivybridge", "x86_64_v3"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2" + ], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "4.8:4.8.5", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:17.9.0", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "18.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } + ] + } + }, + "broadwell": { + "from": ["haswell"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx" + ], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "18.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "haswell", + "flags": "-tp {name}" + } + ] + } + }, + "skylake": { + "from": ["broadwell"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx", + "clflushopt", + "xsavec", + "xsaveopt" + ], + "compilers": { + "gcc": [ + { + "versions": "6.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "18.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "haswell", + "flags": "-tp {name}" + } + ] + } + }, + "mic_knl": { + "from": ["broadwell"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "avx2", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx", + "avx512f", + "avx512pf", + "avx512er", + "avx512cd" + ], + "compilers": { + "gcc": [ + { + "versions": "5.1:", + "name": "knl", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "name": "knl", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "knl", + "flags": "-march={name} -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "18.0:2021.2", + "name": "knl", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":2021.2", + "name": "knl", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":2021.2", + "name": "knl", + "flags": "-march={name} -mtune={name}" + } + ] + } + }, + "skylake_avx512": { + "from": ["skylake", "x86_64_v4"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx", + "clflushopt", + "xsavec", + "xsaveopt", + "avx512f", + "clwb", + "avx512vl", + "avx512bw", + "avx512dq", + "avx512cd" + ], + "compilers": { + "gcc": [ + { + "name": "skylake-avx512", + "versions": "6.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "name": "skylake-avx512", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "skylake-avx512", + "flags": "-march={name} -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "18.0:", + "name": "skylake-avx512", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "name": "skylake-avx512", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "name": "skylake-avx512", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } + ] + } + }, + "cannonlake": { + "from": ["skylake"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx", + "clflushopt", + "xsavec", + "xsaveopt", + "avx512f", + "avx512vl", + "avx512bw", + "avx512dq", + "avx512cd", + "avx512vbmi", + "avx512ifma", + "sha" + ], + "compilers": { + "gcc": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "18.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } + ] + } + }, + "cascadelake": { + "from": ["skylake_avx512"], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx", + "clflushopt", + "xsavec", + "xsaveopt", + "avx512f", + "clwb", + "avx512vl", + "avx512bw", + "avx512dq", + "avx512cd", + "avx512_vnni" + ], + "compilers": { + "gcc": [ + { + "versions": "9.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "11.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "19.0.1:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } + ] + } + }, + "icelake": { + "from": [ + "cascadelake", + "cannonlake" + ], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx", + "clflushopt", + "xsavec", + "xsaveopt", + "avx512f", + "avx512vl", + "avx512bw", + "avx512dq", + "avx512cd", + "avx512vbmi", + "avx512ifma", + "sha_ni", + "clwb", + "rdpid", + "gfni", + "avx512_vbmi2", + "avx512_vpopcntdq", + "avx512_bitalg", + "avx512_vnni", + "vpclmulqdq", + "vaes" + ], + "compilers": { + "gcc": [ + { + "name": "icelake-client", + "versions": "8.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "7.0:", + "name": "icelake-client", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "6.0:6.9", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "icelake-client", + "flags": "-march={name} -mtune={name}" + } + ], + "apple-clang": [ + { + "versions": "10.0.1:", + "name": "icelake-client", + "flags": "-march={name} -mtune={name}" + }, + { + "versions": "10.0.0:10.0.99", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "18.0:", + "name": "icelake-client", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "name": "icelake-client", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "name": "icelake-client", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } + ] + } + }, + "sapphirerapids": { + "from": [ + "icelake" + ], + "vendor": "GenuineIntel", + "features": [ + "mmx", + "sse", + "sse2", + "ssse3", + "sse4_1", + "sse4_2", + "popcnt", + "aes", + "pclmulqdq", + "avx", + "rdrand", + "f16c", + "movbe", + "fma", + "avx2", + "bmi1", + "bmi2", + "rdseed", + "adx", + "clflushopt", + "xsavec", + "xsaveopt", + "avx512f", + "avx512vl", + "avx512bw", + "avx512dq", + "avx512cd", + "avx512vbmi", + "avx512ifma", + "sha_ni", + "clwb", + "rdpid", + "gfni", + "avx512_vbmi2", + "avx512_vpopcntdq", + "avx512_bitalg", + "avx512_vnni", + "vpclmulqdq", + "vaes", + "avx512_bf16", + "cldemote", + "movdir64b", + "movdiri", + "serialize", + "waitpkg" + ], + "compilers": { + "gcc": [ + { + "versions": "11.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "12.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "2021.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": "2021.2:", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": "2021.2:", + "flags": "-march={name} -mtune={name}" + } + ] + } + }, + "k10": { + "from": ["x86_64"], + "vendor": "AuthenticAMD", + "features": [ + "mmx", + "sse", + "sse2", + "sse4a", + "abm", + "cx16", + "3dnow", + "3dnowext" + ], + "compilers": { + "gcc": [ + { + "name": "amdfam10", + "versions": "4.3:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "name": "amdfam10", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "amdfam10", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse2" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse2" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse2" + } + ], + "nvhpc": [] + } + }, + "bulldozer": { + "from": ["x86_64_v2"], + "vendor": "AuthenticAMD", + "features": [ + "mmx", + "sse", + "sse2", + "sse4a", + "abm", + "avx", + "xop", + "fma4", + "aes", + "pclmulqdq", + "cx16", + "ssse3", + "sse4_1", + "sse4_2" + ], + "compilers": { + "gcc": [ + { + "name": "bdver1", + "versions": "4.7:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "name": "bdver1", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "bdver1", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse3" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse3" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse3" + } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } + ] + } + }, + "piledriver": { + "from": ["bulldozer"], + "vendor": "AuthenticAMD", + "features": [ + "mmx", + "sse", + "sse2", + "sse4a", + "abm", + "avx", + "xop", + "fma4", + "aes", + "pclmulqdq", + "cx16", + "ssse3", + "sse4_1", + "sse4_2", + "bmi1", + "f16c", + "fma", + "tbm" + ], + "compilers": { + "gcc": [ + { + "name": "bdver2", + "versions": "4.7:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "name": "bdver2", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "bdver2", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse3" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse3" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse3" + } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } + ] + } + }, + "steamroller": { + "from": ["piledriver"], + "vendor": "AuthenticAMD", + "features": [ + "mmx", + "sse", + "sse2", + "sse4a", + "abm", + "avx", + "xop", + "fma4", + "aes", + "pclmulqdq", + "cx16", + "ssse3", + "sse4_1", + "sse4_2", + "bmi1", + "f16c", + "fma", + "fsgsbase", + "tbm" + ], + "compilers": { + "gcc": [ + { + "name": "bdver3", + "versions": "4.8:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "name": "bdver3", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "bdver3", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse4.2" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse4.2" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "flags": "-msse4.2" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "piledriver", + "flags": "-tp {name}" + } + ] + } + }, + "excavator": { + "from": ["steamroller", "x86_64_v3"], + "vendor": "AuthenticAMD", + "features": [ + "mmx", + "sse", + "sse2", + "sse4a", + "abm", + "avx", + "xop", + "fma4", + "aes", + "pclmulqdq", + "cx16", + "ssse3", + "sse4_1", + "sse4_2", + "bmi1", + "f16c", + "fma", + "fsgsbase", + "bmi2", + "avx2", + "movbe", + "tbm" + ], + "compilers": { + "gcc": [ + { + "name": "bdver4", + "versions": "4.9:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "name": "bdver4", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "bdver4", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "piledriver", + "flags": "-tp {name}" + } + ] + } + }, + "zen": { + "from": ["x86_64_v3"], + "vendor": "AuthenticAMD", + "features": [ + "bmi1", + "bmi2", + "f16c", + "fma", + "fsgsbase", + "avx", + "avx2", + "rdseed", + "clzero", + "aes", + "pclmulqdq", + "cx16", + "movbe", + "mmx", + "sse", + "sse2", + "sse4a", + "ssse3", + "sse4_1", + "sse4_2", + "abm", + "xsavec", + "xsaveopt", + "clflushopt", + "popcnt" + ], + "compilers": { + "gcc": [ + { + "name": "znver1", + "versions": "6.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "4.0:", + "name": "znver1", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "znver1", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } + ] + } + }, + "zen2": { + "from": ["zen"], + "vendor": "AuthenticAMD", + "features": [ + "bmi1", + "bmi2", + "f16c", + "fma", + "fsgsbase", + "avx", + "avx2", + "rdseed", + "clzero", + "aes", + "pclmulqdq", + "cx16", + "movbe", + "mmx", + "sse", + "sse2", + "sse4a", + "ssse3", + "sse4_1", + "sse4_2", + "abm", + "xsavec", + "xsaveopt", + "clflushopt", + "popcnt", + "clwb" + ], + "compilers": { + "gcc": [ + { + "name": "znver2", + "versions": "9.0:", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "9.0:", + "name": "znver2", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "2.2:", + "name": "znver2", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": "20.5:", + "flags": "-tp {name}" + } + ] + } + }, + "zen3": { + "from": ["zen2"], + "vendor": "AuthenticAMD", + "features": [ + "bmi1", + "bmi2", + "f16c", + "fma", + "fsgsbase", + "avx", + "avx2", + "rdseed", + "clzero", + "aes", + "pclmulqdq", + "cx16", + "movbe", + "mmx", + "sse", + "sse2", + "sse4a", + "ssse3", + "sse4_1", + "sse4_2", + "abm", + "xsavec", + "xsaveopt", + "clflushopt", + "popcnt", + "clwb", + "vaes", + "vpclmulqdq", + "pku" + ], + "compilers": { + "gcc": [ + { + "versions": "10.3:", + "name": "znver3", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "12.0:", + "name": "znver3", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "3.0:", + "name": "znver3", + "flags": "-march={name} -mtune={name}" + } + ], + "intel": [ + { + "versions": "16.0:", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "oneapi": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "dpcpp": [ + { + "versions": ":", + "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", + "name": "core-avx2", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": "21.11:", + "flags": "-tp {name}" + } + ] + } + }, + "zen4": { + "from": ["zen3", "x86_64_v4"], + "vendor": "AuthenticAMD", + "features": [ + "bmi1", + "bmi2", + "f16c", + "fma", + "fsgsbase", + "avx", + "avx2", + "rdseed", + "clzero", + "aes", + "pclmulqdq", + "cx16", + "movbe", + "mmx", + "sse", + "sse2", + "sse4a", + "ssse3", + "sse4_1", + "sse4_2", + "abm", + "xsavec", + "xsaveopt", + "clflushopt", + "popcnt", + "clwb", + "vaes", + "vpclmulqdq", + "pku", + "gfni", + "flush_l1d", + "avx512f", + "avx512dq", + "avx512ifma", + "avx512cd", + "avx512bw", + "avx512vl", + "avx512_bf16", + "avx512vbmi", + "avx512_vbmi2", + "avx512_vnni", + "avx512_bitalg", + "avx512_vpopcntdq" + ], + "compilers": { + "gcc": [ + { + "versions": "10.3:12.2", + "name": "znver3", + "flags": "-march={name} -mtune={name} -mavx512f -mavx512dq -mavx512ifma -mavx512cd -mavx512bw -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512vnni -mavx512bitalg" + }, + { + "versions": "12.3:", + "name": "znver4", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "12.0:15.9", + "name": "znver3", + "flags": "-march={name} -mtune={name} -mavx512f -mavx512dq -mavx512ifma -mavx512cd -mavx512bw -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512vnni -mavx512bitalg" + }, + { + "versions": "16.0:", + "name": "znver4", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "3.0:3.9", + "name": "znver3", + "flags": "-march={name} -mtune={name} -mavx512f -mavx512dq -mavx512ifma -mavx512cd -mavx512bw -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512vnni -mavx512bitalg", + "warnings": "Zen4 processors are not fully supported by AOCC versions < 4.0. For optimal performance please upgrade to a newer version of AOCC" + }, + { + "versions": "4.0:", + "name": "znver4", + "flags": "-march={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": "21.11:23.8", + "name": "zen3", + "flags": "-tp {name}", + "warnings": "zen4 is not fully supported by nvhpc versions < 23.9, falling back to zen3" + }, + { + "versions": "23.9:", + "flags": "-tp {name}" + } + ] + } + }, + "zen5": { + "from": ["zen4"], + "vendor": "AuthenticAMD", + "features": [ + "abm", + "aes", + "avx", + "avx2", + "avx512_bf16", + "avx512_bitalg", + "avx512bw", + "avx512cd", + "avx512dq", + "avx512f", + "avx512ifma", + "avx512vbmi", + "avx512_vbmi2", + "avx512vl", + "avx512_vnni", + "avx512_vp2intersect", + "avx512_vpopcntdq", + "avx_vnni", + "bmi1", + "bmi2", + "clflushopt", + "clwb", + "clzero", + "cppc", + "cx16", + "f16c", + "flush_l1d", + "fma", + "fsgsbase", + "gfni", + "ibrs_enhanced", + "mmx", + "movbe", + "movdir64b", + "movdiri", + "pclmulqdq", + "popcnt", + "rdseed", + "sse", + "sse2", + "sse4_1", + "sse4_2", + "sse4a", + "ssse3", + "tsc_adjust", + "vaes", + "vpclmulqdq", + "xsavec", + "xsaveopt" + ], + "compilers": { + "gcc": [ + { + "versions": "14.1:", + "name": "znver5", + "flags": "-march={name} -mtune={name}" + } + ], + "aocc": [ + { + "versions": "5.0:", + "name": "znver5", + "flags": "-march={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "19.1:", + "name": "znver5", + "flags": "-march={name} -mtune={name}" + } + ] + } + }, + "ppc64": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "name": "powerpc64", + "versions": ":", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": ":", + "flags": "-mcpu={name} -mtune={name}" + } + ] + } + }, + "power7": { + "from": ["ppc64"], + "vendor": "IBM", + "generation": 7, + "features": [], + "compilers": { + "gcc": [ + { + "versions": "4.4:", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-mcpu={name} -mtune={name}" + } + ] + } + }, + "power8": { + "from": ["power7"], + "vendor": "IBM", + "generation": 8, + "features": [], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "flags": "-mcpu={name} -mtune={name}" + }, + { + "versions": "4.8:4.8.5", + "warnings": "Using GCC 4.8 to optimize for Power 8 might not work if you are not on Red Hat Enterprise Linux 7, where a custom backport of the feature has been done. Upstream support from GCC starts in version 4.9", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-mcpu={name} -mtune={name}" + } + ] + } + }, + "power9": { + "from": ["power8"], + "vendor": "IBM", + "generation": 9, + "features": [], + "compilers": { + "gcc": [ + { + "versions": "6.0:", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "flags": "-mcpu={name} -mtune={name}" + } + ] + } + }, + "power10": { + "from": ["power9"], + "vendor": "IBM", + "generation": 10, + "features": [], + "compilers": { + "gcc": [ + { + "versions": "11.1:", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "11.0:", + "flags": "-mcpu={name} -mtune={name}" + } + ] + } + }, + "ppc64le": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "name": "powerpc64le", + "versions": "4.8:", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": ":", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "nvhpc": [] + } + }, + "power8le": { + "from": ["ppc64le"], + "vendor": "IBM", + "generation": 8, + "features": [], + "compilers": { + "gcc": [ + { + "versions": "4.9:", + "name": "power8", + "flags": "-mcpu={name} -mtune={name}" + }, + { + "versions": "4.8:4.8.5", + "warnings": "Using GCC 4.8 to optimize for Power 8 might not work if you are not on Red Hat Enterprise Linux 7, where a custom backport of the feature has been done. Upstream support from GCC starts in version 4.9", + "name": "power8", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "family": "ppc64le", + "name": "power8", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "pwr8", + "flags": "-tp {name}" + } + ] + } + }, + "power9le": { + "from": ["power8le"], + "vendor": "IBM", + "generation": 9, + "features": [], + "compilers": { + "gcc": [ + { + "name": "power9", + "versions": "6.0:", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "3.9:", + "family": "ppc64le", + "name": "power9", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "nvhpc": [ + { + "versions": ":", + "name": "pwr9", + "flags": "-tp {name}" + } + ] + } + }, + "power10le": { + "from": ["power9le"], + "vendor": "IBM", + "generation": 10, + "features": [], + "compilers": { + "gcc": [ + { + "name": "power10", + "versions": "11.1:", + "flags": "-mcpu={name} -mtune={name}" + } + ], + "clang": [ + { + "versions": "11.0:", + "family": "ppc64le", + "name": "power10", + "flags": "-mcpu={name} -mtune={name}" + } + ] + } + }, + "aarch64": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "4.8.0:", + "flags": "-march=armv8-a -mtune=generic" + } + ], + "clang": [ + { + "versions": ":", + "flags": "-march=armv8-a -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": ":", + "flags": "-march=armv8-a -mtune=generic" + } + ], + "arm": [ + { + "versions": ":", + "flags": "-march=armv8-a -mtune=generic" + } + ], + "nvhpc": [] + } + }, + "armv8.1a": { + "from": ["aarch64"], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "5:", + "flags": "-march=armv8.1-a -mtune=generic" + } + ], + "clang": [ + { + "versions": ":", + "flags": "-march=armv8.1-a -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": ":", + "flags": "-march=armv8.1-a -mtune=generic" + } + ], + "arm": [ + { + "versions": ":", + "flags": "-march=armv8.1-a -mtune=generic" + } + ] + } + }, + "armv8.2a": { + "from": ["armv8.1a"], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "6:", + "flags": "-march=armv8.2-a -mtune=generic" + } + ], + "clang": [ + { + "versions": ":", + "flags": "-march=armv8.2-a -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": ":", + "flags": "-march=armv8.2-a -mtune=generic" + } + ], + "arm": [ + { + "versions": ":", + "flags": "-march=armv8.2-a -mtune=generic" + } + ] + } + }, + "armv8.3a": { + "from": ["armv8.2a"], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "6:", + "flags": "-march=armv8.3-a -mtune=generic" + } + ], + "clang": [ + { + "versions": "6:", + "flags": "-march=armv8.3-a -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": ":", + "flags": "-march=armv8.3-a -mtune=generic" + } + ], + "arm": [ + { + "versions": ":", + "flags": "-march=armv8.3-a -mtune=generic" + } + ] + } + }, + "armv8.4a": { + "from": ["armv8.3a"], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "8:", + "flags": "-march=armv8.4-a -mtune=generic" + } + ], + "clang": [ + { + "versions": "8:", + "flags": "-march=armv8.4-a -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": ":", + "flags": "-march=armv8.4-a -mtune=generic" + } + ], + "arm": [ + { + "versions": ":", + "flags": "-march=armv8.4-a -mtune=generic" + } + ] + } + }, + "armv8.5a": { + "from": ["armv8.4a"], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "9:", + "flags": "-march=armv8.5-a -mtune=generic" + } + ], + "clang": [ + { + "versions": "11:", + "flags": "-march=armv8.5-a -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": ":", + "flags": "-march=armv8.5-a -mtune=generic" + } + ], + "arm": [ + { + "versions": ":", + "flags": "-march=armv8.5-a -mtune=generic" + } + ] + } + }, + "armv9.0a": { + "from": ["armv8.5a"], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "12:", + "flags": "-march=armv9-a -mtune=generic" + } + ], + "clang": [ + { + "versions": "14:", + "flags": "-march=armv9-a -mtune=generic" + } + ], + "apple-clang": [ + { + "versions": ":", + "flags": "-march=armv9-a -mtune=generic" + } + ], + "arm": [ + { + "versions": ":", + "flags": "-march=armv9-a -mtune=generic" + } + ] + } + }, + "thunderx2": { + "from": ["armv8.1a"], + "vendor": "Cavium", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "cpuid", + "asimdrdm" + ], + "compilers": { + "gcc": [ + { + "versions": "4.8:4.8.9", + "flags": "-march=armv8-a" + }, + { + "versions": "4.9:5.9", + "flags": "-march=armv8-a+crc+crypto" + }, + { + "versions": "6:6.9", + "flags": "-march=armv8.1-a+crc+crypto" + }, + { + "versions": "7:", + "flags": "-mcpu=thunderx2t99" + } + ], + "clang": [ + { + "versions": "3.9:4.9", + "flags": "-march=armv8.1-a+crc+crypto" + }, + { + "versions": "5:", + "flags": "-mcpu=thunderx2t99" + } + ] + }, + "cpupart": "0x0af" + }, + "a64fx": { + "from": ["armv8.2a"], + "vendor": "Fujitsu", + "features": [ + "fp", + "asimd", + "evtstrm", + "sha1", + "sha2", + "crc32", + "atomics", + "cpuid", + "asimdrdm", + "fphp", + "asimdhp", + "fcma", + "dcpop", + "sve" + ], + "compilers": { + "gcc": [ + { + "versions": "4.8:4.8.9", + "flags": "-march=armv8-a" + }, + { + "versions": "4.9:5.9", + "flags": "-march=armv8-a+crc+crypto" + }, + { + "versions": "6:6.9", + "flags": "-march=armv8.1-a+crc+crypto" + }, + { + "versions": "7:7.9", + "flags": "-march=armv8.2-a+crc+crypto+fp16" + }, + { + "versions": "8:10.2", + "flags": "-march=armv8.2-a+crc+sha2+fp16+sve -msve-vector-bits=512" + }, + { + "versions": "10.3:", + "flags": "-mcpu=a64fx -msve-vector-bits=512" + } + ], + "clang": [ + { + "versions": "3.9:4.9", + "flags": "-march=armv8.2-a+crc+sha2+fp16" + }, + { + "versions": "5:10", + "flags": "-march=armv8.2-a+crc+sha2+fp16+sve" + }, + { + "versions": "11:", + "flags": "-mcpu=a64fx" + } + ], + "arm": [ + { + "versions": "20:", + "flags": "-march=armv8.2-a+crc+crypto+fp16+sve" + } + ] + }, + "cpupart": "0x001" + }, + "cortex_a72": { + "from": ["aarch64"], + "vendor": "ARM", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "cpuid" + ], + "compilers" : { + "gcc": [ + { + "versions": "4.8:4.8.9", + "flags" : "-march=armv8-a" + }, + { + "versions": "4.9:5.9", + "flags" : "-march=armv8-a+crc+crypto" + }, + { + "versions": "6:", + "flags" : "-mcpu=cortex-a72" + } + ], + "clang" : [ + { + "versions": "3.9:", + "flags" : "-mcpu=cortex-a72" + } + ] + }, + "cpupart": "0xd08" + }, + "neoverse_n1": { + "from": ["cortex_a72", "armv8.2a"], + "vendor": "ARM", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "fphp", + "asimdhp", + "cpuid", + "asimdrdm", + "lrcpc", + "dcpop", + "asimddp" + ], + "compilers" : { + "gcc": [ + { + "versions": "4.8:4.8.9", + "flags": "-march=armv8-a" + }, + { + "versions": "4.9:5.9", + "flags": "-march=armv8-a+crc+crypto" + }, + { + "versions": "6:6.9", + "flags" : "-march=armv8.1-a" + }, + { + "versions": "7:7.9", + "flags" : "-march=armv8.2-a+fp16 -mtune=cortex-a72" + }, + { + "versions": "8.0:8.0", + "flags" : "-march=armv8.2-a+fp16+dotprod+crypto -mtune=cortex-a72" + }, + { + "versions": "8.1:8.9", + "flags" : "-march=armv8.2-a+fp16+rcpc+dotprod+crypto -mtune=cortex-a72" + }, + { + "versions": "9.0:", + "flags" : "-mcpu=neoverse-n1" + } + ], + "clang" : [ + { + "versions": "3.9:4.9", + "flags" : "-march=armv8.2-a+fp16+crc+crypto" + }, + { + "versions": "5:", + "flags" : "-march=armv8.2-a+fp16+rcpc+dotprod+crypto" + }, + { + "versions": "10:", + "flags" : "-mcpu=neoverse-n1" + } + ], + "arm" : [ + { + "versions": "20:21.9", + "flags" : "-march=armv8.2-a+fp16+rcpc+dotprod+crypto" + }, + { + "versions": "22:", + "flags" : "-mcpu=neoverse-n1" + } + ], + "nvhpc" : [ + { + "versions": "22.5:", + "name": "neoverse-n1", + "flags": "-tp {name}" + } + ] + }, + "cpupart": "0xd0c" + }, + "neoverse_v1": { + "from": ["neoverse_n1", "armv8.4a"], + "vendor": "ARM", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "fphp", + "asimdhp", + "cpuid", + "asimdrdm", + "jscvt", + "fcma", + "lrcpc", + "dcpop", + "sha3", + "asimddp", + "sha512", + "sve", + "asimdfhm", + "dit", + "uscat", + "ilrcpc", + "flagm", + "dcpodp", + "svei8mm", + "svebf16", + "i8mm", + "bf16", + "dgh", + "rng" + ], + "compilers" : { + "gcc": [ + { + "versions": "4.8:4.8.9", + "flags": "-march=armv8-a" + }, + { + "versions": "4.9:5.9", + "flags": "-march=armv8-a+crc+crypto" + }, + { + "versions": "6:6.9", + "flags" : "-march=armv8.1-a" + }, + { + "versions": "7:7.9", + "flags" : "-march=armv8.2-a+crypto+fp16 -mtune=cortex-a72" + }, + { + "versions": "8.0:8.4", + "flags" : "-march=armv8.2-a+fp16+dotprod+crypto -mtune=cortex-a72" + }, + { + "versions": "8.5:8.9", + "flags" : "-mcpu=neoverse-v1" + }, + { + "versions": "9.0:9.3", + "flags" : "-march=armv8.2-a+fp16+dotprod+crypto -mtune=cortex-a72" + }, + { + "versions": "9.4:9.9", + "flags" : "-mcpu=neoverse-v1" + }, + { + "versions": "10.0:10.1", + "flags" : "-march=armv8.2-a+fp16+dotprod+crypto -mtune=cortex-a72" + }, + { + "versions": "10.2:10.2.99", + "flags" : "-mcpu=zeus" + }, + { + "versions": "10.3:", + "flags" : "-mcpu=neoverse-v1" + } + + ], + "clang" : [ + { + "versions": "3.9:4.9", + "flags" : "-march=armv8.2-a+fp16+crc+crypto" + }, + { + "versions": "5:10", + "flags" : "-march=armv8.2-a+fp16+rcpc+dotprod+crypto" + }, + { + "versions": "11:", + "flags" : "-march=armv8.4-a+sve+fp16+bf16+crypto+i8mm+rng" + }, + { + "versions": "12:", + "flags" : "-mcpu=neoverse-v1" + } + ], + "arm" : [ + { + "versions": "20:21.9", + "flags" : "-march=armv8.2-a+sve+fp16+rcpc+dotprod+crypto" + }, + { + "versions": "22:", + "flags" : "-mcpu=neoverse-v1" + } + ], + "nvhpc" : [ + { + "versions": "22.5:", + "name": "neoverse-n1", + "flags": "-tp {name}" + } + ] + }, + "cpupart": "0xd40" + }, + "neoverse_v2": { + "from": ["neoverse_n1", "armv9.0a"], + "vendor": "ARM", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "fphp", + "asimdhp", + "cpuid", + "asimdrdm", + "jscvt", + "fcma", + "lrcpc", + "dcpop", + "sha3", + "asimddp", + "sha512", + "sve", + "asimdfhm", + "uscat", + "ilrcpc", + "flagm", + "sb", + "dcpodp", + "sve2", + "flagm2", + "frint", + "svei8mm", + "svebf16", + "i8mm", + "bf16" + ], + "compilers" : { + "gcc": [ + { + "versions": "4.8:5.99", + "flags": "-march=armv8-a" + }, + { + "versions": "6:6.99", + "flags" : "-march=armv8.1-a" + }, + { + "versions": "7.0:7.99", + "flags" : "-march=armv8.2-a -mtune=cortex-a72" + }, + { + "versions": "8.0:8.99", + "flags" : "-march=armv8.4-a+sve -mtune=cortex-a72" + }, + { + "versions": "9.0:9.99", + "flags" : "-march=armv8.5-a+sve -mtune=cortex-a76" + }, + { + "versions": "10.0:11.3.99", + "flags" : "-march=armv8.5-a+sve+sve2+i8mm+bf16 -mtune=cortex-a77" + }, + { + "versions": "11.4:11.99", + "flags" : "-mcpu=neoverse-v2" + }, + { + "versions": "12.0:12.2.99", + "flags" : "-march=armv9-a+i8mm+bf16 -mtune=cortex-a710" + }, + { + "versions": "12.3:", + "flags" : "-mcpu=neoverse-v2" + } + ], + "clang" : [ + { + "versions": "9.0:10.99", + "flags" : "-march=armv8.5-a+sve" + }, + { + "versions": "11.0:13.99", + "flags" : "-march=armv8.5-a+sve+sve2+i8mm+bf16" + }, + { + "versions": "14.0:15.99", + "flags" : "-march=armv9-a+i8mm+bf16" + }, + { + "versions": "16.0:", + "flags" : "-mcpu=neoverse-v2" + } + ], + "arm" : [ + { + "versions": "23.04.0:", + "flags" : "-mcpu=neoverse-v2" + } + ], + "nvhpc" : [ + { + "versions": "23.3:", + "name": "neoverse-v2", + "flags": "-tp {name}" + } + ] + }, + "cpupart": "0xd4f" + }, + "neoverse_n2": { + "from": ["neoverse_n1", "armv9.0a"], + "vendor": "ARM", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "fphp", + "asimdhp", + "cpuid", + "asimdrdm", + "jscvt", + "fcma", + "lrcpc", + "dcpop", + "sha3", + "asimddp", + "sha512", + "sve", + "asimdfhm", + "uscat", + "ilrcpc", + "flagm", + "sb", + "dcpodp", + "sve2", + "flagm2", + "frint", + "svei8mm", + "svebf16", + "i8mm", + "bf16" + ], + "compilers" : { + "gcc": [ + { + "versions": "4.8:5.99", + "flags": "-march=armv8-a" + }, + { + "versions": "6:6.99", + "flags" : "-march=armv8.1-a" + }, + { + "versions": "7.0:7.99", + "flags" : "-march=armv8.2-a -mtune=cortex-a72" + }, + { + "versions": "8.0:8.99", + "flags" : "-march=armv8.4-a+sve -mtune=cortex-a72" + }, + { + "versions": "9.0:9.99", + "flags" : "-march=armv8.5-a+sve -mtune=cortex-a76" + }, + { + "versions": "10.0:10.99", + "flags" : "-march=armv8.5-a+sve+sve2+i8mm+bf16 -mtune=cortex-a77" + }, + { + "versions": "11.0:", + "flags" : "-mcpu=neoverse-n2" + } + ], + "clang" : [ + { + "versions": "9.0:10.99", + "flags" : "-march=armv8.5-a+sve" + }, + { + "versions": "11.0:13.99", + "flags" : "-march=armv8.5-a+sve+sve2+i8mm+bf16" + }, + { + "versions": "14.0:15.99", + "flags" : "-march=armv9-a+i8mm+bf16" + }, + { + "versions": "16.0:", + "flags" : "-mcpu=neoverse-n2" + } + ], + "arm" : [ + { + "versions": "23.04.0:", + "flags" : "-mcpu=neoverse-n2" + } + ], + "nvhpc" : [ + { + "versions": "23.3:", + "name": "neoverse-n1", + "flags": "-tp {name}" + } + ] + }, + "cpupart": "0xd49" + }, + "m1": { + "from": ["armv8.4a"], + "vendor": "Apple", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "fphp", + "asimdhp", + "cpuid", + "asimdrdm", + "jscvt", + "fcma", + "lrcpc", + "dcpop", + "sha3", + "asimddp", + "sha512", + "asimdfhm", + "dit", + "uscat", + "ilrcpc", + "flagm", + "ssbs", + "sb", + "paca", + "pacg", + "dcpodp", + "flagm2", + "frint" + ], + "compilers": { + "gcc": [ + { + "versions": "8.0:", + "flags" : "-march=armv8.4-a -mtune=generic" + } + ], + "clang" : [ + { + "versions": "9.0:12.0", + "flags" : "-march=armv8.4-a" + }, + { + "versions": "13.0:", + "flags" : "-mcpu=apple-m1" + } + ], + "apple-clang": [ + { + "versions": "11.0:12.5", + "flags" : "-march=armv8.4-a" + }, + { + "versions": "13.0:", + "flags" : "-mcpu=apple-m1" + } + ] + }, + "cpupart": "0x022" + }, + "m2": { + "from": ["m1", "armv8.5a"], + "vendor": "Apple", + "features": [ + "fp", + "asimd", + "evtstrm", + "aes", + "pmull", + "sha1", + "sha2", + "crc32", + "atomics", + "fphp", + "asimdhp", + "cpuid", + "asimdrdm", + "jscvt", + "fcma", + "lrcpc", + "dcpop", + "sha3", + "asimddp", + "sha512", + "asimdfhm", + "dit", + "uscat", + "ilrcpc", + "flagm", + "ssbs", + "sb", + "paca", + "pacg", + "dcpodp", + "flagm2", + "frint", + "ecv", + "bf16", + "i8mm", + "bti" + ], + "compilers": { + "gcc": [ + { + "versions": "8.0:", + "flags" : "-march=armv8.5-a -mtune=generic" + } + ], + "clang" : [ + { + "versions": "9.0:12.0", + "flags" : "-march=armv8.5-a" + }, + { + "versions": "13.0:", + "flags" : "-mcpu=apple-m1" + }, + { + "versions": "16.0:", + "flags" : "-mcpu=apple-m2" + } + ], + "apple-clang": [ + { + "versions": "11.0:12.5", + "flags" : "-march=armv8.5-a" + }, + { + "versions": "13.0:14.0.2", + "flags" : "-mcpu=apple-m1" + }, + { + "versions": "14.0.2:", + "flags" : "-mcpu=apple-m2" + } + ] + }, + "cpupart": "0x032" + }, + "arm": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + "clang": [ + { + "versions": ":", + "family": "arm", + "flags": "-march={family} -mcpu=generic" + } + ] + } + }, + "ppc": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + } + }, + "ppcle": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + } + }, + "sparc": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + } + }, + "sparc64": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + } + }, + "riscv64": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "7.1:", + "flags" : "-march=rv64gc" + } + ], + "clang": [ + { + "versions": "9.0:", + "flags" : "-march=rv64gc" + } + ] + } + }, + "u74mc": { + "from": ["riscv64"], + "vendor": "SiFive", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "10.2:", + "flags" : "-march=rv64gc -mtune=sifive-7-series" + } + ], + "clang" : [ + { + "versions": "12.0:", + "flags" : "-march=rv64gc -mtune=sifive-7-series" + } + ] + } + } + }, + "feature_aliases": { + "sse3": { + "reason": "ssse3 is a superset of sse3 and might be the only one listed", + "any_of": [ + "ssse3" + ] + }, + "avx512": { + "reason": "avx512 indicates generic support for any of the avx512 instruction sets", + "any_of": [ + "avx512f", + "avx512vl", + "avx512bw", + "avx512dq", + "avx512cd" + ] + }, + "altivec": { + "reason": "altivec is supported by Power PC architectures, but might not be listed in features", + "families": [ + "ppc64le", + "ppc64" + ] + }, + "vsx": { + "reason": "VSX alitvec extensions are supported by PowerISA from v2.06 (Power7+), but might not be listed in features", + "families": [ + "ppc64le", + "ppc64" + ] + }, + "fma": { + "reason": "FMA has been supported by PowerISA since Power1, but might not be listed in features", + "families": [ + "ppc64le", + "ppc64" + ] + }, + "sse4.1": { + "reason": "permits to refer to sse4_1 also as sse4.1", + "any_of": [ + "sse4_1" + ] + }, + "sse4.2": { + "reason": "permits to refer to sse4_2 also as sse4.2", + "any_of": [ + "sse4_2" + ] + }, + "neon": { + "reason": "NEON is required in all standard ARMv8 implementations", + "families": [ + "aarch64" + ] + } + }, + "conversions": { + "description": "Conversions that map some platform specific values to canonical values", + "arm_vendors": { + "0x41": "ARM", + "0x42": "Broadcom", + "0x43": "Cavium", + "0x44": "DEC", + "0x46": "Fujitsu", + "0x48": "HiSilicon", + "0x49": "Infineon Technologies AG", + "0x4d": "Motorola", + "0x4e": "Nvidia", + "0x50": "APM", + "0x51": "Qualcomm", + "0x53": "Samsung", + "0x56": "Marvell", + "0x61": "Apple", + "0x66": "Faraday", + "0x68": "HXT", + "0x69": "Intel" + }, + "darwin_flags": { + "sse4.1": "sse4_1", + "sse4.2": "sse4_2", + "avx1.0": "avx", + "clfsopt": "clflushopt", + "xsave": "xsavec xsaveopt" + } + } +} diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/microarchitectures_schema.json b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/microarchitectures_schema.json new file mode 100644 index 0000000000000000000000000000000000000000..085e5b95772e6a71e72afb21678cb1efe731b4d1 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/cpu/microarchitectures_schema.json @@ -0,0 +1,113 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Schema for microarchitecture definitions and feature aliases", + "type": "object", + "additionalProperties": false, + "properties": { + "microarchitectures": { + "type": "object", + "patternProperties": { + "([\\w]*)": { + "type": "object", + "properties": { + "from": { + "$comment": "More than one parent", + "type": "array", + "items": { + "type": "string" + } + }, + "vendor": { + "type": "string" + }, + "features": { + "type": "array", + "items": { + "type": "string" + } + }, + "compilers": { + "type": "object", + "patternProperties": { + "([\\w]*)": { + "$comment": "Permit multiple entries since compilers change options across versions", + "type": "array", + "items": { + "type": "object", + "properties": { + "versions": { + "type": "string" + }, + "name": { + "type": "string" + }, + "flags": { + "type": "string" + } + }, + "required": [ + "versions", + "flags" + ] + } + } + } + }, + "cpupart": { + "type": "string" + } + }, + "required": [ + "from", + "vendor", + "features" + ] + } + } + }, + "feature_aliases": { + "type": "object", + "patternProperties": { + "([\\w]*)": { + "type": "object", + "properties": { + "reason": { + "$comment": "Comment containing the reason why an alias is there", + "type": "string" + }, + "any_of": { + "$comment": "The alias is true if any of the items is a feature of the target", + "type": "array", + "items": { + "type": "string" + } + }, + "families": { + "$comment": "The alias is true if the family of the target is in this list", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + }, + "conversions": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "arm_vendors": { + "type": "object" + }, + "darwin_flags": { + "type": "object" + } + }, + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/bgq-rhel6-power7 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/bgq-rhel6-power7 new file mode 100644 index 0000000000000000000000000000000000000000..39da8a49fe06920f0a9ac714612ccc625551523b --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/bgq-rhel6-power7 @@ -0,0 +1,4 @@ +processor : 0 +cpu : POWER7 (architected), altivec supported +clock : 3720.000000MHz +revision : 2.1 (pvr 003f 0201) diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-bigsur-m1 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-bigsur-m1 new file mode 100644 index 0000000000000000000000000000000000000000..b033bcb90d939d207f6c1bec351843c4ef488634 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-bigsur-m1 @@ -0,0 +1,19 @@ +machdep.cpu.cores_per_package: 8 +machdep.cpu.core_count: 8 +machdep.cpu.logical_per_package: 8 +machdep.cpu.thread_count: 8 +machdep.cpu.brand_string: Apple processor +hw.optional.floatingpoint: 1 +hw.optional.watchpoint: 4 +hw.optional.breakpoint: 6 +hw.optional.neon: 1 +hw.optional.neon_hpfp: 1 +hw.optional.neon_fp16: 1 +hw.optional.armv8_1_atomics: 1 +hw.optional.armv8_crc32: 1 +hw.optional.armv8_2_fhm: 1 +hw.optional.armv8_2_sha512: 1 +hw.optional.armv8_2_sha3: 1 +hw.optional.amx_version: 2 +hw.optional.ucnormal_mem: 1 +hw.optional.arm64: 1 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-haswell b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-haswell new file mode 100644 index 0000000000000000000000000000000000000000..45054c567634d236bacc45274d328e42998b6ff0 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-haswell @@ -0,0 +1,5 @@ +machdep.cpu.vendor: GenuineIntel +machdep.cpu.model: 70 +machdep.cpu.brand_string: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz +machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C +machdep.cpu.leaf7_features: RDWRFSGS TSC_THREAD_OFFSET BMI1 AVX2 SMEP BMI2 ERMS INVPCID FPU_CSDS MDCLEAR IBRS STIBP L1DF SSBD diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-ivybridge b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-ivybridge new file mode 100644 index 0000000000000000000000000000000000000000..6a52d6c19dbe4ef8023f102d795f3f5db996ecfd --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-ivybridge @@ -0,0 +1,59 @@ +machdep.cpu.max_basic: 13 +machdep.cpu.max_ext: 2147483656 +machdep.cpu.vendor: GenuineIntel +machdep.cpu.brand_string: Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz +machdep.cpu.family: 6 +machdep.cpu.model: 58 +machdep.cpu.extmodel: 3 +machdep.cpu.extfamily: 0 +machdep.cpu.stepping: 9 +machdep.cpu.feature_bits: 9203919201183202303 +machdep.cpu.leaf7_feature_bits: 641 0 +machdep.cpu.leaf7_feature_bits_edx: 2617246720 +machdep.cpu.extfeature_bits: 4967106816 +machdep.cpu.signature: 198313 +machdep.cpu.brand: 0 +machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C +machdep.cpu.leaf7_features: RDWRFSGS SMEP ERMS MDCLEAR IBRS STIBP L1DF SSBD +machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF RDTSCP TSCI +machdep.cpu.logical_per_package: 16 +machdep.cpu.cores_per_package: 8 +machdep.cpu.microcode_version: 33 +machdep.cpu.processor_flag: 4 +machdep.cpu.mwait.linesize_min: 64 +machdep.cpu.mwait.linesize_max: 64 +machdep.cpu.mwait.extensions: 3 +machdep.cpu.mwait.sub_Cstates: 135456 +machdep.cpu.thermal.sensor: 1 +machdep.cpu.thermal.dynamic_acceleration: 1 +machdep.cpu.thermal.invariant_APIC_timer: 1 +machdep.cpu.thermal.thresholds: 2 +machdep.cpu.thermal.ACNT_MCNT: 1 +machdep.cpu.thermal.core_power_limits: 1 +machdep.cpu.thermal.fine_grain_clock_mod: 1 +machdep.cpu.thermal.package_thermal_intr: 1 +machdep.cpu.thermal.hardware_feedback: 0 +machdep.cpu.thermal.energy_policy: 0 +machdep.cpu.xsave.extended_state: 7 832 832 0 +machdep.cpu.xsave.extended_state1: 1 0 0 0 +machdep.cpu.arch_perf.version: 3 +machdep.cpu.arch_perf.number: 4 +machdep.cpu.arch_perf.width: 48 +machdep.cpu.arch_perf.events_number: 7 +machdep.cpu.arch_perf.events: 0 +machdep.cpu.arch_perf.fixed_number: 3 +machdep.cpu.arch_perf.fixed_width: 48 +machdep.cpu.cache.linesize: 64 +machdep.cpu.cache.L2_associativity: 8 +machdep.cpu.cache.size: 256 +machdep.cpu.tlb.inst.small: 64 +machdep.cpu.tlb.inst.large: 8 +machdep.cpu.tlb.data.small: 64 +machdep.cpu.tlb.data.large: 32 +machdep.cpu.tlb.shared: 512 +machdep.cpu.address_bits.physical: 36 +machdep.cpu.address_bits.virtual: 48 +machdep.cpu.core_count: 2 +machdep.cpu.thread_count: 4 +machdep.cpu.tsc_ccc.numerator: 0 +machdep.cpu.tsc_ccc.denominator: 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-skylake b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-skylake new file mode 100644 index 0000000000000000000000000000000000000000..67dc28a966fc4a8f83fc1d652c78217ed7f773ee --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-mojave-skylake @@ -0,0 +1,5 @@ +machdep.cpu.vendor: GenuineIntel +machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C +machdep.cpu.leaf7_features: RDWRFSGS TSC_THREAD_OFFSET SGX BMI1 HLE AVX2 SMEP BMI2 ERMS INVPCID RTM FPU_CSDS MPX RDSEED ADX SMAP CLFSOPT IPT MDCLEAR TSXFA IBRS STIBP L1DF SSBD +machdep.cpu.model: 94 +machdep.cpu.brand_string: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-monterey-m1 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-monterey-m1 new file mode 100644 index 0000000000000000000000000000000000000000..de801d480b7694b52927e1a5e0c25bd436f5e2d9 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-monterey-m1 @@ -0,0 +1,117 @@ +hw.ncpu: 8 +hw.byteorder: 1234 +hw.memsize: 17179869184 +hw.activecpu: 8 +hw.features.allows_security_research: 0 +hw.optional.arm.FEAT_FlagM: 1 +hw.optional.arm.FEAT_FlagM2: 1 +hw.optional.arm.FEAT_FHM: 1 +hw.optional.arm.FEAT_DotProd: 1 +hw.optional.arm.FEAT_SHA3: 1 +hw.optional.arm.FEAT_RDM: 1 +hw.optional.arm.FEAT_LSE: 1 +hw.optional.arm.FEAT_SHA256: 1 +hw.optional.arm.FEAT_SHA512: 1 +hw.optional.arm.FEAT_SHA1: 1 +hw.optional.arm.FEAT_AES: 1 +hw.optional.arm.FEAT_PMULL: 1 +hw.optional.arm.FEAT_SPECRES: 0 +hw.optional.arm.FEAT_SB: 1 +hw.optional.arm.FEAT_FRINTTS: 1 +hw.optional.arm.FEAT_LRCPC: 1 +hw.optional.arm.FEAT_LRCPC2: 1 +hw.optional.arm.FEAT_FCMA: 1 +hw.optional.arm.FEAT_JSCVT: 1 +hw.optional.arm.FEAT_PAuth: 1 +hw.optional.arm.FEAT_PAuth2: 0 +hw.optional.arm.FEAT_FPAC: 0 +hw.optional.arm.FEAT_DPB: 1 +hw.optional.arm.FEAT_DPB2: 1 +hw.optional.arm.FEAT_BF16: 0 +hw.optional.arm.FEAT_I8MM: 0 +hw.optional.arm.FEAT_ECV: 1 +hw.optional.arm.FEAT_LSE2: 1 +hw.optional.arm.FEAT_CSV2: 1 +hw.optional.arm.FEAT_CSV3: 1 +hw.optional.arm.FEAT_FP16: 1 +hw.optional.arm.FEAT_SSBS: 1 +hw.optional.arm.FEAT_BTI: 0 +hw.optional.floatingpoint: 1 +hw.optional.neon: 1 +hw.optional.neon_hpfp: 1 +hw.optional.neon_fp16: 1 +hw.optional.armv8_1_atomics: 1 +hw.optional.armv8_2_fhm: 1 +hw.optional.armv8_2_sha512: 1 +hw.optional.armv8_2_sha3: 1 +hw.optional.armv8_3_compnum: 1 +hw.optional.watchpoint: 4 +hw.optional.breakpoint: 6 +hw.optional.armv8_crc32: 1 +hw.optional.armv8_gpi: 1 +hw.optional.AdvSIMD: 1 +hw.optional.AdvSIMD_HPFPCvt: 1 +hw.optional.ucnormal_mem: 1 +hw.optional.arm64: 1 +hw.perflevel0.physicalcpu: 6 +hw.perflevel0.physicalcpu_max: 6 +hw.perflevel0.logicalcpu: 6 +hw.perflevel0.logicalcpu_max: 6 +hw.perflevel0.l1icachesize: 196608 +hw.perflevel0.l1dcachesize: 131072 +hw.perflevel0.l2cachesize: 12582912 +hw.perflevel0.cpusperl2: 3 +hw.perflevel1.physicalcpu: 2 +hw.perflevel1.physicalcpu_max: 2 +hw.perflevel1.logicalcpu: 2 +hw.perflevel1.logicalcpu_max: 2 +hw.perflevel1.l1icachesize: 131072 +hw.perflevel1.l1dcachesize: 65536 +hw.perflevel1.l2cachesize: 4194304 +hw.perflevel1.cpusperl2: 2 +hw.physicalcpu: 8 +hw.physicalcpu_max: 8 +hw.logicalcpu: 8 +hw.logicalcpu_max: 8 +hw.cputype: 16777228 +hw.cpusubtype: 2 +hw.cpu64bit_capable: 1 +hw.cpufamily: 458787763 +hw.cpusubfamily: 4 +hw.cacheconfig: 8 1 2 0 0 0 0 0 0 0 +hw.cachesize: 3443720192 65536 4194304 0 0 0 0 0 0 0 +hw.pagesize: 16384 +hw.pagesize32: 16384 +hw.cachelinesize: 128 +hw.l1icachesize: 131072 +hw.l1dcachesize: 65536 +hw.l2cachesize: 4194304 +hw.tbfrequency: 24000000 +hw.packages: 1 +hw.osenvironment: +hw.ephemeral_storage: 0 +hw.use_recovery_securityd: 0 +hw.use_kernelmanagerd: 1 +hw.serialdebugmode: 0 +hw.nperflevels: 2 +hw.targettype: J314s +machdep.cpu.cores_per_package: 8 +machdep.cpu.core_count: 8 +machdep.cpu.logical_per_package: 8 +machdep.cpu.thread_count: 8 +machdep.cpu.brand_string: Apple M1 Pro +machdep.wake_abstime: 267689415132 +machdep.time_since_reset: 309271811230 +machdep.wake_conttime: 283552239 +machdep.deferred_ipi_timeout: 64000 +machdep.lck_mtx_adaptive_spin_mode: 1 +machdep.virtual_address_size: 47 +machdep.report_phy_read_delay: 0 +machdep.report_phy_write_delay: 0 +machdep.trace_phy_read_delay: 0 +machdep.trace_phy_write_delay: 0 +machdep.report_phy_read_osbt: 0 +machdep.report_phy_write_osbt: 0 +machdep.phy_read_delay_panic: 0 +machdep.phy_writedelay_panic: 0 +machdep.user_idle_level: 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-monterey-m2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-monterey-m2 new file mode 100644 index 0000000000000000000000000000000000000000..757a1fb79ea15a10ff45e2b56ff6645786385e4f --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/darwin-monterey-m2 @@ -0,0 +1,117 @@ +hw.ncpu: 8 +hw.byteorder: 1234 +hw.memsize: 17179869184 +hw.activecpu: 8 +hw.perflevel0.physicalcpu: 4 +hw.perflevel0.physicalcpu_max: 4 +hw.perflevel0.logicalcpu: 4 +hw.perflevel0.logicalcpu_max: 4 +hw.perflevel0.l1icachesize: 196608 +hw.perflevel0.l1dcachesize: 131072 +hw.perflevel0.l2cachesize: 16777216 +hw.perflevel0.cpusperl2: 4 +hw.perflevel1.physicalcpu: 4 +hw.perflevel1.physicalcpu_max: 4 +hw.perflevel1.logicalcpu: 4 +hw.perflevel1.logicalcpu_max: 4 +hw.perflevel1.l1icachesize: 131072 +hw.perflevel1.l1dcachesize: 65536 +hw.perflevel1.l2cachesize: 4194304 +hw.perflevel1.cpusperl2: 4 +hw.optional.arm.FEAT_FlagM: 1 +hw.optional.arm.FEAT_FlagM2: 1 +hw.optional.arm.FEAT_FHM: 1 +hw.optional.arm.FEAT_DotProd: 1 +hw.optional.arm.FEAT_SHA3: 1 +hw.optional.arm.FEAT_RDM: 1 +hw.optional.arm.FEAT_LSE: 1 +hw.optional.arm.FEAT_SHA256: 1 +hw.optional.arm.FEAT_SHA512: 1 +hw.optional.arm.FEAT_SHA1: 1 +hw.optional.arm.FEAT_AES: 1 +hw.optional.arm.FEAT_PMULL: 1 +hw.optional.arm.FEAT_SPECRES: 0 +hw.optional.arm.FEAT_SB: 1 +hw.optional.arm.FEAT_FRINTTS: 1 +hw.optional.arm.FEAT_LRCPC: 1 +hw.optional.arm.FEAT_LRCPC2: 1 +hw.optional.arm.FEAT_FCMA: 1 +hw.optional.arm.FEAT_JSCVT: 1 +hw.optional.arm.FEAT_PAuth: 1 +hw.optional.arm.FEAT_PAuth2: 1 +hw.optional.arm.FEAT_FPAC: 1 +hw.optional.arm.FEAT_DPB: 1 +hw.optional.arm.FEAT_DPB2: 1 +hw.optional.arm.FEAT_BF16: 1 +hw.optional.arm.FEAT_I8MM: 1 +hw.optional.arm.FEAT_ECV: 1 +hw.optional.arm.FEAT_LSE2: 1 +hw.optional.arm.FEAT_CSV2: 1 +hw.optional.arm.FEAT_CSV3: 1 +hw.optional.arm.FEAT_FP16: 1 +hw.optional.arm.FEAT_SSBS: 1 +hw.optional.arm.FEAT_BTI: 1 +hw.optional.floatingpoint: 1 +hw.optional.neon: 1 +hw.optional.neon_hpfp: 1 +hw.optional.neon_fp16: 1 +hw.optional.armv8_1_atomics: 1 +hw.optional.armv8_2_fhm: 1 +hw.optional.armv8_2_sha512: 1 +hw.optional.armv8_2_sha3: 1 +hw.optional.armv8_3_compnum: 1 +hw.optional.watchpoint: 4 +hw.optional.breakpoint: 6 +hw.optional.armv8_crc32: 1 +hw.optional.armv8_gpi: 1 +hw.optional.AdvSIMD: 1 +hw.optional.AdvSIMD_HPFPCvt: 1 +hw.optional.ucnormal_mem: 1 +hw.optional.arm64: 1 +hw.features.allows_security_research: 0 +hw.physicalcpu: 8 +hw.physicalcpu_max: 8 +hw.logicalcpu: 8 +hw.logicalcpu_max: 8 +hw.cputype: 16777228 +hw.cpusubtype: 2 +hw.cpu64bit_capable: 1 +hw.cpufamily: -634136515 +hw.cpusubfamily: 2 +hw.cacheconfig: 8 1 4 0 0 0 0 0 0 0 +hw.cachesize: 3697410048 65536 4194304 0 0 0 0 0 0 0 +hw.pagesize: 16384 +hw.pagesize32: 16384 +hw.cachelinesize: 128 +hw.l1icachesize: 131072 +hw.l1dcachesize: 65536 +hw.l2cachesize: 4194304 +hw.tbfrequency: 24000000 +hw.packages: 1 +hw.osenvironment: +hw.ephemeral_storage: 0 +hw.use_recovery_securityd: 0 +hw.use_kernelmanagerd: 1 +hw.serialdebugmode: 0 +hw.nperflevels: 2 +hw.targettype: J413 +machdep.cpu.cores_per_package: 8 +machdep.cpu.core_count: 8 +machdep.cpu.logical_per_package: 8 +machdep.cpu.thread_count: 8 +machdep.cpu.brand_string: Apple M2 +machdep.user_idle_level: 0 +machdep.wake_abstime: 5418683402971 +machdep.time_since_reset: 6671416324 +machdep.wake_conttime: 22097060794869 +machdep.deferred_ipi_timeout: 64000 +machdep.lck_mtx_adaptive_spin_mode: 1 +machdep.virtual_address_size: 47 +machdep.report_phy_read_delay: 0 +machdep.report_phy_write_delay: 0 +machdep.trace_phy_read_delay: 0 +machdep.trace_phy_write_delay: 0 +machdep.report_phy_read_osbt: 0 +machdep.report_phy_write_osbt: 0 +machdep.phy_read_delay_panic: 0 +machdep.phy_writedelay_panic: 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-cortex_a72 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-cortex_a72 new file mode 100644 index 0000000000000000000000000000000000000000..f500e6f8077196a8270fc88932f4fcdb46233b5b --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-cortex_a72 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 166.66 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd08 +CPU revision : 3 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-neoverse_n1 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-neoverse_n1 new file mode 100644 index 0000000000000000000000000000000000000000..17f1615825d77b3aeea6fdbbb250ca22cc9598b1 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-neoverse_n1 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 243.75 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x3 +CPU part : 0xd0c +CPU revision : 1 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-neoverse_v1 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-neoverse_v1 new file mode 100644 index 0000000000000000000000000000000000000000..01246f99da41a5619a3b89e51e97b8919e94996d --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon-neoverse_v1 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2100.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs paca pacg dcpodp svei8mm svebf16 i8mm bf16 dgh rng +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0xd40 +CPU revision : 1 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon2-sapphirerapids b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon2-sapphirerapids new file mode 100644 index 0000000000000000000000000000000000000000..633a8457d478ddd697aaf0e547dd4636a779079b --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-amazon2-sapphirerapids @@ -0,0 +1,26 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 143 +model name : Intel(R) Xeon(R) Platinum 8488C +stepping : 8 +microcode : 0x2b000461 +cpu MHz : 3101.940 +cache size : 107520 KB +physical id : 0 +siblings : 48 +core id : 0 +cpu cores : 48 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 31 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_bf16 wbnoinvd ida arat avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid cldemote movdiri movdir64b md_clear serialize flush_l1d arch_capabilities +bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs +bogomips : 4800.00 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-asahi-m1 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-asahi-m1 new file mode 100644 index 0000000000000000000000000000000000000000..11f48d1832a52a49b47aa575a2d94a4d00b787f2 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-asahi-m1 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 48.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint +CPU implementer : 0x61 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0x022 +CPU revision : 1 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-asahi-m2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-asahi-m2 new file mode 100644 index 0000000000000000000000000000000000000000..93d048bec7e4ccddc5f8189dc6b81eafaddd3767 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-asahi-m2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 48.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint i8mm bf16 bti ecv +CPU implementer : 0x61 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0x032 +CPU revision : 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-cascadelake b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-cascadelake new file mode 100644 index 0000000000000000000000000000000000000000..e409c3d07a18c826fd9c7742b3e199cccae30d8b --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-cascadelake @@ -0,0 +1,20 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 85 +model name : Intel(R) Xeon(R) Platinum 8260M CPU @ 2.40GHz +stepping : 7 +microcode : 0x5000024 +cpu MHz : 2400.000 +cache size : 36608 KB +physical id : 0 +siblings : 48 +core id : 0 +cpu cores : 24 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 22 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 intel_ppin intel_pt ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-power8le b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-power8le new file mode 100644 index 0000000000000000000000000000000000000000..f21ca85323dd6f47f1bc2b2ab2a1dc9ee5529e91 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-power8le @@ -0,0 +1,4 @@ +processor : 0 +cpu : POWER8NVL (raw), altivec supported +clock : 2061.000000MHz +revision : 1.0 (pvr 004c 0100) diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-thunderx2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-thunderx2 new file mode 100644 index 0000000000000000000000000000000000000000..2447306bac15024241fd123c23cf013dad31b659 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-centos7-thunderx2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 400.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm +CPU implementer : 0x43 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0x0af +CPU revision : 1 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel6-piledriver b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel6-piledriver new file mode 100644 index 0000000000000000000000000000000000000000..599d0c6fe7a933c2e44f79dfe473c9542395732d --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel6-piledriver @@ -0,0 +1,29 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 21 +model : 2 +model name : AMD FX(tm)-8350 Eight-Core Processor +stepping : 0 +microcode : 0x6000832 +cpu MHz : 4013.832 +cache size : 2048 KB +physical id : 0 +siblings : 8 +core id : 0 +cpu cores : 4 +apicid : 16 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 13 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold vmmcall bmi1 +bugs : fxsave_leak sysret_ss_attrs +bogomips : 8030.15 +TLB size : 1536 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm 100mhzsteps hwpstate cpb eff_freq_ro + +# /proc/cpuinfo taken from https://www.redhat.com/archives/vfio-users/2015-August/msg00111.html \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-broadwell b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-broadwell new file mode 100644 index 0000000000000000000000000000000000000000..427cd85bf2eaa24b98e80e26813658659b7a04a5 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-broadwell @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 79 +model name : Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz +stepping : 1 +microcode : 0xb00002a +cpu MHz : 2600.000 +cache size : 35840 KB +physical id : 0 +siblings : 14 +core id : 0 +cpu cores : 14 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 20 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local ibpb ibrs stibp dtherm arat pln pts spec_ctrl intel_stibp +bogomips : 5188.06 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-haswell b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-haswell new file mode 100644 index 0000000000000000000000000000000000000000..7bb5aa958f8b9254990bbdc31a32434b187fe067 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-haswell @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 63 +model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz +stepping : 2 +microcode : 0x3c +cpu MHz : 1757.910 +cache size : 30720 KB +physical id : 0 +siblings : 12 +core id : 0 +cpu cores : 12 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 15 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc ibpb ibrs stibp dtherm arat pln pts spec_ctrl intel_stibp +bogomips : 4987.97 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-ivybridge b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-ivybridge new file mode 100644 index 0000000000000000000000000000000000000000..7d6cfe4daaed77956694e9c14bd43a3bd739d86f --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-ivybridge @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 62 +model name : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz +stepping : 4 +microcode : 0x42c +cpu MHz : 1862.554 +cache size : 20480 KB +physical id : 0 +siblings : 8 +core id : 0 +cpu cores : 8 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 13 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt ibpb ibrs stibp dtherm ida arat pln pts spec_ctrl intel_stibp +bogomips : 5200.15 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-skylake_avx512 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-skylake_avx512 new file mode 100644 index 0000000000000000000000000000000000000000..e9ab1987ddab06277177db82f6a5b590b901f276 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-skylake_avx512 @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 85 +model name : Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz +stepping : 4 +microcode : 0x200004d +cpu MHz : 2600.000 +cache size : 19712 KB +physical id : 0 +siblings : 14 +core id : 0 +cpu cores : 14 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 22 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local ibpb ibrs stibp dtherm ida arat pln pts spec_ctrl intel_stibp ssbd +bogomips : 5200.00 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-x86_64_v3 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-x86_64_v3 new file mode 100644 index 0000000000000000000000000000000000000000..d6feeccceb82f45bb868e864d0fd7aada6c61548 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-x86_64_v3 @@ -0,0 +1,26 @@ +COMMENT : Created synthetically to mimic Haswell with AES disabled from BIOS +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 63 +model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz +stepping : 2 +microcode : 0x3c +cpu MHz : 1757.910 +cache size : 30720 KB +physical id : 0 +siblings : 12 +core id : 0 +cpu cores : 12 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 15 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer xsave avx f16c rdrand lahf_lm abm epb invpcid_single tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc ibpb ibrs stibp dtherm arat pln pts spec_ctrl intel_stibp +bogomips : 4987.97 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-zen b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-zen new file mode 100644 index 0000000000000000000000000000000000000000..014dec3359e30216065e7aabde5f5671bbf5a1b9 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel7-zen @@ -0,0 +1,26 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 23 +model : 1 +model name : AMD EPYC 7301 16-Core Processor +stepping : 2 +microcode : 0x8001227 +cpu MHz : 2200.000 +cache size : 512 KB +physical id : 0 +siblings : 32 +core id : 0 +cpu cores : 16 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 13 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl nonstop_tsc extd_apicid amd_dcm aperfmperf eagerfpu pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_l2 cpb hw_pstate retpoline_amd ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca +bogomips : 4399.40 +TLB size : 2560 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14] diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel8-neoverse_v1 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel8-neoverse_v1 new file mode 100644 index 0000000000000000000000000000000000000000..57853e97eafcaba26d569cc96f81213e083893a3 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel8-neoverse_v1 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2100.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs dcpodp svei8mm svebf16 i8mm bf16 dgh rng +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0xd40 +CPU revision : 1 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel8-power9 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel8-power9 new file mode 100644 index 0000000000000000000000000000000000000000..7e1a89b631b51a03e4eeb94783abc422e5af64f5 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel8-power9 @@ -0,0 +1,4 @@ +processor : 0 +cpu : POWER9, altivec supported +clock : 3666.000000MHz +revision : 2.2 (pvr 004e 1202) diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel9-neoverse_n2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel9-neoverse_n2 new file mode 100644 index 0000000000000000000000000000000000000000..f47458f51374540fbe53cb5bf7d7d9b5717c341a --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel9-neoverse_n2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2100.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs sb dcpodp sve2 sveaes svepmull svebitperm svesha3 flagm2 frint svei8mm svebf16 i8mm bf16 dgh +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd49 +CPU revision : 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel9-neoverse_v2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel9-neoverse_v2 new file mode 100644 index 0000000000000000000000000000000000000000..cd5024170f79f726dc9ca8ee8106b8d0d23ce40d --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rhel9-neoverse_v2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2000.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs sb dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd4f +CPU revision : 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky8-a64fx b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky8-a64fx new file mode 100644 index 0000000000000000000000000000000000000000..2484dbe3e77128c56eff71ab117b62b003889746 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky8-a64fx @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 200.00 +Features : fp asimd evtstrm sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm fcma dcpop sve +CPU implementer : 0x46 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0x001 +CPU revision : 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky8.5-zen4 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky8.5-zen4 new file mode 100644 index 0000000000000000000000000000000000000000..aa1c08bd1d68596efd425aa396244116f3e5114e --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky8.5-zen4 @@ -0,0 +1,27 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 25 +model : 17 +model name : AMD EPYC 9654 96-Core Processor +stepping : 1 +microcode : 0xa10110d +cpu MHz : 2400.000 +cache size : 1024 KB +physical id : 0 +siblings : 96 +core id : 0 +cpu cores : 96 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 16 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d sme sev sev_es +bugs : sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass +bogomips : 4792.38 +TLB size : 3584 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 52 bits physical, 57 bits virtual +power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14] diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky9-zen5 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky9-zen5 new file mode 100644 index 0000000000000000000000000000000000000000..31379fde97b062bf34dd0c0ad71969fbe45a6729 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-rocky9-zen5 @@ -0,0 +1,27 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 26 +model : 68 +model name : AMD Ryzen 9 9950X 16-Core Processor +stepping : 0 +microcode : 0xb40401a +cpu MHz : 600.000 +cache size : 1024 KB +physical id : 0 +siblings : 32 +core id : 0 +cpu cores : 16 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 16 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk avx_vnni avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload vgif v_spec_ctrl vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid bus_lock_detect movdiri movdir64b overflow_recov succor smca fsrm avx512_vp2intersect flush_l1d amd_lbr_pmc_freeze +bugs : sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass +bogomips : 8600.84 +TLB size : 192 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14] diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientific7-k10 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientific7-k10 new file mode 100644 index 0000000000000000000000000000000000000000..1522b17480e1137f86d1819f17ea8aba0d9bd006 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientific7-k10 @@ -0,0 +1,26 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 16 +model : 9 +model name : AMD Opteron(tm) Processor 6136 +stepping : 1 +microcode : 0x10000d9 +cpu MHz : 800.000 +cache size : 512 KB +physical id : 0 +siblings : 8 +core id : 0 +cpu cores : 8 +apicid : 16 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 5 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc art rep_good nopl nonstop_tsc extd_apicid amd_dcm pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt nodeid_msr hw_pstate retpoline_amd ibp_disable vmmcall npt lbrv svm_lock nrip_save pausefilter +bogomips : 4800.19 +TLB size : 1024 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm stc 100mhzsteps hwpstate diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientific7-piledriver b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientific7-piledriver new file mode 100644 index 0000000000000000000000000000000000000000..4c823f6e46baab2ee6f204340e76505b3957e0b4 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientific7-piledriver @@ -0,0 +1,26 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 21 +model : 2 +model name : AMD Opteron(tm) Processor 6320 +stepping : 0 +microcode : 0x6000852 +cpu MHz : 1400.000 +cache size : 2048 KB +physical id : 0 +siblings : 8 +core id : 0 +cpu cores : 4 +apicid : 32 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 13 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl nonstop_tsc extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb cpb hw_pstate retpoline_amd ssbd ibpb vmmcall bmi1 arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold +bogomips : 5600.11 +TLB size : 1536 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm 100mhzsteps hwpstate cpb eff_freq_ro diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientificfermi6-bulldozer b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientificfermi6-bulldozer new file mode 100644 index 0000000000000000000000000000000000000000..c240cfc6ce94618217d588b98a983d6da438e671 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientificfermi6-bulldozer @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 21 +model : 1 +model name : AMD Opteron(TM) Processor 6212 +stepping : 2 +cpu MHz : 2600.188 +cache size : 2048 KB +physical id : 0 +siblings : 8 +core id : 0 +cpu cores : 4 +apicid : 32 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 13 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nonstop_tsc extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb ssbd retpoline ibpb npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold +bogomips : 5200.37 +TLB size : 1536 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm 100mhzsteps hwpstate cpb diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientificfermi6-piledriver b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientificfermi6-piledriver new file mode 100644 index 0000000000000000000000000000000000000000..a87afeee612e1a71e7431ab0531f8d9c7c5564d7 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-scientificfermi6-piledriver @@ -0,0 +1,25 @@ +processor : 31 +vendor_id : AuthenticAMD +cpu family : 21 +model : 2 +model name : AMD Opteron(tm) Processor 6320 +stepping : 0 +cpu MHz : 2800.154 +cache size : 2048 KB +physical id : 3 +siblings : 8 +core id : 3 +cpu cores : 4 +apicid : 135 +initial apicid : 103 +fpu : yes +fpu_exception : yes +cpuid level : 13 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nonstop_tsc extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb cpb ssbd retpoline ibpb npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold bmi1 +bogomips : 5599.22 +TLB size : 1536 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm 100mhzsteps hwpstate cpb eff_freq_ro diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-sifive-u74mc b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-sifive-u74mc new file mode 100644 index 0000000000000000000000000000000000000000..8c1d29002e6952044d026945e1ab81e11a01dee4 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-sifive-u74mc @@ -0,0 +1,5 @@ +processor : 0 +hart : 4 +isa : rv64imafdc +mmu : sv39 +uarch : sifive,u74-mc diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu18.04-broadwell b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu18.04-broadwell new file mode 100644 index 0000000000000000000000000000000000000000..bbe287ebf14956e40272be4e06f20d26f5a00cab --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu18.04-broadwell @@ -0,0 +1,26 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 61 +model name : Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz +stepping : 4 +microcode : 0x2d +cpu MHz : 1944.124 +cache size : 3072 KB +physical id : 0 +siblings : 4 +core id : 0 +cpu cores : 2 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 20 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap intel_pt xsaveopt dtherm ida arat pln pts md_clear flush_l1d +bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds +bogomips : 4389.80 +clflush size : 64 +cache_alignment : 64 +address sizes : 39 bits physical, 48 bits virtual +power management: diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu20.04-zen3 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu20.04-zen3 new file mode 100644 index 0000000000000000000000000000000000000000..9d1f572b7ad812cdf5fc3c00def508841d073300 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu20.04-zen3 @@ -0,0 +1,27 @@ +processor : 0 +vendor_id : AuthenticAMD +cpu family : 25 +model : 33 +model name : AMD Ryzen 9 5950X 16-Core Processor +stepping : 0 +microcode : 0xa201009 +cpu MHz : 2122.858 +cache size : 512 KB +physical id : 0 +siblings : 32 +core id : 0 +cpu cores : 16 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 16 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca +bugs : sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass +bogomips : 6786.81 +TLB size : 2560 4K pages +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 48 bits virtual +power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14] diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu22.04-neoverse_n2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu22.04-neoverse_n2 new file mode 100644 index 0000000000000000000000000000000000000000..cf555d2f49d236ed990db2791763b0eff5e61357 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu22.04-neoverse_n2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2000.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm uscat ilrcpc flagm ssbs sb paca pacg dcpodp sve2 flagm2 frint svei8mm svebf16 i8mm bf16 +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd49 +CPU revision : 0 \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu22.04-neoverse_v2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu22.04-neoverse_v2 new file mode 100644 index 0000000000000000000000000000000000000000..c3c8433415d7a08c60057c01a91bafceba4923e7 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-ubuntu22.04-neoverse_v2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2000.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh bti +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd4f +CPU revision : 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-neoverse_v2 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-neoverse_v2 new file mode 100644 index 0000000000000000000000000000000000000000..09087ac4e8decaf91b3d38151a2b4f13cb342c63 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-neoverse_v2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2000.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd4f +CPU revision : 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-power10 b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-power10 new file mode 100644 index 0000000000000000000000000000000000000000..ad8b15f9b9039f3bbd1af29e1b392e06b5f429aa --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-power10 @@ -0,0 +1,3 @@ +processor : 0 +cpu : POWER10, altivec supported +revision : 17.0 (pvr 0080 1100) \ No newline at end of file diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-sapphirerapids b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-sapphirerapids new file mode 100644 index 0000000000000000000000000000000000000000..c317b6b6b515c100ddebb14f31d2c3ce5aacc563 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/linux-unknown-sapphirerapids @@ -0,0 +1,27 @@ +processor : 2 +vendor_id : GenuineIntel +cpu family : 6 +model : 143 +model name : Intel(R) Xeon(R) Platinum 8480+ +stepping : 6 +microcode : 0x2b000181 +cpu MHz : 2000.000 +cache size : 107520 KB +physical id : 0 +siblings : 112 +core id : 2 +cpu cores : 56 +apicid : 4 +initial apicid : 4 +fpu : yes +fpu_exception : yes +cpuid level : 32 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities +vmx flags : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs pml ept_mode_based_exec tsc_scaling usr_wait_pause +bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb +bogomips : 4000.00 +clflush size : 64 +cache_alignment : 64 +address sizes : 52 bits physical, 57 bits virtual +power management: diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/windows-cpuid-broadwell b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/windows-cpuid-broadwell new file mode 100644 index 0000000000000000000000000000000000000000..f19f1d4a475a08736c60a6b5ff40f2a98ca420c2 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/windows-cpuid-broadwell @@ -0,0 +1,10 @@ +0, 0, 20, 1970169159, 1818588270, 1231384169 +2147483648, 0, 2147483656, 0, 0, 0 +1, 0, 198356, 34605056, 2147154879, 3219913727 +7, 0, 0, 35399595, 0, 2617247232 +7, 1, 0, 0, 0, 0 +13, 1, 1, 0, 0, 0 +2147483649, 0, 0, 0, 289, 739248128 +2147483650, 0, 1702129225, 693250156, 1919894304, 1297360997 +2147483651, 0, 929636393, 808793389, 1126192432, 1075860816 +2147483652, 0, 875442720, 2051557168, 0, 0 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/windows-cpuid-icelake b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/windows-cpuid-icelake new file mode 100644 index 0000000000000000000000000000000000000000..dcc0453e4f3418e4e5c965dddd8f2fa7edf5569c --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/json/tests/targets/windows-cpuid-icelake @@ -0,0 +1,10 @@ +0, 0, 20, 1970169159, 1818588270, 1231384169 +2147483648, 0, 2147483656, 0, 0, 0 +1, 0, 526017, 68159488, 2147154943, 3219913727 +7, 0, 2, 4089423851, 415268830, 4228908816 +7, 1, 0, 0, 0, 262144 +13, 1, 15, 2440, 14592, 0 +2147483649, 0, 0, 0, 289, 739248128 +2147483650, 0, 1752445233, 1852131104, 1953384736, 1378380901 +2147483651, 0, 1866670121, 1411933554, 1763715405, 825306423 +2147483652, 0, 927413560, 857751584, 1194340398, 31304 diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/.gitignore b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c9b568f7eac5edcb35307bb793869b2c20e5ae41 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/.gitignore @@ -0,0 +1,2 @@ +*.pyc +*.swp diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/LICENSE b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..af36480022f9ffcd2ea82399328e271788b55503 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Anders Høst + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/README.md b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4c79e37d86ce7e77133dad5cae2ea6e4e02a7d0d --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/README.md @@ -0,0 +1,76 @@ +cpuid.py +======== + +Now, this is silly! + +Pure Python library for accessing information about x86 processors +by querying the [CPUID](http://en.wikipedia.org/wiki/CPUID) +instruction. Well, not exactly pure Python... + +It works by allocating a small piece of virtual memory, copying +a raw x86 function to that memory, giving the memory execute +permissions and then calling the memory as a function. The injected +function executes the CPUID instruction and copies the result back +to a ctypes.Structure where is can be read by Python. + +It should work fine on both 32 and 64 bit versions of Windows and Linux +running x86 processors. Apple OS X and other BSD systems should also work, +not tested though... + + +Why? +---- +For poops and giggles. Plus, having access to a low-level feature +without having to compile a C wrapper is pretty neat. + + +Examples +-------- +Getting info with eax=0: + + import cpuid + + q = cpuid.CPUID() + eax, ebx, ecx, edx = q(0) + +Running the files: + + $ python example.py + Vendor ID : GenuineIntel + CPU name : Intel(R) Xeon(R) CPU W3550 @ 3.07GHz + + Vector instructions supported: + SSE : Yes + SSE2 : Yes + SSE3 : Yes + SSSE3 : Yes + SSE4.1 : Yes + SSE4.2 : Yes + SSE4a : -- + AVX : -- + AVX2 : -- + + $ python cpuid.py + CPUID A B C D + 00000000 0000000b 756e6547 6c65746e 49656e69 + 00000001 000106a5 00100800 009ce3bd bfebfbff + 00000002 55035a01 00f0b2e4 00000000 09ca212c + 00000003 00000000 00000000 00000000 00000000 + 00000004 00000000 00000000 00000000 00000000 + 00000005 00000040 00000040 00000003 00001120 + 00000006 00000003 00000002 00000001 00000000 + 00000007 00000000 00000000 00000000 00000000 + 00000008 00000000 00000000 00000000 00000000 + 00000009 00000000 00000000 00000000 00000000 + 0000000a 07300403 00000044 00000000 00000603 + 0000000b 00000000 00000000 00000095 00000000 + 80000000 80000008 00000000 00000000 00000000 + 80000001 00000000 00000000 00000001 28100800 + 80000002 65746e49 2952286c 6f655820 2952286e + 80000003 55504320 20202020 20202020 57202020 + 80000004 30353533 20402020 37302e33 007a4847 + 80000005 00000000 00000000 00000000 00000000 + 80000006 00000000 00000000 01006040 00000000 + 80000007 00000000 00000000 00000000 00000100 + 80000008 00003024 00000000 00000000 00000000 + diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/cpuid.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/cpuid.py new file mode 100644 index 0000000000000000000000000000000000000000..79c15d16d1ab7e4149de287823e22eeaf2218e19 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/cpuid.py @@ -0,0 +1,172 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2024 Anders Høst +# + +from __future__ import print_function + +import platform +import os +import ctypes +from ctypes import c_uint32, c_long, c_ulong, c_size_t, c_void_p, POINTER, CFUNCTYPE + +# Posix x86_64: +# Three first call registers : RDI, RSI, RDX +# Volatile registers : RAX, RCX, RDX, RSI, RDI, R8-11 + +# Windows x86_64: +# Three first call registers : RCX, RDX, R8 +# Volatile registers : RAX, RCX, RDX, R8-11 + +# cdecl 32 bit: +# Three first call registers : Stack (%esp) +# Volatile registers : EAX, ECX, EDX + +_POSIX_64_OPC = [ + 0x53, # push %rbx + 0x89, 0xf0, # mov %esi,%eax + 0x89, 0xd1, # mov %edx,%ecx + 0x0f, 0xa2, # cpuid + 0x89, 0x07, # mov %eax,(%rdi) + 0x89, 0x5f, 0x04, # mov %ebx,0x4(%rdi) + 0x89, 0x4f, 0x08, # mov %ecx,0x8(%rdi) + 0x89, 0x57, 0x0c, # mov %edx,0xc(%rdi) + 0x5b, # pop %rbx + 0xc3 # retq +] + +_WINDOWS_64_OPC = [ + 0x53, # push %rbx + 0x89, 0xd0, # mov %edx,%eax + 0x49, 0x89, 0xc9, # mov %rcx,%r9 + 0x44, 0x89, 0xc1, # mov %r8d,%ecx + 0x0f, 0xa2, # cpuid + 0x41, 0x89, 0x01, # mov %eax,(%r9) + 0x41, 0x89, 0x59, 0x04, # mov %ebx,0x4(%r9) + 0x41, 0x89, 0x49, 0x08, # mov %ecx,0x8(%r9) + 0x41, 0x89, 0x51, 0x0c, # mov %edx,0xc(%r9) + 0x5b, # pop %rbx + 0xc3 # retq +] + +_CDECL_32_OPC = [ + 0x53, # push %ebx + 0x57, # push %edi + 0x8b, 0x7c, 0x24, 0x0c, # mov 0xc(%esp),%edi + 0x8b, 0x44, 0x24, 0x10, # mov 0x10(%esp),%eax + 0x8b, 0x4c, 0x24, 0x14, # mov 0x14(%esp),%ecx + 0x0f, 0xa2, # cpuid + 0x89, 0x07, # mov %eax,(%edi) + 0x89, 0x5f, 0x04, # mov %ebx,0x4(%edi) + 0x89, 0x4f, 0x08, # mov %ecx,0x8(%edi) + 0x89, 0x57, 0x0c, # mov %edx,0xc(%edi) + 0x5f, # pop %edi + 0x5b, # pop %ebx + 0xc3 # ret +] + +is_windows = os.name == "nt" +is_64bit = ctypes.sizeof(ctypes.c_voidp) == 8 + + +class CPUID_struct(ctypes.Structure): + _register_names = ("eax", "ebx", "ecx", "edx") + _fields_ = [(r, c_uint32) for r in _register_names] + + def __getitem__(self, item): + if item not in self._register_names: + raise KeyError(item) + return getattr(self, item) + + def __repr__(self): + return "eax=0x{:x}, ebx=0x{:x}, ecx=0x{:x}, edx=0x{:x}".format(self.eax, self.ebx, self.ecx, self.edx) + + +class CPUID(object): + def __init__(self): + if platform.machine() not in ("AMD64", "x86_64", "x86", "i686"): + raise SystemError("Only available for x86") + + if is_windows: + if is_64bit: + # VirtualAlloc seems to fail under some weird + # circumstances when ctypes.windll.kernel32 is + # used under 64 bit Python. CDLL fixes this. + self.win = ctypes.CDLL("kernel32.dll") + opc = _WINDOWS_64_OPC + else: + # Here ctypes.windll.kernel32 is needed to get the + # right DLL. Otherwise it will fail when running + # 32 bit Python on 64 bit Windows. + self.win = ctypes.windll.kernel32 + opc = _CDECL_32_OPC + else: + opc = _POSIX_64_OPC if is_64bit else _CDECL_32_OPC + + size = len(opc) + code = (ctypes.c_ubyte * size)(*opc) + + if is_windows: + self.win.VirtualAlloc.restype = c_void_p + self.win.VirtualAlloc.argtypes = [ctypes.c_void_p, ctypes.c_size_t, ctypes.c_ulong, ctypes.c_ulong] + self.addr = self.win.VirtualAlloc(None, size, 0x1000, 0x40) + if not self.addr: + raise MemoryError("Could not allocate RWX memory") + ctypes.memmove(self.addr, code, size) + else: + from mmap import ( + mmap, + MAP_PRIVATE, + MAP_ANONYMOUS, + PROT_WRITE, + PROT_READ, + PROT_EXEC, + ) + self.mm = mmap( + -1, + size, + flags=MAP_PRIVATE | MAP_ANONYMOUS, + prot=PROT_WRITE | PROT_READ | PROT_EXEC, + ) + self.mm.write(code) + self.addr = ctypes.addressof(ctypes.c_int.from_buffer(self.mm)) + + func_type = CFUNCTYPE(None, POINTER(CPUID_struct), c_uint32, c_uint32) + self.func_ptr = func_type(self.addr) + + def __call__(self, eax, ecx=0): + struct = self.registers_for(eax=eax, ecx=ecx) + return struct.eax, struct.ebx, struct.ecx, struct.edx + + def registers_for(self, eax, ecx=0): + """Calls cpuid with eax and ecx set as the input arguments, and returns a structure + containing eax, ebx, ecx, and edx. + """ + struct = CPUID_struct() + self.func_ptr(struct, eax, ecx) + return struct + + def __del__(self): + if is_windows: + self.win.VirtualFree.restype = c_long + self.win.VirtualFree.argtypes = [c_void_p, c_size_t, c_ulong] + self.win.VirtualFree(self.addr, 0, 0x8000) + else: + self.mm.close() + + + +if __name__ == "__main__": + def valid_inputs(): + cpuid = CPUID() + for eax in (0x0, 0x80000000): + highest, _, _, _ = cpuid(eax) + while eax <= highest: + regs = cpuid(eax) + yield (eax, regs) + eax += 1 + + + print(" ".join(x.ljust(8) for x in ("CPUID", "A", "B", "C", "D")).strip()) + for eax, regs in valid_inputs(): + print("%08x" % eax, " ".join("%08x" % reg for reg in regs)) diff --git a/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/example.py b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/example.py new file mode 100644 index 0000000000000000000000000000000000000000..e07e3c15215b0a9411eb1c4cb6322ecb0fbe8892 --- /dev/null +++ b/miniconda3/pkgs/archspec-0.2.5-pyhd3eb1b0_0/site-packages/archspec/vendor/cpuid/example.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# +# Copyright (c) 2024 Anders Høst +# + +from __future__ import print_function + +import struct +import cpuid + + +def cpu_vendor(cpu): + _, b, c, d = cpu(0) + return struct.pack("III", b, d, c).decode("utf-8") + + +def cpu_name(cpu): + name = "".join((struct.pack("IIII", *cpu(0x80000000 + i)).decode("utf-8") + for i in range(2, 5))) + + return name.split('\x00', 1)[0] + + +def is_set(cpu, leaf, subleaf, reg_idx, bit): + """ + @param {leaf} %eax + @param {sublead} %ecx, 0 in most cases + @param {reg_idx} idx of [%eax, %ebx, %ecx, %edx], 0-based + @param {bit} bit of reg selected by {reg_idx}, 0-based + """ + + regs = cpu(leaf, subleaf) + + if (1 << bit) & regs[reg_idx]: + return "Yes" + else: + return "--" + + +if __name__ == "__main__": + cpu = cpuid.CPUID() + + print("Vendor ID : %s" % cpu_vendor(cpu)) + print("CPU name : %s" % cpu_name(cpu)) + print() + print("Vector instructions supported:") + print("SSE : %s" % is_set(cpu, 1, 0, 3, 25)) + print("SSE2 : %s" % is_set(cpu, 1, 0, 3, 26)) + print("SSE3 : %s" % is_set(cpu, 1, 0, 2, 0)) + print("SSSE3 : %s" % is_set(cpu, 1, 0, 2, 9)) + print("SSE4.1 : %s" % is_set(cpu, 1, 0, 2, 19)) + print("SSE4.2 : %s" % is_set(cpu, 1, 0, 2, 20)) + print("SSE4a : %s" % is_set(cpu, 0x80000001, 0, 2, 6)) + print("AVX : %s" % is_set(cpu, 1, 0, 2, 28)) + print("AVX2 : %s" % is_set(cpu, 7, 0, 1, 5)) + print("BMI1 : %s" % is_set(cpu, 7, 0, 1, 3)) + print("BMI2 : %s" % is_set(cpu, 7, 0, 1, 8)) + # Intel RDT CMT/MBM + print("L3 Monitoring : %s" % is_set(cpu, 0xf, 0, 3, 1)) + print("L3 Occupancy : %s" % is_set(cpu, 0xf, 1, 3, 0)) + print("L3 Total BW : %s" % is_set(cpu, 0xf, 1, 3, 1)) + print("L3 Local BW : %s" % is_set(cpu, 0xf, 1, 3, 2)) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0.conda b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..4b9c56f2c4b484ffc5e554485b74d61fbabfbdce --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:248e6cb425de676a39915d1c241e0434d9ec8b19d27771f7132907519f7fbc77 +size 522428 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/about.json b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/about.json new file mode 100644 index 0000000000000000000000000000000000000000..1a2efceb0f4868fa61c385d8dd0d31a5e22a6ee6 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/about.json @@ -0,0 +1,132 @@ +{ + "channels": [ + "https://repo.anaconda.com/pkgs/main" + ], + "conda_build_version": "24.1.2", + "conda_version": "24.1.2", + "description": "Boltons is a set of pure-Python utilities in the same spirit as \u2014 and yet conspicuously missing from \u2014 the standard library, including:\n\n - Atomic file saving, bolted on with fileutils\n - A highly-optimized OrderedMultiDict, in dictutils\n - Two types of PriorityQueue, in queueutils\n - Chunked and windowed iteration, in iterutils\n - A full-featured TracebackInfo type, for representing stack traces, in tbutils\n - A lightweight UTC timezone available in timeutils.\n - Recursive mapping for nested data transforms, with remap\n", + "dev_url": "https://github.com/mahmoud/boltons", + "doc_url": "https://boltons.readthedocs.io/", + "env_vars": { + "CIO_TEST": "" + }, + "extra": { + "copy_test_source_files": true, + "final": true, + "flow_run_id": "6cff1f59-2eb8-4525-bfdd-067409fd7ecb", + "recipe-maintainers": [ + "kalefranz", + "nicoddemus" + ], + "remote_url": "git@github.com:AnacondaRecipes/boltons-feedstock.git", + "sha": "a3c51c03055756e96ae75c7a208ff6d04c090276" + }, + "home": "https://github.com/mahmoud/boltons", + "identifiers": [], + "keywords": [], + "license": "BSD-3-Clause", + "license_family": "BSD", + "license_file": "LICENSE", + "root_pkgs": [ + "_libgcc_mutex 0.1 main", + "_openmp_mutex 5.1 1_gnu", + "archspec 0.2.1 pyhd3eb1b0_0", + "boltons 23.0.0 py39h06a4308_0", + "brotli-python 1.0.9 py39h6a678d5_7", + "bzip2 1.0.8 h7b6447c_0", + "c-ares 1.19.1 h5eee18b_0", + "charset-normalizer 2.0.4 pyhd3eb1b0_0", + "conda-content-trust 0.2.0 py39h06a4308_0", + "conda-package-handling 2.2.0 py39h06a4308_0", + "conda-package-streaming 0.9.0 py39h06a4308_0", + "fmt 9.1.0 hdb19cb5_0", + "icu 73.1 h6a678d5_0", + "idna 3.4 py39h06a4308_0", + "jsonpatch 1.32 pyhd3eb1b0_0", + "jsonpointer 2.1 pyhd3eb1b0_0", + "krb5 1.20.1 h143b758_1", + "ld_impl_linux-64 2.38 h1181459_1", + "libarchive 3.6.2 h6ac8c49_2", + "libev 4.33 h7f8727e_1", + "libffi 3.4.4 h6a678d5_0", + "libgcc-ng 11.2.0 h1234567_1", + "libgomp 11.2.0 h1234567_1", + "libnghttp2 1.57.0 h2d74bed_0", + "libsolv 0.7.24 he621ea3_0", + "libssh2 1.10.0 hdbd6064_2", + "libstdcxx-ng 11.2.0 h1234567_1", + "libxml2 2.10.4 hf1b16e4_1", + "lz4-c 1.9.4 h6a678d5_0", + "ncurses 6.4 h6a678d5_0", + "packaging 23.1 py39h06a4308_0", + "pcre2 10.42 hebb0a14_0", + "pluggy 1.0.0 py39h06a4308_1", + "pybind11-abi 4 hd3eb1b0_1", + "pycosat 0.6.6 py39h5eee18b_0", + "pycparser 2.21 pyhd3eb1b0_0", + "pysocks 1.7.1 py39h06a4308_0", + "python 3.9.18 h955ad1f_0", + "readline 8.2 h5eee18b_0", + "reproc 14.2.4 h295c915_1", + "reproc-cpp 14.2.4 h295c915_1", + "ruamel.yaml 0.17.21 py39h5eee18b_0", + "ruamel.yaml.clib 0.2.6 py39h5eee18b_1", + "sqlite 3.41.2 h5eee18b_0", + "tk 8.6.12 h1ccaba5_0", + "tqdm 4.65.0 py39hb070fc8_0", + "wheel 0.41.2 py39h06a4308_0", + "yaml-cpp 0.8.0 h6a678d5_0", + "zlib 1.2.13 h5eee18b_0", + "zstandard 0.19.0 py39h5eee18b_0", + "zstd 1.5.5 hc292b87_0", + "attrs 23.1.0 py39h06a4308_0", + "beautifulsoup4 4.12.2 py39h06a4308_0", + "ca-certificates 2023.12.12 h06a4308_0", + "certifi 2024.2.2 py39h06a4308_0", + "cffi 1.16.0 py39h5eee18b_0", + "chardet 4.0.0 py39h06a4308_1003", + "click 8.1.7 py39h06a4308_0", + "conda 24.1.2 py39h06a4308_0", + "conda-build 24.1.2 py39h06a4308_0", + "conda-index 0.4.0 pyhd3eb1b0_0", + "conda-libmamba-solver 24.1.0 pyhd3eb1b0_0", + "cryptography 42.0.2 py39hdda0065_0", + "distro 1.8.0 py39h06a4308_0", + "filelock 3.13.1 py39h06a4308_0", + "jinja2 3.1.3 py39h06a4308_0", + "jsonschema 4.19.2 py39h06a4308_0", + "jsonschema-specifications 2023.7.1 py39h06a4308_0", + "libcurl 8.5.0 h251f7ec_0", + "libedit 3.1.20230828 h5eee18b_0", + "liblief 0.12.3 h6a678d5_0", + "libmamba 1.5.6 haf1ee3a_0", + "libmambapy 1.5.6 py39h2dafd23_0", + "markupsafe 2.1.3 py39h5eee18b_0", + "menuinst 2.0.2 py39h06a4308_0", + "more-itertools 10.1.0 py39h06a4308_0", + "openssl 3.0.13 h7f8727e_0", + "patch 2.7.6 h7b6447c_1001", + "patchelf 0.17.2 h6a678d5_0", + "pip 23.3.1 py39h06a4308_0", + "pkginfo 1.9.6 py39h06a4308_0", + "platformdirs 3.10.0 py39h06a4308_0", + "psutil 5.9.0 py39h5eee18b_0", + "py-lief 0.12.3 py39h6a678d5_0", + "pyopenssl 24.0.0 py39h06a4308_0", + "python-libarchive-c 2.9 pyhd3eb1b0_1", + "pytz 2023.3.post1 py39h06a4308_0", + "pyyaml 6.0.1 py39h5eee18b_0", + "referencing 0.30.2 py39h06a4308_0", + "requests 2.31.0 py39h06a4308_1", + "rpds-py 0.10.6 py39hb02cf49_0", + "setuptools 68.2.2 py39h06a4308_0", + "soupsieve 2.5 py39h06a4308_0", + "tomli 2.0.1 py39h06a4308_0", + "tzdata 2023d h04d1e81_0", + "urllib3 2.1.0 py39h06a4308_1", + "xz 5.4.5 h5eee18b_0", + "yaml 0.2.5 h7b6447c_0" + ], + "summary": "boltons should be builtins. Boltons is a set of over 160 BSD-licensed, pure-Python utilities in the same spirit as--and yet conspicuously missing from--the standard library.\n", + "tags": [] +} \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/files b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/files new file mode 100644 index 0000000000000000000000000000000000000000..4a8b97431fd7f90d23dab933e372795c6fb86a6c --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/files @@ -0,0 +1,67 @@ +lib/python3.13/site-packages/boltons-25.0.0.dist-info/INSTALLER +lib/python3.13/site-packages/boltons-25.0.0.dist-info/LICENSE +lib/python3.13/site-packages/boltons-25.0.0.dist-info/METADATA +lib/python3.13/site-packages/boltons-25.0.0.dist-info/RECORD +lib/python3.13/site-packages/boltons-25.0.0.dist-info/REQUESTED +lib/python3.13/site-packages/boltons-25.0.0.dist-info/WHEEL +lib/python3.13/site-packages/boltons-25.0.0.dist-info/direct_url.json +lib/python3.13/site-packages/boltons/__init__.py +lib/python3.13/site-packages/boltons/__pycache__/__init__.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/cacheutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/debugutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/deprutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/dictutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/easterutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/ecoutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/excutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/fileutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/formatutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/funcutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/gcutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/ioutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/iterutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/jsonutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/listutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/mathutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/mboxutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/namedutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/pathutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/queueutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/setutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/socketutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/statsutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/strutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/tableutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/tbutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/timeutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/typeutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/__pycache__/urlutils.cpython-313.pyc +lib/python3.13/site-packages/boltons/cacheutils.py +lib/python3.13/site-packages/boltons/debugutils.py +lib/python3.13/site-packages/boltons/deprutils.py +lib/python3.13/site-packages/boltons/dictutils.py +lib/python3.13/site-packages/boltons/easterutils.py +lib/python3.13/site-packages/boltons/ecoutils.py +lib/python3.13/site-packages/boltons/excutils.py +lib/python3.13/site-packages/boltons/fileutils.py +lib/python3.13/site-packages/boltons/formatutils.py +lib/python3.13/site-packages/boltons/funcutils.py +lib/python3.13/site-packages/boltons/gcutils.py +lib/python3.13/site-packages/boltons/ioutils.py +lib/python3.13/site-packages/boltons/iterutils.py +lib/python3.13/site-packages/boltons/jsonutils.py +lib/python3.13/site-packages/boltons/listutils.py +lib/python3.13/site-packages/boltons/mathutils.py +lib/python3.13/site-packages/boltons/mboxutils.py +lib/python3.13/site-packages/boltons/namedutils.py +lib/python3.13/site-packages/boltons/pathutils.py +lib/python3.13/site-packages/boltons/queueutils.py +lib/python3.13/site-packages/boltons/setutils.py +lib/python3.13/site-packages/boltons/socketutils.py +lib/python3.13/site-packages/boltons/statsutils.py +lib/python3.13/site-packages/boltons/strutils.py +lib/python3.13/site-packages/boltons/tableutils.py +lib/python3.13/site-packages/boltons/tbutils.py +lib/python3.13/site-packages/boltons/timeutils.py +lib/python3.13/site-packages/boltons/typeutils.py +lib/python3.13/site-packages/boltons/urlutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/git b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/git new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/hash_input.json b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/hash_input.json new file mode 100644 index 0000000000000000000000000000000000000000..54f8fb2da41bdb4962a008606b017773d2fef48e --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/hash_input.json @@ -0,0 +1,4 @@ +{ + "target_platform": "linux-64", + "channel_targets": "defaults" +} \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/index.json b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/index.json new file mode 100644 index 0000000000000000000000000000000000000000..b1ad46509ce5a88ae9e148d9669bbe4ee802c25f --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/index.json @@ -0,0 +1,16 @@ +{ + "arch": "x86_64", + "build": "py313h06a4308_0", + "build_number": 0, + "depends": [ + "python >=3.13,<3.14.0a0", + "python_abi 3.13.* *_cp313" + ], + "license": "BSD-3-Clause", + "license_family": "BSD", + "name": "boltons", + "platform": "linux", + "subdir": "linux-64", + "timestamp": 1751383912748, + "version": "25.0.0" +} \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/licenses/LICENSE b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..6a4c9d2496f53c61c99ae7c113e6ed94b15b038c --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/licenses/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2013, Mahmoud Hashemi + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/paths.json b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/paths.json new file mode 100644 index 0000000000000000000000000000000000000000..fd30e0fb1e66f0dec720f1579d743f655a046a32 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/paths.json @@ -0,0 +1,407 @@ +{ + "paths": [ + { + "_path": "lib/python3.13/site-packages/boltons-25.0.0.dist-info/INSTALLER", + "path_type": "hardlink", + "sha256": "d0edee15f91b406f3f99726e44eb990be6e34fd0345b52b910c568e0eef6a2a8", + "size_in_bytes": 5 + }, + { + "_path": "lib/python3.13/site-packages/boltons-25.0.0.dist-info/LICENSE", + "path_type": "hardlink", + "sha256": "c301912653a8d8c99eab6212aa3aea8d164ea249d8ad53c941e0558a0a5ac1e3", + "size_in_bytes": 1497 + }, + { + "_path": "lib/python3.13/site-packages/boltons-25.0.0.dist-info/METADATA", + "path_type": "hardlink", + "sha256": "47d04e0ddf42c1febf70a930daf4f6d7e18d7da0ed18771b76a3baef66ce0a1b", + "size_in_bytes": 6511 + }, + { + "_path": "lib/python3.13/site-packages/boltons-25.0.0.dist-info/RECORD", + "path_type": "hardlink", + "sha256": "36525f88075fd5eb308e2241587555df426368ff1cf1e9c9a098689b8db8ab07", + "size_in_bytes": 4402 + }, + { + "_path": "lib/python3.13/site-packages/boltons-25.0.0.dist-info/REQUESTED", + "path_type": "hardlink", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "size_in_bytes": 0 + }, + { + "_path": "lib/python3.13/site-packages/boltons-25.0.0.dist-info/WHEEL", + "path_type": "hardlink", + "sha256": "1196c6921ec87b83e865f450f08d19b8ff5592537f4ef719e83484e546abe33e", + "size_in_bytes": 81 + }, + { + "_path": "lib/python3.13/site-packages/boltons-25.0.0.dist-info/direct_url.json", + "path_type": "hardlink", + "sha256": "d7a58963758f49268739c4db4ef550a27b09b0e705c1673cb645bcd660297f43", + "size_in_bytes": 67 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__init__.py", + "path_type": "hardlink", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "size_in_bytes": 0 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/__init__.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "6e67b22e4d67e5b3698fc8bd41132fd5ddd027f847f7fbeda80ae5b578829963", + "size_in_bytes": 145 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/cacheutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "51c72c66192fb27098bd7147dd8162e1384a29bd80589971ba7caa676ed579fb", + "size_in_bytes": 39852 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/debugutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "a1a624abbb07656f7a6685d71db80f67159dcf0df33d7591d54e78326ac64022", + "size_in_bytes": 10877 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/deprutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "25fc9ae5a7d3ece4e4eafe1299553ef12cc48c3d23772e532aa21320b38a16a5", + "size_in_bytes": 1909 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/dictutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "6b7a27cb6dfa5f3e2a391168df958656803555def7a51832642bbfc76670fb7e", + "size_in_bytes": 50661 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/easterutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "67b9a18982d1b6cf583b1d4186a94826daf4ba01c1846138cce264c43471a845", + "size_in_bytes": 524 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/ecoutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "f8f26ef13482b289100f58d597aae5d40c64cd930c8fa656a2e6644549fb1eea", + "size_in_bytes": 13844 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/excutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "6da53bd3512033a4f3a0f75d2bea38c5d71fbcf88049a1ccd935e26fde7c784e", + "size_in_bytes": 11544 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/fileutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "dcb9a5f5df8c74c3819121bdf8e4fa353fde48c37dc3d0f25295c8927fbdde94", + "size_in_bytes": 30928 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/formatutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "d2007593fc8abef6f71dfe2b3c5c6d6446111484c019761b68e6779c65e43ed4", + "size_in_bytes": 14601 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/funcutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "30a66a47aa796c82bb09270368a1ea729ac5e5dcc24babac98ee2528b2dde499", + "size_in_bytes": 41362 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/gcutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "fc4e01b45fe59ad98fc6c57f293a7e8d2fb3320288a01fc0d9ba579e2d1418da", + "size_in_bytes": 5411 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/ioutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "46c30dab3b09edf89560dd854e7be4860d758f5fd13c19688fc54ea03bba9af2", + "size_in_bytes": 26986 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/iterutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "597e81f66d85a9b757e924718a5f0b35cccbbabffdbd13d886b814e22933d640", + "size_in_bytes": 62228 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/jsonutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "fec6f0604a96cd9ea635a5335f3ee64c082f633766896e36cb129a7788d63c93", + "size_in_bytes": 9910 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/listutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "01a0619f48a4ebd0770786e4576dc6fa1f86f3458509e95faa31feaad07c95c3", + "size_in_bytes": 14891 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/mathutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "dfab729d88ea97b72d844c07bb7eccaff6ae9c3e50dbfa81d9d85ecb4efbdc5c", + "size_in_bytes": 10138 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/mboxutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "b354ffd90a973deb08d47d7d06b5011f9210a54269270ad8b49b00f4a701ea09", + "size_in_bytes": 4983 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/namedutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "ea5bb77a9d097ef070322c39fa77e636ebcfdc8076662b05979d1fcb53862e75", + "size_in_bytes": 14604 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/pathutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "5c45eb29b8cad885c1f1bedea995a2cdc1d1e54667283342d596666a5629abba", + "size_in_bytes": 5114 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/queueutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "b0046567fbf674765de39b9575756b28defec1391a5749b0f66e700a1a7ad77f", + "size_in_bytes": 8502 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/setutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "5760187c48f4bea92cfd98cce224ab09c0c3fedad171049e19e00e05cb44a89b", + "size_in_bytes": 40160 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/socketutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "288431d8c9d0e51aa452dc55378cd3ffead83715969529f6c8b6547fd57c9570", + "size_in_bytes": 33667 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/statsutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "e362db456041adff786b8a540ce4a2929d5b63e5fb416b102d544b18ce2f3199", + "size_in_bytes": 33358 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/strutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "8889107c7df3980df3039b9e7b474c1fdb1952773f72fdcfef5803da64c8bffc", + "size_in_bytes": 45180 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/tableutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "78a7414553ed5b6e88449b380331edcfa03e5dd08c74d9d81a9698263d650075", + "size_in_bytes": 25514 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/tbutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "80b288a7a8a45ca43f639a997b4416745822142e1b141f69b829df3a4f8c2032", + "size_in_bytes": 35916 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/timeutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "1fd0952c1989b972f536802f60a4896605ae050165c7e68e5756702da494ec84", + "size_in_bytes": 22068 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/typeutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "4bfb6a08ca125236a4ff7c38feacee0a589dd11e025cb6cf50e7723efd98528d", + "size_in_bytes": 6183 + }, + { + "_path": "lib/python3.13/site-packages/boltons/__pycache__/urlutils.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "31b36758654091a8d51868ad2a1a533c9546b9a33734ab81f01b8a3ff5925d8d", + "size_in_bytes": 67929 + }, + { + "_path": "lib/python3.13/site-packages/boltons/cacheutils.py", + "path_type": "hardlink", + "sha256": "cb22998f46013d91c96b28e141bfc75de274f793e384b3db9a9db59b0c820ea5", + "size_in_bytes": 30399 + }, + { + "_path": "lib/python3.13/site-packages/boltons/debugutils.py", + "path_type": "hardlink", + "sha256": "e701ab82126836aa661f7e9272a9a8b339814ae602977b47213f0aebacfda283", + "size_in_bytes": 10320 + }, + { + "_path": "lib/python3.13/site-packages/boltons/deprutils.py", + "path_type": "hardlink", + "sha256": "d8f2c0fdce9d8276466127f093771e1a0a8844bcd1bd92e6880f30d2782e0151", + "size_in_bytes": 2478 + }, + { + "_path": "lib/python3.13/site-packages/boltons/dictutils.py", + "path_type": "hardlink", + "sha256": "ab54e00ae375b64cdaa8bfa8da3dfaa3790aeb40ce0717188be97b199c32feb1", + "size_in_bytes": 37642 + }, + { + "_path": "lib/python3.13/site-packages/boltons/easterutils.py", + "path_type": "hardlink", + "sha256": "1bfc6e9e05606689ab4087b00585c183ff4fcc4eb4a423f9be153a0be6818d40", + "size_in_bytes": 1798 + }, + { + "_path": "lib/python3.13/site-packages/boltons/ecoutils.py", + "path_type": "hardlink", + "sha256": "38a6c2f045d28ac06c8d9b971185bd8bb9196cf84fa1b9f16cc1f6730b122d9f", + "size_in_bytes": 14036 + }, + { + "_path": "lib/python3.13/site-packages/boltons/excutils.py", + "path_type": "hardlink", + "sha256": "6a2eddd26f46dbdceeda125bd20379d52ffc98a941fe867e3434d17b93119957", + "size_in_bytes": 8972 + }, + { + "_path": "lib/python3.13/site-packages/boltons/fileutils.py", + "path_type": "hardlink", + "sha256": "3cf65e04eaedb63d71e5a4bfe6974194802ae203439cfd8f3f87f2807fc731fc", + "size_in_bytes": 25486 + }, + { + "_path": "lib/python3.13/site-packages/boltons/formatutils.py", + "path_type": "hardlink", + "sha256": "15c7963d5c97b11ec7a419e9e4aec7c20ca765bcf701306510c9c57c7eaeb1a4", + "size_in_bytes": 12728 + }, + { + "_path": "lib/python3.13/site-packages/boltons/funcutils.py", + "path_type": "hardlink", + "sha256": "54d826132a9796be4aadf0c30e3e62a58d61e4c5a7a5f6993a2b959d0bbb03a0", + "size_in_bytes": 36840 + }, + { + "_path": "lib/python3.13/site-packages/boltons/gcutils.py", + "path_type": "hardlink", + "sha256": "e82a32093560c14bb8298532681a3338d2ec6f48d20ccf2f1a4496dd67a17f97", + "size_in_bytes": 6229 + }, + { + "_path": "lib/python3.13/site-packages/boltons/ioutils.py", + "path_type": "hardlink", + "sha256": "36727e503a7483d1f91efc7cd837e502dc4b560e1bff5f7f9e66cda09421b6bc", + "size_in_bytes": 17991 + }, + { + "_path": "lib/python3.13/site-packages/boltons/iterutils.py", + "path_type": "hardlink", + "sha256": "229f0f767aa3ca9fbc0b057dd7191170815bffb43599d3a293a246bd5a75afb6", + "size_in_bytes": 57562 + }, + { + "_path": "lib/python3.13/site-packages/boltons/jsonutils.py", + "path_type": "hardlink", + "sha256": "f71876a97e818d3988b3296cf2a11788d0513cf251f269f8eb7fd42aab591094", + "size_in_bytes": 9864 + }, + { + "_path": "lib/python3.13/site-packages/boltons/listutils.py", + "path_type": "hardlink", + "sha256": "aa680163cb34129c08d89e236b55e7d5be61cc321a48567d9d080b7ff633d110", + "size_in_bytes": 12088 + }, + { + "_path": "lib/python3.13/site-packages/boltons/mathutils.py", + "path_type": "hardlink", + "sha256": "298f80d272dd69510a3c6ed50e6ad76f28ac5e9f92aec0aab81322f7c88369a4", + "size_in_bytes": 7941 + }, + { + "_path": "lib/python3.13/site-packages/boltons/mboxutils.py", + "path_type": "hardlink", + "sha256": "426b5211f7b3ce6ee9d1c80d794b56d9544435865b48a016d1955cd0a1e0320d", + "size_in_bytes": 5938 + }, + { + "_path": "lib/python3.13/site-packages/boltons/namedutils.py", + "path_type": "hardlink", + "sha256": "13f1273386f5695c474099cf22fcc00dcfcccda3719e1ff30df8a138c3dcdf96", + "size_in_bytes": 14957 + }, + { + "_path": "lib/python3.13/site-packages/boltons/pathutils.py", + "path_type": "hardlink", + "sha256": "667a4bb46ed79f66af83b07fac419f3f91576c2e7ed404e11f28cd68b4645fbd", + "size_in_bytes": 6497 + }, + { + "_path": "lib/python3.13/site-packages/boltons/queueutils.py", + "path_type": "hardlink", + "sha256": "a60f04f5f27803429c7a79f3f51f9b286cba3bd997f122161f252c66ca0499bb", + "size_in_bytes": 7650 + }, + { + "_path": "lib/python3.13/site-packages/boltons/setutils.py", + "path_type": "hardlink", + "sha256": "6dc3c91b2c3bc30d319d62803a5ba1ac326022fce7b24e3402d455c897f3c478", + "size_in_bytes": 33482 + }, + { + "_path": "lib/python3.13/site-packages/boltons/socketutils.py", + "path_type": "hardlink", + "sha256": "b2d5da2d58dd3d05c14153a83f36da928fe6285a4a44850c2eab9877c1959adc", + "size_in_bytes": 29900 + }, + { + "_path": "lib/python3.13/site-packages/boltons/statsutils.py", + "path_type": "hardlink", + "sha256": "cfd6dd5fe727c4b168beeeeaf1ff9736e73dd195037fc8d1ad03c106d1579745", + "size_in_bytes": 29923 + }, + { + "_path": "lib/python3.13/site-packages/boltons/strutils.py", + "path_type": "hardlink", + "sha256": "a9453a1eafa8037929ff12fa3496faebe55114c5625186668d238593b8e51389", + "size_in_bytes": 43592 + }, + { + "_path": "lib/python3.13/site-packages/boltons/tableutils.py", + "path_type": "hardlink", + "sha256": "00444911931f640d009710cfbda813f30b6839b82d3d6a28860a1bf5a472267e", + "size_in_bytes": 21922 + }, + { + "_path": "lib/python3.13/site-packages/boltons/tbutils.py", + "path_type": "hardlink", + "sha256": "4314ef581fa5eb47294d31dc534c72ccf9863af491a69324f88de6b703d64652", + "size_in_bytes": 30474 + }, + { + "_path": "lib/python3.13/site-packages/boltons/timeutils.py", + "path_type": "hardlink", + "sha256": "fdefe22ae394666b95195e5b290c9969cdb5ce979cc9c37805cefcc02abe2df5", + "size_in_bytes": 20308 + }, + { + "_path": "lib/python3.13/site-packages/boltons/typeutils.py", + "path_type": "hardlink", + "sha256": "4da2b26d71386ee9010dfb52104e461ecba486ba5544a8cf50d9e26cd34e9c09", + "size_in_bytes": 5814 + }, + { + "_path": "lib/python3.13/site-packages/boltons/urlutils.py", + "path_type": "hardlink", + "sha256": "8c0b344c4ca3fd9af94b6eb1e0d9836e4a4f6f1e4468bccf0ece747bbad5498e", + "size_in_bytes": 57489 + } + ], + "paths_version": 1 +} \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/conda_build_config.yaml b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/conda_build_config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a27fb9c9bffdf22ba50843d120e4cf535a83b842 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/conda_build_config.yaml @@ -0,0 +1,377 @@ +VERBOSE_AT: V=1 +VERBOSE_CM: VERBOSE=1 +alsa_lib: '1.2' +ampl_mp: '3.1' +aom: '3.6' +armadillo: '12' +arpack: '3.9' +arrow_cpp: 19.0.0 +assimp: 5.4.3 +at_spi2_core: '2.36' +aws_c_auth: 0.8.5 +aws_c_cal: 0.8.5 +aws_c_common: 0.11.1 +aws_c_compression: 0.3.1 +aws_c_event_stream: 0.5.4 +aws_c_http: 0.9.3 +aws_c_io: 0.17.0 +aws_c_mqtt: 0.12.2 +aws_c_s3: 0.7.11 +aws_c_sdkutils: 0.2.3 +aws_checksums: 0.2.3 +aws_crt_cpp: 0.31.0 +aws_sdk_cpp: 1.11.528 +azure_core_cpp: 1.14.1 +azure_identity_cpp: 1.10.1 +azure_storage_blobs_cpp: 12.13.0 +azure_storage_common_cpp: 12.10.0 +backtrace: '20241216' +blas_impl: openblas +blosc: '1' +boost: '1.82' +boost_cpp: '1.82' +brunsli: '0' +bzip2: '1' +c_ares: '1' +c_blosc2: '2' +c_compiler: gcc +c_compiler_version: 11.2.0 +c_stdlib: sysroot +c_stdlib_version: '2.17' +cairo: '1' +capnproto: 1.1.0 +ceres_solver: '2.2' +cfitsio: '3.470' +cgo_compiler: go-cgo +cgo_compiler_version: '1.21' +channel_targets: defaults +charls: '2.2' +clang_variant: clang +coin_or_cbc: '2.10' +coin_or_cgl: '0.60' +coin_or_clp: '1.17' +coin_or_osi: '0.108' +coin_or_utils: '2.11' +cpu_optimization_target: nocona +cran_mirror: https://cran.r-project.org +cuda_compiler: cuda-nvcc +cuda_compiler_version: '12.4' +cudnn: '9' +cutensor: '2' +cxx_compiler: gxx +cxx_compiler_version: 11.2.0 +cyrus_sasl: 2.1.28 +dav1d: 1.2.1 +dbus: '1' +eigen: 3.3.7 +epoxy: '1.5' +expat: '2' +extend_keys: +- ignore_build_only_deps +- ignore_version +- extend_keys +- pin_run_as_build +ffmpeg: '6' +fftw: '3.3' +flatbuffers: 24.3.25 +fmt: '9' +fontconfig: '2' +fortran_compiler: gfortran +fortran_compiler_version: 11.2.0 +freeglut: '3' +freetds: '1' +freetype: '2' +freexl: '2' +fribidi: '1' +g2clib: '1.6' +gcab: '1' +gdbm: '1.18' +gdk_pixbuf: '2' +geos: 3.10.6 +geotiff: '1.7' +gettext: '0' +gflags: '2.2' +giflib: '5.2' +gl2ps: 1.4.2 +glew: '2.2' +glib: '2' +glog: '0.5' +glpk: '4.65' +glslang: '15' +gmp: '6' +gnupg: '2.4' +gnutls: '3.8' +go_compiler: go-nocgo +go_compiler_version: '1.21' +graphite2: '1' +gsl: '2.7' +gst_plugins_base: '1.24' +gst_plugins_good: '1.24' +gstreamer: '1.24' +gstreamer_orc: '0.4' +gtest: 1.14.0 +gtk3: '3' +gts: '0.7' +harfbuzz: '10' +hdf4: 4.2.13 +hdf5: 1.14.5 +hdfeos2: '2.20' +hdfeos5: '5.1' +icu: '73' +ignore_build_only_deps: +- python +- numpy +igraph: '0.10' +isl: '0.22' +jansson: '2' +jasper: '4' +jemalloc: '5' +jpeg: 9e +json_c: '0.16' +jsoncpp: 1.9.4 +jxrlib: '1.1' +kealib: '1.5' +krb5: '1.21' +lame: '3.100' +lcms2: '2' +leptonica: '1.82' +lerc: '4' +leveldb: '1.23' +libabseil: '20250127.0' +libaec: '1' +libaio: '0.3' +libapr: '1' +libapriconv: '1' +libaprutil: '1' +libarchive: '3.7' +libassuan: '3' +libavif: '1' +libbrotlicommon: '1.0' +libbrotlidec: '1.0' +libbrotlienc: '1.0' +libclang13: '14.0' +libclang_cpp14: '14.0' +libcrc32c: '1.1' +libcryptominisat: '5.6' +libcurl: '8' +libdap4: '3.19' +libdb: '6.2' +libde265: 1.0.15 +libdeflate: '1.22' +libdrm: '2.4' +libebm: 0.4.4 +libedit: '3.1' +libegl: '1' +libevent: 2.1.12 +libfaiss: 1.0.0 +libffi: '3.4' +libflac: '1.4' +libgcrypt: '1' +libgd: '2.3' +libgdal: '3.6' +libgit2: '1.6' +libgl: '1' +libgles: '1' +libglib: '2' +libglvnd: '1' +libglx: '1' +libgpg_error: '1' +libgrpc: '1.71' +libgsasl: '1' +libgsf: '1.14' +libheif: '1.19' +libiconv: '1' +libidn2: '2' +libjpeg_turbo: '3' +libkml: '1.3' +libksba: '1.6' +liblief: '0.16' +libllvm19: '19.1' +libmamba: '2.0' +libmambapy: '2.0' +libmicrohttpd: '0.9' +libmlir19: '19.1' +libnetcdf: '4' +libnghttp2: '1' +libnsl: '2.0' +libntlm: '1' +libogg: '1.3' +libopengl: '1' +libopus: '1' +libortools: '9.9' +libosqp: 0.6.3 +libpcap: '1.10' +libpciaccess: '0.18' +libpng: '1.6' +libpq: '17' +libprotobuf: 5.29.3 +libqdldl: 0.1.7 +librdkafka: '2.2' +libre2_11: '2024' +librsvg: '2' +libsentencepiece: 0.2.0 +libsndfile: '1.2' +libsodium: 1.0.18 +libspatialindex: 1.9.3 +libspatialite: '5.1' +libssh2: '1' +libtasn1: '4' +libtensorflow: 2.18.1 +libtensorflow_cc: 2.18.1 +libtheora: '1' +libthrift: '0.15' +libtiff: '4' +libtorch: '2.5' +libunistring: '0' +libunwind: '1' +libutf8proc: '2' +libuuid: '1' +libuv: '1' +libvorbis: '1' +libvpx: '1.13' +libwebp: 1.3.2 +libwebp_base: '1' +libxcb: '1' +libxkbcommon: '1' +libxml2: '2.13' +libxmlsec1: '1.3' +libxslt: '1' +libzopfli: '1.0' +lmdb: '0' +lua: '5' +lz4_c: '1.9' +lzo: '2' +mbedtls: '3.5' +metis: '5.1' +minizip: '4' +mkl: '2023' +mkl_service: '2' +mpc: '1' +mpfr: '4' +mpich: '4' +nanobind_abi: '15' +nccl: '2' +ncurses: '6' +nettle: '3.7' +nlopt: '2.7' +npth: '1' +nspr: '4' +nss: '3' +ntbtls: '0' +numpy: '2.1' +ocl_icd: '2' +oniguruma: '6.9' +openblas: '0' +openblas_devel: '0' +openh264: '2.6' +openjpeg: '2' +openldap: '2.6' +openmpi: '4.1' +openssl: '3' +orc: 2.1.1 +pango: '1' +pcre: '8' +pcre2: '10.42' +pdal: '2.5' +perl: '5.38' +pin_run_as_build: + python: + max_pin: x.x + min_pin: x.x + r-base: + max_pin: x.x + min_pin: x.x + libboost: + max_pin: x.x.x +pixman: '0' +popt: '1' +proj: 9.3.1 +ptscotch: 6.0.9 +pugixml: '1.11' +py_lief: '0.16' +pybind11_abi: '5' +pyqt: '6.7' +pyqtwebengine: '6.7' +python: '3.13' +python_igraph: '0.10' +python_impl: cpython +python_implementation: cpython +pytorch: '2.5' +qhull: '2020.2' +qpdf: '11' +qt: '6.7' +quantlib: '1' +r_base: 4.3.1 +r_implementation: r-base +r_version: 4.3.1 +rdkit: 2023.03.3 +re2: '2024' +readline: '8' +reproc: '14.2' +reproc_cpp: '14.2' +rhash: '1' +ruby: '3.2' +rust_compiler: rust +rust_compiler_version: 1.87.0 +s2n: 1.5.14 +scotch: 6.0.9 +serf: '1.3' +simdjson: '3.10' +sip: '6.10' +sleef: '3' +snappy: '1' +spdlog: '1' +spdlog_fmt_embed: '1' +spirv_tools: '2025' +sqlite: '3' +suitesparse: '7' +target_platform: linux-64 +tesseract: 5.2.0 +tiledb: '2.26' +tk: '8.6' +unixodbc: '2.3' +vc: '14' +vtk_base: 9.4.1 +vtk_io_ffmpeg: 9.4.1 +x264: 1!152.20180806 +xcb_util: '0.4' +xcb_util_cursor: '0.1' +xcb_util_image: '0.4' +xcb_util_keysyms: '0.4' +xcb_util_renderutil: '0.3' +xcb_util_wm: '0.4' +xerces_c: '3.2' +xorg_libice: '1' +xorg_libsm: '1' +xorg_libx11: '1' +xorg_libxau: '1' +xorg_libxcomposite: '0' +xorg_libxcursor: '1' +xorg_libxdamage: '1' +xorg_libxdmcp: '1' +xorg_libxext: '1' +xorg_libxfixes: '6' +xorg_libxft: '2' +xorg_libxi: '1' +xorg_libxinerama: '1.1' +xorg_libxmu: '1' +xorg_libxrandr: '1' +xorg_libxrender: '0.9' +xorg_libxscrnsaver: '1' +xorg_libxshmfence: '1' +xorg_libxt: '1' +xorg_libxtst: '1' +xorg_libxxf86vm: '1' +xorg_xextproto: '7' +xorg_xorgproto: '2024' +xxhash: 0.8.0 +xz: '5' +yaml: '0.2' +yaml_cpp: '0.8' +zfp: '1' +zip_keys: +- - python + - numpy +zlib: '1.2' +zlib_ng: '2.0' +zstd: '1.5' diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/meta.yaml b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..565ce807be469cc013eb0f444b9aaff39e1c9003 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/meta.yaml @@ -0,0 +1,124 @@ +# This file created by conda-build 24.1.2 +# meta.yaml template originally from: +# /feedstock/recipe, last modified Tue Jul 1 15:28:37 2025 +# ------------------------------------------------ + +package: + name: boltons + version: 25.0.0 +source: + fn: boltons-25.0.0.tar.gz + sha256: 7c9e47f2ca1c1f704950e913bf518c6c599dc4a01bc5feffffce2c3bf3c878ee + url: https://github.com/mahmoud/boltons/archive/25.0.0.tar.gz +build: + number: '0' + script: /croot/boltons_1751383775419/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/bin/python + -m pip install . --no-deps -vv --no-build-isolation + string: py313h06a4308_0 +requirements: + host: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - bzip2 1.0.8 h5eee18b_6 + - ca-certificates 2025.2.25 h06a4308_0 + - expat 2.7.1 h6a678d5_0 + - flit-core 3.9.0 py313hee27c6d_1 + - ld_impl_linux-64 2.40 h12ee557_0 + - libffi 3.4.4 h6a678d5_1 + - libgcc-ng 11.2.0 h1234567_1 + - libgomp 11.2.0 h1234567_1 + - libmpdec 4.0.0 h5eee18b_0 + - libstdcxx-ng 11.2.0 h1234567_1 + - libuuid 1.41.5 h5eee18b_0 + - libxcb 1.17.0 h9b100fa_0 + - ncurses 6.4 h6a678d5_0 + - openssl 3.0.16 h5eee18b_0 + - pip 25.1 pyhc872135_2 + - pthread-stubs 0.3 h0ce48e5_1 + - python 3.13.5 h4612cfd_100_cp313 + - python_abi 3.13 0_cp313 + - readline 8.2 h5eee18b_0 + - setuptools 78.1.1 py313h06a4308_0 + - sqlite 3.45.3 h5eee18b_0 + - tk 8.6.14 h993c535_1 + - tzdata 2025b h04d1e81_0 + - wheel 0.45.1 py313h06a4308_0 + - xorg-libx11 1.8.12 h9b100fa_1 + - xorg-libxau 1.0.12 h9b100fa_0 + - xorg-libxdmcp 1.1.5 h9b100fa_0 + - xorg-xorgproto 2024.1 h5eee18b_1 + - xz 5.6.4 h5eee18b_1 + - zlib 1.2.13 h5eee18b_1 + run: + - python >=3.13,<3.14.0a0 + - python_abi 3.13.* *_cp313 +test: + commands: + - echo [pytest] > pytest.ini + - echo doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS + ALLOW_UNICODE >> pytest.ini + - pytest -vv --doctest-modules boltons tests + - pip check + imports: + - boltons + - boltons.cacheutils + - boltons.debugutils + - boltons.dictutils + - boltons.ecoutils + - boltons.fileutils + - boltons.formatutils + - boltons.funcutils + - boltons.gcutils + - boltons.ioutils + - boltons.iterutils + - boltons.jsonutils + - boltons.listutils + - boltons.mathutils + - boltons.mboxutils + - boltons.namedutils + - boltons.pathutils + - boltons.queueutils + - boltons.setutils + - boltons.socketutils + - boltons.statsutils + - boltons.strutils + - boltons.tableutils + - boltons.tbutils + - boltons.timeutils + - boltons.typeutils + - boltons.urlutils + requires: + - pip + - pytest + source_files: + - boltons + - tests + - tox.ini +about: + description: "Boltons is a set of pure-Python utilities in the same spirit as \u2014\ + \ and yet conspicuously missing from \u2014 the standard library, including:\n\ + \n - Atomic file saving, bolted on with fileutils\n - A highly-optimized OrderedMultiDict,\ + \ in dictutils\n - Two types of PriorityQueue, in queueutils\n - Chunked and\ + \ windowed iteration, in iterutils\n - A full-featured TracebackInfo type, for\ + \ representing stack traces, in tbutils\n - A lightweight UTC timezone available\ + \ in timeutils.\n - Recursive mapping for nested data transforms, with remap\n" + dev_url: https://github.com/mahmoud/boltons + doc_url: https://boltons.readthedocs.io/ + home: https://github.com/mahmoud/boltons + license: BSD-3-Clause + license_family: BSD + license_file: LICENSE + summary: 'boltons should be builtins. Boltons is a set of over 160 BSD-licensed, + pure-Python utilities in the same spirit as--and yet conspicuously missing from--the + standard library. + + ' +extra: + copy_test_source_files: true + final: true + flow_run_id: 6cff1f59-2eb8-4525-bfdd-067409fd7ecb + recipe-maintainers: + - kalefranz + - nicoddemus + remote_url: git@github.com:AnacondaRecipes/boltons-feedstock.git + sha: a3c51c03055756e96ae75c7a208ff6d04c090276 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/meta.yaml.template b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/meta.yaml.template new file mode 100644 index 0000000000000000000000000000000000000000..a8ef45d21dedbc772816e56e48b858272f156b2d --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/recipe/meta.yaml.template @@ -0,0 +1,95 @@ +{% set name = "boltons" %} +{% set version = "25.0.0" %} + +package: + name: {{ name }} + version: {{ version }} + +source: + fn: boltons-{{ version }}.tar.gz + url: https://github.com/mahmoud/boltons/archive/{{ version }}.tar.gz + sha256: 7c9e47f2ca1c1f704950e913bf518c6c599dc4a01bc5feffffce2c3bf3c878ee + +build: + number: 0 + script: {{ PYTHON }} -m pip install . --no-deps -vv --no-build-isolation + skip: True # [py<37] + +requirements: + host: + - pip + - python + - flit-core >=3.2,<4 + run: + - python + +test: + source_files: + - boltons + - tests + - tox.ini + imports: + - boltons + - boltons.cacheutils + - boltons.debugutils + - boltons.dictutils + - boltons.ecoutils + - boltons.fileutils + - boltons.formatutils + - boltons.funcutils + - boltons.gcutils + - boltons.ioutils + - boltons.iterutils + - boltons.jsonutils + - boltons.listutils + - boltons.mathutils + - boltons.mboxutils + - boltons.namedutils + - boltons.pathutils + - boltons.queueutils + - boltons.setutils + - boltons.socketutils + - boltons.statsutils + - boltons.strutils + - boltons.tableutils + - boltons.tbutils + - boltons.timeutils + - boltons.typeutils + - boltons.urlutils + requires: + - pytest + - pip + commands: + # Add back now missing pytest.ini matching https://github.com/mahmoud/boltons/blob/24.1.0/pytest.ini + - echo [pytest] > pytest.ini + - echo doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS ALLOW_UNICODE >> pytest.ini + # tests/test_jsonutils.py::test_reverse_iter_lines fails due to line endings on windows. + - pytest -vv --doctest-modules boltons tests -k "not test_reverse_iter_lines" # [win] + - pytest -vv --doctest-modules boltons tests # [not win] + - pip check + + +about: + home: https://github.com/mahmoud/boltons + dev_url: https://github.com/mahmoud/boltons + doc_url: https://boltons.readthedocs.io/ + license: BSD-3-Clause + license_file: LICENSE + license_family: BSD + summary: > + boltons should be builtins. Boltons is a set of over 160 BSD-licensed, pure-Python utilities in the same spirit as--and yet conspicuously missing from--the standard library. + description: | + Boltons is a set of pure-Python utilities in the same spirit as — and yet conspicuously missing from — the standard library, including: + + - Atomic file saving, bolted on with fileutils + - A highly-optimized OrderedMultiDict, in dictutils + - Two types of PriorityQueue, in queueutils + - Chunked and windowed iteration, in iterutils + - A full-featured TracebackInfo type, for representing stack traces, in tbutils + - A lightweight UTC timezone available in timeutils. + - Recursive mapping for nested data transforms, with remap + +extra: + recipe-maintainers: + - kalefranz + - nicoddemus diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/repodata_record.json b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/repodata_record.json new file mode 100644 index 0000000000000000000000000000000000000000..71f1a994c3d28f0de6e2e1959bd3b34c5f967cba --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/repodata_record.json @@ -0,0 +1,23 @@ +{ + "arch": "x86_64", + "build": "py313h06a4308_0", + "build_number": 0, + "channel": "https://repo.anaconda.com/pkgs/main/linux-64/", + "constrains": [], + "depends": [ + "python >=3.13,<3.14.0a0", + "python_abi 3.13.* *_cp313" + ], + "fn": "boltons-25.0.0-py313h06a4308_0.conda", + "license": "BSD-3-Clause", + "license_family": "BSD", + "md5": "afd30cc40ab0edf4e246b901c8eca725", + "name": "boltons", + "platform": "linux", + "sha256": "248e6cb425de676a39915d1c241e0434d9ec8b19d27771f7132907519f7fbc77", + "size": 522428, + "subdir": "linux-64", + "timestamp": 1751383912000, + "url": "https://repo.anaconda.com/pkgs/main/linux-64/boltons-25.0.0-py313h06a4308_0.conda", + "version": "25.0.0" +} \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/__init__.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/cacheutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/cacheutils.py new file mode 100644 index 0000000000000000000000000000000000000000..856bf195483aafbfcdb8f6f93a168daf0c9b5857 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/cacheutils.py @@ -0,0 +1,870 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""``cacheutils`` contains consistent implementations of fundamental +cache types. Currently there are two to choose from: + + * :class:`LRI` - Least-recently inserted + * :class:`LRU` - Least-recently used + +Both caches are :class:`dict` subtypes, designed to be as +interchangeable as possible, to facilitate experimentation. A key +practice with performance enhancement with caching is ensuring that +the caching strategy is working. If the cache is constantly missing, +it is just adding more overhead and code complexity. The standard +statistics are: + + * ``hit_count`` - the number of times the queried key has been in + the cache + * ``miss_count`` - the number of times a key has been absent and/or + fetched by the cache + * ``soft_miss_count`` - the number of times a key has been absent, + but a default has been provided by the caller, as with + :meth:`dict.get` and :meth:`dict.setdefault`. Soft misses are a + subset of misses, so this number is always less than or equal to + ``miss_count``. + +Additionally, ``cacheutils`` provides :class:`ThresholdCounter`, a +cache-like bounded counter useful for online statistics collection. + +Learn more about `caching algorithms on Wikipedia +`_. + +""" + +# TODO: TimedLRI +# TODO: support 0 max_size? + + +import heapq +import weakref +import itertools +from operator import attrgetter + +try: + from threading import RLock +except Exception: + class RLock: + 'Dummy reentrant lock for builds without threads' + def __enter__(self): + pass + + def __exit__(self, exctype, excinst, exctb): + pass + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') + _KWARG_MARK = make_sentinel(var_name='_KWARG_MARK') +except ImportError: + _MISSING = object() + _KWARG_MARK = object() + +PREV, NEXT, KEY, VALUE = range(4) # names for the link fields +DEFAULT_MAX_SIZE = 128 + + +class LRI(dict): + """The ``LRI`` implements the basic *Least Recently Inserted* strategy to + caching. One could also think of this as a ``SizeLimitedDefaultDict``. + + *on_miss* is a callable that accepts the missing key (as opposed + to :class:`collections.defaultdict`'s "default_factory", which + accepts no arguments.) Also note that, like the :class:`LRI`, + the ``LRI`` is instrumented with statistics tracking. + + >>> cap_cache = LRI(max_size=2) + >>> cap_cache['a'], cap_cache['b'] = 'A', 'B' + >>> from pprint import pprint as pp + >>> pp(dict(cap_cache)) + {'a': 'A', 'b': 'B'} + >>> [cap_cache['b'] for i in range(3)][0] + 'B' + >>> cap_cache['c'] = 'C' + >>> print(cap_cache.get('a')) + None + >>> cap_cache.hit_count, cap_cache.miss_count, cap_cache.soft_miss_count + (3, 1, 1) + """ + def __init__(self, max_size=DEFAULT_MAX_SIZE, values=None, + on_miss=None): + if max_size <= 0: + raise ValueError('expected max_size > 0, not %r' % max_size) + self.hit_count = self.miss_count = self.soft_miss_count = 0 + self.max_size = max_size + self._lock = RLock() + self._init_ll() + + if on_miss is not None and not callable(on_miss): + raise TypeError('expected on_miss to be a callable' + ' (or None), not %r' % on_miss) + self.on_miss = on_miss + + if values: + self.update(values) + + # TODO: fromkeys()? + + # linked list manipulation methods. + # + # invariants: + # 1) 'anchor' is the sentinel node in the doubly linked list. there is + # always only one, and its KEY and VALUE are both _MISSING. + # 2) the most recently accessed node comes immediately before 'anchor'. + # 3) the least recently accessed node comes immediately after 'anchor'. + def _init_ll(self): + anchor = [] + anchor[:] = [anchor, anchor, _MISSING, _MISSING] + # a link lookup table for finding linked list links in O(1) + # time. + self._link_lookup = {} + self._anchor = anchor + + def _print_ll(self): + print('***') + for (key, val) in self._get_flattened_ll(): + print(key, val) + print('***') + return + + def _get_flattened_ll(self): + flattened_list = [] + link = self._anchor + while True: + flattened_list.append((link[KEY], link[VALUE])) + link = link[NEXT] + if link is self._anchor: + break + return flattened_list + + def _get_link_and_move_to_front_of_ll(self, key): + # find what will become the newest link. this may raise a + # KeyError, which is useful to __getitem__ and __setitem__ + newest = self._link_lookup[key] + + # splice out what will become the newest link. + newest[PREV][NEXT] = newest[NEXT] + newest[NEXT][PREV] = newest[PREV] + + # move what will become the newest link immediately before + # anchor (invariant 2) + anchor = self._anchor + second_newest = anchor[PREV] + second_newest[NEXT] = anchor[PREV] = newest + newest[PREV] = second_newest + newest[NEXT] = anchor + return newest + + def _set_key_and_add_to_front_of_ll(self, key, value): + # create a new link and place it immediately before anchor + # (invariant 2). + anchor = self._anchor + second_newest = anchor[PREV] + newest = [second_newest, anchor, key, value] + second_newest[NEXT] = anchor[PREV] = newest + self._link_lookup[key] = newest + + def _set_key_and_evict_last_in_ll(self, key, value): + # the link after anchor is the oldest in the linked list + # (invariant 3). the current anchor becomes a link that holds + # the newest key, and the oldest link becomes the new anchor + # (invariant 1). now the newest link comes before anchor + # (invariant 2). no links are moved; only their keys + # and values are changed. + oldanchor = self._anchor + oldanchor[KEY] = key + oldanchor[VALUE] = value + + self._anchor = anchor = oldanchor[NEXT] + evicted = anchor[KEY] + anchor[KEY] = anchor[VALUE] = _MISSING + del self._link_lookup[evicted] + self._link_lookup[key] = oldanchor + return evicted + + def _remove_from_ll(self, key): + # splice a link out of the list and drop it from our lookup + # table. + link = self._link_lookup.pop(key) + link[PREV][NEXT] = link[NEXT] + link[NEXT][PREV] = link[PREV] + + def __setitem__(self, key, value): + with self._lock: + try: + link = self._get_link_and_move_to_front_of_ll(key) + except KeyError: + if len(self) < self.max_size: + self._set_key_and_add_to_front_of_ll(key, value) + else: + evicted = self._set_key_and_evict_last_in_ll(key, value) + super().__delitem__(evicted) + else: + link[VALUE] = value + super().__setitem__(key, value) + return + + def __getitem__(self, key): + with self._lock: + try: + link = self._link_lookup[key] + except KeyError: + self.miss_count += 1 + if not self.on_miss: + raise + ret = self[key] = self.on_miss(key) + return ret + + self.hit_count += 1 + return link[VALUE] + + def get(self, key, default=None): + try: + return self[key] + except KeyError: + self.soft_miss_count += 1 + return default + + def __delitem__(self, key): + with self._lock: + super().__delitem__(key) + self._remove_from_ll(key) + + def pop(self, key, default=_MISSING): + # NB: hit/miss counts are bypassed for pop() + with self._lock: + try: + ret = super().pop(key) + except KeyError: + if default is _MISSING: + raise + ret = default + else: + self._remove_from_ll(key) + return ret + + def popitem(self): + with self._lock: + item = super().popitem() + self._remove_from_ll(item[0]) + return item + + def clear(self): + with self._lock: + super().clear() + self._init_ll() + + def copy(self): + return self.__class__(max_size=self.max_size, values=self) + + def setdefault(self, key, default=None): + with self._lock: + try: + return self[key] + except KeyError: + self.soft_miss_count += 1 + self[key] = default + return default + + def update(self, E, **F): + # E and F are throwback names to the dict() __doc__ + with self._lock: + if E is self: + return + setitem = self.__setitem__ + if callable(getattr(E, 'keys', None)): + for k in E.keys(): + setitem(k, E[k]) + else: + for k, v in E: + setitem(k, v) + for k in F: + setitem(k, F[k]) + return + + def __eq__(self, other): + with self._lock: + if self is other: + return True + if len(other) != len(self): + return False + if not isinstance(other, LRI): + return other == self + return super().__eq__(other) + + def __ne__(self, other): + return not (self == other) + + def __repr__(self): + cn = self.__class__.__name__ + val_map = super().__repr__() + return ('%s(max_size=%r, on_miss=%r, values=%s)' + % (cn, self.max_size, self.on_miss, val_map)) + + +class LRU(LRI): + """The ``LRU`` is :class:`dict` subtype implementation of the + *Least-Recently Used* caching strategy. + + Args: + max_size (int): Max number of items to cache. Defaults to ``128``. + values (iterable): Initial values for the cache. Defaults to ``None``. + on_miss (callable): a callable which accepts a single argument, the + key not present in the cache, and returns the value to be cached. + + >>> cap_cache = LRU(max_size=2) + >>> cap_cache['a'], cap_cache['b'] = 'A', 'B' + >>> from pprint import pprint as pp + >>> pp(dict(cap_cache)) + {'a': 'A', 'b': 'B'} + >>> [cap_cache['b'] for i in range(3)][0] + 'B' + >>> cap_cache['c'] = 'C' + >>> print(cap_cache.get('a')) + None + + This cache is also instrumented with statistics + collection. ``hit_count``, ``miss_count``, and ``soft_miss_count`` + are all integer members that can be used to introspect the + performance of the cache. ("Soft" misses are misses that did not + raise :exc:`KeyError`, e.g., ``LRU.get()`` or ``on_miss`` was used to + cache a default. + + >>> cap_cache.hit_count, cap_cache.miss_count, cap_cache.soft_miss_count + (3, 1, 1) + + Other than the size-limiting caching behavior and statistics, + ``LRU`` acts like its parent class, the built-in Python :class:`dict`. + """ + def __getitem__(self, key): + with self._lock: + try: + link = self._get_link_and_move_to_front_of_ll(key) + except KeyError: + self.miss_count += 1 + if not self.on_miss: + raise + ret = self[key] = self.on_miss(key) + return ret + + self.hit_count += 1 + return link[VALUE] + + +### Cached decorator +# Key-making technique adapted from Python 3.4's functools + +class _HashedKey(list): + """The _HashedKey guarantees that hash() will be called no more than once + per cached function invocation. + """ + __slots__ = 'hash_value' + + def __init__(self, key): + self[:] = key + self.hash_value = hash(tuple(key)) + + def __hash__(self): + return self.hash_value + + def __repr__(self): + return f'{self.__class__.__name__}({list.__repr__(self)})' + + +def make_cache_key(args, kwargs, typed=False, + kwarg_mark=_KWARG_MARK, + fasttypes=frozenset([int, str, frozenset, type(None)])): + """Make a generic key from a function's positional and keyword + arguments, suitable for use in caches. Arguments within *args* and + *kwargs* must be `hashable`_. If *typed* is ``True``, ``3`` and + ``3.0`` will be treated as separate keys. + + The key is constructed in a way that is flat as possible rather than + as a nested structure that would take more memory. + + If there is only a single argument and its data type is known to cache + its hash value, then that argument is returned without a wrapper. This + saves space and improves lookup speed. + + >>> tuple(make_cache_key(('a', 'b'), {'c': ('d')})) + ('a', 'b', _KWARG_MARK, ('c', 'd')) + + .. _hashable: https://docs.python.org/2/glossary.html#term-hashable + """ + + # key = [func_name] if func_name else [] + # key.extend(args) + key = list(args) + if kwargs: + sorted_items = sorted(kwargs.items()) + key.append(kwarg_mark) + key.extend(sorted_items) + if typed: + key.extend([type(v) for v in args]) + if kwargs: + key.extend([type(v) for k, v in sorted_items]) + elif len(key) == 1 and type(key[0]) in fasttypes: + return key[0] + return _HashedKey(key) + +# for backwards compatibility in case someone was importing it +_make_cache_key = make_cache_key + + +class CachedFunction: + """This type is used by :func:`cached`, below. Instances of this + class are used to wrap functions in caching logic. + """ + def __init__(self, func, cache, scoped=True, typed=False, key=None): + self.func = func + if callable(cache): + self.get_cache = cache + elif not (callable(getattr(cache, '__getitem__', None)) + and callable(getattr(cache, '__setitem__', None))): + raise TypeError('expected cache to be a dict-like object,' + ' or callable returning a dict-like object, not %r' + % cache) + else: + def _get_cache(): + return cache + self.get_cache = _get_cache + self.scoped = scoped + self.typed = typed + self.key_func = key or make_cache_key + + def __call__(self, *args, **kwargs): + cache = self.get_cache() + key = self.key_func(args, kwargs, typed=self.typed) + try: + ret = cache[key] + except KeyError: + ret = cache[key] = self.func(*args, **kwargs) + return ret + + def __repr__(self): + cn = self.__class__.__name__ + if self.typed or not self.scoped: + return ("%s(func=%r, scoped=%r, typed=%r)" + % (cn, self.func, self.scoped, self.typed)) + return f"{cn}(func={self.func!r})" + + +class CachedMethod: + """Similar to :class:`CachedFunction`, this type is used by + :func:`cachedmethod` to wrap methods in caching logic. + """ + def __init__(self, func, cache, scoped=True, typed=False, key=None): + self.func = func + self.__isabstractmethod__ = getattr(func, '__isabstractmethod__', False) + if isinstance(cache, str): + self.get_cache = attrgetter(cache) + elif callable(cache): + self.get_cache = cache + elif not (callable(getattr(cache, '__getitem__', None)) + and callable(getattr(cache, '__setitem__', None))): + raise TypeError('expected cache to be an attribute name,' + ' dict-like object, or callable returning' + ' a dict-like object, not %r' % cache) + else: + def _get_cache(obj): + return cache + self.get_cache = _get_cache + self.scoped = scoped + self.typed = typed + self.key_func = key or make_cache_key + self.bound_to = None + + def __get__(self, obj, objtype=None): + if obj is None: + return self + cls = self.__class__ + ret = cls(self.func, self.get_cache, typed=self.typed, + scoped=self.scoped, key=self.key_func) + ret.bound_to = obj + return ret + + def __call__(self, *args, **kwargs): + obj = args[0] if self.bound_to is None else self.bound_to + cache = self.get_cache(obj) + key_args = (self.bound_to, self.func) + args if self.scoped else args + key = self.key_func(key_args, kwargs, typed=self.typed) + try: + ret = cache[key] + except KeyError: + if self.bound_to is not None: + args = (self.bound_to,) + args + ret = cache[key] = self.func(*args, **kwargs) + return ret + + def __repr__(self): + cn = self.__class__.__name__ + args = (cn, self.func, self.scoped, self.typed) + if self.bound_to is not None: + args += (self.bound_to,) + return ('<%s func=%r scoped=%r typed=%r bound_to=%r>' % args) + return ("%s(func=%r, scoped=%r, typed=%r)" % args) + + +def cached(cache, scoped=True, typed=False, key=None): + """Cache any function with the cache object of your choosing. Note + that the function wrapped should take only `hashable`_ arguments. + + Args: + cache (Mapping): Any :class:`dict`-like object suitable for + use as a cache. Instances of the :class:`LRU` and + :class:`LRI` are good choices, but a plain :class:`dict` + can work in some cases, as well. This argument can also be + a callable which accepts no arguments and returns a mapping. + scoped (bool): Whether the function itself is part of the + cache key. ``True`` by default, different functions will + not read one another's cache entries, but can evict one + another's results. ``False`` can be useful for certain + shared cache use cases. More advanced behavior can be + produced through the *key* argument. + typed (bool): Whether to factor argument types into the cache + check. Default ``False``, setting to ``True`` causes the + cache keys for ``3`` and ``3.0`` to be considered unequal. + + >>> my_cache = LRU() + >>> @cached(my_cache) + ... def cached_lower(x): + ... return x.lower() + ... + >>> cached_lower("CaChInG's FuN AgAiN!") + "caching's fun again!" + >>> len(my_cache) + 1 + + .. _hashable: https://docs.python.org/2/glossary.html#term-hashable + + """ + def cached_func_decorator(func): + return CachedFunction(func, cache, scoped=scoped, typed=typed, key=key) + return cached_func_decorator + + +def cachedmethod(cache, scoped=True, typed=False, key=None): + """Similar to :func:`cached`, ``cachedmethod`` is used to cache + methods based on their arguments, using any :class:`dict`-like + *cache* object. + + Args: + cache (str/Mapping/callable): Can be the name of an attribute + on the instance, any Mapping/:class:`dict`-like object, or + a callable which returns a Mapping. + scoped (bool): Whether the method itself and the object it is + bound to are part of the cache keys. ``True`` by default, + different methods will not read one another's cache + results. ``False`` can be useful for certain shared cache + use cases. More advanced behavior can be produced through + the *key* arguments. + typed (bool): Whether to factor argument types into the cache + check. Default ``False``, setting to ``True`` causes the + cache keys for ``3`` and ``3.0`` to be considered unequal. + key (callable): A callable with a signature that matches + :func:`make_cache_key` that returns a tuple of hashable + values to be used as the key in the cache. + + >>> class Lowerer(object): + ... def __init__(self): + ... self.cache = LRI() + ... + ... @cachedmethod('cache') + ... def lower(self, text): + ... return text.lower() + ... + >>> lowerer = Lowerer() + >>> lowerer.lower('WOW WHO COULD GUESS CACHING COULD BE SO NEAT') + 'wow who could guess caching could be so neat' + >>> len(lowerer.cache) + 1 + + """ + def cached_method_decorator(func): + return CachedMethod(func, cache, scoped=scoped, typed=typed, key=key) + return cached_method_decorator + + +class cachedproperty: + """The ``cachedproperty`` is used similar to :class:`property`, except + that the wrapped method is only called once. This is commonly used + to implement lazy attributes. + + After the property has been accessed, the value is stored on the + instance itself, using the same name as the cachedproperty. This + allows the cache to be cleared with :func:`delattr`, or through + manipulating the object's ``__dict__``. + """ + def __init__(self, func): + self.__doc__ = getattr(func, '__doc__') + self.__isabstractmethod__ = getattr(func, '__isabstractmethod__', False) + self.func = func + + def __get__(self, obj, objtype=None): + if obj is None: + return self + value = obj.__dict__[self.func.__name__] = self.func(obj) + return value + + def __repr__(self): + cn = self.__class__.__name__ + return f'<{cn} func={self.func}>' + + +class ThresholdCounter: + """A **bounded** dict-like Mapping from keys to counts. The + ThresholdCounter automatically compacts after every (1 / + *threshold*) additions, maintaining exact counts for any keys + whose count represents at least a *threshold* ratio of the total + data. In other words, if a particular key is not present in the + ThresholdCounter, its count represents less than *threshold* of + the total data. + + >>> tc = ThresholdCounter(threshold=0.1) + >>> tc.add(1) + >>> tc.items() + [(1, 1)] + >>> tc.update([2] * 10) + >>> tc.get(1) + 0 + >>> tc.add(5) + >>> 5 in tc + True + >>> len(list(tc.elements())) + 11 + + As you can see above, the API is kept similar to + :class:`collections.Counter`. The most notable feature omissions + being that counted items cannot be set directly, uncounted, or + removed, as this would disrupt the math. + + Use the ThresholdCounter when you need best-effort long-lived + counts for dynamically-keyed data. Without a bounded datastructure + such as this one, the dynamic keys often represent a memory leak + and can impact application reliability. The ThresholdCounter's + item replacement strategy is fully deterministic and can be + thought of as *Amortized Least Relevant*. The absolute upper bound + of keys it will store is *(2/threshold)*, but realistically + *(1/threshold)* is expected for uniformly random datastreams, and + one or two orders of magnitude better for real-world data. + + This algorithm is an implementation of the Lossy Counting + algorithm described in "Approximate Frequency Counts over Data + Streams" by Manku & Motwani. Hat tip to Kurt Rose for discovery + and initial implementation. + + """ + # TODO: hit_count/miss_count? + def __init__(self, threshold=0.001): + if not 0 < threshold < 1: + raise ValueError('expected threshold between 0 and 1, not: %r' + % threshold) + + self.total = 0 + self._count_map = {} + self._threshold = threshold + self._thresh_count = int(1 / threshold) + self._cur_bucket = 1 + + @property + def threshold(self): + return self._threshold + + def add(self, key): + """Increment the count of *key* by 1, automatically adding it if it + does not exist. + + Cache compaction is triggered every *1/threshold* additions. + """ + self.total += 1 + try: + self._count_map[key][0] += 1 + except KeyError: + self._count_map[key] = [1, self._cur_bucket - 1] + + if self.total % self._thresh_count == 0: + self._count_map = {k: v for k, v in self._count_map.items() + if sum(v) > self._cur_bucket} + self._cur_bucket += 1 + return + + def elements(self): + """Return an iterator of all the common elements tracked by the + counter. Yields each key as many times as it has been seen. + """ + repeaters = itertools.starmap(itertools.repeat, self.iteritems()) + return itertools.chain.from_iterable(repeaters) + + def most_common(self, n=None): + """Get the top *n* keys and counts as tuples. If *n* is omitted, + returns all the pairs. + """ + if not n or n <= 0: + return [] + ret = sorted(self.iteritems(), key=lambda x: x[1], reverse=True) + if n is None or n >= len(ret): + return ret + return ret[:n] + + def get_common_count(self): + """Get the sum of counts for keys exceeding the configured data + threshold. + """ + return sum([count for count, _ in self._count_map.values()]) + + def get_uncommon_count(self): + """Get the sum of counts for keys that were culled because the + associated counts represented less than the configured + threshold. The long-tail counts. + """ + return self.total - self.get_common_count() + + def get_commonality(self): + """Get a float representation of the effective count accuracy. The + higher the number, the less uniform the keys being added, and + the higher accuracy and efficiency of the ThresholdCounter. + + If a stronger measure of data cardinality is required, + consider using hyperloglog. + """ + return float(self.get_common_count()) / self.total + + def __getitem__(self, key): + return self._count_map[key][0] + + def __len__(self): + return len(self._count_map) + + def __contains__(self, key): + return key in self._count_map + + def iterkeys(self): + return iter(self._count_map) + + def keys(self): + return list(self.iterkeys()) + + def itervalues(self): + count_map = self._count_map + for k in count_map: + yield count_map[k][0] + + def values(self): + return list(self.itervalues()) + + def iteritems(self): + count_map = self._count_map + for k in count_map: + yield (k, count_map[k][0]) + + def items(self): + return list(self.iteritems()) + + def get(self, key, default=0): + "Get count for *key*, defaulting to 0." + try: + return self[key] + except KeyError: + return default + + def update(self, iterable, **kwargs): + """Like dict.update() but add counts instead of replacing them, used + to add multiple items in one call. + + Source can be an iterable of keys to add, or a mapping of keys + to integer counts. + """ + if iterable is not None: + if callable(getattr(iterable, 'iteritems', None)): + for key, count in iterable.iteritems(): + for i in range(count): + self.add(key) + else: + for key in iterable: + self.add(key) + if kwargs: + self.update(kwargs) + + +class MinIDMap: + """ + Assigns arbitrary weakref-able objects the smallest possible unique + integer IDs, such that no two objects have the same ID at the same + time. + + Maps arbitrary hashable objects to IDs. + + Based on https://gist.github.com/kurtbrose/25b48114de216a5e55df + """ + def __init__(self): + self.mapping = weakref.WeakKeyDictionary() + self.ref_map = {} + self.free = [] + + def get(self, a): + try: + return self.mapping[a][0] # if object is mapped, return ID + except KeyError: + pass + + if self.free: # if there are any free IDs, use the smallest + nxt = heapq.heappop(self.free) + else: # if there are no free numbers, use the next highest ID + nxt = len(self.mapping) + ref = weakref.ref(a, self._clean) + self.mapping[a] = (nxt, ref) + self.ref_map[ref] = nxt + return nxt + + def drop(self, a): + freed, ref = self.mapping[a] + del self.mapping[a] + del self.ref_map[ref] + heapq.heappush(self.free, freed) + + def _clean(self, ref): + print(self.ref_map[ref]) + heapq.heappush(self.free, self.ref_map[ref]) + del self.ref_map[ref] + + def __contains__(self, a): + return a in self.mapping + + def __iter__(self): + return iter(self.mapping) + + def __len__(self): + return self.mapping.__len__() + + def iteritems(self): + return iter((k, self.mapping[k][0]) for k in iter(self.mapping)) + + +# end cacheutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/debugutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/debugutils.py new file mode 100644 index 0000000000000000000000000000000000000000..16d18d4b9078d8864477cbe445d142addfae7134 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/debugutils.py @@ -0,0 +1,292 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" +A small set of utilities useful for debugging misbehaving +applications. Currently this focuses on ways to use :mod:`pdb`, the +built-in Python debugger. +""" + +import sys +import time +from reprlib import Repr + +try: + from .typeutils import make_sentinel + _UNSET = make_sentinel(var_name='_UNSET') +except ImportError: + _UNSET = object() + +__all__ = ['pdb_on_signal', 'pdb_on_exception', 'wrap_trace'] + + +def pdb_on_signal(signalnum=None): + """Installs a signal handler for *signalnum*, which defaults to + ``SIGINT``, or keyboard interrupt/ctrl-c. This signal handler + launches a :mod:`pdb` breakpoint. Results vary in concurrent + systems, but this technique can be useful for debugging infinite + loops, or easily getting into deep call stacks. + + Args: + signalnum (int): The signal number of the signal to handle + with pdb. Defaults to :mod:`signal.SIGINT`, see + :mod:`signal` for more information. + """ + import pdb + import signal + if not signalnum: + signalnum = signal.SIGINT + + old_handler = signal.getsignal(signalnum) + + def pdb_int_handler(sig, frame): + signal.signal(signalnum, old_handler) + pdb.set_trace() + pdb_on_signal(signalnum) # use 'u' to find your code and 'h' for help + + signal.signal(signalnum, pdb_int_handler) + return + + +def pdb_on_exception(limit=100): + """Installs a handler which, instead of exiting, attaches a + post-mortem pdb console whenever an unhandled exception is + encountered. + + Args: + limit (int): the max number of stack frames to display when + printing the traceback + + A similar effect can be achieved from the command-line using the + following command:: + + python -m pdb your_code.py + + But ``pdb_on_exception`` allows you to do this conditionally and within + your application. To restore default behavior, just do:: + + sys.excepthook = sys.__excepthook__ + """ + import pdb + import sys + import traceback + + def pdb_excepthook(exc_type, exc_val, exc_tb): + traceback.print_tb(exc_tb, limit=limit) + pdb.post_mortem(exc_tb) + + sys.excepthook = pdb_excepthook + return + +_repr_obj = Repr() +_repr_obj.maxstring = 50 +_repr_obj.maxother = 50 +brief_repr = _repr_obj.repr + + +# events: call, return, get, set, del, raise +def trace_print_hook(event, label, obj, attr_name, + args=(), kwargs={}, result=_UNSET): + fargs = (event.ljust(6), time.time(), label.rjust(10), + obj.__class__.__name__, attr_name) + if event == 'get': + tmpl = '%s %s - %s - %s.%s -> %s' + fargs += (brief_repr(result),) + elif event == 'set': + tmpl = '%s %s - %s - %s.%s = %s' + fargs += (brief_repr(args[0]),) + elif event == 'del': + tmpl = '%s %s - %s - %s.%s' + else: # call/return/raise + tmpl = '%s %s - %s - %s.%s(%s)' + fargs += (', '.join([brief_repr(a) for a in args]),) + if kwargs: + tmpl = '%s %s - %s - %s.%s(%s, %s)' + fargs += (', '.join([f'{k}={brief_repr(v)}' + for k, v in kwargs.items()]),) + if result is not _UNSET: + tmpl += ' -> %s' + fargs += (brief_repr(result),) + print(tmpl % fargs) + return + + +def wrap_trace(obj, hook=trace_print_hook, + which=None, events=None, label=None): + """Monitor an object for interactions. Whenever code calls a method, + gets an attribute, or sets an attribute, an event is called. By + default the trace output is printed, but a custom tracing *hook* + can be passed. + + Args: + obj (object): New- or old-style object to be traced. Built-in + objects like lists and dicts also supported. + hook (callable): A function called once for every event. See + below for details. + which (str): One or more attribute names to trace, or a + function accepting attribute name and value, and returning + True/False. + events (str): One or more kinds of events to call *hook* + on. Expected values are ``['get', 'set', 'del', 'call', + 'raise', 'return']``. Defaults to all events. + label (str): A name to associate with the traced object + Defaults to hexadecimal memory address, similar to repr. + + The object returned is not the same object as the one passed + in. It will not pass identity checks. However, it will pass + :func:`isinstance` checks, as it is a new instance of a new + subtype of the object passed. + + """ + # other actions: pdb.set_trace, print, aggregate, aggregate_return + # (like aggregate but with the return value) + + # TODO: test classmethod/staticmethod/property + # TODO: wrap __dict__ for old-style classes? + + if isinstance(which, str): + which_func = lambda attr_name, attr_val: attr_name == which + elif callable(getattr(which, '__contains__', None)): + which_func = lambda attr_name, attr_val: attr_name in which + elif which is None or callable(which): + which_func = which + else: + raise TypeError('expected attr name(s) or callable, not: %r' % which) + + label = label or hex(id(obj)) + + if isinstance(events, str): + events = [events] + do_get = not events or 'get' in events + do_set = not events or 'set' in events + do_del = not events or 'del' in events + do_call = not events or 'call' in events + do_raise = not events or 'raise' in events + do_return = not events or 'return' in events + + def wrap_method(attr_name, func, _hook=hook, _label=label): + def wrapped(*a, **kw): + a = a[1:] + if do_call: + hook(event='call', label=_label, obj=obj, + attr_name=attr_name, args=a, kwargs=kw) + if do_raise: + try: + ret = func(*a, **kw) + except Exception: + if not hook(event='raise', label=_label, obj=obj, + attr_name=attr_name, args=a, kwargs=kw, + result=sys.exc_info()): + raise + else: + ret = func(*a, **kw) + if do_return: + hook(event='return', label=_label, obj=obj, + attr_name=attr_name, args=a, kwargs=kw, result=ret) + return ret + + wrapped.__name__ = func.__name__ + wrapped.__doc__ = func.__doc__ + try: + wrapped.__module__ = func.__module__ + except Exception: + pass + try: + if func.__dict__: + wrapped.__dict__.update(func.__dict__) + except Exception: + pass + return wrapped + + def __getattribute__(self, attr_name): + ret = type(obj).__getattribute__(obj, attr_name) + if callable(ret): # wrap any bound methods + ret = type(obj).__getattribute__(self, attr_name) + if do_get: + hook('get', label, obj, attr_name, (), {}, result=ret) + return ret + + def __setattr__(self, attr_name, value): + type(obj).__setattr__(obj, attr_name, value) + if do_set: + hook('set', label, obj, attr_name, (value,), {}) + return + + def __delattr__(self, attr_name): + type(obj).__delattr__(obj, attr_name) + if do_del: + hook('del', label, obj, attr_name, (), {}) + return + + attrs = {} + for attr_name in dir(obj): + try: + attr_val = getattr(obj, attr_name) + except Exception: + continue + + if not callable(attr_val) or attr_name in ('__new__',): + continue + elif which_func and not which_func(attr_name, attr_val): + continue + + if attr_name == '__getattribute__': + wrapped_method = __getattribute__ + elif attr_name == '__setattr__': + wrapped_method = __setattr__ + elif attr_name == '__delattr__': + wrapped_method = __delattr__ + else: + wrapped_method = wrap_method(attr_name, attr_val) + attrs[attr_name] = wrapped_method + + cls_name = obj.__class__.__name__ + if cls_name == cls_name.lower(): + type_name = 'traced_' + cls_name + else: + type_name = 'Traced' + cls_name + + if hasattr(obj, '__mro__'): + bases = (obj.__class__,) + else: + # need new-style class for even basic wrapping of callables to + # work. getattribute won't work for old-style classes of course. + bases = (obj.__class__, object) + + trace_type = type(type_name, bases, attrs) + for cls in trace_type.__mro__: + try: + return cls.__new__(trace_type) + except Exception: + pass + raise TypeError('unable to wrap_trace %r instance %r' + % (obj.__class__, obj)) + + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/deprutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/deprutils.py new file mode 100644 index 0000000000000000000000000000000000000000..6c56736f98156e3b1aa63d867f23f400601bab8a --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/deprutils.py @@ -0,0 +1,63 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import sys +from types import ModuleType +from warnings import warn + +# todo: only warn once + + +class DeprecatableModule(ModuleType): + def __init__(self, module): + name = module.__name__ + super().__init__(name=name) + self.__dict__.update(module.__dict__) + + def __getattribute__(self, name): + get_attribute = super().__getattribute__ + try: + depros = get_attribute('_deprecated_members') + except AttributeError: + self._deprecated_members = depros = {} + ret = get_attribute(name) + message = depros.get(name) + if message is not None: + warn(message, DeprecationWarning, stacklevel=2) + return ret + + +def deprecate_module_member(mod_name, name, message): + module = sys.modules[mod_name] + if not isinstance(module, DeprecatableModule): + sys.modules[mod_name] = module = DeprecatableModule(module) + module._deprecated_members[name] = message + return diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/dictutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/dictutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f913f29f61fc4e1d2f5f5ef6dc32936817ab33f2 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/dictutils.py @@ -0,0 +1,1120 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python has a very powerful mapping type at its core: the :class:`dict` +type. While versatile and featureful, the :class:`dict` prioritizes +simplicity and performance. As a result, it does not retain the order +of item insertion [1]_, nor does it store multiple values per key. It +is a fast, unordered 1:1 mapping. + +The :class:`OrderedMultiDict` contrasts to the built-in :class:`dict`, +as a relatively maximalist, ordered 1:n subtype of +:class:`dict`. Virtually every feature of :class:`dict` has been +retooled to be intuitive in the face of this added +complexity. Additional methods have been added, such as +:class:`collections.Counter`-like functionality. + +A prime advantage of the :class:`OrderedMultiDict` (OMD) is its +non-destructive nature. Data can be added to an :class:`OMD` without being +rearranged or overwritten. The property can allow the developer to +work more freely with the data, as well as make more assumptions about +where input data will end up in the output, all without any extra +work. + +One great example of this is the :meth:`OMD.inverted()` method, which +returns a new OMD with the values as keys and the keys as values. All +the data and the respective order is still represented in the inverted +form, all from an operation which would be outright wrong and reckless +with a built-in :class:`dict` or :class:`collections.OrderedDict`. + +The OMD has been performance tuned to be suitable for a wide range of +usages, including as a basic unordered MultiDict. Special +thanks to `Mark Williams`_ for all his help. + +.. [1] As of 2015, `basic dicts on PyPy are ordered + `_, + and as of December 2017, `basic dicts in CPython 3 are now ordered + `_, as + well. +.. _Mark Williams: https://github.com/markrwilliams + +""" + +from collections.abc import KeysView, ValuesView, ItemsView +from itertools import zip_longest + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + + +PREV, NEXT, KEY, VALUE, SPREV, SNEXT = range(6) + + +__all__ = ['MultiDict', 'OMD', 'OrderedMultiDict', 'OneToOne', 'ManyToMany', 'subdict', 'FrozenDict'] + + +class OrderedMultiDict(dict): + """A MultiDict is a dictionary that can have multiple values per key + and the OrderedMultiDict (OMD) is a MultiDict that retains + original insertion order. Common use cases include: + + * handling query strings parsed from URLs + * inverting a dictionary to create a reverse index (values to keys) + * stacking data from multiple dictionaries in a non-destructive way + + The OrderedMultiDict constructor is identical to the built-in + :class:`dict`, and overall the API constitutes an intuitive + superset of the built-in type: + + >>> omd = OrderedMultiDict() + >>> omd['a'] = 1 + >>> omd['b'] = 2 + >>> omd.add('a', 3) + >>> omd.get('a') + 3 + >>> omd.getlist('a') + [1, 3] + + Some non-:class:`dict`-like behaviors also make an appearance, + such as support for :func:`reversed`: + + >>> list(reversed(omd)) + ['b', 'a'] + + Note that unlike some other MultiDicts, this OMD gives precedence + to the most recent value added. ``omd['a']`` refers to ``3``, not + ``1``. + + >>> omd + OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> omd.poplast('a') + 3 + >>> omd + OrderedMultiDict([('a', 1), ('b', 2)]) + >>> omd.pop('a') + 1 + >>> omd + OrderedMultiDict([('b', 2)]) + + If you want a safe-to-modify or flat dictionary, use + :meth:`OrderedMultiDict.todict()`. + + >>> from pprint import pprint as pp # preserve printed ordering + >>> omd = OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> pp(omd.todict()) + {'a': 3, 'b': 2} + >>> pp(omd.todict(multi=True)) + {'a': [1, 3], 'b': [2]} + + With ``multi=False``, items appear with the keys in to original + insertion order, alongside the most-recently inserted value for + that key. + + >>> OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]).items(multi=False) + [('a', 3), ('b', 2)] + + .. warning:: + + ``dict(omd)`` changed behavior `in Python 3.7 + `_ due to changes made to + support the transition from :class:`collections.OrderedDict` to + the built-in dictionary being ordered. Before 3.7, the result + would be a new dictionary, with values that were lists, similar + to ``omd.todict(multi=True)`` (but only shallow-copy; the lists + were direct references to OMD internal structures). From 3.7 + onward, the values became singular, like + ``omd.todict(multi=False)``. For reliable cross-version + behavior, just use :meth:`~OrderedMultiDict.todict()`. + + """ + def __new__(cls, *a, **kw): + ret = super().__new__(cls) + ret._clear_ll() + return ret + + def __init__(self, *args, **kwargs): + if len(args) > 1: + raise TypeError('%s expected at most 1 argument, got %s' + % (self.__class__.__name__, len(args))) + super().__init__() + + if args: + self.update_extend(args[0]) + if kwargs: + self.update(kwargs) + + def __getstate__(self): + return list(self.iteritems(multi=True)) + + def __setstate__(self, state): + self.clear() + self.update_extend(state) + + def _clear_ll(self): + try: + _map = self._map + except AttributeError: + _map = self._map = {} + self.root = [] + _map.clear() + self.root[:] = [self.root, self.root, None] + + def _insert(self, k, v): + root = self.root + cells = self._map.setdefault(k, []) + last = root[PREV] + cell = [last, root, k, v] + last[NEXT] = root[PREV] = cell + cells.append(cell) + + def add(self, k, v): + """Add a single value *v* under a key *k*. Existing values under *k* + are preserved. + """ + values = super().setdefault(k, []) + self._insert(k, v) + values.append(v) + + def addlist(self, k, v): + """Add an iterable of values underneath a specific key, preserving + any values already under that key. + + >>> omd = OrderedMultiDict([('a', -1)]) + >>> omd.addlist('a', range(3)) + >>> omd + OrderedMultiDict([('a', -1), ('a', 0), ('a', 1), ('a', 2)]) + + Called ``addlist`` for consistency with :meth:`getlist`, but + tuples and other sequences and iterables work. + """ + if not v: + return + self_insert = self._insert + values = super().setdefault(k, []) + for subv in v: + self_insert(k, subv) + values.extend(v) + + def get(self, k, default=None): + """Return the value for key *k* if present in the dictionary, else + *default*. If *default* is not given, ``None`` is returned. + This method never raises a :exc:`KeyError`. + + To get all values under a key, use :meth:`OrderedMultiDict.getlist`. + """ + return super().get(k, [default])[-1] + + def getlist(self, k, default=_MISSING): + """Get all values for key *k* as a list, if *k* is in the + dictionary, else *default*. The list returned is a copy and + can be safely mutated. If *default* is not given, an empty + :class:`list` is returned. + """ + try: + return super().__getitem__(k)[:] + except KeyError: + if default is _MISSING: + return [] + return default + + def clear(self): + "Empty the dictionary." + super().clear() + self._clear_ll() + + def setdefault(self, k, default=_MISSING): + """If key *k* is in the dictionary, return its value. If not, insert + *k* with a value of *default* and return *default*. *default* + defaults to ``None``. See :meth:`dict.setdefault` for more + information. + """ + if not super().__contains__(k): + self[k] = None if default is _MISSING else default + return self[k] + + def copy(self): + "Return a shallow copy of the dictionary." + return self.__class__(self.iteritems(multi=True)) + + @classmethod + def fromkeys(cls, keys, default=None): + """Create a dictionary from a list of keys, with all the values + set to *default*, or ``None`` if *default* is not set. + """ + return cls([(k, default) for k in keys]) + + def update(self, E, **F): + """Add items from a dictionary or iterable (and/or keyword arguments), + overwriting values under an existing key. See + :meth:`dict.update` for more details. + """ + # E and F are throwback names to the dict() __doc__ + if E is self: + return + self_add = self.add + if isinstance(E, OrderedMultiDict): + for k in E: + if k in self: + del self[k] + for k, v in E.iteritems(multi=True): + self_add(k, v) + elif callable(getattr(E, 'keys', None)): + for k in E.keys(): + self[k] = E[k] + else: + seen = set() + seen_add = seen.add + for k, v in E: + if k not in seen and k in self: + del self[k] + seen_add(k) + self_add(k, v) + for k in F: + self[k] = F[k] + return + + def update_extend(self, E, **F): + """Add items from a dictionary, iterable, and/or keyword + arguments without overwriting existing items present in the + dictionary. Like :meth:`update`, but adds to existing keys + instead of overwriting them. + """ + if E is self: + iterator = iter(E.items()) + elif isinstance(E, OrderedMultiDict): + iterator = E.iteritems(multi=True) + elif hasattr(E, 'keys'): + iterator = ((k, E[k]) for k in E.keys()) + else: + iterator = E + + self_add = self.add + for k, v in iterator: + self_add(k, v) + + def __setitem__(self, k, v): + if super().__contains__(k): + self._remove_all(k) + self._insert(k, v) + super().__setitem__(k, [v]) + + def __getitem__(self, k): + return super().__getitem__(k)[-1] + + def __delitem__(self, k): + super().__delitem__(k) + self._remove_all(k) + + def __eq__(self, other): + if self is other: + return True + try: + if len(other) != len(self): + return False + except TypeError: + return False + if isinstance(other, OrderedMultiDict): + selfi = self.iteritems(multi=True) + otheri = other.iteritems(multi=True) + zipped_items = zip_longest(selfi, otheri, fillvalue=(None, None)) + for (selfk, selfv), (otherk, otherv) in zipped_items: + if selfk != otherk or selfv != otherv: + return False + if not(next(selfi, _MISSING) is _MISSING + and next(otheri, _MISSING) is _MISSING): + # leftovers (TODO: watch for StopIteration?) + return False + return True + elif hasattr(other, 'keys'): + for selfk in self: + try: + other[selfk] == self[selfk] + except KeyError: + return False + return True + return False + + def __ne__(self, other): + return not (self == other) + + def __ior__(self, other): + self.update(other) + return self + + def pop(self, k, default=_MISSING): + """Remove all values under key *k*, returning the most-recently + inserted value. Raises :exc:`KeyError` if the key is not + present and no *default* is provided. + """ + try: + return self.popall(k)[-1] + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + + def popall(self, k, default=_MISSING): + """Remove all values under key *k*, returning them in the form of + a list. Raises :exc:`KeyError` if the key is not present and no + *default* is provided. + """ + super_self = super() + if super_self.__contains__(k): + self._remove_all(k) + if default is _MISSING: + return super_self.pop(k) + return super_self.pop(k, default) + + def poplast(self, k=_MISSING, default=_MISSING): + """Remove and return the most-recently inserted value under the key + *k*, or the most-recently inserted key if *k* is not + provided. If no values remain under *k*, it will be removed + from the OMD. Raises :exc:`KeyError` if *k* is not present in + the dictionary, or the dictionary is empty. + """ + if k is _MISSING: + if self: + k = self.root[PREV][KEY] + else: + if default is _MISSING: + raise KeyError('empty %r' % type(self)) + return default + try: + self._remove(k) + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + values = super().__getitem__(k) + v = values.pop() + if not values: + super().__delitem__(k) + return v + + def _remove(self, k): + values = self._map[k] + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + if not values: + del self._map[k] + + def _remove_all(self, k): + values = self._map[k] + while values: + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + del self._map[k] + + def iteritems(self, multi=False): + """Iterate over the OMD's items in insertion order. By default, + yields only the most-recently inserted value for each key. Set + *multi* to ``True`` to get all inserted items. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY], curr[VALUE] + curr = curr[NEXT] + else: + for key in self.iterkeys(): + yield key, self[key] + + def iterkeys(self, multi=False): + """Iterate over the OMD's keys in insertion order. By default, yields + each key once, according to the most recent insertion. Set + *multi* to ``True`` to get all keys, including duplicates, in + insertion order. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY] + curr = curr[NEXT] + else: + yielded = set() + yielded_add = yielded.add + while curr is not root: + k = curr[KEY] + if k not in yielded: + yielded_add(k) + yield k + curr = curr[NEXT] + + def itervalues(self, multi=False): + """Iterate over the OMD's values in insertion order. By default, + yields the most-recently inserted value per unique key. Set + *multi* to ``True`` to get all values according to insertion + order. + """ + for k, v in self.iteritems(multi=multi): + yield v + + def todict(self, multi=False): + """Gets a basic :class:`dict` of the items in this dictionary. Keys + are the same as the OMD, values are the most recently inserted + values for each key. + + Setting the *multi* arg to ``True`` is yields the same + result as calling :class:`dict` on the OMD, except that all the + value lists are copies that can be safely mutated. + """ + if multi: + return {k: self.getlist(k) for k in self} + return {k: self[k] for k in self} + + def sorted(self, key=None, reverse=False): + """Similar to the built-in :func:`sorted`, except this method returns + a new :class:`OrderedMultiDict` sorted by the provided key + function, optionally reversed. + + Args: + key (callable): A callable to determine the sort key of + each element. The callable should expect an **item** + (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict(zip(range(3), range(3))) + >>> omd.sorted(reverse=True) + OrderedMultiDict([(2, 2), (1, 1), (0, 0)]) + + Note that the key function receives an **item** (key-value + tuple), so the recommended signature looks like: + + >>> omd = OrderedMultiDict(zip('hello', 'world')) + >>> omd.sorted(key=lambda i: i[1]) # i[0] is the key, i[1] is the val + OrderedMultiDict([('o', 'd'), ('l', 'l'), ('e', 'o'), ('l', 'r'), ('h', 'w')]) + """ + cls = self.__class__ + return cls(sorted(self.iteritems(multi=True), key=key, reverse=reverse)) + + def sortedvalues(self, key=None, reverse=False): + """Returns a copy of the :class:`OrderedMultiDict` with the same keys + in the same order as the original OMD, but the values within + each keyspace have been sorted according to *key* and + *reverse*. + + Args: + key (callable): A single-argument callable to determine + the sort key of each element. The callable should expect + an **item** (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict() + >>> omd.addlist('even', [6, 2]) + >>> omd.addlist('odd', [1, 5]) + >>> omd.add('even', 4) + >>> omd.add('odd', 3) + >>> somd = omd.sortedvalues() + >>> somd.getlist('even') + [2, 4, 6] + >>> somd.keys(multi=True) == omd.keys(multi=True) + True + >>> omd == somd + False + >>> somd + OrderedMultiDict([('even', 2), ('even', 4), ('odd', 1), ('odd', 3), ('even', 6), ('odd', 5)]) + + As demonstrated above, contents and key order are + retained. Only value order changes. + """ + try: + superself_iteritems = super().iteritems() + except AttributeError: + superself_iteritems = super().items() + # (not reverse) because they pop off in reverse order for reinsertion + sorted_val_map = {k: sorted(v, key=key, reverse=(not reverse)) + for k, v in superself_iteritems} + ret = self.__class__() + for k in self.iterkeys(multi=True): + ret.add(k, sorted_val_map[k].pop()) + return ret + + def inverted(self): + """Returns a new :class:`OrderedMultiDict` with values and keys + swapped, like creating dictionary transposition or reverse + index. Insertion order is retained and all keys and values + are represented in the output. + + >>> omd = OMD([(0, 2), (1, 2)]) + >>> omd.inverted().getlist(2) + [0, 1] + + Inverting twice yields a copy of the original: + + >>> omd.inverted().inverted() + OrderedMultiDict([(0, 2), (1, 2)]) + """ + return self.__class__((v, k) for k, v in self.iteritems(multi=True)) + + def counts(self): + """Returns a mapping from key to number of values inserted under that + key. Like :py:class:`collections.Counter`, but returns a new + :class:`OrderedMultiDict`. + """ + # Returns an OMD because Counter/OrderedDict may not be + # available, and neither Counter nor dict maintain order. + super_getitem = super().__getitem__ + return self.__class__((k, len(super_getitem(k))) for k in self) + + def keys(self, multi=False): + """Returns a list containing the output of :meth:`iterkeys`. See + that method's docs for more details. + """ + return list(self.iterkeys(multi=multi)) + + def values(self, multi=False): + """Returns a list containing the output of :meth:`itervalues`. See + that method's docs for more details. + """ + return list(self.itervalues(multi=multi)) + + def items(self, multi=False): + """Returns a list containing the output of :meth:`iteritems`. See + that method's docs for more details. + """ + return list(self.iteritems(multi=multi)) + + def __iter__(self): + return self.iterkeys() + + def __reversed__(self): + root = self.root + curr = root[PREV] + lengths = {} + lengths_sd = lengths.setdefault + get_values = super().__getitem__ + while curr is not root: + k = curr[KEY] + vals = get_values(k) + if lengths_sd(k, 1) == len(vals): + yield k + lengths[k] += 1 + curr = curr[PREV] + + def __repr__(self): + cn = self.__class__.__name__ + kvs = ', '.join([repr((k, v)) for k, v in self.iteritems(multi=True)]) + return f'{cn}([{kvs}])' + + def viewkeys(self): + "OMD.viewkeys() -> a set-like object providing a view on OMD's keys" + return KeysView(self) + + def viewvalues(self): + "OMD.viewvalues() -> an object providing a view on OMD's values" + return ValuesView(self) + + def viewitems(self): + "OMD.viewitems() -> a set-like object providing a view on OMD's items" + return ItemsView(self) + + +# A couple of convenient aliases +OMD = OrderedMultiDict +MultiDict = OrderedMultiDict + + +class FastIterOrderedMultiDict(OrderedMultiDict): + """An OrderedMultiDict backed by a skip list. Iteration over keys + is faster and uses constant memory but adding duplicate key-value + pairs is slower. Brainchild of Mark Williams. + """ + def _clear_ll(self): + # TODO: always reset objects? (i.e., no else block below) + try: + _map = self._map + except AttributeError: + _map = self._map = {} + self.root = [] + _map.clear() + self.root[:] = [self.root, self.root, + None, None, + self.root, self.root] + + def _insert(self, k, v): + root = self.root + empty = [] + cells = self._map.setdefault(k, empty) + last = root[PREV] + + if cells is empty: + cell = [last, root, + k, v, + last, root] + # was the last one skipped? + if last[SPREV][SNEXT] is root: + last[SPREV][SNEXT] = cell + last[NEXT] = last[SNEXT] = root[PREV] = root[SPREV] = cell + cells.append(cell) + else: + # if the previous was skipped, go back to the cell that + # skipped it + sprev = last[SPREV] if (last[SPREV][SNEXT] is not last) else last + cell = [last, root, + k, v, + sprev, root] + # skip me + last[SNEXT] = root + last[NEXT] = root[PREV] = root[SPREV] = cell + cells.append(cell) + + def _remove(self, k): + cells = self._map[k] + cell = cells.pop() + if not cells: + del self._map[k] + cell[PREV][SNEXT] = cell[SNEXT] + + if cell[PREV][SPREV][SNEXT] is cell: + cell[PREV][SPREV][SNEXT] = cell[NEXT] + elif cell[SNEXT] is cell[NEXT]: + cell[SPREV][SNEXT], cell[SNEXT][SPREV] = cell[SNEXT], cell[SPREV] + + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + + def _remove_all(self, k): + cells = self._map.pop(k) + while cells: + cell = cells.pop() + if cell[PREV][SPREV][SNEXT] is cell: + cell[PREV][SPREV][SNEXT] = cell[NEXT] + elif cell[SNEXT] is cell[NEXT]: + cell[SPREV][SNEXT], cell[SNEXT][SPREV] = cell[SNEXT], cell[SPREV] + + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + cell[PREV][SNEXT] = cell[SNEXT] + + def iteritems(self, multi=False): + next_link = NEXT if multi else SNEXT + root = self.root + curr = root[next_link] + while curr is not root: + yield curr[KEY], curr[VALUE] + curr = curr[next_link] + + def iterkeys(self, multi=False): + next_link = NEXT if multi else SNEXT + root = self.root + curr = root[next_link] + while curr is not root: + yield curr[KEY] + curr = curr[next_link] + + def __reversed__(self): + root = self.root + curr = root[PREV] + while curr is not root: + if curr[SPREV][SNEXT] is not curr: + curr = curr[SPREV] + if curr is root: + break + yield curr[KEY] + curr = curr[PREV] + + +_OTO_INV_MARKER = object() +_OTO_UNIQUE_MARKER = object() + + +class OneToOne(dict): + """Implements a one-to-one mapping dictionary. In addition to + inheriting from and behaving exactly like the builtin + :class:`dict`, all values are automatically added as keys on a + reverse mapping, available as the `inv` attribute. This + arrangement keeps key and value namespaces distinct. + + Basic operations are intuitive: + + >>> oto = OneToOne({'a': 1, 'b': 2}) + >>> print(oto['a']) + 1 + >>> print(oto.inv[1]) + a + >>> len(oto) + 2 + + Overwrites happens in both directions: + + >>> oto.inv[1] = 'c' + >>> print(oto.get('a')) + None + >>> len(oto) + 2 + + For a very similar project, with even more one-to-one + functionality, check out `bidict `_. + """ + __slots__ = ('inv',) + + def __init__(self, *a, **kw): + raise_on_dupe = False + if a: + if a[0] is _OTO_INV_MARKER: + self.inv = a[1] + dict.__init__(self, [(v, k) for k, v in self.inv.items()]) + return + elif a[0] is _OTO_UNIQUE_MARKER: + a, raise_on_dupe = a[1:], True + + dict.__init__(self, *a, **kw) + self.inv = self.__class__(_OTO_INV_MARKER, self) + + if len(self) == len(self.inv): + # if lengths match, that means everything's unique + return + + if not raise_on_dupe: + dict.clear(self) + dict.update(self, [(v, k) for k, v in self.inv.items()]) + return + + # generate an error message if the values aren't 1:1 + + val_multidict = {} + for k, v in self.items(): + val_multidict.setdefault(v, []).append(k) + + dupes = {v: k_list for v, k_list in + val_multidict.items() if len(k_list) > 1} + + raise ValueError('expected unique values, got multiple keys for' + ' the following values: %r' % dupes) + + @classmethod + def unique(cls, *a, **kw): + """This alternate constructor for OneToOne will raise an exception + when input values overlap. For instance: + + >>> OneToOne.unique({'a': 1, 'b': 1}) + Traceback (most recent call last): + ... + ValueError: expected unique values, got multiple keys for the following values: ... + + This even works across inputs: + + >>> a_dict = {'a': 2} + >>> OneToOne.unique(a_dict, b=2) + Traceback (most recent call last): + ... + ValueError: expected unique values, got multiple keys for the following values: ... + """ + return cls(_OTO_UNIQUE_MARKER, *a, **kw) + + def __setitem__(self, key, val): + hash(val) # ensure val is a valid key + if key in self: + dict.__delitem__(self.inv, self[key]) + if val in self.inv: + del self.inv[val] + dict.__setitem__(self, key, val) + dict.__setitem__(self.inv, val, key) + + def __delitem__(self, key): + dict.__delitem__(self.inv, self[key]) + dict.__delitem__(self, key) + + def clear(self): + dict.clear(self) + dict.clear(self.inv) + + def copy(self): + return self.__class__(self) + + def pop(self, key, default=_MISSING): + if key in self: + dict.__delitem__(self.inv, self[key]) + return dict.pop(self, key) + if default is not _MISSING: + return default + raise KeyError() + + def popitem(self): + key, val = dict.popitem(self) + dict.__delitem__(self.inv, val) + return key, val + + def setdefault(self, key, default=None): + if key not in self: + self[key] = default + return self[key] + + def update(self, dict_or_iterable, **kw): + keys_vals = [] + if isinstance(dict_or_iterable, dict): + for val in dict_or_iterable.values(): + hash(val) + keys_vals = list(dict_or_iterable.items()) + else: + for key, val in dict_or_iterable: + hash(key) + hash(val) + keys_vals = list(dict_or_iterable) + for val in kw.values(): + hash(val) + keys_vals.extend(kw.items()) + for key, val in keys_vals: + self[key] = val + + def __repr__(self): + cn = self.__class__.__name__ + dict_repr = dict.__repr__(self) + return f"{cn}({dict_repr})" + + +# marker for the secret handshake used internally to set up the invert ManyToMany +_PAIRING = object() + + +class ManyToMany: + """ + a dict-like entity that represents a many-to-many relationship + between two groups of objects + + behaves like a dict-of-tuples; also has .inv which is kept + up to date which is a dict-of-tuples in the other direction + + also, can be used as a directed graph among hashable python objects + """ + def __init__(self, items=None): + self.data = {} + if type(items) is tuple and items and items[0] is _PAIRING: + self.inv = items[1] + else: + self.inv = self.__class__((_PAIRING, self)) + if items: + self.update(items) + return + + def get(self, key, default=frozenset()): + try: + return self[key] + except KeyError: + return default + + def __getitem__(self, key): + return frozenset(self.data[key]) + + def __setitem__(self, key, vals): + vals = set(vals) + if key in self: + to_remove = self.data[key] - vals + vals -= self.data[key] + for val in to_remove: + self.remove(key, val) + for val in vals: + self.add(key, val) + + def __delitem__(self, key): + for val in self.data.pop(key): + self.inv.data[val].remove(key) + if not self.inv.data[val]: + del self.inv.data[val] + + def update(self, iterable): + """given an iterable of (key, val), add them all""" + if type(iterable) is type(self): + other = iterable + for k in other.data: + if k not in self.data: + self.data[k] = other.data[k] + else: + self.data[k].update(other.data[k]) + for k in other.inv.data: + if k not in self.inv.data: + self.inv.data[k] = other.inv.data[k] + else: + self.inv.data[k].update(other.inv.data[k]) + elif callable(getattr(iterable, 'keys', None)): + for k in iterable.keys(): + self.add(k, iterable[k]) + else: + for key, val in iterable: + self.add(key, val) + return + + def add(self, key, val): + if key not in self.data: + self.data[key] = set() + self.data[key].add(val) + if val not in self.inv.data: + self.inv.data[val] = set() + self.inv.data[val].add(key) + + def remove(self, key, val): + self.data[key].remove(val) + if not self.data[key]: + del self.data[key] + self.inv.data[val].remove(key) + if not self.inv.data[val]: + del self.inv.data[val] + + def replace(self, key, newkey): + """ + replace instances of key by newkey + """ + if key not in self.data: + return + self.data[newkey] = fwdset = self.data.pop(key) + for val in fwdset: + revset = self.inv.data[val] + revset.remove(key) + revset.add(newkey) + + def iteritems(self): + for key in self.data: + for val in self.data[key]: + yield key, val + + def keys(self): + return self.data.keys() + + def __contains__(self, key): + return key in self.data + + def __iter__(self): + return self.data.__iter__() + + def __len__(self): + return self.data.__len__() + + def __eq__(self, other): + return type(self) == type(other) and self.data == other.data + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({list(self.iteritems())!r})' + + +def subdict(d, keep=None, drop=None): + """Compute the "subdictionary" of a dict, *d*. + + A subdict is to a dict what a subset is a to set. If *A* is a + subdict of *B*, that means that all keys of *A* are present in + *B*. + + Returns a new dict with any keys in *drop* removed, and any keys + in *keep* still present, provided they were in the original + dict. *keep* defaults to all keys, *drop* defaults to empty, so + without one of these arguments, calling this function is + equivalent to calling ``dict()``. + + >>> from pprint import pprint as pp + >>> pp(subdict({'a': 1, 'b': 2})) + {'a': 1, 'b': 2} + >>> subdict({'a': 1, 'b': 2, 'c': 3}, drop=['b', 'c']) + {'a': 1} + >>> pp(subdict({'a': 1, 'b': 2, 'c': 3}, keep=['a', 'c'])) + {'a': 1, 'c': 3} + + """ + if keep is None: + keep = d.keys() + if drop is None: + drop = [] + + keys = set(keep) - set(drop) + + return type(d)([(k, v) for k, v in d.items() if k in keys]) + + +class FrozenHashError(TypeError): + pass + + +class FrozenDict(dict): + """An immutable dict subtype that is hashable and can itself be used + as a :class:`dict` key or :class:`set` entry. What + :class:`frozenset` is to :class:`set`, FrozenDict is to + :class:`dict`. + + There was once an attempt to introduce such a type to the standard + library, but it was rejected: `PEP 416 `_. + + Because FrozenDict is a :class:`dict` subtype, it automatically + works everywhere a dict would, including JSON serialization. + + """ + __slots__ = ('_hash',) + + def updated(self, *a, **kw): + """Make a copy and add items from a dictionary or iterable (and/or + keyword arguments), overwriting values under an existing + key. See :meth:`dict.update` for more details. + """ + data = dict(self) + data.update(*a, **kw) + return type(self)(data) + + @classmethod + def fromkeys(cls, keys, value=None): + # one of the lesser known and used/useful dict methods + return cls(dict.fromkeys(keys, value)) + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({dict.__repr__(self)})' + + def __reduce_ex__(self, protocol): + return type(self), (dict(self),) + + def __hash__(self): + try: + ret = self._hash + except AttributeError: + try: + ret = self._hash = hash(frozenset(self.items())) + except Exception as e: + ret = self._hash = FrozenHashError(e) + + if ret.__class__ is FrozenHashError: + raise ret + + return ret + + def __copy__(self): + return self # immutable types don't copy, see tuple's behavior + + # block everything else + def _raise_frozen_typeerror(self, *a, **kw): + "raises a TypeError, because FrozenDicts are immutable" + raise TypeError('%s object is immutable' % self.__class__.__name__) + + __ior__ = __setitem__ = __delitem__ = update = _raise_frozen_typeerror + setdefault = pop = popitem = clear = _raise_frozen_typeerror + + del _raise_frozen_typeerror + + +# end dictutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/easterutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/easterutils.py new file mode 100644 index 0000000000000000000000000000000000000000..02a930a6b26d714b1037fff3059293a6a23ac0e6 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/easterutils.py @@ -0,0 +1,44 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +def gobs_program(): + """ + A pure-Python implementation of Gob's Algorithm (2006). A brief + explanation can be found here: + https://www.youtube.com/watch?v=JbnjusltDHk + """ + while True: + print("Penus", end=" ") + + +if __name__ == '__main__': + gobs_program() diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/ecoutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/ecoutils.py new file mode 100644 index 0000000000000000000000000000000000000000..23fb25fbf329a4b10ea5c4fa5c3fd250257b12ee --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/ecoutils.py @@ -0,0 +1,479 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""As a programming ecosystem grows, so do the chances of runtime +variability. + +Python boasts one of the widest deployments for a high-level +programming environment, making it a viable target for all manner of +application. But with breadth comes variance, so it's important to +know what you're working with. + +Some basic variations that are common among development machines: + +* **Executable runtime**: CPython, PyPy, Jython, etc., plus build date and compiler +* **Language version**: 2.7 through 3.12 +* **Host operating system**: Windows, OS X, Ubuntu, Debian, CentOS, RHEL, etc. +* **Features**: 64-bit, IPv6, Unicode character support (UCS-2/UCS-4) +* **Built-in library support**: OpenSSL, threading, SQLite, zlib +* **User environment**: umask, ulimit, working directory path +* **Machine info**: CPU count, hostname, filesystem encoding + +See the full example profile below for more. + +ecoutils was created to quantify that variability. ecoutils quickly +produces an information-dense description of critical runtime factors, +with minimal side effects. In short, ecoutils is like browser and user +agent analytics, but for Python environments. + +Transmission and collection +--------------------------- + +The data is all JSON serializable, and is suitable for sending to a +central analytics server. An HTTP-backed service for this can be found +at: https://github.com/mahmoud/espymetrics/ + +Notable omissions +----------------- + +Due to space constraints (and possibly latency constraints), the +following information is deemed not dense enough, and thus omitted: + +* :data:`sys.path` +* full :mod:`sysconfig` +* environment variables (:data:`os.environ`) + +Compatibility +------------- + +So far ecoutils has has been tested on Python 3.7+ and PyPy3. +Various versions have been tested on Ubuntu, Debian, +RHEL, OS X, FreeBSD, and Windows 7. + +.. note:: + + ``boltons.ecoutils`` historically supported back to Python 2.4, but in 2024, + due to increasing testing burden, ecoutils support tracks the same + versions of Python as the rest of the boltons package. + For older Pythons, see `this version`_ from boltons 23.0.0. + +.. _this version: https://github.com/mahmoud/boltons/blob/4b1d728f31a8378b193be9c966c853be0a57527d/boltons/ecoutils.py + +Profile generation +------------------ + +Profiles are generated by :func:`ecoutils.get_profile`. + +When run as a module, ecoutils will call :func:`~ecoutils.get_profile` +and print a profile in JSON format:: + + $ python -m boltons.ecoutils + { + "_eco_version": "1.0.0", + "cpu_count": 4, + "cwd": "/home/mahmoud/projects/boltons", + "fs_encoding": "UTF-8", + "guid": "6b139e7bbf5ad4ed8d4063bf6235b4d2", + "hostfqdn": "mahmoud-host", + "hostname": "mahmoud-host", + "linux_dist_name": "Ubuntu", + "linux_dist_version": "14.04", + "python": { + "argv": "boltons/ecoutils.py", + "bin": "/usr/bin/python", + "build_date": "Jun 22 2015 17:58:13", + "compiler": "GCC 4.8.2", + "features": { + "64bit": true, + "expat": "expat_2.1.0", + "ipv6": true, + "openssl": "OpenSSL 1.0.1f 6 Jan 2014", + "readline": true, + "sqlite": "3.8.2", + "threading": true, + "tkinter": "8.6", + "unicode_wide": true, + "zlib": "1.2.8" + }, + "version": "2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]", + "version_info": [ + 2, + 7, + 6, + "final", + 0 + ] + }, + "time_utc": "2016-05-24 07:59:40.473140", + "time_utc_offset": -8.0, + "ulimit_hard": 4096, + "ulimit_soft": 1024, + "umask": "002", + "uname": { + "machine": "x86_64", + "node": "mahmoud-host", + "processor": "x86_64", + "release": "3.13.0-85-generic", + "system": "Linux", + "version": "#129-Ubuntu SMP Thu Mar 17 20:50:15 UTC 2016" + }, + "username": "mahmoud" + } + +``pip install boltons`` and try it yourself! + +""" + +import re +import os +import sys +import json +import time +import random +import socket +import struct +import getpass +import datetime +import platform + +ECO_VERSION = '1.1.0' # see version history below + + +try: + getrandbits = random.SystemRandom().getrandbits + HAVE_URANDOM = True +except Exception: + HAVE_URANDOM = False + getrandbits = random.getrandbits + + +# 128-bit GUID just like a UUID, but backwards compatible to 2.4 +INSTANCE_ID = hex(getrandbits(128))[2:-1].lower() + +IS_64BIT = struct.calcsize("P") > 4 +HAVE_UCS4 = getattr(sys, 'maxunicode', 0) > 65536 +HAVE_READLINE = True + +try: + import readline +except Exception: + HAVE_READLINE = False + +try: + import sqlite3 + SQLITE_VERSION = sqlite3.sqlite_version +except Exception: + # note: 2.5 and older have sqlite, but not sqlite3 + SQLITE_VERSION = '' + + +try: + + import ssl + try: + OPENSSL_VERSION = ssl.OPENSSL_VERSION + except AttributeError: + # This is a conservative estimate for Python <2.6 + # SSL module added in 2006, when 0.9.7 was standard + OPENSSL_VERSION = 'OpenSSL >0.8.0' +except Exception: + OPENSSL_VERSION = '' + + +try: + import tkinter + TKINTER_VERSION = str(tkinter.TkVersion) +except Exception: + TKINTER_VERSION = '' + + +try: + import zlib + ZLIB_VERSION = zlib.ZLIB_VERSION +except Exception: + ZLIB_VERSION = '' + + +try: + from xml.parsers import expat + EXPAT_VERSION = expat.EXPAT_VERSION +except Exception: + EXPAT_VERSION = '' + + +try: + from multiprocessing import cpu_count + CPU_COUNT = cpu_count() +except Exception: + CPU_COUNT = 0 + +try: + import threading + HAVE_THREADING = True +except Exception: + HAVE_THREADING = False + + +try: + HAVE_IPV6 = socket.has_ipv6 +except Exception: + HAVE_IPV6 = False + + +try: + from resource import getrlimit, RLIMIT_NOFILE + RLIMIT_FDS_SOFT, RLIMIT_FDS_HARD = getrlimit(RLIMIT_NOFILE) +except Exception: + RLIMIT_FDS_SOFT, RLIMIT_FDS_HARD = 0, 0 + + +START_TIME_INFO = {'time_utc': str(datetime.datetime.now(datetime.timezone.utc)), + 'time_utc_offset': -time.timezone / 3600.0} + + +def get_python_info(): + ret = {} + ret['argv'] = _escape_shell_args(sys.argv) + ret['bin'] = sys.executable + + # Even though compiler/build_date are already here, they're + # actually parsed from the version string. So, in the rare case of + # the unparsable version string, we're still transmitting it. + ret['version'] = ' '.join(sys.version.split()) + + ret['compiler'] = platform.python_compiler() + ret['build_date'] = platform.python_build()[1] + ret['version_info'] = list(sys.version_info) + + ret['features'] = {'openssl': OPENSSL_VERSION, + 'expat': EXPAT_VERSION, + 'sqlite': SQLITE_VERSION, + 'tkinter': TKINTER_VERSION, + 'zlib': ZLIB_VERSION, + 'unicode_wide': HAVE_UCS4, + 'readline': HAVE_READLINE, + '64bit': IS_64BIT, + 'ipv6': HAVE_IPV6, + 'threading': HAVE_THREADING, + 'urandom': HAVE_URANDOM} + + return ret + + +def get_profile(**kwargs): + """The main entrypoint to ecoutils. Calling this will return a + JSON-serializable dictionary of information about the current + process. + + It is very unlikely that the information returned will change + during the lifetime of the process, and in most cases the majority + of the information stays the same between runs as well. + + :func:`get_profile` takes one optional keyword argument, *scrub*, + a :class:`bool` that, if True, blanks out identifiable + information. This includes current working directory, hostname, + Python executable path, command-line arguments, and + username. Values are replaced with '-', but for compatibility keys + remain in place. + + """ + scrub = kwargs.pop('scrub', False) + if kwargs: + raise TypeError(f'unexpected keyword arguments: {kwargs.keys()!r}') + ret = {} + try: + ret['username'] = getpass.getuser() + except Exception: + ret['username'] = '' + ret['guid'] = str(INSTANCE_ID) + ret['hostname'] = socket.gethostname() + ret['hostfqdn'] = socket.getfqdn() + uname = platform.uname() + ret['uname'] = {'system': uname[0], + 'node': uname[1], + 'release': uname[2], # linux: distro name + 'version': uname[3], # linux: kernel version + 'machine': uname[4], + 'processor': uname[5]} + try: + # TODO: removed in 3.7, replaced with freedesktop_os_release in 3.10 + linux_dist = platform.linux_distribution() + except Exception: + linux_dist = ('', '', '') + ret['linux_dist_name'] = linux_dist[0] + ret['linux_dist_version'] = linux_dist[1] + ret['cpu_count'] = CPU_COUNT + + ret['fs_encoding'] = sys.getfilesystemencoding() + ret['ulimit_soft'] = RLIMIT_FDS_SOFT + ret['ulimit_hard'] = RLIMIT_FDS_HARD + ret['cwd'] = os.getcwd() + ret['umask'] = oct(os.umask(os.umask(2))).rjust(3, '0') + + ret['python'] = get_python_info() + ret.update(START_TIME_INFO) + ret['_eco_version'] = ECO_VERSION + + if scrub: + # mask identifiable information + ret['cwd'] = '-' + ret['hostname'] = '-' + ret['hostfqdn'] = '-' + ret['python']['bin'] = '-' + ret['python']['argv'] = '-' + ret['uname']['node'] = '-' + ret['username'] = '-' + + return ret + + +def dumps(val, indent): + if indent: + return json.dumps(val, sort_keys=True, indent=indent) + return json.dumps(val, sort_keys=True) + + +def get_profile_json(indent=False): + if indent: + indent = 2 + else: + indent = 0 + + data_dict = get_profile() + return dumps(data_dict, indent) + + +def main(): + print(get_profile_json(indent=True)) + +############################################# +# The shell escaping copied in from strutils +############################################# + + +def _escape_shell_args(args, sep=' ', style=None): + if not style: + if sys.platform == 'win32': + style = 'cmd' + else: + style = 'sh' + + if style == 'sh': + return _args2sh(args, sep=sep) + elif style == 'cmd': + return _args2cmd(args, sep=sep) + + raise ValueError("style expected one of 'cmd' or 'sh', not %r" % style) + + +_find_sh_unsafe = re.compile(r'[^a-zA-Z0-9_@%+=:,./-]').search + + +def _args2sh(args, sep=' '): + # see strutils + ret_list = [] + + for arg in args: + if not arg: + ret_list.append("''") + continue + if _find_sh_unsafe(arg) is None: + ret_list.append(arg) + continue + # use single quotes, and put single quotes into double quotes + # the string $'b is then quoted as '$'"'"'b' + ret_list.append("'" + arg.replace("'", "'\"'\"'") + "'") + + return ' '.join(ret_list) + + +def _args2cmd(args, sep=' '): + # see strutils + result = [] + needquote = False + for arg in args: + bs_buf = [] + + # Add a space to separate this argument from the others + if result: + result.append(' ') + + needquote = (" " in arg) or ("\t" in arg) or not arg + if needquote: + result.append('"') + + for c in arg: + if c == '\\': + # Don't know if we need to double yet. + bs_buf.append(c) + elif c == '"': + # Double backslashes. + result.append('\\' * len(bs_buf)*2) + bs_buf = [] + result.append('\\"') + else: + # Normal char + if bs_buf: + result.extend(bs_buf) + bs_buf = [] + result.append(c) + + # Add remaining backslashes, if any. + if bs_buf: + result.extend(bs_buf) + + if needquote: + result.extend(bs_buf) + result.append('"') + + return ''.join(result) + + +############################ +# End shell escaping code +############################ + +if __name__ == '__main__': + main() + + +""" + +ecoutils protocol version history +--------------------------------- + +The version is ECO_VERSION module-level constant, and _eco_version key +in the dictionary returned from ecoutils.get_profile(). + +1.1.0 - (boltons version 24.0.0+) Drop Python <=3.6 compat +1.0.1 - (boltons version 16.3.2+) Remove uuid dependency and add HAVE_URANDOM +1.0.0 - (boltons version 16.3.0-16.3.1) Initial release + +""" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/excutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/excutils.py new file mode 100644 index 0000000000000000000000000000000000000000..fa3262d4d8d21207341f3f1ae4ec9b26eb866fea --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/excutils.py @@ -0,0 +1,287 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import sys +import traceback +import linecache +from collections import namedtuple + +# TODO: last arg or first arg? (last arg makes it harder to *args +# into, but makes it more readable in the default exception +# __repr__ output) +# TODO: Multiexception wrapper + + +__all__ = ['ExceptionCauseMixin'] + + +class ExceptionCauseMixin(Exception): + """ + A mixin class for wrapping an exception in another exception, or + otherwise indicating an exception was caused by another exception. + + This is most useful in concurrent or failure-intolerant scenarios, + where just because one operation failed, doesn't mean the remainder + should be aborted, or that it's the appropriate time to raise + exceptions. + + This is still a work in progress, but an example use case at the + bottom of this module. + + NOTE: when inheriting, you will probably want to put the + ExceptionCauseMixin first. Builtin exceptions are not good about + calling super() + """ + + cause = None + + def __new__(cls, *args, **kw): + cause = None + if args and isinstance(args[0], Exception): + cause, args = args[0], args[1:] + ret = super().__new__(cls, *args, **kw) + ret.cause = cause + if cause is None: + return ret + root_cause = getattr(cause, 'root_cause', None) + if root_cause is None: + ret.root_cause = cause + else: + ret.root_cause = root_cause + + full_trace = getattr(cause, 'full_trace', None) + if full_trace is not None: + ret.full_trace = list(full_trace) + ret._tb = list(cause._tb) + ret._stack = list(cause._stack) + return ret + + try: + exc_type, exc_value, exc_tb = sys.exc_info() + if exc_type is None and exc_value is None: + return ret + if cause is exc_value or root_cause is exc_value: + # handles when cause is the current exception or when + # there are multiple wraps while handling the original + # exception, but a cause was never provided + ret._tb = _extract_from_tb(exc_tb) + ret._stack = _extract_from_frame(exc_tb.tb_frame) + ret.full_trace = ret._stack[:-1] + ret._tb + finally: + del exc_tb + return ret + + def get_str(self): + """ + Get formatted the formatted traceback and exception + message. This function exists separately from __str__() + because __str__() is somewhat specialized for the built-in + traceback module's particular usage. + """ + ret = [] + trace_str = self._get_trace_str() + if trace_str: + ret.extend(['Traceback (most recent call last):\n', trace_str]) + ret.append(self._get_exc_str()) + return ''.join(ret) + + def _get_message(self): + args = getattr(self, 'args', []) + if self.cause: + args = args[1:] + if args and args[0]: + return args[0] + return '' + + def _get_trace_str(self): + if not self.cause: + return super().__repr__() + if self.full_trace: + return ''.join(traceback.format_list(self.full_trace)) + return '' + + def _get_exc_str(self, incl_name=True): + cause_str = _format_exc(self.root_cause) + message = self._get_message() + ret = [] + if incl_name: + ret = [self.__class__.__name__, ': '] + if message: + ret.extend([message, ' (caused by ', cause_str, ')']) + else: + ret.extend([' caused by ', cause_str]) + return ''.join(ret) + + def __str__(self): + if not self.cause: + return super().__str__() + trace_str = self._get_trace_str() + ret = [] + if trace_str: + message = self._get_message() + if message: + ret.extend([message, ' --- ']) + ret.extend(['Wrapped traceback (most recent call last):\n', + trace_str, + self._get_exc_str(incl_name=True)]) + return ''.join(ret) + else: + return self._get_exc_str(incl_name=False) + + +def _format_exc(exc, message=None): + if message is None: + message = exc + exc_str = traceback._format_final_exc_line(exc.__class__.__name__, message) + return exc_str.rstrip() + + +_BaseTBItem = namedtuple('_BaseTBItem', 'filename, lineno, name, line') + + +class _TBItem(_BaseTBItem): + def __repr__(self): + ret = super().__repr__() + ret += ' <%r>' % self.frame_id + return ret + + +class _DeferredLine: + def __init__(self, filename, lineno, module_globals=None): + self.filename = filename + self.lineno = lineno + module_globals = module_globals or {} + self.module_globals = {k: v for k, v in module_globals.items() + if k in ('__name__', '__loader__')} + + def __eq__(self, other): + return (self.lineno, self.filename) == (other.lineno, other.filename) + + def __ne__(self, other): + return (self.lineno, self.filename) != (other.lineno, other.filename) + + def __str__(self): + if hasattr(self, '_line'): + return self._line + linecache.checkcache(self.filename) + line = linecache.getline(self.filename, + self.lineno, + self.module_globals) + if line: + line = line.strip() + else: + line = None + self._line = line + return line + + def __repr__(self): + return repr(str(self)) + + def __len__(self): + return len(str(self)) + + def strip(self): + return str(self).strip() + + +def _extract_from_frame(f=None, limit=None): + ret = [] + if f is None: + f = sys._getframe(1) # cross-impl yadayada + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while f is not None and n < limit: + filename = f.f_code.co_filename + lineno = f.f_lineno + name = f.f_code.co_name + line = _DeferredLine(filename, lineno, f.f_globals) + item = _TBItem(filename, lineno, name, line) + item.frame_id = id(f) + ret.append(item) + f = f.f_back + n += 1 + ret.reverse() + return ret + + +def _extract_from_tb(tb, limit=None): + ret = [] + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while tb is not None and n < limit: + filename = tb.tb_frame.f_code.co_filename + lineno = tb.tb_lineno + name = tb.tb_frame.f_code.co_name + line = _DeferredLine(filename, lineno, tb.tb_frame.f_globals) + item = _TBItem(filename, lineno, name, line) + item.frame_id = id(tb.tb_frame) + ret.append(item) + tb = tb.tb_next + n += 1 + return ret + + +# An Example/Prototest: + + +class MathError(ExceptionCauseMixin, ValueError): + pass + + +def whoops_math(): + return 1/0 + + +def math_lol(n=0): + if n < 3: + return math_lol(n=n+1) + try: + return whoops_math() + except ZeroDivisionError as zde: + exc = MathError(zde, 'ya done messed up') + raise exc + +def main(): + try: + math_lol() + except ValueError as me: + exc = MathError(me, 'hi') + raise exc + + +if __name__ == '__main__': + try: + main() + except Exception: + import pdb;pdb.post_mortem() + raise diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/fileutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/fileutils.py new file mode 100644 index 0000000000000000000000000000000000000000..2a0577047d11697e2eba6cd639f6a3319100c243 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/fileutils.py @@ -0,0 +1,727 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Virtually every Python programmer has used Python for wrangling +disk contents, and ``fileutils`` collects solutions to some of the +most commonly-found gaps in the standard library. +""" + + +import os +import re +import sys +import stat +import errno +import fnmatch +from shutil import copy2, copystat, Error + + +__all__ = ['mkdir_p', 'atomic_save', 'AtomicSaver', 'FilePerms', + 'iter_find_files', 'copytree'] + + +FULL_PERMS = 0o777 +RW_PERMS = 438 +_SINGLE_FULL_PERM = 7 + + +def mkdir_p(path): + """Creates a directory and any parent directories that may need to + be created along the way, without raising errors for any existing + directories. This function mimics the behavior of the ``mkdir -p`` + command available in Linux/BSD environments, but also works on + Windows. + """ + try: + os.makedirs(path) + except OSError as exc: + if exc.errno == errno.EEXIST and os.path.isdir(path): + return + raise + return + + +class FilePerms: + """The :class:`FilePerms` type is used to represent standard POSIX + filesystem permissions: + + * Read + * Write + * Execute + + Across three classes of user: + + * Owning (u)ser + * Owner's (g)roup + * Any (o)ther user + + This class assists with computing new permissions, as well as + working with numeric octal ``777``-style and ``rwx``-style + permissions. Currently it only considers the bottom 9 permission + bits; it does not support sticky bits or more advanced permission + systems. + + Args: + user (str): A string in the 'rwx' format, omitting characters + for which owning user's permissions are not provided. + group (str): A string in the 'rwx' format, omitting characters + for which owning group permissions are not provided. + other (str): A string in the 'rwx' format, omitting characters + for which owning other/world permissions are not provided. + + There are many ways to use :class:`FilePerms`: + + >>> FilePerms(user='rwx', group='xrw', other='wxr') # note character order + FilePerms(user='rwx', group='rwx', other='rwx') + >>> int(FilePerms('r', 'r', '')) + 288 + >>> oct(288)[-3:] # XXX Py3k + '440' + + See also the :meth:`FilePerms.from_int` and + :meth:`FilePerms.from_path` classmethods for useful alternative + ways to construct :class:`FilePerms` objects. + """ + # TODO: consider more than the lower 9 bits + class _FilePermProperty: + _perm_chars = 'rwx' + _perm_set = frozenset('rwx') + _perm_val = {'r': 4, 'w': 2, 'x': 1} # for sorting + + def __init__(self, attribute, offset): + self.attribute = attribute + self.offset = offset + + def __get__(self, fp_obj, type_=None): + if fp_obj is None: + return self + return getattr(fp_obj, self.attribute) + + def __set__(self, fp_obj, value): + cur = getattr(fp_obj, self.attribute) + if cur == value: + return + try: + invalid_chars = set(str(value)) - self._perm_set + except TypeError: + raise TypeError('expected string, not %r' % value) + if invalid_chars: + raise ValueError('got invalid chars %r in permission' + ' specification %r, expected empty string' + ' or one or more of %r' + % (invalid_chars, value, self._perm_chars)) + + def sort_key(c): return self._perm_val[c] + new_value = ''.join(sorted(set(value), + key=sort_key, reverse=True)) + setattr(fp_obj, self.attribute, new_value) + self._update_integer(fp_obj, new_value) + + def _update_integer(self, fp_obj, value): + mode = 0 + key = 'xwr' + for symbol in value: + bit = 2 ** key.index(symbol) + mode |= (bit << (self.offset * 3)) + fp_obj._integer |= mode + + def __init__(self, user='', group='', other=''): + self._user, self._group, self._other = '', '', '' + self._integer = 0 + self.user = user + self.group = group + self.other = other + + @classmethod + def from_int(cls, i): + """Create a :class:`FilePerms` object from an integer. + + >>> FilePerms.from_int(0o644) # note the leading zero-oh for octal + FilePerms(user='rw', group='r', other='r') + """ + i &= FULL_PERMS + key = ('', 'x', 'w', 'xw', 'r', 'rx', 'rw', 'rwx') + parts = [] + while i: + parts.append(key[i & _SINGLE_FULL_PERM]) + i >>= 3 + parts.reverse() + return cls(*parts) + + @classmethod + def from_path(cls, path): + """Make a new :class:`FilePerms` object based on the permissions + assigned to the file or directory at *path*. + + Args: + path (str): Filesystem path of the target file. + + Here's an example that holds true on most systems: + + >>> import tempfile + >>> 'r' in FilePerms.from_path(tempfile.gettempdir()).user + True + """ + stat_res = os.stat(path) + return cls.from_int(stat.S_IMODE(stat_res.st_mode)) + + def __int__(self): + return self._integer + + # Sphinx tip: attribute docstrings come after the attribute + user = _FilePermProperty('_user', 2) + "Stores the ``rwx``-formatted *user* permission." + group = _FilePermProperty('_group', 1) + "Stores the ``rwx``-formatted *group* permission." + other = _FilePermProperty('_other', 0) + "Stores the ``rwx``-formatted *other* permission." + + def __repr__(self): + cn = self.__class__.__name__ + return ('%s(user=%r, group=%r, other=%r)' + % (cn, self.user, self.group, self.other)) + +#### + + +_TEXT_OPENFLAGS = os.O_RDWR | os.O_CREAT | os.O_EXCL +if hasattr(os, 'O_NOINHERIT'): + _TEXT_OPENFLAGS |= os.O_NOINHERIT +if hasattr(os, 'O_NOFOLLOW'): + _TEXT_OPENFLAGS |= os.O_NOFOLLOW +_BIN_OPENFLAGS = _TEXT_OPENFLAGS +if hasattr(os, 'O_BINARY'): + _BIN_OPENFLAGS |= os.O_BINARY + + +try: + import fcntl as fcntl +except ImportError: + def set_cloexec(fd): + "Dummy set_cloexec for platforms without fcntl support" + pass +else: + def set_cloexec(fd): + """Does a best-effort :func:`fcntl.fcntl` call to set a fd to be + automatically closed by any future child processes. + + Implementation from the :mod:`tempfile` module. + """ + try: + flags = fcntl.fcntl(fd, fcntl.F_GETFD, 0) + except OSError: + pass + else: + # flags read successfully, modify + flags |= fcntl.FD_CLOEXEC + fcntl.fcntl(fd, fcntl.F_SETFD, flags) + return + + +def atomic_save(dest_path, **kwargs): + """A convenient interface to the :class:`AtomicSaver` type. Example: + + >>> try: + ... with atomic_save("file.txt", text_mode=True) as fo: + ... _ = fo.write('bye') + ... 1/0 # will error + ... fo.write('bye') + ... except ZeroDivisionError: + ... pass # at least our file.txt didn't get overwritten + + See the :class:`AtomicSaver` documentation for details. + """ + return AtomicSaver(dest_path, **kwargs) + + +def path_to_unicode(path): + if isinstance(path, str): + return path + encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() + return path.decode(encoding) + + +if os.name == 'nt': + import ctypes + from ctypes import c_wchar_p + from ctypes.wintypes import DWORD, LPVOID + + _ReplaceFile = ctypes.windll.kernel32.ReplaceFile + _ReplaceFile.argtypes = [c_wchar_p, c_wchar_p, c_wchar_p, + DWORD, LPVOID, LPVOID] + + def replace(src, dst): + # argument names match stdlib docs, docstring below + try: + # ReplaceFile fails if the dest file does not exist, so + # first try to rename it into position + os.rename(src, dst) + return + except OSError as we: + if we.errno == errno.EEXIST: + pass # continue with the ReplaceFile logic below + else: + raise + + src = path_to_unicode(src) + dst = path_to_unicode(dst) + res = _ReplaceFile(c_wchar_p(dst), c_wchar_p(src), + None, 0, None, None) + if not res: + raise OSError(f'failed to replace {dst!r} with {src!r}') + return + + def atomic_rename(src, dst, overwrite=False): + "Rename *src* to *dst*, replacing *dst* if *overwrite is True" + if overwrite: + replace(src, dst) + else: + os.rename(src, dst) + return +else: + # wrapper func for cross compat + docs + def replace(src, dst): + # os.replace does the same thing on unix + return os.rename(src, dst) + + def atomic_rename(src, dst, overwrite=False): + "Rename *src* to *dst*, replacing *dst* if *overwrite is True" + if overwrite: + os.rename(src, dst) + else: + os.link(src, dst) + os.unlink(src) + return + + +_atomic_rename = atomic_rename # backwards compat + +replace.__doc__ = """Similar to :func:`os.replace` in Python 3.3+, +this function will atomically create or replace the file at path +*dst* with the file at path *src*. + +On Windows, this function uses the ReplaceFile API for maximum +possible atomicity on a range of filesystems. +""" + + +class AtomicSaver: + """``AtomicSaver`` is a configurable `context manager`_ that provides + a writable :class:`file` which will be moved into place as long as + no exceptions are raised within the context manager's block. These + "part files" are created in the same directory as the destination + path to ensure atomic move operations (i.e., no cross-filesystem + moves occur). + + Args: + dest_path (str): The path where the completed file will be + written. + overwrite (bool): Whether to overwrite the destination file if + it exists at completion time. Defaults to ``True``. + file_perms (int): Integer representation of file permissions + for the newly-created file. Defaults are, when the + destination path already exists, to copy the permissions + from the previous file, or if the file did not exist, to + respect the user's configured `umask`_, usually resulting + in octal 0644 or 0664. + text_mode (bool): Whether to open the destination file in text + mode (i.e., ``'w'`` not ``'wb'``). Defaults to ``False`` (``wb``). + part_file (str): Name of the temporary *part_file*. Defaults + to *dest_path* + ``.part``. Note that this argument is + just the filename, and not the full path of the part + file. To guarantee atomic saves, part files are always + created in the same directory as the destination path. + overwrite_part (bool): Whether to overwrite the *part_file*, + should it exist at setup time. Defaults to ``False``, + which results in an :exc:`OSError` being raised on + pre-existing part files. Be careful of setting this to + ``True`` in situations when multiple threads or processes + could be writing to the same part file. + rm_part_on_exc (bool): Remove *part_file* on exception cases. + Defaults to ``True``, but ``False`` can be useful for + recovery in some cases. Note that resumption is not + automatic and by default an :exc:`OSError` is raised if + the *part_file* exists. + + Practically, the AtomicSaver serves a few purposes: + + * Avoiding overwriting an existing, valid file with a partially + written one. + * Providing a reasonable guarantee that a part file only has one + writer at a time. + * Optional recovery of partial data in failure cases. + + .. _context manager: https://docs.python.org/2/reference/compound_stmts.html#with + .. _umask: https://en.wikipedia.org/wiki/Umask + + """ + _default_file_perms = RW_PERMS + + # TODO: option to abort if target file modify date has changed since start? + def __init__(self, dest_path, **kwargs): + self.dest_path = dest_path + self.overwrite = kwargs.pop('overwrite', True) + self.file_perms = kwargs.pop('file_perms', None) + self.overwrite_part = kwargs.pop('overwrite_part', False) + self.part_filename = kwargs.pop('part_file', None) + self.rm_part_on_exc = kwargs.pop('rm_part_on_exc', True) + self.text_mode = kwargs.pop('text_mode', False) + self.buffering = kwargs.pop('buffering', -1) + if kwargs: + raise TypeError(f'unexpected kwargs: {kwargs.keys()!r}') + + self.dest_path = os.path.abspath(self.dest_path) + self.dest_dir = os.path.dirname(self.dest_path) + if not self.part_filename: + self.part_path = dest_path + '.part' + else: + self.part_path = os.path.join(self.dest_dir, self.part_filename) + self.mode = 'w+' if self.text_mode else 'w+b' + self.open_flags = _TEXT_OPENFLAGS if self.text_mode else _BIN_OPENFLAGS + + self.part_file = None + + def _open_part_file(self): + do_chmod = True + file_perms = self.file_perms + if file_perms is None: + try: + # try to copy from file being replaced + stat_res = os.stat(self.dest_path) + file_perms = stat.S_IMODE(stat_res.st_mode) + except OSError: + # default if no destination file exists + file_perms = self._default_file_perms + do_chmod = False # respect the umask + + fd = os.open(self.part_path, self.open_flags, file_perms) + set_cloexec(fd) + self.part_file = os.fdopen(fd, self.mode, self.buffering) + + # if default perms are overridden by the user or previous dest_path + # chmod away the effects of the umask + if do_chmod: + try: + os.chmod(self.part_path, file_perms) + except OSError: + self.part_file.close() + raise + return + + def setup(self): + """Called on context manager entry (the :keyword:`with` statement), + the ``setup()`` method creates the temporary file in the same + directory as the destination file. + + ``setup()`` tests for a writable directory with rename permissions + early, as the part file may not be written to immediately (not + using :func:`os.access` because of the potential issues of + effective vs. real privileges). + + If the caller is not using the :class:`AtomicSaver` as a + context manager, this method should be called explicitly + before writing. + """ + if os.path.lexists(self.dest_path): + if not self.overwrite: + raise OSError(errno.EEXIST, + 'Overwrite disabled and file already exists', + self.dest_path) + if self.overwrite_part and os.path.lexists(self.part_path): + os.unlink(self.part_path) + self._open_part_file() + return + + def __enter__(self): + self.setup() + return self.part_file + + def __exit__(self, exc_type, exc_val, exc_tb): + if self.part_file: + # Ensure data is flushed and synced to disk before closing + self.part_file.flush() + os.fsync(self.part_file.fileno()) + self.part_file.close() + if exc_type: + if self.rm_part_on_exc: + try: + os.unlink(self.part_path) + except Exception: + pass # avoid masking original error + return + try: + atomic_rename(self.part_path, self.dest_path, + overwrite=self.overwrite) + except OSError: + if self.rm_part_on_exc: + try: + os.unlink(self.part_path) + except Exception: + pass # avoid masking original error + raise # could not save destination file + return + + +def iter_find_files(directory, patterns, ignored=None, include_dirs=False, max_depth=None): + """Returns a generator that yields file paths under a *directory*, + matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also + supports *ignored* patterns. + + Args: + directory (str): Path that serves as the root of the + search. Yielded paths will include this as a prefix. + patterns (str or list): A single pattern or list of + glob-formatted patterns to find under *directory*. + ignored (str or list): A single pattern or list of + glob-formatted patterns to ignore. + include_dirs (bool): Whether to include directories that match + patterns, as well. Defaults to ``False``. + max_depth (int): traverse up to this level of subdirectory. + I.e., 0 for the specified *directory* only, 1 for *directory* + and one level of subdirectory. + + For example, finding Python files in the current directory: + + >>> _CUR_DIR = os.path.dirname(os.path.abspath(__file__)) + >>> filenames = sorted(iter_find_files(_CUR_DIR, '*.py')) + >>> os.path.basename(filenames[-1]) + 'urlutils.py' + + Or, Python files while ignoring emacs lockfiles: + + >>> filenames = iter_find_files(_CUR_DIR, '*.py', ignored='.#*') + + .. _glob: https://en.wikipedia.org/wiki/Glob_%28programming%29 + + """ + if isinstance(patterns, str): + patterns = [patterns] + pats_re = re.compile('|'.join([fnmatch.translate(p) for p in patterns])) + + if not ignored: + ignored = [] + elif isinstance(ignored, str): + ignored = [ignored] + ign_re = re.compile('|'.join([fnmatch.translate(p) for p in ignored])) + start_depth = len(directory.split(os.path.sep)) + for root, dirs, files in os.walk(directory): + if max_depth is not None and (len(root.split(os.path.sep)) - start_depth) > max_depth: + continue + if include_dirs: + for basename in dirs: + if pats_re.match(basename): + if ignored and ign_re.match(basename): + continue + filename = os.path.join(root, basename) + yield filename + + for basename in files: + if pats_re.match(basename): + if ignored and ign_re.match(basename): + continue + filename = os.path.join(root, basename) + yield filename + return + + +def copy_tree(src, dst, symlinks=False, ignore=None): + """The ``copy_tree`` function is an exact copy of the built-in + :func:`shutil.copytree`, with one key difference: it will not + raise an exception if part of the tree already exists. It achieves + this by using :func:`mkdir_p`. + + As of Python 3.8, you may pass :func:`shutil.copytree` the + `dirs_exist_ok=True` flag to achieve the same effect. + + Args: + src (str): Path of the source directory to copy. + dst (str): Destination path. Existing directories accepted. + symlinks (bool): If ``True``, copy symlinks rather than their + contents. + ignore (callable): A callable that takes a path and directory + listing, returning the files within the listing to be ignored. + + For more details, check out :func:`shutil.copytree` and + :func:`shutil.copy2`. + + """ + names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + + mkdir_p(dst) + errors = [] + for name in names: + if name in ignored_names: + continue + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + try: + if symlinks and os.path.islink(srcname): + linkto = os.readlink(srcname) + os.symlink(linkto, dstname) + elif os.path.isdir(srcname): + copytree(srcname, dstname, symlinks, ignore) + else: + # Will raise a SpecialFileError for unsupported file types + copy2(srcname, dstname) + # catch the Error from the recursive copytree so that we can + # continue with other files + except Error as e: + errors.extend(e.args[0]) + except OSError as why: + errors.append((srcname, dstname, str(why))) + try: + copystat(src, dst) + except OSError as why: + errors.append((src, dst, str(why))) + if errors: + raise Error(errors) + + +copytree = copy_tree # alias for drop-in replacement of shutil + + +# like open(os.devnull) but with even fewer side effects +class DummyFile: + # TODO: raise ValueErrors on closed for all methods? + # TODO: enforce read/write + def __init__(self, path, mode='r', buffering=None): + self.name = path + self.mode = mode + self.closed = False + self.errors = None + self.isatty = False + self.encoding = None + self.newlines = None + self.softspace = 0 + + def close(self): + self.closed = True + + def fileno(self): + return -1 + + def flush(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def next(self): + raise StopIteration() + + def read(self, size=0): + if self.closed: + raise ValueError('I/O operation on a closed file') + return '' + + def readline(self, size=0): + if self.closed: + raise ValueError('I/O operation on a closed file') + return '' + + def readlines(self, size=0): + if self.closed: + raise ValueError('I/O operation on a closed file') + return [] + + def seek(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def tell(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return 0 + + def truncate(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def write(self, string): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def writelines(self, list_of_strings): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def __next__(self): + raise StopIteration() + + def __enter__(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def __exit__(self, exc_type, exc_val, exc_tb): + return + + +def rotate_file(filename, *, keep: int = 5): + """ + If *filename.ext* exists, it will be moved to *filename.1.ext*, + with all conflicting filenames being moved up by one, dropping any files beyond *keep*. + + After rotation, *filename* will be available for creation as a new file. + + Fails if *filename* is not a file or if *keep* is not > 0. + """ + if keep < 1: + raise ValueError(f'expected "keep" to be >=1, not {keep}') + if not os.path.exists(filename): + return + if not os.path.isfile(filename): + raise ValueError(f'expected {filename} to be a file') + + fn_root, fn_ext = os.path.splitext(filename) + kept_names = [] + for i in range(1, keep + 1): + if fn_ext: + kept_names.append(f'{fn_root}.{i}{fn_ext}') + else: + kept_names.append(f'{fn_root}.{i}') + + fns = [filename] + kept_names + for orig_name, kept_name in reversed(list(zip(fns, fns[1:]))): + if not os.path.exists(orig_name): + continue + os.rename(orig_name, kept_name) + + if os.path.exists(kept_names[-1]): + os.remove(kept_names[-1]) + + return diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/formatutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/formatutils.py new file mode 100644 index 0000000000000000000000000000000000000000..303403493c2421f5950285b012f777e3742ec463 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/formatutils.py @@ -0,0 +1,356 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""`PEP 3101`_ introduced the :meth:`str.format` method, and what +would later be called "new-style" string formatting. For the sake of +explicit correctness, it is probably best to refer to Python's dual +string formatting capabilities as *bracket-style* and +*percent-style*. There is overlap, but one does not replace the +other. + + * Bracket-style is more pluggable, slower, and uses a method. + * Percent-style is simpler, faster, and uses an operator. + +Bracket-style formatting brought with it a much more powerful toolbox, +but it was far from a full one. :meth:`str.format` uses `more powerful +syntax`_, but `the tools and idioms`_ for working with +that syntax are not well-developed nor well-advertised. + +``formatutils`` adds several functions for working with bracket-style +format strings: + + * :class:`DeferredValue`: Defer fetching or calculating a value + until format time. + * :func:`get_format_args`: Parse the positional and keyword + arguments out of a format string. + * :func:`tokenize_format_str`: Tokenize a format string into + literals and :class:`BaseFormatField` objects. + * :func:`construct_format_field_str`: Assists in programmatic + construction of format strings. + * :func:`infer_positional_format_args`: Converts anonymous + references in 2.7+ format strings to explicit positional arguments + suitable for usage with Python 2.6. + +.. _more powerful syntax: https://docs.python.org/2/library/string.html#format-string-syntax +.. _the tools and idioms: https://docs.python.org/2/library/string.html#string-formatting +.. _PEP 3101: https://www.python.org/dev/peps/pep-3101/ +""" +# TODO: also include percent-formatting utils? +# TODO: include lithoxyl.formatters.Formatter (or some adaptation)? + + +import re +from string import Formatter + +__all__ = ['DeferredValue', 'get_format_args', 'tokenize_format_str', + 'construct_format_field_str', 'infer_positional_format_args', + 'BaseFormatField'] + + +_pos_farg_re = re.compile('({{)|' # escaped open-brace + '(}})|' # escaped close-brace + r'({[:!.\[}])') # anon positional format arg + + +def construct_format_field_str(fname, fspec, conv): + """ + Constructs a format field string from the field name, spec, and + conversion character (``fname``, ``fspec``, ``conv``). See Python + String Formatting for more info. + """ + if fname is None: + return '' + ret = '{' + fname + if conv: + ret += '!' + conv + if fspec: + ret += ':' + fspec + ret += '}' + return ret + + +def split_format_str(fstr): + """Does very basic splitting of a format string, returns a list of + strings. For full tokenization, see :func:`tokenize_format_str`. + + """ + ret = [] + + for lit, fname, fspec, conv in Formatter().parse(fstr): + if fname is None: + ret.append((lit, None)) + continue + field_str = construct_format_field_str(fname, fspec, conv) + ret.append((lit, field_str)) + return ret + + +def infer_positional_format_args(fstr): + """Takes format strings with anonymous positional arguments, (e.g., + "{}" and {:d}), and converts them into numbered ones for explicitness and + compatibility with 2.6. + + Returns a string with the inferred positional arguments. + """ + # TODO: memoize + ret, max_anon = '', 0 + # look for {: or {! or {. or {[ or {} + start, end, prev_end = 0, 0, 0 + for match in _pos_farg_re.finditer(fstr): + start, end, group = match.start(), match.end(), match.group() + if prev_end < start: + ret += fstr[prev_end:start] + prev_end = end + if group == '{{' or group == '}}': + ret += group + continue + ret += f'{{{max_anon}{group[1:]}' + max_anon += 1 + ret += fstr[prev_end:] + return ret + + +# This approach is hardly exhaustive but it works for most builtins +_INTCHARS = 'bcdoxXn' +_FLOATCHARS = 'eEfFgGn%' +_TYPE_MAP = dict([(x, int) for x in _INTCHARS] + + [(x, float) for x in _FLOATCHARS]) +_TYPE_MAP['s'] = str + + +def get_format_args(fstr): + """ + Turn a format string into two lists of arguments referenced by the + format string. One is positional arguments, and the other is named + arguments. Each element of the list includes the name and the + nominal type of the field. + + # >>> get_format_args("{noun} is {1:d} years old{punct}") + # ([(1, )], [('noun', ), ('punct', )]) + + # XXX: Py3k + >>> get_format_args("{noun} is {1:d} years old{punct}") == \ + ([(1, int)], [('noun', str), ('punct', str)]) + True + """ + # TODO: memoize + formatter = Formatter() + fargs, fkwargs, _dedup = [], [], set() + + def _add_arg(argname, type_char='s'): + if argname not in _dedup: + _dedup.add(argname) + argtype = _TYPE_MAP.get(type_char, str) # TODO: unicode + try: + fargs.append((int(argname), argtype)) + except ValueError: + fkwargs.append((argname, argtype)) + + for lit, fname, fspec, conv in formatter.parse(fstr): + if fname is not None: + type_char = fspec[-1:] + fname_list = re.split('[.[]', fname) + if len(fname_list) > 1: + raise ValueError('encountered compound format arg: %r' % fname) + try: + base_fname = fname_list[0] + assert base_fname + except (IndexError, AssertionError): + raise ValueError('encountered anonymous positional argument') + _add_arg(fname, type_char) + for sublit, subfname, _, _ in formatter.parse(fspec): + # TODO: positional and anon args not allowed here. + if subfname is not None: + _add_arg(subfname) + return fargs, fkwargs + + +def tokenize_format_str(fstr, resolve_pos=True): + """Takes a format string, turns it into a list of alternating string + literals and :class:`BaseFormatField` tokens. By default, also + infers anonymous positional references into explicit, numbered + positional references. To disable this behavior set *resolve_pos* + to ``False``. + """ + ret = [] + if resolve_pos: + fstr = infer_positional_format_args(fstr) + formatter = Formatter() + for lit, fname, fspec, conv in formatter.parse(fstr): + if lit: + ret.append(lit) + if fname is None: + continue + ret.append(BaseFormatField(fname, fspec, conv)) + return ret + + +class BaseFormatField: + """A class representing a reference to an argument inside of a + bracket-style format string. For instance, in ``"{greeting}, + world!"``, there is a field named "greeting". + + These fields can have many options applied to them. See the + Python docs on `Format String Syntax`_ for the full details. + + .. _Format String Syntax: https://docs.python.org/2/library/string.html#string-formatting + """ + def __init__(self, fname, fspec='', conv=None): + self.set_fname(fname) + self.set_fspec(fspec) + self.set_conv(conv) + + def set_fname(self, fname): + "Set the field name." + + path_list = re.split('[.[]', fname) # TODO + + self.base_name = path_list[0] + self.fname = fname + self.subpath = path_list[1:] + self.is_positional = not self.base_name or self.base_name.isdigit() + + def set_fspec(self, fspec): + "Set the field spec." + fspec = fspec or '' + subfields = [] + for sublit, subfname, _, _ in Formatter().parse(fspec): + if subfname is not None: + subfields.append(subfname) + self.subfields = subfields + self.fspec = fspec + self.type_char = fspec[-1:] + self.type_func = _TYPE_MAP.get(self.type_char, str) + + def set_conv(self, conv): + """There are only two built-in converters: ``s`` and ``r``. They are + somewhat rare and appearlike ``"{ref!r}"``.""" + # TODO + self.conv = conv + self.conv_func = None # TODO + + @property + def fstr(self): + "The current state of the field in string format." + return construct_format_field_str(self.fname, self.fspec, self.conv) + + def __repr__(self): + cn = self.__class__.__name__ + args = [self.fname] + if self.conv is not None: + args.extend([self.fspec, self.conv]) + elif self.fspec != '': + args.append(self.fspec) + args_repr = ', '.join([repr(a) for a in args]) + return f'{cn}({args_repr})' + + def __str__(self): + return self.fstr + + +_UNSET = object() + + +class DeferredValue: + """:class:`DeferredValue` is a wrapper type, used to defer computing + values which would otherwise be expensive to stringify and + format. This is most valuable in areas like logging, where one + would not want to waste time formatting a value for a log message + which will subsequently be filtered because the message's log + level was DEBUG and the logger was set to only emit CRITICAL + messages. + + The :class:``DeferredValue`` is initialized with a callable that + takes no arguments and returns the value, which can be of any + type. By default DeferredValue only calls that callable once, and + future references will get a cached value. This behavior can be + disabled by setting *cache_value* to ``False``. + + Args: + + func (function): A callable that takes no arguments and + computes the value being represented. + cache_value (bool): Whether subsequent usages will call *func* + again. Defaults to ``True``. + + >>> import sys + >>> dv = DeferredValue(lambda: len(sys._current_frames())) + >>> output = "works great in all {0} threads!".format(dv) + + PROTIP: To keep lines shorter, use: ``from formatutils import + DeferredValue as DV`` + """ + def __init__(self, func, cache_value=True): + self.func = func + self.cache_value = cache_value + self._value = _UNSET + + def get_value(self): + """Computes, optionally caches, and returns the value of the + *func*. If ``get_value()`` has been called before, a cached + value may be returned depending on the *cache_value* option + passed to the constructor. + """ + if self._value is not _UNSET and self.cache_value: + value = self._value + else: + value = self.func() + if self.cache_value: + self._value = value + return value + + def __int__(self): + return int(self.get_value()) + + def __float__(self): + return float(self.get_value()) + + def __str__(self): + return str(self.get_value()) + + def __unicode__(self): + return str(self.get_value()) + + def __repr__(self): + return repr(self.get_value()) + + def __format__(self, fmt): + value = self.get_value() + + pt = fmt[-1:] # presentation type + type_conv = _TYPE_MAP.get(pt, str) + + try: + return value.__format__(fmt) + except (ValueError, TypeError): + # TODO: this may be overkill + return type_conv(value).__format__(fmt) + +# end formatutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/funcutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/funcutils.py new file mode 100644 index 0000000000000000000000000000000000000000..0bdc28e9bf54bef76741eae72ae838517e0a87d9 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/funcutils.py @@ -0,0 +1,1007 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's built-in :mod:`functools` module builds several useful +utilities on top of Python's first-class function +support. ``funcutils`` generally stays in the same vein, adding to and +correcting Python's standard metaprogramming facilities. +""" + +import sys +import re +import inspect +import functools +import itertools +from inspect import formatannotation +from types import FunctionType, MethodType + +# For legacy compatibility. +# boltons used to offer an implementation of total_ordering for Python <2.7 +from functools import total_ordering as total_ordering + +try: + from .typeutils import make_sentinel + NO_DEFAULT = make_sentinel(var_name='NO_DEFAULT') +except ImportError: + NO_DEFAULT = object() + + +def inspect_formatargspec( + args, varargs=None, varkw=None, defaults=None, + kwonlyargs=(), kwonlydefaults={}, annotations={}, + formatarg=str, + formatvarargs=lambda name: '*' + name, + formatvarkw=lambda name: '**' + name, + formatvalue=lambda value: '=' + repr(value), + formatreturns=lambda text: ' -> ' + text, + formatannotation=formatannotation): + """Copy formatargspec from python 3.7 standard library. + Python 3 has deprecated formatargspec and requested that Signature + be used instead, however this requires a full reimplementation + of formatargspec() in terms of creating Parameter objects and such. + Instead of introducing all the object-creation overhead and having + to reinvent from scratch, just copy their compatibility routine. + """ + + def formatargandannotation(arg): + result = formatarg(arg) + if arg in annotations: + result += ': ' + formatannotation(annotations[arg]) + return result + specs = [] + if defaults: + firstdefault = len(args) - len(defaults) + for i, arg in enumerate(args): + spec = formatargandannotation(arg) + if defaults and i >= firstdefault: + spec = spec + formatvalue(defaults[i - firstdefault]) + specs.append(spec) + if varargs is not None: + specs.append(formatvarargs(formatargandannotation(varargs))) + else: + if kwonlyargs: + specs.append('*') + if kwonlyargs: + for kwonlyarg in kwonlyargs: + spec = formatargandannotation(kwonlyarg) + if kwonlydefaults and kwonlyarg in kwonlydefaults: + spec += formatvalue(kwonlydefaults[kwonlyarg]) + specs.append(spec) + if varkw is not None: + specs.append(formatvarkw(formatargandannotation(varkw))) + result = '(' + ', '.join(specs) + ')' + if 'return' in annotations: + result += formatreturns(formatannotation(annotations['return'])) + return result + + +def get_module_callables(mod, ignore=None): + """Returns two maps of (*types*, *funcs*) from *mod*, optionally + ignoring based on the :class:`bool` return value of the *ignore* + callable. *mod* can be a string name of a module in + :data:`sys.modules` or the module instance itself. + """ + if isinstance(mod, str): + mod = sys.modules[mod] + types, funcs = {}, {} + for attr_name in dir(mod): + if ignore and ignore(attr_name): + continue + try: + attr = getattr(mod, attr_name) + except Exception: + continue + try: + attr_mod_name = attr.__module__ + except AttributeError: + continue + if attr_mod_name != mod.__name__: + continue + if isinstance(attr, type): + types[attr_name] = attr + elif callable(attr): + funcs[attr_name] = attr + return types, funcs + + +def mro_items(type_obj): + """Takes a type and returns an iterator over all class variables + throughout the type hierarchy (respecting the MRO). + + >>> sorted(set([k for k, v in mro_items(int) if not k.startswith('__') and 'bytes' not in k and not callable(v)])) + ['denominator', 'imag', 'numerator', 'real'] + """ + # TODO: handle slots? + return itertools.chain.from_iterable(ct.__dict__.items() + for ct in type_obj.__mro__) + + +def dir_dict(obj, raise_exc=False): + """Return a dictionary of attribute names to values for a given + object. Unlike ``obj.__dict__``, this function returns all + attributes on the object, including ones on parent classes. + """ + # TODO: separate function for handling descriptors on types? + ret = {} + for k in dir(obj): + try: + ret[k] = getattr(obj, k) + except Exception: + if raise_exc: + raise + return ret + + +def copy_function(orig, copy_dict=True): + """Returns a shallow copy of the function, including code object, + globals, closure, etc. + + >>> func = lambda: func + >>> func() is func + True + >>> func_copy = copy_function(func) + >>> func_copy() is func + True + >>> func_copy is not func + True + + Args: + orig (function): The function to be copied. Must be a + function, not just any method or callable. + copy_dict (bool): Also copy any attributes set on the function + instance. Defaults to ``True``. + """ + ret = FunctionType(orig.__code__, + orig.__globals__, + name=orig.__name__, + argdefs=getattr(orig, "__defaults__", None), + closure=getattr(orig, "__closure__", None)) + if hasattr(orig, "__kwdefaults__"): + ret.__kwdefaults__ = orig.__kwdefaults__ + if copy_dict: + ret.__dict__.update(orig.__dict__) + return ret + + +def partial_ordering(cls): + """Class decorator, similar to :func:`functools.total_ordering`, + except it is used to define `partial orderings`_ (i.e., it is + possible that *x* is neither greater than, equal to, or less than + *y*). It assumes the presence of the ``__le__()`` and ``__ge__()`` + method, but nothing else. It will not override any existing + additional comparison methods. + + .. _partial orderings: https://en.wikipedia.org/wiki/Partially_ordered_set + + >>> @partial_ordering + ... class MySet(set): + ... def __le__(self, other): + ... return self.issubset(other) + ... def __ge__(self, other): + ... return self.issuperset(other) + ... + >>> a = MySet([1,2,3]) + >>> b = MySet([1,2]) + >>> c = MySet([1,2,4]) + >>> b < a + True + >>> b > a + False + >>> b < c + True + >>> a < c + False + >>> c > a + False + """ + def __lt__(self, other): return self <= other and not self >= other + def __gt__(self, other): return self >= other and not self <= other + def __eq__(self, other): return self >= other and self <= other + + if not hasattr(cls, '__lt__'): cls.__lt__ = __lt__ + if not hasattr(cls, '__gt__'): cls.__gt__ = __gt__ + if not hasattr(cls, '__eq__'): cls.__eq__ = __eq__ + + return cls + + +class InstancePartial(functools.partial): + """:class:`functools.partial` is a huge convenience for anyone + working with Python's great first-class functions. It allows + developers to curry arguments and incrementally create simpler + callables for a variety of use cases. + + Unfortunately there's one big gap in its usefulness: + methods. Partials just don't get bound as methods and + automatically handed a reference to ``self``. The + ``InstancePartial`` type remedies this by inheriting from + :class:`functools.partial` and implementing the necessary + descriptor protocol. There are no other differences in + implementation or usage. :class:`CachedInstancePartial`, below, + has the same ability, but is slightly more efficient. + + """ + @property + def _partialmethod(self): + # py3.13 switched from _partialmethod to __partialmethod__, this is kept for backwards compat <=py3.12 + return self.__partialmethod__ + + @property + def __partialmethod__(self): + return functools.partialmethod(self.func, *self.args, **self.keywords) + + def __get__(self, obj, obj_type): + return MethodType(self, obj) + + + +class CachedInstancePartial(functools.partial): + """The ``CachedInstancePartial`` is virtually the same as + :class:`InstancePartial`, adding support for method-usage to + :class:`functools.partial`, except that upon first access, it + caches the bound method on the associated object, speeding it up + for future accesses, and bringing the method call overhead to + about the same as non-``partial`` methods. + + See the :class:`InstancePartial` docstring for more details. + """ + @property + def _partialmethod(self): + # py3.13 switched from _partialmethod to __partialmethod__, this is kept for backwards compat <=py3.12 + return self.__partialmethod__ + + @property + def __partialmethod__(self): + return functools.partialmethod(self.func, *self.args, **self.keywords) + + def __set_name__(self, obj_type, name): + self.__name__ = name + + def __get__(self, obj, obj_type): + # These assignments could've been in __init__, but there was + # no simple way to do it without breaking one of PyPy or Py3. + self.__name__ = getattr(self, "__name__", None) + self.__doc__ = self.func.__doc__ + self.__module__ = self.func.__module__ + + name = self.__name__ + + if obj is None: + return MethodType(self, obj) + try: + # since this is a data descriptor, this block + # is probably only hit once (per object) + return obj.__dict__[name] + except KeyError: + obj.__dict__[name] = ret = MethodType(self, obj) + return ret + + +partial = CachedInstancePartial + + +def format_invocation(name='', args=(), kwargs=None, **kw): + """Given a name, positional arguments, and keyword arguments, format + a basic Python-style function call. + + >>> print(format_invocation('func', args=(1, 2), kwargs={'c': 3})) + func(1, 2, c=3) + >>> print(format_invocation('a_func', args=(1,))) + a_func(1) + >>> print(format_invocation('kw_func', kwargs=[('a', 1), ('b', 2)])) + kw_func(a=1, b=2) + + """ + _repr = kw.pop('repr', repr) + if kw: + raise TypeError('unexpected keyword args: %r' % ', '.join(kw.keys())) + kwargs = kwargs or {} + a_text = ', '.join([_repr(a) for a in args]) + if isinstance(kwargs, dict): + kwarg_items = [(k, kwargs[k]) for k in sorted(kwargs)] + else: + kwarg_items = kwargs + kw_text = ', '.join([f'{k}={_repr(v)}' for k, v in kwarg_items]) + + all_args_text = a_text + if all_args_text and kw_text: + all_args_text += ', ' + all_args_text += kw_text + + return f'{name}({all_args_text})' + + +def format_exp_repr(obj, pos_names, req_names=None, opt_names=None, opt_key=None): + """Render an expression-style repr of an object, based on attribute + names, which are assumed to line up with arguments to an initializer. + + >>> class Flag(object): + ... def __init__(self, length, width, depth=None): + ... self.length = length + ... self.width = width + ... self.depth = depth + ... + + That's our Flag object, here are some example reprs for it: + + >>> flag = Flag(5, 10) + >>> print(format_exp_repr(flag, ['length', 'width'], [], ['depth'])) + Flag(5, 10) + >>> flag2 = Flag(5, 15, 2) + >>> print(format_exp_repr(flag2, ['length'], ['width', 'depth'])) + Flag(5, width=15, depth=2) + + By picking the pos_names, req_names, opt_names, and opt_key, you + can fine-tune how you want the repr to look. + + Args: + obj (object): The object whose type name will be used and + attributes will be checked + pos_names (list): Required list of attribute names which will be + rendered as positional arguments in the output repr. + req_names (list): List of attribute names which will always + appear in the keyword arguments in the output repr. Defaults to None. + opt_names (list): List of attribute names which may appear in + the keyword arguments in the output repr, provided they pass + the *opt_key* check. Defaults to None. + opt_key (callable): A function or callable which checks whether + an opt_name should be in the repr. Defaults to a + ``None``-check. + + """ + cn = type(obj).__name__ + req_names = req_names or [] + opt_names = opt_names or [] + uniq_names, all_names = set(), [] + for name in req_names + opt_names: + if name in uniq_names: + continue + uniq_names.add(name) + all_names.append(name) + + if opt_key is None: + opt_key = lambda v: v is None + assert callable(opt_key) + + args = [getattr(obj, name, None) for name in pos_names] + + kw_items = [(name, getattr(obj, name, None)) for name in all_names] + kw_items = [(name, val) for name, val in kw_items + if not (name in opt_names and opt_key(val))] + + return format_invocation(cn, args, kw_items) + + +def format_nonexp_repr(obj, req_names=None, opt_names=None, opt_key=None): + """Format a non-expression-style repr + + Some object reprs look like object instantiation, e.g., App(r=[], mw=[]). + + This makes sense for smaller, lower-level objects whose state + roundtrips. But a lot of objects contain values that don't + roundtrip, like types and functions. + + For those objects, there is the non-expression style repr, which + mimic's Python's default style to make a repr like so: + + >>> class Flag(object): + ... def __init__(self, length, width, depth=None): + ... self.length = length + ... self.width = width + ... self.depth = depth + ... + >>> flag = Flag(5, 10) + >>> print(format_nonexp_repr(flag, ['length', 'width'], ['depth'])) + + + If no attributes are specified or set, utilizes the id, not unlike Python's + built-in behavior. + + >>> print(format_nonexp_repr(flag)) + + """ + cn = obj.__class__.__name__ + req_names = req_names or [] + opt_names = opt_names or [] + uniq_names, all_names = set(), [] + for name in req_names + opt_names: + if name in uniq_names: + continue + uniq_names.add(name) + all_names.append(name) + + if opt_key is None: + opt_key = lambda v: v is None + assert callable(opt_key) + + items = [(name, getattr(obj, name, None)) for name in all_names] + labels = [f'{name}={val!r}' for name, val in items + if not (name in opt_names and opt_key(val))] + if not labels: + labels = ['id=%s' % id(obj)] + ret = '<{} {}>'.format(cn, ' '.join(labels)) + return ret + + + +# # # +# # # Function builder +# # # + + +def wraps(func, injected=None, expected=None, **kw): + """Decorator factory to apply update_wrapper() to a wrapper function. + + Modeled after built-in :func:`functools.wraps`. Returns a decorator + that invokes update_wrapper() with the decorated function as the wrapper + argument and the arguments to wraps() as the remaining arguments. + Default arguments are as for update_wrapper(). This is a convenience + function to simplify applying partial() to update_wrapper(). + + Same example as in update_wrapper's doc but with wraps: + + >>> from boltons.funcutils import wraps + >>> + >>> def print_return(func): + ... @wraps(func) + ... def wrapper(*args, **kwargs): + ... ret = func(*args, **kwargs) + ... print(ret) + ... return ret + ... return wrapper + ... + >>> @print_return + ... def example(): + ... '''docstring''' + ... return 'example return value' + >>> + >>> val = example() + example return value + >>> example.__name__ + 'example' + >>> example.__doc__ + 'docstring' + """ + return partial(update_wrapper, func=func, build_from=None, + injected=injected, expected=expected, **kw) + + +def update_wrapper(wrapper, func, injected=None, expected=None, build_from=None, **kw): + """Modeled after the built-in :func:`functools.update_wrapper`, + this function is used to make your wrapper function reflect the + wrapped function's: + + * Name + * Documentation + * Module + * Signature + + The built-in :func:`functools.update_wrapper` copies the first three, but + does not copy the signature. This version of ``update_wrapper`` can copy + the inner function's signature exactly, allowing seamless usage + and :mod:`introspection `. Usage is identical to the + built-in version:: + + >>> from boltons.funcutils import update_wrapper + >>> + >>> def print_return(func): + ... def wrapper(*args, **kwargs): + ... ret = func(*args, **kwargs) + ... print(ret) + ... return ret + ... return update_wrapper(wrapper, func) + ... + >>> @print_return + ... def example(): + ... '''docstring''' + ... return 'example return value' + >>> + >>> val = example() + example return value + >>> example.__name__ + 'example' + >>> example.__doc__ + 'docstring' + + In addition, the boltons version of update_wrapper supports + modifying the outer signature. By passing a list of + *injected* argument names, those arguments will be removed from + the outer wrapper's signature, allowing your decorator to provide + arguments that aren't passed in. + + Args: + + wrapper (function) : The callable to which the attributes of + *func* are to be copied. + func (function): The callable whose attributes are to be copied. + injected (list): An optional list of argument names which + should not appear in the new wrapper's signature. + expected (list): An optional list of argument names (or (name, + default) pairs) representing new arguments introduced by + the wrapper (the opposite of *injected*). See + :meth:`FunctionBuilder.add_arg()` for more details. + build_from (function): The callable from which the new wrapper + is built. Defaults to *func*, unless *wrapper* is partial object + built from *func*, in which case it defaults to *wrapper*. + Useful in some specific cases where *wrapper* and *func* have the + same arguments but differ on which are keyword-only and positional-only. + update_dict (bool): Whether to copy other, non-standard + attributes of *func* over to the wrapper. Defaults to True. + inject_to_varkw (bool): Ignore missing arguments when a + ``**kwargs``-type catch-all is present. Defaults to True. + hide_wrapped (bool): Remove reference to the wrapped function(s) + in the updated function. + + In opposition to the built-in :func:`functools.update_wrapper` bolton's + version returns a copy of the function and does not modify anything in place. + For more in-depth wrapping of functions, see the + :class:`FunctionBuilder` type, on which update_wrapper was built. + """ + if injected is None: + injected = [] + elif isinstance(injected, str): + injected = [injected] + else: + injected = list(injected) + + expected_items = _parse_wraps_expected(expected) + + if isinstance(func, (classmethod, staticmethod)): + raise TypeError('wraps does not support wrapping classmethods and' + ' staticmethods, change the order of wrapping to' + ' wrap the underlying function: %r' + % (getattr(func, '__func__', None),)) + + update_dict = kw.pop('update_dict', True) + inject_to_varkw = kw.pop('inject_to_varkw', True) + hide_wrapped = kw.pop('hide_wrapped', False) + if kw: + raise TypeError('unexpected kwargs: %r' % kw.keys()) + + if isinstance(wrapper, functools.partial) and func is wrapper.func: + build_from = build_from or wrapper + + fb = FunctionBuilder.from_func(build_from or func) + + for arg in injected: + try: + fb.remove_arg(arg) + except MissingArgument: + if inject_to_varkw and fb.varkw is not None: + continue # keyword arg will be caught by the varkw + raise + + for arg, default in expected_items: + fb.add_arg(arg, default) # may raise ExistingArgument + + if fb.is_async: + fb.body = 'return await _call(%s)' % fb.get_invocation_str() + else: + fb.body = 'return _call(%s)' % fb.get_invocation_str() + + execdict = dict(_call=wrapper, _func=func) + fully_wrapped = fb.get_func(execdict, with_dict=update_dict) + + if hide_wrapped and hasattr(fully_wrapped, '__wrapped__'): + del fully_wrapped.__dict__['__wrapped__'] + elif not hide_wrapped: + fully_wrapped.__wrapped__ = func # ref to the original function (#115) + + return fully_wrapped + + +def _parse_wraps_expected(expected): + # expected takes a pretty powerful argument, it's processed + # here. admittedly this would be less trouble if I relied on + # OrderedDict (there's an impl of that in the commit history if + # you look + if expected is None: + expected = [] + elif isinstance(expected, str): + expected = [(expected, NO_DEFAULT)] + + expected_items = [] + try: + expected_iter = iter(expected) + except TypeError as e: + raise ValueError('"expected" takes string name, sequence of string names,' + ' iterable of (name, default) pairs, or a mapping of ' + ' {name: default}, not %r (got: %r)' % (expected, e)) + for argname in expected_iter: + if isinstance(argname, str): + # dict keys and bare strings + try: + default = expected[argname] + except TypeError: + default = NO_DEFAULT + else: + # pairs + try: + argname, default = argname + except (TypeError, ValueError): + raise ValueError('"expected" takes string name, sequence of string names,' + ' iterable of (name, default) pairs, or a mapping of ' + ' {name: default}, not %r') + if not isinstance(argname, str): + raise ValueError(f'all "expected" argnames must be strings, not {argname!r}') + + expected_items.append((argname, default)) + + return expected_items + + +class FunctionBuilder: + """The FunctionBuilder type provides an interface for programmatically + creating new functions, either based on existing functions or from + scratch. + + Values are passed in at construction or set as attributes on the + instance. For creating a new function based of an existing one, + see the :meth:`~FunctionBuilder.from_func` classmethod. At any + point, :meth:`~FunctionBuilder.get_func` can be called to get a + newly compiled function, based on the values configured. + + >>> fb = FunctionBuilder('return_five', doc='returns the integer 5', + ... body='return 5') + >>> f = fb.get_func() + >>> f() + 5 + >>> fb.varkw = 'kw' + >>> f_kw = fb.get_func() + >>> f_kw(ignored_arg='ignored_val') + 5 + + Note that function signatures themselves changed quite a bit in + Python 3, so several arguments are only applicable to + FunctionBuilder in Python 3. Except for *name*, all arguments to + the constructor are keyword arguments. + + Args: + name (str): Name of the function. + doc (str): `Docstring`_ for the function, defaults to empty. + module (str): Name of the module from which this function was + imported. Defaults to None. + body (str): String version of the code representing the body + of the function. Defaults to ``'pass'``, which will result + in a function which does nothing and returns ``None``. + args (list): List of argument names, defaults to empty list, + denoting no arguments. + varargs (str): Name of the catch-all variable for positional + arguments. E.g., "args" if the resultant function is to have + ``*args`` in the signature. Defaults to None. + varkw (str): Name of the catch-all variable for keyword + arguments. E.g., "kwargs" if the resultant function is to have + ``**kwargs`` in the signature. Defaults to None. + defaults (tuple): A tuple containing default argument values for + those arguments that have defaults. + kwonlyargs (list): Argument names which are only valid as + keyword arguments. **Python 3 only.** + kwonlydefaults (dict): A mapping, same as normal *defaults*, + but only for the *kwonlyargs*. **Python 3 only.** + annotations (dict): Mapping of type hints and so + forth. **Python 3 only.** + filename (str): The filename that will appear in + tracebacks. Defaults to "boltons.funcutils.FunctionBuilder". + indent (int): Number of spaces with which to indent the + function *body*. Values less than 1 will result in an error. + dict (dict): Any other attributes which should be added to the + functions compiled with this FunctionBuilder. + + All of these arguments are also made available as attributes which + can be mutated as necessary. + + .. _Docstring: https://en.wikipedia.org/wiki/Docstring#Python + + """ + + _argspec_defaults = {'args': list, + 'varargs': lambda: None, + 'varkw': lambda: None, + 'defaults': lambda: None, + 'kwonlyargs': list, + 'kwonlydefaults': dict, + 'annotations': dict} + + @classmethod + def _argspec_to_dict(cls, f): + argspec = inspect.getfullargspec(f) + return {attr: getattr(argspec, attr) + for attr in cls._argspec_defaults} + + _defaults = {'doc': str, + 'dict': dict, + 'is_async': lambda: False, + 'module': lambda: None, + 'body': lambda: 'pass', + 'indent': lambda: 4, + "annotations": dict, + 'filename': lambda: 'boltons.funcutils.FunctionBuilder'} + + _defaults.update(_argspec_defaults) + + _compile_count = itertools.count() + + def __init__(self, name, **kw): + self.name = name + for a, default_factory in self._defaults.items(): + val = kw.pop(a, None) + if val is None: + val = default_factory() + setattr(self, a, val) + + if kw: + raise TypeError('unexpected kwargs: %r' % kw.keys()) + return + + # def get_argspec(self): # TODO + + def get_sig_str(self, with_annotations=True): + """Return function signature as a string. + + with_annotations is ignored on Python 2. On Python 3 signature + will omit annotations if it is set to False. + """ + if with_annotations: + annotations = self.annotations + else: + annotations = {} + + return inspect_formatargspec(self.args, + self.varargs, + self.varkw, + [], + self.kwonlyargs, + {}, + annotations) + + _KWONLY_MARKER = re.compile(r""" + \* # a star + \s* # followed by any amount of whitespace + , # followed by a comma + \s* # followed by any amount of whitespace + """, re.VERBOSE) + + def get_invocation_str(self): + kwonly_pairs = None + formatters = {} + if self.kwonlyargs: + kwonly_pairs = {arg: arg + for arg in self.kwonlyargs} + formatters['formatvalue'] = lambda value: '=' + value + + sig = inspect_formatargspec(self.args, + self.varargs, + self.varkw, + [], + kwonly_pairs, + kwonly_pairs, + {}, + **formatters) + sig = self._KWONLY_MARKER.sub('', sig) + return sig[1:-1] + + @classmethod + def from_func(cls, func): + """Create a new FunctionBuilder instance based on an existing + function. The original function will not be stored or + modified. + """ + # TODO: copy_body? gonna need a good signature regex. + # TODO: might worry about __closure__? + if not callable(func): + raise TypeError(f'expected callable object, not {func!r}') + + if isinstance(func, functools.partial): + kwargs = {'name': func.func.__name__, + 'doc': func.func.__doc__, + 'module': getattr(func.func, '__module__', None), # e.g., method_descriptor + 'annotations': getattr(func.func, "__annotations__", {}), + 'dict': getattr(func.func, '__dict__', {})} + else: + kwargs = {'name': func.__name__, + 'doc': func.__doc__, + 'module': getattr(func, '__module__', None), # e.g., method_descriptor + 'annotations': getattr(func, "__annotations__", {}), + 'dict': getattr(func, '__dict__', {})} + + kwargs.update(cls._argspec_to_dict(func)) + + if inspect.iscoroutinefunction(func): + kwargs['is_async'] = True + + return cls(**kwargs) + + def get_func(self, execdict=None, add_source=True, with_dict=True): + """Compile and return a new function based on the current values of + the FunctionBuilder. + + Args: + execdict (dict): The dictionary representing the scope in + which the compilation should take place. Defaults to an empty + dict. + add_source (bool): Whether to add the source used to a + special ``__source__`` attribute on the resulting + function. Defaults to True. + with_dict (bool): Add any custom attributes, if + applicable. Defaults to True. + + To see an example of usage, see the implementation of + :func:`~boltons.funcutils.wraps`. + """ + execdict = execdict or {} + body = self.body or self._default_body + + tmpl = 'def {name}{sig_str}:' + tmpl += '\n{body}' + + if self.is_async: + tmpl = 'async ' + tmpl + + body = _indent(self.body, ' ' * self.indent) + + name = self.name.replace('<', '_').replace('>', '_') # lambdas + src = tmpl.format(name=name, sig_str=self.get_sig_str(with_annotations=False), + doc=self.doc, body=body) + self._compile(src, execdict) + func = execdict[name] + + func.__name__ = self.name + func.__doc__ = self.doc + func.__defaults__ = self.defaults + func.__kwdefaults__ = self.kwonlydefaults + func.__annotations__ = self.annotations + + if with_dict: + func.__dict__.update(self.dict) + func.__module__ = self.module + # TODO: caller module fallback? + + if add_source: + func.__source__ = src + + return func + + def get_defaults_dict(self): + """Get a dictionary of function arguments with defaults and the + respective values. + """ + ret = dict(reversed(list(zip(reversed(self.args), + reversed(self.defaults or []))))) + kwonlydefaults = getattr(self, 'kwonlydefaults', None) + if kwonlydefaults: + ret.update(kwonlydefaults) + return ret + + def get_arg_names(self, only_required=False): + arg_names = tuple(self.args) + tuple(getattr(self, 'kwonlyargs', ())) + if only_required: + defaults_dict = self.get_defaults_dict() + arg_names = tuple([an for an in arg_names if an not in defaults_dict]) + return arg_names + + def add_arg(self, arg_name, default=NO_DEFAULT, kwonly=False): + """Add an argument with optional *default* (defaults to + ``funcutils.NO_DEFAULT``). Pass *kwonly=True* to add a + keyword-only argument + """ + if arg_name in self.args: + raise ExistingArgument(f'arg {arg_name!r} already in func {self.name} arg list') + if arg_name in self.kwonlyargs: + raise ExistingArgument(f'arg {arg_name!r} already in func {self.name} kwonly arg list') + if not kwonly: + self.args.append(arg_name) + if default is not NO_DEFAULT: + self.defaults = (self.defaults or ()) + (default,) + else: + self.kwonlyargs.append(arg_name) + if default is not NO_DEFAULT: + self.kwonlydefaults[arg_name] = default + + def remove_arg(self, arg_name): + """Remove an argument from this FunctionBuilder's argument list. The + resulting function will have one less argument per call to + this function. + + Args: + arg_name (str): The name of the argument to remove. + + Raises a :exc:`ValueError` if the argument is not present. + + """ + args = self.args + d_dict = self.get_defaults_dict() + try: + args.remove(arg_name) + except ValueError: + try: + self.kwonlyargs.remove(arg_name) + except (AttributeError, ValueError): + # missing from both + exc = MissingArgument('arg %r not found in %s argument list:' + ' %r' % (arg_name, self.name, args)) + exc.arg_name = arg_name + raise exc + else: + self.kwonlydefaults.pop(arg_name, None) + else: + d_dict.pop(arg_name, None) + self.defaults = tuple([d_dict[a] for a in args if a in d_dict]) + return + + def _compile(self, src, execdict): + + filename = ('<%s-%d>' + % (self.filename, next(self._compile_count),)) + try: + code = compile(src, filename, 'single') + exec(code, execdict) + except Exception: + raise + return execdict + + +class MissingArgument(ValueError): + pass + + +class ExistingArgument(ValueError): + pass + + +def _indent(text, margin, newline='\n', key=bool): + "based on boltons.strutils.indent" + indented_lines = [(margin + line if key(line) else line) + for line in text.splitlines()] + return newline.join(indented_lines) + + +def noop(*args, **kwargs): + """ + Simple function that should be used when no effect is desired. + An alternative to checking for an optional function type parameter. + + e.g. + def decorate(func, pre_func=None, post_func=None): + if pre_func: + pre_func() + func() + if post_func: + post_func() + + vs + + def decorate(func, pre_func=noop, post_func=noop): + pre_func() + func() + post_func() + """ + return None + +# end funcutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/gcutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/gcutils.py new file mode 100644 index 0000000000000000000000000000000000000000..1db18b462ae47ec4a53ba990634d539b1cfe1c8e --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/gcutils.py @@ -0,0 +1,164 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""The Python Garbage Collector (`GC`_) doesn't usually get too much +attention, probably because: + + - Python's `reference counting`_ effectively handles the vast majority of + unused objects + - People are slowly learning to avoid implementing `object.__del__()`_ + - The collection itself strikes a good balance between simplicity and + power (`tunable generation sizes`_) + - The collector itself is fast and rarely the cause of long pauses + associated with GC in other runtimes + +Even so, for many applications, the time will come when the developer +will need to track down: + + - Circular references + - Misbehaving objects (locks, ``__del__()``) + - Memory leaks + - Or just ways to shave off a couple percent of execution time + +Thanks to the :mod:`gc` module, the GC is a well-instrumented entry +point for exactly these tasks, and ``gcutils`` aims to facilitate it +further. + +.. _GC: https://docs.python.org/2/glossary.html#term-garbage-collection +.. _reference counting: https://docs.python.org/2/glossary.html#term-reference-count +.. _object.__del__(): https://docs.python.org/2/glossary.html#term-reference-count +.. _tunable generation sizes: https://docs.python.org/2/library/gc.html#gc.set_threshold +""" +# TODO: type survey + + +import gc +import sys + +__all__ = ['get_all', 'GCToggler', 'toggle_gc', 'toggle_gc_postcollect'] + + +def get_all(type_obj, include_subtypes=True): + """Get a list containing all instances of a given type. This will + work for the vast majority of types out there. + + >>> class Ratking(object): pass + >>> wiki, hak, sport = Ratking(), Ratking(), Ratking() + >>> len(get_all(Ratking)) + 3 + + However, there are some exceptions. For example, ``get_all(bool)`` + returns an empty list because ``True`` and ``False`` are + themselves built-in and not tracked. + + >>> get_all(bool) + [] + + Still, it's not hard to see how this functionality can be used to + find all instances of a leaking type and track them down further + using :func:`gc.get_referrers` and :func:`gc.get_referents`. + + ``get_all()`` is optimized such that getting instances of + user-created types is quite fast. Setting *include_subtypes* to + ``False`` will further increase performance in cases where + instances of subtypes aren't required. + + .. note:: + + There are no guarantees about the state of objects returned by + ``get_all()``, especially in concurrent environments. For + instance, it is possible for an object to be in the middle of + executing its ``__init__()`` and be only partially constructed. + """ + # TODO: old-style classes + if not isinstance(type_obj, type): + raise TypeError('expected a type, not %r' % type_obj) + try: + type_is_tracked = gc.is_tracked(type_obj) + except AttributeError: + type_is_tracked = False # Python 2.6 and below don't get the speedup + if type_is_tracked: + to_check = gc.get_referrers(type_obj) + else: + to_check = gc.get_objects() + + if include_subtypes: + ret = [x for x in to_check if isinstance(x, type_obj)] + else: + ret = [x for x in to_check if type(x) is type_obj] + return ret + + +_IS_PYPY = '__pypy__' in sys.builtin_module_names +if _IS_PYPY: + # pypy's gc is just different, y'all + del get_all + + +class GCToggler: + """The ``GCToggler`` is a context-manager that allows one to safely + take more control of your garbage collection schedule. Anecdotal + experience says certain object-creation-heavy tasks see speedups + of around 10% by simply doing one explicit collection at the very + end, especially if most of the objects will stay resident. + + Two GCTogglers are already present in the ``gcutils`` module: + + - :data:`toggle_gc` simply turns off GC at context entrance, and + re-enables at exit + - :data:`toggle_gc_postcollect` does the same, but triggers an + explicit collection after re-enabling. + + >>> with toggle_gc: + ... x = [object() for i in range(1000)] + + Between those two instances, the ``GCToggler`` type probably won't + be used much directly, but is documented for inheritance purposes. + """ + def __init__(self, postcollect=False): + self.postcollect = postcollect + + def __enter__(self): + gc.disable() + + def __exit__(self, exc_type, exc_val, exc_tb): + gc.enable() + if self.postcollect: + gc.collect() + + +toggle_gc = GCToggler() +"""A context manager for disabling GC for a code block. See +:class:`GCToggler` for more details.""" + + +toggle_gc_postcollect = GCToggler(postcollect=True) +"""A context manager for disabling GC for a code block, and collecting +before re-enabling. See :class:`GCToggler` for more details.""" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/ioutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/ioutils.py new file mode 100644 index 0000000000000000000000000000000000000000..bfcaf3fc1923eedf788b4fb403d699f7743d8d09 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/ioutils.py @@ -0,0 +1,587 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Coding decl above needed for rendering the emdash properly in the +# documentation. + +""" +Module ``ioutils`` implements a number of helper classes and functions which +are useful when dealing with input, output, and bytestreams in a variety of +ways. +""" +import os +from io import BytesIO, IOBase +from abc import ( + ABCMeta, + abstractmethod, + abstractproperty, +) +from errno import EINVAL +from codecs import EncodedFile +from tempfile import TemporaryFile +from itertools import zip_longest + +READ_CHUNK_SIZE = 21333 +""" +Number of bytes to read at a time. The value is ~ 1/3rd of 64k which means that +the value will easily fit in the L2 cache of most processors even if every +codepoint in a string is three bytes long which makes it a nice fast default +value. +""" + + +class SpooledIOBase(IOBase): + """ + A base class shared by the SpooledBytesIO and SpooledStringIO classes. + + The SpooledTemporaryFile class is missing several attributes and methods + present in the StringIO implementation. This brings the api as close to + parity as possible so that classes derived from SpooledIOBase can be used + as near drop-in replacements to save memory. + """ + __metaclass__ = ABCMeta + + def __init__(self, max_size=5000000, dir=None): + self._max_size = max_size + self._dir = dir + + def _checkClosed(self, msg=None): + """Raise a ValueError if file is closed""" + if self.closed: + raise ValueError('I/O operation on closed file.' + if msg is None else msg) + @abstractmethod + def read(self, n=-1): + """Read n characters from the buffer""" + + @abstractmethod + def write(self, s): + """Write into the buffer""" + + @abstractmethod + def seek(self, pos, mode=0): + """Seek to a specific point in a file""" + + @abstractmethod + def readline(self, length=None): + """Returns the next available line""" + + @abstractmethod + def readlines(self, sizehint=0): + """Returns a list of all lines from the current position forward""" + + def writelines(self, lines): + """ + Write lines to the file from an interable. + + NOTE: writelines() does NOT add line separators. + """ + self._checkClosed() + for line in lines: + self.write(line) + + @abstractmethod + def rollover(self): + """Roll file-like-object over into a real temporary file""" + + @abstractmethod + def tell(self): + """Return the current position""" + + @abstractproperty + def buffer(self): + """Should return a flo instance""" + + @abstractproperty + def _rolled(self): + """Returns whether the file has been rolled to a real file or not""" + + @abstractproperty + def len(self): + """Returns the length of the data""" + + def _get_softspace(self): + return self.buffer.softspace + + def _set_softspace(self, val): + self.buffer.softspace = val + + softspace = property(_get_softspace, _set_softspace) + + @property + def _file(self): + return self.buffer + + def close(self): + return self.buffer.close() + + def flush(self): + self._checkClosed() + return self.buffer.flush() + + def isatty(self): + self._checkClosed() + return self.buffer.isatty() + + @property + def closed(self): + return self.buffer.closed + + @property + def pos(self): + return self.tell() + + @property + def buf(self): + return self.getvalue() + + def fileno(self): + self.rollover() + return self.buffer.fileno() + + def truncate(self, size=None): + """ + Truncate the contents of the buffer. + + Custom version of truncate that takes either no arguments (like the + real SpooledTemporaryFile) or a single argument that truncates the + value to a certain index location. + """ + self._checkClosed() + if size is None: + return self.buffer.truncate() + + if size < 0: + raise OSError(EINVAL, "Negative size not allowed") + + # Emulate truncation to a particular location + pos = self.tell() + self.seek(size) + self.buffer.truncate() + if pos < size: + self.seek(pos) + + def getvalue(self): + """Return the entire files contents.""" + self._checkClosed() + pos = self.tell() + self.seek(0) + val = self.read() + self.seek(pos) + return val + + def seekable(self): + return True + + def readable(self): + return True + + def writable(self): + return True + + def __next__(self): + self._checkClosed() + line = self.readline() + if not line: + pos = self.buffer.tell() + self.buffer.seek(0, os.SEEK_END) + if pos == self.buffer.tell(): + raise StopIteration + else: + self.buffer.seek(pos) + return line + + next = __next__ + + def __len__(self): + return self.len + + def __iter__(self): + self._checkClosed() + return self + + def __enter__(self): + self._checkClosed() + return self + + def __exit__(self, *args): + self._file.close() + + def __eq__(self, other): + if isinstance(other, self.__class__): + self_pos = self.tell() + other_pos = other.tell() + try: + self.seek(0) + other.seek(0) + eq = True + for self_line, other_line in zip_longest(self, other): + if self_line != other_line: + eq = False + break + self.seek(self_pos) + other.seek(other_pos) + except Exception: + # Attempt to return files to original position if there were any errors + try: + self.seek(self_pos) + except Exception: + pass + try: + other.seek(other_pos) + except Exception: + pass + raise + else: + return eq + return False + + def __ne__(self, other): + return not self.__eq__(other) + + def __bool__(self): + return True + + def __del__(self): + """Can fail when called at program exit so suppress traceback.""" + try: + self.close() + except Exception: + pass + + +class SpooledBytesIO(SpooledIOBase): + """ + SpooledBytesIO is a spooled file-like-object that only accepts bytes. On + Python 2.x this means the 'str' type; on Python 3.x this means the 'bytes' + type. Bytes are written in and retrieved exactly as given, but it will + raise TypeErrors if something other than bytes are written. + + Example:: + + >>> from boltons import ioutils + >>> with ioutils.SpooledBytesIO() as f: + ... f.write(b"Happy IO") + ... _ = f.seek(0) + ... isinstance(f.getvalue(), bytes) + True + """ + + def read(self, n=-1): + self._checkClosed() + return self.buffer.read(n) + + def write(self, s): + self._checkClosed() + if not isinstance(s, bytes): + raise TypeError("bytes expected, got {}".format( + type(s).__name__ + )) + + if self.tell() + len(s) >= self._max_size: + self.rollover() + self.buffer.write(s) + + def seek(self, pos, mode=0): + self._checkClosed() + return self.buffer.seek(pos, mode) + + def readline(self, length=None): + self._checkClosed() + if length: + return self.buffer.readline(length) + else: + return self.buffer.readline() + + def readlines(self, sizehint=0): + return self.buffer.readlines(sizehint) + + def rollover(self): + """Roll the StringIO over to a TempFile""" + if not self._rolled: + tmp = TemporaryFile(dir=self._dir) + pos = self.buffer.tell() + tmp.write(self.buffer.getvalue()) + tmp.seek(pos) + self.buffer.close() + self._buffer = tmp + + @property + def _rolled(self): + return not isinstance(self.buffer, BytesIO) + + @property + def buffer(self): + try: + return self._buffer + except AttributeError: + self._buffer = BytesIO() + return self._buffer + + @property + def len(self): + """Determine the length of the file""" + pos = self.tell() + if self._rolled: + self.seek(0) + val = os.fstat(self.fileno()).st_size + else: + self.seek(0, os.SEEK_END) + val = self.tell() + self.seek(pos) + return val + + def tell(self): + self._checkClosed() + return self.buffer.tell() + + +class SpooledStringIO(SpooledIOBase): + """ + SpooledStringIO is a spooled file-like-object that only accepts unicode + values. On Python 2.x this means the 'unicode' type and on Python 3.x this + means the 'str' type. Values are accepted as unicode and then coerced into + utf-8 encoded bytes for storage. On retrieval, the values are returned as + unicode. + + Example:: + + >>> from boltons import ioutils + >>> with ioutils.SpooledStringIO() as f: + ... f.write(u"\u2014 Hey, an emdash!") + ... _ = f.seek(0) + ... isinstance(f.read(), str) + True + + """ + def __init__(self, *args, **kwargs): + self._tell = 0 + super().__init__(*args, **kwargs) + + def read(self, n=-1): + self._checkClosed() + ret = self.buffer.reader.read(n, n) + self._tell = self.tell() + len(ret) + return ret + + def write(self, s): + self._checkClosed() + if not isinstance(s, str): + raise TypeError("str expected, got {}".format( + type(s).__name__ + )) + current_pos = self.tell() + if self.buffer.tell() + len(s.encode('utf-8')) >= self._max_size: + self.rollover() + self.buffer.write(s.encode('utf-8')) + self._tell = current_pos + len(s) + + def _traverse_codepoints(self, current_position, n): + """Traverse from current position to the right n codepoints""" + dest = current_position + n + while True: + if current_position == dest: + # By chance we've landed on the right position, break + break + + # If the read would take us past the intended position then + # seek only enough to cover the offset + if current_position + READ_CHUNK_SIZE > dest: + self.read(dest - current_position) + break + else: + ret = self.read(READ_CHUNK_SIZE) + + # Increment our current position + current_position += READ_CHUNK_SIZE + + # If we kept reading but there was nothing here, break + # as we are at the end of the file + if not ret: + break + + return dest + + def seek(self, pos, mode=0): + """Traverse from offset to the specified codepoint""" + self._checkClosed() + # Seek to position from the start of the file + if mode == os.SEEK_SET: + self.buffer.seek(0) + self._traverse_codepoints(0, pos) + self._tell = pos + # Seek to new position relative to current position + elif mode == os.SEEK_CUR: + start_pos = self.tell() + self._traverse_codepoints(self.tell(), pos) + self._tell = start_pos + pos + elif mode == os.SEEK_END: + self.buffer.seek(0) + dest_position = self.len - pos + self._traverse_codepoints(0, dest_position) + self._tell = dest_position + else: + raise ValueError( + f"Invalid whence ({mode}, should be 0, 1, or 2)" + ) + return self.tell() + + def readline(self, length=None): + self._checkClosed() + ret = self.buffer.readline(length).decode('utf-8') + self._tell = self.tell() + len(ret) + return ret + + def readlines(self, sizehint=0): + ret = [x.decode('utf-8') for x in self.buffer.readlines(sizehint)] + self._tell = self.tell() + sum(len(x) for x in ret) + return ret + + @property + def buffer(self): + try: + return self._buffer + except AttributeError: + self._buffer = EncodedFile(BytesIO(), data_encoding='utf-8') + return self._buffer + + @property + def _rolled(self): + return not isinstance(self.buffer.stream, BytesIO) + + def rollover(self): + """Roll the buffer over to a TempFile""" + if not self._rolled: + tmp = EncodedFile(TemporaryFile(dir=self._dir), + data_encoding='utf-8') + pos = self.buffer.tell() + tmp.write(self.buffer.getvalue()) + tmp.seek(pos) + self.buffer.close() + self._buffer = tmp + + def tell(self): + """Return the codepoint position""" + self._checkClosed() + return self._tell + + @property + def len(self): + """Determine the number of codepoints in the file""" + pos = self.buffer.tell() + self.buffer.seek(0) + total = 0 + while True: + ret = self.read(READ_CHUNK_SIZE) + if not ret: + break + total += len(ret) + self.buffer.seek(pos) + return total + + +def is_text_fileobj(fileobj): + if getattr(fileobj, 'encoding', False): + # codecs.open and io.TextIOBase + return True + if getattr(fileobj, 'getvalue', False): + # StringIO.StringIO / io.StringIO + try: + if isinstance(fileobj.getvalue(), str): + return True + except Exception: + pass + return False + + +class MultiFileReader: + """Takes a list of open files or file-like objects and provides an + interface to read from them all contiguously. Like + :func:`itertools.chain()`, but for reading files. + + >>> mfr = MultiFileReader(BytesIO(b'ab'), BytesIO(b'cd'), BytesIO(b'e')) + >>> mfr.read(3).decode('ascii') + u'abc' + >>> mfr.read(3).decode('ascii') + u'de' + + The constructor takes as many fileobjs as you hand it, and will + raise a TypeError on non-file-like objects. A ValueError is raised + when file-like objects are a mix of bytes- and text-handling + objects (for instance, BytesIO and StringIO). + """ + + def __init__(self, *fileobjs): + if not all([callable(getattr(f, 'read', None)) and + callable(getattr(f, 'seek', None)) for f in fileobjs]): + raise TypeError('MultiFileReader expected file-like objects' + ' with .read() and .seek()') + if all([is_text_fileobj(f) for f in fileobjs]): + # codecs.open and io.TextIOBase + self._joiner = '' + elif any([is_text_fileobj(f) for f in fileobjs]): + raise ValueError('All arguments to MultiFileReader must handle' + ' bytes OR text, not a mix') + else: + # open/file and io.BytesIO + self._joiner = b'' + self._fileobjs = fileobjs + self._index = 0 + + def read(self, amt=None): + """Read up to the specified *amt*, seamlessly bridging across + files. Returns the appropriate type of string (bytes or text) + for the input, and returns an empty string when the files are + exhausted. + """ + if not amt: + return self._joiner.join(f.read() for f in self._fileobjs) + parts = [] + while amt > 0 and self._index < len(self._fileobjs): + parts.append(self._fileobjs[self._index].read(amt)) + got = len(parts[-1]) + if got < amt: + self._index += 1 + amt -= got + return self._joiner.join(parts) + + def seek(self, offset, whence=os.SEEK_SET): + """Enables setting position of the file cursor to a given + *offset*. Currently only supports ``offset=0``. + """ + if whence != os.SEEK_SET: + raise NotImplementedError( + 'MultiFileReader.seek() only supports os.SEEK_SET') + if offset != 0: + raise NotImplementedError( + 'MultiFileReader only supports seeking to start at this time') + for f in self._fileobjs: + f.seek(0) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/iterutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/iterutils.py new file mode 100644 index 0000000000000000000000000000000000000000..e0a5b900173d93689acf0e6b09dd75d87924da5b --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/iterutils.py @@ -0,0 +1,1609 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""":mod:`itertools` is full of great examples of Python generator +usage. However, there are still some critical gaps. ``iterutils`` +fills many of those gaps with featureful, tested, and Pythonic +solutions. + +Many of the functions below have two versions, one which +returns an iterator (denoted by the ``*_iter`` naming pattern), and a +shorter-named convenience form that returns a list. Some of the +following are based on examples in itertools docs. +""" + +import os +import math +import time +import codecs +import random +import itertools +from itertools import zip_longest +from collections.abc import Mapping, Sequence, Set, ItemsView, Iterable + + +try: + from .typeutils import make_sentinel + _UNSET = make_sentinel('_UNSET') + _REMAP_EXIT = make_sentinel('_REMAP_EXIT') +except ImportError: + _REMAP_EXIT = object() + _UNSET = object() + + +def is_iterable(obj): + """Similar in nature to :func:`callable`, ``is_iterable`` returns + ``True`` if an object is `iterable`_, ``False`` if not. + + >>> is_iterable([]) + True + >>> is_iterable(object()) + False + + .. _iterable: https://docs.python.org/2/glossary.html#term-iterable + """ + try: + iter(obj) + except TypeError: + return False + return True + + +def is_scalar(obj): + """A near-mirror of :func:`is_iterable`. Returns ``False`` if an + object is an iterable container type. Strings are considered + scalar as well, because strings are more often treated as whole + values as opposed to iterables of 1-character substrings. + + >>> is_scalar(object()) + True + >>> is_scalar(range(10)) + False + >>> is_scalar('hello') + True + """ + return not is_iterable(obj) or isinstance(obj, (str, bytes)) + + +def is_collection(obj): + """The opposite of :func:`is_scalar`. Returns ``True`` if an object + is an iterable other than a string. + + >>> is_collection(object()) + False + >>> is_collection(range(10)) + True + >>> is_collection('hello') + False + """ + return is_iterable(obj) and not isinstance(obj, (str, bytes)) + + +def split(src, sep=None, maxsplit=None): + """Splits an iterable based on a separator. Like :meth:`str.split`, + but for all iterables. Returns a list of lists. + + >>> split(['hi', 'hello', None, None, 'sup', None, 'soap', None]) + [['hi', 'hello'], ['sup'], ['soap']] + + See :func:`split_iter` docs for more info. + """ + return list(split_iter(src, sep, maxsplit)) + + +def split_iter(src, sep=None, maxsplit=None): + """Splits an iterable based on a separator, *sep*, a max of + *maxsplit* times (no max by default). *sep* can be: + + * a single value + * an iterable of separators + * a single-argument callable that returns True when a separator is + encountered + + ``split_iter()`` yields lists of non-separator values. A separator will + never appear in the output. + + >>> list(split_iter(['hi', 'hello', None, None, 'sup', None, 'soap', None])) + [['hi', 'hello'], ['sup'], ['soap']] + + Note that ``split_iter`` is based on :func:`str.split`, so if + *sep* is ``None``, ``split()`` **groups** separators. If empty lists + are desired between two contiguous ``None`` values, simply use + ``sep=[None]``: + + >>> list(split_iter(['hi', 'hello', None, None, 'sup', None])) + [['hi', 'hello'], ['sup']] + >>> list(split_iter(['hi', 'hello', None, None, 'sup', None], sep=[None])) + [['hi', 'hello'], [], ['sup'], []] + + Using a callable separator: + + >>> falsy_sep = lambda x: not x + >>> list(split_iter(['hi', 'hello', None, '', 'sup', False], falsy_sep)) + [['hi', 'hello'], [], ['sup'], []] + + See :func:`split` for a list-returning version. + + """ + if not is_iterable(src): + raise TypeError('expected an iterable') + + if maxsplit is not None: + maxsplit = int(maxsplit) + if maxsplit == 0: + yield [src] + return + + if callable(sep): + sep_func = sep + elif not is_scalar(sep): + sep = frozenset(sep) + def sep_func(x): return x in sep + else: + def sep_func(x): return x == sep + + cur_group = [] + split_count = 0 + for s in src: + if maxsplit is not None and split_count >= maxsplit: + def sep_func(x): return False + if sep_func(s): + if sep is None and not cur_group: + # If sep is none, str.split() "groups" separators + # check the str.split() docs for more info + continue + split_count += 1 + yield cur_group + cur_group = [] + else: + cur_group.append(s) + + if cur_group or sep is not None: + yield cur_group + return + + +def lstrip(iterable, strip_value=None): + """Strips values from the beginning of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.lstrip. Returns a list. + + >>> lstrip(['Foo', 'Bar', 'Bam'], 'Foo') + ['Bar', 'Bam'] + + """ + return list(lstrip_iter(iterable, strip_value)) + + +def lstrip_iter(iterable, strip_value=None): + """Strips values from the beginning of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.lstrip. Returns a generator. + + >>> list(lstrip_iter(['Foo', 'Bar', 'Bam'], 'Foo')) + ['Bar', 'Bam'] + + """ + iterator = iter(iterable) + for i in iterator: + if i != strip_value: + yield i + break + for i in iterator: + yield i + + +def rstrip(iterable, strip_value=None): + """Strips values from the end of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.rstrip. Returns a list. + + >>> rstrip(['Foo', 'Bar', 'Bam'], 'Bam') + ['Foo', 'Bar'] + + """ + return list(rstrip_iter(iterable, strip_value)) + + +def rstrip_iter(iterable, strip_value=None): + """Strips values from the end of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.rstrip. Returns a generator. + + >>> list(rstrip_iter(['Foo', 'Bar', 'Bam'], 'Bam')) + ['Foo', 'Bar'] + + """ + iterator = iter(iterable) + for i in iterator: + if i == strip_value: + cache = list() + cache.append(i) + broken = False + for i in iterator: + if i == strip_value: + cache.append(i) + else: + broken = True + break + if not broken: # Return to caller here because the end of the + return # iterator has been reached + yield from cache + yield i + + +def strip(iterable, strip_value=None): + """Strips values from the beginning and end of an iterable. Stripped items + will match the value of the argument strip_value. Functionality is + analogous to that of the method str.strip. Returns a list. + + >>> strip(['Fu', 'Foo', 'Bar', 'Bam', 'Fu'], 'Fu') + ['Foo', 'Bar', 'Bam'] + + """ + return list(strip_iter(iterable, strip_value)) + + +def strip_iter(iterable, strip_value=None): + """Strips values from the beginning and end of an iterable. Stripped items + will match the value of the argument strip_value. Functionality is + analogous to that of the method str.strip. Returns a generator. + + >>> list(strip_iter(['Fu', 'Foo', 'Bar', 'Bam', 'Fu'], 'Fu')) + ['Foo', 'Bar', 'Bam'] + + """ + return rstrip_iter(lstrip_iter(iterable, strip_value), strip_value) + + +def chunked(src, size, count=None, **kw): + """Returns a list of *count* chunks, each with *size* elements, + generated from iterable *src*. If *src* is not evenly divisible by + *size*, the final chunk will have fewer than *size* elements. + Provide the *fill* keyword argument to provide a pad value and + enable padding, otherwise no padding will take place. + + >>> chunked(range(10), 3) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] + >>> chunked(range(10), 3, fill=None) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, None, None]] + >>> chunked(range(10), 3, count=2) + [[0, 1, 2], [3, 4, 5]] + + See :func:`chunked_iter` for more info. + """ + chunk_iter = chunked_iter(src, size, **kw) + if count is None: + return list(chunk_iter) + else: + return list(itertools.islice(chunk_iter, count)) + + +def _validate_positive_int(value, name, strictly_positive=True): + value = int(value) + if value < 0 or (strictly_positive and value == 0): + raise ValueError('expected a positive integer ' + name) + return value + + +def chunked_iter(src, size, **kw): + """Generates *size*-sized chunks from *src* iterable. Unless the + optional *fill* keyword argument is provided, iterables not evenly + divisible by *size* will have a final chunk that is smaller than + *size*. + + >>> list(chunked_iter(range(10), 3)) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] + >>> list(chunked_iter(range(10), 3, fill=None)) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, None, None]] + + Note that ``fill=None`` in fact uses ``None`` as the fill value. + """ + # TODO: add count kwarg? + if not is_iterable(src): + raise TypeError('expected an iterable') + size = _validate_positive_int(size, 'chunk size') + do_fill = True + try: + fill_val = kw.pop('fill') + except KeyError: + do_fill = False + fill_val = None + if kw: + raise ValueError('got unexpected keyword arguments: %r' % kw.keys()) + if not src: + return + + def postprocess(chk): return chk + if isinstance(src, (str, bytes)): + def postprocess(chk, _sep=type(src)()): return _sep.join(chk) + if isinstance(src, bytes): + def postprocess(chk): return bytes(chk) + src_iter = iter(src) + while True: + cur_chunk = list(itertools.islice(src_iter, size)) + if not cur_chunk: + break + lc = len(cur_chunk) + if lc < size and do_fill: + cur_chunk[lc:] = [fill_val] * (size - lc) + yield postprocess(cur_chunk) + return + + +def chunk_ranges(input_size, chunk_size, input_offset=0, overlap_size=0, align=False): + """Generates *chunk_size*-sized chunk ranges for an input with length *input_size*. + Optionally, a start of the input can be set via *input_offset*, and + and overlap between the chunks may be specified via *overlap_size*. + Also, if *align* is set to *True*, any items with *i % (chunk_size-overlap_size) == 0* + are always at the beginning of the chunk. + + Returns an iterator of (start, end) tuples, one tuple per chunk. + + >>> list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5)) + [(10, 15), (15, 20)] + >>> list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5, overlap_size=1)) + [(10, 15), (14, 19), (18, 20)] + >>> list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5, overlap_size=2)) + [(10, 15), (13, 18), (16, 20)] + + >>> list(chunk_ranges(input_offset=4, input_size=15, chunk_size=5, align=False)) + [(4, 9), (9, 14), (14, 19)] + >>> list(chunk_ranges(input_offset=4, input_size=15, chunk_size=5, align=True)) + [(4, 5), (5, 10), (10, 15), (15, 19)] + + >>> list(chunk_ranges(input_offset=2, input_size=15, chunk_size=5, overlap_size=1, align=False)) + [(2, 7), (6, 11), (10, 15), (14, 17)] + >>> list(chunk_ranges(input_offset=2, input_size=15, chunk_size=5, overlap_size=1, align=True)) + [(2, 5), (4, 9), (8, 13), (12, 17)] + >>> list(chunk_ranges(input_offset=3, input_size=15, chunk_size=5, overlap_size=1, align=True)) + [(3, 5), (4, 9), (8, 13), (12, 17), (16, 18)] + """ + input_size = _validate_positive_int( + input_size, 'input_size', strictly_positive=False) + chunk_size = _validate_positive_int(chunk_size, 'chunk_size') + input_offset = _validate_positive_int( + input_offset, 'input_offset', strictly_positive=False) + overlap_size = _validate_positive_int( + overlap_size, 'overlap_size', strictly_positive=False) + + input_stop = input_offset + input_size + + if align: + initial_chunk_len = chunk_size - \ + input_offset % (chunk_size - overlap_size) + if initial_chunk_len != overlap_size: + yield (input_offset, min(input_offset + initial_chunk_len, input_stop)) + if input_offset + initial_chunk_len >= input_stop: + return + input_offset = input_offset + initial_chunk_len - overlap_size + + for i in range(input_offset, input_stop, chunk_size - overlap_size): + yield (i, min(i + chunk_size, input_stop)) + + if i + chunk_size >= input_stop: + return + + +def pairwise(src, end=_UNSET): + """Convenience function for calling :func:`windowed` on *src*, with + *size* set to 2. + + >>> pairwise(range(5)) + [(0, 1), (1, 2), (2, 3), (3, 4)] + >>> pairwise([]) + [] + + Unless *end* is set, the number of pairs is always one less than + the number of elements in the iterable passed in, except on an empty input, + which will return an empty list. + + With *end* set, a number of pairs equal to the length of *src* is returned, + with the last item of the last pair being equal to *end*. + + >>> list(pairwise(range(3), end=None)) + [(0, 1), (1, 2), (2, None)] + + This way, *end* values can be useful as sentinels to signal the end of the iterable. + """ + return windowed(src, 2, fill=end) + + +def pairwise_iter(src, end=_UNSET): + """Convenience function for calling :func:`windowed_iter` on *src*, + with *size* set to 2. + + >>> list(pairwise_iter(range(5))) + [(0, 1), (1, 2), (2, 3), (3, 4)] + >>> list(pairwise_iter([])) + [] + + Unless *end* is set, the number of pairs is always one less + than the number of elements in the iterable passed in, + or zero, when *src* is empty. + + With *end* set, a number of pairs equal to the length of *src* is returned, + with the last item of the last pair being equal to *end*. + + >>> list(pairwise_iter(range(3), end=None)) + [(0, 1), (1, 2), (2, None)] + + This way, *end* values can be useful as sentinels to signal the end + of the iterable. For infinite iterators, setting *end* has no effect. + """ + return windowed_iter(src, 2, fill=end) + + +def windowed(src, size, fill=_UNSET): + """Returns tuples with exactly length *size*. If *fill* is unset + and the iterable is too short to make a window of length *size*, + no tuples are returned. See :func:`windowed_iter` for more. + """ + return list(windowed_iter(src, size, fill=fill)) + + +def windowed_iter(src, size, fill=_UNSET): + """Returns tuples with length *size* which represent a sliding + window over iterable *src*. + + >>> list(windowed_iter(range(7), 3)) + [(0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 6)] + + If *fill* is unset, and the iterable is too short to make a window + of length *size*, then no window tuples are returned. + + >>> list(windowed_iter(range(3), 5)) + [] + + With *fill* set, the iterator always yields a number of windows + equal to the length of the *src* iterable. + + >>> windowed(range(4), 3, fill=None) + [(0, 1, 2), (1, 2, 3), (2, 3, None), (3, None, None)] + + This way, *fill* values can be useful to signal the end of the iterable. + For infinite iterators, setting *fill* has no effect. + """ + tees = itertools.tee(src, size) + if fill is _UNSET: + try: + for i, t in enumerate(tees): + for _ in range(i): + next(t) + except StopIteration: + return zip([]) + return zip(*tees) + + for i, t in enumerate(tees): + for _ in range(i): + try: + next(t) + except StopIteration: + continue + return zip_longest(*tees, fillvalue=fill) + + +def xfrange(stop, start=None, step=1.0): + """Same as :func:`frange`, but generator-based instead of returning a + list. + + >>> tuple(xfrange(1, 3, step=0.75)) + (1.0, 1.75, 2.5) + + See :func:`frange` for more details. + """ + if not step: + raise ValueError('step must be non-zero') + if start is None: + start, stop = 0.0, stop * 1.0 + else: + # swap when all args are used + stop, start = start * 1.0, stop * 1.0 + cur = start + while cur < stop: + yield cur + cur += step + + +def frange(stop, start=None, step=1.0): + """A :func:`range` clone for float-based ranges. + + >>> frange(5) + [0.0, 1.0, 2.0, 3.0, 4.0] + >>> frange(6, step=1.25) + [0.0, 1.25, 2.5, 3.75, 5.0] + >>> frange(100.5, 101.5, 0.25) + [100.5, 100.75, 101.0, 101.25] + >>> frange(5, 0) + [] + >>> frange(5, 0, step=-1.25) + [5.0, 3.75, 2.5, 1.25] + """ + if not step: + raise ValueError('step must be non-zero') + if start is None: + start, stop = 0.0, stop * 1.0 + else: + # swap when all args are used + stop, start = start * 1.0, stop * 1.0 + count = int(math.ceil((stop - start) / step)) + ret = [None] * count + if not ret: + return ret + ret[0] = start + for i in range(1, count): + ret[i] = ret[i - 1] + step + return ret + + +def backoff(start, stop, count=None, factor=2.0, jitter=False): + """Returns a list of geometrically-increasing floating-point numbers, + suitable for usage with `exponential backoff`_. Exactly like + :func:`backoff_iter`, but without the ``'repeat'`` option for + *count*. See :func:`backoff_iter` for more details. + + .. _exponential backoff: https://en.wikipedia.org/wiki/Exponential_backoff + + >>> backoff(1, 10) + [1.0, 2.0, 4.0, 8.0, 10.0] + """ + if count == 'repeat': + raise ValueError("'repeat' supported in backoff_iter, not backoff") + return list(backoff_iter(start, stop, count=count, + factor=factor, jitter=jitter)) + + +def backoff_iter(start, stop, count=None, factor=2.0, jitter=False): + """Generates a sequence of geometrically-increasing floats, suitable + for usage with `exponential backoff`_. Starts with *start*, + increasing by *factor* until *stop* is reached, optionally + stopping iteration once *count* numbers are yielded. *factor* + defaults to 2. In general retrying with properly-configured + backoff creates a better-behaved component for a larger service + ecosystem. + + .. _exponential backoff: https://en.wikipedia.org/wiki/Exponential_backoff + + >>> list(backoff_iter(1.0, 10.0, count=5)) + [1.0, 2.0, 4.0, 8.0, 10.0] + >>> list(backoff_iter(1.0, 10.0, count=8)) + [1.0, 2.0, 4.0, 8.0, 10.0, 10.0, 10.0, 10.0] + >>> list(backoff_iter(0.25, 100.0, factor=10)) + [0.25, 2.5, 25.0, 100.0] + + A simplified usage example: + + .. code-block:: python + + for timeout in backoff_iter(0.25, 5.0): + try: + res = network_call() + break + except Exception as e: + log(e) + time.sleep(timeout) + + An enhancement for large-scale systems would be to add variation, + or *jitter*, to timeout values. This is done to avoid a thundering + herd on the receiving end of the network call. + + Finally, for *count*, the special value ``'repeat'`` can be passed to + continue yielding indefinitely. + + Args: + + start (float): Positive number for baseline. + stop (float): Positive number for maximum. + count (int): Number of steps before stopping + iteration. Defaults to the number of steps between *start* and + *stop*. Pass the string, `'repeat'`, to continue iteration + indefinitely. + factor (float): Rate of exponential increase. Defaults to `2.0`, + e.g., `[1, 2, 4, 8, 16]`. + jitter (float): A factor between `-1.0` and `1.0`, used to + uniformly randomize and thus spread out timeouts in a distributed + system, avoiding rhythm effects. Positive values use the base + backoff curve as a maximum, negative values use the curve as a + minimum. Set to 1.0 or `True` for a jitter approximating + Ethernet's time-tested backoff solution. Defaults to `False`. + + """ + start = float(start) + stop = float(stop) + factor = float(factor) + if start < 0.0: + raise ValueError('expected start >= 0, not %r' % start) + if factor < 1.0: + raise ValueError('expected factor >= 1.0, not %r' % factor) + if stop == 0.0: + raise ValueError('expected stop >= 0') + if stop < start: + raise ValueError('expected stop >= start, not %r' % stop) + if count is None: + denom = start if start else 1 + count = 1 + math.ceil(math.log(stop/denom, factor)) + count = count if start else count + 1 + if count != 'repeat' and count < 0: + raise ValueError('count must be positive or "repeat", not %r' % count) + if jitter: + jitter = float(jitter) + if not (-1.0 <= jitter <= 1.0): + raise ValueError('expected jitter -1 <= j <= 1, not: %r' % jitter) + + cur, i = start, 0 + while count == 'repeat' or i < count: + if not jitter: + cur_ret = cur + elif jitter: + cur_ret = cur - (cur * jitter * random.random()) + yield cur_ret + i += 1 + if cur == 0: + cur = 1 + elif cur < stop: + cur *= factor + if cur > stop: + cur = stop + return + + +def bucketize(src, key=bool, value_transform=None, key_filter=None): + """Group values in the *src* iterable by the value returned by *key*. + + >>> bucketize(range(5)) + {False: [0], True: [1, 2, 3, 4]} + >>> is_odd = lambda x: x % 2 == 1 + >>> bucketize(range(5), is_odd) + {False: [0, 2, 4], True: [1, 3]} + + *key* is :class:`bool` by default, but can either be a callable or a string or a list + if it is a string, it is the name of the attribute on which to bucketize objects. + + >>> bucketize([1+1j, 2+2j, 1, 2], key='real') + {1.0: [(1+1j), 1], 2.0: [(2+2j), 2]} + + if *key* is a list, it contains the buckets where to put each object + + >>> bucketize([1,2,365,4,98],key=[0,1,2,0,2]) + {0: [1, 4], 1: [2], 2: [365, 98]} + + + Value lists are not deduplicated: + + >>> bucketize([None, None, None, 'hello']) + {False: [None, None, None], True: ['hello']} + + Bucketize into more than 3 groups + + >>> bucketize(range(10), lambda x: x % 3) + {0: [0, 3, 6, 9], 1: [1, 4, 7], 2: [2, 5, 8]} + + ``bucketize`` has a couple of advanced options useful in certain + cases. *value_transform* can be used to modify values as they are + added to buckets, and *key_filter* will allow excluding certain + buckets from being collected. + + >>> bucketize(range(5), value_transform=lambda x: x*x) + {False: [0], True: [1, 4, 9, 16]} + + >>> bucketize(range(10), key=lambda x: x % 3, key_filter=lambda k: k % 3 != 1) + {0: [0, 3, 6, 9], 2: [2, 5, 8]} + + Note in some of these examples there were at most two keys, ``True`` and + ``False``, and each key present has a list with at least one + item. See :func:`partition` for a version specialized for binary + use cases. + + """ + if not is_iterable(src): + raise TypeError('expected an iterable') + elif isinstance(key, list): + if len(key) != len(src): + raise ValueError("key and src have to be the same length") + src = zip(key, src) + + if isinstance(key, str): + def key_func(x): return getattr(x, key, x) + elif callable(key): + key_func = key + elif isinstance(key, list): + def key_func(x): return x[0] + else: + raise TypeError('expected key to be callable or a string or a list') + + if value_transform is None: + def value_transform(x): return x + if not callable(value_transform): + raise TypeError('expected callable value transform function') + if isinstance(key, list): + f = value_transform + def value_transform(x): return f(x[1]) + + ret = {} + for val in src: + key_of_val = key_func(val) + if key_filter is None or key_filter(key_of_val): + ret.setdefault(key_of_val, []).append(value_transform(val)) + return ret + + +def partition(src, key=bool): + """No relation to :meth:`str.partition`, ``partition`` is like + :func:`bucketize`, but for added convenience returns a tuple of + ``(truthy_values, falsy_values)``. + + >>> nonempty, empty = partition(['', '', 'hi', '', 'bye']) + >>> nonempty + ['hi', 'bye'] + + *key* defaults to :class:`bool`, but can be carefully overridden to + use either a function that returns either ``True`` or ``False`` or + a string name of the attribute on which to partition objects. + + >>> import string + >>> is_digit = lambda x: x in string.digits + >>> decimal_digits, hexletters = partition(string.hexdigits, is_digit) + >>> ''.join(decimal_digits), ''.join(hexletters) + ('0123456789', 'abcdefABCDEF') + """ + bucketized = bucketize(src, key) + return bucketized.get(True, []), bucketized.get(False, []) + + +def unique(src, key=None): + """``unique()`` returns a list of unique values, as determined by + *key*, in the order they first appeared in the input iterable, + *src*. + + >>> ones_n_zeros = '11010110001010010101010' + >>> ''.join(unique(ones_n_zeros)) + '10' + + See :func:`unique_iter` docs for more details. + """ + return list(unique_iter(src, key)) + + +def unique_iter(src, key=None): + """Yield unique elements from the iterable, *src*, based on *key*, + in the order in which they first appeared in *src*. + + >>> repetitious = [1, 2, 3] * 10 + >>> list(unique_iter(repetitious)) + [1, 2, 3] + + By default, *key* is the object itself, but *key* can either be a + callable or, for convenience, a string name of the attribute on + which to uniqueify objects, falling back on identity when the + attribute is not present. + + >>> pleasantries = ['hi', 'hello', 'ok', 'bye', 'yes'] + >>> list(unique_iter(pleasantries, key=lambda x: len(x))) + ['hi', 'hello', 'bye'] + """ + if not is_iterable(src): + raise TypeError('expected an iterable, not %r' % type(src)) + if key is None: + def key_func(x): return x + elif callable(key): + key_func = key + elif isinstance(key, str): + def key_func(x): return getattr(x, key, x) + else: + raise TypeError('"key" expected a string or callable, not %r' % key) + seen = set() + for i in src: + k = key_func(i) + if k not in seen: + seen.add(k) + yield i + return + + +def redundant(src, key=None, groups=False): + """The complement of :func:`unique()`. + + By default returns non-unique/duplicate values as a list of the + *first* redundant value in *src*. Pass ``groups=True`` to get + groups of all values with redundancies, ordered by position of the + first redundant value. This is useful in conjunction with some + normalizing *key* function. + + >>> redundant([1, 2, 3, 4]) + [] + >>> redundant([1, 2, 3, 2, 3, 3, 4]) + [2, 3] + >>> redundant([1, 2, 3, 2, 3, 3, 4], groups=True) + [[2, 2], [3, 3, 3]] + + An example using a *key* function to do case-insensitive + redundancy detection. + + >>> redundant(['hi', 'Hi', 'HI', 'hello'], key=str.lower) + ['Hi'] + >>> redundant(['hi', 'Hi', 'HI', 'hello'], groups=True, key=str.lower) + [['hi', 'Hi', 'HI']] + + *key* should also be used when the values in *src* are not hashable. + + .. note:: + + This output of this function is designed for reporting + duplicates in contexts when a unique input is desired. Due to + the grouped return type, there is no streaming equivalent of + this function for the time being. + + """ + if key is None: + pass + elif callable(key): + key_func = key + elif isinstance(key, (str, bytes)): + def key_func(x): return getattr(x, key, x) + else: + raise TypeError('"key" expected a string or callable, not %r' % key) + seen = {} # key to first seen item + redundant_order = [] + redundant_groups = {} + for i in src: + k = key_func(i) if key else i + if k not in seen: + seen[k] = i + else: + if k in redundant_groups: + if groups: + redundant_groups[k].append(i) + else: + redundant_order.append(k) + redundant_groups[k] = [seen[k], i] + if not groups: + ret = [redundant_groups[k][1] for k in redundant_order] + else: + ret = [redundant_groups[k] for k in redundant_order] + return ret + + +def one(src, default=None, key=None): + """Along the same lines as builtins, :func:`all` and :func:`any`, and + similar to :func:`first`, ``one()`` returns the single object in + the given iterable *src* that evaluates to ``True``, as determined + by callable *key*. If unset, *key* defaults to :class:`bool`. If + no such objects are found, *default* is returned. If *default* is + not passed, ``None`` is returned. + + If *src* has more than one object that evaluates to ``True``, or + if there is no object that fulfills such condition, return + *default*. It's like an `XOR`_ over an iterable. + + >>> one((True, False, False)) + True + >>> one((True, False, True)) + >>> one((0, 0, 'a')) + 'a' + >>> one((0, False, None)) + >>> one((True, True), default=False) + False + >>> bool(one(('', 1))) + True + >>> one((10, 20, 30, 42), key=lambda i: i > 40) + 42 + + See `Martín Gaitán's original repo`_ for further use cases. + + .. _Martín Gaitán's original repo: https://github.com/mgaitan/one + .. _XOR: https://en.wikipedia.org/wiki/Exclusive_or + + """ + ones = list(itertools.islice(filter(key, src), 2)) + return ones[0] if len(ones) == 1 else default + + +def first(iterable, default=None, key=None): + """Return first element of *iterable* that evaluates to ``True``, else + return ``None`` or optional *default*. Similar to :func:`one`. + + >>> first([0, False, None, [], (), 42]) + 42 + >>> first([0, False, None, [], ()]) is None + True + >>> first([0, False, None, [], ()], default='ohai') + 'ohai' + >>> import re + >>> m = first(re.match(regex, 'abc') for regex in ['b.*', 'a(.*)']) + >>> m.group(1) + 'bc' + + The optional *key* argument specifies a one-argument predicate function + like that used for *filter()*. The *key* argument, if supplied, should be + in keyword form. For example, finding the first even number in an iterable: + + >>> first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0) + 4 + + Contributed by Hynek Schlawack, author of `the original standalone module`_. + + .. _the original standalone module: https://github.com/hynek/first + """ + return next(filter(key, iterable), default) + + +def flatten_iter(iterable): + """``flatten_iter()`` yields all the elements from *iterable* while + collapsing any nested iterables. + + >>> nested = [[1, 2], [[3], [4, 5]]] + >>> list(flatten_iter(nested)) + [1, 2, 3, 4, 5] + """ + for item in iterable: + if isinstance(item, Iterable) and not isinstance(item, (str, bytes)): + yield from flatten_iter(item) + else: + yield item + + +def flatten(iterable): + """``flatten()`` returns a collapsed list of all the elements from + *iterable* while collapsing any nested iterables. + + >>> nested = [[1, 2], [[3], [4, 5]]] + >>> flatten(nested) + [1, 2, 3, 4, 5] + """ + return list(flatten_iter(iterable)) + + +def same(iterable, ref=_UNSET): + """``same()`` returns ``True`` when all values in *iterable* are + equal to one another, or optionally a reference value, + *ref*. Similar to :func:`all` and :func:`any` in that it evaluates + an iterable and returns a :class:`bool`. ``same()`` returns + ``True`` for empty iterables. + + >>> same([]) + True + >>> same([1]) + True + >>> same(['a', 'a', 'a']) + True + >>> same(range(20)) + False + >>> same([[], []]) + True + >>> same([[], []], ref='test') + False + + """ + iterator = iter(iterable) + if ref is _UNSET: + ref = next(iterator, ref) + return all(val == ref for val in iterator) + + +def default_visit(path, key, value): + # print('visit(%r, %r, %r)' % (path, key, value)) + return key, value + + +# enable the extreme: monkeypatching iterutils with a different default_visit +_orig_default_visit = default_visit + + +def default_enter(path, key, value): + # print('enter(%r, %r)' % (key, value)) + if isinstance(value, (str, bytes)): + return value, False + elif isinstance(value, Mapping): + return value.__class__(), ItemsView(value) + elif isinstance(value, Sequence): + return value.__class__(), enumerate(value) + elif isinstance(value, Set): + return value.__class__(), enumerate(value) + else: + # files, strings, other iterables, and scalars are not + # traversed + return value, False + + +def default_exit(path, key, old_parent, new_parent, new_items): + # print('exit(%r, %r, %r, %r, %r)' + # % (path, key, old_parent, new_parent, new_items)) + ret = new_parent + if isinstance(new_parent, Mapping): + new_parent.update(new_items) + elif isinstance(new_parent, Sequence): + vals = [v for i, v in new_items] + try: + new_parent.extend(vals) + except AttributeError: + ret = new_parent.__class__(vals) # tuples + elif isinstance(new_parent, Set): + vals = [v for i, v in new_items] + try: + new_parent.update(vals) + except AttributeError: + ret = new_parent.__class__(vals) # frozensets + else: + raise RuntimeError('unexpected iterable type: %r' % type(new_parent)) + return ret + + +def remap(root, visit=default_visit, enter=default_enter, exit=default_exit, + **kwargs): + """The remap ("recursive map") function is used to traverse and + transform nested structures. Lists, tuples, sets, and dictionaries + are just a few of the data structures nested into heterogeneous + tree-like structures that are so common in programming. + Unfortunately, Python's built-in ways to manipulate collections + are almost all flat. List comprehensions may be fast and succinct, + but they do not recurse, making it tedious to apply quick changes + or complex transforms to real-world data. + + remap goes where list comprehensions cannot. + + Here's an example of removing all Nones from some data: + + >>> from pprint import pprint + >>> reviews = {'Star Trek': {'TNG': 10, 'DS9': 8.5, 'ENT': None}, + ... 'Babylon 5': 6, 'Dr. Who': None} + >>> pprint(remap(reviews, lambda p, k, v: v is not None)) + {'Babylon 5': 6, 'Star Trek': {'DS9': 8.5, 'TNG': 10}} + + Notice how both Nones have been removed despite the nesting in the + dictionary. Not bad for a one-liner, and that's just the beginning. + See `this remap cookbook`_ for more delicious recipes. + + .. _this remap cookbook: http://sedimental.org/remap.html + + remap takes four main arguments: the object to traverse and three + optional callables which determine how the remapped object will be + created. + + Args: + + root: The target object to traverse. By default, remap + supports iterables like :class:`list`, :class:`tuple`, + :class:`dict`, and :class:`set`, but any object traversable by + *enter* will work. + visit (callable): This function is called on every item in + *root*. It must accept three positional arguments, *path*, + *key*, and *value*. *path* is simply a tuple of parents' + keys. *visit* should return the new key-value pair. It may + also return ``True`` as shorthand to keep the old item + unmodified, or ``False`` to drop the item from the new + structure. *visit* is called after *enter*, on the new parent. + + The *visit* function is called for every item in root, + including duplicate items. For traversable values, it is + called on the new parent object, after all its children + have been visited. The default visit behavior simply + returns the key-value pair unmodified. + enter (callable): This function controls which items in *root* + are traversed. It accepts the same arguments as *visit*: the + path, the key, and the value of the current item. It returns a + pair of the blank new parent, and an iterator over the items + which should be visited. If ``False`` is returned instead of + an iterator, the value will not be traversed. + + The *enter* function is only called once per unique value. The + default enter behavior support mappings, sequences, and + sets. Strings and all other iterables will not be traversed. + exit (callable): This function determines how to handle items + once they have been visited. It gets the same three + arguments as the other functions -- *path*, *key*, *value* + -- plus two more: the blank new parent object returned + from *enter*, and a list of the new items, as remapped by + *visit*. + + Like *enter*, the *exit* function is only called once per + unique value. The default exit behavior is to simply add + all new items to the new parent, e.g., using + :meth:`list.extend` and :meth:`dict.update` to add to the + new parent. Immutable objects, such as a :class:`tuple` or + :class:`namedtuple`, must be recreated from scratch, but + use the same type as the new parent passed back from the + *enter* function. + reraise_visit (bool): A pragmatic convenience for the *visit* + callable. When set to ``False``, remap ignores any errors + raised by the *visit* callback. Items causing exceptions + are kept. See examples for more details. + trace (bool): Pass ``trace=True`` to print out the entire + traversal. Or pass a tuple of ``'visit'``, ``'enter'``, + or ``'exit'`` to print only the selected events. + + remap is designed to cover the majority of cases with just the + *visit* callable. While passing in multiple callables is very + empowering, remap is designed so very few cases should require + passing more than one function. + + When passing *enter* and *exit*, it's common and easiest to build + on the default behavior. Simply add ``from boltons.iterutils import + default_enter`` (or ``default_exit``), and have your enter/exit + function call the default behavior before or after your custom + logic. See `this example`_. + + Duplicate and self-referential objects (aka reference loops) are + automatically handled internally, `as shown here`_. + + .. _this example: http://sedimental.org/remap.html#sort_all_lists + .. _as shown here: http://sedimental.org/remap.html#corner_cases + + """ + # TODO: improve argument formatting in sphinx doc + # TODO: enter() return (False, items) to continue traverse but cancel copy? + if not callable(visit): + raise TypeError('visit expected callable, not: %r' % visit) + if not callable(enter): + raise TypeError('enter expected callable, not: %r' % enter) + if not callable(exit): + raise TypeError('exit expected callable, not: %r' % exit) + reraise_visit = kwargs.pop('reraise_visit', True) + trace = kwargs.pop('trace', ()) + if trace is True: + trace = ('visit', 'enter', 'exit') + elif isinstance(trace, str): + trace = (trace,) + if not isinstance(trace, (tuple, list, set)): + raise TypeError('trace expected tuple of event names, not: %r' % trace) + trace_enter, trace_exit, trace_visit = 'enter' in trace, 'exit' in trace, 'visit' in trace + + if kwargs: + raise TypeError('unexpected keyword arguments: %r' % kwargs.keys()) + + path, registry, stack = (), {}, [(None, root)] + new_items_stack = [] + while stack: + key, value = stack.pop() + id_value = id(value) + if key is _REMAP_EXIT: + key, new_parent, old_parent = value + id_value = id(old_parent) + path, new_items = new_items_stack.pop() + if trace_exit: + print(' .. remap exit:', path, '-', key, '-', + old_parent, '-', new_parent, '-', new_items) + value = exit(path, key, old_parent, new_parent, new_items) + if trace_exit: + print(' .. remap exit result:', value) + registry[id_value] = value + if not new_items_stack: + continue + elif id_value in registry: + value = registry[id_value] + else: + if trace_enter: + print(' .. remap enter:', path, '-', key, '-', value) + res = enter(path, key, value) + if trace_enter: + print(' .. remap enter result:', res) + try: + new_parent, new_items = res + except TypeError: + # TODO: handle False? + raise TypeError('enter should return a tuple of (new_parent,' + ' items_iterator), not: %r' % res) + if new_items is not False: + # traverse unless False is explicitly passed + registry[id_value] = new_parent + new_items_stack.append((path, [])) + if value is not root: + path += (key,) + stack.append((_REMAP_EXIT, (key, new_parent, value))) + if new_items: + stack.extend(reversed(list(new_items))) + if trace_enter: + print(' .. remap stack size now:', len(stack)) + continue + if visit is _orig_default_visit: + # avoid function call overhead by inlining identity operation + visited_item = (key, value) + else: + try: + if trace_visit: + print(' .. remap visit:', path, '-', key, '-', value) + visited_item = visit(path, key, value) + except Exception: + if reraise_visit: + raise + visited_item = True + if visited_item is False: + if trace_visit: + print(' .. remap visit result: ') + continue # drop + elif visited_item is True: + visited_item = (key, value) + if trace_visit: + print(' .. remap visit result:', visited_item) + # TODO: typecheck? + # raise TypeError('expected (key, value) from visit(),' + # ' not: %r' % visited_item) + try: + new_items_stack[-1][1].append(visited_item) + except IndexError: + raise TypeError('expected remappable root, not: %r' % root) + return value + + +class PathAccessError(KeyError, IndexError, TypeError): + """An amalgamation of KeyError, IndexError, and TypeError, + representing what can occur when looking up a path in a nested + object. + """ + + def __init__(self, exc, seg, path): + self.exc = exc + self.seg = seg + self.path = path + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({self.exc!r}, {self.seg!r}, {self.path!r})' + + def __str__(self): + return ('could not access %r from path %r, got error: %r' + % (self.seg, self.path, self.exc)) + + +def get_path(root, path, default=_UNSET): + """Retrieve a value from a nested object via a tuple representing the + lookup path. + + >>> root = {'a': {'b': {'c': [[1], [2], [3]]}}} + >>> get_path(root, ('a', 'b', 'c', 2, 0)) + 3 + + The path tuple format is intentionally consistent with that of + :func:`remap`, but a single dotted string can also be passed. + + One of get_path's chief aims is improved error messaging. EAFP is + great, but the error messages are not. + + For instance, ``root['a']['b']['c'][2][1]`` gives back + ``IndexError: list index out of range`` + + What went out of range where? get_path currently raises + ``PathAccessError: could not access 2 from path ('a', 'b', 'c', 2, + 1), got error: IndexError('list index out of range',)``, a + subclass of IndexError and KeyError. + + You can also pass a default that covers the entire operation, + should the lookup fail at any level. + + Args: + root: The target nesting of dictionaries, lists, or other + objects supporting ``__getitem__``. + path (tuple): A sequence of strings and integers to be successively + looked up within *root*. A dot-separated (``a.b``) string may + also be passed. + default: The value to be returned should any + ``PathAccessError`` exceptions be raised. + """ + if isinstance(path, str): + path = path.split('.') + cur = root + try: + for seg in path: + try: + cur = cur[seg] + except (KeyError, IndexError) as exc: + raise PathAccessError(exc, seg, path) + except TypeError as exc: + # either string index in a list, or a parent that + # doesn't support indexing + try: + seg = int(seg) + cur = cur[seg] + except (ValueError, KeyError, IndexError, TypeError): + if not is_iterable(cur): + exc = TypeError('%r object is not indexable' + % type(cur).__name__) + raise PathAccessError(exc, seg, path) + except PathAccessError: + if default is _UNSET: + raise + return default + return cur + + +def research(root, query=lambda p, k, v: True, reraise=False, enter=default_enter): + """The :func:`research` function uses :func:`remap` to recurse over + any data nested in *root*, and find values which match a given + criterion, specified by the *query* callable. + + Results are returned as a list of ``(path, value)`` pairs. The + paths are tuples in the same format accepted by + :func:`get_path`. This can be useful for comparing values nested + in two or more different structures. + + Here's a simple example that finds all integers: + + >>> root = {'a': {'b': 1, 'c': (2, 'd', 3)}, 'e': None} + >>> res = research(root, query=lambda p, k, v: isinstance(v, int)) + >>> print(sorted(res)) + [(('a', 'b'), 1), (('a', 'c', 0), 2), (('a', 'c', 2), 3)] + + Note how *query* follows the same, familiar ``path, key, value`` + signature as the ``visit`` and ``enter`` functions on + :func:`remap`, and returns a :class:`bool`. + + Args: + root: The target object to search. Supports the same types of + objects as :func:`remap`, including :class:`list`, + :class:`tuple`, :class:`dict`, and :class:`set`. + query (callable): The function called on every object to + determine whether to include it in the search results. The + callable must accept three arguments, *path*, *key*, and + *value*, commonly abbreviated *p*, *k*, and *v*, same as + *enter* and *visit* from :func:`remap`. + reraise (bool): Whether to reraise exceptions raised by *query* + or to simply drop the result that caused the error. + + + With :func:`research` it's easy to inspect the details of a data + structure, like finding values that are at a certain depth (using + ``len(p)``) and much more. If more advanced functionality is + needed, check out the code and make your own :func:`remap` + wrapper, and consider `submitting a patch`_! + + .. _submitting a patch: https://github.com/mahmoud/boltons/pulls + """ + ret = [] + + if not callable(query): + raise TypeError('query expected callable, not: %r' % query) + + def _enter(path, key, value): + try: + if query(path, key, value): + ret.append((path + (key,), value)) + except Exception: + if reraise: + raise + return enter(path, key, value) + + remap(root, enter=_enter) + return ret + + +# TODO: recollect() +# TODO: refilter() +# TODO: reiter() + + +# GUID iterators: 10x faster and somewhat more compact than uuid. + +class GUIDerator: + """The GUIDerator is an iterator that yields a globally-unique + identifier (GUID) on every iteration. The GUIDs produced are + hexadecimal strings. + + Testing shows it to be around 12x faster than the uuid module. By + default it is also more compact, partly due to its default 96-bit + (24-hexdigit) length. 96 bits of randomness means that there is a + 1 in 2 ^ 32 chance of collision after 2 ^ 64 iterations. If more + or less uniqueness is desired, the *size* argument can be adjusted + accordingly. + + Args: + size (int): character length of the GUID, defaults to 24. Lengths + between 20 and 36 are considered valid. + + The GUIDerator has built-in fork protection that causes it to + detect a fork on next iteration and reseed accordingly. + + """ + + def __init__(self, size=24): + self.size = size + if size < 20 or size > 36: + raise ValueError('expected 20 < size <= 36') + import hashlib + self._sha1 = hashlib.sha1 + self.count = itertools.count() + self.reseed() + + def reseed(self): + import socket + self.pid = os.getpid() + self.salt = '-'.join([str(self.pid), + socket.gethostname() or '', + str(time.time()), + os.urandom(6).hex()]) + return + + def __iter__(self): + return self + + def __next__(self): + if os.getpid() != self.pid: + self.reseed() + target_bytes = (self.salt + str(next(self.count))).encode('utf8') + hash_text = self._sha1(target_bytes).hexdigest()[:self.size] + return hash_text + + next = __next__ + + +class SequentialGUIDerator(GUIDerator): + """Much like the standard GUIDerator, the SequentialGUIDerator is an + iterator that yields a globally-unique identifier (GUID) on every + iteration. The GUIDs produced are hexadecimal strings. + + The SequentialGUIDerator differs in that it picks a starting GUID + value and increments every iteration. This yields GUIDs which are + of course unique, but also ordered and lexicographically sortable. + + The SequentialGUIDerator is around 50% faster than the normal + GUIDerator, making it almost 20x as fast as the built-in uuid + module. By default it is also more compact, partly due to its + 96-bit (24-hexdigit) default length. 96 bits of randomness means that + there is a 1 in 2 ^ 32 chance of collision after 2 ^ 64 + iterations. If more or less uniqueness is desired, the *size* + argument can be adjusted accordingly. + + Args: + size (int): character length of the GUID, defaults to 24. + + Note that with SequentialGUIDerator there is a chance of GUIDs + growing larger than the size configured. The SequentialGUIDerator + has built-in fork protection that causes it to detect a fork on + next iteration and reseed accordingly. + + """ + + def reseed(self): + super().reseed() + start_str = self._sha1(self.salt.encode('utf8')).hexdigest() + self.start = int(start_str[:self.size], 16) + self.start |= (1 << ((self.size * 4) - 2)) + + def __next__(self): + if os.getpid() != self.pid: + self.reseed() + return '%x' % (next(self.count) + self.start) + + next = __next__ + + +guid_iter = GUIDerator() +seq_guid_iter = SequentialGUIDerator() + + +def soft_sorted(iterable, first=None, last=None, key=None, reverse=False): + """For when you care about the order of some elements, but not about + others. + + Use this to float to the top and/or sink to the bottom a specific + ordering, while sorting the rest of the elements according to + normal :func:`sorted` rules. + + >>> soft_sorted(['two', 'b', 'one', 'a'], first=['one', 'two']) + ['one', 'two', 'a', 'b'] + >>> soft_sorted(range(7), first=[6, 15], last=[2, 4], reverse=True) + [6, 5, 3, 1, 0, 2, 4] + >>> import string + >>> ''.join(soft_sorted(string.hexdigits, first='za1', last='b', key=str.lower)) + 'aA1023456789cCdDeEfFbB' + + Args: + iterable (list): A list or other iterable to sort. + first (list): A sequence to enforce for elements which should + appear at the beginning of the returned list. + last (list): A sequence to enforce for elements which should + appear at the end of the returned list. + key (callable): Callable used to generate a comparable key for + each item to be sorted, same as the key in + :func:`sorted`. Note that entries in *first* and *last* + should be the keys for the items. Defaults to + passthrough/the identity function. + reverse (bool): Whether or not elements not explicitly ordered + by *first* and *last* should be in reverse order or not. + + Returns a new list in sorted order. + """ + first = first or [] + last = last or [] + key = key or (lambda x: x) + seq = list(iterable) + other = [x for x in seq if not ( + (first and key(x) in first) or (last and key(x) in last))] + other.sort(key=key, reverse=reverse) + + if first: + first = sorted([x for x in seq if key(x) in first], + key=lambda x: first.index(key(x))) + if last: + last = sorted([x for x in seq if key(x) in last], + key=lambda x: last.index(key(x))) + return first + other + last + + +def untyped_sorted(iterable, key=None, reverse=False): + """A version of :func:`sorted` which will happily sort an iterable of + heterogeneous types and return a new list, similar to legacy Python's + behavior. + + >>> untyped_sorted(['abc', 2.0, 1, 2, 'def']) + [1, 2.0, 2, 'abc', 'def'] + + Note how mutually orderable types are sorted as expected, as in + the case of the integers and floats above. + + .. note:: + + Results may vary across Python versions and builds, but the + function will produce a sorted list, except in the case of + explicitly unorderable objects. + + """ + class _Wrapper: + slots = ('obj',) + + def __init__(self, obj): + self.obj = obj + + def __lt__(self, other): + obj = key(self.obj) if key is not None else self.obj + other = key(other.obj) if key is not None else other.obj + try: + ret = obj < other + except TypeError: + ret = ((type(obj).__name__, id(type(obj)), obj) + < (type(other).__name__, id(type(other)), other)) + return ret + + if key is not None and not callable(key): + raise TypeError('expected function or callable object for key, not: %r' + % key) + + return sorted(iterable, key=_Wrapper, reverse=reverse) + + +""" +May actually be faster to do an isinstance check for a str path + +$ python -m timeit -s "x = [1]" "x[0]" +10000000 loops, best of 3: 0.0207 usec per loop +$ python -m timeit -s "x = [1]" "try: x[0] \nexcept: pass" +10000000 loops, best of 3: 0.029 usec per loop +$ python -m timeit -s "x = [1]" "try: x[1] \nexcept: pass" +1000000 loops, best of 3: 0.315 usec per loop +# setting up try/except is fast, only around 0.01us +# actually triggering the exception takes almost 10x as long + +$ python -m timeit -s "x = [1]" "isinstance(x, basestring)" +10000000 loops, best of 3: 0.141 usec per loop +$ python -m timeit -s "x = [1]" "isinstance(x, str)" +10000000 loops, best of 3: 0.131 usec per loop +$ python -m timeit -s "x = [1]" "try: x.split('.')\n except: pass" +1000000 loops, best of 3: 0.443 usec per loop +$ python -m timeit -s "x = [1]" "try: x.split('.') \nexcept AttributeError: pass" +1000000 loops, best of 3: 0.544 usec per loop +""" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/jsonutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/jsonutils.py new file mode 100644 index 0000000000000000000000000000000000000000..bf61b03a3b1d43e534f268f6dec577781c53eab3 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/jsonutils.py @@ -0,0 +1,267 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""``jsonutils`` aims to provide various helpers for working with +JSON. Currently it focuses on providing a reliable and intuitive means +of working with `JSON Lines`_-formatted files. + +.. _JSON Lines: http://jsonlines.org/ + +""" + + +import io +import os +import json + + +DEFAULT_BLOCKSIZE = 4096 + + +__all__ = ['JSONLIterator', 'reverse_iter_lines'] + + +def reverse_iter_lines(file_obj, blocksize=DEFAULT_BLOCKSIZE, preseek=True, encoding=None): + """Returns an iterator over the lines from a file object, in + reverse order, i.e., last line first, first line last. Uses the + :meth:`file.seek` method of file objects, and is tested compatible with + :class:`file` objects, as well as :class:`StringIO.StringIO`. + + Args: + file_obj (file): An open file object. Note that + ``reverse_iter_lines`` mutably reads from the file and + other functions should not mutably interact with the file + object after being passed. Files can be opened in bytes or + text mode. + blocksize (int): The block size to pass to + :meth:`file.read()`. Warning: keep this a fairly large + multiple of 2, defaults to 4096. + preseek (bool): Tells the function whether or not to automatically + seek to the end of the file. Defaults to ``True``. + ``preseek=False`` is useful in cases when the + file cursor is already in position, either at the end of + the file or in the middle for relative reverse line + generation. + + """ + # This function is a bit of a pain because it attempts to be byte/text agnostic + try: + encoding = encoding or file_obj.encoding + except AttributeError: + # BytesIO + encoding = None + else: + encoding = 'utf-8' + + # need orig_obj to keep alive otherwise __del__ on the TextWrapper will close the file + orig_obj = file_obj + try: + file_obj = orig_obj.detach() + except (AttributeError, io.UnsupportedOperation): + pass + + empty_bytes, newline_bytes, empty_text = b'', b'\n', '' + + if preseek: + file_obj.seek(0, os.SEEK_END) + buff = empty_bytes + cur_pos = file_obj.tell() + while 0 < cur_pos: + read_size = min(blocksize, cur_pos) + cur_pos -= read_size + file_obj.seek(cur_pos, os.SEEK_SET) + cur = file_obj.read(read_size) + buff = cur + buff + lines = buff.splitlines() + + if len(lines) < 2 or lines[0] == empty_bytes: + continue + if buff[-1:] == newline_bytes: + yield empty_text if encoding else empty_bytes + for line in lines[:0:-1]: + yield line.decode(encoding) if encoding else line + buff = lines[0] + if buff: + yield buff.decode(encoding) if encoding else buff + + + +""" +TODO: allow passthroughs for: + +json.load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]]) +""" + + +class JSONLIterator: + """The ``JSONLIterator`` is used to iterate over JSON-encoded objects + stored in the `JSON Lines format`_ (one object per line). + + Most notably it has the ability to efficiently read from the + bottom of files, making it very effective for reading in simple + append-only JSONL use cases. It also has the ability to start from + anywhere in the file and ignore corrupted lines. + + Args: + file_obj (file): An open file object. + ignore_errors (bool): Whether to skip over lines that raise an error on + deserialization (:func:`json.loads`). + reverse (bool): Controls the direction of the iteration. + Defaults to ``False``. If set to ``True`` and *rel_seek* + is unset, seeks to the end of the file before iteration + begins. + rel_seek (float): Used to preseek the start position of + iteration. Set to 0.0 for the start of the file, 1.0 for the + end, and anything in between. + + .. _JSON Lines format: http://jsonlines.org/ + """ + def __init__(self, file_obj, + ignore_errors=False, reverse=False, rel_seek=None): + self._reverse = bool(reverse) + self._file_obj = file_obj + self.ignore_errors = ignore_errors + + if rel_seek is None: + if reverse: + rel_seek = 1.0 + elif not -1.0 < rel_seek < 1.0: + raise ValueError("'rel_seek' expected a float between" + " -1.0 and 1.0, not %r" % rel_seek) + elif rel_seek < 0: + rel_seek = 1.0 - rel_seek + self._rel_seek = rel_seek + self._blocksize = 4096 + if rel_seek is not None: + self._init_rel_seek() + if self._reverse: + self._line_iter = reverse_iter_lines(self._file_obj, + blocksize=self._blocksize, + preseek=False) + else: + self._line_iter = iter(self._file_obj) + + @property + def cur_byte_pos(self): + "A property representing where in the file the iterator is reading." + return self._file_obj.tell() + + def _align_to_newline(self): + "Aligns the file object's position to the next newline." + fo, bsize = self._file_obj, self._blocksize + cur, total_read = '', 0 + cur_pos = fo.tell() + while '\n' not in cur: + cur = fo.read(bsize) + total_read += bsize + try: + newline_offset = cur.index('\n') + total_read - bsize + except ValueError: + raise # TODO: seek to end? + fo.seek(cur_pos + newline_offset) + + def _init_rel_seek(self): + "Sets the file object's position to the relative location set above." + rs, fo = self._rel_seek, self._file_obj + if rs == 0.0: + fo.seek(0, os.SEEK_SET) + else: + fo.seek(0, os.SEEK_END) + size = fo.tell() + if rs == 1.0: + self._cur_pos = size + else: + target = int(size * rs) + fo.seek(target, os.SEEK_SET) + self._align_to_newline() + self._cur_pos = fo.tell() + + def __iter__(self): + return self + + def next(self): + """Yields one :class:`dict` loaded with :func:`json.loads`, advancing + the file object by one line. Raises :exc:`StopIteration` upon reaching + the end of the file (or beginning, if ``reverse`` was set to ``True``. + """ + while 1: + line = next(self._line_iter).lstrip() + if not line: + continue + try: + obj = json.loads(line) + except Exception: + if not self.ignore_errors: + raise + continue + return obj + + __next__ = next + + +if __name__ == '__main__': + def _main(): + import sys + if '-h' in sys.argv or '--help' in sys.argv: + print('loads one or more JSON Line files for basic validation.') + return + verbose = False + if '-v' in sys.argv or '--verbose' in sys.argv: + verbose = True + file_count, obj_count = 0, 0 + filenames = sys.argv[1:] + for filename in filenames: + if filename in ('-h', '--help', '-v', '--verbose'): + continue + file_count += 1 + with open(filename, 'rb') as file_obj: + iterator = JSONLIterator(file_obj) + cur_obj_count = 0 + while 1: + try: + next(iterator) + except ValueError: + print('error reading object #%s around byte %s in %s' + % (cur_obj_count + 1, iterator.cur_byte_pos, filename)) + return + except StopIteration: + break + obj_count += 1 + cur_obj_count += 1 + if verbose and obj_count and obj_count % 100 == 0: + sys.stdout.write('.') + if obj_count % 10000: + sys.stdout.write('%s\n' % obj_count) + if verbose: + print('files checked: %s' % file_count) + print('objects loaded: %s' % obj_count) + return + + _main() diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/listutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/listutils.py new file mode 100644 index 0000000000000000000000000000000000000000..06b9da28f74488d45b98a8f949d7e34cfd930160 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/listutils.py @@ -0,0 +1,350 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's builtin :class:`list` is a very fast and efficient +sequence type, but it could be better for certain access patterns, +such as non-sequential insertion into a large lists. ``listutils`` +provides a pure-Python solution to this problem. + +For utilities for working with iterables and lists, check out +:mod:`iterutils`. For the a :class:`list`-based version of +:class:`collections.namedtuple`, check out :mod:`namedutils`. +""" + + +import operator +from math import log as math_log +from itertools import chain, islice + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + +# TODO: expose splaylist? +__all__ = ['BList', 'BarrelList'] + + +# TODO: comparators +# TODO: keep track of list lengths and bisect to the right list for +# faster getitem (and slightly slower setitem and delitem ops) + +class BarrelList(list): + """The ``BarrelList`` is a :class:`list` subtype backed by many + dynamically-scaled sublists, to provide better scaling and random + insertion/deletion characteristics. It is a subtype of the builtin + :class:`list` and has an identical API, supporting indexing, + slicing, sorting, etc. If application requirements call for + something more performant, consider the `blist module available on + PyPI`_. + + The name comes by way of Kurt Rose, who said it reminded him of + barrel shifters. Not sure how, but it's BList-like, so the name + stuck. BList is of course a reference to `B-trees`_. + + Args: + iterable: An optional iterable of initial values for the list. + + >>> blist = BList(range(100000)) + >>> blist.pop(50000) + 50000 + >>> len(blist) + 99999 + >>> len(blist.lists) # how many underlying lists + 8 + >>> slice_idx = blist.lists[0][-1] + >>> blist[slice_idx:slice_idx + 2] + BarrelList([11637, 11638]) + + Slicing is supported and works just fine across list borders, + returning another instance of the BarrelList. + + .. _blist module available on PyPI: https://pypi.python.org/pypi/blist + .. _B-trees: https://en.wikipedia.org/wiki/B-tree + + """ + + _size_factor = 1520 + "This size factor is the result of tuning using the tune() function below." + + def __init__(self, iterable=None): + self.lists = [[]] + if iterable: + self.extend(iterable) + + @property + def _cur_size_limit(self): + len_self, size_factor = len(self), self._size_factor + return int(round(size_factor * math_log(len_self + 2, 2))) + + def _translate_index(self, index): + if index < 0: + index += len(self) + rel_idx, lists = index, self.lists + for list_idx in range(len(lists)): + len_list = len(lists[list_idx]) + if rel_idx < len_list: + break + rel_idx -= len_list + if rel_idx < 0: + return None, None + return list_idx, rel_idx + + def _balance_list(self, list_idx): + if list_idx < 0: + list_idx += len(self.lists) + cur_list, len_self = self.lists[list_idx], len(self) + size_limit = self._cur_size_limit + if len(cur_list) > size_limit: + half_limit = size_limit // 2 + while len(cur_list) > half_limit: + next_list_idx = list_idx + 1 + self.lists.insert(next_list_idx, cur_list[-half_limit:]) + del cur_list[-half_limit:] + return True + return False + + def insert(self, index, item): + if len(self.lists) == 1: + self.lists[0].insert(index, item) + self._balance_list(0) + else: + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + self.lists[list_idx].insert(rel_idx, item) + self._balance_list(list_idx) + return + + def append(self, item): + self.lists[-1].append(item) + + def extend(self, iterable): + self.lists[-1].extend(iterable) + + def pop(self, *a): + lists = self.lists + if len(lists) == 1 and not a: + return self.lists[0].pop() + index = a and a[0] + if index == () or index is None or index == -1: + ret = lists[-1].pop() + if len(lists) > 1 and not lists[-1]: + lists.pop() + else: + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + ret = lists[list_idx].pop(rel_idx) + self._balance_list(list_idx) + return ret + + def iter_slice(self, start, stop, step=None): + iterable = self # TODO: optimization opportunities abound + # start_list_idx, stop_list_idx = 0, len(self.lists) + if start is None: + start = 0 + if stop is None: + stop = len(self) + if step is not None and step < 0: + step = -step + start, stop = -start, -stop - 1 + iterable = reversed(self) + if start < 0: + start += len(self) + # start_list_idx, start_rel_idx = self._translate_index(start) + if stop < 0: + stop += len(self) + # stop_list_idx, stop_rel_idx = self._translate_index(stop) + return islice(iterable, start, stop, step) + + def del_slice(self, start, stop, step=None): + if step is not None and abs(step) > 1: # punt + new_list = chain(self.iter_slice(0, start, step), + self.iter_slice(stop, None, step)) + self.lists[0][:] = new_list + self._balance_list(0) + return + if start is None: + start = 0 + if stop is None: + stop = len(self) + start_list_idx, start_rel_idx = self._translate_index(start) + stop_list_idx, stop_rel_idx = self._translate_index(stop) + if start_list_idx is None: + raise IndexError() + if stop_list_idx is None: + raise IndexError() + + if start_list_idx == stop_list_idx: + del self.lists[start_list_idx][start_rel_idx:stop_rel_idx] + elif start_list_idx < stop_list_idx: + del self.lists[start_list_idx + 1:stop_list_idx] + del self.lists[start_list_idx][start_rel_idx:] + del self.lists[stop_list_idx][:stop_rel_idx] + else: + assert False, ('start list index should never translate to' + ' greater than stop list index') + + __delslice__ = del_slice + + @classmethod + def from_iterable(cls, it): + return cls(it) + + def __iter__(self): + return chain.from_iterable(self.lists) + + def __reversed__(self): + return chain.from_iterable(reversed(l) for l in reversed(self.lists)) + + def __len__(self): + return sum([len(l) for l in self.lists]) + + def __contains__(self, item): + for cur in self.lists: + if item in cur: + return True + return False + + def __getitem__(self, index): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + iter_slice = self.iter_slice(start, stop, step) + ret = self.from_iterable(iter_slice) + return ret + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + return self.lists[list_idx][rel_idx] + + def __delitem__(self, index): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + self.del_slice(start, stop, step) + return + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + del self.lists[list_idx][rel_idx] + + def __setitem__(self, index, item): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + if len(self.lists) == 1: + self.lists[0][index] = item + else: + tmp = list(self) + tmp[index] = item + self.lists[:] = [tmp] + self._balance_list(0) + return + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + self.lists[list_idx][rel_idx] = item + + def __getslice__(self, start, stop): + iter_slice = self.iter_slice(start, stop, 1) + return self.from_iterable(iter_slice) + + def __setslice__(self, start, stop, sequence): + if len(self.lists) == 1: + self.lists[0][start:stop] = sequence + else: + tmp = list(self) + tmp[start:stop] = sequence + self.lists[:] = [tmp] + self._balance_list(0) + return + + def __repr__(self): + return f'{self.__class__.__name__}({list(self)!r})' + + def sort(self): + # poor pythonist's mergesort, it's faster than sorted(self) + # when the lists' average length is greater than 512. + if len(self.lists) == 1: + self.lists[0].sort() + else: + for li in self.lists: + li.sort() + tmp_sorted = sorted(chain.from_iterable(self.lists)) + del self.lists[:] + self.lists[0] = tmp_sorted + self._balance_list(0) + + def reverse(self): + for cur in self.lists: + cur.reverse() + self.lists.reverse() + + def count(self, item): + return sum([cur.count(item) for cur in self.lists]) + + def index(self, item): + len_accum = 0 + for cur in self.lists: + try: + rel_idx = cur.index(item) + return len_accum + rel_idx + except ValueError: + len_accum += len(cur) + raise ValueError(f'{item!r} is not in list') + + +BList = BarrelList + + +class SplayList(list): + """Like a `splay tree`_, the SplayList facilitates moving higher + utility items closer to the front of the list for faster access. + + .. _splay tree: https://en.wikipedia.org/wiki/Splay_tree + """ + + def shift(self, item_index, dest_index=0): + if item_index == dest_index: + return + item = self.pop(item_index) + self.insert(dest_index, item) + + def swap(self, item_index, dest_index): + self[dest_index], self[item_index] = self[item_index], self[dest_index] diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/mathutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/mathutils.py new file mode 100644 index 0000000000000000000000000000000000000000..1367a5413bbb9c6f3754da50c33b073641ac40df --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/mathutils.py @@ -0,0 +1,249 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""This module provides useful math functions on top of Python's +built-in :mod:`math` module. +""" + +from math import ceil as _ceil, floor as _floor +import bisect +import binascii + + +def clamp(x, lower=float('-inf'), upper=float('inf')): + """Limit a value to a given range. + + Args: + x (int or float): Number to be clamped. + lower (int or float): Minimum value for x. + upper (int or float): Maximum value for x. + + The returned value is guaranteed to be between *lower* and + *upper*. Integers, floats, and other comparable types can be + mixed. + + >>> clamp(1.0, 0, 5) + 1.0 + >>> clamp(-1.0, 0, 5) + 0 + >>> clamp(101.0, 0, 5) + 5 + >>> clamp(123, upper=5) + 5 + + Similar to `numpy's clip`_ function. + + .. _numpy's clip: http://docs.scipy.org/doc/numpy/reference/generated/numpy.clip.html + + """ + if upper < lower: + raise ValueError('expected upper bound (%r) >= lower bound (%r)' + % (upper, lower)) + return min(max(x, lower), upper) + + +def ceil(x, options=None): + """Return the ceiling of *x*. If *options* is set, return the smallest + integer or float from *options* that is greater than or equal to + *x*. + + Args: + x (int or float): Number to be tested. + options (iterable): Optional iterable of arbitrary numbers + (ints or floats). + + >>> VALID_CABLE_CSA = [1.5, 2.5, 4, 6, 10, 25, 35, 50] + >>> ceil(3.5, options=VALID_CABLE_CSA) + 4 + >>> ceil(4, options=VALID_CABLE_CSA) + 4 + """ + if options is None: + return _ceil(x) + options = sorted(options) + i = bisect.bisect_left(options, x) + if i == len(options): + raise ValueError("no ceil options greater than or equal to: %r" % x) + return options[i] + + +def floor(x, options=None): + """Return the floor of *x*. If *options* is set, return the largest + integer or float from *options* that is less than or equal to + *x*. + + Args: + x (int or float): Number to be tested. + options (iterable): Optional iterable of arbitrary numbers + (ints or floats). + + >>> VALID_CABLE_CSA = [1.5, 2.5, 4, 6, 10, 25, 35, 50] + >>> floor(3.5, options=VALID_CABLE_CSA) + 2.5 + >>> floor(2.5, options=VALID_CABLE_CSA) + 2.5 + + """ + if options is None: + return _floor(x) + options = sorted(options) + + i = bisect.bisect_right(options, x) + if not i: + raise ValueError("no floor options less than or equal to: %r" % x) + return options[i - 1] + + +class Bits: + ''' + An immutable bit-string or bit-array object. + Provides list-like access to bits as bools, + as well as bitwise masking and shifting operators. + Bits also make it easy to convert between many + different useful representations: + + * bytes -- good for serializing raw binary data + * int -- good for incrementing (e.g. to try all possible values) + * list of bools -- good for iterating over or treating as flags + * hex/bin string -- good for human readability + + ''' + __slots__ = ('val', 'len') + + def __init__(self, val=0, len_=None): + if type(val) is not int: + if type(val) is list: + val = ''.join(['1' if e else '0' for e in val]) + if type(val) is bytes: + val = val.decode('ascii') + if type(val) is str: + if len_ is None: + len_ = len(val) + if val.startswith('0x'): + len_ = (len_ - 2) * 4 + if val.startswith('0x'): + val = int(val, 16) + else: + if val: + val = int(val, 2) + else: + val = 0 + if type(val) is not int: + raise TypeError(f'initialized with bad type: {type(val).__name__}') + if val < 0: + raise ValueError('Bits cannot represent negative values') + if len_ is None: + len_ = len(f'{val:b}') + if val > 2 ** len_: + raise ValueError(f'value {val} cannot be represented with {len_} bits') + self.val = val # data is stored internally as integer + self.len = len_ + + def __getitem__(self, k): + if type(k) is slice: + return Bits(self.as_bin()[k]) + if type(k) is int: + if k >= self.len: + raise IndexError(k) + return bool((1 << (self.len - k - 1)) & self.val) + raise TypeError(type(k)) + + def __len__(self): + return self.len + + def __eq__(self, other): + if type(self) is not type(other): + return NotImplemented + return self.val == other.val and self.len == other.len + + def __or__(self, other): + if type(self) is not type(other): + return NotImplemented + return Bits(self.val | other.val, max(self.len, other.len)) + + def __and__(self, other): + if type(self) is not type(other): + return NotImplemented + return Bits(self.val & other.val, max(self.len, other.len)) + + def __lshift__(self, other): + return Bits(self.val << other, self.len + other) + + def __rshift__(self, other): + return Bits(self.val >> other, self.len - other) + + def __hash__(self): + return hash(self.val) + + def as_list(self): + return [c == '1' for c in self.as_bin()] + + def as_bin(self): + return f'{{0:0{self.len}b}}'.format(self.val) + + def as_hex(self): + # make template to pad out to number of bytes necessary to represent bits + tmpl = f'%0{2 * (self.len // 8 + ((self.len % 8) != 0))}X' + ret = tmpl % self.val + return ret + + def as_int(self): + return self.val + + def as_bytes(self): + return binascii.unhexlify(self.as_hex()) + + @classmethod + def from_list(cls, list_): + return cls(list_) + + @classmethod + def from_bin(cls, bin): + return cls(bin) + + @classmethod + def from_hex(cls, hex): + if isinstance(hex, bytes): + hex = hex.decode('ascii') + if not hex.startswith('0x'): + hex = '0x' + hex + return cls(hex) + + @classmethod + def from_int(cls, int_, len_=None): + return cls(int_, len_) + + @classmethod + def from_bytes(cls, bytes_): + return cls.from_hex(binascii.hexlify(bytes_)) + + def __repr__(self): + cn = self.__class__.__name__ + return f"{cn}('{self.as_bin()}')" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/mboxutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/mboxutils.py new file mode 100644 index 0000000000000000000000000000000000000000..299d105955a2f303190f2e52b75d8e81b590852c --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/mboxutils.py @@ -0,0 +1,150 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Useful utilities for working with the `mbox`_-formatted +mailboxes. Credit to Mark Williams for these. + +.. _mbox: https://en.wikipedia.org/wiki/Mbox +""" + +import mailbox +import tempfile + + +DEFAULT_MAXMEM = 4 * 1024 * 1024 # 4MB + + +class mbox_readonlydir(mailbox.mbox): + """A subclass of :class:`mailbox.mbox` suitable for use with mboxs + insides a read-only mail directory, e.g., ``/var/mail``. Otherwise + the API is exactly the same as the built-in mbox. + + Deletes messages via truncation, in the manner of `Heirloom mailx`_. + + Args: + path (str): Path to the mbox file. + factory (type): Message type (defaults to :class:`rfc822.Message`) + create (bool): Create mailbox if it does not exist. (defaults + to ``True``) + maxmem (int): Specifies, in bytes, the largest sized mailbox + to attempt to copy into memory. Larger mailboxes + will be copied incrementally which is more + hazardous. (defaults to 4MB) + + .. note:: + + Because this truncates and rewrites parts of the mbox file, + this class can corrupt your mailbox. Only use this if you know + the built-in :class:`mailbox.mbox` does not work for your use + case. + + .. _Heirloom mailx: http://heirloom.sourceforge.net/mailx.html + """ + def __init__(self, path, factory=None, create=True, maxmem=1024 * 1024): + mailbox.mbox.__init__(self, path, factory, create) + self.maxmem = maxmem + + def flush(self): + """Write any pending changes to disk. This is called on mailbox + close and is usually not called explicitly. + + .. note:: + + This deletes messages via truncation. Interruptions may + corrupt your mailbox. + """ + + # Appending and basic assertions are the same as in mailbox.mbox.flush. + if not self._pending: + if self._pending_sync: + # Messages have only been added, so syncing the file + # is enough. + mailbox._sync_flush(self._file) + self._pending_sync = False + return + + # In order to be writing anything out at all, self._toc must + # already have been generated (and presumably has been modified + # by adding or deleting an item). + assert self._toc is not None + + # Check length of self._file; if it's changed, some other process + # has modified the mailbox since we scanned it. + self._file.seek(0, 2) + cur_len = self._file.tell() + if cur_len != self._file_length: + raise mailbox.ExternalClashError('Size of mailbox file changed ' + '(expected %i, found %i)' % + (self._file_length, cur_len)) + + self._file.seek(0) + + # Truncation logic begins here. Mostly the same except we + # can use tempfile because we're not doing rename(2). + with tempfile.TemporaryFile() as new_file: + new_toc = {} + self._pre_mailbox_hook(new_file) + for key in sorted(self._toc.keys()): + start, stop = self._toc[key] + self._file.seek(start) + self._pre_message_hook(new_file) + new_start = new_file.tell() + while True: + buffer = self._file.read(min(4096, + stop - self._file.tell())) + if buffer == '': + break + new_file.write(buffer) + new_toc[key] = (new_start, new_file.tell()) + self._post_message_hook(new_file) + self._file_length = new_file.tell() + + self._file.seek(0) + new_file.seek(0) + + # Copy back our messages + if self._file_length <= self.maxmem: + self._file.write(new_file.read()) + else: + while True: + buffer = new_file.read(4096) + if not buffer: + break + self._file.write(buffer) + + # Delete the rest. + self._file.truncate() + + # Same wrap up. + self._toc = new_toc + self._pending = False + self._pending_sync = False + if self._locked: + mailbox._lock_file(self._file, dotlock=False) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/namedutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/namedutils.py new file mode 100644 index 0000000000000000000000000000000000000000..0311f81468b69822335e0c3299c431a28d17aa9e --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/namedutils.py @@ -0,0 +1,385 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""\ +The ``namedutils`` module defines two lightweight container types: +:class:`namedtuple` and :class:`namedlist`. Both are subtypes of built-in +sequence types, which are very fast and efficient. They simply add +named attribute accessors for specific indexes within themselves. + +The :class:`namedtuple` is identical to the built-in +:class:`collections.namedtuple`, with a couple of enhancements, +including a ``__repr__`` more suitable to inheritance. + +The :class:`namedlist` is the mutable counterpart to the +:class:`namedtuple`, and is much faster and lighter-weight than +full-blown :class:`object`. Consider this if you're implementing nodes +in a tree, graph, or other mutable data structure. If you want an even +skinnier approach, you'll probably have to look to C. +""" + + +import sys as _sys +from collections import OrderedDict +from keyword import iskeyword as _iskeyword +from operator import itemgetter as _itemgetter + + +__all__ = ['namedlist', 'namedtuple'] + +# Tiny templates + +_repr_tmpl = '{name}=%r' + +_imm_field_tmpl = '''\ + {name} = _property(_itemgetter({index:d}), doc='Alias for field {index:d}') +''' + +_m_field_tmpl = '''\ + {name} = _property(_itemgetter({index:d}), _itemsetter({index:d}), doc='Alias for field {index:d}') +''' + +################################################################# +### namedtuple +################################################################# + +_namedtuple_tmpl = '''\ +class {typename}(tuple): + '{typename}({arg_list})' + + __slots__ = () + + _fields = {field_names!r} + + def __new__(_cls, {arg_list}): # TODO: tweak sig to make more extensible + 'Create new instance of {typename}({arg_list})' + return _tuple.__new__(_cls, ({arg_list})) + + @classmethod + def _make(cls, iterable, new=_tuple.__new__, len=len): + 'Make a new {typename} object from a sequence or iterable' + result = new(cls, iterable) + if len(result) != {num_fields:d}: + raise TypeError('Expected {num_fields:d}' + ' arguments, got %d' % len(result)) + return result + + def __repr__(self): + 'Return a nicely formatted representation string' + tmpl = self.__class__.__name__ + '({repr_fmt})' + return tmpl % self + + def _asdict(self): + 'Return a new OrderedDict which maps field names to their values' + return OrderedDict(zip(self._fields, self)) + + def _replace(_self, **kwds): + 'Return a new {typename} object replacing field(s) with new values' + result = _self._make(map(kwds.pop, {field_names!r}, _self)) + if kwds: + raise ValueError('Got unexpected field names: %r' % kwds.keys()) + return result + + def __getnewargs__(self): + 'Return self as a plain tuple. Used by copy and pickle.' + return tuple(self) + + __dict__ = _property(_asdict) + + def __getstate__(self): + 'Exclude the OrderedDict from pickling' # wat + pass + +{field_defs} +''' + +def namedtuple(typename, field_names, verbose=False, rename=False): + """Returns a new subclass of tuple with named fields. + + >>> Point = namedtuple('Point', ['x', 'y']) + >>> Point.__doc__ # docstring for the new class + 'Point(x, y)' + >>> p = Point(11, y=22) # instantiate with pos args or keywords + >>> p[0] + p[1] # indexable like a plain tuple + 33 + >>> x, y = p # unpack like a regular tuple + >>> x, y + (11, 22) + >>> p.x + p.y # fields also accessible by name + 33 + >>> d = p._asdict() # convert to a dictionary + >>> d['x'] + 11 + >>> Point(**d) # convert from a dictionary + Point(x=11, y=22) + >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields + Point(x=100, y=22) + """ + + # Validate the field names. At the user's option, either generate an error + # message or automatically replace the field name with a valid name. + if isinstance(field_names, str): + field_names = field_names.replace(',', ' ').split() + field_names = [str(x) for x in field_names] + if rename: + seen = set() + for index, name in enumerate(field_names): + if (not all(c.isalnum() or c == '_' for c in name) + or _iskeyword(name) + or not name + or name[0].isdigit() + or name.startswith('_') + or name in seen): + field_names[index] = '_%d' % index + seen.add(name) + for name in [typename] + field_names: + if not all(c.isalnum() or c == '_' for c in name): + raise ValueError('Type names and field names can only contain ' + 'alphanumeric characters and underscores: %r' + % name) + if _iskeyword(name): + raise ValueError('Type names and field names cannot be a ' + 'keyword: %r' % name) + if name[0].isdigit(): + raise ValueError('Type names and field names cannot start with ' + 'a number: %r' % name) + seen = set() + for name in field_names: + if name.startswith('_') and not rename: + raise ValueError('Field names cannot start with an underscore: ' + '%r' % name) + if name in seen: + raise ValueError('Encountered duplicate field name: %r' % name) + seen.add(name) + + # Fill-in the class template + fmt_kw = {'typename': typename} + fmt_kw['field_names'] = tuple(field_names) + fmt_kw['num_fields'] = len(field_names) + fmt_kw['arg_list'] = repr(tuple(field_names)).replace("'", "")[1:-1] + fmt_kw['repr_fmt'] = ', '.join(_repr_tmpl.format(name=name) + for name in field_names) + fmt_kw['field_defs'] = '\n'.join(_imm_field_tmpl.format(index=index, name=name) + for index, name in enumerate(field_names)) + class_definition = _namedtuple_tmpl.format(**fmt_kw) + + if verbose: + print(class_definition) + + # Execute the template string in a temporary namespace and support + # tracing utilities by setting a value for frame.f_globals['__name__'] + namespace = dict(_itemgetter=_itemgetter, + __name__='namedtuple_%s' % typename, + OrderedDict=OrderedDict, + _property=property, + _tuple=tuple) + try: + exec(class_definition, namespace) + except SyntaxError as e: + raise SyntaxError(e.msg + ':\n' + class_definition) + result = namespace[typename] + + # For pickling to work, the __module__ variable needs to be set to the frame + # where the named tuple is created. Bypass this step in environments where + # sys._getframe is not defined (Jython for example) or sys._getframe is not + # defined for arguments greater than 0 (IronPython). + try: + frame = _sys._getframe(1) + result.__module__ = frame.f_globals.get('__name__', '__main__') + except (AttributeError, ValueError): + pass + + return result + + +################################################################# +### namedlist +################################################################# + +_namedlist_tmpl = '''\ +class {typename}(list): + '{typename}({arg_list})' + + __slots__ = () + + _fields = {field_names!r} + + def __new__(_cls, {arg_list}): # TODO: tweak sig to make more extensible + 'Create new instance of {typename}({arg_list})' + return _list.__new__(_cls, ({arg_list})) + + def __init__(self, {arg_list}): # tuple didn't need this but list does + return _list.__init__(self, ({arg_list})) + + @classmethod + def _make(cls, iterable, new=_list, len=len): + 'Make a new {typename} object from a sequence or iterable' + # why did this function exist? why not just star the + # iterable like below? + result = cls(*iterable) + if len(result) != {num_fields:d}: + raise TypeError('Expected {num_fields:d} arguments,' + ' got %d' % len(result)) + return result + + def __repr__(self): + 'Return a nicely formatted representation string' + tmpl = self.__class__.__name__ + '({repr_fmt})' + return tmpl % tuple(self) + + def _asdict(self): + 'Return a new OrderedDict which maps field names to their values' + return OrderedDict(zip(self._fields, self)) + + def _replace(_self, **kwds): + 'Return a new {typename} object replacing field(s) with new values' + result = _self._make(map(kwds.pop, {field_names!r}, _self)) + if kwds: + raise ValueError('Got unexpected field names: %r' % kwds.keys()) + return result + + def __getnewargs__(self): + 'Return self as a plain list. Used by copy and pickle.' + return tuple(self) + + __dict__ = _property(_asdict) + + def __getstate__(self): + 'Exclude the OrderedDict from pickling' # wat + pass + +{field_defs} +''' + + +def namedlist(typename, field_names, verbose=False, rename=False): + """Returns a new subclass of list with named fields. + + >>> Point = namedlist('Point', ['x', 'y']) + >>> Point.__doc__ # docstring for the new class + 'Point(x, y)' + >>> p = Point(11, y=22) # instantiate with pos args or keywords + >>> p[0] + p[1] # indexable like a plain list + 33 + >>> x, y = p # unpack like a regular list + >>> x, y + (11, 22) + >>> p.x + p.y # fields also accessible by name + 33 + >>> d = p._asdict() # convert to a dictionary + >>> d['x'] + 11 + >>> Point(**d) # convert from a dictionary + Point(x=11, y=22) + >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields + Point(x=100, y=22) + """ + + # Validate the field names. At the user's option, either generate an error + # message or automatically replace the field name with a valid name. + if isinstance(field_names, str): + field_names = field_names.replace(',', ' ').split() + field_names = [str(x) for x in field_names] + if rename: + seen = set() + for index, name in enumerate(field_names): + if (not all(c.isalnum() or c == '_' for c in name) + or _iskeyword(name) + or not name + or name[0].isdigit() + or name.startswith('_') + or name in seen): + field_names[index] = '_%d' % index + seen.add(name) + for name in [typename] + field_names: + if not all(c.isalnum() or c == '_' for c in name): + raise ValueError('Type names and field names can only contain ' + 'alphanumeric characters and underscores: %r' + % name) + if _iskeyword(name): + raise ValueError('Type names and field names cannot be a ' + 'keyword: %r' % name) + if name[0].isdigit(): + raise ValueError('Type names and field names cannot start with ' + 'a number: %r' % name) + seen = set() + for name in field_names: + if name.startswith('_') and not rename: + raise ValueError('Field names cannot start with an underscore: ' + '%r' % name) + if name in seen: + raise ValueError('Encountered duplicate field name: %r' % name) + seen.add(name) + + # Fill-in the class template + fmt_kw = {'typename': typename} + fmt_kw['field_names'] = tuple(field_names) + fmt_kw['num_fields'] = len(field_names) + fmt_kw['arg_list'] = repr(tuple(field_names)).replace("'", "")[1:-1] + fmt_kw['repr_fmt'] = ', '.join(_repr_tmpl.format(name=name) + for name in field_names) + fmt_kw['field_defs'] = '\n'.join(_m_field_tmpl.format(index=index, name=name) + for index, name in enumerate(field_names)) + class_definition = _namedlist_tmpl.format(**fmt_kw) + + if verbose: + print(class_definition) + + def _itemsetter(key): + def _itemsetter(obj, value): + obj[key] = value + return _itemsetter + + # Execute the template string in a temporary namespace and support + # tracing utilities by setting a value for frame.f_globals['__name__'] + namespace = dict(_itemgetter=_itemgetter, + _itemsetter=_itemsetter, + __name__='namedlist_%s' % typename, + OrderedDict=OrderedDict, + _property=property, + _list=list) + try: + exec(class_definition, namespace) + except SyntaxError as e: + raise SyntaxError(e.msg + ':\n' + class_definition) + result = namespace[typename] + + # For pickling to work, the __module__ variable needs to be set to + # the frame where the named list is created. Bypass this step in + # environments where sys._getframe is not defined (Jython for + # example) or sys._getframe is not defined for arguments greater + # than 0 (IronPython). + try: + frame = _sys._getframe(1) + result.__module__ = frame.f_globals.get('__name__', '__main__') + except (AttributeError, ValueError): + pass + + return result diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/pathutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/pathutils.py new file mode 100644 index 0000000000000000000000000000000000000000..a8cb2602f31b5920c67c03027684b01c22bf371c --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/pathutils.py @@ -0,0 +1,183 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" +Functions for working with filesystem paths. + +The :func:`expandpath` function expands the tilde to $HOME and environment +variables to their values. + +The :func:`augpath` function creates variants of an existing path without +having to spend multiple lines of code splitting it up and stitching it back +together. + +The :func:`shrinkuser` function replaces your home directory with a tilde. +""" + +from os.path import (expanduser, expandvars, join, normpath, split, splitext) +import os + + +__all__ = [ + 'augpath', 'shrinkuser', 'expandpath', +] + + +def augpath(path, suffix='', prefix='', ext=None, base=None, dpath=None, + multidot=False): + """ + Augment a path by modifying its components. + + Creates a new path with a different extension, basename, directory, prefix, + and/or suffix. + + A prefix is inserted before the basename. A suffix is inserted + between the basename and the extension. The basename and extension can be + replaced with a new one. Essentially a path is broken down into components + (dpath, base, ext), and then recombined as (dpath, prefix, base, suffix, + ext) after replacing any specified component. + + Args: + path (str | PathLike): a path to augment + suffix (str, default=''): placed between the basename and extension + prefix (str, default=''): placed in front of the basename + ext (str, default=None): if specified, replaces the extension + base (str, default=None): if specified, replaces the basename without + extension + dpath (str | PathLike, default=None): if specified, replaces the + directory + multidot (bool, default=False): Allows extensions to contain multiple + dots. Specifically, if False, everything after the last dot in the + basename is the extension. If True, everything after the first dot + in the basename is the extension. + + Returns: + str: augmented path + + Example: + >>> path = 'foo.bar' + >>> suffix = '_suff' + >>> prefix = 'pref_' + >>> ext = '.baz' + >>> newpath = augpath(path, suffix, prefix, ext=ext, base='bar') + >>> print('newpath = %s' % (newpath,)) + newpath = pref_bar_suff.baz + + Example: + >>> augpath('foo.bar') + 'foo.bar' + >>> augpath('foo.bar', ext='.BAZ') + 'foo.BAZ' + >>> augpath('foo.bar', suffix='_') + 'foo_.bar' + >>> augpath('foo.bar', prefix='_') + '_foo.bar' + >>> augpath('foo.bar', base='baz') + 'baz.bar' + >>> augpath('foo.tar.gz', ext='.zip', multidot=True) + 'foo.zip' + >>> augpath('foo.tar.gz', ext='.zip', multidot=False) + 'foo.tar.zip' + >>> augpath('foo.tar.gz', suffix='_new', multidot=True) + 'foo_new.tar.gz' + """ + # Breakup path + orig_dpath, fname = split(path) + if multidot: + # The first dot defines the extension + parts = fname.split('.', 1) + orig_base = parts[0] + orig_ext = '' if len(parts) == 1 else '.' + parts[1] + else: + # The last dot defines the extension + orig_base, orig_ext = splitext(fname) + # Replace parts with specified augmentations + if dpath is None: + dpath = orig_dpath + if ext is None: + ext = orig_ext + if base is None: + base = orig_base + # Recombine into new path + new_fname = ''.join((prefix, base, suffix, ext)) + newpath = join(dpath, new_fname) + return newpath + + +def shrinkuser(path, home='~'): + """ + Inverse of :func:`os.path.expanduser`. + + Args: + path (str | PathLike): path in system file structure + home (str, default='~'): symbol used to replace the home path. + Defaults to '~', but you might want to use '$HOME' or + '%USERPROFILE%' instead. + + Returns: + str: path: shortened path replacing the home directory with a tilde + + Example: + >>> path = expanduser('~') + >>> assert path != '~' + >>> assert shrinkuser(path) == '~' + >>> assert shrinkuser(path + '1') == path + '1' + >>> assert shrinkuser(path + '/1') == join('~', '1') + >>> assert shrinkuser(path + '/1', '$HOME') == join('$HOME', '1') + """ + path = normpath(path) + userhome_dpath = expanduser('~') + if path.startswith(userhome_dpath): + if len(path) == len(userhome_dpath): + path = home + elif path[len(userhome_dpath)] == os.path.sep: + path = home + path[len(userhome_dpath):] + return path + + +def expandpath(path): + """ + Shell-like expansion of environment variables and tilde home directory. + + Args: + path (str | PathLike): the path to expand + + Returns: + str : expanded path + + Example: + >>> import os + >>> os.environ['SPAM'] = 'eggs' + >>> assert expandpath('~/$SPAM') == expanduser('~/eggs') + >>> assert expandpath('foo') == 'foo' + """ + path = expanduser(path) + path = expandvars(path) + return path diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/queueutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/queueutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f6e4e4c28d0f0a394eb6deba7fec1f92b1344059 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/queueutils.py @@ -0,0 +1,223 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python comes with a many great data structures, from :class:`dict` +to :class:`collections.deque`, and no shortage of serviceable +algorithm implementations, from :func:`sorted` to :mod:`bisect`. But +priority queues are curiously relegated to an example documented in +:mod:`heapq`. Even there, the approach presented is not full-featured +and object-oriented. There is a built-in priority queue, +:class:`Queue.PriorityQueue`, but in addition to its austere API, it +carries the double-edged sword of threadsafety, making it fine for +multi-threaded, multi-consumer applications, but high-overhead for +cooperative/single-threaded use cases. + +The ``queueutils`` module currently provides two Queue +implementations: :class:`HeapPriorityQueue`, based on a heap, and +:class:`SortedPriorityQueue`, based on a sorted list. Both use a +unified API based on :class:`BasePriorityQueue` to facilitate testing +the slightly different performance characteristics on various +application use cases. + +>>> pq = PriorityQueue() +>>> pq.add('low priority task', 0) +>>> pq.add('high priority task', 2) +>>> pq.add('medium priority task 1', 1) +>>> pq.add('medium priority task 2', 1) +>>> len(pq) +4 +>>> pq.pop() +'high priority task' +>>> pq.peek() +'medium priority task 1' +>>> len(pq) +3 + +""" + + +from heapq import heappush, heappop +from bisect import insort +import itertools + +try: + from .typeutils import make_sentinel + _REMOVED = make_sentinel(var_name='_REMOVED') +except ImportError: + _REMOVED = object() + +try: + from .listutils import BList + # see BarrelList docstring for notes +except ImportError: + BList = list + + +__all__ = ['PriorityQueue', 'BasePriorityQueue', + 'HeapPriorityQueue', 'SortedPriorityQueue'] + + +# TODO: make Base a real abstract class +# TODO: add uniqueification + + +class BasePriorityQueue: + """The abstract base class for the other PriorityQueues in this + module. Override the ``_backend_type`` class attribute, as well as + the :meth:`_push_entry` and :meth:`_pop_entry` staticmethods for + custom subclass behavior. (Don't forget to use + :func:`staticmethod`). + + Args: + priority_key (callable): A function that takes *priority* as + passed in by :meth:`add` and returns a real number + representing the effective priority. + + """ + # negating priority means larger numbers = higher priority + _default_priority_key = staticmethod(lambda p: -float(p or 0)) + _backend_type = list + + def __init__(self, **kw): + self._pq = self._backend_type() + self._entry_map = {} + self._counter = itertools.count() + self._get_priority = kw.pop('priority_key', self._default_priority_key) + if kw: + raise TypeError('unexpected keyword arguments: %r' % kw.keys()) + + @staticmethod + def _push_entry(backend, entry): + pass # abstract + + @staticmethod + def _pop_entry(backend): + pass # abstract + + def add(self, task, priority=None): + """ + Add a task to the queue, or change the *task*'s priority if *task* + is already in the queue. *task* can be any hashable object, + and *priority* defaults to ``0``. Higher values representing + higher priority, but this behavior can be controlled by + setting *priority_key* in the constructor. + """ + priority = self._get_priority(priority) + if task in self._entry_map: + self.remove(task) + count = next(self._counter) + entry = [priority, count, task] + self._entry_map[task] = entry + self._push_entry(self._pq, entry) + + def remove(self, task): + """Remove a task from the priority queue. Raises :exc:`KeyError` if + the *task* is absent. + """ + entry = self._entry_map.pop(task) + entry[-1] = _REMOVED + + def _cull(self, raise_exc=True): + "Remove entries marked as removed by previous :meth:`remove` calls." + while self._pq: + priority, count, task = self._pq[0] + if task is _REMOVED: + self._pop_entry(self._pq) + continue + return + if raise_exc: + raise IndexError('empty priority queue') + + def peek(self, default=_REMOVED): + """Read the next value in the queue without removing it. Returns + *default* on an empty queue, or raises :exc:`KeyError` if + *default* is not set. + """ + try: + self._cull() + _, _, task = self._pq[0] + except IndexError: + if default is not _REMOVED: + return default + raise IndexError('peek on empty queue') + return task + + def pop(self, default=_REMOVED): + """Remove and return the next value in the queue. Returns *default* on + an empty queue, or raises :exc:`KeyError` if *default* is not + set. + """ + try: + self._cull() + _, _, task = self._pop_entry(self._pq) + del self._entry_map[task] + except IndexError: + if default is not _REMOVED: + return default + raise IndexError('pop on empty queue') + return task + + def __len__(self): + "Return the number of tasks in the queue." + return len(self._entry_map) + + +class HeapPriorityQueue(BasePriorityQueue): + """A priority queue inherited from :class:`BasePriorityQueue`, + backed by a list and based on the :func:`heapq.heappop` and + :func:`heapq.heappush` functions in the built-in :mod:`heapq` + module. + """ + @staticmethod + def _pop_entry(backend): + return heappop(backend) + + @staticmethod + def _push_entry(backend, entry): + heappush(backend, entry) + + +class SortedPriorityQueue(BasePriorityQueue): + """A priority queue inherited from :class:`BasePriorityQueue`, based + on the :func:`bisect.insort` approach for in-order insertion into + a sorted list. + """ + _backend_type = BList + + @staticmethod + def _pop_entry(backend): + return backend.pop(0) + + @staticmethod + def _push_entry(backend, entry): + insort(backend, entry) + + +PriorityQueue = SortedPriorityQueue diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/setutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/setutils.py new file mode 100644 index 0000000000000000000000000000000000000000..3ed5ab32052ebb2750f90a2bc07eab40b2249525 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/setutils.py @@ -0,0 +1,969 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""\ + +The :class:`set` type brings the practical expressiveness of +set theory to Python. It has a very rich API overall, but lacks a +couple of fundamental features. For one, sets are not ordered. On top +of this, sets are not indexable, i.e, ``my_set[8]`` will raise an +:exc:`TypeError`. The :class:`IndexedSet` type remedies both of these +issues without compromising on the excellent complexity +characteristics of Python's built-in set implementation. +""" + + +from bisect import bisect_left +from collections.abc import MutableSet +from itertools import chain, islice +import operator + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + + +__all__ = ['IndexedSet', 'complement'] + + +_COMPACTION_FACTOR = 8 + +# TODO: inherit from set() +# TODO: .discard_many(), .remove_many() +# TODO: raise exception on non-set params? +# TODO: technically reverse operators should probably reverse the +# order of the 'other' inputs and put self last (to try and maintain +# insertion order) + + +class IndexedSet(MutableSet): + """``IndexedSet`` is a :class:`collections.MutableSet` that maintains + insertion order and uniqueness of inserted elements. It's a hybrid + type, mostly like an OrderedSet, but also :class:`list`-like, in + that it supports indexing and slicing. + + Args: + other (iterable): An optional iterable used to initialize the set. + + >>> x = IndexedSet(list(range(4)) + list(range(8))) + >>> x + IndexedSet([0, 1, 2, 3, 4, 5, 6, 7]) + >>> x - set(range(2)) + IndexedSet([2, 3, 4, 5, 6, 7]) + >>> x[-1] + 7 + >>> fcr = IndexedSet('freecreditreport.com') + >>> ''.join(fcr[:fcr.index('.')]) + 'frecditpo' + + Standard set operators and interoperation with :class:`set` are + all supported: + + >>> fcr & set('cash4gold.com') + IndexedSet(['c', 'd', 'o', '.', 'm']) + + As you can see, the ``IndexedSet`` is almost like a ``UniqueList``, + retaining only one copy of a given value, in the order it was + first added. For the curious, the reason why IndexedSet does not + support setting items based on index (i.e, ``__setitem__()``), + consider the following dilemma:: + + my_indexed_set = [A, B, C, D] + my_indexed_set[2] = A + + At this point, a set requires only one *A*, but a :class:`list` would + overwrite *C*. Overwriting *C* would change the length of the list, + meaning that ``my_indexed_set[2]`` would not be *A*, as expected with a + list, but rather *D*. So, no ``__setitem__()``. + + Otherwise, the API strives to be as complete a union of the + :class:`list` and :class:`set` APIs as possible. + """ + def __init__(self, other=None): + self.item_index_map = dict() + self.item_list = [] + self.dead_indices = [] + self._compactions = 0 + self._c_max_size = 0 + if other: + self.update(other) + + # internal functions + @property + def _dead_index_count(self): + return len(self.item_list) - len(self.item_index_map) + + def _compact(self): + if not self.dead_indices: + return + self._compactions += 1 + dead_index_count = self._dead_index_count + items, index_map = self.item_list, self.item_index_map + self._c_max_size = max(self._c_max_size, len(items)) + for i, item in enumerate(self): + items[i] = item + index_map[item] = i + del items[-dead_index_count:] + del self.dead_indices[:] + + def _cull(self): + ded = self.dead_indices + if not ded: + return + items, ii_map = self.item_list, self.item_index_map + if not ii_map: + del items[:] + del ded[:] + elif len(ded) > 384: + self._compact() + elif self._dead_index_count > (len(items) / _COMPACTION_FACTOR): + self._compact() + elif items[-1] is _MISSING: # get rid of dead right hand side + num_dead = 1 + while items[-(num_dead + 1)] is _MISSING: + num_dead += 1 + if ded and ded[-1][1] == len(items): + del ded[-1] + del items[-num_dead:] + + def _get_real_index(self, index): + if index < 0: + index += len(self) + if not self.dead_indices: + return index + real_index = index + for d_start, d_stop in self.dead_indices: + if real_index < d_start: + break + real_index += d_stop - d_start + return real_index + + def _get_apparent_index(self, index): + if index < 0: + index += len(self) + if not self.dead_indices: + return index + apparent_index = index + for d_start, d_stop in self.dead_indices: + if index < d_start: + break + apparent_index -= d_stop - d_start + return apparent_index + + def _add_dead(self, start, stop=None): + # TODO: does not handle when the new interval subsumes + # multiple existing intervals + dints = self.dead_indices + if stop is None: + stop = start + 1 + cand_int = [start, stop] + if not dints: + dints.append(cand_int) + return + int_idx = bisect_left(dints, cand_int) + dint = dints[int_idx - 1] + d_start, d_stop = dint + if start <= d_start <= stop: + dint[0] = start + elif start <= d_stop <= stop: + dint[1] = stop + else: + dints.insert(int_idx, cand_int) + return + + # common operations (shared by set and list) + def __len__(self): + return len(self.item_index_map) + + def __contains__(self, item): + return item in self.item_index_map + + def __iter__(self): + return (item for item in self.item_list if item is not _MISSING) + + def __reversed__(self): + item_list = self.item_list + return (item for item in reversed(item_list) if item is not _MISSING) + + def __repr__(self): + return f'{self.__class__.__name__}({list(self)!r})' + + def __eq__(self, other): + if isinstance(other, IndexedSet): + return len(self) == len(other) and list(self) == list(other) + try: + return set(self) == set(other) + except TypeError: + return False + + @classmethod + def from_iterable(cls, it): + "from_iterable(it) -> create a set from an iterable" + return cls(it) + + # set operations + def add(self, item): + "add(item) -> add item to the set" + if item not in self.item_index_map: + self.item_index_map[item] = len(self.item_list) + self.item_list.append(item) + + def remove(self, item): + "remove(item) -> remove item from the set, raises if not present" + try: + didx = self.item_index_map.pop(item) + except KeyError: + raise KeyError(item) + self.item_list[didx] = _MISSING + self._add_dead(didx) + self._cull() + + def discard(self, item): + "discard(item) -> discard item from the set (does not raise)" + try: + self.remove(item) + except KeyError: + pass + + def clear(self): + "clear() -> empty the set" + del self.item_list[:] + del self.dead_indices[:] + self.item_index_map.clear() + + def isdisjoint(self, other): + "isdisjoint(other) -> return True if no overlap with other" + iim = self.item_index_map + for k in other: + if k in iim: + return False + return True + + def issubset(self, other): + "issubset(other) -> return True if other contains this set" + if len(other) < len(self): + return False + for k in self.item_index_map: + if k not in other: + return False + return True + + def issuperset(self, other): + "issuperset(other) -> return True if set contains other" + if len(other) > len(self): + return False + iim = self.item_index_map + for k in other: + if k not in iim: + return False + return True + + def union(self, *others): + "union(*others) -> return a new set containing this set and others" + return self.from_iterable(chain(self, *others)) + + def iter_intersection(self, *others): + "iter_intersection(*others) -> iterate over elements also in others" + for k in self: + for other in others: + if k not in other: + break + else: + yield k + return + + def intersection(self, *others): + "intersection(*others) -> get a set with overlap of this and others" + if len(others) == 1: + other = others[0] + return self.from_iterable(k for k in self if k in other) + return self.from_iterable(self.iter_intersection(*others)) + + def iter_difference(self, *others): + "iter_difference(*others) -> iterate over elements not in others" + for k in self: + for other in others: + if k in other: + break + else: + yield k + return + + def difference(self, *others): + "difference(*others) -> get a new set with elements not in others" + if len(others) == 1: + other = others[0] + return self.from_iterable(k for k in self if k not in other) + return self.from_iterable(self.iter_difference(*others)) + + def symmetric_difference(self, *others): + "symmetric_difference(*others) -> XOR set of this and others" + ret = self.union(*others) + return ret.difference(self.intersection(*others)) + + __or__ = __ror__ = union + __and__ = __rand__ = intersection + __sub__ = difference + __xor__ = __rxor__ = symmetric_difference + + def __rsub__(self, other): + vals = [x for x in other if x not in self] + return type(other)(vals) + + # in-place set operations + def update(self, *others): + "update(*others) -> add values from one or more iterables" + if not others: + return # raise? + elif len(others) == 1: + other = others[0] + else: + other = chain(others) + for o in other: + self.add(o) + + def intersection_update(self, *others): + "intersection_update(*others) -> discard self.difference(*others)" + for val in self.difference(*others): + self.discard(val) + + def difference_update(self, *others): + "difference_update(*others) -> discard self.intersection(*others)" + if self in others: + self.clear() + for val in self.intersection(*others): + self.discard(val) + + def symmetric_difference_update(self, other): # note singular 'other' + "symmetric_difference_update(other) -> in-place XOR with other" + if self is other: + self.clear() + for val in other: + if val in self: + self.discard(val) + else: + self.add(val) + + def __ior__(self, *others): + self.update(*others) + return self + + def __iand__(self, *others): + self.intersection_update(*others) + return self + + def __isub__(self, *others): + self.difference_update(*others) + return self + + def __ixor__(self, *others): + self.symmetric_difference_update(*others) + return self + + def iter_slice(self, start, stop, step=None): + "iterate over a slice of the set" + iterable = self + if start is not None: + start = self._get_real_index(start) + if stop is not None: + stop = self._get_real_index(stop) + if step is not None and step < 0: + step = -step + iterable = reversed(self) + return islice(iterable, start, stop, step) + + # list operations + def __getitem__(self, index): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + iter_slice = self.iter_slice(start, stop, step) + return self.from_iterable(iter_slice) + if index < 0: + index += len(self) + real_index = self._get_real_index(index) + try: + ret = self.item_list[real_index] + except IndexError: + raise IndexError('IndexedSet index out of range') + return ret + + def pop(self, index=None): + "pop(index) -> remove the item at a given index (-1 by default)" + item_index_map = self.item_index_map + len_self = len(item_index_map) + if index is None or index == -1 or index == len_self - 1: + ret = self.item_list.pop() + del item_index_map[ret] + else: + real_index = self._get_real_index(index) + ret = self.item_list[real_index] + self.item_list[real_index] = _MISSING + del item_index_map[ret] + self._add_dead(real_index) + self._cull() + return ret + + def count(self, val): + "count(val) -> count number of instances of value (0 or 1)" + if val in self.item_index_map: + return 1 + return 0 + + def reverse(self): + "reverse() -> reverse the contents of the set in-place" + reversed_list = list(reversed(self)) + self.item_list[:] = reversed_list + for i, item in enumerate(self.item_list): + self.item_index_map[item] = i + del self.dead_indices[:] + + def sort(self, **kwargs): + "sort() -> sort the contents of the set in-place" + sorted_list = sorted(self, **kwargs) + if sorted_list == self.item_list: + return + self.item_list[:] = sorted_list + for i, item in enumerate(self.item_list): + self.item_index_map[item] = i + del self.dead_indices[:] + + def index(self, val): + "index(val) -> get the index of a value, raises if not present" + try: + return self._get_apparent_index(self.item_index_map[val]) + except KeyError: + cn = self.__class__.__name__ + raise ValueError(f'{val!r} is not in {cn}') + + +def complement(wrapped): + """Given a :class:`set`, convert it to a **complement set**. + + Whereas a :class:`set` keeps track of what it contains, a + `complement set + `_ keeps + track of what it does *not* contain. For example, look what + happens when we intersect a normal set with a complement set:: + + >>> list(set(range(5)) & complement(set([2, 3]))) + [0, 1, 4] + + We get the everything in the left that wasn't in the right, + because intersecting with a complement is the same as subtracting + a normal set. + + Args: + wrapped (set): A set or any other iterable which should be + turned into a complement set. + + All set methods and operators are supported by complement sets, + between other :func:`complement`-wrapped sets and/or regular + :class:`set` objects. + + Because a complement set only tracks what elements are *not* in + the set, functionality based on set contents is unavailable: + :func:`len`, :func:`iter` (and for loops), and ``.pop()``. But a + complement set can always be turned back into a regular set by + complementing it again: + + >>> s = set(range(5)) + >>> complement(complement(s)) == s + True + + .. note:: + + An empty complement set corresponds to the concept of a + `universal set `_ + from mathematics. + + Complement sets by example + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + Many uses of sets can be expressed more simply by using a + complement. Rather than trying to work out in your head the proper + way to invert an expression, you can just throw a complement on + the set. Consider this example of a name filter:: + + >>> class NamesFilter(object): + ... def __init__(self, allowed): + ... self._allowed = allowed + ... + ... def filter(self, names): + ... return [name for name in names if name in self._allowed] + >>> NamesFilter(set(['alice', 'bob'])).filter(['alice', 'bob', 'carol']) + ['alice', 'bob'] + + What if we want to just express "let all the names through"? + + We could try to enumerate all of the expected names:: + + ``NamesFilter({'alice', 'bob', 'carol'})`` + + But this is very brittle -- what if at some point over this + object is changed to filter ``['alice', 'bob', 'carol', 'dan']``? + + Even worse, what about the poor programmer who next works + on this piece of code? They cannot tell whether the purpose + of the large allowed set was "allow everything", or if 'dan' + was excluded for some subtle reason. + + A complement set lets the programmer intention be expressed + succinctly and directly:: + + NamesFilter(complement(set())) + + Not only is this code short and robust, it is easy to understand + the intention. + + """ + if type(wrapped) is _ComplementSet: + return wrapped.complemented() + if type(wrapped) is frozenset: + return _ComplementSet(excluded=wrapped) + return _ComplementSet(excluded=set(wrapped)) + + +def _norm_args_typeerror(other): + '''normalize args and raise type-error if there is a problem''' + if type(other) in (set, frozenset): + inc, exc = other, None + elif type(other) is _ComplementSet: + inc, exc = other._included, other._excluded + else: + raise TypeError('argument must be another set or complement(set)') + return inc, exc + + +def _norm_args_notimplemented(other): + '''normalize args and return NotImplemented (for overloaded operators)''' + if type(other) in (set, frozenset): + inc, exc = other, None + elif type(other) is _ComplementSet: + inc, exc = other._included, other._excluded + else: + return NotImplemented, None + return inc, exc + + +class _ComplementSet: + """ + helper class for complement() that implements the set methods + """ + __slots__ = ('_included', '_excluded') + + def __init__(self, included=None, excluded=None): + if included is None: + assert type(excluded) in (set, frozenset) + elif excluded is None: + assert type(included) in (set, frozenset) + else: + raise ValueError('one of included or excluded must be a set') + self._included, self._excluded = included, excluded + + def __repr__(self): + if self._included is None: + return f'complement({repr(self._excluded)})' + return f'complement(complement({repr(self._included)}))' + + def complemented(self): + '''return a complement of the current set''' + if type(self._included) is frozenset or type(self._excluded) is frozenset: + return _ComplementSet(included=self._excluded, excluded=self._included) + return _ComplementSet( + included=None if self._excluded is None else set(self._excluded), + excluded=None if self._included is None else set(self._included)) + + __invert__ = complemented + + def complement(self): + '''convert the current set to its complement in-place''' + self._included, self._excluded = self._excluded, self._included + + def __contains__(self, item): + if self._included is None: + return not item in self._excluded + return item in self._included + + def add(self, item): + if self._included is None: + if item in self._excluded: + self._excluded.remove(item) + else: + self._included.add(item) + + def remove(self, item): + if self._included is None: + self._excluded.add(item) + else: + self._included.remove(item) + + def pop(self): + if self._included is None: + raise NotImplementedError # self.missing.add(random.choice(gc.objects())) + return self._included.pop() + + def intersection(self, other): + try: + return self & other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __and__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(included=inc - self._excluded) + else: # - - + return _ComplementSet(excluded=self._excluded.union(other._excluded)) + else: + if inc is None: # + - + return _ComplementSet(included=exc - self._included) + else: # + + + return _ComplementSet(included=self._included.intersection(inc)) + + __rand__ = __and__ + + def __iand__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + self._excluded = inc - self._excluded # TODO: do this in place? + else: # - - + self._excluded |= exc + else: + if inc is None: # + - + self._included -= exc + self._included, self._excluded = None, self._included + else: # + + + self._included &= inc + return self + + def union(self, other): + try: + return self | other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __or__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(excluded=self._excluded - inc) + else: # - - + return _ComplementSet(excluded=self._excluded.intersection(exc)) + else: + if inc is None: # + - + return _ComplementSet(excluded=exc - self._included) + else: # + + + return _ComplementSet(included=self._included.union(inc)) + + __ror__ = __or__ + + def __ior__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + self._excluded -= inc + else: # - - + self._excluded &= exc + else: + if inc is None: # + - + self._included, self._excluded = None, exc - self._included # TODO: do this in place? + else: # + + + self._included |= inc + return self + + def update(self, items): + if type(items) in (set, frozenset): + inc, exc = items, None + elif type(items) is _ComplementSet: + inc, exc = items._included, items._excluded + else: + inc, exc = frozenset(items), None + if self._included is None: + if exc is None: # - + + self._excluded &= inc + else: # - - + self._excluded.discard(exc) + else: + if inc is None: # + - + self._included &= exc + self._included, self._excluded = None, self._excluded + else: # + + + self._included.update(inc) + + def discard(self, items): + if type(items) in (set, frozenset): + inc, exc = items, None + elif type(items) is _ComplementSet: + inc, exc = items._included, items._excluded + else: + inc, exc = frozenset(items), None + if self._included is None: + if exc is None: # - + + self._excluded.update(inc) + else: # - - + self._included, self._excluded = exc - self._excluded, None + else: + if inc is None: # + - + self._included &= exc + else: # + + + self._included.discard(inc) + + def symmetric_difference(self, other): + try: + return self ^ other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __xor__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(excluded=self._excluded - inc) + else: # - - + return _ComplementSet(included=self._excluded.symmetric_difference(exc)) + else: + if inc is None: # + - + return _ComplementSet(excluded=exc - self._included) + else: # + + + return _ComplementSet(included=self._included.symmetric_difference(inc)) + + __rxor__ = __xor__ + + def symmetric_difference_update(self, other): + inc, exc = _norm_args_typeerror(other) + if self._included is None: + if exc is None: # - + + self._excluded |= inc + else: # - - + self._excluded.symmetric_difference_update(exc) + self._included, self._excluded = self._excluded, None + else: + if inc is None: # + - + self._included |= exc + self._included, self._excluded = None, self._included + else: # + + + self._included.symmetric_difference_update(inc) + + def isdisjoint(self, other): + inc, exc = _norm_args_typeerror(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return inc.issubset(self._excluded) + else: # - - + return False + else: + if inc is None: # + - + return self._included.issubset(exc) + else: # + + + return self._included.isdisjoint(inc) + + def issubset(self, other): + '''everything missing from other is also missing from self''' + try: + return self <= other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __le__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return False + else: # - - + return self._excluded.issupserset(exc) + else: + if inc is None: # + - + return self._included.isdisjoint(exc) + else: # + + + return self._included.issubset(inc) + + def __lt__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return False + else: # - - + return self._excluded > exc + else: + if inc is None: # + - + return self._included.isdisjoint(exc) + else: # + + + return self._included < inc + + def issuperset(self, other): + '''everything missing from self is also missing from super''' + try: + return self >= other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __ge__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return not self._excluded.intersection(inc) + else: # - - + return self._excluded.issubset(exc) + else: + if inc is None: # + - + return False + else: # + + + return self._included.issupserset(inc) + + def __gt__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return not self._excluded.intersection(inc) + else: # - - + return self._excluded < exc + else: + if inc is None: # + - + return False + else: # + + + return self._included > inc + + def difference(self, other): + try: + return self - other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __sub__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(excluded=self._excluded | inc) + else: # - - + return _ComplementSet(included=exc - self._excluded) + else: + if inc is None: # + - + return _ComplementSet(included=self._included & exc) + else: # + + + return _ComplementSet(included=self._included.difference(inc)) + + def __rsub__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + # rsub, so the expression being evaluated is "other - self" + if self._included is None: + if exc is None: # - + + return _ComplementSet(included=inc & self._excluded) + else: # - - + return _ComplementSet(included=self._excluded - exc) + else: + if inc is None: # + - + return _ComplementSet(excluded=exc | self._included) + else: # + + + return _ComplementSet(included=inc.difference(self._included)) + + def difference_update(self, other): + try: + self -= other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __isub__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + self._excluded |= inc + else: # - - + self._included, self._excluded = exc - self._excluded, None + else: + if inc is None: # + - + self._included &= exc + else: # + + + self._included.difference_update(inc) + return self + + def __eq__(self, other): + return ( + type(self) is type(other) + and self._included == other._included + and self._excluded == other._excluded) or ( + type(other) in (set, frozenset) and self._included == other) + + def __hash__(self): + return hash(self._included) ^ hash(self._excluded) + + def __len__(self): + if self._included is not None: + return len(self._included) + raise NotImplementedError('complemented sets have undefined length') + + def __iter__(self): + if self._included is not None: + return iter(self._included) + raise NotImplementedError('complemented sets have undefined contents') + + def __bool__(self): + if self._included is not None: + return bool(self._included) + return True + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/socketutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/socketutils.py new file mode 100644 index 0000000000000000000000000000000000000000..387f84f0dde1e0d6a80a7c0518e39be4c6949855 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/socketutils.py @@ -0,0 +1,766 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""At its heart, Python can be viewed as an extension of the C +programming language. Springing from the most popular systems +programming language has made Python itself a great language for +systems programming. One key to success in this domain is Python's +very serviceable :mod:`socket` module and its :class:`socket.socket` +type. + +The ``socketutils`` module provides natural next steps to the ``socket`` +builtin: straightforward, tested building blocks for higher-level +protocols. + +The :class:`BufferedSocket` wraps an ordinary socket, providing a +layer of intuitive buffering for both sending and receiving. This +facilitates parsing messages from streams, i.e., all sockets with type +``SOCK_STREAM``. The BufferedSocket enables receiving until the next +relevant token, up to a certain size, or until the connection is +closed. For all of these, it provides consistent APIs to size +limiting, as well as timeouts that are compatible with multiple +concurrency paradigms. Use it to parse the next one-off text or binary +socket protocol you encounter. + +This module also provides the :class:`NetstringSocket`, a pure-Python +implementation of `the Netstring protocol`_, built on top of the +:class:`BufferedSocket`, serving as a ready-made, production-grade example. + +Special thanks to `Kurt Rose`_ for his original authorship and all his +contributions on this module. Also thanks to `Daniel J. Bernstein`_, the +original author of `Netstring`_. + +.. _the Netstring protocol: https://en.wikipedia.org/wiki/Netstring +.. _Kurt Rose: https://github.com/doublereedkurt +.. _Daniel J. Bernstein: https://cr.yp.to/ +.. _Netstring: https://cr.yp.to/proto/netstrings.txt + +""" + +import time +import socket + +try: + from threading import RLock +except Exception: + class RLock: + 'Dummy reentrant lock for builds without threads' + def __enter__(self): + pass + + def __exit__(self, exctype, excinst, exctb): + pass + + +try: + from .typeutils import make_sentinel + _UNSET = make_sentinel(var_name='_UNSET') +except ImportError: + _UNSET = object() + + +DEFAULT_TIMEOUT = 10 # 10 seconds +DEFAULT_MAXSIZE = 32 * 1024 # 32kb +_RECV_LARGE_MAXSIZE = 1024 ** 5 # 1PB + + +class BufferedSocket: + """Mainly provides recv_until and recv_size. recv, send, sendall, and + peek all function as similarly as possible to the built-in socket + API. + + This type has been tested against both the built-in socket type as + well as those from gevent and eventlet. It also features support + for sockets with timeouts set to 0 (aka nonblocking), provided the + caller is prepared to handle the EWOULDBLOCK exceptions. + + Args: + sock (socket): The connected socket to be wrapped. + timeout (float): The default timeout for sends and recvs, in + seconds. Set to ``None`` for no timeout, and 0 for + nonblocking. Defaults to *sock*'s own timeout if already set, + and 10 seconds otherwise. + maxsize (int): The default maximum number of bytes to be received + into the buffer before it is considered full and raises an + exception. Defaults to 32 kilobytes. + recvsize (int): The number of bytes to recv for every + lower-level :meth:`socket.recv` call. Defaults to *maxsize*. + + *timeout* and *maxsize* can both be overridden on individual socket + operations. + + All ``recv`` methods return bytestrings (:class:`bytes`) and can + raise :exc:`socket.error`. :exc:`Timeout`, + :exc:`ConnectionClosed`, and :exc:`MessageTooLong` all inherit + from :exc:`socket.error` and exist to provide better error + messages. Received bytes are always buffered, even if an exception + is raised. Use :meth:`BufferedSocket.getrecvbuffer` to retrieve + partial recvs. + + BufferedSocket does not replace the built-in socket by any + means. While the overlapping parts of the API are kept parallel to + the built-in :class:`socket.socket`, BufferedSocket does not + inherit from socket, and most socket functionality is only + available on the underlying socket. :meth:`socket.getpeername`, + :meth:`socket.getsockname`, :meth:`socket.fileno`, and others are + only available on the underlying socket that is wrapped. Use the + ``BufferedSocket.sock`` attribute to access it. See the examples + for more information on how to use BufferedSockets with built-in + sockets. + + The BufferedSocket is threadsafe, but consider the semantics of + your protocol before accessing a single socket from multiple + threads. Similarly, once the BufferedSocket is constructed, avoid + using the underlying socket directly. Only use it for operations + unrelated to messages, e.g., :meth:`socket.getpeername`. + + """ + def __init__(self, sock, timeout=_UNSET, + maxsize=DEFAULT_MAXSIZE, recvsize=_UNSET): + self.sock = sock + self.rbuf = b'' + self.sbuf = [] + self.maxsize = int(maxsize) + + if timeout is _UNSET: + if self.sock.gettimeout() is None: + self.timeout = DEFAULT_TIMEOUT + else: + self.timeout = self.sock.gettimeout() + else: + if timeout is None: + self.timeout = timeout + else: + self.timeout = float(timeout) + + if recvsize is _UNSET: + self._recvsize = self.maxsize + else: + self._recvsize = int(recvsize) + + self._send_lock = RLock() + self._recv_lock = RLock() + + def settimeout(self, timeout): + "Set the default *timeout* for future operations, in seconds." + self.timeout = timeout + + def gettimeout(self): + return self.timeout + + def setblocking(self, blocking): + self.timeout = None if blocking else 0.0 + + def setmaxsize(self, maxsize): + """Set the default maximum buffer size *maxsize* for future + operations, in bytes. Does not truncate the current buffer. + """ + self.maxsize = maxsize + + def getrecvbuffer(self): + "Returns the receive buffer bytestring (rbuf)." + with self._recv_lock: + return self.rbuf + + def getsendbuffer(self): + "Returns a copy of the send buffer list." + with self._send_lock: + return b''.join(self.sbuf) + + def recv(self, size, flags=0, timeout=_UNSET): + """Returns **up to** *size* bytes, using the internal buffer before + performing a single :meth:`socket.recv` operation. + + Args: + size (int): The maximum number of bytes to receive. + flags (int): Kept for API compatibility with sockets. Only + the default, ``0``, is valid. + timeout (float): The timeout for this operation. Can be + ``0`` for nonblocking and ``None`` for no + timeout. Defaults to the value set in the constructor + of BufferedSocket. + + If the operation does not complete in *timeout* seconds, a + :exc:`Timeout` is raised. Much like the built-in + :class:`socket.socket`, if this method returns an empty string, + then the socket is closed and recv buffer is empty. Further + calls to recv will raise :exc:`socket.error`. + + """ + with self._recv_lock: + if timeout is _UNSET: + timeout = self.timeout + if flags: + raise ValueError("non-zero flags not supported: %r" % flags) + if len(self.rbuf) >= size: + data, self.rbuf = self.rbuf[:size], self.rbuf[size:] + return data + if self.rbuf: + ret, self.rbuf = self.rbuf, b'' + return ret + self.sock.settimeout(timeout) + try: + data = self.sock.recv(self._recvsize) + except socket.timeout: + raise Timeout(timeout) # check the rbuf attr for more + if len(data) > size: + data, self.rbuf = data[:size], data[size:] + return data + + def peek(self, size, timeout=_UNSET): + """Returns *size* bytes from the socket and/or internal buffer. Bytes + are retained in BufferedSocket's internal recv buffer. To only + see bytes in the recv buffer, use :meth:`getrecvbuffer`. + + Args: + size (int): The exact number of bytes to peek at + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + + If the appropriate number of bytes cannot be fetched from the + buffer and socket before *timeout* expires, then a + :exc:`Timeout` will be raised. If the connection is closed, a + :exc:`ConnectionClosed` will be raised. + """ + with self._recv_lock: + if len(self.rbuf) >= size: + return self.rbuf[:size] + data = self.recv_size(size, timeout=timeout) + self.rbuf = data + self.rbuf + return data + + def recv_close(self, timeout=_UNSET, maxsize=_UNSET): + """Receive until the connection is closed, up to *maxsize* bytes. If + more than *maxsize* bytes are received, raises :exc:`MessageTooLong`. + """ + # recv_close works by using recv_size to request maxsize data, + # and ignoring ConnectionClose, returning and clearing the + # internal buffer instead. It raises an exception if + # ConnectionClosed isn't raised. + with self._recv_lock: + if maxsize is _UNSET: + maxsize = self.maxsize + if maxsize is None: + maxsize = _RECV_LARGE_MAXSIZE + try: + recvd = self.recv_size(maxsize + 1, timeout) + except ConnectionClosed: + ret, self.rbuf = self.rbuf, b'' + else: + # put extra received bytes (now in rbuf) after recvd + self.rbuf = recvd + self.rbuf + size_read = min(maxsize, len(self.rbuf)) + raise MessageTooLong(size_read) # check receive buffer + return ret + + def recv_until(self, delimiter, timeout=_UNSET, maxsize=_UNSET, + with_delimiter=False): + """Receive until *delimiter* is found, *maxsize* bytes have been read, + or *timeout* is exceeded. + + Args: + delimiter (bytes): One or more bytes to be searched for + in the socket stream. + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + maxsize (int): The maximum size for the internal buffer. + Defaults to the value set in the constructor. + with_delimiter (bool): Whether or not to include the + delimiter in the output. ``False`` by default, but + ``True`` is useful in cases where one is simply + forwarding the messages. + + ``recv_until`` will raise the following exceptions: + + * :exc:`Timeout` if more than *timeout* seconds expire. + * :exc:`ConnectionClosed` if the underlying socket is closed + by the sending end. + * :exc:`MessageTooLong` if the delimiter is not found in the + first *maxsize* bytes. + * :exc:`socket.error` if operating in nonblocking mode + (*timeout* equal to 0), or if some unexpected socket error + occurs, such as operating on a closed socket. + + """ + with self._recv_lock: + if maxsize is _UNSET: + maxsize = self.maxsize + if maxsize is None: + maxsize = _RECV_LARGE_MAXSIZE + if timeout is _UNSET: + timeout = self.timeout + len_delimiter = len(delimiter) + + sock = self.sock + recvd = bytearray(self.rbuf) + start = time.time() + find_offset_start = 0 # becomes a negative index below + + if not timeout: # covers None (no timeout) and 0 (nonblocking) + sock.settimeout(timeout) + try: + while 1: + offset = recvd.find(delimiter, find_offset_start, maxsize) + if offset != -1: # str.find returns -1 when no match found + if with_delimiter: # include delimiter in return + offset += len_delimiter + rbuf_offset = offset + else: + rbuf_offset = offset + len_delimiter + break + elif len(recvd) > maxsize: + raise MessageTooLong(maxsize, delimiter) # see rbuf + if timeout: + cur_timeout = timeout - (time.time() - start) + if cur_timeout <= 0.0: + raise socket.timeout() + sock.settimeout(cur_timeout) + nxt = sock.recv(self._recvsize) + if not nxt: + args = (len(recvd), delimiter) + msg = ('connection closed after reading %s bytes' + ' without finding symbol: %r' % args) + raise ConnectionClosed(msg) # check the recv buffer + recvd.extend(nxt) + find_offset_start = -len(nxt) - len_delimiter + 1 + except socket.timeout: + self.rbuf = bytes(recvd) + msg = ('read %s bytes without finding delimiter: %r' + % (len(recvd), delimiter)) + raise Timeout(timeout, msg) # check the recv buffer + except Exception: + self.rbuf = bytes(recvd) + raise + val, self.rbuf = bytes(recvd[:offset]), bytes(recvd[rbuf_offset:]) + return val + + def recv_size(self, size, timeout=_UNSET): + """Read off of the internal buffer, then off the socket, until + *size* bytes have been read. + + Args: + size (int): number of bytes to read before returning. + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + + If the appropriate number of bytes cannot be fetched from the + buffer and socket before *timeout* expires, then a + :exc:`Timeout` will be raised. If the connection is closed, a + :exc:`ConnectionClosed` will be raised. + """ + with self._recv_lock: + if timeout is _UNSET: + timeout = self.timeout + chunks = [] + total_bytes = 0 + try: + start = time.time() + self.sock.settimeout(timeout) + nxt = self.rbuf or self.sock.recv(self._recvsize) + while nxt: + total_bytes += len(nxt) + if total_bytes >= size: + break + chunks.append(nxt) + if timeout: + cur_timeout = timeout - (time.time() - start) + if cur_timeout <= 0.0: + raise socket.timeout() + self.sock.settimeout(cur_timeout) + nxt = self.sock.recv(self._recvsize) + else: + msg = ('connection closed after reading %s of %s requested' + ' bytes' % (total_bytes, size)) + raise ConnectionClosed(msg) # check recv buffer + except socket.timeout: + self.rbuf = b''.join(chunks) + msg = f'read {total_bytes} of {size} bytes' + raise Timeout(timeout, msg) # check recv buffer + except Exception: + # received data is still buffered in the case of errors + self.rbuf = b''.join(chunks) + raise + extra_bytes = total_bytes - size + if extra_bytes: + last, self.rbuf = nxt[:-extra_bytes], nxt[-extra_bytes:] + else: + last, self.rbuf = nxt, b'' + chunks.append(last) + return b''.join(chunks) + + def send(self, data, flags=0, timeout=_UNSET): + """Send the contents of the internal send buffer, as well as *data*, + to the receiving end of the connection. Returns the total + number of bytes sent. If no exception is raised, all of *data* was + sent and the internal send buffer is empty. + + Args: + data (bytes): The bytes to send. + flags (int): Kept for API compatibility with sockets. Only + the default 0 is valid. + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + + Will raise :exc:`Timeout` if the send operation fails to + complete before *timeout*. In the event of an exception, use + :meth:`BufferedSocket.getsendbuffer` to see which data was + unsent. + """ + with self._send_lock: + if timeout is _UNSET: + timeout = self.timeout + if flags: + raise ValueError("non-zero flags not supported") + sbuf = self.sbuf + sbuf.append(data) + if len(sbuf) > 1: + sbuf[:] = [b''.join([s for s in sbuf if s])] + self.sock.settimeout(timeout) + start, total_sent = time.time(), 0 + try: + while sbuf[0]: + sent = self.sock.send(sbuf[0]) + total_sent += sent + sbuf[0] = sbuf[0][sent:] + if timeout: + cur_timeout = timeout - (time.time() - start) + if cur_timeout <= 0.0: + raise socket.timeout() + self.sock.settimeout(cur_timeout) + except socket.timeout: + raise Timeout(timeout, '%s bytes unsent' % len(sbuf[0])) + return total_sent + + def sendall(self, data, flags=0, timeout=_UNSET): + """A passthrough to :meth:`~BufferedSocket.send`, retained for + parallelism to the :class:`socket.socket` API. + """ + return self.send(data, flags, timeout) + + def flush(self): + "Send the contents of the internal send buffer." + with self._send_lock: + self.send(b'') + return + + def buffer(self, data): + "Buffer *data* bytes for the next send operation." + with self._send_lock: + self.sbuf.append(data) + return + + # # # + # # # Passing through some socket basics + # # # + + def getsockname(self): + """Convenience function to return the wrapped socket's own address. + See :meth:`socket.getsockname` for more details. + """ + return self.sock.getsockname() + + def getpeername(self): + """Convenience function to return the remote address to which the + wrapped socket is connected. See :meth:`socket.getpeername` + for more details. + """ + return self.sock.getpeername() + + def getsockopt(self, level, optname, buflen=None): + """Convenience function passing through to the wrapped socket's + :meth:`socket.getsockopt`. + """ + args = (level, optname) + if buflen is not None: + args += (buflen,) + return self.sock.getsockopt(*args) + + def setsockopt(self, level, optname, value): + """Convenience function passing through to the wrapped socket's + :meth:`socket.setsockopt`. + """ + return self.sock.setsockopt(level, optname, value) + + @property + def type(self): + """A passthrough to the wrapped socket's type. Valid usages should + only ever see :data:`socket.SOCK_STREAM`. + """ + return self.sock.type + + @property + def family(self): + """A passthrough to the wrapped socket's family. BufferedSocket + supports all widely-used families, so this read-only attribute + can be one of :data:`socket.AF_INET` for IP, + :data:`socket.AF_INET6` for IPv6, and :data:`socket.AF_UNIX` + for UDS. + """ + return self.sock.family + + @property + def proto(self): + """A passthrough to the wrapped socket's protocol. The ``proto`` + attribute is very rarely used, so it's always 0, meaning "the + default" protocol. Pretty much all the practical information + is in :attr:`~BufferedSocket.type` and + :attr:`~BufferedSocket.family`, so you can go back to never + thinking about this. + """ + return self.sock.proto + + # # # + # # # Now for some more advanced interpretations of the builtin socket + # # # + + def fileno(self): + """Returns the file descriptor of the wrapped socket. -1 if it has + been closed on this end. + + Note that this makes the BufferedSocket selectable, i.e., + usable for operating system event loops without any external + libraries. Keep in mind that the operating system cannot know + about data in BufferedSocket's internal buffer. Exercise + discipline with calling ``recv*`` functions. + """ + return self.sock.fileno() + + def close(self): + """Closes the wrapped socket, and empties the internal buffers. The + send buffer is not flushed automatically, so if you have been + calling :meth:`~BufferedSocket.buffer`, be sure to call + :meth:`~BufferedSocket.flush` before calling this + method. After calling this method, future socket operations + will raise :exc:`socket.error`. + """ + with self._recv_lock: + with self._send_lock: + self.rbuf = b'' + self.rbuf_unconsumed = self.rbuf + self.sbuf[:] = [] + self.sock.close() + return + + def shutdown(self, how): + """Convenience method which passes through to the wrapped socket's + :meth:`~socket.shutdown`. Semantics vary by platform, so no + special internal handling is done with the buffers. This + method exists to facilitate the most common usage, wherein a + full ``shutdown`` is followed by a + :meth:`~BufferedSocket.close`. Developers requiring more + support, please open `an issue`_. + + .. _an issue: https://github.com/mahmoud/boltons/issues + """ + with self._recv_lock: + with self._send_lock: + self.sock.shutdown(how) + return + + # end BufferedSocket + + +class Error(socket.error): + """A subclass of :exc:`socket.error` from which all other + ``socketutils`` exceptions inherit. + + When using :class:`BufferedSocket` and other ``socketutils`` + types, generally you want to catch one of the specific exception + types below, or :exc:`socket.error`. + """ + pass + + +class ConnectionClosed(Error): + """Raised when receiving and the connection is unexpectedly closed + from the sending end. Raised from :class:`BufferedSocket`'s + :meth:`~BufferedSocket.peek`, :meth:`~BufferedSocket.recv_until`, + and :meth:`~BufferedSocket.recv_size`, and never from its + :meth:`~BufferedSocket.recv` or + :meth:`~BufferedSocket.recv_close`. + """ + pass + + +class MessageTooLong(Error): + """Raised from :meth:`BufferedSocket.recv_until` and + :meth:`BufferedSocket.recv_closed` when more than *maxsize* bytes are + read without encountering the delimiter or a closed connection, + respectively. + """ + def __init__(self, bytes_read=None, delimiter=None): + msg = 'message exceeded maximum size' + if bytes_read is not None: + msg += f'. {bytes_read} bytes read' + if delimiter is not None: + msg += f'. Delimiter not found: {delimiter!r}' + super().__init__(msg) + + +class Timeout(socket.timeout, Error): + """Inheriting from :exc:`socket.timeout`, Timeout is used to indicate + when a socket operation did not complete within the time + specified. Raised from any of :class:`BufferedSocket`'s ``recv`` + methods. + """ + def __init__(self, timeout, extra=""): + msg = 'socket operation timed out' + if timeout is not None: + msg += ' after %sms.' % (timeout * 1000) + if extra: + msg += ' ' + extra + super().__init__(msg) + + +class NetstringSocket: + """ + Reads and writes using the netstring protocol. + + More info: https://en.wikipedia.org/wiki/Netstring + Even more info: http://cr.yp.to/proto/netstrings.txt + """ + def __init__(self, sock, timeout=DEFAULT_TIMEOUT, maxsize=DEFAULT_MAXSIZE): + self.bsock = BufferedSocket(sock) + self.timeout = timeout + self.maxsize = maxsize + self._msgsize_maxsize = len(str(maxsize)) + 1 # len(str()) == log10 + + def fileno(self): + return self.bsock.fileno() + + def settimeout(self, timeout): + self.timeout = timeout + + def setmaxsize(self, maxsize): + self.maxsize = maxsize + self._msgsize_maxsize = self._calc_msgsize_maxsize(maxsize) + + def _calc_msgsize_maxsize(self, maxsize): + return len(str(maxsize)) + 1 # len(str()) == log10 + + def read_ns(self, timeout=_UNSET, maxsize=_UNSET): + if timeout is _UNSET: + timeout = self.timeout + + if maxsize is _UNSET: + maxsize = self.maxsize + msgsize_maxsize = self._msgsize_maxsize + else: + msgsize_maxsize = self._calc_msgsize_maxsize(maxsize) + + size_prefix = self.bsock.recv_until(b':', + timeout=timeout, + maxsize=msgsize_maxsize) + try: + size = int(size_prefix) + except ValueError: + raise NetstringInvalidSize('netstring message size must be valid' + ' integer, not %r' % size_prefix) + + if size > maxsize: + raise NetstringMessageTooLong(size, maxsize) + payload = self.bsock.recv_size(size) + if self.bsock.recv(1) != b',': + raise NetstringProtocolError("expected trailing ',' after message") + + return payload + + def write_ns(self, payload): + size = len(payload) + if size > self.maxsize: + raise NetstringMessageTooLong(size, self.maxsize) + data = str(size).encode('ascii') + b':' + payload + b',' + self.bsock.send(data) + + +class NetstringProtocolError(Error): + "Base class for all of socketutils' Netstring exception types." + pass + + +class NetstringInvalidSize(NetstringProtocolError): + """NetstringInvalidSize is raised when the ``:``-delimited size prefix + of the message does not contain a valid integer. + + Message showing valid size:: + + 5:hello, + + Here the ``5`` is the size. Anything in this prefix position that + is not parsable as a Python integer (i.e., :class:`int`) will raise + this exception. + """ + def __init__(self, msg): + super().__init__(msg) + + +class NetstringMessageTooLong(NetstringProtocolError): + """NetstringMessageTooLong is raised when the size prefix contains a + valid integer, but that integer is larger than the + :class:`NetstringSocket`'s configured *maxsize*. + + When this exception is raised, it's recommended to simply close + the connection instead of trying to recover. + """ + def __init__(self, size, maxsize): + msg = ('netstring message length exceeds configured maxsize: %s > %s' + % (size, maxsize)) + super().__init__(msg) + + +""" +attrs worth adding/passing through: + + +properties: type, proto + +For its main functionality, BufferedSocket can wrap any object that +has the following methods: + + - gettimeout() + - settimeout() + - recv(size) + - send(data) + +The following methods are passed through: + +... + +""" + +# TODO: buffered socket check socket.type == SOCK_STREAM? +# TODO: make recv_until support taking a regex +# TODO: including the delimiter in the recv_until return is not +# necessary, as ConnectionClosed differentiates empty messages +# from socket closes. diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/statsutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/statsutils.py new file mode 100644 index 0000000000000000000000000000000000000000..36a82230d80f2b6e32fcf07851da2aa2c4d7132b --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/statsutils.py @@ -0,0 +1,814 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""``statsutils`` provides tools aimed primarily at descriptive +statistics for data analysis, such as :func:`mean` (average), +:func:`median`, :func:`variance`, and many others, + +The :class:`Stats` type provides all the main functionality of the +``statsutils`` module. A :class:`Stats` object wraps a given dataset, +providing all statistical measures as property attributes. These +attributes cache their results, which allows efficient computation of +multiple measures, as many measures rely on other measures. For +example, relative standard deviation (:attr:`Stats.rel_std_dev`) +relies on both the mean and standard deviation. The Stats object +caches those results so no rework is done. + +The :class:`Stats` type's attributes have module-level counterparts for +convenience when the computation reuse advantages do not apply. + +>>> stats = Stats(range(42)) +>>> stats.mean +20.5 +>>> mean(range(42)) +20.5 + +Statistics is a large field, and ``statsutils`` is focused on a few +basic techniques that are useful in software. The following is a brief +introduction to those techniques. For a more in-depth introduction, +`Statistics for Software +`_, +an article I wrote on the topic. It introduces key terminology vital +to effective usage of statistics. + +Statistical moments +------------------- + +Python programmers are probably familiar with the concept of the +*mean* or *average*, which gives a rough quantitiative middle value by +which a sample can be can be generalized. However, the mean is just +the first of four `moment`_-based measures by which a sample or +distribution can be measured. + +The four `Standardized moments`_ are: + + 1. `Mean`_ - :func:`mean` - theoretical middle value + 2. `Variance`_ - :func:`variance` - width of value dispersion + 3. `Skewness`_ - :func:`skewness` - symmetry of distribution + 4. `Kurtosis`_ - :func:`kurtosis` - "peakiness" or "long-tailed"-ness + +For more information check out `the Moment article on Wikipedia`_. + +.. _moment: https://en.wikipedia.org/wiki/Moment_(mathematics) +.. _Standardized moments: https://en.wikipedia.org/wiki/Standardized_moment +.. _Mean: https://en.wikipedia.org/wiki/Mean +.. _Variance: https://en.wikipedia.org/wiki/Variance +.. _Skewness: https://en.wikipedia.org/wiki/Skewness +.. _Kurtosis: https://en.wikipedia.org/wiki/Kurtosis +.. _the Moment article on Wikipedia: https://en.wikipedia.org/wiki/Moment_(mathematics) + +Keep in mind that while these moments can give a bit more insight into +the shape and distribution of data, they do not guarantee a complete +picture. Wildly different datasets can have the same values for all +four moments, so generalize wisely. + +Robust statistics +----------------- + +Moment-based statistics are notorious for being easily skewed by +outliers. The whole field of robust statistics aims to mitigate this +dilemma. ``statsutils`` also includes several robust statistical methods: + + * `Median`_ - The middle value of a sorted dataset + * `Trimean`_ - Another robust measure of the data's central tendency + * `Median Absolute Deviation`_ (MAD) - A robust measure of + variability, a natural counterpart to :func:`variance`. + * `Trimming`_ - Reducing a dataset to only the middle majority of + data is a simple way of making other estimators more robust. + +.. _Median: https://en.wikipedia.org/wiki/Median +.. _Trimean: https://en.wikipedia.org/wiki/Trimean +.. _Median Absolute Deviation: https://en.wikipedia.org/wiki/Median_absolute_deviation +.. _Trimming: https://en.wikipedia.org/wiki/Trimmed_estimator + + +Online and Offline Statistics +----------------------------- + +Unrelated to computer networking, `online`_ statistics involve +calculating statistics in a `streaming`_ fashion, without all the data +being available. The :class:`Stats` type is meant for the more +traditional offline statistics when all the data is available. For +pure-Python online statistics accumulators, look at the `Lithoxyl`_ +system instrumentation package. + +.. _Online: https://en.wikipedia.org/wiki/Online_algorithm +.. _streaming: https://en.wikipedia.org/wiki/Streaming_algorithm +.. _Lithoxyl: https://github.com/mahmoud/lithoxyl + +""" + + +import bisect +from math import floor, ceil +from collections import Counter + + +class _StatsProperty: + def __init__(self, name, func): + self.name = name + self.func = func + self.internal_name = '_' + name + + doc = func.__doc__ or '' + pre_doctest_doc, _, _ = doc.partition('>>>') + self.__doc__ = pre_doctest_doc + + def __get__(self, obj, objtype=None): + if obj is None: + return self + if not obj.data: + return obj.default + try: + return getattr(obj, self.internal_name) + except AttributeError: + setattr(obj, self.internal_name, self.func(obj)) + return getattr(obj, self.internal_name) + + +class Stats: + """The ``Stats`` type is used to represent a group of unordered + statistical datapoints for calculations such as mean, median, and + variance. + + Args: + + data (list): List or other iterable containing numeric values. + default (float): A value to be returned when a given + statistical measure is not defined. 0.0 by default, but + ``float('nan')`` is appropriate for stricter applications. + use_copy (bool): By default Stats objects copy the initial + data into a new list to avoid issues with + modifications. Pass ``False`` to disable this behavior. + is_sorted (bool): Presorted data can skip an extra sorting + step for a little speed boost. Defaults to False. + + """ + def __init__(self, data, default=0.0, use_copy=True, is_sorted=False): + self._use_copy = use_copy + self._is_sorted = is_sorted + if use_copy: + self.data = list(data) + else: + self.data = data + + self.default = default + cls = self.__class__ + self._prop_attr_names = [a for a in dir(self) + if isinstance(getattr(cls, a, None), + _StatsProperty)] + self._pearson_precision = 0 + + def __len__(self): + return len(self.data) + + def __iter__(self): + return iter(self.data) + + def _get_sorted_data(self): + """When using a copy of the data, it's better to have that copy be + sorted, but we do it lazily using this method, in case no + sorted measures are used. I.e., if median is never called, + sorting would be a waste. + + When not using a copy, it's presumed that all optimizations + are on the user. + """ + if not self._use_copy: + return sorted(self.data) + elif not self._is_sorted: + self.data.sort() + return self.data + + def clear_cache(self): + """``Stats`` objects automatically cache intermediary calculations + that can be reused. For instance, accessing the ``std_dev`` + attribute after the ``variance`` attribute will be + significantly faster for medium-to-large datasets. + + If you modify the object by adding additional data points, + call this function to have the cached statistics recomputed. + + """ + for attr_name in self._prop_attr_names: + attr_name = getattr(self.__class__, attr_name).internal_name + if not hasattr(self, attr_name): + continue + delattr(self, attr_name) + return + + def _calc_count(self): + """The number of items in this Stats object. Returns the same as + :func:`len` on a Stats object, but provided for pandas terminology + parallelism. + + >>> Stats(range(20)).count + 20 + """ + return len(self.data) + count = _StatsProperty('count', _calc_count) + + def _calc_mean(self): + """ + The arithmetic mean, or "average". Sum of the values divided by + the number of values. + + >>> mean(range(20)) + 9.5 + >>> mean(list(range(19)) + [949]) # 949 is an arbitrary outlier + 56.0 + """ + return sum(self.data, 0.0) / len(self.data) + mean = _StatsProperty('mean', _calc_mean) + + def _calc_max(self): + """ + The maximum value present in the data. + + >>> Stats([2, 1, 3]).max + 3 + """ + if self._is_sorted: + return self.data[-1] + return max(self.data) + max = _StatsProperty('max', _calc_max) + + def _calc_min(self): + """ + The minimum value present in the data. + + >>> Stats([2, 1, 3]).min + 1 + """ + if self._is_sorted: + return self.data[0] + return min(self.data) + min = _StatsProperty('min', _calc_min) + + def _calc_median(self): + """ + The median is either the middle value or the average of the two + middle values of a sample. Compared to the mean, it's generally + more resilient to the presence of outliers in the sample. + + >>> median([2, 1, 3]) + 2 + >>> median(range(97)) + 48 + >>> median(list(range(96)) + [1066]) # 1066 is an arbitrary outlier + 48 + """ + return self._get_quantile(self._get_sorted_data(), 0.5) + median = _StatsProperty('median', _calc_median) + + def _calc_iqr(self): + """Inter-quartile range (IQR) is the difference between the 75th + percentile and 25th percentile. IQR is a robust measure of + dispersion, like standard deviation, but safer to compare + between datasets, as it is less influenced by outliers. + + >>> iqr([1, 2, 3, 4, 5]) + 2 + >>> iqr(range(1001)) + 500 + """ + return self.get_quantile(0.75) - self.get_quantile(0.25) + iqr = _StatsProperty('iqr', _calc_iqr) + + def _calc_trimean(self): + """The trimean is a robust measure of central tendency, like the + median, that takes the weighted average of the median and the + upper and lower quartiles. + + >>> trimean([2, 1, 3]) + 2.0 + >>> trimean(range(97)) + 48.0 + >>> trimean(list(range(96)) + [1066]) # 1066 is an arbitrary outlier + 48.0 + + """ + sorted_data = self._get_sorted_data() + gq = lambda q: self._get_quantile(sorted_data, q) + return (gq(0.25) + (2 * gq(0.5)) + gq(0.75)) / 4.0 + trimean = _StatsProperty('trimean', _calc_trimean) + + def _calc_variance(self): + """\ + Variance is the average of the squares of the difference between + each value and the mean. + + >>> variance(range(97)) + 784.0 + """ + global mean # defined elsewhere in this file + return mean(self._get_pow_diffs(2)) + variance = _StatsProperty('variance', _calc_variance) + + def _calc_std_dev(self): + """\ + Standard deviation. Square root of the variance. + + >>> std_dev(range(97)) + 28.0 + """ + return self.variance ** 0.5 + std_dev = _StatsProperty('std_dev', _calc_std_dev) + + def _calc_median_abs_dev(self): + """\ + Median Absolute Deviation is a robust measure of statistical + dispersion: http://en.wikipedia.org/wiki/Median_absolute_deviation + + >>> median_abs_dev(range(97)) + 24.0 + """ + global median # defined elsewhere in this file + sorted_vals = sorted(self.data) + x = float(median(sorted_vals)) + return median([abs(x - v) for v in sorted_vals]) + median_abs_dev = _StatsProperty('median_abs_dev', _calc_median_abs_dev) + mad = median_abs_dev # convenience + + def _calc_rel_std_dev(self): + """\ + Standard deviation divided by the absolute value of the average. + + http://en.wikipedia.org/wiki/Relative_standard_deviation + + >>> print('%1.3f' % rel_std_dev(range(97))) + 0.583 + """ + abs_mean = abs(self.mean) + if abs_mean: + return self.std_dev / abs_mean + else: + return self.default + rel_std_dev = _StatsProperty('rel_std_dev', _calc_rel_std_dev) + + def _calc_skewness(self): + """\ + Indicates the asymmetry of a curve. Positive values mean the bulk + of the values are on the left side of the average and vice versa. + + http://en.wikipedia.org/wiki/Skewness + + See the module docstring for more about statistical moments. + + >>> skewness(range(97)) # symmetrical around 48.0 + 0.0 + >>> left_skewed = skewness(list(range(97)) + list(range(10))) + >>> right_skewed = skewness(list(range(97)) + list(range(87, 97))) + >>> round(left_skewed, 3), round(right_skewed, 3) + (0.114, -0.114) + """ + data, s_dev = self.data, self.std_dev + if len(data) > 1 and s_dev > 0: + return (sum(self._get_pow_diffs(3)) / + float((len(data) - 1) * (s_dev ** 3))) + else: + return self.default + skewness = _StatsProperty('skewness', _calc_skewness) + + def _calc_kurtosis(self): + """\ + Indicates how much data is in the tails of the distribution. The + result is always positive, with the normal "bell-curve" + distribution having a kurtosis of 3. + + http://en.wikipedia.org/wiki/Kurtosis + + See the module docstring for more about statistical moments. + + >>> kurtosis(range(9)) + 1.99125 + + With a kurtosis of 1.99125, [0, 1, 2, 3, 4, 5, 6, 7, 8] is more + centrally distributed than the normal curve. + """ + data, s_dev = self.data, self.std_dev + if len(data) > 1 and s_dev > 0: + return (sum(self._get_pow_diffs(4)) / + float((len(data) - 1) * (s_dev ** 4))) + else: + return 0.0 + kurtosis = _StatsProperty('kurtosis', _calc_kurtosis) + + def _calc_pearson_type(self): + precision = self._pearson_precision + skewness = self.skewness + kurtosis = self.kurtosis + beta1 = skewness ** 2.0 + beta2 = kurtosis * 1.0 + + # TODO: range checks? + + c0 = (4 * beta2) - (3 * beta1) + c1 = skewness * (beta2 + 3) + c2 = (2 * beta2) - (3 * beta1) - 6 + + if round(c1, precision) == 0: + if round(beta2, precision) == 3: + return 0 # Normal + else: + if beta2 < 3: + return 2 # Symmetric Beta + elif beta2 > 3: + return 7 + elif round(c2, precision) == 0: + return 3 # Gamma + else: + k = c1 ** 2 / (4 * c0 * c2) + if k < 0: + return 1 # Beta + raise RuntimeError('missed a spot') + pearson_type = _StatsProperty('pearson_type', _calc_pearson_type) + + @staticmethod + def _get_quantile(sorted_data, q): + data, n = sorted_data, len(sorted_data) + idx = q / 1.0 * (n - 1) + idx_f, idx_c = int(floor(idx)), int(ceil(idx)) + if idx_f == idx_c: + return data[idx_f] + return (data[idx_f] * (idx_c - idx)) + (data[idx_c] * (idx - idx_f)) + + def get_quantile(self, q): + """Get a quantile from the dataset. Quantiles are floating point + values between ``0.0`` and ``1.0``, with ``0.0`` representing + the minimum value in the dataset and ``1.0`` representing the + maximum. ``0.5`` represents the median: + + >>> Stats(range(100)).get_quantile(0.5) + 49.5 + """ + q = float(q) + if not 0.0 <= q <= 1.0: + raise ValueError('expected q between 0.0 and 1.0, not %r' % q) + elif not self.data: + return self.default + return self._get_quantile(self._get_sorted_data(), q) + + def get_zscore(self, value): + """Get the z-score for *value* in the group. If the standard deviation + is 0, 0 inf or -inf will be returned to indicate whether the value is + equal to, greater than or below the group's mean. + """ + mean = self.mean + if self.std_dev == 0: + if value == mean: + return 0 + if value > mean: + return float('inf') + if value < mean: + return float('-inf') + return (float(value) - mean) / self.std_dev + + def trim_relative(self, amount=0.15): + """A utility function used to cut a proportion of values off each end + of a list of values. This has the effect of limiting the + effect of outliers. + + Args: + amount (float): A value between 0.0 and 0.5 to trim off of + each side of the data. + + .. note: + + This operation modifies the data in-place. It does not + make or return a copy. + + """ + trim = float(amount) + if not 0.0 <= trim < 0.5: + raise ValueError('expected amount between 0.0 and 0.5, not %r' + % trim) + size = len(self.data) + size_diff = int(size * trim) + if size_diff == 0.0: + return + self.data = self._get_sorted_data()[size_diff:-size_diff] + self.clear_cache() + + def _get_pow_diffs(self, power): + """ + A utility function used for calculating statistical moments. + """ + m = self.mean + return [(v - m) ** power for v in self.data] + + def _get_bin_bounds(self, count=None, with_max=False): + if not self.data: + return [0.0] # TODO: raise? + + data = self.data + len_data, min_data, max_data = len(data), min(data), max(data) + + if len_data < 4: + if not count: + count = len_data + dx = (max_data - min_data) / float(count) + bins = [min_data + (dx * i) for i in range(count)] + elif count is None: + # freedman algorithm for fixed-width bin selection + q25, q75 = self.get_quantile(0.25), self.get_quantile(0.75) + dx = 2 * (q75 - q25) / (len_data ** (1 / 3.0)) + bin_count = max(1, int(ceil((max_data - min_data) / dx))) + bins = [min_data + (dx * i) for i in range(bin_count + 1)] + bins = [b for b in bins if b < max_data] + else: + dx = (max_data - min_data) / float(count) + bins = [min_data + (dx * i) for i in range(count)] + + if with_max: + bins.append(float(max_data)) + + return bins + + def get_histogram_counts(self, bins=None, **kw): + """Produces a list of ``(bin, count)`` pairs comprising a histogram of + the Stats object's data, using fixed-width bins. See + :meth:`Stats.format_histogram` for more details. + + Args: + bins (int): maximum number of bins, or list of + floating-point bin boundaries. Defaults to the output of + Freedman's algorithm. + bin_digits (int): Number of digits used to round down the + bin boundaries. Defaults to 1. + + The output of this method can be stored and/or modified, and + then passed to :func:`statsutils.format_histogram_counts` to + achieve the same text formatting as the + :meth:`~Stats.format_histogram` method. This can be useful for + snapshotting over time. + """ + bin_digits = int(kw.pop('bin_digits', 1)) + if kw: + raise TypeError('unexpected keyword arguments: %r' % kw.keys()) + + if not bins: + bins = self._get_bin_bounds() + else: + try: + bin_count = int(bins) + except TypeError: + try: + bins = [float(x) for x in bins] + except Exception: + raise ValueError('bins expected integer bin count or list' + ' of float bin boundaries, not %r' % bins) + if self.min < bins[0]: + bins = [self.min] + bins + else: + bins = self._get_bin_bounds(bin_count) + + # floor and ceil really should have taken ndigits, like round() + round_factor = 10.0 ** bin_digits + bins = [floor(b * round_factor) / round_factor for b in bins] + bins = sorted(set(bins)) + + idxs = [bisect.bisect(bins, d) - 1 for d in self.data] + count_map = Counter(idxs) + + bin_counts = [(b, count_map.get(i, 0)) for i, b in enumerate(bins)] + + return bin_counts + + def format_histogram(self, bins=None, **kw): + """Produces a textual histogram of the data, using fixed-width bins, + allowing for simple visualization, even in console environments. + + >>> data = list(range(20)) + list(range(5, 15)) + [10] + >>> print(Stats(data).format_histogram(width=30)) + 0.0: 5 ######### + 4.4: 8 ############### + 8.9: 11 #################### + 13.3: 5 ######### + 17.8: 2 #### + + In this histogram, five values are between 0.0 and 4.4, eight + are between 4.4 and 8.9, and two values lie between 17.8 and + the max. + + You can specify the number of bins, or provide a list of + bin boundaries themselves. If no bins are provided, as in the + example above, `Freedman's algorithm`_ for bin selection is + used. + + Args: + bins (int): Maximum number of bins for the + histogram. Also accepts a list of floating-point + bin boundaries. If the minimum boundary is still + greater than the minimum value in the data, that + boundary will be implicitly added. Defaults to the bin + boundaries returned by `Freedman's algorithm`_. + bin_digits (int): Number of digits to round each bin + to. Note that bins are always rounded down to avoid + clipping any data. Defaults to 1. + width (int): integer number of columns in the longest line + in the histogram. Defaults to console width on Python + 3.3+, or 80 if that is not available. + format_bin (callable): Called on each bin to create a + label for the final output. Use this function to add + units, such as "ms" for milliseconds. + + Should you want something more programmatically reusable, see + the :meth:`~Stats.get_histogram_counts` method, the output of + is used by format_histogram. The :meth:`~Stats.describe` + method is another useful summarization method, albeit less + visual. + + .. _Freedman's algorithm: https://en.wikipedia.org/wiki/Freedman%E2%80%93Diaconis_rule + """ + width = kw.pop('width', None) + format_bin = kw.pop('format_bin', None) + bin_counts = self.get_histogram_counts(bins=bins, **kw) + return format_histogram_counts(bin_counts, + width=width, + format_bin=format_bin) + + def describe(self, quantiles=None, format=None): + """Provides standard summary statistics for the data in the Stats + object, in one of several convenient formats. + + Args: + quantiles (list): A list of numeric values to use as + quantiles in the resulting summary. All values must be + 0.0-1.0, with 0.5 representing the median. Defaults to + ``[0.25, 0.5, 0.75]``, representing the standard + quartiles. + format (str): Controls the return type of the function, + with one of three valid values: ``"dict"`` gives back + a :class:`dict` with the appropriate keys and + values. ``"list"`` is a list of key-value pairs in an + order suitable to pass to an OrderedDict or HTML + table. ``"text"`` converts the values to text suitable + for printing, as seen below. + + Here is the information returned by a default ``describe``, as + presented in the ``"text"`` format: + + >>> stats = Stats(range(1, 8)) + >>> print(stats.describe(format='text')) + count: 7 + mean: 4.0 + std_dev: 2.0 + mad: 2.0 + min: 1 + 0.25: 2.5 + 0.5: 4 + 0.75: 5.5 + max: 7 + + For more advanced descriptive statistics, check out my blog + post on the topic `Statistics for Software + `_. + + """ + if format is None: + format = 'dict' + elif format not in ('dict', 'list', 'text'): + raise ValueError('invalid format for describe,' + ' expected one of "dict"/"list"/"text", not %r' + % format) + quantiles = quantiles or [0.25, 0.5, 0.75] + q_items = [] + for q in quantiles: + q_val = self.get_quantile(q) + q_items.append((str(q), q_val)) + + items = [('count', self.count), + ('mean', self.mean), + ('std_dev', self.std_dev), + ('mad', self.mad), + ('min', self.min)] + + items.extend(q_items) + items.append(('max', self.max)) + if format == 'dict': + ret = dict(items) + elif format == 'list': + ret = items + elif format == 'text': + ret = '\n'.join(['{}{}'.format((label + ':').ljust(10), val) + for label, val in items]) + return ret + + +def describe(data, quantiles=None, format=None): + """A convenience function to get standard summary statistics useful + for describing most data. See :meth:`Stats.describe` for more + details. + + >>> print(describe(range(7), format='text')) + count: 7 + mean: 3.0 + std_dev: 2.0 + mad: 2.0 + min: 0 + 0.25: 1.5 + 0.5: 3 + 0.75: 4.5 + max: 6 + + See :meth:`Stats.format_histogram` for another very useful + summarization that uses textual visualization. + """ + return Stats(data).describe(quantiles=quantiles, format=format) + + +def _get_conv_func(attr_name): + def stats_helper(data, default=0.0): + return getattr(Stats(data, default=default, use_copy=False), + attr_name) + return stats_helper + + +for attr_name, attr in list(Stats.__dict__.items()): + if isinstance(attr, _StatsProperty): + if attr_name in ('max', 'min', 'count'): # don't shadow builtins + continue + if attr_name in ('mad',): # convenience aliases + continue + func = _get_conv_func(attr_name) + func.__doc__ = attr.func.__doc__ + globals()[attr_name] = func + delattr(Stats, '_calc_' + attr_name) +# cleanup +del attr +del attr_name +del func + + +def format_histogram_counts(bin_counts, width=None, format_bin=None): + """The formatting logic behind :meth:`Stats.format_histogram`, which + takes the output of :meth:`Stats.get_histogram_counts`, and passes + them to this function. + + Args: + bin_counts (list): A list of bin values to counts. + width (int): Number of character columns in the text output, + defaults to 80 or console width in Python 3.3+. + format_bin (callable): Used to convert bin values into string + labels. + """ + lines = [] + if not format_bin: + format_bin = lambda v: v + if not width: + try: + import shutil # python 3 convenience + width = shutil.get_terminal_size()[0] + except Exception: + width = 80 + + bins = [b for b, _ in bin_counts] + count_max = max([count for _, count in bin_counts]) + count_cols = len(str(count_max)) + + labels = ['%s' % format_bin(b) for b in bins] + label_cols = max([len(l) for l in labels]) + tmp_line = '{}: {} #'.format('x' * label_cols, count_max) + + bar_cols = max(width - len(tmp_line), 3) + line_k = float(bar_cols) / count_max + tmpl = "{label:>{label_cols}}: {count:>{count_cols}} {bar}" + for label, (bin_val, count) in zip(labels, bin_counts): + bar_len = int(round(count * line_k)) + bar = ('#' * bar_len) or '|' + line = tmpl.format(label=label, + label_cols=label_cols, + count=count, + count_cols=count_cols, + bar=bar) + lines.append(line) + + return '\n'.join(lines) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/strutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/strutils.py new file mode 100644 index 0000000000000000000000000000000000000000..1d43f2b0a1441a487a42e1885545a9fe531d5764 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/strutils.py @@ -0,0 +1,1289 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""So much practical programming involves string manipulation, which +Python readily accommodates. Still, there are dozens of basic and +common capabilities missing from the standard library, several of them +provided by ``strutils``. +""" + + +import builtins +import re +import sys +import uuid +import zlib +import string +import unicodedata +import collections +from collections.abc import Mapping +from gzip import GzipFile +from html.parser import HTMLParser +from html import entities as htmlentitydefs +from io import BytesIO as StringIO + + +__all__ = ['camel2under', 'under2camel', 'slugify', 'split_punct_ws', + 'unit_len', 'ordinalize', 'cardinalize', 'pluralize', 'singularize', + 'asciify', 'is_ascii', 'is_uuid', 'html2text', 'strip_ansi', + 'bytes2human', 'find_hashtags', 'a10n', 'gzip_bytes', 'gunzip_bytes', + 'iter_splitlines', 'indent', 'escape_shell_args', + 'args2cmd', 'args2sh', 'parse_int_list', 'format_int_list', + 'complement_int_list', 'int_ranges_from_int_list', 'MultiReplace', + 'multi_replace', 'unwrap_text', 'removeprefix'] + + +_punct_ws_str = string.punctuation + string.whitespace +_punct_re = re.compile('[' + _punct_ws_str + ']+') +_camel2under_re = re.compile('((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))') + + +def camel2under(camel_string): + """Converts a camelcased string to underscores. Useful for turning a + class name into a function name. + + >>> camel2under('BasicParseTest') + 'basic_parse_test' + """ + return _camel2under_re.sub(r'_\1', camel_string).lower() + + +def under2camel(under_string): + """Converts an underscored string to camelcased. Useful for turning a + function name into a class name. + + >>> under2camel('complex_tokenizer') + 'ComplexTokenizer' + """ + return ''.join(w.capitalize() or '_' for w in under_string.split('_')) + + +def slugify(text, delim='_', lower=True, ascii=False): + """ + A basic function that turns text full of scary characters + (i.e., punctuation and whitespace), into a relatively safe + lowercased string separated only by the delimiter specified + by *delim*, which defaults to ``_``. + + The *ascii* convenience flag will :func:`asciify` the slug if + you require ascii-only slugs. + + >>> slugify('First post! Hi!!!!~1 ') + 'first_post_hi_1' + + >>> slugify("Kurt Gödel's pretty cool.", ascii=True) == \ + b'kurt_goedel_s_pretty_cool' + True + + """ + ret = delim.join(split_punct_ws(text)) or delim if text else '' + if ascii: + ret = asciify(ret) + if lower: + ret = ret.lower() + return ret + + +def split_punct_ws(text): + """While :meth:`str.split` will split on whitespace, + :func:`split_punct_ws` will split on punctuation and + whitespace. This used internally by :func:`slugify`, above. + + >>> split_punct_ws('First post! Hi!!!!~1 ') + ['First', 'post', 'Hi', '1'] + """ + return [w for w in _punct_re.split(text) if w] + + +def unit_len(sized_iterable, unit_noun='item'): # TODO: len_units()/unitize()? + """Returns a plain-English description of an iterable's + :func:`len()`, conditionally pluralized with :func:`cardinalize`, + detailed below. + + >>> print(unit_len(range(10), 'number')) + 10 numbers + >>> print(unit_len('aeiou', 'vowel')) + 5 vowels + >>> print(unit_len([], 'worry')) + No worries + """ + count = len(sized_iterable) + units = cardinalize(unit_noun, count) + if count: + return f'{count} {units}' + return f'No {units}' + + +_ORDINAL_MAP = {'1': 'st', + '2': 'nd', + '3': 'rd'} # 'th' is the default + + +def ordinalize(number, ext_only=False): + """Turns *number* into its cardinal form, i.e., 1st, 2nd, + 3rd, 4th, etc. If the last character isn't a digit, it returns the + string value unchanged. + + Args: + number (int or str): Number to be cardinalized. + ext_only (bool): Whether to return only the suffix. Default ``False``. + + >>> print(ordinalize(1)) + 1st + >>> print(ordinalize(3694839230)) + 3694839230th + >>> print(ordinalize('hi')) + hi + >>> print(ordinalize(1515)) + 1515th + """ + numstr, ext = str(number), '' + if numstr and numstr[-1] in string.digits: + try: + # first check for teens + if numstr[-2] == '1': + ext = 'th' + else: + # all other cases + ext = _ORDINAL_MAP.get(numstr[-1], 'th') + except IndexError: + # single digit numbers (will reach here based on [-2] above) + ext = _ORDINAL_MAP.get(numstr[-1], 'th') + if ext_only: + return ext + else: + return numstr + ext + + +def cardinalize(unit_noun, count): + """Conditionally pluralizes a singular word *unit_noun* if + *count* is not one, preserving case when possible. + + >>> vowels = 'aeiou' + >>> print(len(vowels), cardinalize('vowel', len(vowels))) + 5 vowels + >>> print(3, cardinalize('Wish', 3)) + 3 Wishes + """ + if count == 1: + return unit_noun + return pluralize(unit_noun) + + +def singularize(word): + """Semi-intelligently converts an English plural *word* to its + singular form, preserving case pattern. + + >>> singularize('chances') + 'chance' + >>> singularize('Activities') + 'Activity' + >>> singularize('Glasses') + 'Glass' + >>> singularize('FEET') + 'FOOT' + + """ + orig_word, word = word, word.strip().lower() + if not word or word in _IRR_S2P: + return orig_word + + irr_singular = _IRR_P2S.get(word) + if irr_singular: + singular = irr_singular + elif not word.endswith('s'): + return orig_word + elif len(word) == 2: + singular = word[:-1] # or just return word? + elif word.endswith('ies') and word[-4:-3] not in 'aeiou': + singular = word[:-3] + 'y' + elif word.endswith('es') and word[-3] == 's': + singular = word[:-2] + else: + singular = word[:-1] + return _match_case(orig_word, singular) + + +def pluralize(word): + """Semi-intelligently converts an English *word* from singular form to + plural, preserving case pattern. + + >>> pluralize('friend') + 'friends' + >>> pluralize('enemy') + 'enemies' + >>> pluralize('Sheep') + 'Sheep' + """ + orig_word, word = word, word.strip().lower() + if not word or word in _IRR_P2S: + return orig_word + irr_plural = _IRR_S2P.get(word) + if irr_plural: + plural = irr_plural + elif word.endswith('y') and word[-2:-1] not in 'aeiou': + plural = word[:-1] + 'ies' + elif word[-1] == 's' or word.endswith('ch') or word.endswith('sh'): + plural = word if word.endswith('es') else word + 'es' + else: + plural = word + 's' + return _match_case(orig_word, plural) + + +def _match_case(master, disciple): + if not master.strip(): + return disciple + if master.lower() == master: + return disciple.lower() + elif master.upper() == master: + return disciple.upper() + elif master.title() == master: + return disciple.title() + return disciple + + +# Singular to plural map of irregular pluralizations +_IRR_S2P = {'addendum': 'addenda', 'alga': 'algae', 'alumna': 'alumnae', + 'alumnus': 'alumni', 'analysis': 'analyses', 'antenna': 'antennae', + 'appendix': 'appendices', 'axis': 'axes', 'bacillus': 'bacilli', + 'bacterium': 'bacteria', 'basis': 'bases', 'beau': 'beaux', + 'bison': 'bison', 'bureau': 'bureaus', 'cactus': 'cacti', + 'calf': 'calves', 'child': 'children', 'corps': 'corps', + 'corpus': 'corpora', 'crisis': 'crises', 'criterion': 'criteria', + 'curriculum': 'curricula', 'datum': 'data', 'deer': 'deer', + 'diagnosis': 'diagnoses', 'die': 'dice', 'dwarf': 'dwarves', + 'echo': 'echoes', 'elf': 'elves', 'ellipsis': 'ellipses', + 'embargo': 'embargoes', 'emphasis': 'emphases', 'erratum': 'errata', + 'fireman': 'firemen', 'fish': 'fish', 'focus': 'foci', + 'foot': 'feet', 'formula': 'formulae', 'formula': 'formulas', + 'fungus': 'fungi', 'genus': 'genera', 'goose': 'geese', + 'half': 'halves', 'hero': 'heroes', 'hippopotamus': 'hippopotami', + 'hoof': 'hooves', 'hypothesis': 'hypotheses', 'index': 'indices', + 'knife': 'knives', 'leaf': 'leaves', 'life': 'lives', + 'loaf': 'loaves', 'louse': 'lice', 'man': 'men', + 'matrix': 'matrices', 'means': 'means', 'medium': 'media', + 'memorandum': 'memoranda', 'millennium': 'milennia', 'moose': 'moose', + 'mosquito': 'mosquitoes', 'mouse': 'mice', 'nebula': 'nebulae', + 'neurosis': 'neuroses', 'nucleus': 'nuclei', 'oasis': 'oases', + 'octopus': 'octopi', 'offspring': 'offspring', 'ovum': 'ova', + 'ox': 'oxen', 'paralysis': 'paralyses', 'parenthesis': 'parentheses', + 'person': 'people', 'phenomenon': 'phenomena', 'potato': 'potatoes', + 'radius': 'radii', 'scarf': 'scarves', 'scissors': 'scissors', + 'self': 'selves', 'sense': 'senses', 'series': 'series', 'sheep': + 'sheep', 'shelf': 'shelves', 'species': 'species', 'stimulus': + 'stimuli', 'stratum': 'strata', 'syllabus': 'syllabi', 'symposium': + 'symposia', 'synopsis': 'synopses', 'synthesis': 'syntheses', + 'tableau': 'tableaux', 'that': 'those', 'thesis': 'theses', + 'thief': 'thieves', 'this': 'these', 'tomato': 'tomatoes', 'tooth': + 'teeth', 'torpedo': 'torpedoes', 'vertebra': 'vertebrae', 'veto': + 'vetoes', 'vita': 'vitae', 'watch': 'watches', 'wife': 'wives', + 'wolf': 'wolves', 'woman': 'women'} + + +# Reverse index of the above +_IRR_P2S = {v: k for k, v in _IRR_S2P.items()} + +HASHTAG_RE = re.compile(r"(?:^|\s)[##]{1}(\w+)", re.UNICODE) + + +def find_hashtags(string): + """Finds and returns all hashtags in a string, with the hashmark + removed. Supports full-width hashmarks for Asian languages and + does not false-positive on URL anchors. + + >>> find_hashtags('#atag http://asite/#ananchor') + ['atag'] + + ``find_hashtags`` also works with unicode hashtags. + """ + + # the following works, doctest just struggles with it + # >>> find_hashtags(u"can't get enough of that dignity chicken #肯德基 woo") + # [u'\u80af\u5fb7\u57fa'] + return HASHTAG_RE.findall(string) + + +def a10n(string): + """That thing where "internationalization" becomes "i18n", what's it + called? Abbreviation? Oh wait, no: ``a10n``. (It's actually a form + of `numeronym`_.) + + >>> a10n('abbreviation') + 'a10n' + >>> a10n('internationalization') + 'i18n' + >>> a10n('') + '' + + .. _numeronym: http://en.wikipedia.org/wiki/Numeronym + """ + if len(string) < 3: + return string + return f'{string[0]}{len(string[1:-1])}{string[-1]}' + + +# Based on https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences +ANSI_SEQUENCES = re.compile(r''' + \x1B # Sequence starts with ESC, i.e. hex 0x1B + (?: + [@-Z\\-_] # Second byte: + # all 0x40–0x5F range but CSI char, i.e ASCII @A–Z\]^_ + | # Or + \[ # CSI sequences, starting with [ + [0-?]* # Parameter bytes: + # range 0x30–0x3F, ASCII 0–9:;<=>? + [ -/]* # Intermediate bytes: + # range 0x20–0x2F, ASCII space and !"#$%&'()*+,-./ + [@-~] # Final byte + # range 0x40–0x7E, ASCII @A–Z[\]^_`a–z{|}~ + ) +''', re.VERBOSE) + + +def strip_ansi(text): + """Strips ANSI escape codes from *text*. Useful for the occasional + time when a log or redirected output accidentally captures console + color codes and the like. + + >>> strip_ansi('\x1b[0m\x1b[1;36mart\x1b[46;34m') + 'art' + + Supports str, bytes and bytearray content as input. Returns the + same type as the input. + + There's a lot of ANSI art available for testing on `sixteencolors.net`_. + This function does not interpret or render ANSI art, but you can do so with + `ansi2img`_ or `escapes.js`_. + + .. _sixteencolors.net: http://sixteencolors.net + .. _ansi2img: http://www.bedroomlan.org/projects/ansi2img + .. _escapes.js: https://github.com/atdt/escapes.js + """ + # TODO: move to cliutils.py + + # Transform any ASCII-like content to unicode to allow regex to match, and + # save input type for later. + target_type = None + # Unicode type aliased to str is code-smell for Boltons in Python 3 env. + if isinstance(text, (bytes, bytearray)): + target_type = type(text) + text = text.decode('utf-8') + + cleaned = ANSI_SEQUENCES.sub('', text) + + # Transform back the result to the same bytearray type provided by the user. + if target_type and target_type != type(cleaned): + cleaned = target_type(cleaned, 'utf-8') + + return cleaned + + +def asciify(text, ignore=False): + """Converts a unicode or bytestring, *text*, into a bytestring with + just ascii characters. Performs basic deaccenting for all you + Europhiles out there. + + Also, a gentle reminder that this is a **utility**, primarily meant + for slugification. Whenever possible, make your application work + **with** unicode, not against it. + + Args: + text (str): The string to be asciified. + ignore (bool): Configures final encoding to ignore remaining + unasciified string instead of replacing it. + + >>> asciify('Beyoncé') == b'Beyonce' + True + """ + try: + try: + return text.encode('ascii') + except UnicodeDecodeError: + # this usually means you passed in a non-unicode string + text = text.decode('utf-8') + return text.encode('ascii') + except UnicodeEncodeError: + mode = 'replace' + if ignore: + mode = 'ignore' + transd = unicodedata.normalize('NFKD', text.translate(DEACCENT_MAP)) + ret = transd.encode('ascii', mode) + return ret + + +def is_ascii(text): + """Check if a string or bytestring, *text*, is composed of ascii + characters only. Raises :exc:`ValueError` if argument is not text. + + Args: + text (str): The string to be checked. + + >>> is_ascii('Beyoncé') + False + >>> is_ascii('Beyonce') + True + """ + if isinstance(text, str): + try: + text.encode('ascii') + except UnicodeEncodeError: + return False + elif isinstance(text, bytes): + try: + text.decode('ascii') + except UnicodeDecodeError: + return False + else: + raise ValueError('expected text or bytes, not %r' % type(text)) + return True + + +class DeaccenterDict(dict): + "A small caching dictionary for deaccenting." + def __missing__(self, key): + ch = self.get(key) + if ch is not None: + return ch + try: + de = unicodedata.decomposition(chr(key)) + p1, _, p2 = de.rpartition(' ') + if int(p2, 16) == 0x308: + ch = self.get(key) + else: + ch = int(p1, 16) + except (IndexError, ValueError): + ch = self.get(key, key) + self[key] = ch + return ch + + +# http://chmullig.com/2009/12/python-unicode-ascii-ifier/ +# For something more complete, investigate the unidecode +# or isounidecode packages, which are capable of performing +# crude transliteration. +_BASE_DEACCENT_MAP = { + 0xc6: "AE", # Æ LATIN CAPITAL LETTER AE + 0xd0: "D", # Ð LATIN CAPITAL LETTER ETH + 0xd8: "OE", # Ø LATIN CAPITAL LETTER O WITH STROKE + 0xde: "Th", # Þ LATIN CAPITAL LETTER THORN + 0xc4: 'Ae', # Ä LATIN CAPITAL LETTER A WITH DIAERESIS + 0xd6: 'Oe', # Ö LATIN CAPITAL LETTER O WITH DIAERESIS + 0xdc: 'Ue', # Ü LATIN CAPITAL LETTER U WITH DIAERESIS + 0xc0: "A", # À LATIN CAPITAL LETTER A WITH GRAVE + 0xc1: "A", # Á LATIN CAPITAL LETTER A WITH ACUTE + 0xc3: "A", # Ã LATIN CAPITAL LETTER A WITH TILDE + 0xc7: "C", # Ç LATIN CAPITAL LETTER C WITH CEDILLA + 0xc8: "E", # È LATIN CAPITAL LETTER E WITH GRAVE + 0xc9: "E", # É LATIN CAPITAL LETTER E WITH ACUTE + 0xca: "E", # Ê LATIN CAPITAL LETTER E WITH CIRCUMFLEX + 0xcc: "I", # Ì LATIN CAPITAL LETTER I WITH GRAVE + 0xcd: "I", # Í LATIN CAPITAL LETTER I WITH ACUTE + 0xd2: "O", # Ò LATIN CAPITAL LETTER O WITH GRAVE + 0xd3: "O", # Ó LATIN CAPITAL LETTER O WITH ACUTE + 0xd5: "O", # Õ LATIN CAPITAL LETTER O WITH TILDE + 0xd9: "U", # Ù LATIN CAPITAL LETTER U WITH GRAVE + 0xda: "U", # Ú LATIN CAPITAL LETTER U WITH ACUTE + 0xdf: "ss", # ß LATIN SMALL LETTER SHARP S + 0xe6: "ae", # æ LATIN SMALL LETTER AE + 0xf0: "d", # ð LATIN SMALL LETTER ETH + 0xf8: "oe", # ø LATIN SMALL LETTER O WITH STROKE + 0xfe: "th", # þ LATIN SMALL LETTER THORN, + 0xe4: 'ae', # ä LATIN SMALL LETTER A WITH DIAERESIS + 0xf6: 'oe', # ö LATIN SMALL LETTER O WITH DIAERESIS + 0xfc: 'ue', # ü LATIN SMALL LETTER U WITH DIAERESIS + 0xe0: "a", # à LATIN SMALL LETTER A WITH GRAVE + 0xe1: "a", # á LATIN SMALL LETTER A WITH ACUTE + 0xe3: "a", # ã LATIN SMALL LETTER A WITH TILDE + 0xe7: "c", # ç LATIN SMALL LETTER C WITH CEDILLA + 0xe8: "e", # è LATIN SMALL LETTER E WITH GRAVE + 0xe9: "e", # é LATIN SMALL LETTER E WITH ACUTE + 0xea: "e", # ê LATIN SMALL LETTER E WITH CIRCUMFLEX + 0xec: "i", # ì LATIN SMALL LETTER I WITH GRAVE + 0xed: "i", # í LATIN SMALL LETTER I WITH ACUTE + 0xf2: "o", # ò LATIN SMALL LETTER O WITH GRAVE + 0xf3: "o", # ó LATIN SMALL LETTER O WITH ACUTE + 0xf5: "o", # õ LATIN SMALL LETTER O WITH TILDE + 0xf9: "u", # ù LATIN SMALL LETTER U WITH GRAVE + 0xfa: "u", # ú LATIN SMALL LETTER U WITH ACUTE + 0x2018: "'", # ‘ LEFT SINGLE QUOTATION MARK + 0x2019: "'", # ’ RIGHT SINGLE QUOTATION MARK + 0x201c: '"', # “ LEFT DOUBLE QUOTATION MARK + 0x201d: '"', # ” RIGHT DOUBLE QUOTATION MARK + } + + +DEACCENT_MAP = DeaccenterDict(_BASE_DEACCENT_MAP) + + +_SIZE_SYMBOLS = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') +_SIZE_BOUNDS = [(1024 ** i, sym) for i, sym in enumerate(_SIZE_SYMBOLS)] +_SIZE_RANGES = list(zip(_SIZE_BOUNDS, _SIZE_BOUNDS[1:])) + + +def bytes2human(nbytes, ndigits=0): + """Turns an integer value of *nbytes* into a human readable format. Set + *ndigits* to control how many digits after the decimal point + should be shown (default ``0``). + + >>> bytes2human(128991) + '126K' + >>> bytes2human(100001221) + '95M' + >>> bytes2human(0, 2) + '0.00B' + """ + abs_bytes = abs(nbytes) + for (size, symbol), (next_size, next_symbol) in _SIZE_RANGES: + if abs_bytes <= next_size: + break + hnbytes = float(nbytes) / size + return '{hnbytes:.{ndigits}f}{symbol}'.format(hnbytes=hnbytes, + ndigits=ndigits, + symbol=symbol) + + +class HTMLTextExtractor(HTMLParser): + def __init__(self): + self.reset() + self.strict = False + self.convert_charrefs = True + self.result = [] + + def handle_data(self, d): + self.result.append(d) + + def handle_charref(self, number): + if number[0] == 'x' or number[0] == 'X': + codepoint = int(number[1:], 16) + else: + codepoint = int(number) + self.result.append(chr(codepoint)) + + def handle_entityref(self, name): + try: + codepoint = htmlentitydefs.name2codepoint[name] + except KeyError: + self.result.append('&' + name + ';') + else: + self.result.append(chr(codepoint)) + + def get_text(self): + return ''.join(self.result) + + +def html2text(html): + """Strips tags from HTML text, returning markup-free text. Also, does + a best effort replacement of entities like " " + + >>> r = html2text(u'Test &(\u0394ημώ)') + >>> r == u'Test &(\u0394\u03b7\u03bc\u03ce)' + True + """ + # based on answers to http://stackoverflow.com/questions/753052/ + s = HTMLTextExtractor() + s.feed(html) + return s.get_text() + + +_EMPTY_GZIP_BYTES = b'\x1f\x8b\x08\x089\xf3\xb9U\x00\x03empty\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00' +_NON_EMPTY_GZIP_BYTES = b'\x1f\x8b\x08\x08\xbc\xf7\xb9U\x00\x03not_empty\x00K\xaa,I-N\xcc\xc8\xafT\xe4\x02\x00\xf3nb\xbf\x0b\x00\x00\x00' + + +def gunzip_bytes(bytestring): + """The :mod:`gzip` module is great if you have a file or file-like + object, but what if you just have bytes. StringIO is one + possibility, but it's often faster, easier, and simpler to just + use this one-liner. Use this tried-and-true utility function to + decompress gzip from bytes. + + >>> gunzip_bytes(_EMPTY_GZIP_BYTES) == b'' + True + >>> gunzip_bytes(_NON_EMPTY_GZIP_BYTES).rstrip() == b'bytesahoy!' + True + """ + return zlib.decompress(bytestring, 16 + zlib.MAX_WBITS) + + +def gzip_bytes(bytestring, level=6): + """Turn some bytes into some compressed bytes. + + >>> len(gzip_bytes(b'a' * 10000)) + 46 + + Args: + bytestring (bytes): Bytes to be compressed + level (int): An integer, 1-9, controlling the + speed/compression. 1 is fastest, least compressed, 9 is + slowest, but most compressed. + + Note that all levels of gzip are pretty fast these days, though + it's not really a competitor in compression, at any level. + """ + out = StringIO() + f = GzipFile(fileobj=out, mode='wb', compresslevel=level) + f.write(bytestring) + f.close() + return out.getvalue() + + + +_line_ending_re = re.compile(r'(\r\n|\n|\x0b|\f|\r|\x85|\x2028|\x2029)', + re.UNICODE) + + +def iter_splitlines(text): + r"""Like :meth:`str.splitlines`, but returns an iterator of lines + instead of a list. Also similar to :meth:`file.next`, as that also + lazily reads and yields lines from a file. + + This function works with a variety of line endings, but as always, + be careful when mixing line endings within a file. + + >>> list(iter_splitlines('\nhi\nbye\n')) + ['', 'hi', 'bye', ''] + >>> list(iter_splitlines('\r\nhi\rbye\r\n')) + ['', 'hi', 'bye', ''] + >>> list(iter_splitlines('')) + [] + """ + prev_end, len_text = 0, len(text) + # print('last: %r' % last_idx) + # start, end = None, None + for match in _line_ending_re.finditer(text): + start, end = match.start(1), match.end(1) + # print(start, end) + if prev_end <= start: + yield text[prev_end:start] + if end == len_text: + yield '' + prev_end = end + tail = text[prev_end:] + if tail: + yield tail + return + + +def indent(text, margin, newline='\n', key=bool): + """The missing counterpart to the built-in :func:`textwrap.dedent`. + + Args: + text (str): The text to indent. + margin (str): The string to prepend to each line. + newline (str): The newline used to rejoin the lines (default: ``\\n``) + key (callable): Called on each line to determine whether to + indent it. Default: :class:`bool`, to ensure that empty lines do + not get whitespace added. + """ + indented_lines = [(margin + line if key(line) else line) + for line in iter_splitlines(text)] + return newline.join(indented_lines) + + +def is_uuid(obj, version=4): + """Check the argument is either a valid UUID object or string. + + Args: + obj (object): The test target. Strings and UUID objects supported. + version (int): The target UUID version, set to 0 to skip version check. + + >>> is_uuid('e682ccca-5a4c-4ef2-9711-73f9ad1e15ea') + True + >>> is_uuid('0221f0d9-d4b9-11e5-a478-10ddb1c2feb9') + False + >>> is_uuid('0221f0d9-d4b9-11e5-a478-10ddb1c2feb9', version=1) + True + """ + if not isinstance(obj, uuid.UUID): + try: + obj = uuid.UUID(obj) + except (TypeError, ValueError, AttributeError): + return False + if version and obj.version != int(version): + return False + return True + + +def escape_shell_args(args, sep=' ', style=None): + """Returns an escaped version of each string in *args*, according to + *style*. + + Args: + args (list): A list of arguments to escape and join together + sep (str): The separator used to join the escaped arguments. + style (str): The style of escaping to use. Can be one of + ``cmd`` or ``sh``, geared toward Windows and Linux/BSD/etc., + respectively. If *style* is ``None``, then it is picked + according to the system platform. + + See :func:`args2cmd` and :func:`args2sh` for details and example + output for each style. + """ + if not style: + style = 'cmd' if sys.platform == 'win32' else 'sh' + + if style == 'sh': + return args2sh(args, sep=sep) + elif style == 'cmd': + return args2cmd(args, sep=sep) + + raise ValueError("style expected one of 'cmd' or 'sh', not %r" % style) + + +_find_sh_unsafe = re.compile(r'[^a-zA-Z0-9_@%+=:,./-]').search + + +def args2sh(args, sep=' '): + """Return a shell-escaped string version of *args*, separated by + *sep*, based on the rules of sh, bash, and other shells in the + Linux/BSD/MacOS ecosystem. + + >>> print(args2sh(['aa', '[bb]', "cc'cc", 'dd"dd'])) + aa '[bb]' 'cc'"'"'cc' 'dd"dd' + + As you can see, arguments with no special characters are not + escaped, arguments with special characters are quoted with single + quotes, and single quotes themselves are quoted with double + quotes. Double quotes are handled like any other special + character. + + Based on code from the :mod:`pipes`/:mod:`shlex` modules. Also + note that :mod:`shlex` and :mod:`argparse` have functions to split + and parse strings escaped in this manner. + """ + ret_list = [] + + for arg in args: + if not arg: + ret_list.append("''") + continue + if _find_sh_unsafe(arg) is None: + ret_list.append(arg) + continue + # use single quotes, and put single quotes into double quotes + # the string $'b is then quoted as '$'"'"'b' + ret_list.append("'" + arg.replace("'", "'\"'\"'") + "'") + + return ' '.join(ret_list) + + +def args2cmd(args, sep=' '): + r"""Return a shell-escaped string version of *args*, separated by + *sep*, using the same rules as the Microsoft C runtime. + + >>> print(args2cmd(['aa', '[bb]', "cc'cc", 'dd"dd'])) + aa [bb] cc'cc dd\"dd + + As you can see, escaping is through backslashing and not quoting, + and double quotes are the only special character. See the comment + in the code for more details. Based on internal code from the + :mod:`subprocess` module. + + """ + # technique description from subprocess below + """ + 1) Arguments are delimited by white space, which is either a + space or a tab. + + 2) A string surrounded by double quotation marks is + interpreted as a single argument, regardless of white space + contained within. A quoted string can be embedded in an + argument. + + 3) A double quotation mark preceded by a backslash is + interpreted as a literal double quotation mark. + + 4) Backslashes are interpreted literally, unless they + immediately precede a double quotation mark. + + 5) If backslashes immediately precede a double quotation mark, + every pair of backslashes is interpreted as a literal + backslash. If the number of backslashes is odd, the last + backslash escapes the next double quotation mark as + described in rule 3. + + See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx + or search http://msdn.microsoft.com for + "Parsing C++ Command-Line Arguments" + """ + result = [] + needquote = False + for arg in args: + bs_buf = [] + + # Add a space to separate this argument from the others + if result: + result.append(' ') + + needquote = (" " in arg) or ("\t" in arg) or not arg + if needquote: + result.append('"') + + for c in arg: + if c == '\\': + # Don't know if we need to double yet. + bs_buf.append(c) + elif c == '"': + # Double backslashes. + result.append('\\' * len(bs_buf)*2) + bs_buf = [] + result.append('\\"') + else: + # Normal char + if bs_buf: + result.extend(bs_buf) + bs_buf = [] + result.append(c) + + # Add remaining backslashes, if any. + if bs_buf: + result.extend(bs_buf) + + if needquote: + result.extend(bs_buf) + result.append('"') + + return ''.join(result) + + +def parse_int_list(range_string, delim=',', range_delim='-'): + """Returns a sorted list of positive integers based on + *range_string*. Reverse of :func:`format_int_list`. + + Args: + range_string (str): String of comma separated positive + integers or ranges (e.g. '1,2,4-6,8'). Typical of a custom + page range string used in printer dialogs. + delim (char): Defaults to ','. Separates integers and + contiguous ranges of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous + range of integers. + + >>> parse_int_list('1,3,5-8,10-11,15') + [1, 3, 5, 6, 7, 8, 10, 11, 15] + + """ + output = [] + + for x in range_string.strip().split(delim): + + # Range + if range_delim in x: + range_limits = list(map(int, x.split(range_delim))) + output += list(range(min(range_limits), max(range_limits)+1)) + + # Empty String + elif not x: + continue + + # Integer + else: + output.append(int(x)) + + return sorted(output) + + +def format_int_list(int_list, delim=',', range_delim='-', delim_space=False): + """Returns a sorted range string from a list of positive integers + (*int_list*). Contiguous ranges of integers are collapsed to min + and max values. Reverse of :func:`parse_int_list`. + + Args: + int_list (list): List of positive integers to be converted + into a range string (e.g. [1,2,4,5,6,8]). + delim (char): Defaults to ','. Separates integers and + contiguous ranges of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous + range of integers. + delim_space (bool): Defaults to ``False``. If ``True``, adds a + space after all *delim* characters. + + >>> format_int_list([1,3,5,6,7,8,10,11,15]) + '1,3,5-8,10-11,15' + + """ + output = [] + contig_range = collections.deque() + + for x in sorted(int_list): + + # Handle current (and first) value. + if len(contig_range) < 1: + contig_range.append(x) + + # Handle current value, given multiple previous values are contiguous. + elif len(contig_range) > 1: + delta = x - contig_range[-1] + + # Current value is contiguous. + if delta == 1: + contig_range.append(x) + + # Current value is non-contiguous. + elif delta > 1: + range_substr = '{:d}{}{:d}'.format(min(contig_range), + range_delim, + max(contig_range)) + output.append(range_substr) + contig_range.clear() + contig_range.append(x) + + # Current value repeated. + else: + continue + + # Handle current value, given no previous contiguous integers + else: + delta = x - contig_range[0] + + # Current value is contiguous. + if delta == 1: + contig_range.append(x) + + # Current value is non-contiguous. + elif delta > 1: + output.append(f'{contig_range.popleft():d}') + contig_range.append(x) + + # Current value repeated. + else: + continue + + # Handle the last value. + else: + + # Last value is non-contiguous. + if len(contig_range) == 1: + output.append(f'{contig_range.popleft():d}') + contig_range.clear() + + # Last value is part of contiguous range. + elif len(contig_range) > 1: + range_substr = '{:d}{}{:d}'.format(min(contig_range), + range_delim, + max(contig_range)) + output.append(range_substr) + contig_range.clear() + + if delim_space: + output_str = (delim+' ').join(output) + else: + output_str = delim.join(output) + + return output_str + + +def complement_int_list( + range_string, range_start=0, range_end=None, + delim=',', range_delim='-'): + """ Returns range string that is the complement of the one provided as + *range_string* parameter. + + These range strings are of the kind produce by :func:`format_int_list`, and + parseable by :func:`parse_int_list`. + + Args: + range_string (str): String of comma separated positive integers or + ranges (e.g. '1,2,4-6,8'). Typical of a custom page range string + used in printer dialogs. + range_start (int): A positive integer from which to start the resulting + range. Value is inclusive. Defaults to ``0``. + range_end (int): A positive integer from which the produced range is + stopped. Value is exclusive. Defaults to the maximum value found in + the provided ``range_string``. + delim (char): Defaults to ','. Separates integers and contiguous ranges + of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous range of + integers. + + >>> complement_int_list('1,3,5-8,10-11,15') + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=0) + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=1) + '2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=2) + '2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=3) + '4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=15) + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=14) + '0,2,4,9,12-13' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=13) + '0,2,4,9,12' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=20) + '0,2,4,9,12-14,16-19' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=0) + '' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=-1) + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=-1) + '' + + >>> complement_int_list('1,3,5-8', range_start=1, range_end=1) + '' + + >>> complement_int_list('1,3,5-8', range_start=2, range_end=2) + '' + + >>> complement_int_list('1,3,5-8', range_start=2, range_end=3) + '2' + + >>> complement_int_list('1,3,5-8', range_start=-10, range_end=-5) + '' + + >>> complement_int_list('1,3,5-8', range_start=20, range_end=10) + '' + + >>> complement_int_list('') + '' + """ + int_list = set(parse_int_list(range_string, delim, range_delim)) + if range_end is None: + if int_list: + range_end = max(int_list) + 1 + else: + range_end = range_start + complement_values = set( + range(range_end)) - int_list - set(range(range_start)) + return format_int_list(complement_values, delim, range_delim) + + +def int_ranges_from_int_list(range_string, delim=',', range_delim='-'): + """ Transform a string of ranges (*range_string*) into a tuple of tuples. + + Args: + range_string (str): String of comma separated positive integers or + ranges (e.g. '1,2,4-6,8'). Typical of a custom page range string + used in printer dialogs. + delim (char): Defaults to ','. Separates integers and contiguous ranges + of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous range of + integers. + + >>> int_ranges_from_int_list('1,3,5-8,10-11,15') + ((1, 1), (3, 3), (5, 8), (10, 11), (15, 15)) + + >>> int_ranges_from_int_list('1') + ((1, 1),) + + >>> int_ranges_from_int_list('') + () + """ + int_tuples = [] + # Normalize the range string to our internal format for processing. + range_string = format_int_list( + parse_int_list(range_string, delim, range_delim)) + if range_string: + for bounds in range_string.split(','): + if '-' in bounds: + start, end = bounds.split('-') + else: + start, end = bounds, bounds + int_tuples.append((int(start), int(end))) + return tuple(int_tuples) + + +class MultiReplace: + """ + MultiReplace is a tool for doing multiple find/replace actions in one pass. + + Given a mapping of values to be replaced it allows for all of the matching + values to be replaced in a single pass which can save a lot of performance + on very large strings. In addition to simple replace, it also allows for + replacing based on regular expressions. + + Keyword Arguments: + + :type regex: bool + :param regex: Treat search keys as regular expressions [Default: False] + :type flags: int + :param flags: flags to pass to the regex engine during compile + + Dictionary Usage:: + + from boltons import strutils + s = strutils.MultiReplace({ + 'foo': 'zoo', + 'cat': 'hat', + 'bat': 'kraken' + }) + new = s.sub('The foo bar cat ate a bat') + new == 'The zoo bar hat ate a kraken' + + Iterable Usage:: + + from boltons import strutils + s = strutils.MultiReplace([ + ('foo', 'zoo'), + ('cat', 'hat'), + ('bat', 'kraken)' + ]) + new = s.sub('The foo bar cat ate a bat') + new == 'The zoo bar hat ate a kraken' + + + The constructor can be passed a dictionary or other mapping as well as + an iterable of tuples. If given an iterable, the substitution will be run + in the order the replacement values are specified in the iterable. This is + also true if it is given an OrderedDict. If given a dictionary then the + order will be non-deterministic:: + + >>> 'foo bar baz'.replace('foo', 'baz').replace('baz', 'bar') + 'bar bar bar' + >>> m = MultiReplace({'foo': 'baz', 'baz': 'bar'}) + >>> m.sub('foo bar baz') + 'baz bar bar' + + This is because the order of replacement can matter if you're inserting + something that might be replaced by a later substitution. Pay attention and + if you need to rely on order then consider using a list of tuples instead + of a dictionary. + """ + + def __init__(self, sub_map, **kwargs): + """Compile any regular expressions that have been passed.""" + options = { + 'regex': False, + 'flags': 0, + } + options.update(kwargs) + self.group_map = {} + regex_values = [] + + if isinstance(sub_map, Mapping): + sub_map = sub_map.items() + + for idx, vals in enumerate(sub_map): + group_name = f'group{idx}' + if isinstance(vals[0], str): + # If we're not treating input strings like a regex, escape it + if not options['regex']: + exp = re.escape(vals[0]) + else: + exp = vals[0] + else: + exp = vals[0].pattern + + regex_values.append(f'(?P<{group_name}>{exp})') + self.group_map[group_name] = vals[1] + + self.combined_pattern = re.compile( + '|'.join(regex_values), + flags=options['flags'] + ) + + def _get_value(self, match): + """Given a match object find replacement value.""" + group_dict = match.groupdict() + key = [x for x in group_dict if group_dict[x]][0] + return self.group_map[key] + + def sub(self, text): + """ + Run substitutions on the input text. + + Given an input string, run all substitutions given in the + constructor. + """ + return self.combined_pattern.sub(self._get_value, text) + + +def multi_replace(text, sub_map, **kwargs): + """ + Shortcut function to invoke MultiReplace in a single call. + + Example Usage:: + + from boltons.strutils import multi_replace + new = multi_replace( + 'The foo bar cat ate a bat', + {'foo': 'zoo', 'cat': 'hat', 'bat': 'kraken'} + ) + new == 'The zoo bar hat ate a kraken' + """ + m = MultiReplace(sub_map, **kwargs) + return m.sub(text) + + +def unwrap_text(text, ending='\n\n'): + r""" + Unwrap text, the natural complement to :func:`textwrap.wrap`. + + >>> text = "Short \n lines \nwrapped\nsmall.\n\nAnother\nparagraph." + >>> unwrap_text(text) + 'Short lines wrapped small.\n\nAnother paragraph.' + + Args: + text: A string to unwrap. + ending (str): The string to join all unwrapped paragraphs + by. Pass ``None`` to get the list. Defaults to '\n\n' for + compatibility with Markdown and RST. + + """ + all_grafs = [] + cur_graf = [] + for line in text.splitlines(): + line = line.strip() + if line: + cur_graf.append(line) + else: + all_grafs.append(' '.join(cur_graf)) + cur_graf = [] + if cur_graf: + all_grafs.append(' '.join(cur_graf)) + if ending is None: + return all_grafs + return ending.join(all_grafs) + +def removeprefix(text: str, prefix: str) -> str: + r""" + Remove `prefix` from start of `text` if present. + + Backport of `str.removeprefix` for Python versions less than 3.9. + + Args: + text: A string to remove the prefix from. + prefix: The string to remove from the beginning of `text`. + """ + if text.startswith(prefix): + return text[len(prefix):] + return text diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/tableutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/tableutils.py new file mode 100644 index 0000000000000000000000000000000000000000..46f155eb08ac6e0aa90db05e4768ec23f4ad6af1 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/tableutils.py @@ -0,0 +1,583 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""If there is one recurring theme in ``boltons``, it is that Python +has excellent datastructures that constitute a good foundation for +most quick manipulations, as well as building applications. However, +Python usage has grown much faster than builtin data structure +power. Python has a growing need for more advanced general-purpose +data structures which behave intuitively. + +The :class:`Table` class is one example. When handed one- or +two-dimensional data, it can provide useful, if basic, text and HTML +renditions of small to medium sized data. It also heuristically +handles recursive data of various formats (lists, dicts, namedtuples, +objects). + +For more advanced :class:`Table`-style manipulation check out the +`pandas`_ DataFrame. + +.. _pandas: http://pandas.pydata.org/ + +""" + + +from html import escape as html_escape +import types +from itertools import islice +from collections.abc import Sequence, Mapping, MutableSequence + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + +""" +Some idle feature thoughts: + +* shift around column order without rearranging data +* gotta make it so you can add additional items, not just initialize with +* maybe a shortcut would be to allow adding of Tables to other Tables +* what's the perf of preallocating lists and overwriting items versus + starting from empty? +* is it possible to effectively tell the difference between when a + Table is from_data()'d with a single row (list) or with a list of lists? +* CSS: white-space pre-line or pre-wrap maybe? +* Would be nice to support different backends (currently uses lists + exclusively). Sometimes large datasets come in list-of-dicts and + list-of-tuples format and it's desirable to cut down processing overhead. + +TODO: make iterable on rows? +""" + +__all__ = ['Table'] + + +def to_text(obj, maxlen=None): + try: + text = str(obj) + except Exception: + try: + text = str(repr(obj)) + except Exception: + text = str(object.__repr__(obj)) + if maxlen and len(text) > maxlen: + text = text[:maxlen - 3] + '...' + # TODO: inverse of ljust/rjust/center + return text + + +def escape_html(obj, maxlen=None): + text = to_text(obj, maxlen=maxlen) + return html_escape(text, quote=True) + + +_DNR = {type(None), bool, complex, float, type(NotImplemented), slice, + str, bytes, int, + types.FunctionType, types.MethodType, + types.BuiltinFunctionType, types.GeneratorType} + + +class UnsupportedData(TypeError): + pass + + +class InputType: + def __init__(self, *a, **kw): + pass + + def get_entry_seq(self, data_seq, headers): + return [self.get_entry(entry, headers) for entry in data_seq] + + +class DictInputType(InputType): + def check_type(self, obj): + return isinstance(obj, Mapping) + + def guess_headers(self, obj): + return sorted(obj.keys()) + + def get_entry(self, obj, headers): + return [obj.get(h) for h in headers] + + def get_entry_seq(self, obj, headers): + return [[ci.get(h) for h in headers] for ci in obj] + + +class ObjectInputType(InputType): + def check_type(self, obj): + return type(obj) not in _DNR and hasattr(obj, '__class__') + + def guess_headers(self, obj): + headers = [] + for attr in dir(obj): + # an object's __dict__ could technically have non-string keys + try: + val = getattr(obj, attr) + except Exception: + # seen on greenlet: `run` shows in dir() but raises + # AttributeError. Also properties misbehave. + continue + if callable(val): + continue + headers.append(attr) + return headers + + def get_entry(self, obj, headers): + values = [] + for h in headers: + try: + values.append(getattr(obj, h)) + except Exception: + values.append(None) + return values + + +# might be better to hardcode list support since it's so close to the +# core or might be better to make this the copy-style from_* importer +# and have the non-copy style be hardcoded in __init__ +class ListInputType(InputType): + def check_type(self, obj): + return isinstance(obj, MutableSequence) + + def guess_headers(self, obj): + return None + + def get_entry(self, obj, headers): + return obj + + def get_entry_seq(self, obj_seq, headers): + return obj_seq + + +class TupleInputType(InputType): + def check_type(self, obj): + return isinstance(obj, tuple) + + def guess_headers(self, obj): + return None + + def get_entry(self, obj, headers): + return list(obj) + + def get_entry_seq(self, obj_seq, headers): + return [list(t) for t in obj_seq] + + +class NamedTupleInputType(InputType): + def check_type(self, obj): + return hasattr(obj, '_fields') and isinstance(obj, tuple) + + def guess_headers(self, obj): + return list(obj._fields) + + def get_entry(self, obj, headers): + return [getattr(obj, h, None) for h in headers] + + def get_entry_seq(self, obj_seq, headers): + return [[getattr(obj, h, None) for h in headers] for obj in obj_seq] + + +class Table: + """ + This Table class is meant to be simple, low-overhead, and extensible. Its + most common use would be for translation between in-memory data + structures and serialization formats, such as HTML and console-ready text. + + As such, it stores data in list-of-lists format, and *does not* copy + lists passed in. It also reserves the right to modify those lists in a + "filling" process, whereby short lists are extended to the width of + the table (usually determined by number of headers). This greatly + reduces overhead and processing/validation that would have to occur + otherwise. + + General description of headers behavior: + + Headers describe the columns, but are not part of the data, however, + if the *headers* argument is omitted, Table tries to infer header + names from the data. It is possible to have a table with no headers, + just pass in ``headers=None``. + + Supported inputs: + + * :class:`list` of :class:`list` objects + * :class:`dict` (list/single) + * :class:`object` (list/single) + * :class:`collections.namedtuple` (list/single) + * TODO: DB API cursor? + * TODO: json + + Supported outputs: + + * HTML + * Pretty text (also usable as GF Markdown) + * TODO: CSV + * TODO: json + * TODO: json lines + + To minimize resident size, the Table data is stored as a list of lists. + """ + + # order definitely matters here + _input_types = [DictInputType(), ListInputType(), + NamedTupleInputType(), TupleInputType(), + ObjectInputType()] + + _html_tr, _html_tr_close = '', '' + _html_th, _html_th_close = '', '' + _html_td, _html_td_close = '', '' + _html_thead, _html_thead_close = '', '' + _html_tbody, _html_tbody_close = '', '' + + # _html_tfoot, _html_tfoot_close = '', '' + _html_table_tag, _html_table_tag_close = '', '
' + + def __init__(self, data=None, headers=_MISSING, metadata=None): + if headers is _MISSING: + headers = [] + if data: + headers, data = list(data[0]), islice(data, 1, None) + self.headers = headers or [] + self.metadata = metadata or {} + self._data = [] + self._width = 0 + + self.extend(data) + + def extend(self, data): + """ + Append the given data to the end of the Table. + """ + if not data: + return + self._data.extend(data) + self._set_width() + self._fill() + + def _set_width(self, reset=False): + if reset: + self._width = 0 + if self._width: + return + if self.headers: + self._width = len(self.headers) + return + self._width = max([len(d) for d in self._data]) + + def _fill(self): + width, filler = self._width, [None] + if not width: + return + for d in self._data: + rem = width - len(d) + if rem > 0: + d.extend(filler * rem) + return + + @classmethod + def from_dict(cls, data, headers=_MISSING, max_depth=1, metadata=None): + """Create a Table from a :class:`dict`. Operates the same as + :meth:`from_data`, but forces interpretation of the data as a + Mapping. + """ + return cls.from_data(data=data, headers=headers, + max_depth=max_depth, _data_type=DictInputType(), + metadata=metadata) + + @classmethod + def from_list(cls, data, headers=_MISSING, max_depth=1, metadata=None): + """Create a Table from a :class:`list`. Operates the same as + :meth:`from_data`, but forces the interpretation of the data + as a Sequence. + """ + return cls.from_data(data=data, headers=headers, + max_depth=max_depth, _data_type=ListInputType(), + metadata=metadata) + + @classmethod + def from_object(cls, data, headers=_MISSING, max_depth=1, metadata=None): + """Create a Table from an :class:`object`. Operates the same as + :meth:`from_data`, but forces the interpretation of the data + as an object. May be useful for some :class:`dict` and + :class:`list` subtypes. + """ + return cls.from_data(data=data, headers=headers, + max_depth=max_depth, _data_type=ObjectInputType(), + metadata=metadata) + + @classmethod + def from_data(cls, data, headers=_MISSING, max_depth=1, **kwargs): + + """Create a Table from any supported data, heuristically + selecting how to represent the data in Table format. + + Args: + data (object): Any object or iterable with data to be + imported to the Table. + + headers (iterable): An iterable of headers to be matched + to the data. If not explicitly passed, headers will be + guessed for certain datatypes. + + max_depth (int): The level to which nested Tables should + be created (default: 1). + + _data_type (InputType subclass): For advanced use cases, + do not guess the type of the input data, use this data + type instead. + """ + # TODO: seen/cycle detection/reuse ? + # maxdepth follows the same behavior as find command + # i.e., it doesn't work if max_depth=0 is passed in + metadata = kwargs.pop('metadata', None) + _data_type = kwargs.pop('_data_type', None) + + if max_depth < 1: + # return data instead? + return cls(headers=headers, metadata=metadata) + is_seq = isinstance(data, Sequence) + if is_seq: + if not data: + return cls(headers=headers, metadata=metadata) + to_check = data[0] + if not _data_type: + for it in cls._input_types: + if it.check_type(to_check): + _data_type = it + break + else: + # not particularly happy about this rewind-y approach + is_seq = False + to_check = data + else: + if type(data) in _DNR: + # hmm, got scalar data. + # raise an exception or make an exception, nahmsayn? + return cls([[data]], headers=headers, metadata=metadata) + to_check = data + if not _data_type: + for it in cls._input_types: + if it.check_type(to_check): + _data_type = it + break + else: + raise UnsupportedData('unsupported data type %r' + % type(data)) + if headers is _MISSING: + headers = _data_type.guess_headers(to_check) + if is_seq: + entries = _data_type.get_entry_seq(data, headers) + else: + entries = [_data_type.get_entry(data, headers)] + if max_depth > 1: + new_max_depth = max_depth - 1 + for i, entry in enumerate(entries): + for j, cell in enumerate(entry): + if type(cell) in _DNR: + # optimization to avoid function overhead + continue + try: + entries[i][j] = cls.from_data(cell, + max_depth=new_max_depth) + except UnsupportedData: + continue + return cls(entries, headers=headers, metadata=metadata) + + def __len__(self): + return len(self._data) + + def __getitem__(self, idx): + return self._data[idx] + + def __repr__(self): + cn = self.__class__.__name__ + if self.headers: + return f'{cn}(headers={self.headers!r}, data={self._data!r})' + else: + return f'{cn}({self._data!r})' + + def to_html(self, orientation=None, wrapped=True, + with_headers=True, with_newlines=True, + with_metadata=False, max_depth=1): + """Render this Table to HTML. Configure the structure of Table + HTML by subclassing and overriding ``_html_*`` class + attributes. + + Args: + orientation (str): one of 'auto', 'horizontal', or + 'vertical' (or the first letter of any of + those). Default 'auto'. + wrapped (bool): whether or not to include the wrapping + '
' tags. Default ``True``, set to + ``False`` if appending multiple Table outputs or an + otherwise customized HTML wrapping tag is needed. + with_newlines (bool): Set to ``True`` if output should + include added newlines to make the HTML more + readable. Default ``False``. + with_metadata (bool/str): Set to ``True`` if output should + be preceded with a Table of preset metadata, if it + exists. Set to special value ``'bottom'`` if the + metadata Table HTML should come *after* the main HTML output. + max_depth (int): Indicate how deeply to nest HTML tables + before simply reverting to :func:`repr`-ing the nested + data. + + Returns: + A text string of the HTML of the rendered table. + + """ + lines = [] + headers = [] + if with_metadata and self.metadata: + metadata_table = Table.from_data(self.metadata, + max_depth=max_depth) + metadata_html = metadata_table.to_html(with_headers=True, + with_newlines=with_newlines, + with_metadata=False, + max_depth=max_depth) + if with_metadata != 'bottom': + lines.append(metadata_html) + lines.append('
') + + if with_headers and self.headers: + headers.extend(self.headers) + headers.extend([None] * (self._width - len(self.headers))) + if wrapped: + lines.append(self._html_table_tag) + orientation = orientation or 'auto' + ol = orientation[0].lower() + if ol == 'a': + ol = 'h' if len(self) > 1 else 'v' + if ol == 'h': + self._add_horizontal_html_lines(lines, headers=headers, + max_depth=max_depth) + elif ol == 'v': + self._add_vertical_html_lines(lines, headers=headers, + max_depth=max_depth) + else: + raise ValueError("expected one of 'auto', 'vertical', or" + " 'horizontal', not %r" % orientation) + if with_metadata and self.metadata and with_metadata == 'bottom': + lines.append('
') + lines.append(metadata_html) + + if wrapped: + lines.append(self._html_table_tag_close) + sep = '\n' if with_newlines else '' + return sep.join(lines) + + def get_cell_html(self, value): + """Called on each value in an HTML table. By default it simply escapes + the HTML. Override this method to add additional conditions + and behaviors, but take care to ensure the final output is + HTML escaped. + """ + return escape_html(value) + + def _add_horizontal_html_lines(self, lines, headers, max_depth): + esc = self.get_cell_html + new_depth = max_depth - 1 if max_depth > 1 else max_depth + if max_depth > 1: + new_depth = max_depth - 1 + if headers: + _thth = self._html_th_close + self._html_th + lines.append(self._html_thead) + lines.append(self._html_tr + self._html_th + + _thth.join([esc(h) for h in headers]) + + self._html_th_close + self._html_tr_close) + lines.append(self._html_thead_close) + trtd, _tdtd, _td_tr = (self._html_tr + self._html_td, + self._html_td_close + self._html_td, + self._html_td_close + self._html_tr_close) + lines.append(self._html_tbody) + for row in self._data: + if max_depth > 1: + _fill_parts = [] + for cell in row: + if isinstance(cell, Table): + _fill_parts.append(cell.to_html(max_depth=new_depth)) + else: + _fill_parts.append(esc(cell)) + else: + _fill_parts = [esc(c) for c in row] + lines.append(''.join([trtd, _tdtd.join(_fill_parts), _td_tr])) + lines.append(self._html_tbody_close) + + def _add_vertical_html_lines(self, lines, headers, max_depth): + esc = self.get_cell_html + new_depth = max_depth - 1 if max_depth > 1 else max_depth + tr, th, _th = self._html_tr, self._html_th, self._html_th_close + td, _tdtd = self._html_td, self._html_td_close + self._html_td + _td_tr = self._html_td_close + self._html_tr_close + for i in range(self._width): + line_parts = [tr] + if headers: + line_parts.extend([th, esc(headers[i]), _th]) + if max_depth > 1: + new_depth = max_depth - 1 + _fill_parts = [] + for row in self._data: + cell = row[i] + if isinstance(cell, Table): + _fill_parts.append(cell.to_html(max_depth=new_depth)) + else: + _fill_parts.append(esc(row[i])) + else: + _fill_parts = [esc(row[i]) for row in self._data] + line_parts.extend([td, _tdtd.join(_fill_parts), _td_tr]) + lines.append(''.join(line_parts)) + + def to_text(self, with_headers=True, maxlen=None): + """Get the Table's textual representation. Only works well + for Tables with non-recursive data. + + Args: + with_headers (bool): Whether to include a header row at the top. + maxlen (int): Max length of data in each cell. + """ + lines = [] + widths = [] + headers = list(self.headers) + text_data = [[to_text(cell, maxlen=maxlen) for cell in row] + for row in self._data] + for idx in range(self._width): + cur_widths = [len(cur) for cur in text_data] + if with_headers: + cur_widths.append(len(to_text(headers[idx], maxlen=maxlen))) + widths.append(max(cur_widths)) + if with_headers: + lines.append(' | '.join([h.center(widths[i]) + for i, h in enumerate(headers)])) + lines.append('-|-'.join(['-' * w for w in widths])) + for row in text_data: + lines.append(' | '.join([cell.center(widths[j]) + for j, cell in enumerate(row)])) + return '\n'.join(lines) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/tbutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/tbutils.py new file mode 100644 index 0000000000000000000000000000000000000000..bfc49840cc92ccebf5506914c69c14252b158cfe --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/tbutils.py @@ -0,0 +1,820 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""One of the oft-cited tenets of Python is that it is better to ask +forgiveness than permission. That is, there are many cases where it is +more inclusive and correct to handle exceptions than spend extra lines +and execution time checking for conditions. This philosophy makes good +exception handling features all the more important. Unfortunately +Python's :mod:`traceback` module is woefully behind the times. + +The ``tbutils`` module provides two disparate but complementary featuresets: + + 1. With :class:`ExceptionInfo` and :class:`TracebackInfo`, the + ability to extract, construct, manipulate, format, and serialize + exceptions, tracebacks, and callstacks. + 2. With :class:`ParsedException`, the ability to find and parse tracebacks + from captured output such as logs and stdout. + +There is also the :class:`ContextualTracebackInfo` variant of +:class:`TracebackInfo`, which includes much more information from each +frame of the callstack, including values of locals and neighboring +lines of code. +""" + + +import re +import sys +import linecache + + +# TODO: chaining primitives? what are real use cases where these help? + +# TODO: print_* for backwards compatibility +# __all__ = ['extract_stack', 'extract_tb', 'format_exception', +# 'format_exception_only', 'format_list', 'format_stack', +# 'format_tb', 'print_exc', 'format_exc', 'print_exception', +# 'print_last', 'print_stack', 'print_tb'] + + +__all__ = ['ExceptionInfo', 'TracebackInfo', 'Callpoint', + 'ContextualExceptionInfo', 'ContextualTracebackInfo', + 'ContextualCallpoint', 'print_exception', 'ParsedException'] + + +class Callpoint: + """The Callpoint is a lightweight object used to represent a single + entry in the code of a call stack. It stores the code-related + metadata of a given frame. Available attributes are the same as + the parameters below. + + Args: + func_name (str): the function name + lineno (int): the line number + module_name (str): the module name + module_path (str): the filesystem path of the module + lasti (int): the index of bytecode execution + line (str): the single-line code content (if available) + + """ + __slots__ = ('func_name', 'lineno', 'module_name', 'module_path', 'lasti', + 'line') + + def __init__(self, module_name, module_path, func_name, + lineno, lasti, line=None): + self.func_name = func_name + self.lineno = lineno + self.module_name = module_name + self.module_path = module_path + self.lasti = lasti + self.line = line + + def to_dict(self): + "Get a :class:`dict` copy of the Callpoint. Useful for serialization." + ret = {} + for slot in self.__slots__: + try: + val = getattr(self, slot) + except AttributeError: + pass + else: + ret[slot] = str(val) if isinstance(val, _DeferredLine) else val + return ret + + @classmethod + def from_current(cls, level=1): + "Creates a Callpoint from the location of the calling function." + frame = sys._getframe(level) + return cls.from_frame(frame) + + @classmethod + def from_frame(cls, frame): + "Create a Callpoint object from data extracted from the given frame." + func_name = frame.f_code.co_name + lineno = frame.f_lineno + module_name = frame.f_globals.get('__name__', '') + module_path = frame.f_code.co_filename + lasti = frame.f_lasti + line = _DeferredLine(module_path, lineno, frame.f_globals) + return cls(module_name, module_path, func_name, + lineno, lasti, line=line) + + @classmethod + def from_tb(cls, tb): + """Create a Callpoint from the traceback of the current + exception. Main difference with :meth:`from_frame` is that + ``lineno`` and ``lasti`` come from the traceback, which is to + say the line that failed in the try block, not the line + currently being executed (in the except block). + """ + func_name = tb.tb_frame.f_code.co_name + lineno = tb.tb_lineno + lasti = tb.tb_lasti + module_name = tb.tb_frame.f_globals.get('__name__', '') + module_path = tb.tb_frame.f_code.co_filename + line = _DeferredLine(module_path, lineno, tb.tb_frame.f_globals) + return cls(module_name, module_path, func_name, + lineno, lasti, line=line) + + def __repr__(self): + cn = self.__class__.__name__ + args = [getattr(self, s, None) for s in self.__slots__] + if not any(args): + return super().__repr__() + else: + return '{}({})'.format(cn, ', '.join([repr(a) for a in args])) + + def tb_frame_str(self): + """Render the Callpoint as it would appear in a standard printed + Python traceback. Returns a string with filename, line number, + function name, and the actual code line of the error on up to + two lines. + """ + ret = ' File "{}", line {}, in {}\n'.format(self.module_path, + self.lineno, + self.func_name) + if self.line: + ret += f' {str(self.line).strip()}\n' + return ret + + +class _DeferredLine: + """The _DeferredLine type allows Callpoints and TracebackInfos to be + constructed without potentially hitting the filesystem, as is the + normal behavior of the standard Python :mod:`traceback` and + :mod:`linecache` modules. Calling :func:`str` fetches and caches + the line. + + Args: + filename (str): the path of the file containing the line + lineno (int): the number of the line in question + module_globals (dict): an optional dict of module globals, + used to handle advanced use cases using custom module loaders. + + """ + __slots__ = ('filename', 'lineno', '_line', '_mod_name', '_mod_loader') + + def __init__(self, filename, lineno, module_globals=None): + self.filename = filename + self.lineno = lineno + if module_globals is None: + self._mod_name = None + self._mod_loader = None + else: + self._mod_name = module_globals.get('__name__') + self._mod_loader = module_globals.get('__loader__') + + def __eq__(self, other): + return (self.lineno, self.filename) == (other.lineno, other.filename) + + def __ne__(self, other): + return not self == other + + def __str__(self): + ret = getattr(self, '_line', None) + if ret is not None: + return ret + try: + linecache.checkcache(self.filename) + mod_globals = {'__name__': self._mod_name, + '__loader__': self._mod_loader} + line = linecache.getline(self.filename, + self.lineno, + mod_globals) + line = line.rstrip() + except KeyError: + line = '' + self._line = line + return line + + def __repr__(self): + return repr(str(self)) + + def __len__(self): + return len(str(self)) + + +# TODO: dedup frames, look at __eq__ on _DeferredLine +class TracebackInfo: + """The TracebackInfo class provides a basic representation of a stack + trace, be it from an exception being handled or just part of + normal execution. It is basically a wrapper around a list of + :class:`Callpoint` objects representing frames. + + Args: + frames (list): A list of frame objects in the stack. + + .. note :: + + ``TracebackInfo`` can represent both exception tracebacks and + non-exception tracebacks (aka stack traces). As a result, there + is no ``TracebackInfo.from_current()``, as that would be + ambiguous. Instead, call :meth:`TracebackInfo.from_frame` + without the *frame* argument for a stack trace, or + :meth:`TracebackInfo.from_traceback` without the *tb* argument + for an exception traceback. + """ + callpoint_type = Callpoint + + def __init__(self, frames): + self.frames = frames + + @classmethod + def from_frame(cls, frame=None, level=1, limit=None): + """Create a new TracebackInfo *frame* by recurring up in the stack a + max of *limit* times. If *frame* is unset, get the frame from + :func:`sys._getframe` using *level*. + + Args: + frame (types.FrameType): frame object from + :func:`sys._getframe` or elsewhere. Defaults to result + of :func:`sys.get_frame`. + level (int): If *frame* is unset, the desired frame is + this many levels up the stack from the invocation of + this method. Default ``1`` (i.e., caller of this method). + limit (int): max number of parent frames to extract + (defaults to :data:`sys.tracebacklimit`) + + """ + ret = [] + if frame is None: + frame = sys._getframe(level) + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while frame is not None and n < limit: + item = cls.callpoint_type.from_frame(frame) + ret.append(item) + frame = frame.f_back + n += 1 + ret.reverse() + return cls(ret) + + @classmethod + def from_traceback(cls, tb=None, limit=None): + """Create a new TracebackInfo from the traceback *tb* by recurring + up in the stack a max of *limit* times. If *tb* is unset, get + the traceback from the currently handled exception. If no + exception is being handled, raise a :exc:`ValueError`. + + Args: + + frame (types.TracebackType): traceback object from + :func:`sys.exc_info` or elsewhere. If absent or set to + ``None``, defaults to ``sys.exc_info()[2]``, and + raises a :exc:`ValueError` if no exception is + currently being handled. + limit (int): max number of parent frames to extract + (defaults to :data:`sys.tracebacklimit`) + + """ + ret = [] + if tb is None: + tb = sys.exc_info()[2] + if tb is None: + raise ValueError('no tb set and no exception being handled') + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while tb is not None and n < limit: + item = cls.callpoint_type.from_tb(tb) + ret.append(item) + tb = tb.tb_next + n += 1 + return cls(ret) + + @classmethod + def from_dict(cls, d): + "Complements :meth:`TracebackInfo.to_dict`." + # TODO: check this. + return cls(d['frames']) + + def to_dict(self): + """Returns a dict with a list of :class:`Callpoint` frames converted + to dicts. + """ + return {'frames': [f.to_dict() for f in self.frames]} + + def __len__(self): + return len(self.frames) + + def __iter__(self): + return iter(self.frames) + + def __repr__(self): + cn = self.__class__.__name__ + + if self.frames: + frame_part = f' last={self.frames[-1]!r}' + else: + frame_part = '' + + return f'<{cn} frames={len(self.frames)}{frame_part}>' + + def __str__(self): + return self.get_formatted() + + def get_formatted(self): + """Returns a string as formatted in the traditional Python + built-in style observable when an exception is not caught. In + other words, mimics :func:`traceback.format_tb` and + :func:`traceback.format_stack`. + """ + ret = 'Traceback (most recent call last):\n' + ret += ''.join([f.tb_frame_str() for f in self.frames]) + return ret + + +class ExceptionInfo: + """An ExceptionInfo object ties together three main fields suitable + for representing an instance of an exception: The exception type + name, a string representation of the exception itself (the + exception message), and information about the traceback (stored as + a :class:`TracebackInfo` object). + + These fields line up with :func:`sys.exc_info`, but unlike the + values returned by that function, ExceptionInfo does not hold any + references to the real exception or traceback. This property makes + it suitable for serialization or long-term retention, without + worrying about formatting pitfalls, circular references, or leaking memory. + + Args: + + exc_type (str): The exception type name. + exc_msg (str): String representation of the exception value. + tb_info (TracebackInfo): Information about the stack trace of the + exception. + + Like the :class:`TracebackInfo`, ExceptionInfo is most commonly + instantiated from one of its classmethods: :meth:`from_exc_info` + or :meth:`from_current`. + """ + + #: Override this in inherited types to control the TracebackInfo type used + tb_info_type = TracebackInfo + + def __init__(self, exc_type, exc_msg, tb_info): + # TODO: additional fields for SyntaxErrors + self.exc_type = exc_type + self.exc_msg = exc_msg + self.tb_info = tb_info + + @classmethod + def from_exc_info(cls, exc_type, exc_value, traceback): + """Create an :class:`ExceptionInfo` object from the exception's type, + value, and traceback, as returned by :func:`sys.exc_info`. See + also :meth:`from_current`. + """ + type_str = exc_type.__name__ + type_mod = exc_type.__module__ + if type_mod not in ("__main__", "__builtin__", "exceptions", "builtins"): + type_str = f'{type_mod}.{type_str}' + val_str = _some_str(exc_value) + tb_info = cls.tb_info_type.from_traceback(traceback) + return cls(type_str, val_str, tb_info) + + @classmethod + def from_current(cls): + """Create an :class:`ExceptionInfo` object from the current exception + being handled, by way of :func:`sys.exc_info`. Will raise an + exception if no exception is currently being handled. + """ + return cls.from_exc_info(*sys.exc_info()) + + def to_dict(self): + """Get a :class:`dict` representation of the ExceptionInfo, suitable + for JSON serialization. + """ + return {'exc_type': self.exc_type, + 'exc_msg': self.exc_msg, + 'exc_tb': self.tb_info.to_dict()} + + def __repr__(self): + cn = self.__class__.__name__ + try: + len_frames = len(self.tb_info.frames) + last_frame = f', last={self.tb_info.frames[-1]!r}' + except Exception: + len_frames = 0 + last_frame = '' + args = (cn, self.exc_type, self.exc_msg, len_frames, last_frame) + return '<%s [%s: %s] (%s frames%s)>' % args + + def get_formatted(self): + """Returns a string formatted in the traditional Python + built-in style observable when an exception is not caught. In + other words, mimics :func:`traceback.format_exception`. + """ + # TODO: add SyntaxError formatting + tb_str = self.tb_info.get_formatted() + return ''.join([tb_str, f'{self.exc_type}: {self.exc_msg}']) + + def get_formatted_exception_only(self): + return f'{self.exc_type}: {self.exc_msg}' + + +class ContextualCallpoint(Callpoint): + """The ContextualCallpoint is a :class:`Callpoint` subtype with the + exact same API and storing two additional values: + + 1. :func:`repr` outputs for local variables from the Callpoint's scope + 2. A number of lines before and after the Callpoint's line of code + + The ContextualCallpoint is used by the :class:`ContextualTracebackInfo`. + """ + def __init__(self, *a, **kw): + self.local_reprs = kw.pop('local_reprs', {}) + self.pre_lines = kw.pop('pre_lines', []) + self.post_lines = kw.pop('post_lines', []) + super().__init__(*a, **kw) + + @classmethod + def from_frame(cls, frame): + "Identical to :meth:`Callpoint.from_frame`" + ret = super().from_frame(frame) + ret._populate_local_reprs(frame.f_locals) + ret._populate_context_lines() + return ret + + @classmethod + def from_tb(cls, tb): + "Identical to :meth:`Callpoint.from_tb`" + ret = super().from_tb(tb) + ret._populate_local_reprs(tb.tb_frame.f_locals) + ret._populate_context_lines() + return ret + + def _populate_context_lines(self, pivot=8): + DL, lineno = _DeferredLine, self.lineno + try: + module_globals = self.line.module_globals + except AttributeError: + module_globals = None + start_line = max(0, lineno - pivot) + pre_lines = [DL(self.module_path, ln, module_globals) + for ln in range(start_line, lineno)] + self.pre_lines[:] = pre_lines + post_lines = [DL(self.module_path, ln, module_globals) + for ln in range(lineno + 1, lineno + 1 + pivot)] + self.post_lines[:] = post_lines + return + + def _populate_local_reprs(self, f_locals): + local_reprs = self.local_reprs + for k, v in f_locals.items(): + try: + local_reprs[k] = repr(v) + except Exception: + surrogate = '' % type(v).__name__ + local_reprs[k] = surrogate + return + + def to_dict(self): + """ + Same principle as :meth:`Callpoint.to_dict`, but with the added + contextual values. With ``ContextualCallpoint.to_dict()``, + each frame will now be represented like:: + + {'func_name': 'print_example', + 'lineno': 0, + 'module_name': 'example_module', + 'module_path': '/home/example/example_module.pyc', + 'lasti': 0, + 'line': 'print "example"', + 'locals': {'variable': '"value"'}, + 'pre_lines': ['variable = "value"'], + 'post_lines': []} + + The locals dictionary and line lists are copies and can be mutated + freely. + """ + ret = super().to_dict() + ret['locals'] = dict(self.local_reprs) + + # get the line numbers and textual lines + # without assuming DeferredLines + start_line = self.lineno - len(self.pre_lines) + pre_lines = [{'lineno': start_line + i, 'line': str(l)} + for i, l in enumerate(self.pre_lines)] + # trim off leading empty lines + for i, item in enumerate(pre_lines): + if item['line']: + break + if i: + pre_lines = pre_lines[i:] + ret['pre_lines'] = pre_lines + + # now post_lines + post_lines = [{'lineno': self.lineno + i, 'line': str(l)} + for i, l in enumerate(self.post_lines)] + _last = 0 + for i, item in enumerate(post_lines): + if item['line']: + _last = i + post_lines = post_lines[:_last + 1] + ret['post_lines'] = post_lines + return ret + + +class ContextualTracebackInfo(TracebackInfo): + """The ContextualTracebackInfo type is a :class:`TracebackInfo` + subtype that is used by :class:`ContextualExceptionInfo` and uses + the :class:`ContextualCallpoint` as its frame-representing + primitive. + """ + callpoint_type = ContextualCallpoint + + +class ContextualExceptionInfo(ExceptionInfo): + """The ContextualTracebackInfo type is a :class:`TracebackInfo` + subtype that uses the :class:`ContextualCallpoint` as its + frame-representing primitive. + + It carries with it most of the exception information required to + recreate the widely recognizable "500" page for debugging Django + applications. + """ + tb_info_type = ContextualTracebackInfo + + +# TODO: clean up & reimplement -- specifically for syntax errors +def format_exception_only(etype, value): + """Format the exception part of a traceback. + + The arguments are the exception type and value such as given by + sys.last_type and sys.last_value. The return value is a list of + strings, each ending in a newline. + + Normally, the list contains a single string; however, for + SyntaxError exceptions, it contains several lines that (when + printed) display detailed information about where the syntax + error occurred. + + The message indicating which exception occurred is always the last + string in the list. + + """ + # Gracefully handle (the way Python 2.4 and earlier did) the case of + # being called with (None, None). + if etype is None: + return [_format_final_exc_line(etype, value)] + + stype = etype.__name__ + smod = etype.__module__ + if smod not in ("__main__", "builtins", "exceptions"): + stype = smod + '.' + stype + + if not issubclass(etype, SyntaxError): + return [_format_final_exc_line(stype, value)] + + # It was a syntax error; show exactly where the problem was found. + lines = [] + filename = value.filename or "" + lineno = str(value.lineno) or '?' + lines.append(f' File "{filename}", line {lineno}\n') + badline = value.text + offset = value.offset + if badline is not None: + lines.append(' %s\n' % badline.strip()) + if offset is not None: + caretspace = badline.rstrip('\n')[:offset].lstrip() + # non-space whitespace (likes tabs) must be kept for alignment + caretspace = ((c.isspace() and c or ' ') for c in caretspace) + # only three spaces to account for offset1 == pos 0 + lines.append(' %s^\n' % ''.join(caretspace)) + msg = value.msg or "" + lines.append(f"{stype}: {msg}\n") + return lines + + +# TODO: use asciify, improved if necessary +def _some_str(value): + try: + return str(value) + except Exception: + pass + return '' % type(value).__name__ + + +def _format_final_exc_line(etype, value): + valuestr = _some_str(value) + if value is None or not valuestr: + line = "%s\n" % etype + else: + line = f"{etype}: {valuestr}\n" + return line + + +def print_exception(etype, value, tb, limit=None, file=None): + """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. + + This differs from print_tb() in the following ways: (1) if + traceback is not None, it prints a header "Traceback (most recent + call last):"; (2) it prints the exception type and value after the + stack trace; (3) if type is SyntaxError and value has the + appropriate format, it prints the line where the syntax error + occurred with a caret on the next line indicating the approximate + position of the error. + """ + + if file is None: + file = sys.stderr + if tb: + tbi = TracebackInfo.from_traceback(tb, limit) + print(str(tbi), end='', file=file) + + for line in format_exception_only(etype, value): + print(line, end='', file=file) + + +def fix_print_exception(): + """ + Sets the default exception hook :func:`sys.excepthook` to the + :func:`tbutils.print_exception` that uses all the ``tbutils`` + facilities to provide a consistent output behavior. + """ + sys.excepthook = print_exception + + +_frame_re = re.compile(r'^File "(?P.+)", line (?P\d+)' + r', in (?P.+)$') +_se_frame_re = re.compile(r'^File "(?P.+)", line (?P\d+)') +_underline_re = re.compile(r'^[~^ ]*$') + +# TODO: ParsedException generator over large bodies of text + +class ParsedException: + """Stores a parsed traceback and exception as would be typically + output by :func:`sys.excepthook` or + :func:`traceback.print_exception`. + + .. note: + + Does not currently store SyntaxError details such as column. + + """ + def __init__(self, exc_type_name, exc_msg, frames=None): + self.exc_type = exc_type_name + self.exc_msg = exc_msg + self.frames = list(frames or []) + + @property + def source_file(self): + """ + The file path of module containing the function that raised the + exception, or None if not available. + """ + try: + return self.frames[-1]['filepath'] + except IndexError: + return None + + def to_dict(self): + "Get a copy as a JSON-serializable :class:`dict`." + return {'exc_type': self.exc_type, + 'exc_msg': self.exc_msg, + 'frames': list(self.frames)} + + def __repr__(self): + cn = self.__class__.__name__ + return ('%s(%r, %r, frames=%r)' + % (cn, self.exc_type, self.exc_msg, self.frames)) + + def to_string(self): + """Formats the exception and its traceback into the standard format, + as returned by the traceback module. + + ``ParsedException.from_string(text).to_string()`` should yield + ``text``. + + .. note:: + + Note that this method does not output "anchors" (e.g., + ``~~~~~^^``), as were added in Python 3.13. See the built-in + ``traceback`` module if these are necessary. + """ + lines = ['Traceback (most recent call last):'] + + for frame in self.frames: + lines.append(' File "{}", line {}, in {}'.format(frame['filepath'], + frame['lineno'], + frame['funcname'])) + source_line = frame.get('source_line') + if source_line: + lines.append(f' {source_line}') + if self.exc_msg: + lines.append(f'{self.exc_type}: {self.exc_msg}') + else: + lines.append(f'{self.exc_type}') + return '\n'.join(lines) + + @classmethod + def from_string(cls, tb_str): + """Parse a traceback and exception from the text *tb_str*. This text + is expected to have been decoded, otherwise it will be + interpreted as UTF-8. + + This method does not search a larger body of text for + tracebacks. If the first line of the text passed does not + match one of the known patterns, a :exc:`ValueError` will be + raised. This method will ignore trailing text after the end of + the first traceback. + + Args: + tb_str (str): The traceback text (:class:`unicode` or UTF-8 bytes) + """ + if not isinstance(tb_str, str): + tb_str = tb_str.decode('utf-8') + tb_lines = tb_str.lstrip().splitlines() + + # First off, handle some ignored exceptions. These can be the + # result of exceptions raised by __del__ during garbage + # collection + while tb_lines: + cl = tb_lines[-1] + if cl.startswith('Exception ') and cl.endswith('ignored'): + tb_lines.pop() + else: + break + if tb_lines and tb_lines[0].strip() == 'Traceback (most recent call last):': + start_line = 1 + frame_re = _frame_re + elif len(tb_lines) > 1 and tb_lines[-2].lstrip().startswith('^'): + # This is to handle the slight formatting difference + # associated with SyntaxErrors, which also don't really + # have tracebacks + start_line = 0 + frame_re = _se_frame_re + else: + raise ValueError('unrecognized traceback string format') + + frames = [] + line_no = start_line + while True: + frame_line = tb_lines[line_no].strip() + frame_match = frame_re.match(frame_line) + if frame_match: + frame_dict = frame_match.groupdict() + try: + next_line = tb_lines[line_no + 1] + except IndexError: + # We read what we could + next_line = '' + next_line_stripped = next_line.strip() + if ( + frame_re.match(next_line_stripped) or + # The exception message will not be indented + # This check is to avoid overrunning on eval-like + # tracebacks where the last frame doesn't have source + # code in the traceback + not next_line.startswith(' ') + ): + frame_dict['source_line'] = '' + else: + frame_dict['source_line'] = next_line_stripped + line_no += 1 + if _underline_re.match(tb_lines[line_no + 1]): + # To deal with anchors + line_no += 1 + else: + break + line_no += 1 + frames.append(frame_dict) + + try: + exc_line = '\n'.join(tb_lines[line_no:]) + exc_type, _, exc_msg = exc_line.partition(': ') + except Exception: + exc_type, exc_msg = '', '' + + return cls(exc_type, exc_msg, frames) + + +ParsedTB = ParsedException # legacy alias diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/timeutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/timeutils.py new file mode 100644 index 0000000000000000000000000000000000000000..82f201ee94699223728de0cc1799b755707e2b65 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/timeutils.py @@ -0,0 +1,566 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's :mod:`datetime` module provides some of the most complex +and powerful primitives in the Python standard library. Time is +nontrivial, but thankfully its support is first-class in +Python. ``dateutils`` provides some additional tools for working with +time. + +Additionally, timeutils provides a few basic utilities for working +with timezones in Python. The Python :mod:`datetime` module's +documentation describes how to create a +:class:`~datetime.datetime`-compatible :class:`~datetime.tzinfo` +subtype. It even provides a few examples. + +The following module defines usable forms of the timezones in those +docs, as well as a couple other useful ones, :data:`UTC` (aka GMT) and +:data:`LocalTZ` (representing the local timezone as configured in the +operating system). For timezones beyond these, as well as a higher +degree of accuracy in corner cases, check out `pytz`_ and `dateutil`_. + +.. _pytz: https://pypi.python.org/pypi/pytz +.. _dateutil: https://dateutil.readthedocs.io/en/stable/index.html +""" + +import re +import time +import bisect +import operator +from datetime import tzinfo, timedelta, date, datetime, timezone + + +# For legacy compatibility. +# boltons used to offer an implementation of total_seconds for Python <2.7 +total_seconds = timedelta.total_seconds + + +def dt_to_timestamp(dt): + """Converts from a :class:`~datetime.datetime` object to an integer + timestamp, suitable interoperation with :func:`time.time` and + other `Epoch-based timestamps`. + + .. _Epoch-based timestamps: https://en.wikipedia.org/wiki/Unix_time + + >>> timestamp = int(time.time()) + >>> utc_dt = datetime.fromtimestamp(timestamp, timezone.utc) + >>> timestamp - dt_to_timestamp(utc_dt) + 0.0 + + ``dt_to_timestamp`` supports both timezone-aware and naïve + :class:`~datetime.datetime` objects. Note that it assumes naïve + datetime objects are implied UTC, such as those generated with + :meth:`datetime.datetime.utcnow`. If your datetime objects are + local time, such as those generated with + :meth:`datetime.datetime.now`, first convert it using the + :meth:`datetime.datetime.replace` method with ``tzinfo=`` + :class:`LocalTZ` object in this module, then pass the result of + that to ``dt_to_timestamp``. + """ + if dt.tzinfo: + td = dt - EPOCH_AWARE + else: + td = dt.replace(tzinfo=timezone.utc) - EPOCH_AWARE + return timedelta.total_seconds(td) + + +_NONDIGIT_RE = re.compile(r'\D') + + +def isoparse(iso_str): + """Parses the limited subset of `ISO8601-formatted time`_ strings as + returned by :meth:`datetime.datetime.isoformat`. + + >>> epoch_dt = datetime.fromtimestamp(0, timezone.utc).replace(tzinfo=None) + >>> iso_str = epoch_dt.isoformat() + >>> print(iso_str) + 1970-01-01T00:00:00 + >>> isoparse(iso_str) + datetime.datetime(1970, 1, 1, 0, 0) + + >>> utcnow = datetime.now(timezone.utc).replace(tzinfo=None) + >>> utcnow == isoparse(utcnow.isoformat()) + True + + For further datetime parsing, see the `iso8601`_ package for strict + ISO parsing and `dateutil`_ package for loose parsing and more. + + .. _ISO8601-formatted time: https://en.wikipedia.org/wiki/ISO_8601 + .. _iso8601: https://pypi.python.org/pypi/iso8601 + .. _dateutil: https://pypi.python.org/pypi/python-dateutil + + """ + dt_args = [int(p) for p in _NONDIGIT_RE.split(iso_str)] + return datetime(*dt_args) + + +_BOUNDS = [(0, timedelta(seconds=1), 'second'), + (1, timedelta(seconds=60), 'minute'), + (1, timedelta(seconds=3600), 'hour'), + (1, timedelta(days=1), 'day'), + (1, timedelta(days=7), 'week'), + (2, timedelta(days=30), 'month'), + (1, timedelta(days=365), 'year')] +_BOUNDS = [(b[0] * b[1], b[1], b[2]) for b in _BOUNDS] +_BOUND_DELTAS = [b[0] for b in _BOUNDS] + +_FLOAT_PATTERN = r'[+-]?\ *(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?' +_PARSE_TD_RE = re.compile(r"((?P%s)\s*(?P\w)\w*)" % _FLOAT_PATTERN) +_PARSE_TD_KW_MAP = {unit[0]: unit + 's' + for _, _, unit in reversed(_BOUNDS[:-2])} + + +def parse_timedelta(text): + """Robustly parses a short text description of a time period into a + :class:`datetime.timedelta`. Supports weeks, days, hours, minutes, + and seconds, with or without decimal points: + + Args: + text (str): Text to parse. + Returns: + datetime.timedelta + Raises: + ValueError: on parse failure. + + >>> parse_td('1d 2h 3.5m 0s') == timedelta(days=1, seconds=7410) + True + + Also supports full words and whitespace. + + >>> parse_td('2 weeks 1 day') == timedelta(days=15) + True + + Negative times are supported, too: + + >>> parse_td('-1.5 weeks 3m 20s') == timedelta(days=-11, seconds=43400) + True + """ + td_kwargs = {} + for match in _PARSE_TD_RE.finditer(text): + value, unit = match.group('value'), match.group('unit') + try: + unit_key = _PARSE_TD_KW_MAP[unit] + except KeyError: + raise ValueError('invalid time unit %r, expected one of %r' + % (unit, _PARSE_TD_KW_MAP.keys())) + try: + value = float(value) + except ValueError: + raise ValueError('invalid time value for unit %r: %r' + % (unit, value)) + td_kwargs[unit_key] = value + return timedelta(**td_kwargs) + + +parse_td = parse_timedelta # legacy alias + + +def _cardinalize_time_unit(unit, value): + # removes dependency on strutils; nice and simple because + # all time units cardinalize normally + if value == 1: + return unit + return unit + 's' + + +def decimal_relative_time(d, other=None, ndigits=0, cardinalize=True): + """Get a tuple representing the relative time difference between two + :class:`~datetime.datetime` objects or one + :class:`~datetime.datetime` and now. + + Args: + d (datetime): The first datetime object. + other (datetime): An optional second datetime object. If + unset, defaults to the current time as determined + :meth:`datetime.utcnow`. + ndigits (int): The number of decimal digits to round to, + defaults to ``0``. + cardinalize (bool): Whether to pluralize the time unit if + appropriate, defaults to ``True``. + Returns: + (float, str): A tuple of the :class:`float` difference and + respective unit of time, pluralized if appropriate and + *cardinalize* is set to ``True``. + + Unlike :func:`relative_time`, this method's return is amenable to + localization into other languages and custom phrasing and + formatting. + + >>> now = datetime.now(timezone.utc).replace(tzinfo=None) + >>> decimal_relative_time(now - timedelta(days=1, seconds=3600), now) + (1.0, 'day') + >>> decimal_relative_time(now - timedelta(seconds=0.002), now, ndigits=5) + (0.002, 'seconds') + >>> decimal_relative_time(now, now - timedelta(days=900), ndigits=1) + (-2.5, 'years') + + """ + if other is None: + other = datetime.now(timezone.utc).replace(tzinfo=None) + diff = other - d + diff_seconds = timedelta.total_seconds(diff) + abs_diff = abs(diff) + b_idx = bisect.bisect(_BOUND_DELTAS, abs_diff) - 1 + bbound, bunit, bname = _BOUNDS[b_idx] + f_diff = diff_seconds / timedelta.total_seconds(bunit) + rounded_diff = round(f_diff, ndigits) + if cardinalize: + return rounded_diff, _cardinalize_time_unit(bname, abs(rounded_diff)) + return rounded_diff, bname + + +def relative_time(d, other=None, ndigits=0): + """Get a string representation of the difference between two + :class:`~datetime.datetime` objects or one + :class:`~datetime.datetime` and the current time. Handles past and + future times. + + Args: + d (datetime): The first datetime object. + other (datetime): An optional second datetime object. If + unset, defaults to the current time as determined + :meth:`datetime.utcnow`. + ndigits (int): The number of decimal digits to round to, + defaults to ``0``. + Returns: + A short English-language string. + + >>> now = datetime.now(timezone.utc).replace(tzinfo=None) + >>> relative_time(now, ndigits=1) + '0 seconds ago' + >>> relative_time(now - timedelta(days=1, seconds=36000), ndigits=1) + '1.4 days ago' + >>> relative_time(now + timedelta(days=7), now, ndigits=1) + '1 week from now' + + """ + drt, unit = decimal_relative_time(d, other, ndigits, cardinalize=True) + phrase = 'ago' + if drt < 0: + phrase = 'from now' + return f'{abs(drt):g} {unit} {phrase}' + + +def strpdate(string, format): + """Parse the date string according to the format in `format`. Returns a + :class:`date` object. Internally, :meth:`datetime.strptime` is used to + parse the string and thus conversion specifiers for time fields (e.g. `%H`) + may be provided; these will be parsed but ignored. + + Args: + string (str): The date string to be parsed. + format (str): The `strptime`_-style date format string. + Returns: + datetime.date + + .. _`strptime`: https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior + + >>> strpdate('2016-02-14', '%Y-%m-%d') + datetime.date(2016, 2, 14) + >>> strpdate('26/12 (2015)', '%d/%m (%Y)') + datetime.date(2015, 12, 26) + >>> strpdate('20151231 23:59:59', '%Y%m%d %H:%M:%S') + datetime.date(2015, 12, 31) + >>> strpdate('20160101 00:00:00.001', '%Y%m%d %H:%M:%S.%f') + datetime.date(2016, 1, 1) + """ + whence = datetime.strptime(string, format) + return whence.date() + + +def daterange(start, stop, step=1, inclusive=False): + """In the spirit of :func:`range` and :func:`xrange`, the `daterange` + generator that yields a sequence of :class:`~datetime.date` + objects, starting at *start*, incrementing by *step*, until *stop* + is reached. + + When *inclusive* is True, the final date may be *stop*, **if** + *step* falls evenly on it. By default, *step* is one day. See + details below for many more details. + + Args: + start (datetime.date): The starting date The first value in + the sequence. + stop (datetime.date): The stopping date. By default not + included in return. Can be `None` to yield an infinite + sequence. + step (int): The value to increment *start* by to reach + *stop*. Can be an :class:`int` number of days, a + :class:`datetime.timedelta`, or a :class:`tuple` of integers, + `(year, month, day)`. Positive and negative *step* values + are supported. + inclusive (bool): Whether or not the *stop* date can be + returned. *stop* is only returned when a *step* falls evenly + on it. + + >>> christmas = date(year=2015, month=12, day=25) + >>> boxing_day = date(year=2015, month=12, day=26) + >>> new_year = date(year=2016, month=1, day=1) + >>> for day in daterange(christmas, new_year): + ... print(repr(day)) + datetime.date(2015, 12, 25) + datetime.date(2015, 12, 26) + datetime.date(2015, 12, 27) + datetime.date(2015, 12, 28) + datetime.date(2015, 12, 29) + datetime.date(2015, 12, 30) + datetime.date(2015, 12, 31) + >>> for day in daterange(christmas, boxing_day): + ... print(repr(day)) + datetime.date(2015, 12, 25) + >>> for day in daterange(date(2017, 5, 1), date(2017, 8, 1), + ... step=(0, 1, 0), inclusive=True): + ... print(repr(day)) + datetime.date(2017, 5, 1) + datetime.date(2017, 6, 1) + datetime.date(2017, 7, 1) + datetime.date(2017, 8, 1) + + *Be careful when using stop=None, as this will yield an infinite + sequence of dates.* + """ + if not isinstance(start, date): + raise TypeError("start expected datetime.date instance") + if stop and not isinstance(stop, date): + raise TypeError("stop expected datetime.date instance or None") + try: + y_step, m_step, d_step = step + except TypeError: + y_step, m_step, d_step = 0, 0, step + else: + y_step, m_step = int(y_step), int(m_step) + if isinstance(d_step, int): + d_step = timedelta(days=int(d_step)) + elif isinstance(d_step, timedelta): + pass + else: + raise ValueError('step expected int, timedelta, or tuple' + ' (year, month, day), not: %r' % step) + + m_step += y_step * 12 + + if stop is None: + finished = lambda now, stop: False + elif start <= stop: + finished = operator.gt if inclusive else operator.ge + else: + finished = operator.lt if inclusive else operator.le + now = start + + while not finished(now, stop): + yield now + if m_step: + m_y_step, cur_month = divmod((now.month - 1) + m_step, 12) + now = now.replace(year=now.year + m_y_step, + month=(cur_month + 1)) + now = now + d_step + return + + +# Timezone support (brought in from tzutils) + + +ZERO = timedelta(0) +HOUR = timedelta(hours=1) + + +class ConstantTZInfo(tzinfo): + """ + A :class:`~datetime.tzinfo` subtype whose *offset* remains constant + (no daylight savings). + + Args: + name (str): Name of the timezone. + offset (datetime.timedelta): Offset of the timezone. + """ + def __init__(self, name="ConstantTZ", offset=ZERO): + self.name = name + self.offset = offset + + @property + def utcoffset_hours(self): + return timedelta.total_seconds(self.offset) / (60 * 60) + + def utcoffset(self, dt): + return self.offset + + def tzname(self, dt): + return self.name + + def dst(self, dt): + return ZERO + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}(name={self.name!r}, offset={self.offset!r})' + + +UTC = ConstantTZInfo('UTC') +EPOCH_AWARE = datetime.fromtimestamp(0, UTC) + + +class LocalTZInfo(tzinfo): + """The ``LocalTZInfo`` type takes data available in the time module + about the local timezone and makes a practical + :class:`datetime.tzinfo` to represent the timezone settings of the + operating system. + + For a more in-depth integration with the operating system, check + out `tzlocal`_. It builds on `pytz`_ and implements heuristics for + many versions of major operating systems to provide the official + ``pytz`` tzinfo, instead of the LocalTZ generalization. + + .. _tzlocal: https://pypi.python.org/pypi/tzlocal + .. _pytz: https://pypi.python.org/pypi/pytz + + """ + _std_offset = timedelta(seconds=-time.timezone) + _dst_offset = _std_offset + if time.daylight: + _dst_offset = timedelta(seconds=-time.altzone) + + def is_dst(self, dt): + dt_t = (dt.year, dt.month, dt.day, dt.hour, dt.minute, + dt.second, dt.weekday(), 0, -1) + local_t = time.localtime(time.mktime(dt_t)) + return local_t.tm_isdst > 0 + + def utcoffset(self, dt): + if self.is_dst(dt): + return self._dst_offset + return self._std_offset + + def dst(self, dt): + if self.is_dst(dt): + return self._dst_offset - self._std_offset + return ZERO + + def tzname(self, dt): + return time.tzname[self.is_dst(dt)] + + def __repr__(self): + return '%s()' % self.__class__.__name__ + + +LocalTZ = LocalTZInfo() + + +def _first_sunday_on_or_after(dt): + days_to_go = 6 - dt.weekday() + if days_to_go: + dt += timedelta(days_to_go) + return dt + + +# US DST Rules +# +# This is a simplified (i.e., wrong for a few cases) set of rules for US +# DST start and end times. For a complete and up-to-date set of DST rules +# and timezone definitions, visit the Olson Database (or try pytz): +# http://www.twinsun.com/tz/tz-link.htm +# http://sourceforge.net/projects/pytz/ (might not be up-to-date) +# +# In the US, since 2007, DST starts at 2am (standard time) on the second +# Sunday in March, which is the first Sunday on or after Mar 8. +DSTSTART_2007 = datetime(1, 3, 8, 2) +# and ends at 2am (DST time; 1am standard time) on the first Sunday of Nov. +DSTEND_2007 = datetime(1, 11, 1, 1) +# From 1987 to 2006, DST used to start at 2am (standard time) on the first +# Sunday in April and to end at 2am (DST time; 1am standard time) on the last +# Sunday of October, which is the first Sunday on or after Oct 25. +DSTSTART_1987_2006 = datetime(1, 4, 1, 2) +DSTEND_1987_2006 = datetime(1, 10, 25, 1) +# From 1967 to 1986, DST used to start at 2am (standard time) on the last +# Sunday in April (the one on or after April 24) and to end at 2am (DST time; +# 1am standard time) on the last Sunday of October, which is the first Sunday +# on or after Oct 25. +DSTSTART_1967_1986 = datetime(1, 4, 24, 2) +DSTEND_1967_1986 = DSTEND_1987_2006 + + +class USTimeZone(tzinfo): + """Copied directly from the Python docs, the ``USTimeZone`` is a + :class:`datetime.tzinfo` subtype used to create the + :data:`Eastern`, :data:`Central`, :data:`Mountain`, and + :data:`Pacific` tzinfo types. + """ + def __init__(self, hours, reprname, stdname, dstname): + self.stdoffset = timedelta(hours=hours) + self.reprname = reprname + self.stdname = stdname + self.dstname = dstname + + def __repr__(self): + return self.reprname + + def tzname(self, dt): + if self.dst(dt): + return self.dstname + else: + return self.stdname + + def utcoffset(self, dt): + return self.stdoffset + self.dst(dt) + + def dst(self, dt): + if dt is None or dt.tzinfo is None: + # An exception may be sensible here, in one or both cases. + # It depends on how you want to treat them. The default + # fromutc() implementation (called by the default astimezone() + # implementation) passes a datetime with dt.tzinfo is self. + return ZERO + assert dt.tzinfo is self + + # Find start and end times for US DST. For years before 1967, return + # ZERO for no DST. + if 2006 < dt.year: + dststart, dstend = DSTSTART_2007, DSTEND_2007 + elif 1986 < dt.year < 2007: + dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006 + elif 1966 < dt.year < 1987: + dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986 + else: + return ZERO + + start = _first_sunday_on_or_after(dststart.replace(year=dt.year)) + end = _first_sunday_on_or_after(dstend.replace(year=dt.year)) + + # Can't compare naive to aware objects, so strip the timezone + # from dt first. + if start <= dt.replace(tzinfo=None) < end: + return HOUR + else: + return ZERO + + +Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") +Central = USTimeZone(-6, "Central", "CST", "CDT") +Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") +Pacific = USTimeZone(-8, "Pacific", "PST", "PDT") diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/typeutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/typeutils.py new file mode 100644 index 0000000000000000000000000000000000000000..875e2e2b0412bc7fee0a11726371bac402566ee5 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/typeutils.py @@ -0,0 +1,180 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's built-in :mod:`functools` module builds several useful +utilities on top of Python's first-class function support. +``typeutils`` attempts to do the same for metaprogramming with types +and instances. +""" +import sys +from collections import deque + +_issubclass = issubclass + + +def make_sentinel(name='_MISSING', var_name=None): + """Creates and returns a new **instance** of a new class, suitable for + usage as a "sentinel", a kind of singleton often used to indicate + a value is missing when ``None`` is a valid input. + + Args: + name (str): Name of the Sentinel + var_name (str): Set this name to the name of the variable in + its respective module enable pickleability. Note: + pickleable sentinels should be global constants at the top + level of their module. + + >>> make_sentinel(var_name='_MISSING') + _MISSING + + The most common use cases here in boltons are as default values + for optional function arguments, partly because of its + less-confusing appearance in automatically generated + documentation. Sentinels also function well as placeholders in queues + and linked lists. + + .. note:: + + By design, additional calls to ``make_sentinel`` with the same + values will not produce equivalent objects. + + >>> make_sentinel('TEST') == make_sentinel('TEST') + False + >>> type(make_sentinel('TEST')) == type(make_sentinel('TEST')) + False + + """ + class Sentinel: + def __init__(self): + self.name = name + self.var_name = var_name + + def __repr__(self): + if self.var_name: + return self.var_name + return f'{self.__class__.__name__}({self.name!r})' + + if var_name: + def __reduce__(self): + return self.var_name + + def __bool__(self): + return False + + def __copy__(self): + return self + + def __deepcopy__(self, _memo): + return self + + if var_name: + frame = sys._getframe(1) + module = frame.f_globals.get('__name__') + if not module or module not in sys.modules: + raise ValueError('Pickleable sentinel objects (with var_name) can only' + ' be created from top-level module scopes') + Sentinel.__module__ = module + + return Sentinel() + + +def issubclass(subclass, baseclass): + """Just like the built-in :func:`issubclass`, this function checks + whether *subclass* is inherited from *baseclass*. Unlike the + built-in function, this ``issubclass`` will simply return + ``False`` if either argument is not suitable (e.g., if *subclass* + is not an instance of :class:`type`), instead of raising + :exc:`TypeError`. + + Args: + subclass (type): The target class to check. + baseclass (type): The base class *subclass* will be checked against. + + >>> class MyObject(object): pass + ... + >>> issubclass(MyObject, object) # always a fun fact + True + >>> issubclass('hi', 'friend') + False + """ + try: + return _issubclass(subclass, baseclass) + except TypeError: + return False + + +def get_all_subclasses(cls): + """Recursively finds and returns a :class:`list` of all types + inherited from *cls*. + + >>> class A(object): + ... pass + ... + >>> class B(A): + ... pass + ... + >>> class C(B): + ... pass + ... + >>> class D(A): + ... pass + ... + >>> [t.__name__ for t in get_all_subclasses(A)] + ['B', 'D', 'C'] + >>> [t.__name__ for t in get_all_subclasses(B)] + ['C'] + + """ + try: + to_check = deque(cls.__subclasses__()) + except (AttributeError, TypeError): + raise TypeError('expected type object, not %r' % cls) + seen, ret = set(), [] + while to_check: + cur = to_check.popleft() + if cur in seen: + continue + ret.append(cur) + seen.add(cur) + to_check.extend(cur.__subclasses__()) + return ret + + +class classproperty: + """Much like a :class:`property`, but the wrapped get function is a + class method. For simplicity, only read-only properties are + implemented. + """ + + def __init__(self, fn): + self.fn = fn + + def __get__(self, instance, cls): + return self.fn(cls) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/urlutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/urlutils.py new file mode 100644 index 0000000000000000000000000000000000000000..45d3e73e87820a34a622540cdf1a29cb34b895c3 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/boltons/urlutils.py @@ -0,0 +1,1606 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""":mod:`urlutils` is a module dedicated to one of software's most +versatile, well-aged, and beloved data structures: the URL, also known +as the `Uniform Resource Locator`_. + +Among other things, this module is a full reimplementation of URLs, +without any reliance on the :mod:`urlparse` or :mod:`urllib` standard +library modules. The centerpiece and top-level interface of urlutils +is the :class:`URL` type. Also featured is the :func:`find_all_links` +convenience function. Some low-level functions and constants are also +below. + +The implementations in this module are based heavily on `RFC 3986`_ and +`RFC 3987`_, and incorporates details from several other RFCs and `W3C +documents`_. + +.. _Uniform Resource Locator: https://en.wikipedia.org/wiki/Uniform_Resource_Locator +.. _RFC 3986: https://tools.ietf.org/html/rfc3986 +.. _RFC 3987: https://tools.ietf.org/html/rfc3987 +.. _W3C documents: https://www.w3.org/TR/uri-clarification/ + +""" + +import re +import socket +import string +from unicodedata import normalize + +# The unreserved URI characters (per RFC 3986 Section 2.3) +_UNRESERVED_CHARS = frozenset('~-._0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz') + +# URL parsing regex (based on RFC 3986 Appendix B, with modifications) +_URL_RE = re.compile(r'^((?P[^:/?#]+):)?' + r'((?P<_netloc_sep>//)(?P[^/?#]*))?' + r'(?P[^?#]*)' + r'(\?(?P[^#]*))?' + r'(#(?P.*))?') + + +_HEX_CHAR_MAP = {(a + b).encode('ascii'): + chr(int(a + b, 16)).encode('charmap') + for a in string.hexdigits for b in string.hexdigits} +_ASCII_RE = re.compile('([\x00-\x7f]+)') + + +# This port list painstakingly curated by hand searching through +# https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml +# and +# https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml +SCHEME_PORT_MAP = {'acap': 674, 'afp': 548, 'dict': 2628, 'dns': 53, + 'file': None, 'ftp': 21, 'git': 9418, 'gopher': 70, + 'http': 80, 'https': 443, 'imap': 143, 'ipp': 631, + 'ipps': 631, 'irc': 194, 'ircs': 6697, 'ldap': 389, + 'ldaps': 636, 'mms': 1755, 'msrp': 2855, 'msrps': None, + 'mtqp': 1038, 'nfs': 111, 'nntp': 119, 'nntps': 563, + 'pop': 110, 'prospero': 1525, 'redis': 6379, 'rsync': 873, + 'rtsp': 554, 'rtsps': 322, 'rtspu': 5005, 'sftp': 22, + 'smb': 445, 'snmp': 161, 'ssh': 22, 'steam': None, + 'svn': 3690, 'telnet': 23, 'ventrilo': 3784, 'vnc': 5900, + 'wais': 210, 'ws': 80, 'wss': 443, 'xmpp': None} + +# This list of schemes that don't use authorities is also from the link above. +NO_NETLOC_SCHEMES = {'urn', 'about', 'bitcoin', 'blob', 'data', 'geo', + 'magnet', 'mailto', 'news', 'pkcs11', + 'sip', 'sips', 'tel'} +# As of Mar 11, 2017, there were 44 netloc schemes, and 13 non-netloc + +# RFC 3986 section 2.2, Reserved Characters +_GEN_DELIMS = frozenset(':/?#[]@') +_SUB_DELIMS = frozenset("!$&'()*+,;=") +_ALL_DELIMS = _GEN_DELIMS | _SUB_DELIMS + +_USERINFO_SAFE = _UNRESERVED_CHARS | _SUB_DELIMS +_USERINFO_DELIMS = _ALL_DELIMS - _USERINFO_SAFE +_PATH_SAFE = _UNRESERVED_CHARS | _SUB_DELIMS | set(':@') +_PATH_DELIMS = _ALL_DELIMS - _PATH_SAFE +_FRAGMENT_SAFE = _UNRESERVED_CHARS | _PATH_SAFE | set('/?') +_FRAGMENT_DELIMS = _ALL_DELIMS - _FRAGMENT_SAFE +_QUERY_SAFE = _UNRESERVED_CHARS | _FRAGMENT_SAFE - set('&=+') +_QUERY_DELIMS = _ALL_DELIMS - _QUERY_SAFE + + +class URLParseError(ValueError): + """Exception inheriting from :exc:`ValueError`, raised when failing to + parse a URL. Mostly raised on invalid ports and IPv6 addresses. + """ + pass + + +DEFAULT_ENCODING = 'utf8' + + +def to_unicode(obj): + try: + return str(obj) + except UnicodeDecodeError: + return str(obj, encoding=DEFAULT_ENCODING) + + +# regex from gruber via tornado +# doesn't support ipv6 +# doesn't support mailto (netloc-less schemes) +_FIND_ALL_URL_RE = re.compile(r"""\b((?:([\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\s&()<>]|&|")*(?:[^!"#$%'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&|")*\)))+)""") + + +def find_all_links(text, with_text=False, default_scheme='https', schemes=()): + """This function uses heuristics to searches plain text for strings + that look like URLs, returning a :class:`list` of :class:`URL` + objects. It supports limiting the accepted schemes, and returning + interleaved text as well. + + >>> find_all_links('Visit https://boltons.rtfd.org!') + [URL(u'https://boltons.rtfd.org')] + >>> find_all_links('Visit https://boltons.rtfd.org!', with_text=True) + [u'Visit ', URL(u'https://boltons.rtfd.org'), u'!'] + + Args: + text (str): The text to search. + + with_text (bool): Whether or not to interleave plaintext blocks + with the returned URL objects. Having all tokens can be + useful for transforming the text, e.g., replacing links with + HTML equivalents. Defaults to ``False``. + + default_scheme (str): Many URLs are written without the scheme + component. This function can match a reasonable subset of + those, provided *default_scheme* is set to a string. Set to + ``False`` to disable matching scheme-less URLs. Defaults to + ``'https'``. + + schemes (list): A list of strings that a URL's scheme must + match in order to be included in the results. Defaults to + empty, which matches all schemes. + + .. note:: Currently this function does not support finding IPv6 + addresses or URLs with netloc-less schemes, like mailto. + + """ + text = to_unicode(text) + prev_end, start, end = 0, None, None + ret = [] + _add = ret.append + + def _add_text(t): + if ret and isinstance(ret[-1], str): + ret[-1] += t + else: + _add(t) + + for match in _FIND_ALL_URL_RE.finditer(text): + start, end = match.start(1), match.end(1) + if prev_end < start and with_text: + _add(text[prev_end:start]) + prev_end = end + try: + cur_url_text = match.group(0) + cur_url = URL(cur_url_text) + if not cur_url.scheme: + if default_scheme: + cur_url = URL(default_scheme + '://' + cur_url_text) + else: + _add_text(text[start:end]) + continue + if schemes and cur_url.scheme not in schemes: + _add_text(text[start:end]) + else: + _add(cur_url) + except URLParseError: + # currently this should only be hit with broken port + # strings. the regex above doesn't support ipv6 addresses + if with_text: + _add_text(text[start:end]) + + if with_text: + tail = text[prev_end:] + if tail: + _add_text(tail) + + return ret + + +def _make_quote_map(safe_chars): + ret = {} + # v is included in the dict for py3 mostly, because bytestrings + # are iterables of ints, of course! + for i, v in zip(range(256), range(256)): + c = chr(v) + if c in safe_chars: + ret[c] = ret[v] = c + else: + ret[c] = ret[v] = f'%{i:02X}' + return ret + + +_USERINFO_PART_QUOTE_MAP = _make_quote_map(_USERINFO_SAFE) +_PATH_PART_QUOTE_MAP = _make_quote_map(_PATH_SAFE) +_QUERY_PART_QUOTE_MAP = _make_quote_map(_QUERY_SAFE) +_FRAGMENT_QUOTE_MAP = _make_quote_map(_FRAGMENT_SAFE) + + +def quote_path_part(text, full_quote=True): + """ + Percent-encode a single segment of a URL path. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_PATH_PART_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_PATH_PART_QUOTE_MAP[t] if t in _PATH_DELIMS else t + for t in text]) + + +def quote_query_part(text, full_quote=True): + """ + Percent-encode a single query string key or value. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_QUERY_PART_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_QUERY_PART_QUOTE_MAP[t] if t in _QUERY_DELIMS else t + for t in text]) + + +def quote_fragment_part(text, full_quote=True): + """Quote the fragment part of the URL. Fragments don't have + subdelimiters, so the whole URL fragment can be passed. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_FRAGMENT_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_FRAGMENT_QUOTE_MAP[t] if t in _FRAGMENT_DELIMS else t + for t in text]) + + +def quote_userinfo_part(text, full_quote=True): + """Quote special characters in either the username or password + section of the URL. Note that userinfo in URLs is considered + deprecated in many circles (especially browsers), and support for + percent-encoded userinfo can be spotty. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_USERINFO_PART_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_USERINFO_PART_QUOTE_MAP[t] if t in _USERINFO_DELIMS + else t for t in text]) + + +def unquote(string, encoding='utf-8', errors='replace'): + """Percent-decode a string, by replacing %xx escapes with their + single-character equivalent. The optional *encoding* and *errors* + parameters specify how to decode percent-encoded sequences into + Unicode characters, as accepted by the :meth:`bytes.decode()` method. By + default, percent-encoded sequences are decoded with UTF-8, and + invalid sequences are replaced by a placeholder character. + + >>> unquote(u'abc%20def') + u'abc def' + """ + if '%' not in string: + string.split + return string + if encoding is None: + encoding = 'utf-8' + if errors is None: + errors = 'replace' + bits = _ASCII_RE.split(string) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote_to_bytes(bits[i]).decode(encoding, errors)) + append(bits[i + 1]) + return ''.join(res) + + +def unquote_to_bytes(string): + """unquote_to_bytes('abc%20def') -> b'abc def'.""" + # Note: strings are encoded as UTF-8. This is only an issue if it contains + # unescaped non-ASCII characters, which URIs should not. + if not string: + # Is it a string-like object? + string.split + return b'' + if isinstance(string, str): + string = string.encode('utf-8') + bits = string.split(b'%') + if len(bits) == 1: + return string + # import pdb;pdb.set_trace() + res = [bits[0]] + append = res.append + + for item in bits[1:]: + try: + append(_HEX_CHAR_MAP[item[:2]]) + append(item[2:]) + except KeyError: + append(b'%') + append(item) + return b''.join(res) + + +def register_scheme(text, uses_netloc=None, default_port=None): + """Registers new scheme information, resulting in correct port and + slash behavior from the URL object. There are dozens of standard + schemes preregistered, so this function is mostly meant for + proprietary internal customizations or stopgaps on missing + standards information. If a scheme seems to be missing, please + `file an issue`_! + + Args: + text (str): Text representing the scheme. + (the 'http' in 'http://hatnote.com') + uses_netloc (bool): Does the scheme support specifying a + network host? For instance, "http" does, "mailto" does not. + default_port (int): The default port, if any, for netloc-using + schemes. + + .. _file an issue: https://github.com/mahmoud/boltons/issues + """ + text = text.lower() + if default_port is not None: + try: + default_port = int(default_port) + except ValueError: + raise ValueError('default_port expected integer or None, not %r' + % (default_port,)) + + if uses_netloc is True: + SCHEME_PORT_MAP[text] = default_port + elif uses_netloc is False: + if default_port is not None: + raise ValueError('unexpected default port while specifying' + ' non-netloc scheme: %r' % default_port) + NO_NETLOC_SCHEMES.add(text) + elif uses_netloc is not None: + raise ValueError('uses_netloc expected True, False, or None') + + return + + +def resolve_path_parts(path_parts): + """Normalize the URL path by resolving segments of '.' and '..', + resulting in a dot-free path. See RFC 3986 section 5.2.4, Remove + Dot Segments. + """ + # TODO: what to do with multiple slashes + ret = [] + + for part in path_parts: + if part == '.': + pass + elif part == '..': + if ret and (len(ret) > 1 or ret[0]): # prevent unrooting + ret.pop() + else: + ret.append(part) + + if list(path_parts[-1:]) in (['.'], ['..']): + ret.append('') + + return ret + + +class cachedproperty: + """The ``cachedproperty`` is used similar to :class:`property`, except + that the wrapped method is only called once. This is commonly used + to implement lazy attributes. + + After the property has been accessed, the value is stored on the + instance itself, using the same name as the cachedproperty. This + allows the cache to be cleared with :func:`delattr`, or through + manipulating the object's ``__dict__``. + """ + def __init__(self, func): + self.__doc__ = getattr(func, '__doc__') + self.func = func + + def __get__(self, obj, objtype=None): + if obj is None: + return self + value = obj.__dict__[self.func.__name__] = self.func(obj) + return value + + def __repr__(self): + cn = self.__class__.__name__ + return f'<{cn} func={self.func}>' + + +class URL: + r"""The URL is one of the most ubiquitous data structures in the + virtual and physical landscape. From blogs to billboards, URLs are + so common, that it's easy to overlook their complexity and + power. + + There are 8 parts of a URL, each with its own semantics and + special characters: + + * :attr:`~URL.scheme` + * :attr:`~URL.username` + * :attr:`~URL.password` + * :attr:`~URL.host` + * :attr:`~URL.port` + * :attr:`~URL.path` + * :attr:`~URL.query_params` (query string parameters) + * :attr:`~URL.fragment` + + Each is exposed as an attribute on the URL object. RFC 3986 offers + this brief structural summary of the main URL components:: + + foo://user:pass@example.com:8042/over/there?name=ferret#nose + \_/ \_______/ \_________/ \__/\_________/ \_________/ \__/ + | | | | | | | + scheme userinfo host port path query fragment + + And here's how that example can be manipulated with the URL type: + + >>> url = URL('foo://example.com:8042/over/there?name=ferret#nose') + >>> print(url.host) + example.com + >>> print(url.get_authority()) + example.com:8042 + >>> print(url.qp['name']) # qp is a synonym for query_params + ferret + + URL's approach to encoding is that inputs are decoded as much as + possible, and data remains in this decoded state until re-encoded + using the :meth:`~URL.to_text()` method. In this way, it's similar + to Python's current approach of encouraging immediate decoding of + bytes to text. + + Note that URL instances are mutable objects. If an immutable + representation of the URL is desired, the string from + :meth:`~URL.to_text()` may be used. For an immutable, but + almost-as-featureful, URL object, check out the `hyperlink + package`_. + + .. _hyperlink package: https://github.com/mahmoud/hyperlink + + """ + + # public attributes (for comparison, see __eq__): + _cmp_attrs = ('scheme', 'uses_netloc', 'username', 'password', + 'family', 'host', 'port', 'path', 'query_params', 'fragment') + + def __init__(self, url=''): + # TODO: encoding param. The encoding that underlies the + # percent-encoding is always utf8 for IRIs, but can be Latin-1 + # for other usage schemes. + ud = DEFAULT_PARSED_URL + if url: + if isinstance(url, URL): + url = url.to_text() # better way to copy URLs? + elif isinstance(url, bytes): + try: + url = url.decode(DEFAULT_ENCODING) + except UnicodeDecodeError as ude: + raise URLParseError('expected text or %s-encoded bytes.' + ' try decoding the url bytes and' + ' passing the result. (got: %s)' + % (DEFAULT_ENCODING, ude)) + ud = parse_url(url) + + _e = '' + self.scheme = ud['scheme'] or _e + self._netloc_sep = ud['_netloc_sep'] or _e + self.username = (unquote(ud['username']) + if '%' in (ud['username'] or _e) else ud['username'] or _e) + self.password = (unquote(ud['password']) + if '%' in (ud['password'] or _e) else ud['password'] or _e) + self.family = ud['family'] + + if not ud['host']: + self.host = _e + else: + try: + self.host = ud['host'].encode("ascii") + except UnicodeEncodeError: + self.host = ud['host'] # already non-ascii text + else: + self.host = self.host.decode("idna") + + self.port = ud['port'] + self.path_parts = tuple([unquote(p) if '%' in p else p for p + in (ud['path'] or _e).split('/')]) + self._query = ud['query'] or _e + self.fragment = (unquote(ud['fragment']) + if '%' in (ud['fragment'] or _e) else ud['fragment'] or _e) + # TODO: possibly use None as marker for empty vs missing + return + + @classmethod + def from_parts(cls, scheme=None, host=None, path_parts=(), query_params=(), + fragment='', port=None, username=None, password=None): + """Build a new URL from parts. Note that the respective arguments are + not in the order they would appear in a URL: + + Args: + scheme (str): The scheme of a URL, e.g., 'http' + host (str): The host string, e.g., 'hatnote.com' + path_parts (tuple): The individual text segments of the + path, e.g., ('post', '123') + query_params (dict): An OMD, dict, or list of (key, value) + pairs representing the keys and values of the URL's query + parameters. + fragment (str): The fragment of the URL, e.g., 'anchor1' + port (int): The integer port of URL, automatic defaults are + available for registered schemes. + username (str): The username for the userinfo part of the URL. + password (str): The password for the userinfo part of the URL. + + Note that this method does relatively little + validation. :meth:`URL.to_text()` should be used to check if + any errors are produced while composing the final textual URL. + """ + ret = cls() + + ret.scheme = scheme + ret.host = host + ret.path_parts = tuple(path_parts) or ('',) + ret.query_params.update(query_params) + ret.fragment = fragment + ret.port = port + ret.username = username + ret.password = password + + return ret + + @cachedproperty + def query_params(self): + """The parsed form of the query string of the URL, represented as a + :class:`~dictutils.OrderedMultiDict`. Also available as the + handy alias ``qp``. + + >>> url = URL('http://boltons.readthedocs.io/?utm_source=doctest&python=great') + >>> url.qp.keys() + [u'utm_source', u'python'] + """ + return QueryParamDict.from_text(self._query) + + qp = query_params + + @property + def path(self): + "The URL's path, in text form." + return '/'.join([quote_path_part(p, full_quote=False) + for p in self.path_parts]) + + @path.setter + def path(self, path_text): + self.path_parts = tuple([unquote(p) if '%' in p else p + for p in to_unicode(path_text).split('/')]) + return + + @property + def uses_netloc(self): + """Whether or not a URL uses :code:`:` or :code:`://` to separate the + scheme from the rest of the URL depends on the scheme's own + standard definition. There is no way to infer this behavior + from other parts of the URL. A scheme either supports network + locations or it does not. + + The URL type's approach to this is to check for explicitly + registered schemes, with common schemes like HTTP + preregistered. This is the same approach taken by + :mod:`urlparse`. + + URL adds two additional heuristics if the scheme as a whole is + not registered. First, it attempts to check the subpart of the + scheme after the last ``+`` character. This adds intuitive + behavior for schemes like ``git+ssh``. Second, if a URL with + an unrecognized scheme is loaded, it will maintain the + separator it sees. + + >>> print(URL('fakescheme://test.com').to_text()) + fakescheme://test.com + >>> print(URL('mockscheme:hello:world').to_text()) + mockscheme:hello:world + + """ + default = self._netloc_sep + if self.scheme in SCHEME_PORT_MAP: + return True + if self.scheme in NO_NETLOC_SCHEMES: + return False + if self.scheme.split('+')[-1] in SCHEME_PORT_MAP: + return True + return default + + @property + def default_port(self): + """Return the default port for the currently-set scheme. Returns + ``None`` if the scheme is unrecognized. See + :func:`register_scheme` above. If :attr:`~URL.port` matches + this value, no port is emitted in the output of + :meth:`~URL.to_text()`. + + Applies the same '+' heuristic detailed in :meth:`URL.uses_netloc`. + """ + try: + return SCHEME_PORT_MAP[self.scheme] + except KeyError: + return SCHEME_PORT_MAP.get(self.scheme.split('+')[-1]) + + def normalize(self, with_case=True): + """Resolve any "." and ".." references in the path, as well as + normalize scheme and host casing. To turn off case + normalization, pass ``with_case=False``. + + More information can be found in `Section 6.2.2 of RFC 3986`_. + + .. _Section 6.2.2 of RFC 3986: https://tools.ietf.org/html/rfc3986#section-6.2.2 + """ + self.path_parts = resolve_path_parts(self.path_parts) + + if with_case: + self.scheme = self.scheme.lower() + self.host = self.host.lower() + return + + def navigate(self, dest): + """Factory method that returns a _new_ :class:`URL` based on a given + destination, *dest*. Useful for navigating those relative + links with ease. + + The newly created :class:`URL` is normalized before being returned. + + >>> url = URL('http://boltons.readthedocs.io') + >>> url.navigate('en/latest/') + URL(u'http://boltons.readthedocs.io/en/latest/') + + Args: + dest (str): A string or URL object representing the destination + + More information can be found in `Section 5 of RFC 3986`_. + + .. _Section 5 of RFC 3986: https://tools.ietf.org/html/rfc3986#section-5 + """ + orig_dest = None + if not isinstance(dest, URL): + dest, orig_dest = URL(dest), dest + if dest.scheme and dest.host: + # absolute URLs replace everything, but don't make an + # extra copy if we don't have to + return URL(dest) if orig_dest is None else dest + query_params = dest.query_params + + if dest.path: + if dest.path.startswith('/'): # absolute path + new_path_parts = list(dest.path_parts) + else: # relative path + new_path_parts = list(self.path_parts[:-1]) \ + + list(dest.path_parts) + else: + new_path_parts = list(self.path_parts) + if not query_params: + query_params = self.query_params + + ret = self.from_parts(scheme=dest.scheme or self.scheme, + host=dest.host or self.host, + port=dest.port or self.port, + path_parts=new_path_parts, + query_params=query_params, + fragment=dest.fragment, + username=dest.username or self.username, + password=dest.password or self.password) + ret.normalize() + return ret + + def get_authority(self, full_quote=False, with_userinfo=False): + """Used by URL schemes that have a network location, + :meth:`~URL.get_authority` combines :attr:`username`, + :attr:`password`, :attr:`host`, and :attr:`port` into one + string, the *authority*, that is used for + connecting to a network-accessible resource. + + Used internally by :meth:`~URL.to_text()` and can be useful + for labeling connections. + + >>> url = URL('ftp://user@ftp.debian.org:2121/debian/README') + >>> print(url.get_authority()) + ftp.debian.org:2121 + >>> print(url.get_authority(with_userinfo=True)) + user@ftp.debian.org:2121 + + Args: + full_quote (bool): Whether or not to apply IDNA encoding. + Defaults to ``False``. + with_userinfo (bool): Whether or not to include username + and password, technically part of the + authority. Defaults to ``False``. + + """ + parts = [] + _add = parts.append + if self.username and with_userinfo: + _add(quote_userinfo_part(self.username)) + if self.password: + _add(':') + _add(quote_userinfo_part(self.password)) + _add('@') + if self.host: + if self.family == socket.AF_INET6: + _add('[') + _add(self.host) + _add(']') + elif full_quote: + _add(self.host.encode('idna').decode('ascii')) + else: + _add(self.host) + # TODO: 0 port? + if self.port and self.port != self.default_port: + _add(':') + _add(str(self.port)) + return ''.join(parts) + + def to_text(self, full_quote=False): + """Render a string representing the current state of the URL + object. + + >>> url = URL('http://listen.hatnote.com') + >>> url.fragment = 'en' + >>> print(url.to_text()) + http://listen.hatnote.com#en + + By setting the *full_quote* flag, the URL can either be fully + quoted or minimally quoted. The most common characteristic of + an encoded-URL is the presence of percent-encoded text (e.g., + %60). Unquoted URLs are more readable and suitable + for display, whereas fully-quoted URLs are more conservative + and generally necessary for sending over the network. + """ + scheme = self.scheme + path = '/'.join([quote_path_part(p, full_quote=full_quote) + for p in self.path_parts]) + authority = self.get_authority(full_quote=full_quote, + with_userinfo=True) + query_string = self.query_params.to_text(full_quote=full_quote) + fragment = quote_fragment_part(self.fragment, full_quote=full_quote) + + parts = [] + _add = parts.append + if scheme: + _add(scheme) + _add(':') + if authority: + _add('//') + _add(authority) + elif (scheme and path[:2] != '//' and self.uses_netloc): + _add('//') + if path: + if scheme and authority and path[:1] != '/': + _add('/') + # TODO: i think this is here because relative paths + # with absolute authorities = undefined + _add(path) + if query_string: + _add('?') + _add(query_string) + if fragment: + _add('#') + _add(fragment) + return ''.join(parts) + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({self.to_text()!r})' + + def __str__(self): + return self.to_text() + + def __unicode__(self): + return self.to_text() + + def __eq__(self, other): + for attr in self._cmp_attrs: + if not getattr(self, attr) == getattr(other, attr, None): + return False + return True + + def __ne__(self, other): + return not self == other + + +try: + from socket import inet_pton +except ImportError: + # from https://gist.github.com/nnemkin/4966028 + import ctypes + + class _sockaddr(ctypes.Structure): + _fields_ = [("sa_family", ctypes.c_short), + ("__pad1", ctypes.c_ushort), + ("ipv4_addr", ctypes.c_byte * 4), + ("ipv6_addr", ctypes.c_byte * 16), + ("__pad2", ctypes.c_ulong)] + + WSAStringToAddressA = ctypes.windll.ws2_32.WSAStringToAddressA + WSAAddressToStringA = ctypes.windll.ws2_32.WSAAddressToStringA + + def inet_pton(address_family, ip_string): + addr = _sockaddr() + ip_string = ip_string.encode('ascii') + addr.sa_family = address_family + addr_size = ctypes.c_int(ctypes.sizeof(addr)) + + if WSAStringToAddressA(ip_string, address_family, None, ctypes.byref(addr), ctypes.byref(addr_size)) != 0: + raise OSError(ctypes.FormatError()) + + if address_family == socket.AF_INET: + return ctypes.string_at(addr.ipv4_addr, 4) + if address_family == socket.AF_INET6: + return ctypes.string_at(addr.ipv6_addr, 16) + raise OSError('unknown address family') + + +def parse_host(host): + """\ + Low-level function used to parse the host portion of a URL. + + Returns a tuple of (family, host) where *family* is a + :mod:`socket` module constant or ``None``, and host is a string. + + >>> parse_host('googlewebsite.com') == (None, 'googlewebsite.com') + True + >>> parse_host('[::1]') == (socket.AF_INET6, '::1') + True + >>> parse_host('192.168.1.1') == (socket.AF_INET, '192.168.1.1') + True + + Odd doctest formatting above due to py3's switch from int to enums + for :mod:`socket` constants. + + """ + if not host: + return None, '' + if ':' in host and '[' == host[0] and ']' == host[-1]: + host = host[1:-1] + try: + inet_pton(socket.AF_INET6, host) + except OSError as se: + raise URLParseError(f'invalid IPv6 host: {host!r} ({se!r})') + except UnicodeEncodeError: + pass # TODO: this can't be a real host right? + else: + family = socket.AF_INET6 + return family, host + try: + inet_pton(socket.AF_INET, host) + except (OSError, UnicodeEncodeError): + family = None # not an IP + else: + family = socket.AF_INET + return family, host + + +def parse_url(url_text): + """\ + Used to parse the text for a single URL into a dictionary, used + internally by the :class:`URL` type. + + Note that "URL" has a very narrow, standards-based + definition. While :func:`parse_url` may raise + :class:`URLParseError` under a very limited number of conditions, + such as non-integer port, a surprising number of strings are + technically valid URLs. For instance, the text ``"url"`` is a + valid URL, because it is a relative path. + + In short, do not expect this function to validate form inputs or + other more colloquial usages of URLs. + + >>> res = parse_url('http://127.0.0.1:3000/?a=1') + >>> sorted(res.keys()) # res is a basic dictionary + ['_netloc_sep', 'authority', 'family', 'fragment', 'host', 'password', 'path', 'port', 'query', 'scheme', 'username'] + """ + url_text = str(url_text) + # raise TypeError('parse_url expected text, not %r' % url_str) + um = _URL_RE.match(url_text) + try: + gs = um.groupdict() + except AttributeError: + raise URLParseError('could not parse url: %r' % url_text) + + au_text = gs['authority'] + user, pw, hostinfo = None, None, au_text + + if au_text: + userinfo, sep, hostinfo = au_text.rpartition('@') + if sep: + # TODO: empty userinfo error? + user, _, pw = userinfo.partition(':') + + host, port = None, None + if hostinfo: + host, sep, port_str = hostinfo.partition(':') + if sep: + if host and host[0] == '[' and ']' in port_str: + host_right, _, port_str = port_str.partition(']') + host = host + ':' + host_right + ']' + if port_str and port_str[0] == ':': + port_str = port_str[1:] + + try: + port = int(port_str) + except ValueError: + if port_str: # empty ports ok according to RFC 3986 6.2.3 + raise URLParseError('expected integer for port, not %r' + % port_str) + port = None + + family, host = parse_host(host) + + gs['username'] = user + gs['password'] = pw + gs['family'] = family + gs['host'] = host + gs['port'] = port + return gs + + +DEFAULT_PARSED_URL = parse_url('') + + +def parse_qsl(qs, keep_blank_values=True, encoding=DEFAULT_ENCODING): + """ + Converts a query string into a list of (key, value) pairs. + """ + pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')] + ret = [] + for pair in pairs: + if not pair: + continue + key, _, value = pair.partition('=') + if not value: + if keep_blank_values: + value = None + else: + continue + key = unquote(key.replace('+', ' ')) + if value: + value = unquote(value.replace('+', ' ')) + ret.append((key, value)) + return ret + + +""" +# What follows is the OrderedMultiDict from dictutils.py, circa +# 20161021, used for the QueryParamDict, toward the bottom. +""" + +from collections.abc import KeysView, ValuesView, ItemsView +from itertools import zip_longest + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + + +PREV, NEXT, KEY, VALUE, SPREV, SNEXT = range(6) + + +class OrderedMultiDict(dict): + """A MultiDict is a dictionary that can have multiple values per key + and the OrderedMultiDict (OMD) is a MultiDict that retains + original insertion order. Common use cases include: + + * handling query strings parsed from URLs + * inverting a dictionary to create a reverse index (values to keys) + * stacking data from multiple dictionaries in a non-destructive way + + The OrderedMultiDict constructor is identical to the built-in + :class:`dict`, and overall the API constitutes an intuitive + superset of the built-in type: + + >>> omd = OrderedMultiDict() + >>> omd['a'] = 1 + >>> omd['b'] = 2 + >>> omd.add('a', 3) + >>> omd.get('a') + 3 + >>> omd.getlist('a') + [1, 3] + + Some non-:class:`dict`-like behaviors also make an appearance, + such as support for :func:`reversed`: + + >>> list(reversed(omd)) + ['b', 'a'] + + Note that unlike some other MultiDicts, this OMD gives precedence + to the most recent value added. ``omd['a']`` refers to ``3``, not + ``1``. + + >>> omd + OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> omd.poplast('a') + 3 + >>> omd + OrderedMultiDict([('a', 1), ('b', 2)]) + >>> omd.pop('a') + 1 + >>> omd + OrderedMultiDict([('b', 2)]) + + If you want a safe-to-modify or flat dictionary, use + :meth:`OrderedMultiDict.todict()`. + + >>> from pprint import pprint as pp # preserve printed ordering + >>> omd = OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> pp(omd.todict()) + {'a': 3, 'b': 2} + >>> pp(omd.todict(multi=True)) + {'a': [1, 3], 'b': [2]} + + With ``multi=False``, items appear with the keys in to original + insertion order, alongside the most-recently inserted value for + that key. + + >>> OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]).items(multi=False) + [('a', 3), ('b', 2)] + + .. warning:: + + ``dict(omd)`` changed behavior `in Python 3.7 + `_ due to changes made to + support the transition from :class:`collections.OrderedDict` to + the built-in dictionary being ordered. Before 3.7, the result + would be a new dictionary, with values that were lists, similar + to ``omd.todict(multi=True)`` (but only shallow-copy; the lists + were direct references to OMD internal structures). From 3.7 + onward, the values became singular, like + ``omd.todict(multi=False)``. For reliable cross-version + behavior, just use :meth:`~OrderedMultiDict.todict()`. + + """ + def __new__(cls, *a, **kw): + ret = super().__new__(cls) + ret._clear_ll() + return ret + + def __init__(self, *args, **kwargs): + if len(args) > 1: + raise TypeError('%s expected at most 1 argument, got %s' + % (self.__class__.__name__, len(args))) + super().__init__() + + if args: + self.update_extend(args[0]) + if kwargs: + self.update(kwargs) + + def __getstate__(self): + return list(self.iteritems(multi=True)) + + def __setstate__(self, state): + self.clear() + self.update_extend(state) + + def _clear_ll(self): + try: + _map = self._map + except AttributeError: + _map = self._map = {} + self.root = [] + _map.clear() + self.root[:] = [self.root, self.root, None] + + def _insert(self, k, v): + root = self.root + cells = self._map.setdefault(k, []) + last = root[PREV] + cell = [last, root, k, v] + last[NEXT] = root[PREV] = cell + cells.append(cell) + + def add(self, k, v): + """Add a single value *v* under a key *k*. Existing values under *k* + are preserved. + """ + values = super().setdefault(k, []) + self._insert(k, v) + values.append(v) + + def addlist(self, k, v): + """Add an iterable of values underneath a specific key, preserving + any values already under that key. + + >>> omd = OrderedMultiDict([('a', -1)]) + >>> omd.addlist('a', range(3)) + >>> omd + OrderedMultiDict([('a', -1), ('a', 0), ('a', 1), ('a', 2)]) + + Called ``addlist`` for consistency with :meth:`getlist`, but + tuples and other sequences and iterables work. + """ + if not v: + return + self_insert = self._insert + values = super().setdefault(k, []) + for subv in v: + self_insert(k, subv) + values.extend(v) + + def get(self, k, default=None): + """Return the value for key *k* if present in the dictionary, else + *default*. If *default* is not given, ``None`` is returned. + This method never raises a :exc:`KeyError`. + + To get all values under a key, use :meth:`OrderedMultiDict.getlist`. + """ + return super().get(k, [default])[-1] + + def getlist(self, k, default=_MISSING): + """Get all values for key *k* as a list, if *k* is in the + dictionary, else *default*. The list returned is a copy and + can be safely mutated. If *default* is not given, an empty + :class:`list` is returned. + """ + try: + return super().__getitem__(k)[:] + except KeyError: + if default is _MISSING: + return [] + return default + + def clear(self): + "Empty the dictionary." + super().clear() + self._clear_ll() + + def setdefault(self, k, default=_MISSING): + """If key *k* is in the dictionary, return its value. If not, insert + *k* with a value of *default* and return *default*. *default* + defaults to ``None``. See :meth:`dict.setdefault` for more + information. + """ + if not super().__contains__(k): + self[k] = None if default is _MISSING else default + return self[k] + + def copy(self): + "Return a shallow copy of the dictionary." + return self.__class__(self.iteritems(multi=True)) + + @classmethod + def fromkeys(cls, keys, default=None): + """Create a dictionary from a list of keys, with all the values + set to *default*, or ``None`` if *default* is not set. + """ + return cls([(k, default) for k in keys]) + + def update(self, E, **F): + """Add items from a dictionary or iterable (and/or keyword arguments), + overwriting values under an existing key. See + :meth:`dict.update` for more details. + """ + # E and F are throwback names to the dict() __doc__ + if E is self: + return + self_add = self.add + if isinstance(E, OrderedMultiDict): + for k in E: + if k in self: + del self[k] + for k, v in E.iteritems(multi=True): + self_add(k, v) + elif callable(getattr(E, 'keys', None)): + for k in E.keys(): + self[k] = E[k] + else: + seen = set() + seen_add = seen.add + for k, v in E: + if k not in seen and k in self: + del self[k] + seen_add(k) + self_add(k, v) + for k in F: + self[k] = F[k] + return + + def update_extend(self, E, **F): + """Add items from a dictionary, iterable, and/or keyword + arguments without overwriting existing items present in the + dictionary. Like :meth:`update`, but adds to existing keys + instead of overwriting them. + """ + if E is self: + iterator = iter(E.items()) + elif isinstance(E, OrderedMultiDict): + iterator = E.iteritems(multi=True) + elif hasattr(E, 'keys'): + iterator = ((k, E[k]) for k in E.keys()) + else: + iterator = E + + self_add = self.add + for k, v in iterator: + self_add(k, v) + + def __setitem__(self, k, v): + if super().__contains__(k): + self._remove_all(k) + self._insert(k, v) + super().__setitem__(k, [v]) + + def __getitem__(self, k): + return super().__getitem__(k)[-1] + + def __delitem__(self, k): + super().__delitem__(k) + self._remove_all(k) + + def __eq__(self, other): + if self is other: + return True + try: + if len(other) != len(self): + return False + except TypeError: + return False + if isinstance(other, OrderedMultiDict): + selfi = self.iteritems(multi=True) + otheri = other.iteritems(multi=True) + zipped_items = zip_longest(selfi, otheri, fillvalue=(None, None)) + for (selfk, selfv), (otherk, otherv) in zipped_items: + if selfk != otherk or selfv != otherv: + return False + if not(next(selfi, _MISSING) is _MISSING + and next(otheri, _MISSING) is _MISSING): + # leftovers (TODO: watch for StopIteration?) + return False + return True + elif hasattr(other, 'keys'): + for selfk in self: + try: + other[selfk] == self[selfk] + except KeyError: + return False + return True + return False + + def __ne__(self, other): + return not (self == other) + + def __ior__(self, other): + self.update(other) + return self + + def pop(self, k, default=_MISSING): + """Remove all values under key *k*, returning the most-recently + inserted value. Raises :exc:`KeyError` if the key is not + present and no *default* is provided. + """ + try: + return self.popall(k)[-1] + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + + def popall(self, k, default=_MISSING): + """Remove all values under key *k*, returning them in the form of + a list. Raises :exc:`KeyError` if the key is not present and no + *default* is provided. + """ + super_self = super() + if super_self.__contains__(k): + self._remove_all(k) + if default is _MISSING: + return super_self.pop(k) + return super_self.pop(k, default) + + def poplast(self, k=_MISSING, default=_MISSING): + """Remove and return the most-recently inserted value under the key + *k*, or the most-recently inserted key if *k* is not + provided. If no values remain under *k*, it will be removed + from the OMD. Raises :exc:`KeyError` if *k* is not present in + the dictionary, or the dictionary is empty. + """ + if k is _MISSING: + if self: + k = self.root[PREV][KEY] + else: + if default is _MISSING: + raise KeyError('empty %r' % type(self)) + return default + try: + self._remove(k) + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + values = super().__getitem__(k) + v = values.pop() + if not values: + super().__delitem__(k) + return v + + def _remove(self, k): + values = self._map[k] + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + if not values: + del self._map[k] + + def _remove_all(self, k): + values = self._map[k] + while values: + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + del self._map[k] + + def iteritems(self, multi=False): + """Iterate over the OMD's items in insertion order. By default, + yields only the most-recently inserted value for each key. Set + *multi* to ``True`` to get all inserted items. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY], curr[VALUE] + curr = curr[NEXT] + else: + for key in self.iterkeys(): + yield key, self[key] + + def iterkeys(self, multi=False): + """Iterate over the OMD's keys in insertion order. By default, yields + each key once, according to the most recent insertion. Set + *multi* to ``True`` to get all keys, including duplicates, in + insertion order. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY] + curr = curr[NEXT] + else: + yielded = set() + yielded_add = yielded.add + while curr is not root: + k = curr[KEY] + if k not in yielded: + yielded_add(k) + yield k + curr = curr[NEXT] + + def itervalues(self, multi=False): + """Iterate over the OMD's values in insertion order. By default, + yields the most-recently inserted value per unique key. Set + *multi* to ``True`` to get all values according to insertion + order. + """ + for k, v in self.iteritems(multi=multi): + yield v + + def todict(self, multi=False): + """Gets a basic :class:`dict` of the items in this dictionary. Keys + are the same as the OMD, values are the most recently inserted + values for each key. + + Setting the *multi* arg to ``True`` is yields the same + result as calling :class:`dict` on the OMD, except that all the + value lists are copies that can be safely mutated. + """ + if multi: + return {k: self.getlist(k) for k in self} + return {k: self[k] for k in self} + + def sorted(self, key=None, reverse=False): + """Similar to the built-in :func:`sorted`, except this method returns + a new :class:`OrderedMultiDict` sorted by the provided key + function, optionally reversed. + + Args: + key (callable): A callable to determine the sort key of + each element. The callable should expect an **item** + (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict(zip(range(3), range(3))) + >>> omd.sorted(reverse=True) + OrderedMultiDict([(2, 2), (1, 1), (0, 0)]) + + Note that the key function receives an **item** (key-value + tuple), so the recommended signature looks like: + + >>> omd = OrderedMultiDict(zip('hello', 'world')) + >>> omd.sorted(key=lambda i: i[1]) # i[0] is the key, i[1] is the val + OrderedMultiDict([('o', 'd'), ('l', 'l'), ('e', 'o'), ('l', 'r'), ('h', 'w')]) + """ + cls = self.__class__ + return cls(sorted(self.iteritems(multi=True), key=key, reverse=reverse)) + + def sortedvalues(self, key=None, reverse=False): + """Returns a copy of the :class:`OrderedMultiDict` with the same keys + in the same order as the original OMD, but the values within + each keyspace have been sorted according to *key* and + *reverse*. + + Args: + key (callable): A single-argument callable to determine + the sort key of each element. The callable should expect + an **item** (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict() + >>> omd.addlist('even', [6, 2]) + >>> omd.addlist('odd', [1, 5]) + >>> omd.add('even', 4) + >>> omd.add('odd', 3) + >>> somd = omd.sortedvalues() + >>> somd.getlist('even') + [2, 4, 6] + >>> somd.keys(multi=True) == omd.keys(multi=True) + True + >>> omd == somd + False + >>> somd + OrderedMultiDict([('even', 2), ('even', 4), ('odd', 1), ('odd', 3), ('even', 6), ('odd', 5)]) + + As demonstrated above, contents and key order are + retained. Only value order changes. + """ + try: + superself_iteritems = super().iteritems() + except AttributeError: + superself_iteritems = super().items() + # (not reverse) because they pop off in reverse order for reinsertion + sorted_val_map = {k: sorted(v, key=key, reverse=(not reverse)) + for k, v in superself_iteritems} + ret = self.__class__() + for k in self.iterkeys(multi=True): + ret.add(k, sorted_val_map[k].pop()) + return ret + + def inverted(self): + """Returns a new :class:`OrderedMultiDict` with values and keys + swapped, like creating dictionary transposition or reverse + index. Insertion order is retained and all keys and values + are represented in the output. + + >>> omd = OMD([(0, 2), (1, 2)]) + >>> omd.inverted().getlist(2) + [0, 1] + + Inverting twice yields a copy of the original: + + >>> omd.inverted().inverted() + OrderedMultiDict([(0, 2), (1, 2)]) + """ + return self.__class__((v, k) for k, v in self.iteritems(multi=True)) + + def counts(self): + """Returns a mapping from key to number of values inserted under that + key. Like :py:class:`collections.Counter`, but returns a new + :class:`OrderedMultiDict`. + """ + # Returns an OMD because Counter/OrderedDict may not be + # available, and neither Counter nor dict maintain order. + super_getitem = super().__getitem__ + return self.__class__((k, len(super_getitem(k))) for k in self) + + def keys(self, multi=False): + """Returns a list containing the output of :meth:`iterkeys`. See + that method's docs for more details. + """ + return list(self.iterkeys(multi=multi)) + + def values(self, multi=False): + """Returns a list containing the output of :meth:`itervalues`. See + that method's docs for more details. + """ + return list(self.itervalues(multi=multi)) + + def items(self, multi=False): + """Returns a list containing the output of :meth:`iteritems`. See + that method's docs for more details. + """ + return list(self.iteritems(multi=multi)) + + def __iter__(self): + return self.iterkeys() + + def __reversed__(self): + root = self.root + curr = root[PREV] + lengths = {} + lengths_sd = lengths.setdefault + get_values = super().__getitem__ + while curr is not root: + k = curr[KEY] + vals = get_values(k) + if lengths_sd(k, 1) == len(vals): + yield k + lengths[k] += 1 + curr = curr[PREV] + + def __repr__(self): + cn = self.__class__.__name__ + kvs = ', '.join([repr((k, v)) for k, v in self.iteritems(multi=True)]) + return f'{cn}([{kvs}])' + + def viewkeys(self): + "OMD.viewkeys() -> a set-like object providing a view on OMD's keys" + return KeysView(self) + + def viewvalues(self): + "OMD.viewvalues() -> an object providing a view on OMD's values" + return ValuesView(self) + + def viewitems(self): + "OMD.viewitems() -> a set-like object providing a view on OMD's items" + return ItemsView(self) + + + +try: + # try to import the built-in one anyways + from .dictutils import OrderedMultiDict +except ImportError: + pass + +OMD = OrderedMultiDict + + +class QueryParamDict(OrderedMultiDict): + """A subclass of :class:`~dictutils.OrderedMultiDict` specialized for + representing query string values. Everything is fully unquoted on + load and all parsed keys and values are strings by default. + + As the name suggests, multiple values are supported and insertion + order is preserved. + + >>> qp = QueryParamDict.from_text(u'key=val1&key=val2&utm_source=rtd') + >>> qp.getlist('key') + [u'val1', u'val2'] + >>> qp['key'] + u'val2' + >>> qp.add('key', 'val3') + >>> qp.to_text() + 'key=val1&key=val2&utm_source=rtd&key=val3' + + See :class:`~dictutils.OrderedMultiDict` for more API features. + """ + + @classmethod + def from_text(cls, query_string): + """ + Parse *query_string* and return a new :class:`QueryParamDict`. + """ + pairs = parse_qsl(query_string, keep_blank_values=True) + return cls(pairs) + + def to_text(self, full_quote=False): + """ + Render and return a query string. + + Args: + full_quote (bool): Whether or not to percent-quote special + characters or leave them decoded for readability. + """ + ret_list = [] + for k, v in self.iteritems(multi=True): + key = quote_query_part(to_unicode(k), full_quote=full_quote) + if v is None: + ret_list.append(key) + else: + val = quote_query_part(to_unicode(v), full_quote=full_quote) + ret_list.append('='.join((key, val))) + return '&'.join(ret_list) + +# end urlutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/run_test.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/run_test.py new file mode 100644 index 0000000000000000000000000000000000000000..fd5288c021d9a39248ac2fa93ef70bf1b7a73f94 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/run_test.py @@ -0,0 +1,81 @@ +print("import: 'boltons'") +import boltons + +print("import: 'boltons.cacheutils'") +import boltons.cacheutils + +print("import: 'boltons.debugutils'") +import boltons.debugutils + +print("import: 'boltons.dictutils'") +import boltons.dictutils + +print("import: 'boltons.ecoutils'") +import boltons.ecoutils + +print("import: 'boltons.fileutils'") +import boltons.fileutils + +print("import: 'boltons.formatutils'") +import boltons.formatutils + +print("import: 'boltons.funcutils'") +import boltons.funcutils + +print("import: 'boltons.gcutils'") +import boltons.gcutils + +print("import: 'boltons.ioutils'") +import boltons.ioutils + +print("import: 'boltons.iterutils'") +import boltons.iterutils + +print("import: 'boltons.jsonutils'") +import boltons.jsonutils + +print("import: 'boltons.listutils'") +import boltons.listutils + +print("import: 'boltons.mathutils'") +import boltons.mathutils + +print("import: 'boltons.mboxutils'") +import boltons.mboxutils + +print("import: 'boltons.namedutils'") +import boltons.namedutils + +print("import: 'boltons.pathutils'") +import boltons.pathutils + +print("import: 'boltons.queueutils'") +import boltons.queueutils + +print("import: 'boltons.setutils'") +import boltons.setutils + +print("import: 'boltons.socketutils'") +import boltons.socketutils + +print("import: 'boltons.statsutils'") +import boltons.statsutils + +print("import: 'boltons.strutils'") +import boltons.strutils + +print("import: 'boltons.tableutils'") +import boltons.tableutils + +print("import: 'boltons.tbutils'") +import boltons.tbutils + +print("import: 'boltons.timeutils'") +import boltons.timeutils + +print("import: 'boltons.typeutils'") +import boltons.typeutils + +print("import: 'boltons.urlutils'") +import boltons.urlutils + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/run_test.sh b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/run_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..de025fbd3eb63904bb88ad16aba0251bdbfc7ce8 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/run_test.sh @@ -0,0 +1,11 @@ + + +set -ex + + + +echo [pytest] > pytest.ini +echo doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS ALLOW_UNICODE >> pytest.ini +pytest -vv --doctest-modules boltons tests +pip check +exit 0 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/test_time_dependencies.json b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/test_time_dependencies.json new file mode 100644 index 0000000000000000000000000000000000000000..d148ef6e9c8542d5f2035b58b19f01b91b024856 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/test_time_dependencies.json @@ -0,0 +1 @@ +["pip", "pytest"] \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/.coveragerc b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/.coveragerc new file mode 100644 index 0000000000000000000000000000000000000000..4c81fb975063160dba6a16fc2021b903976789ad --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/.coveragerc @@ -0,0 +1,9 @@ +; command for getting a coverage report: +; pytest --doctest-modules --cov=boltons --cov-report html --cov-config tests/.coveragerc tests/ boltons/ +; (run from project directory) + +[run] +branch = True + +[html] +directory = htmlcov diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/__init__.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/conftest.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..d4d2192c5cd619439ab05e6417ef778951d8be02 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/conftest.py @@ -0,0 +1,26 @@ +import sys +import re + + +_VERSION_MARKER = re.compile(r'_py(?P\d)(?P\d)?') + + +def pytest_ignore_collect(path, config): + """ + Ignore tests that end with _pyX, where X does not equal this + interpreter's major version. + """ + filename = path.basename + modulename = filename.split('.', 1)[0] + match = _VERSION_MARKER.search(modulename) + if not match: + return False + major_version = match.group('major_version') + minor_version = match.group('minor_version') + + if minor_version: + version_match = (int(major_version), int(minor_version)) == sys.version_info[:2] + else: + version_match = int(major_version) == sys.version_info[0] + + return not version_match # because this is an _ignore_ (not an include) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/jsonl_test_data.txt b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/jsonl_test_data.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b8fd12a37ab7f0f13db6fd53a68d4a5cd68ef16 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/jsonl_test_data.txt @@ -0,0 +1,5 @@ +{} +{"1": 1} +{"2": 2} +{"3": 3} +{"4": 4} diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/newlines_test_data.txt b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/newlines_test_data.txt new file mode 100644 index 0000000000000000000000000000000000000000..0310f86855d10320903cc4a14b1049e55ce3c635 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/newlines_test_data.txt @@ -0,0 +1,12 @@ +a +b +c +d +e + + +f +g +hijklmnop +qrstuv +wxyz diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_cacheutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_cacheutils.py new file mode 100644 index 0000000000000000000000000000000000000000..18d82a7f102d1713deb2fabab96549b1417625c8 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_cacheutils.py @@ -0,0 +1,480 @@ +import string +import sys +from abc import abstractmethod, ABCMeta + +import pytest + +from boltons.cacheutils import LRU, LRI, cached, cachedmethod, cachedproperty, MinIDMap, ThresholdCounter + + +class CountingCallable: + def __init__(self): + self.call_count = 0 + + def __call__(self, *a, **kw): + self.call_count += 1 + return self.call_count + + +def test_lru_add(): + cache = LRU(max_size=3) + for i in range(4): + cache[i] = i + assert len(cache) == 3 + assert 0 not in cache + + +def test_lri(): + cache_size = 10 + bc = LRI(cache_size, on_miss=lambda k: k.upper()) + for idx, char in enumerate(string.ascii_letters): + x = bc[char] + assert x == char.upper() + least_recent_insert_index = idx - cache_size + if least_recent_insert_index >= 0: + # least recently inserted object evicted + assert len(bc) == cache_size + for char in string.ascii_letters[least_recent_insert_index+1:idx]: + assert char in bc + + # test that reinserting an existing key changes eviction behavior + bc[string.ascii_letters[-cache_size+1]] = "new value" + least_recently_inserted_key = string.ascii_letters[-cache_size+2] + bc["unreferenced_key"] = "value" + keys_in_cache = [ + string.ascii_letters[i] + for i in range(-cache_size + 1, 0) + if string.ascii_letters[i] != least_recently_inserted_key + ] + keys_in_cache.append("unreferenced_key") + assert len(bc) == cache_size + for k in keys_in_cache: + assert k in bc + + +def test_lri_cache_eviction(): + """ + Regression test + Original LRI implementation had a bug where the specified cache + size only supported `max_size` number of inserts to the cache, + rather than support `max_size` number of keys in the cache. This + would result in some unintuitive behavior, where a key is evicted + recently inserted value would be evicted from the cache if the key + inserted was inserted `max_size` keys earlier. + """ + test_cache = LRI(2) + # dequeue: (key1); dict keys: (key1) + test_cache["key1"] = "value1" + # dequeue: (key1, key1); dict keys: (key1) + test_cache["key1"] = "value1" + # dequeue: (key1, key1, key2); dict keys: (key1, key2) + test_cache["key2"] = "value2" + # dequeue: (key1, key2, key3); dict keys: (key2, key3) + test_cache["key3"] = "value3" + # will error here since we evict key1 from the cache and it doesn't + # exist in the dict anymore + test_cache["key3"] = "value3" + + +def test_cache_sizes_on_repeat_insertions(): + """ + Regression test + Original LRI implementation had an unbounded size of memory + regardless of the value for its `max_size` parameter due to a naive + insertion algorithm onto an underlying deque data structure. To + prevent memory leaks, this test will assert that a cache does not + grow past its max size given values of a uniform memory footprint + """ + caches_to_test = (LRU, LRI) + for cache_type in caches_to_test: + test_cache = cache_type(2) + # note strings are used to force allocation of memory + test_cache["key1"] = "1" + test_cache["key2"] = "1" + initial_list_size = len(test_cache._get_flattened_ll()) + for k in test_cache: + for __ in range(100): + test_cache[k] = "1" + list_size_after_inserts = len(test_cache._get_flattened_ll()) + assert initial_list_size == list_size_after_inserts + + +def test_lru_basic(): + lru = LRU(max_size=1) + repr(lru) # sanity + + lru['hi'] = 0 + lru['bye'] = 1 + assert len(lru) == 1 + lru['bye'] + assert lru.get('hi') is None + + del lru['bye'] + assert 'bye' not in lru + assert len(lru) == 0 + assert not lru + + try: + lru.pop('bye') + except KeyError: + pass + else: + assert False + + default = object() + assert lru.pop('bye', default) is default + + try: + lru.popitem() + except KeyError: + pass + else: + assert False + + lru['another'] = 1 + assert lru.popitem() == ('another', 1) + + lru['yet_another'] = 2 + assert lru.pop('yet_another') == 2 + + lru['yet_another'] = 3 + assert lru.pop('yet_another', default) == 3 + + lru['yet_another'] = 4 + lru.clear() + assert not lru + + lru['yet_another'] = 5 + second_lru = LRU(max_size=1) + assert lru.copy() == lru + + second_lru['yet_another'] = 5 + assert second_lru == lru + assert lru == second_lru + + lru.update(LRU(max_size=2, values=[('a', 1), + ('b', 2)])) + assert len(lru) == 1 + assert 'yet_another' not in lru + + lru.setdefault('x', 2) + assert dict(lru) == {'x': 2} + lru.setdefault('x', 3) + assert dict(lru) == {'x': 2} + + assert lru != second_lru + assert second_lru != lru + + +@pytest.mark.parametrize("lru_class", [LRU, LRI]) +def test_lru_dict_replacement(lru_class): + # see issue #348 + cache = lru_class() + + # Add an entry. + cache['a'] = 1 + + # Normal __getitem__ access. + assert cache['a'] == 1 # passes. + # Convert to dict. + assert dict(cache) == {'a': 1} # passes. + # Another way to access the only value. + assert list(cache.values())[0] == 1 # passes. + + # Replace the existing 'a' entry with a new value. + cache['a'] = 200 + + # __getitem__ works as expected. + assert cache['a'] == 200 # passes. + + # Both dict and accessing via values() return the old entry: 1. + assert dict(cache) == {'a': 200} # fails. + assert list(cache.values())[0] == 200 + + +def test_lru_with_dupes(): + SIZE = 2 + lru = LRU(max_size=SIZE) + for i in [0, 0, 1, 1, 2, 2]: + lru[i] = i + assert _test_linkage(lru._anchor, SIZE + 1), 'linked list invalid' + + +def test_lru_with_dupes_2(): + "From Issue #55, h/t github.com/mt" + SIZE = 3 + lru = LRU(max_size=SIZE) + keys = ['A', 'A', 'B', 'A', 'C', 'B', 'D', 'E'] + for i, k in enumerate(keys): + lru[k] = 'HIT' + assert _test_linkage(lru._anchor, SIZE + 1), 'linked list invalid' + + return + + +def _test_linkage(dll, max_count=10000, prev_idx=0, next_idx=1): + """A function to test basic invariants of doubly-linked lists (with + links made of Python lists). + + 1. Test that the list is not longer than a certain length + 2. That the forward links (indicated by `next_idx`) correspond to + the backward links (indicated by `prev_idx`). + + The `dll` parameter is the root/anchor link of the list. + """ + start = cur = dll + i = 0 + prev = None + while 1: + if i > max_count: + raise Exception("did not return to anchor link after %r rounds" + % max_count) + if prev is not None and cur is start: + break + prev = cur + cur = cur[next_idx] + if cur[prev_idx] is not prev: + raise Exception('prev_idx does not point to prev at i = %r' % i) + i += 1 + + return True + + +def test_cached_dec(): + lru = LRU() + inner_func = CountingCallable() + func = cached(lru)(inner_func) + + assert inner_func.call_count == 0 + func() + assert inner_func.call_count == 1 + func() + assert inner_func.call_count == 1 + func('man door hand hook car door') + assert inner_func.call_count == 2 + + return + + +def test_unscoped_cached_dec(): + lru = LRU() + inner_func = CountingCallable() + func = cached(lru)(inner_func) + + other_inner_func = CountingCallable() + other_func = cached(lru)(other_inner_func) + + assert inner_func.call_count == 0 + func('a') + assert inner_func.call_count == 1 + func('a') + + other_func('a') + assert other_inner_func.call_count == 0 + return + + +def test_callable_cached_dec(): + lru = LRU() + get_lru = lambda: lru + + inner_func = CountingCallable() + func = cached(get_lru)(inner_func) + + assert inner_func.call_count == 0 + func() + assert inner_func.call_count == 1 + func() + assert inner_func.call_count == 1 + + lru.clear() + + func() + assert inner_func.call_count == 2 + func() + assert inner_func.call_count == 2 + + print(repr(func)) + + return + + +def test_cachedmethod(): + class Car: + def __init__(self, cache=None): + self.h_cache = LRI() if cache is None else cache + self.door_count = 0 + self.hook_count = 0 + self.hand_count = 0 + + @cachedmethod('h_cache') + def hand(self, *a, **kw): + self.hand_count += 1 + + @cachedmethod(lambda obj: obj.h_cache) + def hook(self, *a, **kw): + self.hook_count += 1 + + @cachedmethod('h_cache', scoped=False) + def door(self, *a, **kw): + self.door_count += 1 + + car = Car() + + # attribute name-style + assert car.hand_count == 0 + car.hand('h', a='nd') + assert car.hand_count == 1 + car.hand('h', a='nd') + assert car.hand_count == 1 + + # callable-style + assert car.hook_count == 0 + car.hook() + assert car.hook_count == 1 + car.hook() + assert car.hook_count == 1 + + # Ensure that non-selfish caches share the cache nicely + lru = LRU() + car_one = Car(cache=lru) + assert car_one.door_count == 0 + car_one.door('bob') + assert car_one.door_count == 1 + car_one.door('bob') + assert car_one.door_count == 1 + + car_two = Car(cache=lru) + assert car_two.door_count == 0 + car_two.door('bob') + assert car_two.door_count == 0 + + # try unbound for kicks + Car.door(Car(), 'bob') + + # always check the repr + print(repr(car_two.door)) + print(repr(Car.door)) + return + + +def test_cachedmethod_maintains_func_abstraction(): + ABC = ABCMeta('ABC', (object,), {}) + + class Car(ABC): + + def __init__(self, cache=None): + self.h_cache = LRI() if cache is None else cache + self.hand_count = 0 + + @cachedmethod('h_cache') + @abstractmethod + def hand(self, *a, **kw): + self.hand_count += 1 + + with pytest.raises(TypeError): + Car() + + +def test_cachedproperty(): + class Proper: + def __init__(self): + self.expensive_func = CountingCallable() + + @cachedproperty + def useful_attr(self): + """Useful DocString""" + return self.expensive_func() + + prop = Proper() + + assert prop.expensive_func.call_count == 0 + assert prop.useful_attr == 1 + assert prop.expensive_func.call_count == 1 + assert prop.useful_attr == 1 + assert prop.expensive_func.call_count == 1 + + # Make sure original DocString is accessible + assert Proper.useful_attr.__doc__ == "Useful DocString" + + prop.useful_attr += 1 # would not be possible with normal properties + assert prop.useful_attr == 2 + + delattr(prop, 'useful_attr') + assert prop.expensive_func.call_count == 1 + assert prop.useful_attr + assert prop.expensive_func.call_count == 2 + + repr(Proper.useful_attr) + + +def test_cachedproperty_maintains_func_abstraction(): + ABC = ABCMeta('ABC', (object,), {}) + + class AbstractExpensiveCalculator(ABC): + + @cachedproperty + @abstractmethod + def calculate(self): + pass + + with pytest.raises(TypeError): + AbstractExpensiveCalculator() + + +def test_min_id_map(): + import sys + if '__pypy__' in sys.builtin_module_names: + return # TODO: pypy still needs some work + + midm = MinIDMap() + + class Foo: + def __init__(self, val): + self.val = val + + # use this circular array to have them periodically collected + ref_wheel = [None, None, None] + + for i in range(1000): + nxt = Foo(i) + ref_wheel[i % len(ref_wheel)] = nxt + assert midm.get(nxt) <= len(ref_wheel) + if i % 10 == 0: + midm.drop(nxt) + + # test __iter__ + assert sorted([f.val for f in list(midm)[:10]]) == list(range(1000 - len(ref_wheel), 1000)) + + items = list(midm.iteritems()) + assert isinstance(items[0][0], Foo) + assert sorted(item[1] for item in items) == list(range(0, len(ref_wheel))) + + +def test_threshold_counter(): + tc = ThresholdCounter(threshold=0.1) + tc.add(1) + + assert tc.items() == [(1, 1)] + + tc.update([2] * 10) + + assert tc.get(1) == 0 + + tc.add(5) + assert 5 in tc + + assert len(list(tc.elements())) == 11 + + assert tc.threshold == 0.1 + assert tc.get_common_count() == 11 + assert tc.get_uncommon_count() == 1 # bc the initial 1 was dropped + assert round(tc.get_commonality(), 2) == 0.92 + assert tc.most_common(2) == [(2, 10), (5, 1)] + assert list(tc.elements()) == ([2] * 10) + [5] + + assert tc[2] == 10 + assert len(tc) == 2 + assert sorted(tc.keys()) == [2, 5] + assert sorted(tc.values()) == [1, 10] + assert sorted(tc.items()) == [(2, 10), (5, 1)] diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_debugutils_trace.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_debugutils_trace.py new file mode 100644 index 0000000000000000000000000000000000000000..37ce8a6e978c33af998869caa4f4fd1c8c288c27 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_debugutils_trace.py @@ -0,0 +1,87 @@ +from collections import namedtuple + +from pytest import raises + +from boltons.debugutils import wrap_trace + + +def test_trace_dict(): + target = {} + wrapped = wrap_trace(target) + + assert target is not wrapped + assert isinstance(wrapped, dict) + + wrapped['a'] = 'A' + assert target['a'] == 'A' + assert len(wrapped) == len(target) + + wrapped.pop('a') + assert 'a' not in target + + with raises(AttributeError): + wrapped.nonexistent_attr = 'nope' + + return + + +def test_trace_bytes(): + target = b'Hello' + + wrapped = wrap_trace(target) + + assert target is not wrapped + assert isinstance(wrapped, bytes) + + assert len(wrapped) == len(target) + assert wrapped.decode('utf-8') == 'Hello' + assert wrapped.lower() == target.lower() + + +def test_trace_exc(): + class TestException(Exception): + pass + + target = TestException('exceptions can be a good thing') + wrapped = wrap_trace(target) + + try: + raise wrapped + except TestException as te: + assert te.args == target.args + + +def test_trace_which(): + class Config: + def __init__(self, value): + self.value = value + + config = Config('first') + wrapped = wrap_trace(config, which='__setattr__') + + wrapped.value = 'second' + assert config.value == 'second' + + +def test_trace_namedtuple(): + TargetType = namedtuple('TargetType', 'x y z') + target = TargetType(1, 2, 3) + + wrapped = wrap_trace(target) + + assert wrapped == (1, 2, 3) + + +def test_trace_oldstyle(): + class Oldie: + test = object() + + def get_test(self): + return self.test + + oldie = Oldie() + + wrapped = wrap_trace(oldie) + assert wrapped.get_test() is oldie.test + + return diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_dictutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_dictutils.py new file mode 100644 index 0000000000000000000000000000000000000000..d4f6a678d9caa38e7710b0353c911602536bedeb --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_dictutils.py @@ -0,0 +1,544 @@ +import sys +import pytest + +from boltons.dictutils import OMD, OneToOne, ManyToMany, FrozenDict, subdict, FrozenHashError + + +_ITEMSETS = [[], + [('a', 1), ('b', 2), ('c', 3)], + [('A', 'One'), ('A', 'One'), ('A', 'One')], + [('Z', -1), ('Y', -2), ('Y', -2)], + [('a', 1), ('b', 2), ('a', 3), ('c', 4)]] + + +def test_dict_init(): + d = dict(_ITEMSETS[1]) + omd = OMD(d) + + assert omd['a'] == 1 + assert omd['b'] == 2 + assert omd['c'] == 3 + + assert len(omd) == 3 + assert omd.getlist('a') == [1] + assert omd == d + + +def test_todict(): + omd = OMD(_ITEMSETS[2]) + assert len(omd) == 1 + assert omd['A'] == 'One' + + d = omd.todict(multi=True) + assert len(d) == 1 + assert d['A'] == ['One', 'One', 'One'] + + flat = omd.todict() + assert flat['A'] == 'One' + + for itemset in _ITEMSETS: + omd = OMD(itemset) + d = dict(itemset) + + flat = omd.todict() + assert flat == d + return + + +def test_eq(): + omd = OMD(_ITEMSETS[3]) + assert omd == omd + assert not (omd != omd) + + omd2 = OMD(_ITEMSETS[3]) + assert omd == omd2 + assert omd2 == omd + assert not (omd != omd2) + + d = dict(_ITEMSETS[3]) + assert d == omd + omd3 = OMD(d) + assert omd != omd3 + + +def test_copy(): + for itemset in _ITEMSETS: + omd = OMD(itemset) + omd_c = omd.copy() + assert omd == omd_c + if omd_c: + omd_c.pop(itemset[0][0]) + assert omd != omd_c + return + + +def test_omd_pickle(): + import pickle + + empty = OMD() + pickled = pickle.dumps(empty) + roundtripped = pickle.loads(pickled) + assert roundtripped == empty + + nonempty = OMD([('a', 1), ('b', 2), ('b', 3)]) + + roundtripped = pickle.loads(pickle.dumps(nonempty)) + assert roundtripped == nonempty + assert roundtripped.getlist('b') == [2, 3] + + + +def test_clear(): + for itemset in _ITEMSETS: + omd = OMD(itemset) + omd.clear() + assert len(omd) == 0 + assert not omd + omd.clear() + assert not omd + omd['a'] = 22 + assert omd + omd.clear() + assert not omd + + +def test_types(): + from collections.abc import MutableMapping + + omd = OMD() + assert isinstance(omd, dict) + assert isinstance(omd, MutableMapping) + + +def test_multi_correctness(): + size = 100 + redun = 5 + + _rng = range(size) + _rng_redun = list(range(size//redun)) * redun + _pairs = zip(_rng_redun, _rng) + + omd = OMD(_pairs) + for multi in (True, False): + vals = [x[1] for x in omd.iteritems(multi=multi)] + strictly_ascending = all([x < y for x, y in zip(vals, vals[1:])]) + assert strictly_ascending + return + + +def test_kv_consistency(): + for itemset in _ITEMSETS: + omd = OMD(itemset) + + for multi in (True, False): + items = omd.items(multi=multi) + keys = omd.keys(multi=multi) + values = omd.values(multi=multi) + + assert keys == [x[0] for x in items] + assert values == [x[1] for x in items] + return + + +def test_update_basic(): + omd = OMD(_ITEMSETS[1]) + omd2 = OMD({'a': 10}) + omd.update(omd2) + assert omd['a'] == 10 + assert omd.getlist('a') == [10] + + omd2_c = omd2.copy() + omd2_c.pop('a') + assert omd2 != omd2_c + + +def test_update(): + for first, second in zip(_ITEMSETS, _ITEMSETS[1:]): + omd1 = OMD(first) + omd2 = OMD(second) + ref1 = dict(first) + ref2 = dict(second) + + omd1.update(omd2) + ref1.update(ref2) + assert omd1.todict() == ref1 + + omd1_repr = repr(omd1) + omd1.update(omd1) + assert omd1_repr == repr(omd1) + + +def test_update_extend(): + for first, second in zip(_ITEMSETS, _ITEMSETS[1:] + [[]]): + omd1 = OMD(first) + omd2 = OMD(second) + ref = dict(first) + orig_keys = set(omd1) + + ref.update(second) + omd1.update_extend(omd2) + for k in omd2: + assert len(omd1.getlist(k)) >= len(omd2.getlist(k)) + + assert omd1.todict() == ref + assert orig_keys <= set(omd1) + + +def test_invert(): + for items in _ITEMSETS: + omd = OMD(items) + iomd = omd.inverted() + # first, test all items made the jump + assert len(omd.items(multi=True)) == len(iomd.items(multi=True)) + + for val in omd.values(): + assert val in iomd # all values present as keys + + +def test_poplast(): + for items in _ITEMSETS[1:]: + omd = OMD(items) + assert omd.poplast() == items[-1][-1] + + +def test_pop(): + omd = OMD() + omd.add('even', 0) + omd.add('odd', 1) + omd.add('even', 2) + + assert omd.pop('odd') == 1 + assert omd.pop('odd', 99) == 99 + try: + omd.pop('odd') + assert False + except KeyError: + pass + + assert len(omd) == 1 + assert len(omd.items(multi=True)) == 2 + + +def test_addlist(): + omd = OMD() + omd.addlist('a', [1, 2, 3]) + omd.addlist('b', [4, 5]) + + assert omd.keys() == ['a', 'b'] + assert len(list(omd.iteritems(multi=True))) == 5 + + e_omd = OMD() + e_omd.addlist('a', []) + assert e_omd.keys() == [] + assert len(list(e_omd.iteritems(multi=True))) == 0 + + +def test_pop_all(): + omd = OMD() + omd.add('even', 0) + omd.add('odd', 1) + omd.add('even', 2) + + assert omd.popall('odd') == [1] + assert len(omd) == 1 + try: + omd.popall('odd') + assert False + except KeyError: + pass + assert omd.popall('odd', None) is None + + assert omd.popall('even') == [0, 2] + assert len(omd) == 0 + assert omd.popall('nope', None) is None + + assert OMD().popall('', None) is None + + +def test_reversed(): + from collections import OrderedDict + + for items in _ITEMSETS: + omd = OMD(items) + od = OrderedDict(items) + for ik, ok in zip(reversed(od), reversed(omd)): + assert ik == ok + + r100 = range(100) + omd = OMD(zip(r100, r100)) + for i in r100: + omd.add(i, i) + r100 = list(reversed(r100)) + assert list(reversed(omd)) == r100 + + omd = OMD() + assert list(reversed(omd)) == list(reversed(omd.keys())) + for i in range(20): + for j in range(i): + omd.add(i, i) + assert list(reversed(omd)) == list(reversed(omd.keys())) + + +def test_setdefault(): + omd = OMD() + empty_list = [] + x = omd.setdefault('1', empty_list) + assert x is empty_list + y = omd.setdefault('2') + assert y is None + assert omd.setdefault('1', None) is empty_list + + e_omd = OMD() + e_omd.addlist(1, []) + assert e_omd.popall(1, None) is None + assert len(e_omd) == 0 + + +def test_ior(): + omd_a = OMD(_ITEMSETS[1]) + omd_b = OMD(_ITEMSETS[2]) + omd_c = OMD(_ITEMSETS[1]) + + omd_a_id = id(omd_a) + omd_a |= omd_b + omd_c.update(omd_b) + + assert omd_a_id == id(omd_a) + assert omd_a == omd_c + +## END OMD TESTS + +import string + +def test_subdict(): + cap_map = {x: x.upper() for x in string.hexdigits} + assert len(cap_map) == 22 + assert len(subdict(cap_map, drop=['a'])) == 21 + assert 'a' not in subdict(cap_map, drop=['a']) + + assert len(subdict(cap_map, keep=['a', 'b'])) == 2 + + +def test_subdict_keep_type(): + omd = OMD({'a': 'A'}) + assert subdict(omd) == omd + assert type(subdict(omd)) is OMD + + +def test_one_to_one(): + e = OneToOne({1:2}) + def ck(val, inv): + assert (e, e.inv) == (val, inv) + ck({1:2}, {2:1}) + e[2] = 3 + ck({1:2, 2:3}, {3:2, 2:1}) + e.clear() + ck({}, {}) + e[1] = 1 + ck({1:1}, {1:1}) + e[1] = 2 + ck({1:2}, {2:1}) + e[3] = 2 + ck({3:2}, {2:3}) + del e[3] + ck({}, {}) + e[1] = 2 + e.inv[2] = 3 + ck({3:2}, {2:3}) + del e.inv[2] + ck({}, {}) + assert OneToOne({1:2, 3:4}).copy().inv == {2:1, 4:3} + e[1] = 2 + e.pop(1) + ck({}, {}) + e[1] = 2 + e.inv.pop(2) + ck({}, {}) + e[1] = 2 + e.popitem() + ck({}, {}) + e.setdefault(1) + ck({1: None}, {None: 1}) + e.inv.setdefault(2) + ck({1: None, None: 2}, {None: 1, 2: None}) + e.clear() + e.update({}) + ck({}, {}) + e.update({1: 2}, cat="dog") + ck({1:2, "cat":"dog"}, {2: 1, "dog":"cat"}) + + # try various overlapping values + oto = OneToOne({'a': 0, 'b': 0}) + assert len(oto) == len(oto.inv) == 1 + + oto['c'] = 0 + assert len(oto) == len(oto.inv) == 1 + assert oto.inv[0] == 'c' + + oto.update({'z': 0, 'y': 0}) + assert len(oto) == len(oto.inv) == 1 + + # test out unique classmethod + with pytest.raises(ValueError): + OneToOne.unique({'a': 0, 'b': 0}) + + return + + +def test_many_to_many(): + m2m = ManyToMany() + assert len(m2m) == 0 + assert not m2m + m2m.add(1, 'a') + assert m2m + m2m.add(1, 'b') + assert len(m2m) == 1 + assert m2m[1] == frozenset(['a', 'b']) + assert m2m.inv['a'] == frozenset([1]) + del m2m.inv['a'] + assert m2m[1] == frozenset(['b']) + assert 1 in m2m + del m2m.inv['b'] + assert 1 not in m2m + m2m[1] = ('a', 'b') + assert set(m2m.iteritems()) == {(1, 'a'), (1, 'b')} + m2m.remove(1, 'a') + m2m.remove(1, 'b') + assert 1 not in m2m + m2m.update([(1, 'a'), (2, 'b')]) + assert m2m.get(2) == frozenset(('b',)) + assert m2m.get(3) == frozenset(()) + assert ManyToMany(['ab', 'cd']) == ManyToMany(['ba', 'dc']).inv + assert ManyToMany(ManyToMany(['ab', 'cd'])) == ManyToMany(['ab', 'cd']) + + m2m = ManyToMany({'a': 'b'}) + m2m.replace('a', 'B') + # also test the repr while we're at it + assert repr(m2m) == repr(ManyToMany([("B", "b")])) + assert repr(m2m).startswith('ManyToMany(') and 'B' in repr(m2m) + + +def test_frozendict(): + efd = FrozenDict() + assert isinstance(efd, dict) + assert len(efd) == 0 + assert not efd + assert repr(efd) == "FrozenDict({})" + + data = {'a': 'A', 'b': 'B'} + fd = FrozenDict(data) + + assert bool(fd) + assert len(fd) == 2 + assert fd['a'] == 'A' + assert fd['b'] == 'B' + assert sorted(fd.keys()) == ['a', 'b'] + assert sorted(fd.values()) == ['A', 'B'] + assert sorted(fd.items()) == [('a', 'A'), ('b', 'B')] + assert 'a' in fd + assert 'c' not in fd + + assert hash(fd) + fd_map = {'fd': fd} + assert fd_map['fd'] is fd + + with pytest.raises(TypeError): + fd['c'] = 'C' + with pytest.raises(TypeError): + del fd['a'] + with pytest.raises(TypeError): + fd.update(x='X') + with pytest.raises(TypeError): + fd.setdefault('x', []) + with pytest.raises(TypeError): + fd.pop('c') + with pytest.raises(TypeError): + fd.popitem() + with pytest.raises(TypeError): + fd.clear() + + + import pickle + fkfd = FrozenDict.fromkeys([2, 4, 6], value=0) + assert pickle.loads(pickle.dumps(fkfd)) == fkfd + + assert sorted(fkfd.updated({8: 0}).keys()) == [2, 4, 6, 8] + + # try something with an unhashable value + unfd = FrozenDict({'a': ['A']}) + with pytest.raises(TypeError) as excinfo: + {unfd: 'val'} + assert excinfo.type is FrozenHashError + with pytest.raises(TypeError) as excinfo2: + {unfd: 'val'} + assert excinfo.value is excinfo2.value # test cached exception + + return + + +@pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9 or higher") +def test_frozendict_ior(): + data = {'a': 'A', 'b': 'B'} + fd = FrozenDict(data) + + with pytest.raises(TypeError, match=".*FrozenDict.*immutable.*"): + fd |= fd + + +def test_frozendict_api(): + # all the read-only methods that are fine + through_methods = ['__class__', + '__cmp__', + '__contains__', + '__delattr__', + '__dir__', + '__eq__', + '__format__', + '__ge__', + '__getattribute__', + '__getstate__', + '__getitem__', + '__getstate__', + '__gt__', + '__init__', + '__iter__', + '__le__', + '__len__', + '__lt__', + '__ne__', + '__new__', + '__or__', + '__reduce__', + '__reversed__', + '__ror__', + '__setattr__', + '__sizeof__', + '__str__', + 'copy', + 'get', + 'has_key', + 'items', + 'iteritems', + 'iterkeys', + 'itervalues', + 'keys', + 'values', + 'viewitems', + 'viewkeys', + 'viewvalues'] + + fd = FrozenDict() + ret = [] + for attrname in dir(fd): + if attrname == '_hash': # in the dir, even before it's set + continue + attr = getattr(fd, attrname) + if not callable(attr): + continue + + if getattr(FrozenDict, attrname) == getattr(dict, attrname, None) and attrname not in through_methods: + assert attrname == False + ret.append(attrname) + + import copy + assert copy.copy(fd) is fd diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_ecoutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_ecoutils.py new file mode 100644 index 0000000000000000000000000000000000000000..bac569398dafe66cdef41cb00659565e20e8d1ff --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_ecoutils.py @@ -0,0 +1,15 @@ +import sys +from boltons import ecoutils + + +def test_basic(): + # basic sanity test + prof = ecoutils.get_profile() + + assert prof['python']['bin'] == sys.executable + + +def test_scrub(): + prof = ecoutils.get_profile(scrub=True) + + assert prof['username'] == '-' diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_fileutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_fileutils.py new file mode 100644 index 0000000000000000000000000000000000000000..81987b0b462d953b71aa8c32b81c428b40914067 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_fileutils.py @@ -0,0 +1,93 @@ +import os.path + + + + + +from boltons import fileutils +from boltons.fileutils import FilePerms, iter_find_files +from boltons.strutils import removeprefix + + +BOLTONS_PATH = os.path.dirname(os.path.abspath(fileutils.__file__)) + + +def test_fileperms(): + up = FilePerms() + up.other = '' + up.user = 'xrw' + up.group = 'rrrwx' + try: + up.other = 'nope' + except ValueError: + # correctly raised ValueError on invalid chars + pass + + assert repr(up) == "FilePerms(user='rwx', group='rwx', other='')" + assert up.user == 'rwx' + assert oct(int(up)) == '0o770' + + assert int(FilePerms()) == 0 + + +def test_iter_find_files(): + def _to_baseless_list(paths): + return [removeprefix(p, BOLTONS_PATH).lstrip(os.path.sep) for p in paths] + + assert 'fileutils.py' in _to_baseless_list(iter_find_files(BOLTONS_PATH, patterns=['*.py'])) + + boltons_parent = os.path.dirname(BOLTONS_PATH) + assert 'fileutils.py' in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py'])) + assert 'fileutils.py' not in _to_baseless_list(iter_find_files(boltons_parent, patterns=['*.py'], max_depth=0)) + + +def test_rotate_file_no_rotation(tmp_path): + file_path = tmp_path / 'test_file.txt' + fileutils.rotate_file(file_path) + assert not file_path.exists() + + +def test_rotate_file_one_rotation(tmp_path): + file_path = tmp_path / 'test_file.txt' + file_path.write_text('test content') + assert file_path.exists() + + fileutils.rotate_file(file_path) + assert not file_path.exists() + assert (tmp_path / 'test_file.1.txt').exists() + + +def test_rotate_file_full_rotation(tmp_path): + file_path = tmp_path / 'test_file.txt' + file_path.write_text('test content 0') + for i in range(1, 5): + cur_path = tmp_path / f'test_file.{i}.txt' + cur_path.write_text(f'test content {i}') + assert cur_path.exists() + + fileutils.rotate_file(file_path, keep=5) + assert not file_path.exists() + + for i in range(1, 5): + cur_path = tmp_path / f'test_file.{i}.txt' + assert cur_path.read_text() == f'test content {i-1}' + + assert not (tmp_path / 'test_file.5.txt').exists() + +def test_rotate_file_full_rotation_no_ext(tmp_path): + file_path = tmp_path / 'test_file' + file_path.write_text('test content 0') + for i in range(1, 5): + cur_path = tmp_path / f'test_file.{i}' + cur_path.write_text(f'test content {i}') + assert cur_path.exists() + + fileutils.rotate_file(file_path, keep=5) + assert not file_path.exists() + + for i in range(1, 5): + cur_path = tmp_path / f'test_file.{i}' + assert cur_path.read_text() == f'test content {i-1}' + + assert not (tmp_path / 'test_file.5').exists() + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_formatutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_formatutils.py new file mode 100644 index 0000000000000000000000000000000000000000..8eba3c1f43f66bb2190a4d3bf3e9359641d6e71e --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_formatutils.py @@ -0,0 +1,74 @@ +import re +from collections import namedtuple + +from boltons.formatutils import (get_format_args, + split_format_str, + tokenize_format_str, + infer_positional_format_args, + DeferredValue as DV) + + +PFAT = namedtuple("PositionalFormatArgTest", "fstr arg_vals res") + +_PFATS = [PFAT('{} {} {}', ('hi', 'hello', 'bye'), "hi hello bye"), + PFAT('{:d} {}', (1, 2), "1 2"), + PFAT('{!s} {!r}', ('str', 'repr'), "str 'repr'"), + PFAT('{[hi]}, {.__name__!r}', ({'hi': 'hi'}, re), "hi, 're'"), + PFAT('{{joek}} ({} {})', ('so', 'funny'), "{joek} (so funny)")] + + +def test_pos_infer(): + for i, (tmpl, args, res) in enumerate(_PFATS): + converted = infer_positional_format_args(tmpl) + assert converted.format(*args) == res + + +_TEST_TMPLS = ["example 1: {hello}", + "example 2: {hello:*10}", + "example 3: {hello:*{width}}", + "example 4: {hello!r:{fchar}{width}}, {width}, yes", + "example 5: {0}, {1:d}, {2:f}, {1}", + "example 6: {}, {}, {}, {1}"] + + +def test_get_fstr_args(): + results = [] + for t in _TEST_TMPLS: + inferred_t = infer_positional_format_args(t) + res = get_format_args(inferred_t) + assert res + + +def test_split_fstr(): + results = [] + for t in _TEST_TMPLS: + res = split_format_str(t) + results.append(res) + assert res + + +def test_tokenize_format_str(): + results = [] + for t in _TEST_TMPLS: + res = tokenize_format_str(t) + results.append(res) + assert res + + +def test_deferredvalue(): + def myfunc(): + myfunc.called += 1 + return 123 + + myfunc.called = 0 + + dv = DV(myfunc) + assert str(dv) == '123' + assert myfunc.called == 1 + assert str(dv) == '123' + assert myfunc.called == 1 + dv.cache_value = False + assert str(dv) == '123' + assert myfunc.called == 2 + assert str(dv) == '123' + assert myfunc.called == 3 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils.py new file mode 100644 index 0000000000000000000000000000000000000000..03ef585cfc4b477133ff44ef8e821382d9923664 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils.py @@ -0,0 +1,84 @@ +from boltons.funcutils import (copy_function, + total_ordering, + format_invocation, + InstancePartial, + CachedInstancePartial, + noop) + + +class Greeter: + def __init__(self, greeting): + self.greeting = greeting + + def greet(self, excitement='.'): + return self.greeting.capitalize() + excitement + + partial_greet = InstancePartial(greet, excitement='!') + cached_partial_greet = CachedInstancePartial(greet, excitement='...') + + def native_greet(self): + return self.greet(';') + + +class SubGreeter(Greeter): + pass + + +def test_partials(): + g = SubGreeter('hello') + + assert g.greet() == 'Hello.' + assert g.native_greet() == 'Hello;' + assert g.partial_greet() == 'Hello!' + assert g.cached_partial_greet() == 'Hello...' + assert CachedInstancePartial(g.greet, excitement='s')() == 'Hellos' + + g.native_greet = 'native reassigned' + assert g.native_greet == 'native reassigned' + + g.partial_greet = 'partial reassigned' + assert g.partial_greet == 'partial reassigned' + + g.cached_partial_greet = 'cached_partial reassigned' + assert g.cached_partial_greet == 'cached_partial reassigned' + + +def test_copy_function(): + def callee(): + return 1 + callee_copy = copy_function(callee) + assert callee is not callee_copy + assert callee() == callee_copy() + + +def test_total_ordering(): + @total_ordering + class Number: + def __init__(self, val): + self.val = int(val) + + def __gt__(self, other): + return self.val > other + + def __eq__(self, other): + return self.val == other + + num = Number(3) + assert num > 0 + assert num == 3 + + assert num < 5 + assert num >= 2 + assert num != 1 + + +def test_format_invocation(): + assert format_invocation('d') == "d()" + assert format_invocation('f', ('a', 'b')) == "f('a', 'b')" + assert format_invocation('g', (), {'x': 'y'}) == "g(x='y')" + assert format_invocation('h', ('a', 'b'), {'x': 'y', 'z': 'zz'}) == "h('a', 'b', x='y', z='zz')" + +def test_noop(): + assert noop() is None + assert noop(1, 2) is None + assert noop(a=1, b=2) is None diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils_fb.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils_fb.py new file mode 100644 index 0000000000000000000000000000000000000000..98d0940dd2563f2663972e7a501acb75c12c580b --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils_fb.py @@ -0,0 +1,296 @@ +import pytest +from boltons.funcutils import wraps, FunctionBuilder + + +def pita_wrap(flag=False): + + def cedar_dec(func): + @wraps(func) + def cedar_wrapper(*a, **kw): + return (flag, func.__name__, func(*a, **kw)) + return cedar_wrapper + + return cedar_dec + + +def wrappable_func(a, b): + return a, b + + +def wrappable_varkw_func(a, b, **kw): + return a, b + + +def test_wraps_basic(): + + @pita_wrap(flag=True) + def simple_func(): + '''"""a tricky docstring"""''' + return 'hello' + + assert simple_func() == (True, 'simple_func', 'hello') + assert simple_func.__doc__ == '''"""a tricky docstring"""''' + + assert callable(simple_func.__wrapped__) + assert simple_func.__wrapped__() == 'hello' + assert simple_func.__wrapped__.__doc__ == '''"""a tricky docstring"""''' + + @pita_wrap(flag=False) + def less_simple_func(arg='hello'): + return arg + + assert less_simple_func() == (False, 'less_simple_func', 'hello') + assert less_simple_func(arg='bye') == (False, 'less_simple_func', 'bye') + + with pytest.raises(TypeError): + simple_func(no_such_arg='nope') + + @pita_wrap(flag=False) + def default_non_roundtrippable_repr(x=lambda y: y + 1): + return x(1) + + assert default_non_roundtrippable_repr() == ( + False, 'default_non_roundtrippable_repr', 2) + + +def test_wraps_injected(): + def inject_string(func): + @wraps(func, injected="a") + def wrapped(*args, **kwargs): + return func(1, *args, **kwargs) + return wrapped + + assert inject_string(wrappable_func)(2) == (1, 2) + + def inject_list(func): + @wraps(func, injected=["b"]) + def wrapped(a, *args, **kwargs): + return func(a, 2, *args, **kwargs) + return wrapped + + assert inject_list(wrappable_func)(1) == (1, 2) + + def inject_nonexistent_arg(func): + @wraps(func, injected=["X"]) + def wrapped(*args, **kwargs): + return func(*args, **kwargs) + return wrapped + + with pytest.raises(ValueError): + inject_nonexistent_arg(wrappable_func) + + def inject_missing_argument(func): + @wraps(func, injected="c") + def wrapped(*args, **kwargs): + return func(1, *args, **kwargs) + return wrapped + + def inject_misc_argument(func): + # inject_to_varkw is default True, just being explicit + @wraps(func, injected="c", inject_to_varkw=True) + def wrapped(*args, **kwargs): + return func(c=1, *args, **kwargs) + return wrapped + + assert inject_misc_argument(wrappable_varkw_func)(1, 2) == (1, 2) + + def inject_misc_argument_no_varkw(func): + @wraps(func, injected="c", inject_to_varkw=False) + def wrapped(*args, **kwargs): + return func(c=1, *args, **kwargs) + return wrapped + + with pytest.raises(ValueError): + inject_misc_argument_no_varkw(wrappable_varkw_func) + + +def test_wraps_update_dict(): + + def updated_dict(func): + @wraps(func, update_dict=True) + def wrapped(*args, **kwargs): + return func(*args, **kwargs) + return wrapped + + def f(a, b): + return a, b + + f.something = True + + assert getattr(updated_dict(f), 'something') + + +def test_wraps_unknown_args(): + + def fails(func): + @wraps(func, foo="bar") + def wrapped(*args, **kwargs): + return func(*args, **kwargs) + return wrapped + + with pytest.raises(TypeError): + fails(wrappable_func) + + +def test_FunctionBuilder_invalid_args(): + with pytest.raises(TypeError): + FunctionBuilder(name="fails", foo="bar") + + +def test_FunctionBuilder_invalid_body(): + with pytest.raises(SyntaxError): + FunctionBuilder(name="fails", body="*").get_func() + + +def test_FunctionBuilder_modify(): + fb = FunctionBuilder('return_five', doc='returns the integer 5', + body='return 5') + f = fb.get_func() + assert f() == 5 + + fb.varkw = 'kw' + f_kw = fb.get_func() + assert f_kw(ignored_arg='ignored_val') == 5 + + +def test_wraps_wrappers(): + call_list = [] + + def call_list_appender(func): + @wraps(func) + def appender(*a, **kw): + call_list.append((a, kw)) + return func(*a, **kw) + return appender + + with pytest.raises(TypeError): + class Num: + def __init__(self, num): + self.num = num + + @call_list_appender + @classmethod + def added(cls, x, y=1): + return cls(x + y) + + return + + +def test_FunctionBuilder_add_arg(): + fb = FunctionBuilder('return_five', doc='returns the integer 5', + body='return 5') + f = fb.get_func() + assert f() == 5 + + fb.add_arg('val') + f = fb.get_func() + assert f(val='ignored') == 5 + + with pytest.raises(ValueError) as excinfo: + fb.add_arg('val') + excinfo.typename == 'ExistingArgument' + + fb = FunctionBuilder('return_val', doc='returns the value', + body='return val') + + broken_func = fb.get_func() + with pytest.raises(NameError): + broken_func() + + fb.add_arg('val', default='default_val') + + better_func = fb.get_func() + assert better_func() == 'default_val' + + assert better_func('positional') == 'positional' + assert better_func(val='keyword') == 'keyword' + + +def test_wraps_expected(): + def expect_string(func): + @wraps(func, expected="c") + def wrapped(*args, **kwargs): + args, c = args[:2], args[-1] + return func(*args, **kwargs) + (c,) + return wrapped + + expected_string = expect_string(wrappable_func) + assert expected_string(1, 2, 3) == (1, 2, 3) + + with pytest.raises(TypeError) as excinfo: + expected_string(1, 2) + + # a rough way of making sure we got the kind of error we expected + assert 'argument' in repr(excinfo.value) + + def expect_list(func): + @wraps(func, expected=["c"]) + def wrapped(*args, **kwargs): + args, c = args[:2], args[-1] + return func(*args, **kwargs) + (c,) + return wrapped + + assert expect_list(wrappable_func)(1, 2, c=4) == (1, 2, 4) + + def expect_pair(func): + @wraps(func, expected=[('c', 5)]) + def wrapped(*args, **kwargs): + args, c = args[:2], args[-1] + return func(*args, **kwargs) + (c,) + return wrapped + + assert expect_pair(wrappable_func)(1, 2) == (1, 2, 5) + + def expect_dict(func): + @wraps(func, expected={'c': 6}) + def wrapped(*args, **kwargs): + args, c = args[:2], args[-1] + return func(*args, **kwargs) + (c,) + return wrapped + + assert expect_dict(wrappable_func)(1, 2) == (1, 2, 6) + + +def test_defaults_dict(): + def example(req, test='default'): + return req + + fb_example = FunctionBuilder.from_func(example) + assert 'test' in fb_example.args + dd = fb_example.get_defaults_dict() + assert dd['test'] == 'default' + assert 'req' not in dd + + +def test_get_arg_names(): + def example(req, test='default'): + return req + + fb_example = FunctionBuilder.from_func(example) + assert 'test' in fb_example.args + assert fb_example.get_arg_names() == ('req', 'test') + assert fb_example.get_arg_names(only_required=True) == ('req',) + + +@pytest.mark.parametrize( + "args, varargs, varkw, defaults, invocation_str, sig_str", + [ + (["a", "b"], None, None, None, "a, b", "(a, b)"), + (None, "args", "kwargs", None, "*args, **kwargs", "(*args, **kwargs)"), + ("a", None, None, dict(a="a"), "a", "(a)"), + ], +) +def test_get_invocation_sig_str( + args, varargs, varkw, defaults, invocation_str, sig_str +): + fb = FunctionBuilder( + name='return_five', + body='return 5', + args=args, + varargs=varargs, + varkw=varkw, + defaults=defaults + ) + + assert fb.get_invocation_str() == invocation_str + assert fb.get_sig_str() == sig_str diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils_fb_py3.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils_fb_py3.py new file mode 100644 index 0000000000000000000000000000000000000000..85cdf12c18e16a060a5a350de3151fd06eb3c34e --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_funcutils_fb_py3.py @@ -0,0 +1,318 @@ +import time +import inspect +import functools +from collections import defaultdict + +import pytest + +from boltons.funcutils import wraps, FunctionBuilder, update_wrapper, copy_function +import boltons.funcutils as funcutils + + +def wrappable_func(a, b): + return a, b + + +def wrappable_varkw_func(a, b, **kw): + return a, b + + +def pita_wrap(flag=False): + + def cedar_dec(func): + @wraps(func) + def cedar_wrapper(*a, **kw): + return (flag, func.__name__, func(*a, **kw)) + return cedar_wrapper + + return cedar_dec + + +def test_wraps_py3(): + + @pita_wrap(flag=True) + def annotations(a: int, b: float=1, c: defaultdict=()) -> defaultdict: + return a, b, c + + assert annotations(0) == (True, "annotations", (0, 1, ())) + assert annotations.__annotations__ == {'a': int, 'b': float, + 'c': defaultdict, + 'return': defaultdict} + + @pita_wrap(flag=False) + def kwonly_arg(a, *, b, c=2): + return a, b, c + + with pytest.raises(TypeError): + kwonly_arg(0) + + assert kwonly_arg(0, b=1) == (False, "kwonly_arg", (0, 1, 2)) + assert kwonly_arg(0, b=1, c=3) == (False, "kwonly_arg", (0, 1, 3)) + + @pita_wrap(flag=True) + def kwonly_non_roundtrippable_repr(*, x=lambda y: y + 1): + return x(1) + + assert kwonly_non_roundtrippable_repr() == ( + True, 'kwonly_non_roundtrippable_repr', 2) + + +def test_copy_function_kw_defaults_py3(): + # test that the copy works with keyword-only defaults + f = lambda x, *, y=2: x * y + f_copy = copy_function(f) + assert f(21) == f_copy(21) == 42 + + +@pytest.mark.parametrize('partial_kind', (functools, funcutils)) +def test_update_wrapper_partial(partial_kind): + wrapper = partial_kind.partial(wrappable_varkw_func, b=1) + + fully_wrapped = update_wrapper(wrapper, wrappable_varkw_func) + assert fully_wrapped(1) == (1, 1) + + +def test_remove_kwonly_arg(): + # example adapted from https://github.com/mahmoud/boltons/issues/123 + + def darkhelm_inject_loop(func): + sig = inspect.signature(func) + loop_param = sig.parameters['loop'].replace(default=None) + sig = sig.replace(parameters=[loop_param]) + + def add_loop(args, kwargs): + bargs = sig.bind(*args, **kwargs) + bargs.apply_defaults() + if bargs.arguments['loop'] is None: + bargs.arguments['loop'] = "don't look at me, I just use gevent" + + return bargs.arguments + + def wrapper(*args, **kwargs): + return func(**add_loop(args, kwargs)) + + return wraps(func, injected=['loop'])(wrapper) + + @darkhelm_inject_loop + def example(test='default', *, loop='lol'): + return loop + + fb_example = FunctionBuilder.from_func(example) + assert 'test' in fb_example.args + assert fb_example.get_defaults_dict()['test'] == 'default' + + assert 'loop' not in fb_example.kwonlyargs + assert 'loop' not in fb_example.kwonlydefaults + + +def test_defaults_dict(): + def example(req, test='default', *, loop='lol'): + return loop + + fb_example = FunctionBuilder.from_func(example) + assert 'test' in fb_example.args + dd = fb_example.get_defaults_dict() + assert dd['test'] == 'default' + assert dd['loop'] == 'lol' + assert 'req' not in dd + + +def test_get_arg_names(): + def example(req, test='default', *, loop='lol'): + return loop + + fb_example = FunctionBuilder.from_func(example) + assert 'test' in fb_example.args + assert fb_example.get_arg_names() == ('req', 'test', 'loop') + assert fb_example.get_arg_names(only_required=True) == ('req',) + + +@pytest.mark.parametrize('signature,should_match', + [('a, *, b', True), + ('a,*,b', True), + ('a, * , b', True), + ('a, *,\nb', True), + ('a, *\n,b', True), + ('a, b', False), + ('a, *args', False), + ('a, *args, **kwargs', False), + ('*args', False), + ('*args, **kwargs', False)]) +def test_FunctionBuilder_KWONLY_MARKER(signature, should_match): + """ + _KWONLY_MARKER matches the keyword-only argument separator, + regardless of whitespace. + + Note: it assumes the signature is valid Python. + """ + matched = bool(FunctionBuilder._KWONLY_MARKER.search(signature)) + message = "{!r}: should_match was {}, but result was {}".format( + signature, should_match, matched) + assert bool(matched) == should_match, message + + +def test_FunctionBuilder_add_arg_kwonly(): + fb = FunctionBuilder('return_val', doc='returns the value', + body='return val') + + broken_func = fb.get_func() + with pytest.raises(NameError): + broken_func() + + fb.add_arg('val', default='default_val', kwonly=True) + + better_func = fb.get_func() + assert better_func() == 'default_val' + + with pytest.raises(ValueError): + fb.add_arg('val') + + assert better_func(val='keyword') == 'keyword' + + with pytest.raises(TypeError): + assert better_func('positional') + return + + +@pytest.mark.parametrize( + "args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, invocation_str, sig_str", + [ + ( + None, + "args", + "kwargs", + None, + "a", + dict(a="a"), + "*args, a=a, **kwargs", + "(*args, a, **kwargs)", + ) + ], +) +def test_get_invocation_sig_str( + args, + varargs, + varkw, + defaults, + kwonlyargs, + kwonlydefaults, + invocation_str, + sig_str, +): + fb = FunctionBuilder( + name="return_five", + body="return 5", + args=args, + varargs=varargs, + varkw=varkw, + defaults=defaults, + kwonlyargs=kwonlyargs, + kwonlydefaults=kwonlydefaults, + ) + + assert fb.get_invocation_str() == invocation_str + assert fb.get_sig_str() == sig_str + + +def test_wraps_inner_kwarg_only(): + """from https://github.com/mahmoud/boltons/issues/261 + + mh responds to the issue: + + You'll notice that when kw-only args are involved the first time + (wraps(f)(g)) it works fine. The other way around, however, + wraps(g)(f) fails, because by the very nature of funcutils.wraps, + you're trying to give f the same signature as g. And f's signature + is not like g's. g supports positional b and f() does not. + + If you want to make a wrapper which converts a keyword-only + argument to one that can be positional or keyword only, that'll + require a different approach for now. + + A potential fix would be to pass all function arguments as + keywords. But doubt that's the right direction, because, while I + have yet to add positional argument only support, that'll + definitely throw a wrench into things. + """ + from boltons.funcutils import wraps + + def g(a: float, b=10): + return a * b + + def f(a: int, *, b=1): + return a * b + + # all is well here... + assert f(3) == 3 + assert g(3) == 30 + assert wraps(f)(g)(3) == 3 # yay, g got the f default (not so with functools.wraps!) + + # but this doesn't work + with pytest.raises(TypeError): + wraps(g)(f)(3) + + return + + +def test_wraps_async(): + # from https://github.com/mahmoud/boltons/issues/194 + import asyncio + + def delayed(func): + @wraps(func) + async def wrapped(*args, **kw): + await asyncio.sleep(1.0) + return await func(*args, **kw) + + return wrapped + + + async def f(): + await asyncio.sleep(0.1) + + assert asyncio.iscoroutinefunction(f) + + f2 = delayed(f) + + assert asyncio.iscoroutinefunction(f2) + + # from https://github.com/mahmoud/boltons/pull/195 + def yolo(): + def make_time_decorator(wrapped): + @wraps(wrapped) + async def decorator(*args, **kw): + return (await wrapped(*args, **kw)) + return decorator + + return make_time_decorator + + + @yolo() + async def foo(x): + await asyncio.sleep(x) + + start_time = time.monotonic() + asyncio.run(foo(0.3)) + duration = time.monotonic() - start_time + + # lol windows py37 somehow completes this in under 0.3 + # "assert 0.29700000000002547 > 0.3" https://ci.appveyor.com/project/mahmoud/boltons/builds/22261051/job/3jfq1tq2233csqp6 + assert duration > 0.25 + + +def test_wraps_hide_wrapped(): + new_func = wraps(wrappable_func, injected='b')(lambda a: wrappable_func(a, b=1)) + new_sig = inspect.signature(new_func, follow_wrapped=True) + + assert list(new_sig.parameters.keys()) == ['a', 'b'] + + new_func = wraps(wrappable_func, injected='b', hide_wrapped=True)(lambda a: wrappable_func(a, b=1)) + new_sig = inspect.signature(new_func, follow_wrapped=True) + + assert list(new_sig.parameters.keys()) == ['a'] + + new_func = wraps(wrappable_func, injected='b')(lambda a: wrappable_func(a, b=1)) + new_new_func = wraps(new_func, injected='a', hide_wrapped=True)(lambda: new_func(a=1)) + new_new_sig = inspect.signature(new_new_func, follow_wrapped=True) + + assert len(new_new_sig.parameters) == 0 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_gcutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_gcutils.py new file mode 100644 index 0000000000000000000000000000000000000000..41cbff6d3b93ced42ba7512fd7ae3b810b77cef4 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_gcutils.py @@ -0,0 +1,32 @@ +import sys +import time + + +if '__pypy__' not in sys.builtin_module_names: + # pypy's gc really is different + + from boltons.gcutils import get_all, toggle_gc_postcollect + + def test_get_all(): + class TestType: + pass + + tt = TestType() + + assert len(get_all(TestType)) == 1 + assert len(get_all(bool)) == 0 + return + + def test_toggle_gc_postcollect(): + COUNT = int(1e6) + + start = time.time() + with toggle_gc_postcollect: + x = [{} for x in range(COUNT)] + no_gc_time = time.time() - start + + start = time.time() + x = [{} for x in range(COUNT)] + with_gc_time = time.time() - start + + time_diff = no_gc_time < with_gc_time diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_ioutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_ioutils.py new file mode 100644 index 0000000000000000000000000000000000000000..a61df005f935a034a3d67d5d254e561ea255ec69 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_ioutils.py @@ -0,0 +1,496 @@ +import io +import os +import codecs +import random +import string + +from tempfile import mkdtemp +from unittest import TestCase +from zipfile import ZipFile, ZIP_DEFLATED + + +from boltons import ioutils + +CUR_FILE_PATH = os.path.abspath(__file__) + + +class AssertionsMixin: + + def assertIsNone(self, item, msg=None): + self.assertTrue(item is None, msg) + + +class BaseTestMixin: + """ + A set of tests that work the same for SpooledBtyesIO and SpooledStringIO + """ + + def test_getvalue_norollover(self): + """Make sure getvalue function works with in-memory flo""" + self.spooled_flo.write(self.test_str) + self.assertEqual(self.spooled_flo.getvalue(), self.test_str) + + def test_getvalue_rollover(self): + """Make sure getvalue function works with on-disk flo""" + self.spooled_flo.write(self.test_str) + self.assertFalse(self.spooled_flo._rolled) + self.spooled_flo.rollover() + self.assertEqual(self.spooled_flo.getvalue(), self.test_str) + self.assertTrue(self.spooled_flo._rolled) + + def test_rollover_custom_directory(self): + """dir keyword argument is passed to TemporaryFile instantiation""" + custom_dir = mkdtemp() + try: + # Re-instantiate self.spooled_flo with the custom dir argument + _spooled_flo = type(self.spooled_flo)(dir=custom_dir) + self.assertEqual(_spooled_flo._dir, custom_dir) + # TemporaryFile is kind of a black box, we can't really test it + # since the directory entry for the file is removed immediately + # after the file is created. So we can't check path using fd.name + # or listdir(custom_dir). We could either convert rollover() to + # use NamedtemporaryFile-s or assume it's well tested enough that + # passing dir= into the constructor will work as expected. We'll + # call rollover() with the dir attribute set just to ensure + # nothing has gone absurdly wrong. + _spooled_flo.write(self.test_str) + _spooled_flo.rollover() + self.assertEqual(_spooled_flo.getvalue(), self.test_str) + self.assertTrue(_spooled_flo._rolled) + _spooled_flo.close() + finally: + os.rmdir(custom_dir) + + def test_compare_err(self): + """Read-heads are reset if a comparison raises an error.""" + def _monkey_err(*args, **kwargs): + raise Exception('A sad error has occurred today') + + a = self.spooled_flo.__class__() + a.write(self.test_str) + b = self.spooled_flo.__class__() + b.write(self.test_str) + + a.seek(1) + b.seek(2) + + b.__next__ = _monkey_err + + try: + a == b + except Exception: + pass + + self.assertEqual(a.tell(), 1) + self.assertEqual(b.tell(), 2) + + def test_truncate_noargs_norollover(self): + """Test truncating with no args with in-memory flo""" + self.spooled_flo.write(self.test_str) + self.spooled_flo.seek(10) + self.spooled_flo.truncate() + self.assertEqual(self.spooled_flo.getvalue(), self.test_str[:10]) + + def test_truncate_noargs_rollover(self): + """Test truncating with no args with on-disk flo""" + self.spooled_flo.write(self.test_str) + self.spooled_flo.seek(10) + self.spooled_flo.rollover() + self.spooled_flo.truncate() + self.assertEqual(self.spooled_flo.getvalue(), self.test_str[:10]) + + def test_truncate_with_args_norollover(self): + """Test truncating to a value with in-memory flo""" + self.spooled_flo.write(self.test_str) + self.spooled_flo.seek(5) + self.spooled_flo.truncate(10) + self.assertEqual(self.spooled_flo.getvalue(), self.test_str[:10]) + + def test_truncate_with_args_rollover(self): + """Test truncating to a value with on-disk flo""" + self.spooled_flo.write(self.test_str) + self.spooled_flo.seek(5) + self.spooled_flo.rollover() + self.spooled_flo.truncate(10) + self.assertEqual(self.spooled_flo.getvalue(), self.test_str[:10]) + + def test_type_error_too_many_args(self): + """Make sure TypeError raised if too many args passed to truncate""" + self.spooled_flo.write(self.test_str) + self.assertRaises(TypeError, self.spooled_flo.truncate, 0, 10) + + def test_io_error_negative_truncate(self): + """Make sure IOError raised trying to truncate with negative value""" + self.spooled_flo.write(self.test_str) + self.assertRaises(IOError, self.spooled_flo.truncate, -1) + + def test_compare_different_instances(self): + """Make sure two different instance types are not considered equal""" + a = ioutils.SpooledBytesIO() + a.write(b"I am equal!") + b = ioutils.SpooledStringIO() + b.write("I am equal!") + self.assertNotEqual(a, b) + + def test_compare_unequal_instances(self): + """Comparisons of non-SpooledIOBase classes should fail""" + self.assertNotEqual("Bummer dude", self.spooled_flo) + + def test_set_softspace_attribute(self): + """Ensure softspace attribute can be retrieved and set""" + self.spooled_flo.softspace = True + self.assertTrue(self.spooled_flo.softspace) + + def test_set_softspace_attribute_rolled(self): + """Ensure softspace attribute can be retrieved and set if rolled""" + self.spooled_flo.softspace = True + self.assertTrue(self.spooled_flo.softspace) + self.spooled_flo.rollover() + self.spooled_flo.softspace = True + self.assertTrue(self.spooled_flo.softspace) + + def test_buf_property(self): + """'buf' property returns the same value as getvalue()""" + self.assertEqual(self.spooled_flo.buf, self.spooled_flo.getvalue()) + + def test_pos_property(self): + """'pos' property returns the same value as tell()""" + self.assertEqual(self.spooled_flo.pos, self.spooled_flo.tell()) + + def test_closed_property(self): + """'closed' property works as expected""" + self.assertFalse(self.spooled_flo.closed) + self.spooled_flo.close() + self.assertTrue(self.spooled_flo.closed) + + def test_readline(self): + """Make readline returns expected values""" + self.spooled_flo.write(self.test_str_lines) + self.spooled_flo.seek(0) + self.assertEqual(self.spooled_flo.readline().rstrip(self.linesep), + self.test_str_lines.split(self.linesep)[0]) + + def test_readlines(self): + """Make sure readlines returns expected values""" + self.spooled_flo.write(self.test_str_lines) + self.spooled_flo.seek(0) + self.assertEqual( + [x.rstrip(self.linesep) for x in self.spooled_flo.readlines()], + self.test_str_lines.split(self.linesep) + ) + + def test_next(self): + """Make next returns expected values""" + self.spooled_flo.write(self.test_str_lines) + self.spooled_flo.seek(0) + self.assertEqual(self.spooled_flo.next().rstrip(self.linesep), + self.test_str_lines.split(self.linesep)[0]) + + def test_isatty(self): + """Make sure we can check if the value is a tty""" + # This should simply not fail + self.assertTrue(self.spooled_flo.isatty() is True or + self.spooled_flo.isatty() is False) + + def test_truthy(self): + """Make sure empty instances are still considered truthy""" + self.spooled_flo.seek(0) + self.spooled_flo.truncate() + if not self.spooled_flo: + raise AssertionError("Instance is not truthy") + + def test_instance_check(self): + """Instance checks against IOBase succeed.""" + if not isinstance(self.spooled_flo, io.IOBase): + raise AssertionError(f'{type(self.spooled_flo)} is not an instance of IOBase') + + def test_closed_file_method_valueerrors(self): + """ValueError raised on closed files for certain methods.""" + self.spooled_flo.close() + methods = ( + 'flush', 'isatty', 'pos', 'buf', 'truncate', '__next__', '__iter__', + '__enter__', 'read', 'readline', 'tell', + ) + for method_name in methods: + with self.assertRaises(ValueError): + getattr(self.spooled_flo, method_name)() + + + +class TestSpooledBytesIO(TestCase, BaseTestMixin, AssertionsMixin): + linesep = os.linesep.encode('ascii') + + def setUp(self): + self.spooled_flo = ioutils.SpooledBytesIO() + self.test_str = b"Armado en los EE, UU. para S. P. Richards co.," + self.test_str_lines = ( + f"Text with:{os.linesep}newlines!".encode('ascii') + ) + self.data_type = bytes + + def test_compare_not_equal_instances(self): + """Make sure instances with different values fail == check.""" + a = ioutils.SpooledBytesIO() + a.write(b"I am a!") + b = ioutils.SpooledBytesIO() + b.write(b"I am b!") + self.assertNotEqual(a, b) + + def test_compare_two_equal_instances(self): + """Make sure we can compare instances""" + a = ioutils.SpooledBytesIO() + a.write(b"I am equal!") + b = ioutils.SpooledBytesIO() + b.write(b"I am equal!") + self.assertEqual(a, b) + + def test_auto_rollover(self): + """Make sure file rolls over to disk after max_size reached""" + tmp = ioutils.SpooledBytesIO(max_size=10) + tmp.write(b"The quick brown fox jumped over the lazy dogs.") + self.assertTrue(tmp._rolled) + + def test_use_as_context_mgr(self): + """Make sure SpooledBytesIO can be used as a context manager""" + test_str = b"Armado en los EE, UU. para S. P. Richards co.," + with ioutils.SpooledBytesIO() as f: + f.write(test_str) + self.assertEqual(f.getvalue(), test_str) + + def test_len_no_rollover(self): + """Make sure len works with in-memory flo""" + self.spooled_flo.write(self.test_str) + self.assertEqual(self.spooled_flo.len, len(self.test_str)) + self.assertEqual(len(self.spooled_flo), len(self.test_str)) + + def test_len_rollover(self): + """Make sure len works with on-disk flo""" + self.spooled_flo.write(self.test_str) + self.spooled_flo.rollover() + self.assertEqual(self.spooled_flo.len, len(self.test_str)) + self.assertEqual(len(self.spooled_flo), len(self.test_str)) + + def test_invalid_type(self): + """Ensure TypeError raised when writing unicode to SpooledBytesIO""" + self.assertRaises(TypeError, self.spooled_flo.write, "hi") + + def test_flush_after_rollover(self): + """Make sure we can flush before and after rolling to a real file""" + self.spooled_flo.write(self.test_str) + self.assertIsNone(self.spooled_flo.flush()) + self.spooled_flo.rollover() + self.assertIsNone(self.spooled_flo.flush()) + + def test_zip_compat(self): + """Make sure object is compatible with ZipFile library""" + self.spooled_flo.seek(0) + self.spooled_flo.truncate() + doc = ZipFile(self.spooled_flo, 'w', ZIP_DEFLATED) + doc.writestr("content.txt", "test") + self.assertTrue('content.txt' in doc.namelist()) + doc.close() + + def test_iter(self): + """Make sure iter works as expected""" + self.spooled_flo.write(b"a\nb") + self.spooled_flo.seek(0) + self.assertEqual([x for x in self.spooled_flo], [b"a\n", b"b"]) + + def test_writelines(self): + """An iterable of lines can be written""" + lines = [b"1", b"2", b"3"] + expected = b"123" + self.spooled_flo.writelines(lines) + self.assertEqual(self.spooled_flo.getvalue(), expected) + + +class TestSpooledStringIO(TestCase, BaseTestMixin, AssertionsMixin): + linesep = os.linesep + + def setUp(self): + self.spooled_flo = ioutils.SpooledStringIO() + self.test_str = "Remember kids, always use an emdash: '\u2014'" + self.test_str_lines = f"Text with\u2014{os.linesep}newlines!" + self.data_type = str + + def test_compare_not_equal_instances(self): + """Make sure instances with different values fail == check.""" + a = ioutils.SpooledStringIO() + a.write("I am a!") + b = ioutils.SpooledStringIO() + b.write("I am b!") + self.assertNotEqual(a, b) + + def test_compare_two_equal_instances(self): + """Make sure we can compare instances""" + a = ioutils.SpooledStringIO() + a.write("I am equal!") + b = ioutils.SpooledStringIO() + b.write("I am equal!") + self.assertEqual(a, b) + + def test_auto_rollover(self): + """Make sure file rolls over to disk after max_size reached""" + tmp = ioutils.SpooledStringIO(max_size=10) + tmp.write("The quick brown fox jumped over the lazy dogs.") + self.assertTrue(tmp._rolled) + + def test_use_as_context_mgr(self): + """Make sure SpooledStringIO can be used as a context manager""" + test_str = "Armado en los EE, UU. para S. P. Richards co.," + with ioutils.SpooledStringIO() as f: + f.write(test_str) + self.assertEqual(f.getvalue(), test_str) + + def test_len_no_rollover(self): + """Make sure len property works with in-memory flo""" + self.spooled_flo.write(self.test_str) + self.assertEqual(self.spooled_flo.len, len(self.test_str)) + + def test_len_rollover(self): + """Make sure len property works with on-disk flo""" + self.spooled_flo.write(self.test_str) + self.spooled_flo.rollover() + self.assertEqual(self.spooled_flo.len, len(self.test_str)) + + def test_invalid_type(self): + """Ensure TypeError raised when writing bytes to SpooledStringIO""" + self.assertRaises(TypeError, self.spooled_flo.write, b"hi") + + def test_tell_codepoints(self): + """Verify tell() returns codepoint position, not bytes position""" + self.spooled_flo.write(self.test_str) + self.spooled_flo.seek(0) + self.spooled_flo.read(40) + self.assertEqual(self.spooled_flo.tell(), 40) + self.spooled_flo.seek(10) + self.assertEqual(self.spooled_flo.tell(), 10) + + def test_codepoints_all_enc(self): + """"Test getting read, seek, tell, on various codepoints""" + test_str = "\u2014\u2014\u2014" + self.spooled_flo.write(test_str) + self.spooled_flo.seek(1) + self.assertEqual(self.spooled_flo.read(), "\u2014\u2014") + self.assertEqual(len(self.spooled_flo), len(test_str)) + + def test_seek_codepoints_SEEK_END(self): + """Make sure seek() moves to codepoints relative to file end""" + self.spooled_flo.write(self.test_str) + ret = self.spooled_flo.seek(0, os.SEEK_END) + self.assertEqual(ret, len(self.test_str)) + + def test_seek_codepoints_large_SEEK_END(self): + """Make sure seek() moves to codepoints relative to file end""" + test_str = "".join(random.choice(string.ascii_letters) for + x in range(34000)) + self.spooled_flo.write(test_str) + ret = self.spooled_flo.seek(0, os.SEEK_END) + self.assertEqual(ret, len(test_str)) + + def test_seek_codepoints_SEEK_SET(self): + """Make sure seek() moves to codepoints relative to file start""" + self.spooled_flo.write(self.test_str) + ret = self.spooled_flo.seek(3, os.SEEK_SET) + self.assertEqual(ret, 3) + + def test_seek_codepoints_large_SEEK_SET(self): + """Make sure seek() moves to codepoints relative to file start""" + test_str = "".join(random.choice(string.ascii_letters) for + x in range(34000)) + self.spooled_flo.write(test_str) + ret = self.spooled_flo.seek(33000, os.SEEK_SET) + self.assertEqual(ret, 33000) + + def test_seek_codepoints_SEEK_CUR(self): + """Make sure seek() moves to codepoints relative to current_position""" + test_str = "\u2014\u2014\u2014" + self.spooled_flo.write(test_str) + self.spooled_flo.seek(1) + self.assertEqual(self.spooled_flo.tell(), 1) + ret = self.spooled_flo.seek(2, os.SEEK_CUR) + self.assertEqual(ret, 3) + + def test_seek_codepoints_large_SEEK_CUR(self): + """Make sure seek() moves to codepoints relative to current_position""" + test_str = "".join(random.choice(string.ascii_letters) for + x in range(34000)) + self.spooled_flo.write(test_str) + self.spooled_flo.seek(1) + ret = self.spooled_flo.seek(33000, os.SEEK_CUR) + self.assertEqual(ret, 33001) + + def test_x80_codepoint(self): + """Make sure x80 codepoint doesn't confuse read value""" + test_str = '\x8000' + self.spooled_flo.write(test_str) + self.spooled_flo.seek(0) + self.assertEqual(len(self.spooled_flo.read(2)), 2) + self.assertEqual(self.spooled_flo.read(), '0') + + def test_seek_encoded(self): + """Make sure reading works when bytes exceeds read val""" + test_str = "\u2014\u2014\u2014" + self.spooled_flo.write(test_str) + self.spooled_flo.seek(0) + self.assertEqual(self.spooled_flo.read(3), test_str) + + def test_iter(self): + """Make sure iter works as expected""" + self.spooled_flo.write("a\nb") + self.spooled_flo.seek(0) + self.assertEqual([x for x in self.spooled_flo], ["a\n", "b"]) + + def test_writelines(self): + """An iterable of lines can be written""" + lines = ["1", "2", "3"] + expected = "123" + self.spooled_flo.writelines(lines) + self.assertEqual(self.spooled_flo.getvalue(), expected) + + +class TestMultiFileReader(TestCase): + def test_read_seek_bytes(self): + r = ioutils.MultiFileReader(io.BytesIO(b'narf'), io.BytesIO(b'troz')) + self.assertEqual([b'nar', b'ftr', b'oz'], + list(iter(lambda: r.read(3), b''))) + r.seek(0) + self.assertEqual(b'narftroz', r.read()) + + def test_read_seek_text(self): + r = ioutils.MultiFileReader(io.StringIO('narf'), + io.StringIO('troz')) + self.assertEqual(['nar', 'ftr', 'oz'], + list(iter(lambda: r.read(3), ''))) + r.seek(0) + self.assertEqual('narftroz', r.read()) + + def test_no_mixed_bytes_and_text(self): + self.assertRaises(ValueError, ioutils.MultiFileReader, + io.BytesIO(b'narf'), io.StringIO('troz')) + + def test_open(self): + with open(CUR_FILE_PATH) as f: + r_file_str = f.read() + with open(CUR_FILE_PATH) as f1: + with open(CUR_FILE_PATH) as f2: + mfr = ioutils.MultiFileReader(f1, f2) + r_double_file_str = mfr.read() + + assert r_double_file_str == (r_file_str * 2) + + with open(CUR_FILE_PATH, 'rb') as f: + rb_file_str = f.read() + with open(CUR_FILE_PATH, 'rb') as f1: + with open(CUR_FILE_PATH, 'rb') as f2: + mfr = ioutils.MultiFileReader(f1, f2) + rb_double_file_str = mfr.read() + + assert rb_double_file_str == (rb_file_str * 2) + + utf8_file_str = codecs.open(CUR_FILE_PATH, encoding='utf8').read() + f1, f2 = (codecs.open(CUR_FILE_PATH, encoding='utf8'), + codecs.open(CUR_FILE_PATH, encoding='utf8')) + mfr = ioutils.MultiFileReader(f1, f2) + utf8_double_file_str = mfr.read() + assert utf8_double_file_str == (utf8_file_str * 2) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_iterutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_iterutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f661f68efd104ce45cbf6e9021ddf70f5304173b --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_iterutils.py @@ -0,0 +1,600 @@ +import os + +import pytest + +from boltons.dictutils import OMD +from boltons.iterutils import (first, + pairwise, + pairwise_iter, + windowed, + windowed_iter, + remap, + research, + default_enter, + default_exit, + get_path) +from boltons.namedutils import namedtuple + +CUR_PATH = os.path.abspath(__file__) + +isbool = lambda x: isinstance(x, bool) +isint = lambda x: isinstance(x, int) +odd = lambda x: isint(x) and x % 2 != 0 +even = lambda x: isint(x) and x % 2 == 0 +is_meaning_of_life = lambda x: x == 42 + + +class TestFirst: + def test_empty_iterables(self): + """ + Empty iterables return None. + """ + s = set() + l = [] + assert first(s) is None + assert first(l) is None + + def test_default_value(self): + """ + Empty iterables + a default value return the default value. + """ + s = set() + l = [] + assert first(s, default=42) == 42 + assert first(l, default=3.14) == 3.14 + + l = [0, False, []] + assert first(l, default=3.14) == 3.14 + + def test_selection(self): + """ + Success cases with and without a key function. + """ + l = [(), 0, False, 3, []] + + assert first(l, default=42) == 3 + assert first(l, key=isint) == 0 + assert first(l, key=isbool) is False + assert first(l, key=odd) == 3 + assert first(l, key=even) == 0 + assert first(l, key=is_meaning_of_life) is None + + +class TestRemap: + # TODO: test namedtuples and other immutable containers + + def test_basic_clone(self): + orig = {"a": "b", "c": [1, 2]} + assert orig == remap(orig) + + orig2 = [{1: 2}, {"a": "b", "c": [1, 2, {"cat": "dog"}]}] + assert orig2 == remap(orig2) + + def test_empty(self): + assert [] == remap([]) + assert {} == remap({}) + assert set() == remap(set()) + + def test_unremappable(self): + obj = object() + with pytest.raises(TypeError): + remap(obj) + + def test_basic_upper(self): + orig = {'a': 1, 'b': object(), 'c': {'d': set()}} + remapped = remap(orig, lambda p, k, v: (k.upper(), v)) + assert orig['a'] == remapped['A'] + assert orig['b'] == remapped['B'] + assert orig['c']['d'] == remapped['C']['D'] + + def test_item_drop(self): + orig = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + even_items = remap(orig, lambda p, k, v: not (v % 2)) + assert even_items == [0, 2, 4, 6, 8] + + def test_noncallables(self): + with pytest.raises(TypeError): + remap([], visit='test') + with pytest.raises(TypeError): + remap([], enter='test') + with pytest.raises(TypeError): + remap([], exit='test') + + def test_sub_selfref(self): + coll = [0, 1, 2, 3] + sub = [] + sub.append(sub) + coll.append(sub) + with pytest.raises(RuntimeError): + # if equal, should recurse infinitely + assert coll == remap(coll) + + def test_root_selfref(self): + selfref = [0, 1, 2, 3] + selfref.append(selfref) + with pytest.raises(RuntimeError): + assert selfref == remap(selfref) + + selfref2 = {} + selfref2['self'] = selfref2 + with pytest.raises(RuntimeError): + assert selfref2 == remap(selfref2) + + def test_duperef(self): + val = ['hello'] + duperef = [val, val] + remapped = remap(duperef) + assert remapped[0] is remapped[1] + assert remapped[0] is not duperef[0] + + def test_namedtuple(self): + """TODO: this fails right now because namedtuples' __new__ is + overridden to accept arguments. remap's default_enter tries + to create an empty namedtuple and gets a TypeError. + + Could make it so that immutable types actually don't create a + blank new parent and instead use the old_parent as a + placeholder, creating a new one at exit-time from the value's + __class__ (how default_exit works now). But even then it would + have to *args in the values, as namedtuple constructors don't + take an iterable. + """ + + Point = namedtuple('Point', 'x y') + point_map = {'origin': [Point(0, 0)]} + + with pytest.raises(TypeError): + remapped = remap(point_map) + assert isinstance(remapped['origin'][0], Point) + + def test_path(self): + path_map = {} + + # test visit's path + target_str = 'test' + orig = [[[target_str]]] + ref_path = (0, 0, 0) + + def visit(path, key, value): + if value is target_str: + path_map['target_str'] = path + (key,) + return key, value + + remapped = remap(orig, visit=visit) + + assert remapped == orig + assert path_map['target_str'] == ref_path + + # test enter's path + target_obj = object() + orig = {'a': {'b': {'c': {'d': ['e', target_obj, 'f']}}}} + ref_path = ('a', 'b', 'c', 'd', 1) + + def enter(path, key, value): + if value is target_obj: + path_map['target_obj'] = path + (key,) + return default_enter(path, key, value) + + remapped = remap(orig, enter=enter) + + assert remapped == orig + assert path_map['target_obj'] == ref_path + + # test exit's path + target_set = frozenset([1, 7, 3, 8]) + orig = [0, 1, 2, [3, 4, [5, target_set]]] + ref_path = (3, 2, 1) + + def exit(path, key, old_parent, new_parent, new_items): + if old_parent is target_set: + path_map['target_set'] = path + (key,) + return default_exit(path, key, old_parent, new_parent, new_items) + + remapped = remap(orig, exit=exit) + + assert remapped == orig + assert path_map['target_set'] == ref_path + + def test_reraise_visit(self): + root = {'A': 'b', 1: 2} + key_to_lower = lambda p, k, v: (k.lower(), v) + with pytest.raises(AttributeError): + remap(root, key_to_lower) + + remapped = remap(root, key_to_lower, reraise_visit=False) + assert remapped['a'] == 'b' + assert remapped[1] == 2 + + def test_drop_nones(self): + orig = {'a': 1, 'b': None, 'c': [3, None, 4, None]} + ref = {'a': 1, 'c': [3, 4]} + drop_none = lambda p, k, v: v is not None + remapped = remap(orig, visit=drop_none) + assert remapped == ref + + orig = [None] * 100 + remapped = remap(orig, drop_none) + assert not remapped + + def test_dict_to_omd(self): + def enter(path, key, value): + if isinstance(value, dict): + return OMD(), sorted(value.items()) + return default_enter(path, key, value) + + orig = [{'title': 'Wild Palms', + 'ratings': {1: 1, 2: 3, 3: 5, 4: 6, 5: 3}}, + {'title': 'Twin Peaks', + 'ratings': {1: 3, 2: 2, 3: 8, 4: 12, 5: 15}}] + remapped = remap(orig, enter=enter) + assert remapped == orig + + assert isinstance(remapped[0], OMD) + assert isinstance(remapped[0]['ratings'], OMD) + assert isinstance(remapped[1], OMD) + assert isinstance(remapped[1]['ratings'], OMD) + + def test_sort_all_lists(self): + def exit(path, key, old_parent, new_parent, new_items): + # NB: in this case, I'd normally use *a, **kw + ret = default_exit(path, key, old_parent, new_parent, new_items) + if isinstance(ret, list): + ret.sort() + return ret + + # NB: Airplane model numbers (Boeing and Airbus) + orig = [[[7, 0, 7], + [7, 2, 7], + [7, 7, 7], + [7, 3, 7]], + [[3, 8, 0], + [3, 2, 0], + [3, 1, 9], + [3, 5, 0]]] + ref = [[[0, 2, 3], + [0, 3, 5], + [0, 3, 8], + [1, 3, 9]], + [[0, 7, 7], + [2, 7, 7], + [3, 7, 7], + [7, 7, 7]]] + + remapped = remap(orig, exit=exit) + assert remapped == ref + + def test_collector_pattern(self): + all_interests = set() + + def enter(path, key, value): + try: + all_interests.update(value['interests']) + except: + pass + return default_enter(path, key, value) + + orig = [{'name': 'Kate', + 'interests': ['theater', 'manga'], + 'dads': [{'name': 'Chris', + 'interests': ['biking', 'python']}]}, + {'name': 'Avery', + 'interests': ['museums', 'pears'], + 'dads': [{'name': 'Kurt', + 'interests': ['python', 'recursion']}]}] + + ref = {'python', 'recursion', 'biking', 'museums', + 'pears', 'theater', 'manga'} + + remap(orig, enter=enter) + assert all_interests == ref + + def test_add_length(self): + def exit(path, key, old_parent, new_parent, new_items): + ret = default_exit(path, key, old_parent, new_parent, new_items) + try: + ret['review_length'] = len(ret['review']) + except: + pass + return ret + + orig = {'Star Trek': + {'TNG': {'stars': 10, + 'review': "Episodic AND deep. <3 Data."}, + 'DS9': {'stars': 8.5, + 'review': "Like TNG, but with a story and no Data."}, + 'ENT': {'stars': None, + 'review': "Can't review what you can't watch."}}, + 'Babylon 5': {'stars': 6, + 'review': "Sophomoric, like a bitter laugh."}, + 'Dr. Who': {'stars': None, + 'review': "800 episodes is too many to review."}} + remapped = remap(orig, exit=exit) + assert (remapped['Star Trek']['TNG']['review_length'] + < remapped['Star Trek']['DS9']['review_length']) + + def test_prepop(self): + """Demonstrating normalization and ID addition through prepopulating + the objects with an enter callback. + """ + base_obj = {'name': None, + 'rank': None, + 'id': 1} + + def enter(path, key, value): + new_parent, new_items = default_enter(path, key, value) + try: + new_parent.update(base_obj) + base_obj['id'] += 1 + except: + pass + return new_parent, new_items + + orig = [{'name': 'Firefox', 'rank': 1}, + {'name': 'Chrome', 'rank': 2}, + {'name': 'IE'}] + ref = [{'name': 'Firefox', 'rank': 1, 'id': 1}, + {'name': 'Chrome', 'rank': 2, 'id': 2}, + {'name': 'IE', 'rank': None, 'id': 3}] + remapped = remap(orig, enter=enter) + assert remapped == ref + + def test_remap_set(self): + # explicit test for sets to make sure #84 is covered + s = {1, 2, 3} + assert remap(s) == s + + fs = frozenset([1, 2, 3]) + assert remap(fs) == fs + + def test_remap_file(self): + with open(CUR_PATH, 'rb') as f: + x = {'a': [1, 2, 3], 'f': [f]} + assert remap(x) == x + + f.read() + assert remap(x) == x + + f.close() # see #146 + assert remap(x) == x + return + + +class TestGetPath: + def test_depth_one(self): + root = ['test'] + assert get_path(root, (0,)) == 'test' + assert get_path(root, '0') == 'test' + + root = {'key': 'value'} + assert get_path(root, ('key',)) == 'value' + assert get_path(root, 'key') == 'value' + + def test_depth_two(self): + root = {'key': ['test']} + assert get_path(root, ('key', 0)) == 'test' + assert get_path(root, 'key.0') == 'test' + + +def test_research(): + root = {} + + with pytest.raises(TypeError): + research(root, query=None) + + root = {'a': 'a'} + res = research(root, query=lambda p, k, v: v == 'a') + assert len(res) == 1 + assert res[0] == (('a',), 'a') + + def broken_query(p, k, v): + raise RuntimeError() + + with pytest.raises(RuntimeError): + research(root, broken_query, reraise=True) + + # empty results with default, reraise=False + assert research(root, broken_query) == [] + + +def test_research_custom_enter(): + # see #368 + from types import SimpleNamespace as NS + root = NS( + a='a', + b='b', + c=NS(aa='aa') ) + + def query(path, key, value): + return value.startswith('a') + + def custom_enter(path, key, value): + if isinstance(value, NS): + return [], value.__dict__.items() + return default_enter(path, key, value) + + with pytest.raises(TypeError): + research(root, query) + assert research(root, query, enter=custom_enter) == [(('a',), 'a'), (('c', 'aa'), 'aa')] + + + +def test_backoff_basic(): + from boltons.iterutils import backoff + + assert backoff(1, 16) == [1.0, 2.0, 4.0, 8.0, 16.0] + assert backoff(1, 1) == [1.0] + assert backoff(2, 15) == [2.0, 4.0, 8.0, 15.0] + + +def test_backoff_repeat(): + from boltons.iterutils import backoff_iter + + fives = [] + for val in backoff_iter(5, 5, count='repeat'): + fives.append(val) + if len(fives) >= 1000: + break + assert fives == [5] * 1000 + + +def test_backoff_zero_start(): + from boltons.iterutils import backoff + + assert backoff(0, 16) == [0.0, 1.0, 2.0, 4.0, 8.0, 16.0] + assert backoff(0, 15) == [0.0, 1.0, 2.0, 4.0, 8.0, 15.0] + + slow_backoff = [round(x, 2) for x in backoff(0, 2.9, factor=1.2)] + assert slow_backoff == [0.0, 1.0, 1.2, 1.44, 1.73, 2.07, 2.49, 2.9] + + +def test_backoff_validation(): + from boltons.iterutils import backoff + + with pytest.raises(ValueError): + backoff(8, 2) + with pytest.raises(ValueError): + backoff(1, 0) + with pytest.raises(ValueError): + backoff(-1, 10) + with pytest.raises(ValueError): + backoff(2, 8, factor=0) + with pytest.raises(ValueError): + backoff(2, 8, jitter=20) + + +def test_backoff_jitter(): + from boltons.iterutils import backoff + + start, stop = 1, 256 + + unjittered = backoff(start, stop) + jittered = backoff(start, stop, jitter=True) + + assert len(unjittered) == len(jittered) + assert [u >= j for u, j in zip(unjittered, jittered)] + + neg_jittered = backoff(start, stop, jitter=-0.01) + + assert len(unjittered) == len(neg_jittered) + assert [u <= j for u, j in zip(unjittered, neg_jittered)] + + o_jittered = backoff(start, stop, jitter=-0.0) + assert len(unjittered) == len(o_jittered) + assert [u == j for u, j in zip(unjittered, o_jittered)] + + nonconst_jittered = backoff(stop, stop, count=5, jitter=True) + assert len(nonconst_jittered) == 5 + # no two should be equal realistically + assert len(set(nonconst_jittered)) == 5 + + +def test_guiderator(): + import string + from boltons.iterutils import GUIDerator + + guid_iter = GUIDerator() + + guid = next(guid_iter) + assert guid + assert len(guid) == guid_iter.size + assert all([c in string.hexdigits for c in guid]) + + guid2 = next(guid_iter) + + assert guid != guid2 + + # custom size + guid_iter = GUIDerator(size=26) + assert len(next(guid_iter)) == 26 + + +def test_seqguiderator(): + import string + from boltons.iterutils import SequentialGUIDerator as GUIDerator + + guid_iter = GUIDerator() + + guid = next(guid_iter) + assert guid + assert len(guid) == guid_iter.size + assert all([c in string.hexdigits for c in guid]) + + guid2 = next(guid_iter) + + assert guid != guid2 + + # custom size + for x in range(10000): + guid_iter = GUIDerator(size=26) + assert len(next(guid_iter)) == 26 + + +def test_chunked_bytes(): + # see #231 + from boltons.iterutils import chunked + + assert chunked(b'123', 2) in (['12', '3'], [b'12', b'3']) + + +def test_chunk_ranges(): + from boltons.iterutils import chunk_ranges + + assert list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5)) == [(10, 15), (15, 20)] + assert list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5, overlap_size=1)) == [(10, 15), (14, 19), (18, 20)] + assert list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5, overlap_size=2)) == [(10, 15), (13, 18), (16, 20)] + + assert list(chunk_ranges(input_offset=4, input_size=15, chunk_size=5, align=False)) == [(4, 9), (9, 14), (14, 19)] + assert list(chunk_ranges(input_offset=4, input_size=15, chunk_size=5, align=True)) == [(4, 5), (5, 10), (10, 15), (15, 19)] + + assert list(chunk_ranges(input_offset=2, input_size=15, chunk_size=5, overlap_size=1, align=False)) == [(2, 7), (6, 11), (10, 15), (14, 17)] + assert list(chunk_ranges(input_offset=2, input_size=15, chunk_size=5, overlap_size=1, align=True)) == [(2, 5), (4, 9), (8, 13), (12, 17)] + assert list(chunk_ranges(input_offset=3, input_size=15, chunk_size=5, overlap_size=1, align=True)) == [(3, 5), (4, 9), (8, 13), (12, 17), (16, 18)] + assert list(chunk_ranges(input_offset=3, input_size=2, chunk_size=5, overlap_size=1, align=True)) == [(3, 5)] + + +def test_lstrip(): + from boltons.iterutils import lstrip + + assert lstrip([0,1,0,2,0,3,0],0) == [1,0,2,0,3,0] + assert lstrip([0,0,0,1,0,2,0,3,0],0) == [1,0,2,0,3,0] + assert lstrip([]) == [] + + + +def test_rstrip(): + from boltons.iterutils import rstrip + + assert rstrip([0,1,0,2,0,3,0],0) == [0,1,0,2,0,3] + assert rstrip([0,1,0,2,0,3,0,0,0],0) == [0,1,0,2,0,3] + assert rstrip([]) == [] + + +def test_strip(): + from boltons.iterutils import strip + + assert strip([0,1,0,2,0,3,0],0) == [1,0,2,0,3] + assert strip([0,0,0,1,0,2,0,3,0,0,0],0) == [1,0,2,0,3] + assert strip([]) == [] + + +def test_pairwise_filled(): + assert pairwise(range(4)) == [(0, 1), (1, 2), (2, 3)] + assert pairwise(range(4), end=None) == [(0, 1), (1, 2), (2, 3), (3, None)] + + assert pairwise([]) == [] + assert pairwise([1], end=None) == [(1, None)] + + assert list(pairwise_iter(range(4))) == [(0, 1), (1, 2), (2, 3)] + assert list(pairwise_iter(range(4), end=None)) == [(0, 1), (1, 2), (2, 3), (3, None)] + + +def test_windowed_filled(): + assert windowed(range(4), 3) == [(0, 1, 2), (1, 2, 3)] + assert windowed(range(4), 3, fill=None) == [(0, 1, 2), (1, 2, 3), (2, 3, None), (3, None, None)] + + assert windowed([], 3) == [] + assert windowed([], 3, fill=None) == [] + assert windowed([1, 2], 3, fill=None) == [(1, 2, None), (2, None, None)] + + assert list(windowed_iter(range(4), 3)) == [(0, 1, 2), (1, 2, 3)] + assert list(windowed_iter(range(4), 3, fill=None)) == [(0, 1, 2), (1, 2, 3), (2, 3, None), (3, None, None)] diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_jsonutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_jsonutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f8840b9b726d13b473ba0b19a0f84ce3141b06a2 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_jsonutils.py @@ -0,0 +1,39 @@ +import os + +from boltons.jsonutils import (JSONLIterator, + DEFAULT_BLOCKSIZE, + reverse_iter_lines) + +CUR_PATH = os.path.dirname(os.path.abspath(__file__)) +NEWLINES_DATA_PATH = CUR_PATH + '/newlines_test_data.txt' +JSONL_DATA_PATH = CUR_PATH + '/jsonl_test_data.txt' + + +def _test_reverse_iter_lines(filename, blocksize=DEFAULT_BLOCKSIZE): + fo = open(filename) + reference = fo.read() + fo.seek(0, os.SEEK_SET) + rev_lines = list(reverse_iter_lines(fo, blocksize)) + assert '\n'.join(rev_lines[::-1]) == reference + + +def _test_reverse_iter_lines_bytes(filename, blocksize=DEFAULT_BLOCKSIZE): + fo = open(filename, 'rb') + reference = fo.read() + fo.seek(0, os.SEEK_SET) + rev_lines = list(reverse_iter_lines(fo, blocksize)) + assert os.linesep.encode('ascii').join(rev_lines[::-1]) == reference + + + +def test_reverse_iter_lines(): + for blocksize in (2, 4, 16, 4096): + _test_reverse_iter_lines(NEWLINES_DATA_PATH, blocksize) + _test_reverse_iter_lines_bytes(NEWLINES_DATA_PATH, blocksize) + + +def test_jsonl_iterator(): + ref = [{'4': 4}, {'3': 3}, {'2': 2}, {'1': 1}, {}] + jsonl_iter = JSONLIterator(open(JSONL_DATA_PATH), reverse=True) + jsonl_list = list(jsonl_iter) + assert jsonl_list == ref diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_listutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_listutils.py new file mode 100644 index 0000000000000000000000000000000000000000..8fe5514fc3016909aaa04a498fc58f17017c3e16 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_listutils.py @@ -0,0 +1,123 @@ +import sys + +from boltons.listutils import SplayList, BarrelList + + +def test_splay_list(): + splay = SplayList(range(10)) + splay.swap(0, 9) + assert splay[0] == 9 + assert splay[-1] == 0 + + splay.shift(-2) + assert splay[0] == 8 + assert splay[-1] == 0 + assert len(splay) == 10 + + +def test_barrel_list(): + bl = BarrelList() + bl.insert(0, 0) + assert bl[0] == 0 + assert len(bl) == 1 + bl.insert(1, 1) + assert list(bl) == [0, 1] + bl.insert(0, -1) + assert list(bl) == [-1, 0, 1] + bl.extend(range(int(1e5))) + assert len(bl) == (1e5 + 3) + bl._balance_list(0) + assert len(bl) == (1e5 + 3) + bl.pop(50000) + assert len(bl) == (1e5 + 3 - 1) + + bl2 = BarrelList(TEST_INTS) + bl2.sort() + assert list(bl2[:5]) == [0, 74, 80, 96, 150] + assert list(bl2[:-5:-1]) == [50508, 46607, 46428, 43442] + + # a hundred thousand integers + bl3 = BarrelList(range(int(1e5))) + for i in range(10000): + # move the middle ten thou to the beginning + bl3.insert(0, bl3.pop(len(bl3) // 2)) + assert len(bl3) == 1e5 # length didn't change + assert bl3[0] == 40001 # first value changed as expected + assert bl3[-1] == sorted(bl3)[-1] # last value didn't change + + del bl3[10:5000] + assert bl3[0] == 40001 + assert len(bl3) == 1e5 - (5000 - 10) # length stayed co + bl3[:20:2] = range(0, -10, -1) + assert bl3[6] == -3 # some truly tricky stepping/slicing works + +# roughly increasing random integers +# [ord(i) * x for i, x in zip(os.urandom(1024), range(1024))] +TEST_INTS = [0, 74, 96, 183, 456, 150, 1098, 665, 1752, 1053, 190, + 561, 2244, 2964, 2534, 750, 80, 612, 3780, 2698, 1320, + 4935, 5324, 3220, 672, 2925, 6474, 6507, 3892, 4814, + 1470, 6913, 6112, 6072, 7854, 8540, 4212, 7770, 8702, + 1404, 2240, 902, 5250, 10320, 9680, 8775, 2392, 11327, + 10368, 8085, 7750, 9333, 8008, 11395, 6858, 8690, 14112, + 5358, 13572, 3304, 9000, 11712, 1426, 12033, 11136, + 10270, 10626, 11189, 7208, 966, 9380, 16614, 10368, + 11680, 8214, 16350, 4712, 5082, 13572, 15879, 6800, 8667, + 17548, 9628, 3360, 19550, 1634, 20619, 1232, 17978, + 22950, 10829, 5612, 22692, 10058, 21375, 19680, 5626, + 15582, 18216, 2200, 20402, 24174, 3090, 19864, 2520, + 15794, 18511, 4212, 18530, 8470, 7992, 5152, 4294, 456, + 6095, 26564, 9477, 14042, 7259, 14520, 28677, 9394, 5289, + 7812, 1625, 17514, 7493, 24704, 903, 33150, 1834, 11352, + 20615, 32562, 540, 6256, 12878, 276, 17236, 6300, 25380, + 9088, 27742, 4752, 33930, 7008, 22491, 7992, 2831, 34200, + 18271, 22648, 6426, 15862, 26660, 29484, 2826, 14378, + 26553, 16000, 18998, 28998, 16626, 19024, 22275, 18426, + 21042, 29064, 30927, 26010, 14193, 9976, 30621, 12354, + 33600, 40832, 20178, 20292, 12709, 26640, 29865, 23660, + 20862, 34592, 28305, 24180, 38709, 18800, 11907, 28120, + 34189, 4992, 8106, 14938, 6435, 12936, 31914, 1782, 995, + 9800, 28542, 22018, 27608, 30396, 28700, 26986, 50508, + 5616, 46607, 2310, 41356, 26712, 8733, 43442, 33755, + 21384, 40145, 26160, 46428, 30360] + + +test_barrel_list() + +if __name__ == '__main__': + _TUNE_SETUP = """\ +from boltons.listutils import BarrelList +bl = BarrelList() +bl._size_factor = %s +bl.extend(range(int(%s))) +""" + + def tune(): + from collections import defaultdict + import gc + from timeit import timeit + data_size = 1e5 + old_size_factor = size_factor = 512 + all_times = defaultdict(list) + min_times = {} + step = 512 + while abs(step) > 4: + gc.collect() + for x in range(3): + tottime = timeit('bl.insert(0, bl.pop(len(bl)//2))', + _TUNE_SETUP % (size_factor, data_size), + number=10000) + all_times[size_factor].append(tottime) + min_time = round(min(all_times[size_factor]), 3) + min_times[size_factor] = min_time + print(size_factor, min_time, step) + if min_time > (min_times[old_size_factor] + 0.002): + step = -step // 2 + old_size_factor = size_factor + size_factor += step + print(tottime) + + try: + tune() # main() + except Exception as e: + import pdb;pdb.post_mortem() + raise diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_mathutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_mathutils.py new file mode 100644 index 0000000000000000000000000000000000000000..4187a6bbe1bab6e83b185da3914f05b0099103ca --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_mathutils.py @@ -0,0 +1,112 @@ +from pytest import raises +from boltons.mathutils import clamp, ceil, floor, Bits +import math + +INF, NAN = float('inf'), float('nan') + +OPTIONS = [1618, 1378, 166, 1521, 2347, 2016, 879, 2123, + 269.3, 1230, 66, 425.2, 250, 2399, 2314, 439, + 247, 208, 379, 1861] +OPTIONS_SORTED = sorted(OPTIONS) +OUT_OF_RANGE_LOWER = 60 +OUT_OF_RANGE_UPPER = 2500 +VALID_LOWER = 247 +VALID_UPPER = 2314 +VALID_BETWEEN = 248.5 + +def test_clamp_examples(): + """some examples for clamp()""" + assert 0 == clamp(0, 0, 1) == clamp(-1, 0, 1) + assert 0 == clamp(-1, lower=0) + assert 1 == clamp(1, 0, 1) == clamp(5, 0, 1) + assert 1 == clamp(5, upper=1) + assert 0.5 == clamp(7, upper=0.5) + assert 1 == clamp(7.7, upper=1) + +def test_clamp_transparent(): + """clamp(x) should equal x because both limits are omitted""" + assert clamp(0) == 0 + assert clamp(1) == 1 + assert clamp(10**100) == 10**100 + assert clamp(INF) == INF + assert clamp(-INF) == -INF + assert math.isnan(clamp(NAN)) + + +def test_ceil_basic(): + assert ceil(VALID_LOWER, OPTIONS) == VALID_LOWER + assert ceil(VALID_UPPER, OPTIONS) == VALID_UPPER + assert ceil(VALID_BETWEEN, OPTIONS) == 250 + + +def test_ceil_sorted(): + assert ceil(VALID_LOWER, OPTIONS) == ceil(VALID_LOWER, OPTIONS_SORTED) + assert ceil(VALID_UPPER, OPTIONS) == ceil(VALID_UPPER, OPTIONS_SORTED) + assert ceil(VALID_BETWEEN, OPTIONS) == ceil(VALID_BETWEEN, OPTIONS_SORTED) + + +def test_ceil_oor_lower(): + assert min(OPTIONS) == ceil(OUT_OF_RANGE_LOWER, OPTIONS) + + +def test_ceil_oor_upper(): + with raises(ValueError): + ceil(OUT_OF_RANGE_UPPER, OPTIONS) + + +def test_floor_basic(): + assert floor(VALID_LOWER, OPTIONS) == VALID_LOWER + assert floor(VALID_UPPER, OPTIONS) == VALID_UPPER + assert floor(VALID_LOWER, OPTIONS) == 247 + + +def test_floor_sorted(): + assert floor(VALID_LOWER, OPTIONS) == floor(VALID_LOWER, OPTIONS_SORTED) + assert floor(VALID_UPPER, OPTIONS) == floor(VALID_UPPER, OPTIONS_SORTED) + assert floor(VALID_BETWEEN, OPTIONS) == floor(VALID_BETWEEN, OPTIONS_SORTED) + + +def test_floor_oor_upper(): + assert max(OPTIONS) == floor(OUT_OF_RANGE_UPPER, OPTIONS) + + +def test_floor_oor_lower(): + with raises(ValueError): + floor(OUT_OF_RANGE_LOWER, OPTIONS) + + +def test_bits(): + def chk(a, b): + assert a == b, a + chk(Bits('10')[:1], Bits('1')) + chk(Bits('10')[1:], Bits('0')) + chk(Bits('10')[0], True) + chk(Bits('10')[1], False) + chk(Bits('0000100')[4], True) + chk(Bits('10').as_list(), [True, False]) + chk(Bits('10').as_int(), 2) + chk(Bits('10').as_bin(), '10') + chk(Bits('1111').as_hex(), '0F') + chk(Bits('10'), Bits([True, False])) + chk(Bits('10'), Bits(2)) + chk(Bits('01') | Bits('10'), Bits('11')) + chk(Bits('01') & Bits('10'), Bits('00')) + chk(Bits('11') >> 1, Bits('1')) + chk(Bits('1') << 1, Bits('10')) + assert Bits('0') != Bits('00') + # test roundtrip as_/from_hex + chk(Bits.from_hex(Bits('10101010').as_hex()), + Bits('10101010')) + # test roundtrip as_/from_bytes + chk( + Bits.from_bytes(Bits('10101010').as_bytes()), + Bits('10101010')) + # pile of roundtripping + chk(Bits.from_int( + Bits.from_bin( + Bits.from_list( + Bits('101').as_list() + ).as_bin() + ).as_int() + ), + Bits('101')) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_namedutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_namedutils.py new file mode 100644 index 0000000000000000000000000000000000000000..e2230a7be169a40e6beea144a2825122fb1ef0e3 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_namedutils.py @@ -0,0 +1,26 @@ +from pickle import loads, dumps + +from boltons.namedutils import namedlist, namedtuple + +Point = namedtuple('Point', 'x, y', rename=True) +MutablePoint = namedlist('MutablePoint', 'x, y', rename=True) + + +def test_namedlist(): + p = MutablePoint(x=10, y=20) + + assert p == [10, 20] + p[0] = 11 + assert p == [11, 20] + p.x = 12 + assert p == [12, 20] + + +def test_namedlist_pickle(): + p = MutablePoint(x=10, y=20) + assert p == loads(dumps(p)) + + +def test_namedtuple_pickle(): + p = Point(x=10, y=20) + assert p == loads(dumps(p)) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_queueutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_queueutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f75fe46a49e1bc46c744ff41aa4eed70380a34a8 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_queueutils.py @@ -0,0 +1,50 @@ +from boltons.queueutils import SortedPriorityQueue, HeapPriorityQueue + + +def _test_priority_queue(queue_type): + pq = queue_type() + item1 = 'a' + item2 = 'b' + item3 = 'c' + pq.add(item1) + pq.remove(item1) + + # integer priorities + pq.add(item1, 2) + pq.add(item2, 9) + pq.add(item3, 7) + assert len(pq) == 3 + assert item2 == pq.pop() + assert len(pq) == 2 + assert item3 == pq.pop() + assert len(pq) == 1 + assert item1 == pq.pop() + assert len(pq) == 0 + + # float priorities + pq.add(item1, 0.2) + pq.add(item2, 0.9) + pq.add(item3, 0.7) + assert len(pq) == 3 + assert item2 == pq.pop() + assert len(pq) == 2 + assert item3 == pq.pop() + assert len(pq) == 1 + assert item1 == pq.pop() + assert len(pq) == 0 + + try: + pq.pop() + except IndexError: + pass + else: + assert False, 'priority queue should be empty' + return + + +def test_heap_queue(): + _test_priority_queue(HeapPriorityQueue) + + +def test_sorted_queue(): + _test_priority_queue(SortedPriorityQueue) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_setutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_setutils.py new file mode 100644 index 0000000000000000000000000000000000000000..b095ea7bdc6db656050209db7b4385210259ecdd --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_setutils.py @@ -0,0 +1,205 @@ +from pytest import raises + +from boltons.setutils import IndexedSet, _MISSING, complement + + +def test_indexed_set_basic(): + zero2nine = IndexedSet(range(10)) + five2nine = zero2nine & IndexedSet(range(5, 15)) + x = IndexedSet(five2nine) + x |= {10} + + assert list(zero2nine) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + assert set(zero2nine) == {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} + assert list(five2nine) == [5, 6, 7, 8, 9] + assert x == IndexedSet([5, 6, 7, 8, 9, 10]) + assert x[-1] == 10 + + assert zero2nine ^ five2nine == IndexedSet([0, 1, 2, 3, 4]) + + assert x[:3] == IndexedSet([5, 6, 7]) + assert x[2:4:-1] == IndexedSet([8, 7]) + + +def test_indexed_set_rsub(): + "From #252" + assert (set('abc') - IndexedSet('bcd')) == {'a'} + assert (IndexedSet('abc') - IndexedSet('bcd')) == IndexedSet(['a']) + assert (frozenset('abc') - IndexedSet('bcd')) == frozenset(['a']) + + +def test_indexed_set_mutate(): + thou = IndexedSet(range(1000)) + assert (thou.pop(), thou.pop()) == (999, 998) + assert (thou.pop(499), thou.pop(499)) == (499, 500) + + ref = [495, 496, 497, 498, 501, 502, 503, 504, 505, 506] + assert [thou[i] for i in range(495, 505)] == ref + + assert len(thou) == 996 + while len(thou) > 600: + dead_idx_len = len(thou.dead_indices) + dead_idx_count = thou._dead_index_count + thou.pop(0) + new_dead_idx_len = len(thou.dead_indices) + if new_dead_idx_len < dead_idx_len: + assert dead_idx_count > 0 + # 124, 109, 95 + assert len(thou) == 600 + assert thou._dead_index_count == 67 + + assert not any([thou[i] is _MISSING for i in range(len(thou))]) + + thou &= IndexedSet(range(500, 503)) + + assert thou == IndexedSet([501, 502]) + return + + +def big_popper(): + # more of a benchmark than a test + from os import urandom + import time + big_set = IndexedSet(range(100000)) + rands = [ord(r) for r in urandom(len(big_set))] + start_time, start_size = time.time(), len(big_set) + while len(big_set) > 10000: + if len(big_set) % 10000 == 0: + print(len(big_set) / 10000) + rand = rands.pop() + big_set.pop(rand) + big_set.pop(-rand) + end_time, end_size = time.time(), len(big_set) + print() + print('popped {} items in {} seconds'.format(start_size - end_size, + end_time - start_time)) + + +def test_complement_set(): + '''exercises a bunch of code-paths but doesn't really confirm math identities''' + assert complement(complement(set())) == set() + sab = set('ab') + sbc = set('bc') + cab = complement('ab') + cbc = complement('bc') + cc = complement('c') + sc = set('c') + u = complement(set()) + assert repr(sab) in repr(cab) + # non-mutating tests + assert cab != cbc + assert complement(cab) == sab + assert complement(cbc) == sbc + assert 'a' not in cab + assert 'c' in cab + assert (sab & cbc) == (sab - sbc) # set theory invariant + assert not (cab < sab) # complement never subset of set + assert not (sab < cab) + assert not (cbc < sab) + assert not (cbc < cab) # not subsets of each other + assert sab < cc + assert cab < (cab | cbc) + assert (cab | cbc) > cab + assert cc > sab + assert not (cab > sab) + assert not cab.isdisjoint(cc) # complements never disjoint + assert cab.isdisjoint(sab) + assert not cab.isdisjoint(sc) + assert (cab | sab) == u + assert (cab | cc) == u + assert (cab | cbc) == complement('b') + assert (sab | cab) == (cbc | sbc) + assert (sab & cab) == (cbc & sbc) + assert (sab ^ cab) == (cbc ^ sbc) + assert cab - cc == sc + assert cab - sab == cab + assert sab - cab == sab + assert (cab ^ cbc | set('b')) == (sab | sbc) + everything = complement(frozenset()) + assert everything in everything # https://en.wikipedia.org/wiki/Russell%27s_paradox + assert bool(cab) + assert not complement(u) + # destructive testing + cab ^= sab + cab ^= sab + cab &= sab + cab &= cbc + cab |= sab + cab |= cbc + cab -= sab + cab.add(5) + cab.remove(5) + cab.update(sab) + cab.discard(sab) + cab.update(cbc) + cab.add(complement(frozenset())) # frozen complement can be a member of complement set + assert len({complement(frozenset()): 1, complement(frozenset()): 2}) == 1 # hash works + with raises(NotImplementedError): cab.pop() + with raises(NotImplementedError): len(cab) + with raises(NotImplementedError): iter(cab) + ~cab + cab.complement() + cab.complemented() + class OpOverloader: + # tests that operators properly return NotImplemented so they will defer to + # another class implementation if available + def __and__(self, other): return self + __rand__ = __iand__ = __or__ = __ror__ = __ior__ = __xor__ = __rxor__ = __sub__ = __isub__ = __and__ + def __le__(self, other): return True + __lt__ = __ge__ = __gt__ = __le__ + + ops = OpOverloader() + def opsmash(a, b): + a &= b; a |= b; a -= b; a ^= b + a > b; a >= b; a < b; a <= b + return (((a & b) | b) - b) ^ b + + with raises(TypeError): opsmash(cab, object()) + assert opsmash(ops, cab) == ops + assert opsmash(cab, ops) == ops + + +def test_iset_index_method(): + original_list = list(range(8, 20)) + list(range(8)) + + indexed_list = IndexedSet() + + for i in original_list: + indexed_list.add(i) + + for i in original_list: + index = indexed_list.index(i) + # if we're removing them in order, the target value should always be at index 0 + assert index == 0 + indexed_list.pop(index) + + indexed_list = IndexedSet(range(10)) + + for i in reversed(range(10)): + if i % 2: + continue + index = indexed_list.index(i) + assert i == indexed_list.pop(index) + + + indexed_list = IndexedSet(range(32)) + + for i in list(indexed_list): + if i % 3: + index = indexed_list.index(i) + assert i == indexed_list.pop(index) + + indexed_list = IndexedSet(range(10)) + + for i in range(10): + if i < 3: + continue + index = indexed_list.index(i) + assert i == indexed_list.pop(index) + + indexed_list = IndexedSet(range(32)) + + for i in list(indexed_list): + if i % 3: + index = indexed_list.index(i) + assert i == indexed_list.pop(index) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_socketutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_socketutils.py new file mode 100644 index 0000000000000000000000000000000000000000..d85cc83b80d63b1b47c95e4885b53c9f0760a03d --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_socketutils.py @@ -0,0 +1,425 @@ +import sys +import time +import errno +import socket +import threading +from boltons.socketutils import (BufferedSocket, + NetstringSocket, + ConnectionClosed, + NetstringMessageTooLong, + MessageTooLong, + Timeout) + +import pytest + +# skip if there's no socketpair +pytestmark = pytest.mark.skipif(getattr(socket, 'socketpair', None) is None, + reason='no socketpair (likely Py2 on Windows)') + + +def test_short_lines(): + for ms in (2, 4, 6, 1024, None): + x, y = socket.socketpair() + bs = BufferedSocket(x) + y.sendall(b'1\n2\n3\n') + assert bs.recv_until(b'\n', maxsize=ms) == b'1' + assert bs.recv_until(b'\n', maxsize=ms) == b'2' + y.close() + assert bs.recv_close(maxsize=ms) == b'3\n' + + try: + bs.recv_size(1) + except ConnectionClosed: + pass + else: + assert False, 'expected ConnectionClosed' + + bs.close() + return + + +def test_multibyte_delim(): + """Primarily tests recv_until with various maxsizes and True/False + for with_delimiter. + """ + + delim = b'\r\n' + for with_delim in (True, False): + if with_delim: + cond_delim = b'\r\n' + else: + cond_delim = b'' + + empty = b'' + small_one = b'1' + big_two = b'2' * 2048 + for ms in (3, 5, 1024, None): + x, y = socket.socketpair() + bs = BufferedSocket(x) + + y.sendall(empty + delim) + y.sendall(small_one + delim) + y.sendall(big_two + delim) + + kwargs = {'maxsize': ms, 'with_delimiter': with_delim} + assert bs.recv_until(delim, **kwargs) == empty + cond_delim + assert bs.recv_until(delim, **kwargs) == small_one + cond_delim + try: + assert bs.recv_until(delim, **kwargs) == big_two + cond_delim + except MessageTooLong: + if ms is None: + assert False, 'unexpected MessageTooLong' + else: + if ms is not None: + assert False, 'expected MessageTooLong' + + return + + +def test_props(): + x, y = socket.socketpair() + bs = BufferedSocket(x) + + assert bs.type == x.type + assert bs.proto == x.proto + assert bs.family == x.family + return + + +def test_buffers(): + x, y = socket.socketpair() + bx, by = BufferedSocket(x), BufferedSocket(y) + + assert by.getrecvbuffer() == b'' + assert by.getsendbuffer() == b'' + + assert bx.getrecvbuffer() == b'' + + by.buffer(b'12') + by.sendall(b'3') + assert bx.recv_size(1) == b'1' + + assert bx.getrecvbuffer() == b'23' + + return + + +def test_client_disconnecting(): + def get_bs_pair(): + x, y = socket.socketpair() + bx, by = BufferedSocket(x), BufferedSocket(y) + + # sanity check + by.sendall(b'123') + bx.recv_size(3) == b'123' + + return bx, by + + bx, by = get_bs_pair() + assert bx.fileno() > 0 + + bx.close() + assert bx.getrecvbuffer() == b'' + + try: + bx.recv(1) + except OSError: + pass + else: + assert False, 'expected socket.error on closed recv' + + assert bx.fileno() == -1 + + by.buffer(b'123') + assert by.getsendbuffer() + try: + by.flush() + except OSError: + assert by.getsendbuffer() == b'123' + else: + if sys.platform != 'win32': # Windows socketpairs are kind of bad + assert False, 'expected socket.error broken pipe' + + try: + by.shutdown(socket.SHUT_RDWR) + except OSError: + # Mac sockets are already shut down at this point. See #71. + if sys.platform != 'darwin': + raise + + by.close() + assert not by.getsendbuffer() + + try: + by.send(b'123') + except OSError: + pass + else: + assert False, 'expected socket.error on closed send' + + return + + +def test_split_delim(): + delim = b'\r\n' + first = b'1234\r' + second = b'\n5' + + x, y = socket.socketpair() + bs = BufferedSocket(x) + + y.sendall(first) + try: + bs.recv_until(delim, timeout=0.0001) + except Timeout: + pass + y.sendall(second) + + assert bs.recv_until(delim, with_delimiter=True) == b'1234\r\n' + assert bs.recv_size(1) == b'5' + return + + +def test_basic_nonblocking(): + delim = b'\n' + + # test with per-call timeout + x, y = socket.socketpair() + bs = BufferedSocket(x) + + try: + bs.recv_until(delim, timeout=0) + except OSError as se: + assert se.errno == errno.EWOULDBLOCK + y.sendall(delim) # sending an empty message, effectively + assert bs.recv_until(delim) == b'' + + # test with instance-level default timeout + x, y = socket.socketpair() + bs = BufferedSocket(x, timeout=0) + + try: + bs.recv_until(delim) + except OSError as se: + assert se.errno == errno.EWOULDBLOCK + y.sendall(delim) + assert bs.recv_until(delim) == b'' + + # test with setblocking(0) on the underlying socket + x, y = socket.socketpair() + x.setblocking(0) + bs = BufferedSocket(x) + + try: + bs.recv_until(delim) + except OSError as se: + assert se.errno == errno.EWOULDBLOCK + y.sendall(delim) + assert bs.recv_until(delim) == b'' + + return + + +def test_simple_buffered_socket_passthroughs(): + x, y = socket.socketpair() + bs = BufferedSocket(x) + + assert bs.getsockname() == x.getsockname() + assert bs.getpeername() == x.getpeername() + + +def test_timeout_setters_getters(): + x, y = socket.socketpair() + bs = BufferedSocket(x) + + assert bs.settimeout(1.0) is None + assert bs.gettimeout() == 1.0 + + assert bs.setblocking(False) is None + assert bs.gettimeout() == 0.0 + + assert bs.setblocking(True) is None + assert bs.gettimeout() is None + + +def netstring_server(server_socket): + "A basic netstring server loop, supporting a few operations" + try: + while True: + clientsock, addr = server_socket.accept() + client = NetstringSocket(clientsock) + while 1: + request = client.read_ns() + if request == b'close': + clientsock.close() + break + elif request == b'shutdown': + return + elif request == b'reply4k': + client.write_ns(b'a' * 4096) + elif request == b'ping': + client.write_ns(b'pong') + elif request == b'reply128k': + client.setmaxsize(128 * 1024) + client.write_ns(b'huge' * 32 * 1024) # 128kb + client.setmaxsize(32768) # back to default + except Exception as e: + print('netstring_server exiting with error: %r' % e) + raise + + +def test_socketutils_netstring(): + """A holistic feature test of BufferedSocket via the NetstringSocket + wrapper. Runs + """ + print("running self tests") + + # Set up server + server_socket = socket.socket() + server_socket.bind(('127.0.0.1', 0)) # localhost with ephemeral port + server_socket.listen(100) + ip, port = server_socket.getsockname() + start_server = lambda: netstring_server(server_socket) + threading.Thread(target=start_server).start() + + # set up client + def client_connect(): + clientsock = socket.create_connection((ip, port)) + client = NetstringSocket(clientsock) + return client + + # connect, ping-pong + client = client_connect() + client.write_ns(b'ping') + assert client.read_ns() == b'pong' + s = time.time() + for i in range(1000): + client.write_ns(b'ping') + assert client.read_ns() == b'pong' + dur = time.time() - s + print("netstring ping-pong latency", dur, "ms") + + s = time.time() + for i in range(1000): + client.write_ns(b'ping') + resps = [] + for i in range(1000): + resps.append(client.read_ns()) + e = time.time() + assert all([r == b'pong' for r in resps]) + assert client.bsock.getrecvbuffer() == b'' + dur = e - s + print("netstring pipelined ping-pong latency", dur, "ms") + + # tell the server to close the socket and then try a failure case + client.write_ns(b'close') + try: + client.read_ns() + raise Exception('read from closed socket') + except ConnectionClosed: + print("raised ConnectionClosed correctly") + + # test big messages + client = client_connect() + client.setmaxsize(128 * 1024) + client.write_ns(b'reply128k') + res = client.read_ns() + assert len(res) == (128 * 1024) + client.write_ns(b'close') + + # test that read timeouts work + client = client_connect() + client.settimeout(0.1) + try: + client.read_ns() + raise Exception('did not timeout') + except Timeout: + print("read_ns raised timeout correctly") + client.write_ns(b'close') + + # test that netstring max sizes work + client = client_connect() + client.setmaxsize(2048) + client.write_ns(b'reply4k') + try: + client.read_ns() + raise Exception('read more than maxsize') + except NetstringMessageTooLong: + print("raised MessageTooLong correctly") + try: + client.bsock.recv_until(b'b', maxsize=4096) + raise Exception('recv_until did not raise MessageTooLong') + except MessageTooLong: + print("raised MessageTooLong correctly") + assert client.bsock.recv_size(4097) == b'a' * 4096 + b',' + print('correctly maintained buffer after exception raised') + + # test BufferedSocket read timeouts with recv_until and recv_size + client.bsock.settimeout(0.01) + try: + client.bsock.recv_until(b'a') + raise Exception('recv_until did not raise Timeout') + except Timeout: + print('recv_until correctly raised Timeout') + try: + client.bsock.recv_size(1) + raise Exception('recv_size did not raise Timeout') + except Timeout: + print('recv_size correctly raised Timeout') + + client.write_ns(b'shutdown') + print("all passed") + + +def netstring_server_timeout_override(server_socket): + """Netstring socket has an unreasonably low timeout, + however it should be overridden by the `read_ns` argument.""" + + try: + while True: + clientsock, addr = server_socket.accept() + client = NetstringSocket(clientsock, timeout=0.01) + while 1: + request = client.read_ns(1) + if request == b'close': + clientsock.close() + break + elif request == b'shutdown': + return + elif request == b'ping': + client.write_ns(b'pong') + except Exception as e: + print('netstring_server exiting with error: %r' % e) + raise + + +def test_socketutils_netstring_timeout(): + """Tests that server socket timeout is overridden by the argument to read call. + + Server has timeout of 10 ms, and we will sleep for 20 ms. If timeout is not overridden correctly, + a timeout exception will be raised.""" + + print("running timeout test") + + # Set up server + server_socket = socket.socket() + server_socket.bind(('127.0.0.1', 0)) # localhost with ephemeral port + server_socket.listen(100) + ip, port = server_socket.getsockname() + start_server = lambda: netstring_server_timeout_override(server_socket) + threading.Thread(target=start_server).start() + + # set up client + def client_connect(): + clientsock = socket.create_connection((ip, port)) + client = NetstringSocket(clientsock) + return client + + # connect, ping-pong + client = client_connect() + time.sleep(0.02) + client.write_ns(b'ping') + assert client.read_ns() == b'pong' + + client.write_ns(b'shutdown') + print("no timeout occurred - all good.") \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_statsutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_statsutils.py new file mode 100644 index 0000000000000000000000000000000000000000..c04a045eda4a3971874ea55e48a6311150139682 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_statsutils.py @@ -0,0 +1,32 @@ +from boltons.statsutils import Stats + + +def test_stats_basic(): + da = Stats(range(20)) + assert da.mean == 9.5 + assert round(da.std_dev, 2) == 5.77 + assert da.variance == 33.25 + assert da.skewness == 0 + assert round(da.kurtosis, 1) == 1.9 + assert da.median == 9.5 + + +def _test_pearson(): + import random + from statsutils import pearson_type + + def get_pt(dist): + vals = [dist() for x in range(10000)] + pt = pearson_type(vals) + return pt + + for x in range(3): + # pt = get_pt(dist=lambda: random.normalvariate(15, 5)) # expect 0, normal + # pt = get_pt(dist=lambda: random.weibullvariate(2, 3)) # gets 1, beta, weibull not specifically supported + # pt = get_pt(dist=lambda: random.gammavariate(2, 3)) # expect 3, gamma + # pt = get_pt(dist=lambda: random.betavariate(2, 3)) # expect 1, beta + # pt = get_pt(dist=lambda: random.expovariate(0.2)) # expect 3, beta + pt = get_pt(dist=lambda: random.uniform(0.0, 10.0)) # gets 2 + print('pearson type:', pt) + + # import pdb;pdb.set_trace() diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_statsutils_histogram.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_statsutils_histogram.py new file mode 100644 index 0000000000000000000000000000000000000000..b0b310f172ec46e1f52347d270b18b61ad7551ab --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_statsutils_histogram.py @@ -0,0 +1,103 @@ +from boltons.statsutils import Stats + + +# [round(random.normalvariate(10, 3), 3) for i in range(100)] +NORM_DATA = [12.975, 8.341, 12.27, 12.799, 15.443, 6.739, 10.572, + 14.863, 3.723, 9.825, 7.716, 12.218, 11.641, 9.02, + 13.037, 11.175, 13.156, 11.706, 8.184, 13.306, 9.845, + 11.665, 14.298, 12.021, 8.419, 10.209, 10.698, 6.559, + 10.346, 9.895, 11.742, 13.391, 10.587, 6.639, 10.23, + 8.841, 10.511, 6.033, 5.767, 8.482, 9.517, 9.039, 11.111, + 13.845, 4.331, 5.323, 14.486, 14.875, 10.005, 6.367, + 12.18, 11.69, 13.97, 4.14, 7.979, 11.114, 4.126, 10.028, + 9.295, 10.078, 14.615, 7.055, 7.641, 9.037, 9.933, + 10.077, 14.174, 14.645, 10.398, 10.238, 9.067, 4.841, + 13.159, 15.829, 8.464, 7.47, 11.858, 9.885, 11.978, + 5.418, 12.19, 8.206, 10.755, 6.455, 10.019, 11.594, + 9.082, 10.245, 12.321, 8.508, 9.711, 5.5, 15.001, 9.922, + 7.864, 7.794, 10.546, 9.203, 8.798, 9.853] + + +SIMPLE_RANGE_DATA = range(110) + +LAYER_RANGE_DATA = (list(range(100)) + + list(range(20, 80)) + + list(range(40, 60))) + +EMPTY_DATA = [] + +ALL_DATASETS = [EMPTY_DATA, LAYER_RANGE_DATA, SIMPLE_RANGE_DATA, NORM_DATA] + + +def test_check_sum(): + for data in ALL_DATASETS: + for bin_size in [0, 1, 10, 99]: + # bin_size=0 tests freedman + stats = Stats(data) + hist_counts = stats.get_histogram_counts() + hist_counts_sum = sum([c for _, c in hist_counts]) + assert len(data) == hist_counts_sum + if not data: + continue + + assert min(data) >= hist_counts[0][0] + assert max(data) >= hist_counts[-1][0] + return + + +def test_norm_regression(): + stats = Stats(NORM_DATA) + + assert stats.format_histogram(width=80) == NORM_DATA_FREEDMAN_OUTPUT + assert stats.format_histogram(10, width=80) == NORM_DATA_TEN_BIN_OUTPUT + + subpar_bin_out = stats.format_histogram([12.0], width=80) + assert subpar_bin_out == NORM_DATA_SINGLE_SUBPAR_BIN_OUTPUT + + format_bin_out = stats.format_histogram(5, + width=80, + format_bin=lambda b: '%sms' % b) + assert format_bin_out == NORM_DATA_FORMAT_BIN_OUTPUT + + +NORM_DATA_FREEDMAN_OUTPUT = """\ + 3.7: 5 ################ + 5.2: 10 ################################ + 6.8: 9 ############################# + 8.3: 21 ################################################################### + 9.9: 22 ###################################################################### +11.4: 16 ################################################### +13.0: 10 ################################ +14.5: 7 ######################""" + +NORM_DATA_TEN_BIN_OUTPUT = """\ + 3.7: 5 ############## + 4.9: 5 ############## + 6.1: 6 ################# + 7.3: 12 ################################## + 8.5: 11 ############################### + 9.7: 25 ###################################################################### +10.9: 12 ################################## +12.1: 12 ################################## +13.4: 5 ############## +14.6: 7 ####################""" + +# make sure the minimum gets added +NORM_DATA_SINGLE_SUBPAR_BIN_OUTPUT = """\ + 3.7: 75 ###################################################################### +12.0: 25 #######################""" + +NORM_DATA_FORMAT_BIN_OUTPUT = """\ + 3.7ms: 10 ################### + 6.1ms: 18 ################################## + 8.5ms: 36 #################################################################### +10.9ms: 24 ############################################# +13.4ms: 12 #######################""" + + +def main(): + print(Stats(NORM_DATA).format_histogram(10)) + + +if __name__ == '__main__': + main() diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_strutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_strutils.py new file mode 100644 index 0000000000000000000000000000000000000000..41ee50eb68d2aa58edea94d22ae2ee9a2b439953 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_strutils.py @@ -0,0 +1,149 @@ +import re +import uuid +from unittest import TestCase + +from boltons import strutils + + +def test_strip_ansi(): + assert strutils.strip_ansi( + '\x1b[0m\x1b[1;36mart\x1b[46;34m\xdc') == 'art\xdc' + assert strutils.strip_ansi( + '\x1b[0m\x1b[1;36mart\x1b[46;34m\xdc') == 'artÜ' + assert strutils.strip_ansi( + '╒══════╕\n│ \x1b[1mCell\x1b[0m │\n╘══════╛') == ( + '╒══════╕\n' + '│ Cell │\n' + '╘══════╛') + assert strutils.strip_ansi( + 'ls\r\n\x1B[00m\x1b[01;31mfile.zip\x1b[00m\r\n\x1b[01;31m') == \ + 'ls\r\nfile.zip\r\n' + assert strutils.strip_ansi( + '\t\u001b[0;35mIP\u001b[0m\t\u001b[0;36m192.1.0.2\u001b[0m') == \ + '\tIP\t192.1.0.2' + assert strutils.strip_ansi('(╯°□°)╯︵ \x1b[1m┻━┻\x1b[0m') == ( + '(╯°□°)╯︵ ┻━┻') + assert strutils.strip_ansi('(╯°□°)╯︵ \x1b[1m┻━┻\x1b[0m') == ( + '(╯°□°)╯︵ ┻━┻') + assert strutils.strip_ansi( + b'(\xe2\x95\xaf\xc2\xb0\xe2\x96\xa1\xc2\xb0)\xe2\x95\xaf\xef\xb8' + b'\xb5 \x1b[1m\xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb\x1b[0m') == ( + b'(\xe2\x95\xaf\xc2\xb0\xe2\x96\xa1\xc2\xb0)\xe2\x95\xaf\xef\xb8' + b'\xb5 \xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb') + assert strutils.strip_ansi( + bytearray('(╯°□°)╯︵ \x1b[1m┻━┻\x1b[0m', 'utf-8')) == \ + bytearray( + b'(\xe2\x95\xaf\xc2\xb0\xe2\x96\xa1\xc2\xb0)\xe2\x95\xaf\xef\xb8' + b'\xb5 \xe2\x94\xbb\xe2\x94\x81\xe2\x94\xbb') + + +def test_asciify(): + ref = 'Beyoncé' + b = strutils.asciify(ref) + assert len(b) == len(b) + assert b[-1:].decode('ascii') == 'e' + + +def test_indent(): + to_indent = '\nabc\ndef\n\nxyz\n' + ref = '\n abc\n def\n\n xyz\n' + assert strutils.indent(to_indent, ' ') == ref + + +def test_is_uuid(): + assert strutils.is_uuid(uuid.uuid4()) == True + assert strutils.is_uuid(uuid.uuid4(), version=1) == False + assert strutils.is_uuid(str(uuid.uuid4())) == True + assert strutils.is_uuid(str(uuid.uuid4()), version=1) == False + assert strutils.is_uuid(set('garbage')) == False + + +def test_parse_int_list(): + assert strutils.parse_int_list("1,3,5-8,10-11,15") == [1, 3, 5, 6, 7, 8, 10, 11, 15] + + assert strutils.parse_int_list("1,3,5-8,10-11,15,") == [1, 3, 5, 6, 7, 8, 10, 11, 15] + assert strutils.parse_int_list(",1,3,5-8,10-11,15") == [1, 3, 5, 6, 7, 8, 10, 11, 15] + assert strutils.parse_int_list(" 1, 3 ,5-8,10-11,15 ") == [1, 3, 5, 6, 7, 8, 10, 11, 15] + assert strutils.parse_int_list("3,1,5-8,10-11,15") == [1, 3, 5, 6, 7, 8, 10, 11, 15] + + assert strutils.parse_int_list("5-8") == [5, 6, 7, 8] + assert strutils.parse_int_list("8-5") == [5, 6, 7, 8] + +def test_format_int_list(): + assert strutils.format_int_list([1, 3, 5, 6, 7, 8, 10, 11, 15]) == '1,3,5-8,10-11,15' + assert strutils.format_int_list([5, 6, 7, 8]) == '5-8' + + assert strutils.format_int_list([1, 3, 5, 6, 7, 8, 10, 11, 15], delim_space=True) == '1, 3, 5-8, 10-11, 15' + assert strutils.format_int_list([5, 6, 7, 8], delim_space=True) == '5-8' + + +class TestMultiReplace(TestCase): + + def test_simple_substitutions(self): + """Test replacing multiple values.""" + m = strutils.MultiReplace({r'cat': 'kedi', r'purple': 'mor', }) + self.assertEqual(m.sub('The cat is purple'), 'The kedi is mor') + + def test_shortcut_function(self): + """Test replacing multiple values.""" + self.assertEqual( + strutils.multi_replace( + 'The cat is purple', + {r'cat': 'kedi', r'purple': 'mor', } + ), + 'The kedi is mor' + ) + + def test_substitutions_in_word(self): + """Test replacing multiple values that are substrings of a word.""" + m = strutils.MultiReplace({r'cat': 'kedi', r'purple': 'mor', }) + self.assertEqual(m.sub('Thecatispurple'), 'Thekediismor') + + def test_sub_with_regex(self): + """Test substitutions with a regular expression.""" + m = strutils.MultiReplace({ + r'cat': 'kedi', + r'purple': 'mor', + r'q\w+?t': 'dinglehopper' + }, regex=True) + self.assertEqual( + m.sub('The purple cat ate a quart of jelly'), + 'The mor kedi ate a dinglehopper of jelly' + ) + + def test_sub_with_list(self): + """Test substitutions from an iterable instead of a dictionary.""" + m = strutils.MultiReplace([ + (r'cat', 'kedi'), + (r'purple', 'mor'), + (r'q\w+?t', 'dinglehopper'), + ], regex=True) + self.assertEqual( + m.sub('The purple cat ate a quart of jelly'), + 'The mor kedi ate a dinglehopper of jelly' + ) + + def test_sub_with_compiled_regex(self): + """Test substitutions where some regular expressiosn are compiled.""" + exp = re.compile(r'q\w+?t') + m = strutils.MultiReplace([ + (r'cat', 'kedi'), + (r'purple', 'mor'), + (exp, 'dinglehopper'), + ]) + self.assertEqual( + m.sub('The purple cat ate a quart of jelly'), + 'The mor kedi ate a dinglehopper of jelly' + ) + + def test_substitutions_with_regex_chars(self): + """Test replacing values that have special regex characters.""" + m = strutils.MultiReplace({'cat.+': 'kedi', r'purple': 'mor', }) + self.assertEqual(m.sub('The cat.+ is purple'), 'The kedi is mor') + + +def test_roundzip(): + aaa = b'a' * 10000 + assert strutils.gunzip_bytes(strutils.gzip_bytes(aaa)) == aaa + + assert strutils.gunzip_bytes(strutils.gzip_bytes(b'')) == b'' diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tableutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tableutils.py new file mode 100644 index 0000000000000000000000000000000000000000..4524386aa4b2aab2e1868cb39a379bc85ec36809 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tableutils.py @@ -0,0 +1,54 @@ +from boltons.tableutils import Table + + +def test_table_lists(): + data_lists = [['id', 'name'], + [1, 'John Doe'], + [2, 'Dale Simmons']] + t1 = Table(data_lists) + assert set(t1.headers) == {'id', 'name'} + assert len(t1) == 2 + assert 'John Doe' in repr(t1) + +T2_REF_HTML = """ + + +
id1
nameJohn Doe
""" + +T3_REF_HTML = """ + + + + + + + + + +
idname
1John Doe
2Dale Simmons
3Kurt Rose
4None
""" + + +def test_table_dicts(): + data_dicts = [{'id': 1, 'name': 'John Doe'}, + {'id': 2, 'name': 'Dale Simmons'}] + t2 = Table.from_dict(data_dicts[0]) + t3 = Table.from_dict(data_dicts) + t3.extend([[3, 'Kurt Rose'], [4]]) + + assert set(t2.headers) == {'id', 'name'} + assert len(t2) == 1 + # the sorted() stuff handles ordering differences between versions + # TODO: should maybe change Table to sort the headers of dicts and such? + assert sorted(t2.to_html()) == sorted(T2_REF_HTML) + assert sorted(t3.to_html()) == sorted(T3_REF_HTML) + assert t3.to_text() + + +def test_table_obj(): + class TestType: + def __init__(self): + self.greeting = 'hi' + + t4 = Table.from_object(TestType()) + assert len(t4) == 1 + assert 'greeting' in t4.headers diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tbutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tbutils.py new file mode 100644 index 0000000000000000000000000000000000000000..3948aab6d488ae3356b202d652bfe9cadfd97dd1 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tbutils.py @@ -0,0 +1,104 @@ +import json +import sys +from io import StringIO + +from boltons.tbutils import (TracebackInfo, + ExceptionInfo, + print_exception, + fix_print_exception, + ContextualCallpoint, + ContextualExceptionInfo) + + + +def test_exception_info(): + # test ExceptionInfo and TracebackInfo and hooks, via StringIOs + builtin_exc_hook = sys.excepthook + fix_print_exception() + tbi_str = '' + + def test(): + raise ValueError('yay fun') + + fake_stderr1 = StringIO() + fake_stderr2 = StringIO() + sys.stderr = fake_stderr1 + + try: + test() + except: + exc, _, exc_traceback = sys.exc_info() + tbi = TracebackInfo.from_traceback(exc_traceback) + exc_info = ExceptionInfo.from_exc_info(*sys.exc_info()) + exc_info2 = ExceptionInfo.from_current() + tbi_str = str(tbi) + print_exception(*sys.exc_info(), file=fake_stderr2) + new_exc_hook_res = fake_stderr2.getvalue() + builtin_exc_hook(*sys.exc_info()) + builtin_exc_hook_res = fake_stderr1.getvalue() + finally: + sys.stderr = sys.__stderr__ + + # Single frame + single_frame_str = tbi.frames[-1].tb_frame_str() + assert 'in test' in single_frame_str + assert 'yay fun' in single_frame_str + + # Traceback info + assert len(tbi_str.splitlines()) == 5 + assert 'yay fun' in tbi_str + + # Full except hook output + assert 'ValueError: yay fun' in new_exc_hook_res + assert "ValueError('yay fun')" in new_exc_hook_res + assert len(new_exc_hook_res) > len(tbi_str) + + if sys.version_info <= (3, 12): + # output diverges with Python 3.13+, see https://github.com/mahmoud/boltons/issues/365 + # TLDR tbutils only has minimal handling for anchors (e.g., ~~~~^^) + assert new_exc_hook_res == builtin_exc_hook_res + + +def test_contextual(): + def func1(): + return func2() + def func2(): + x = 5 + return func3() + def func3(): + return ContextualCallpoint.from_current(level=2) + + callpoint = func1() + assert callpoint.func_name == 'func2' + line = str(callpoint.line) + assert line.startswith(' ') + assert line.strip() == 'return func3()' + assert 'func2' in repr(callpoint) + + try: + json.dumps(callpoint.to_dict()) + except TypeError: + raise AssertionError("to_dict result is not JSON serializable") + + def func_a(): + a = 1 + raise Exception('func_a exception') + def func_b(): + b = 2 + return func_a() + def func_c(): + c = 3 + return func_b() + + try: + func_c() + except Exception as e: + ctx_ei = ContextualExceptionInfo.from_current() + ctx_ei_str = ctx_ei.get_formatted() + + ctx_ei_lines = ctx_ei_str.splitlines() + assert ctx_ei_lines[-1] == 'Exception: func_a exception' + assert ctx_ei_lines[0] == 'Traceback (most recent call last):' + assert len(ctx_ei_lines) == 10 + assert "Exception('func_a exception')" in ctx_ei_str + assert ctx_ei.tb_info.frames[2].local_reprs['b'] == '2' diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tbutils_parsed_exc.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tbutils_parsed_exc.py new file mode 100644 index 0000000000000000000000000000000000000000..6927832dba6ae3b2b2c84d352089f4c41043c643 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_tbutils_parsed_exc.py @@ -0,0 +1,82 @@ +from boltons.tbutils import ParsedException + + +def test_parsed_exc_basic(): + _tb_str = """\ +Traceback (most recent call last): + File "example.py", line 2, in + plarp +NameError: name 'plarp' is not defined""" + + parsed_tb = ParsedException.from_string(_tb_str) + print(parsed_tb) + assert parsed_tb.exc_type == 'NameError' + assert parsed_tb.exc_msg == "name 'plarp' is not defined" + assert parsed_tb.frames == [{'source_line': 'plarp', + 'filepath': 'example.py', + 'lineno': '2', + 'funcname': ''}] + + assert parsed_tb.to_string() == _tb_str + + +def test_parsed_exc_nosrcline(): + """just making sure that everything can be parsed even if there is + a line without source and also if the exception has no message""" + + _tb_str = """\ +Traceback (most recent call last): + File "/home/mahmoud/virtualenvs/chert/bin/chert", line 9, in + load_entry_point('chert==0.2.1.dev0', 'console_scripts', 'chert')() + File "/home/mahmoud/projects/chert/chert/core.py", line 1281, in main + ch.process() + File "/home/mahmoud/projects/chert/chert/core.py", line 741, in process + self.load() + File "", line 2, in load + File "/home/mahmoud/projects/lithoxyl/lithoxyl/logger.py", line 291, in logged_func + return func_to_log(*a, **kw) + File "/home/mahmoud/projects/chert/chert/core.py", line 775, in load + raise RuntimeError +RuntimeError""" + + parsed_tb = ParsedException.from_string(_tb_str) + + assert parsed_tb.exc_type == 'RuntimeError' + assert parsed_tb.exc_msg == '' + + assert len(parsed_tb.frames) == 6 + assert parsed_tb.frames[3] == {'source_line': '', + 'filepath': '', + 'lineno': '2', + 'funcname': 'load'} + assert parsed_tb.to_string() == _tb_str + +def test_parsed_exc_with_anchor(): + """parse a traceback with anchor lines beneath source lines""" + _tb_str = """\ +Traceback (most recent call last): + File "main.py", line 3, in + print(add(1, "two")) + ^^^^^^^^^^^^^ + File "add.py", line 2, in add + return a + b + ~~^~~ +TypeError: unsupported operand type(s) for +: 'int' and 'str'""" + + parsed_tb = ParsedException.from_string(_tb_str) + + assert parsed_tb.exc_type == 'TypeError' + assert parsed_tb.exc_msg == "unsupported operand type(s) for +: 'int' and 'str'" + assert parsed_tb.frames == [{'source_line': 'print(add(1, "two"))', + 'filepath': 'main.py', + 'lineno': '3', + 'funcname': ''}, + {'source_line': 'return a + b', + 'filepath': 'add.py', + 'lineno': '2', + 'funcname': 'add'}] + + # Note: not checking the anchor lines (indices 3, 6) because column details not currently stored in ParsedException + _tb_str_lines = _tb_str.splitlines() + _tb_str_without_anchor = "\n".join(_tb_str_lines[:3] + _tb_str_lines[4:6] + _tb_str_lines[7:]) + assert parsed_tb.to_string() == _tb_str_without_anchor \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_timeutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_timeutils.py new file mode 100644 index 0000000000000000000000000000000000000000..b30fdf321964cb40e128a44a65ce574a3b6c6d70 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_timeutils.py @@ -0,0 +1,58 @@ +from datetime import timedelta, date + +import pytest + +from boltons.timeutils import daterange + + +def test_daterange_years(): + new_year = date(2017, 1, 1) + bit_rollover = date(2038, 1, 19) + + new_years_remaining = daterange(new_year, bit_rollover, step=(1, 0, 0)) + assert len(list(new_years_remaining)) == 22 + + y2025 = date(2025, 1, 1) + bakers_years_til_2025 = list(daterange(new_year, y2025, step=(1, 1, 0))) + assert len(bakers_years_til_2025) == 8 + assert bakers_years_til_2025[-1] == date(2024, 8, 1) + assert bakers_years_til_2025[-1] == date(2024, 8, 1) + + years_from_2025 = list(daterange(y2025, new_year, step=(-1, 0, 0), + inclusive=True)) + + assert years_from_2025[0] == date(2025, 1, 1) + assert years_from_2025[-1] == date(2017, 1, 1) + + +def test_daterange_years_step(): + start_day = date(year=2012, month=12, day=25) + end_day = date(year=2016, month=1, day=1) + dates = list(daterange(start_day, end_day, step=(1, 0, 0), inclusive=False)) + expected = [date(year=2012, month=12, day=25), date(year=2013, month=12, day=25), date(year=2014, month=12, day=25), date(year=2015, month=12, day=25)] + + assert dates == expected + + dates = list(daterange(start_day, end_day, step=(0, 13, 0), inclusive=False)) + expected = [date(year=2012, month=12, day=25), date(year=2014, month=1, day=25), date(year=2015, month=2, day=25)] + assert dates == expected + + +def test_daterange_infinite(): + today = date.today() + infinite_dates = daterange(today, None) + for i in range(10): + assert next(infinite_dates) == today + timedelta(days=i) + + +def test_daterange_with_same_start_stop(): + today = date.today() + + date_range = daterange(today, today) + with pytest.raises(StopIteration): + next(date_range) + + date_range_inclusive = daterange(today, today, inclusive=True) + assert next(date_range_inclusive) == today + with pytest.raises(StopIteration): + next(date_range_inclusive) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_typeutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_typeutils.py new file mode 100644 index 0000000000000000000000000000000000000000..68c5fe98ea6c80be2549b14a08e254f069e43484 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_typeutils.py @@ -0,0 +1,18 @@ +import copy +import pickle + +from boltons.typeutils import make_sentinel + +NOT_SET = make_sentinel('not_set', var_name='NOT_SET') + +def test_sentinel_falsiness(): + assert not NOT_SET + + +def test_sentinel_pickle(): + assert pickle.dumps(NOT_SET) + +def test_sentinel_copy(): + test = make_sentinel('test') + assert test is copy.copy(test) + assert test is copy.deepcopy(test) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_urlutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_urlutils.py new file mode 100644 index 0000000000000000000000000000000000000000..d25701ec692c6c383b3e359bbd7081982a1928e7 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tests/test_urlutils.py @@ -0,0 +1,478 @@ +import pytest + +from boltons import urlutils +from boltons.urlutils import URL, _URL_RE, find_all_links + + +# fully quoted urls that should round trip +TEST_URLS = [ + 'http://googlewebsite.com/e-shops.aspx', + 'http://example.com:8080/search?q=123&business=Nothing%20Special', + 'http://hatnote.com:9000?arg=1&arg=2&arg=3', + 'https://xn--bcher-kva.ch', + 'http://xn--ggbla1c4e.xn--ngbc5azd/', + 'http://tools.ietf.org/html/rfc3986#section-3.4', + 'http://wiki:pedia@hatnote.com', + 'ftp://ftp.rfc-editor.org/in-notes/tar/RFCs0001-0500.tar.gz', + 'http://[1080:0:0:0:8:800:200C:417A]/index.html', + 'ssh://192.0.2.16:2222/', + 'https://[::101.45.75.219]:80/?hi=bye', + 'ldap://[::192.9.5.5]/dc=example,dc=com??sub?(sn=Jensen)', + 'mailto:me@example.com?to=me@example.com&body=hi%20http://wikipedia.org', + 'news:alt.rec.motorcycle', + 'tel:+1-800-867-5309', + 'urn:oasis:member:A00024:x', + ('magnet:?xt=urn:btih:1a42b9e04e122b97a5254e3df77ab3c4b7da725f&dn=Puppy%' + '20Linux%20precise-5.7.1.iso&tr=udp://tracker.openbittorrent.com:80&' + 'tr=udp://tracker.publicbt.com:80&tr=udp://tracker.istole.it:6969&' + 'tr=udp://tracker.ccc.de:80&tr=udp://open.demonii.com:1337'), + # from twisted: + "http://localhost", + "http://localhost/", + "http://localhost/foo", + "http://localhost/foo/", + "http://localhost/foo!!bar/", + "http://localhost/foo%20bar/", + "http://localhost/foo%2Fbar/", + "http://localhost/foo?n", + "http://localhost/foo?n=v", + "http://localhost/foo?n=/a/b", + "http://example.com/foo!@$bar?b!@z=123", + "http://localhost/asd?a=asd%20sdf/345", + "http://(%2525)/(%2525)?(%2525)&(%2525)=(%2525)#(%2525)", + "http://(%C3%A9)/(%C3%A9)?(%C3%A9)&(%C3%A9)=(%C3%A9)#(%C3%A9)" + ] + + +@pytest.fixture(scope="module", params=TEST_URLS) +def test_url(request): + param = request.param + return param + + +def test_regex(test_url): + match = _URL_RE.match(test_url) + assert match.groupdict() + + +def test_roundtrip(test_url): + result = URL(test_url).to_text(full_quote=True) + assert test_url == result + + +def test_basic(): + u1 = URL('http://googlewebsite.com/e-shops.aspx') + assert isinstance(u1.to_text(), str) + assert u1.host == 'googlewebsite.com' + + +def test_utf8_url(): + url_bytes = (b'http://\xd9\x85\xd8\xab\xd8\xa7\xd9\x84' + b'.\xd8\xa2\xd8\xb2\xd9\x85\xd8\xa7' + b'\xdb\x8c\xd8\xb4\xdb\x8c') + url = URL(url_bytes) + assert url.scheme == 'http' + assert url.host == 'مثال.آزمایشی' + + +def test_idna(): + u1 = URL('http://bücher.ch') + assert u1.host == 'bücher.ch' + assert u1.to_text(full_quote=True) == 'http://xn--bcher-kva.ch' + assert u1.to_text(full_quote=False) == 'http://bücher.ch' + + u2 = URL('https://xn--bcher-kva.ch') + assert u2.host == 'bücher.ch' + assert u2.to_text(full_quote=True) == 'https://xn--bcher-kva.ch' + assert u2.to_text(full_quote=False) == 'https://bücher.ch' + + +def test_query_params(test_url): + url_obj = URL(test_url) + if not url_obj.query_params or url_obj.fragment: + return + qp_text = url_obj.query_params.to_text(full_quote=True) + assert test_url.endswith(qp_text) + + +def test_iri_query(): + url = URL('http://minerals.mountain.ore/?rock=\N{SHAMROCK}') + assert url.query_params['rock'] == '\N{SHAMROCK}' + assert url.query_params.to_text(full_quote=True).endswith('%E2%98%98') + + +def test_iri_path(): + url = URL('http://minerals.mountain.ore/rock/\N{SHAMROCK}/') + assert url.path == '/rock/\N{SHAMROCK}/' + assert url.to_text(full_quote=True).endswith('%E2%98%98/') + + +def test_url_copy(): + url = URL('http://example.com/foo?bar=baz') + url_copy = URL(url) + assert url == url_copy + + +def test_invalid_port(): + with pytest.raises(ValueError): + URL('http://reader.googlewebsite.com:neverforget') + + +def test_invalid_ipv6(): + invalid_ipv6_ips = ['2001::0234:C1ab::A0:aabc:003F', + '2001::1::3F'] + for ip in invalid_ipv6_ips: + with pytest.raises(ValueError): + URL('http://[' + ip + ']') + + +def test_parse_url(): + expected = {'family': 2, 'password': None, 'fragment': None, + 'authority': '127.0.0.1:3000', 'port': 3000, 'query': 'a=1', + '_netloc_sep': '//', 'path': '/', 'scheme': 'http', + 'host': '127.0.0.1', 'username': None} + res = urlutils.parse_url('http://127.0.0.1:3000/?a=1') + assert res == expected + + +def test_parse_equals_in_qp_value(): + u = URL('http://localhost/?=x=x=x') + assert u.qp[''] == 'x=x=x' + assert u.to_text() == 'http://localhost/?=x%3Dx%3Dx' + + u = URL('http://localhost/?foo=x=x=x&bar=y') + assert u.qp['foo'] == 'x=x=x' + assert u.qp['bar'] == 'y' + + +def test_identical_equal(): + u = URL('http://example.com/path?query=param#frag') + assert u == u + + +def test_equal(): + u = URL('http://example.com/path?query=param#frag') + bono = URL('http://example.com/path?query=param#frag') + assert bono == u + + +def test_not_equal(): + u = URL('http://example.com/path?query=param1#frag') + bono = URL('http://example.com/path?query=param2#frag') + assert bono != u + + +def _test_bad_utf8(): # not part of the API + bad_bin_url = 'http://xn--9ca.com/%00%FF/%C3%A9' + url = URL(bad_bin_url) + + expected = ('http://\N{LATIN SMALL LETTER E WITH ACUTE}.com/' + '%00%FF/' + '\N{LATIN SMALL LETTER E WITH ACUTE}') + + actual = url.to_text() + + assert expected == actual + + +def test_userinfo(): + url = URL('http://someuser:somepassword@example.com/some-segment@ignore') + assert url.username == 'someuser' + assert url.password == 'somepassword' + assert url.to_text() == 'http://someuser:somepassword@example.com/some-segment@ignore' + + +def test_quoted_userinfo(): + url = URL('http://wikipedia.org') + url.username = 'user' + url.password = 'p@ss' + assert url.to_text(full_quote=True) == 'http://user:p%40ss@wikipedia.org' + + url = URL('http://beyonc\xe9:b\xe9b@tmp.com') + # assert url.to_text(full_quote=False) == u'http://beyoncé:b%C3%A9b@tmp.com' + assert url.to_text(full_quote=True) == 'http://beyonc%C3%A9:b%C3%A9b@tmp.com' + + +def test_mailto(): + mt = 'mailto:mahmoud@hatnote.com' + url = URL(mt) + assert url.scheme == 'mailto' + assert url.to_text() == mt + + +# Examples from RFC 3986 section 5.4, Reference Resolution Examples +# painstakingly copied from the lovingly transcribed version in +# twisted's test_url, with inapplicable cases removed +REL_URL_BASE = 'http://a/b/c/d;p?q' +REL_URL_TEST_CASES = [ + # "Normal" + #('g:h', 'g:h'), # Not supported: scheme with relative path + ('g', 'http://a/b/c/g'), + ('./g', 'http://a/b/c/g'), + ('g/', 'http://a/b/c/g/'), + ('/g', 'http://a/g'), + (';x', 'http://a/b/c/;x'), + ('g;x', 'http://a/b/c/g;x'), + ('', 'http://a/b/c/d;p?q'), + ('.', 'http://a/b/c/'), + ('./', 'http://a/b/c/'), + ('..', 'http://a/b/'), + ('../', 'http://a/b/'), + ('../g', 'http://a/b/g'), + ('../..', 'http://a/'), + ('../../', 'http://a/'), + ('../../g', 'http://a/g'), + + # Abnormal examples + # ".." cannot be used to change the authority component of a URI. + ('../../../g', 'http://a/g'), # TODO (rooted?) + ('../../../../g', 'http://a/g'), # TODO (rooted)? + + # Only include "." and ".." when they are only part of a larger segment, + # not by themselves. + ('/./g', 'http://a/g'), + ('/../g', 'http://a/g'), + ('g.', 'http://a/b/c/g.'), + ('.g', 'http://a/b/c/.g'), + ('g..', 'http://a/b/c/g..'), + ('..g', 'http://a/b/c/..g'), + + # Unnecessary or nonsensical forms of "." and "..". + ('./../g', 'http://a/b/g'), + ('./g/.', 'http://a/b/c/g/'), + ('g/./h', 'http://a/b/c/g/h'), + ('g/../h', 'http://a/b/c/h'), + ('g;x=1/./y', 'http://a/b/c/g;x=1/y'), + ('g;x=1/../y', 'http://a/b/c/y'), +] + + +def test_rel_navigate(): + for suffix, expected in REL_URL_TEST_CASES: + url = URL(REL_URL_BASE) + new_url = url.navigate(suffix) + assert new_url.to_text() == expected + + new_url = url.navigate(URL(suffix)) + assert new_url.to_text() == expected + + return + + +def test_navigate(): + orig_text = 'http://a.b/c/d?e#f' + orig = URL(orig_text) + navd = orig.navigate('') + # fragment removed on empty navigate + assert navd.to_text() == 'http://a.b/c/d?e' + + # query also removed on non-empty navigate (interp'd as rel path) + navd = orig.navigate('dd') + assert navd.to_text() == 'http://a.b/c/dd' + + # check trailing slash + navd = orig.navigate('dd/') + assert navd.to_text() == 'http://a.b/c/dd/' + + # path removed on absolute path navigate + navd = orig.navigate('/C') + assert navd.to_text() == 'http://a.b/C' + + # only query string + navd = orig.navigate('?e=E&ee=EE') + assert navd.to_text() == 'http://a.b/c/d?e=E&ee=EE' + + # only fragment + navd = orig.navigate('#FFF') + assert navd.to_text() == 'http://a.b/c/d?e#FFF' + + # an odd case, bears more consideration perhaps + navd = orig.navigate('https:') + assert navd.to_text() == 'https://a.b/c/d?e' + + # another odd one, host only + navd = orig.navigate('//newhost') + assert navd.to_text() == 'http://newhost/c/d?e' + + # absolute URLs (with scheme + host) replace everything + _dest_text = 'http://hatnote.com' + _dest = URL(_dest_text) + navd = orig.navigate(_dest) + assert _dest is not navd # make sure copies are made + assert navd.to_text() == _dest_text + navd = orig.navigate(_dest_text) + assert navd.to_text() == _dest_text + + +@pytest.mark.parametrize( + ('expected', 'base', 'paths'), [ + ('https://host/b', 'https://host', ('a', '/b', )), + ('https://host/b', 'https://host', ('a', 'b', )), + ('https://host/a/b', 'https://host', ('a/', 'b', )), + ('https://host/b', 'https://host', ('/a', 'b', )), + ('https://host/a/b', 'https://host/a/', (None, 'b', )), + ('https://host/b', 'https://host/a', (None, 'b', )), +]) +def test_chained_navigate(expected, base, paths): + """Chained :meth:`navigate` calls produces correct results.""" + url = URL(base) + + for path in paths: + url = url.navigate(path) + + assert expected == url.to_text() + + +# TODO: RFC3986 6.2.3 (not just for query add, either) +# def test_add_query(): +# url = URL('http://www.example.com') +# url.qp['key'] = 'value' +# assert url.to_text() == 'http://www.example.com/?key=value' + + +def test_self_normalize(): + url = URL('http://hatnote.com/a/../../b?k=v#hashtags') + url.normalize() + assert url.to_text() == 'http://hatnote.com/b?k=v#hashtags' + + +def test_normalize_with_case(): + # from RFC 3986 Section 6.2.2 + url1 = URL('example://a/b/c/%7Bfoo%7D') + url2 = URL('eXAMPLE://a/./b/../b/%63/%7bfoo%7d') + + assert url1 != url2 + + url1.normalize() + url2.normalize() + + assert url1 == url2 + + +def test_netloc_slashes(): + # basic sanity checks + url = URL('mailto:mahmoud@hatnote.com') + assert url.scheme == 'mailto' + assert url.to_text() == 'mailto:mahmoud@hatnote.com' + + url = URL('http://hatnote.com') + assert url.scheme == 'http' + assert url.to_text() == 'http://hatnote.com' + + # test that unrecognized schemes stay consistent with '//' + url = URL('newscheme:a:b:c') + assert url.scheme == 'newscheme' + assert url.to_text() == 'newscheme:a:b:c' + + url = URL('newerscheme://a/b/c') + assert url.scheme == 'newerscheme' + assert url.to_text() == 'newerscheme://a/b/c' + + # test that reasonable guesses are made + url = URL('git+ftp://gitstub.biz/glyph/lefkowitz') + assert url.scheme == 'git+ftp' + assert url.to_text() == 'git+ftp://gitstub.biz/glyph/lefkowitz' + + url = URL('what+mailto:freerealestate@enotuniq.org') + assert url.scheme == 'what+mailto' + assert url.to_text() == 'what+mailto:freerealestate@enotuniq.org' + + url = URL() + url.scheme = 'ztp' + url.path = '/x/y/z' + assert url.to_text() == 'ztp:/x/y/z' + + # also works when the input doesn't include '//' + url = URL() + url.scheme = 'git+ftp' + url.path = '/x/y/z/' + assert url.to_text() == 'git+ftp:///x/y/z/' + + # really why would this ever come up but ok + url = URL('file:///path/to/heck') + url.scheme = 'mailto' + assert url.to_text() == 'mailto:/path/to/heck' + + return + + +# (link_text, expected_urls) +# adapted from tornado test suite +FAL_TESTS = [("hello http://world.com/!", ["http://world.com/"]), + ("hello http://world.com/with?param=true&stuff=yes", ["http://world.com/with?param=true&stuff=yes"]), + ("http://url.com/w(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ["http://url.com/w"]), + ("http://url.com/withmany.......................................", ["http://url.com/withmany"]), + ("http://url.com/withmany((((((((((((((((((((((((((((((((((a)", ["http://url.com/withmany"]), + # some examples from http://daringfireball.net/2009/11/liberal_regex_for_matching_urls + ("http://foo.com/blah_blah", ["http://foo.com/blah_blah"]), + ("http://foo.com/blah_blah/", ["http://foo.com/blah_blah/"]), + ("(Something like http://foo.com/blah_blah)", ["http://foo.com/blah_blah"]), + ("http://foo.com/blah_blah_(wikipedia)", ["http://foo.com/blah_blah_(wikipedia)"]), + ("http://foo.com/blah_(blah)_(wikipedia)_blah", ["http://foo.com/blah_(blah)_(wikipedia)_blah"]), + ("http://foo.com/blah_blah.", ["http://foo.com/blah_blah"]), + ("http://foo.com/blah_blah/.", ["http://foo.com/blah_blah/"]), + ("", ["http://foo.com/blah_blah"]), + ("", ["http://foo.com/blah_blah/"]), + ("http://foo.com/blah_blah,", ["http://foo.com/blah_blah"]), + ("http://www.example.com/wpstyle/?p=364.", ["http://www.example.com/wpstyle/?p=364"]), + ("rdar://1234", ["rdar://1234"]), + ("rdar:/1234", ["rdar:/1234"]), + ("http://userid:password@example.com:8080", ["http://userid:password@example.com:8080"]), + ("http://userid@example.com", ["http://userid@example.com"]), + ("message://%3c330e7f8409726r6a4ba78dkf1fd71420c1bf6ff@mail.gmail.com%3e", ["message://%3C330e7f8409726r6a4ba78dkf1fd71420c1bf6ff@mail.gmail.com%3e"]), + ("http://\u27a1.ws/\u4a39", ["http://\u27a1.ws/\u4a39"]), + ("http://example.com", ["http://example.com"]), + ("Just a www.example.com link.", ["https://www.example.com"]), + ("www.a-link.com", ["https://www.a-link.com"]), + ("www.a-link.com and www.b-link.com/blogs extra", ["https://www.a-link.com", "https://www.b-link.com/blogs"]) +] + + +def test_find_all_links_basic(): + target = """hi my name is prince nigeria, please visit my website + http://richprince.biz or if that's blocked try + https://getprince.ly! Thanks for your attention.bye! + + PS if those ports are blocked, how about trying + https://crownbux.afamilycompany:broken/affiliate + + PPS if all else fails you can always mailto:thePrince@machovelli.an + """ + + urls = find_all_links(target) + assert len(urls) == 2 + + +def test_find_all_links(): + prefix = "a little something before, " + suffix = " a bit of another after." + + for content, expected_links in FAL_TESTS: + text = prefix + content + suffix + + links = find_all_links(text) + assert len(links) == len(expected_links) + + for link, expected in zip(links, expected_links): + assert link.to_text(full_quote=False) == expected + + link_tokens = find_all_links(text, with_text=True) + assert link_tokens[0].startswith(prefix) + assert link_tokens[-1].endswith(suffix) + + +def test_unicodey(): + unicodey = ('http://\N{LATIN SMALL LETTER E WITH ACUTE}.com/' + '\N{LATIN SMALL LETTER E}\N{COMBINING ACUTE ACCENT}' + '?\N{LATIN SMALL LETTER A}\N{COMBINING ACUTE ACCENT}=' + '\N{LATIN SMALL LETTER I}\N{COMBINING ACUTE ACCENT}' + '#\N{LATIN SMALL LETTER U}\N{COMBINING ACUTE ACCENT}') + url = URL(unicodey) + assert url.host == 'é.com' + assert url.path_parts[1] == '\N{LATIN SMALL LETTER E}\N{COMBINING ACUTE ACCENT}' + assert url.to_text(full_quote=False) == unicodey + fully_quoted = 'http://xn--9ca.com/%C3%A9?%C3%A1=%C3%AD#%C3%BA' + assert url.to_text(full_quote=True) == fully_quoted + +def test_str_repr(): + assert str(URL("http://googlewebsite.com/e-shops.aspx")) == "http://googlewebsite.com/e-shops.aspx" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tox.ini b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tox.ini new file mode 100644 index 0000000000000000000000000000000000000000..12fb928836e79ea071d3985a73dab5c1b01da6fe --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/info/test/tox.ini @@ -0,0 +1,7 @@ +[tox] +envlist = py37,py39,py310,py311,py312,py313,pypy3 +[testenv] +changedir = .tox +deps = -rrequirements-test.txt +commands = pytest --doctest-modules {envsitepackagesdir}/boltons {toxinidir}/tests {posargs} + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/INSTALLER b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..f79e4cb9aaf0b2d9e8ba78861e2071317b2384b3 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/INSTALLER @@ -0,0 +1 @@ +conda \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/LICENSE b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..6a4c9d2496f53c61c99ae7c113e6ed94b15b038c --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2013, Mahmoud Hashemi + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/METADATA b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..767d124a83b059d9193e7f637a6da7d5dfe1c7ed --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/METADATA @@ -0,0 +1,134 @@ +Metadata-Version: 2.1 +Name: boltons +Version: 25.0.0 +Summary: When they're not builtins, they're boltons. +Author-email: Mahmoud Hashemi +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +Classifier: Topic :: Utilities +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: BSD License +Classifier: Topic :: Software Development :: Libraries +Classifier: Development Status :: 5 - Production/Stable +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Project-URL: Homepage, https://github.com/mahmoud/boltons + +# Boltons + +*boltons should be builtins.* + + + + + + + + +**Boltons** is a set of over 230 BSD-licensed, pure-Python utilities +in the same spirit as — and yet conspicuously missing from — +[the standard library][stdlib], including: + + * [Atomic file saving][atomic], bolted on with [fileutils][fileutils] + * A highly-optimized [OrderedMultiDict][omd], in [dictutils][dictutils] + * *Two* types of [PriorityQueue][pq], in [queueutils][queueutils] + * [Chunked][chunked] and [windowed][windowed] iteration, in [iterutils][iterutils] + * Recursive data structure [iteration and merging][remap], with [iterutils.remap][iterutils.remap] + * Exponential backoff functionality, including jitter, through [iterutils.backoff][iterutils.backoff] + * A full-featured [TracebackInfo][tbinfo] type, for representing stack traces, + in [tbutils][tbutils] + +**[Full and extensive docs are available on Read The Docs.][rtd]** See +what's new [by checking the CHANGELOG][changelog]. + +Boltons is tested against Python 3.7-3.13, as well as PyPy3. + +[stdlib]: https://docs.python.org/3/library/index.html +[rtd]: https://boltons.readthedocs.org/en/latest/ +[changelog]: https://github.com/mahmoud/boltons/blob/master/CHANGELOG.md + +[atomic]: https://boltons.readthedocs.org/en/latest/fileutils.html#boltons.fileutils.atomic_save +[omd]: https://boltons.readthedocs.org/en/latest/dictutils.html#boltons.dictutils.OrderedMultiDict +[pq]: https://boltons.readthedocs.org/en/latest/queueutils.html#boltons.queueutils.PriorityQueue +[chunked]: https://boltons.readthedocs.org/en/latest/iterutils.html#boltons.iterutils.chunked +[windowed]: https://boltons.readthedocs.org/en/latest/iterutils.html#boltons.iterutils.windowed +[tbinfo]: https://boltons.readthedocs.org/en/latest/tbutils.html#boltons.tbutils.TracebackInfo + +[fileutils]: https://boltons.readthedocs.org/en/latest/fileutils.html#module-boltons.fileutils +[ioutils]: https://boltons.readthedocs.org/en/latest/ioutils.html#module-boltons.ioutils +[dictutils]: https://boltons.readthedocs.org/en/latest/dictutils.html#module-boltons.dictutils +[queueutils]: https://boltons.readthedocs.org/en/latest/queueutils.html#module-boltons.queueutils +[iterutils]: https://boltons.readthedocs.org/en/latest/iterutils.html#module-boltons.iterutils +[iterutils.remap]: http://boltons.readthedocs.org/en/latest/iterutils.html#boltons.iterutils.remap +[iterutils.backoff]: http://boltons.readthedocs.org/en/latest/iterutils.html#boltons.iterutils.backoff +[tbutils]: https://boltons.readthedocs.org/en/latest/tbutils.html#module-boltons.tbutils + +[remap]: http://sedimental.org/remap.html + +## Installation + +Boltons can be added to a project in a few ways. There's the obvious one: + +```bash +pip install boltons +``` +On macOS, it can also be installed via [MacPorts](https://ports.macports.org/port/py-boltons/summary): + +```bash +sudo port install py-boltons +``` + + +Then, [thanks to PyPI][boltons_pypi], dozens of boltons are just an import away: + +```python +from boltons.cacheutils import LRU +my_cache = LRU() +``` + +However, due to the nature of utilities, application developers might +want to consider other options, including vendorization of individual +modules into a project. Boltons is pure-Python and has no +dependencies. If the whole project is too big, each module is +independent, and can be copied directly into a project. See the +[Integration][integration] section of the docs for more details. + +[boltons_pypi]: https://pypi.python.org/pypi/boltons +[integration]: https://boltons.readthedocs.org/en/latest/architecture.html#integration + +## Third-party packages + +The majority of boltons strive to be "good enough" for a wide range of +basic uses, leaving advanced use cases to Python's [myriad specialized +3rd-party libraries][pypi]. In many cases the respective ``boltons`` module +will describe 3rd-party alternatives worth investigating when use +cases outgrow `boltons`. If you've found a natural "next-step" +library worth mentioning, see the next section! + +[pypi]: https://pypi.python.org/pypi + +## Gaps + +Found something missing in the standard library that should be in +`boltons`? Found something missing in `boltons`? First, take a +moment to read the very brief [architecture statement][architecture] to make +sure the functionality would be a good fit. + +Then, if you are very motivated, submit [a Pull Request][prs]. Otherwise, +submit a short feature request on [the Issues page][issues], and we will +figure something out. + +[architecture]: https://boltons.readthedocs.org/en/latest/architecture.html +[issues]: https://github.com/mahmoud/boltons/issues +[prs]: https://github.com/mahmoud/boltons/pulls + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/RECORD b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..8ae377f1a60e6cb00dddc492801a01447c1ebaf5 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/RECORD @@ -0,0 +1,67 @@ +boltons-25.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +boltons-25.0.0.dist-info/LICENSE,sha256=wwGRJlOo2Mmeq2ISqjrqjRZOoknYrVPJQeBVigpaweM,1497 +boltons-25.0.0.dist-info/METADATA,sha256=R9BODd9Cwf6_cKkw2vT21-GNfaDtGHcbdqO672bOChs,6511 +boltons-25.0.0.dist-info/RECORD,, +boltons-25.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +boltons-25.0.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 +boltons-25.0.0.dist-info/direct_url.json,sha256=16WJY3WPSSaHOcTbTvVQonsJsOcFwWc8tkW81mApf0M,67 +boltons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +boltons/__pycache__/__init__.cpython-313.pyc,, +boltons/__pycache__/cacheutils.cpython-313.pyc,, +boltons/__pycache__/debugutils.cpython-313.pyc,, +boltons/__pycache__/deprutils.cpython-313.pyc,, +boltons/__pycache__/dictutils.cpython-313.pyc,, +boltons/__pycache__/easterutils.cpython-313.pyc,, +boltons/__pycache__/ecoutils.cpython-313.pyc,, +boltons/__pycache__/excutils.cpython-313.pyc,, +boltons/__pycache__/fileutils.cpython-313.pyc,, +boltons/__pycache__/formatutils.cpython-313.pyc,, +boltons/__pycache__/funcutils.cpython-313.pyc,, +boltons/__pycache__/gcutils.cpython-313.pyc,, +boltons/__pycache__/ioutils.cpython-313.pyc,, +boltons/__pycache__/iterutils.cpython-313.pyc,, +boltons/__pycache__/jsonutils.cpython-313.pyc,, +boltons/__pycache__/listutils.cpython-313.pyc,, +boltons/__pycache__/mathutils.cpython-313.pyc,, +boltons/__pycache__/mboxutils.cpython-313.pyc,, +boltons/__pycache__/namedutils.cpython-313.pyc,, +boltons/__pycache__/pathutils.cpython-313.pyc,, +boltons/__pycache__/queueutils.cpython-313.pyc,, +boltons/__pycache__/setutils.cpython-313.pyc,, +boltons/__pycache__/socketutils.cpython-313.pyc,, +boltons/__pycache__/statsutils.cpython-313.pyc,, +boltons/__pycache__/strutils.cpython-313.pyc,, +boltons/__pycache__/tableutils.cpython-313.pyc,, +boltons/__pycache__/tbutils.cpython-313.pyc,, +boltons/__pycache__/timeutils.cpython-313.pyc,, +boltons/__pycache__/typeutils.cpython-313.pyc,, +boltons/__pycache__/urlutils.cpython-313.pyc,, +boltons/cacheutils.py,sha256=yyKZj0YBPZHJayjhQb_HXeJ095PjhLPbmp21mwyCDqU,30399 +boltons/debugutils.py,sha256=5wGrghJoNqpmH36ScqmoszmBSuYCl3tHIT8K66z9ooM,10320 +boltons/deprutils.py,sha256=2PLA_c6dgnZGYSfwk3ceGgqIRLzRvZLmiA8w0nguAVE,2478 +boltons/dictutils.py,sha256=q1TgCuN1tkzaqL-o2j36o3kK60DOBxcYi-l7GZwy_rE,37642 +boltons/easterutils.py,sha256=G_xungVgZomrQIewBYXBg_9PzE60pCP5vhU6C-aBjUA,1798 +boltons/ecoutils.py,sha256=OKbC8EXSisBsjZuXEYW9i7kZbPhPobnxbMH2cwsSLZ8,14036 +boltons/excutils.py,sha256=ai7d0m9G29zu2hJb0gN51S_8mKlB_oZ-NDTRe5MRmVc,8972 +boltons/fileutils.py,sha256=PPZeBOrttj1x5aS_5pdBlIAq4gNDnP2PP4fygH_HMfw,25486 +boltons/formatutils.py,sha256=FceWPVyXsR7HpBnp5K7HwgynZbz3ATBlEMnFfH6usaQ,12728 +boltons/funcutils.py,sha256=VNgmEyqXlr5KrfDDDj5ipY1h5MWnpfaZOiuVnQu7A6A,36840 +boltons/gcutils.py,sha256=6CoyCTVgwUu4KYUyaBozONLsb0jSDM8vGkSW3Wehf5c,6229 +boltons/ioutils.py,sha256=NnJ-UDp0g9H5Hvx82DflAtxLVg4b_19_nmbNoJQhtrw,17991 +boltons/iterutils.py,sha256=Ip8Pdnqjyp-8CwV91xkRcIFb_7Q1mdOik6JGvVp1r7Y,57562 +boltons/jsonutils.py,sha256=9xh2qX6BjTmIsyls8qEXiNBRPPJR8mn463_UKqtZEJQ,9864 +boltons/listutils.py,sha256=qmgBY8s0EpwI2J4ja1Xn1b5hzDIaSFZ9nQgLf_Yz0RA,12088 +boltons/mathutils.py,sha256=KY-A0nLdaVEKPG7VDmrXbyisXp-SrsCquBMi98iDaaQ,7941 +boltons/mboxutils.py,sha256=QmtSEfezzm7p0cgNeUtW2VRENYZbSKAW0ZVc0KHgMg0,5938 +boltons/namedutils.py,sha256=E_EnM4b1aVxHQJnPIvzADc_MzaNxnh_zDfihOMPc35Y,14957 +boltons/pathutils.py,sha256=ZnpLtG7Xn2avg7B_rEGfP5FXbC5-1AThHyjNaLRkX70,6497 +boltons/queueutils.py,sha256=pg8E9fJ4A0Kcennz9R-bKGy6O9mX8SIWHyUsZsoEmbs,7650 +boltons/setutils.py,sha256=bcPJGyw7ww0xnWKAOluhrDJgIvznsk40AtRVyJfzxHg,33482 +boltons/socketutils.py,sha256=stXaLVjdPQXBQVOoPzbako_mKFpKRIUMLquYd8GVmtw,29900 +boltons/statsutils.py,sha256=z9bdX-cnxLFovu7q8f-XNuc90ZUDf8jRrQPBBtFXl0U,29923 +boltons/strutils.py,sha256=qUU6Hq-oA3kp_xL6NJb66-VRFMViUYZmjSOFk7jlE4k,43592 +boltons/tableutils.py,sha256=AERJEZMfZA0AlxDPvagT8wtoObgtPWoohgob9aRyJn4,21922 +boltons/tbutils.py,sha256=QxTvWB-l60cpTTHcU0xyzPmGOvSRppMk-I3mtwPWRlI,30474 +boltons/timeutils.py,sha256=_e_iKuOUZmuVGV5bKQyZac21zpecycN4Bc78wCq-LfU,20308 +boltons/typeutils.py,sha256=TaKybXE4bukBDftSEE5GHsukhrpVRKjPUNnibNNOnAk,5814 +boltons/urlutils.py,sha256=jAs0TEyj_Zr5S26x4NmDbkpPbx5EaLzPDs50e7rVSY4,57489 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/REQUESTED b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/WHEEL b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..3b5e64b5e6c4a210201d1676a891fd57b15cda99 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.9.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/direct_url.json b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/direct_url.json new file mode 100644 index 0000000000000000000000000000000000000000..dfef5ea31e16851edb58ddfc4257e1709e8adad1 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons-25.0.0.dist-info/direct_url.json @@ -0,0 +1 @@ +{"dir_info": {}, "url": "file:///croot/boltons_1751383775419/work"} \ No newline at end of file diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/__init__.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/cacheutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/cacheutils.py new file mode 100644 index 0000000000000000000000000000000000000000..856bf195483aafbfcdb8f6f93a168daf0c9b5857 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/cacheutils.py @@ -0,0 +1,870 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""``cacheutils`` contains consistent implementations of fundamental +cache types. Currently there are two to choose from: + + * :class:`LRI` - Least-recently inserted + * :class:`LRU` - Least-recently used + +Both caches are :class:`dict` subtypes, designed to be as +interchangeable as possible, to facilitate experimentation. A key +practice with performance enhancement with caching is ensuring that +the caching strategy is working. If the cache is constantly missing, +it is just adding more overhead and code complexity. The standard +statistics are: + + * ``hit_count`` - the number of times the queried key has been in + the cache + * ``miss_count`` - the number of times a key has been absent and/or + fetched by the cache + * ``soft_miss_count`` - the number of times a key has been absent, + but a default has been provided by the caller, as with + :meth:`dict.get` and :meth:`dict.setdefault`. Soft misses are a + subset of misses, so this number is always less than or equal to + ``miss_count``. + +Additionally, ``cacheutils`` provides :class:`ThresholdCounter`, a +cache-like bounded counter useful for online statistics collection. + +Learn more about `caching algorithms on Wikipedia +`_. + +""" + +# TODO: TimedLRI +# TODO: support 0 max_size? + + +import heapq +import weakref +import itertools +from operator import attrgetter + +try: + from threading import RLock +except Exception: + class RLock: + 'Dummy reentrant lock for builds without threads' + def __enter__(self): + pass + + def __exit__(self, exctype, excinst, exctb): + pass + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') + _KWARG_MARK = make_sentinel(var_name='_KWARG_MARK') +except ImportError: + _MISSING = object() + _KWARG_MARK = object() + +PREV, NEXT, KEY, VALUE = range(4) # names for the link fields +DEFAULT_MAX_SIZE = 128 + + +class LRI(dict): + """The ``LRI`` implements the basic *Least Recently Inserted* strategy to + caching. One could also think of this as a ``SizeLimitedDefaultDict``. + + *on_miss* is a callable that accepts the missing key (as opposed + to :class:`collections.defaultdict`'s "default_factory", which + accepts no arguments.) Also note that, like the :class:`LRI`, + the ``LRI`` is instrumented with statistics tracking. + + >>> cap_cache = LRI(max_size=2) + >>> cap_cache['a'], cap_cache['b'] = 'A', 'B' + >>> from pprint import pprint as pp + >>> pp(dict(cap_cache)) + {'a': 'A', 'b': 'B'} + >>> [cap_cache['b'] for i in range(3)][0] + 'B' + >>> cap_cache['c'] = 'C' + >>> print(cap_cache.get('a')) + None + >>> cap_cache.hit_count, cap_cache.miss_count, cap_cache.soft_miss_count + (3, 1, 1) + """ + def __init__(self, max_size=DEFAULT_MAX_SIZE, values=None, + on_miss=None): + if max_size <= 0: + raise ValueError('expected max_size > 0, not %r' % max_size) + self.hit_count = self.miss_count = self.soft_miss_count = 0 + self.max_size = max_size + self._lock = RLock() + self._init_ll() + + if on_miss is not None and not callable(on_miss): + raise TypeError('expected on_miss to be a callable' + ' (or None), not %r' % on_miss) + self.on_miss = on_miss + + if values: + self.update(values) + + # TODO: fromkeys()? + + # linked list manipulation methods. + # + # invariants: + # 1) 'anchor' is the sentinel node in the doubly linked list. there is + # always only one, and its KEY and VALUE are both _MISSING. + # 2) the most recently accessed node comes immediately before 'anchor'. + # 3) the least recently accessed node comes immediately after 'anchor'. + def _init_ll(self): + anchor = [] + anchor[:] = [anchor, anchor, _MISSING, _MISSING] + # a link lookup table for finding linked list links in O(1) + # time. + self._link_lookup = {} + self._anchor = anchor + + def _print_ll(self): + print('***') + for (key, val) in self._get_flattened_ll(): + print(key, val) + print('***') + return + + def _get_flattened_ll(self): + flattened_list = [] + link = self._anchor + while True: + flattened_list.append((link[KEY], link[VALUE])) + link = link[NEXT] + if link is self._anchor: + break + return flattened_list + + def _get_link_and_move_to_front_of_ll(self, key): + # find what will become the newest link. this may raise a + # KeyError, which is useful to __getitem__ and __setitem__ + newest = self._link_lookup[key] + + # splice out what will become the newest link. + newest[PREV][NEXT] = newest[NEXT] + newest[NEXT][PREV] = newest[PREV] + + # move what will become the newest link immediately before + # anchor (invariant 2) + anchor = self._anchor + second_newest = anchor[PREV] + second_newest[NEXT] = anchor[PREV] = newest + newest[PREV] = second_newest + newest[NEXT] = anchor + return newest + + def _set_key_and_add_to_front_of_ll(self, key, value): + # create a new link and place it immediately before anchor + # (invariant 2). + anchor = self._anchor + second_newest = anchor[PREV] + newest = [second_newest, anchor, key, value] + second_newest[NEXT] = anchor[PREV] = newest + self._link_lookup[key] = newest + + def _set_key_and_evict_last_in_ll(self, key, value): + # the link after anchor is the oldest in the linked list + # (invariant 3). the current anchor becomes a link that holds + # the newest key, and the oldest link becomes the new anchor + # (invariant 1). now the newest link comes before anchor + # (invariant 2). no links are moved; only their keys + # and values are changed. + oldanchor = self._anchor + oldanchor[KEY] = key + oldanchor[VALUE] = value + + self._anchor = anchor = oldanchor[NEXT] + evicted = anchor[KEY] + anchor[KEY] = anchor[VALUE] = _MISSING + del self._link_lookup[evicted] + self._link_lookup[key] = oldanchor + return evicted + + def _remove_from_ll(self, key): + # splice a link out of the list and drop it from our lookup + # table. + link = self._link_lookup.pop(key) + link[PREV][NEXT] = link[NEXT] + link[NEXT][PREV] = link[PREV] + + def __setitem__(self, key, value): + with self._lock: + try: + link = self._get_link_and_move_to_front_of_ll(key) + except KeyError: + if len(self) < self.max_size: + self._set_key_and_add_to_front_of_ll(key, value) + else: + evicted = self._set_key_and_evict_last_in_ll(key, value) + super().__delitem__(evicted) + else: + link[VALUE] = value + super().__setitem__(key, value) + return + + def __getitem__(self, key): + with self._lock: + try: + link = self._link_lookup[key] + except KeyError: + self.miss_count += 1 + if not self.on_miss: + raise + ret = self[key] = self.on_miss(key) + return ret + + self.hit_count += 1 + return link[VALUE] + + def get(self, key, default=None): + try: + return self[key] + except KeyError: + self.soft_miss_count += 1 + return default + + def __delitem__(self, key): + with self._lock: + super().__delitem__(key) + self._remove_from_ll(key) + + def pop(self, key, default=_MISSING): + # NB: hit/miss counts are bypassed for pop() + with self._lock: + try: + ret = super().pop(key) + except KeyError: + if default is _MISSING: + raise + ret = default + else: + self._remove_from_ll(key) + return ret + + def popitem(self): + with self._lock: + item = super().popitem() + self._remove_from_ll(item[0]) + return item + + def clear(self): + with self._lock: + super().clear() + self._init_ll() + + def copy(self): + return self.__class__(max_size=self.max_size, values=self) + + def setdefault(self, key, default=None): + with self._lock: + try: + return self[key] + except KeyError: + self.soft_miss_count += 1 + self[key] = default + return default + + def update(self, E, **F): + # E and F are throwback names to the dict() __doc__ + with self._lock: + if E is self: + return + setitem = self.__setitem__ + if callable(getattr(E, 'keys', None)): + for k in E.keys(): + setitem(k, E[k]) + else: + for k, v in E: + setitem(k, v) + for k in F: + setitem(k, F[k]) + return + + def __eq__(self, other): + with self._lock: + if self is other: + return True + if len(other) != len(self): + return False + if not isinstance(other, LRI): + return other == self + return super().__eq__(other) + + def __ne__(self, other): + return not (self == other) + + def __repr__(self): + cn = self.__class__.__name__ + val_map = super().__repr__() + return ('%s(max_size=%r, on_miss=%r, values=%s)' + % (cn, self.max_size, self.on_miss, val_map)) + + +class LRU(LRI): + """The ``LRU`` is :class:`dict` subtype implementation of the + *Least-Recently Used* caching strategy. + + Args: + max_size (int): Max number of items to cache. Defaults to ``128``. + values (iterable): Initial values for the cache. Defaults to ``None``. + on_miss (callable): a callable which accepts a single argument, the + key not present in the cache, and returns the value to be cached. + + >>> cap_cache = LRU(max_size=2) + >>> cap_cache['a'], cap_cache['b'] = 'A', 'B' + >>> from pprint import pprint as pp + >>> pp(dict(cap_cache)) + {'a': 'A', 'b': 'B'} + >>> [cap_cache['b'] for i in range(3)][0] + 'B' + >>> cap_cache['c'] = 'C' + >>> print(cap_cache.get('a')) + None + + This cache is also instrumented with statistics + collection. ``hit_count``, ``miss_count``, and ``soft_miss_count`` + are all integer members that can be used to introspect the + performance of the cache. ("Soft" misses are misses that did not + raise :exc:`KeyError`, e.g., ``LRU.get()`` or ``on_miss`` was used to + cache a default. + + >>> cap_cache.hit_count, cap_cache.miss_count, cap_cache.soft_miss_count + (3, 1, 1) + + Other than the size-limiting caching behavior and statistics, + ``LRU`` acts like its parent class, the built-in Python :class:`dict`. + """ + def __getitem__(self, key): + with self._lock: + try: + link = self._get_link_and_move_to_front_of_ll(key) + except KeyError: + self.miss_count += 1 + if not self.on_miss: + raise + ret = self[key] = self.on_miss(key) + return ret + + self.hit_count += 1 + return link[VALUE] + + +### Cached decorator +# Key-making technique adapted from Python 3.4's functools + +class _HashedKey(list): + """The _HashedKey guarantees that hash() will be called no more than once + per cached function invocation. + """ + __slots__ = 'hash_value' + + def __init__(self, key): + self[:] = key + self.hash_value = hash(tuple(key)) + + def __hash__(self): + return self.hash_value + + def __repr__(self): + return f'{self.__class__.__name__}({list.__repr__(self)})' + + +def make_cache_key(args, kwargs, typed=False, + kwarg_mark=_KWARG_MARK, + fasttypes=frozenset([int, str, frozenset, type(None)])): + """Make a generic key from a function's positional and keyword + arguments, suitable for use in caches. Arguments within *args* and + *kwargs* must be `hashable`_. If *typed* is ``True``, ``3`` and + ``3.0`` will be treated as separate keys. + + The key is constructed in a way that is flat as possible rather than + as a nested structure that would take more memory. + + If there is only a single argument and its data type is known to cache + its hash value, then that argument is returned without a wrapper. This + saves space and improves lookup speed. + + >>> tuple(make_cache_key(('a', 'b'), {'c': ('d')})) + ('a', 'b', _KWARG_MARK, ('c', 'd')) + + .. _hashable: https://docs.python.org/2/glossary.html#term-hashable + """ + + # key = [func_name] if func_name else [] + # key.extend(args) + key = list(args) + if kwargs: + sorted_items = sorted(kwargs.items()) + key.append(kwarg_mark) + key.extend(sorted_items) + if typed: + key.extend([type(v) for v in args]) + if kwargs: + key.extend([type(v) for k, v in sorted_items]) + elif len(key) == 1 and type(key[0]) in fasttypes: + return key[0] + return _HashedKey(key) + +# for backwards compatibility in case someone was importing it +_make_cache_key = make_cache_key + + +class CachedFunction: + """This type is used by :func:`cached`, below. Instances of this + class are used to wrap functions in caching logic. + """ + def __init__(self, func, cache, scoped=True, typed=False, key=None): + self.func = func + if callable(cache): + self.get_cache = cache + elif not (callable(getattr(cache, '__getitem__', None)) + and callable(getattr(cache, '__setitem__', None))): + raise TypeError('expected cache to be a dict-like object,' + ' or callable returning a dict-like object, not %r' + % cache) + else: + def _get_cache(): + return cache + self.get_cache = _get_cache + self.scoped = scoped + self.typed = typed + self.key_func = key or make_cache_key + + def __call__(self, *args, **kwargs): + cache = self.get_cache() + key = self.key_func(args, kwargs, typed=self.typed) + try: + ret = cache[key] + except KeyError: + ret = cache[key] = self.func(*args, **kwargs) + return ret + + def __repr__(self): + cn = self.__class__.__name__ + if self.typed or not self.scoped: + return ("%s(func=%r, scoped=%r, typed=%r)" + % (cn, self.func, self.scoped, self.typed)) + return f"{cn}(func={self.func!r})" + + +class CachedMethod: + """Similar to :class:`CachedFunction`, this type is used by + :func:`cachedmethod` to wrap methods in caching logic. + """ + def __init__(self, func, cache, scoped=True, typed=False, key=None): + self.func = func + self.__isabstractmethod__ = getattr(func, '__isabstractmethod__', False) + if isinstance(cache, str): + self.get_cache = attrgetter(cache) + elif callable(cache): + self.get_cache = cache + elif not (callable(getattr(cache, '__getitem__', None)) + and callable(getattr(cache, '__setitem__', None))): + raise TypeError('expected cache to be an attribute name,' + ' dict-like object, or callable returning' + ' a dict-like object, not %r' % cache) + else: + def _get_cache(obj): + return cache + self.get_cache = _get_cache + self.scoped = scoped + self.typed = typed + self.key_func = key or make_cache_key + self.bound_to = None + + def __get__(self, obj, objtype=None): + if obj is None: + return self + cls = self.__class__ + ret = cls(self.func, self.get_cache, typed=self.typed, + scoped=self.scoped, key=self.key_func) + ret.bound_to = obj + return ret + + def __call__(self, *args, **kwargs): + obj = args[0] if self.bound_to is None else self.bound_to + cache = self.get_cache(obj) + key_args = (self.bound_to, self.func) + args if self.scoped else args + key = self.key_func(key_args, kwargs, typed=self.typed) + try: + ret = cache[key] + except KeyError: + if self.bound_to is not None: + args = (self.bound_to,) + args + ret = cache[key] = self.func(*args, **kwargs) + return ret + + def __repr__(self): + cn = self.__class__.__name__ + args = (cn, self.func, self.scoped, self.typed) + if self.bound_to is not None: + args += (self.bound_to,) + return ('<%s func=%r scoped=%r typed=%r bound_to=%r>' % args) + return ("%s(func=%r, scoped=%r, typed=%r)" % args) + + +def cached(cache, scoped=True, typed=False, key=None): + """Cache any function with the cache object of your choosing. Note + that the function wrapped should take only `hashable`_ arguments. + + Args: + cache (Mapping): Any :class:`dict`-like object suitable for + use as a cache. Instances of the :class:`LRU` and + :class:`LRI` are good choices, but a plain :class:`dict` + can work in some cases, as well. This argument can also be + a callable which accepts no arguments and returns a mapping. + scoped (bool): Whether the function itself is part of the + cache key. ``True`` by default, different functions will + not read one another's cache entries, but can evict one + another's results. ``False`` can be useful for certain + shared cache use cases. More advanced behavior can be + produced through the *key* argument. + typed (bool): Whether to factor argument types into the cache + check. Default ``False``, setting to ``True`` causes the + cache keys for ``3`` and ``3.0`` to be considered unequal. + + >>> my_cache = LRU() + >>> @cached(my_cache) + ... def cached_lower(x): + ... return x.lower() + ... + >>> cached_lower("CaChInG's FuN AgAiN!") + "caching's fun again!" + >>> len(my_cache) + 1 + + .. _hashable: https://docs.python.org/2/glossary.html#term-hashable + + """ + def cached_func_decorator(func): + return CachedFunction(func, cache, scoped=scoped, typed=typed, key=key) + return cached_func_decorator + + +def cachedmethod(cache, scoped=True, typed=False, key=None): + """Similar to :func:`cached`, ``cachedmethod`` is used to cache + methods based on their arguments, using any :class:`dict`-like + *cache* object. + + Args: + cache (str/Mapping/callable): Can be the name of an attribute + on the instance, any Mapping/:class:`dict`-like object, or + a callable which returns a Mapping. + scoped (bool): Whether the method itself and the object it is + bound to are part of the cache keys. ``True`` by default, + different methods will not read one another's cache + results. ``False`` can be useful for certain shared cache + use cases. More advanced behavior can be produced through + the *key* arguments. + typed (bool): Whether to factor argument types into the cache + check. Default ``False``, setting to ``True`` causes the + cache keys for ``3`` and ``3.0`` to be considered unequal. + key (callable): A callable with a signature that matches + :func:`make_cache_key` that returns a tuple of hashable + values to be used as the key in the cache. + + >>> class Lowerer(object): + ... def __init__(self): + ... self.cache = LRI() + ... + ... @cachedmethod('cache') + ... def lower(self, text): + ... return text.lower() + ... + >>> lowerer = Lowerer() + >>> lowerer.lower('WOW WHO COULD GUESS CACHING COULD BE SO NEAT') + 'wow who could guess caching could be so neat' + >>> len(lowerer.cache) + 1 + + """ + def cached_method_decorator(func): + return CachedMethod(func, cache, scoped=scoped, typed=typed, key=key) + return cached_method_decorator + + +class cachedproperty: + """The ``cachedproperty`` is used similar to :class:`property`, except + that the wrapped method is only called once. This is commonly used + to implement lazy attributes. + + After the property has been accessed, the value is stored on the + instance itself, using the same name as the cachedproperty. This + allows the cache to be cleared with :func:`delattr`, or through + manipulating the object's ``__dict__``. + """ + def __init__(self, func): + self.__doc__ = getattr(func, '__doc__') + self.__isabstractmethod__ = getattr(func, '__isabstractmethod__', False) + self.func = func + + def __get__(self, obj, objtype=None): + if obj is None: + return self + value = obj.__dict__[self.func.__name__] = self.func(obj) + return value + + def __repr__(self): + cn = self.__class__.__name__ + return f'<{cn} func={self.func}>' + + +class ThresholdCounter: + """A **bounded** dict-like Mapping from keys to counts. The + ThresholdCounter automatically compacts after every (1 / + *threshold*) additions, maintaining exact counts for any keys + whose count represents at least a *threshold* ratio of the total + data. In other words, if a particular key is not present in the + ThresholdCounter, its count represents less than *threshold* of + the total data. + + >>> tc = ThresholdCounter(threshold=0.1) + >>> tc.add(1) + >>> tc.items() + [(1, 1)] + >>> tc.update([2] * 10) + >>> tc.get(1) + 0 + >>> tc.add(5) + >>> 5 in tc + True + >>> len(list(tc.elements())) + 11 + + As you can see above, the API is kept similar to + :class:`collections.Counter`. The most notable feature omissions + being that counted items cannot be set directly, uncounted, or + removed, as this would disrupt the math. + + Use the ThresholdCounter when you need best-effort long-lived + counts for dynamically-keyed data. Without a bounded datastructure + such as this one, the dynamic keys often represent a memory leak + and can impact application reliability. The ThresholdCounter's + item replacement strategy is fully deterministic and can be + thought of as *Amortized Least Relevant*. The absolute upper bound + of keys it will store is *(2/threshold)*, but realistically + *(1/threshold)* is expected for uniformly random datastreams, and + one or two orders of magnitude better for real-world data. + + This algorithm is an implementation of the Lossy Counting + algorithm described in "Approximate Frequency Counts over Data + Streams" by Manku & Motwani. Hat tip to Kurt Rose for discovery + and initial implementation. + + """ + # TODO: hit_count/miss_count? + def __init__(self, threshold=0.001): + if not 0 < threshold < 1: + raise ValueError('expected threshold between 0 and 1, not: %r' + % threshold) + + self.total = 0 + self._count_map = {} + self._threshold = threshold + self._thresh_count = int(1 / threshold) + self._cur_bucket = 1 + + @property + def threshold(self): + return self._threshold + + def add(self, key): + """Increment the count of *key* by 1, automatically adding it if it + does not exist. + + Cache compaction is triggered every *1/threshold* additions. + """ + self.total += 1 + try: + self._count_map[key][0] += 1 + except KeyError: + self._count_map[key] = [1, self._cur_bucket - 1] + + if self.total % self._thresh_count == 0: + self._count_map = {k: v for k, v in self._count_map.items() + if sum(v) > self._cur_bucket} + self._cur_bucket += 1 + return + + def elements(self): + """Return an iterator of all the common elements tracked by the + counter. Yields each key as many times as it has been seen. + """ + repeaters = itertools.starmap(itertools.repeat, self.iteritems()) + return itertools.chain.from_iterable(repeaters) + + def most_common(self, n=None): + """Get the top *n* keys and counts as tuples. If *n* is omitted, + returns all the pairs. + """ + if not n or n <= 0: + return [] + ret = sorted(self.iteritems(), key=lambda x: x[1], reverse=True) + if n is None or n >= len(ret): + return ret + return ret[:n] + + def get_common_count(self): + """Get the sum of counts for keys exceeding the configured data + threshold. + """ + return sum([count for count, _ in self._count_map.values()]) + + def get_uncommon_count(self): + """Get the sum of counts for keys that were culled because the + associated counts represented less than the configured + threshold. The long-tail counts. + """ + return self.total - self.get_common_count() + + def get_commonality(self): + """Get a float representation of the effective count accuracy. The + higher the number, the less uniform the keys being added, and + the higher accuracy and efficiency of the ThresholdCounter. + + If a stronger measure of data cardinality is required, + consider using hyperloglog. + """ + return float(self.get_common_count()) / self.total + + def __getitem__(self, key): + return self._count_map[key][0] + + def __len__(self): + return len(self._count_map) + + def __contains__(self, key): + return key in self._count_map + + def iterkeys(self): + return iter(self._count_map) + + def keys(self): + return list(self.iterkeys()) + + def itervalues(self): + count_map = self._count_map + for k in count_map: + yield count_map[k][0] + + def values(self): + return list(self.itervalues()) + + def iteritems(self): + count_map = self._count_map + for k in count_map: + yield (k, count_map[k][0]) + + def items(self): + return list(self.iteritems()) + + def get(self, key, default=0): + "Get count for *key*, defaulting to 0." + try: + return self[key] + except KeyError: + return default + + def update(self, iterable, **kwargs): + """Like dict.update() but add counts instead of replacing them, used + to add multiple items in one call. + + Source can be an iterable of keys to add, or a mapping of keys + to integer counts. + """ + if iterable is not None: + if callable(getattr(iterable, 'iteritems', None)): + for key, count in iterable.iteritems(): + for i in range(count): + self.add(key) + else: + for key in iterable: + self.add(key) + if kwargs: + self.update(kwargs) + + +class MinIDMap: + """ + Assigns arbitrary weakref-able objects the smallest possible unique + integer IDs, such that no two objects have the same ID at the same + time. + + Maps arbitrary hashable objects to IDs. + + Based on https://gist.github.com/kurtbrose/25b48114de216a5e55df + """ + def __init__(self): + self.mapping = weakref.WeakKeyDictionary() + self.ref_map = {} + self.free = [] + + def get(self, a): + try: + return self.mapping[a][0] # if object is mapped, return ID + except KeyError: + pass + + if self.free: # if there are any free IDs, use the smallest + nxt = heapq.heappop(self.free) + else: # if there are no free numbers, use the next highest ID + nxt = len(self.mapping) + ref = weakref.ref(a, self._clean) + self.mapping[a] = (nxt, ref) + self.ref_map[ref] = nxt + return nxt + + def drop(self, a): + freed, ref = self.mapping[a] + del self.mapping[a] + del self.ref_map[ref] + heapq.heappush(self.free, freed) + + def _clean(self, ref): + print(self.ref_map[ref]) + heapq.heappush(self.free, self.ref_map[ref]) + del self.ref_map[ref] + + def __contains__(self, a): + return a in self.mapping + + def __iter__(self): + return iter(self.mapping) + + def __len__(self): + return self.mapping.__len__() + + def iteritems(self): + return iter((k, self.mapping[k][0]) for k in iter(self.mapping)) + + +# end cacheutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/debugutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/debugutils.py new file mode 100644 index 0000000000000000000000000000000000000000..16d18d4b9078d8864477cbe445d142addfae7134 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/debugutils.py @@ -0,0 +1,292 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" +A small set of utilities useful for debugging misbehaving +applications. Currently this focuses on ways to use :mod:`pdb`, the +built-in Python debugger. +""" + +import sys +import time +from reprlib import Repr + +try: + from .typeutils import make_sentinel + _UNSET = make_sentinel(var_name='_UNSET') +except ImportError: + _UNSET = object() + +__all__ = ['pdb_on_signal', 'pdb_on_exception', 'wrap_trace'] + + +def pdb_on_signal(signalnum=None): + """Installs a signal handler for *signalnum*, which defaults to + ``SIGINT``, or keyboard interrupt/ctrl-c. This signal handler + launches a :mod:`pdb` breakpoint. Results vary in concurrent + systems, but this technique can be useful for debugging infinite + loops, or easily getting into deep call stacks. + + Args: + signalnum (int): The signal number of the signal to handle + with pdb. Defaults to :mod:`signal.SIGINT`, see + :mod:`signal` for more information. + """ + import pdb + import signal + if not signalnum: + signalnum = signal.SIGINT + + old_handler = signal.getsignal(signalnum) + + def pdb_int_handler(sig, frame): + signal.signal(signalnum, old_handler) + pdb.set_trace() + pdb_on_signal(signalnum) # use 'u' to find your code and 'h' for help + + signal.signal(signalnum, pdb_int_handler) + return + + +def pdb_on_exception(limit=100): + """Installs a handler which, instead of exiting, attaches a + post-mortem pdb console whenever an unhandled exception is + encountered. + + Args: + limit (int): the max number of stack frames to display when + printing the traceback + + A similar effect can be achieved from the command-line using the + following command:: + + python -m pdb your_code.py + + But ``pdb_on_exception`` allows you to do this conditionally and within + your application. To restore default behavior, just do:: + + sys.excepthook = sys.__excepthook__ + """ + import pdb + import sys + import traceback + + def pdb_excepthook(exc_type, exc_val, exc_tb): + traceback.print_tb(exc_tb, limit=limit) + pdb.post_mortem(exc_tb) + + sys.excepthook = pdb_excepthook + return + +_repr_obj = Repr() +_repr_obj.maxstring = 50 +_repr_obj.maxother = 50 +brief_repr = _repr_obj.repr + + +# events: call, return, get, set, del, raise +def trace_print_hook(event, label, obj, attr_name, + args=(), kwargs={}, result=_UNSET): + fargs = (event.ljust(6), time.time(), label.rjust(10), + obj.__class__.__name__, attr_name) + if event == 'get': + tmpl = '%s %s - %s - %s.%s -> %s' + fargs += (brief_repr(result),) + elif event == 'set': + tmpl = '%s %s - %s - %s.%s = %s' + fargs += (brief_repr(args[0]),) + elif event == 'del': + tmpl = '%s %s - %s - %s.%s' + else: # call/return/raise + tmpl = '%s %s - %s - %s.%s(%s)' + fargs += (', '.join([brief_repr(a) for a in args]),) + if kwargs: + tmpl = '%s %s - %s - %s.%s(%s, %s)' + fargs += (', '.join([f'{k}={brief_repr(v)}' + for k, v in kwargs.items()]),) + if result is not _UNSET: + tmpl += ' -> %s' + fargs += (brief_repr(result),) + print(tmpl % fargs) + return + + +def wrap_trace(obj, hook=trace_print_hook, + which=None, events=None, label=None): + """Monitor an object for interactions. Whenever code calls a method, + gets an attribute, or sets an attribute, an event is called. By + default the trace output is printed, but a custom tracing *hook* + can be passed. + + Args: + obj (object): New- or old-style object to be traced. Built-in + objects like lists and dicts also supported. + hook (callable): A function called once for every event. See + below for details. + which (str): One or more attribute names to trace, or a + function accepting attribute name and value, and returning + True/False. + events (str): One or more kinds of events to call *hook* + on. Expected values are ``['get', 'set', 'del', 'call', + 'raise', 'return']``. Defaults to all events. + label (str): A name to associate with the traced object + Defaults to hexadecimal memory address, similar to repr. + + The object returned is not the same object as the one passed + in. It will not pass identity checks. However, it will pass + :func:`isinstance` checks, as it is a new instance of a new + subtype of the object passed. + + """ + # other actions: pdb.set_trace, print, aggregate, aggregate_return + # (like aggregate but with the return value) + + # TODO: test classmethod/staticmethod/property + # TODO: wrap __dict__ for old-style classes? + + if isinstance(which, str): + which_func = lambda attr_name, attr_val: attr_name == which + elif callable(getattr(which, '__contains__', None)): + which_func = lambda attr_name, attr_val: attr_name in which + elif which is None or callable(which): + which_func = which + else: + raise TypeError('expected attr name(s) or callable, not: %r' % which) + + label = label or hex(id(obj)) + + if isinstance(events, str): + events = [events] + do_get = not events or 'get' in events + do_set = not events or 'set' in events + do_del = not events or 'del' in events + do_call = not events or 'call' in events + do_raise = not events or 'raise' in events + do_return = not events or 'return' in events + + def wrap_method(attr_name, func, _hook=hook, _label=label): + def wrapped(*a, **kw): + a = a[1:] + if do_call: + hook(event='call', label=_label, obj=obj, + attr_name=attr_name, args=a, kwargs=kw) + if do_raise: + try: + ret = func(*a, **kw) + except Exception: + if not hook(event='raise', label=_label, obj=obj, + attr_name=attr_name, args=a, kwargs=kw, + result=sys.exc_info()): + raise + else: + ret = func(*a, **kw) + if do_return: + hook(event='return', label=_label, obj=obj, + attr_name=attr_name, args=a, kwargs=kw, result=ret) + return ret + + wrapped.__name__ = func.__name__ + wrapped.__doc__ = func.__doc__ + try: + wrapped.__module__ = func.__module__ + except Exception: + pass + try: + if func.__dict__: + wrapped.__dict__.update(func.__dict__) + except Exception: + pass + return wrapped + + def __getattribute__(self, attr_name): + ret = type(obj).__getattribute__(obj, attr_name) + if callable(ret): # wrap any bound methods + ret = type(obj).__getattribute__(self, attr_name) + if do_get: + hook('get', label, obj, attr_name, (), {}, result=ret) + return ret + + def __setattr__(self, attr_name, value): + type(obj).__setattr__(obj, attr_name, value) + if do_set: + hook('set', label, obj, attr_name, (value,), {}) + return + + def __delattr__(self, attr_name): + type(obj).__delattr__(obj, attr_name) + if do_del: + hook('del', label, obj, attr_name, (), {}) + return + + attrs = {} + for attr_name in dir(obj): + try: + attr_val = getattr(obj, attr_name) + except Exception: + continue + + if not callable(attr_val) or attr_name in ('__new__',): + continue + elif which_func and not which_func(attr_name, attr_val): + continue + + if attr_name == '__getattribute__': + wrapped_method = __getattribute__ + elif attr_name == '__setattr__': + wrapped_method = __setattr__ + elif attr_name == '__delattr__': + wrapped_method = __delattr__ + else: + wrapped_method = wrap_method(attr_name, attr_val) + attrs[attr_name] = wrapped_method + + cls_name = obj.__class__.__name__ + if cls_name == cls_name.lower(): + type_name = 'traced_' + cls_name + else: + type_name = 'Traced' + cls_name + + if hasattr(obj, '__mro__'): + bases = (obj.__class__,) + else: + # need new-style class for even basic wrapping of callables to + # work. getattribute won't work for old-style classes of course. + bases = (obj.__class__, object) + + trace_type = type(type_name, bases, attrs) + for cls in trace_type.__mro__: + try: + return cls.__new__(trace_type) + except Exception: + pass + raise TypeError('unable to wrap_trace %r instance %r' + % (obj.__class__, obj)) + + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/deprutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/deprutils.py new file mode 100644 index 0000000000000000000000000000000000000000..6c56736f98156e3b1aa63d867f23f400601bab8a --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/deprutils.py @@ -0,0 +1,63 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import sys +from types import ModuleType +from warnings import warn + +# todo: only warn once + + +class DeprecatableModule(ModuleType): + def __init__(self, module): + name = module.__name__ + super().__init__(name=name) + self.__dict__.update(module.__dict__) + + def __getattribute__(self, name): + get_attribute = super().__getattribute__ + try: + depros = get_attribute('_deprecated_members') + except AttributeError: + self._deprecated_members = depros = {} + ret = get_attribute(name) + message = depros.get(name) + if message is not None: + warn(message, DeprecationWarning, stacklevel=2) + return ret + + +def deprecate_module_member(mod_name, name, message): + module = sys.modules[mod_name] + if not isinstance(module, DeprecatableModule): + sys.modules[mod_name] = module = DeprecatableModule(module) + module._deprecated_members[name] = message + return diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/dictutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/dictutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f913f29f61fc4e1d2f5f5ef6dc32936817ab33f2 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/dictutils.py @@ -0,0 +1,1120 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python has a very powerful mapping type at its core: the :class:`dict` +type. While versatile and featureful, the :class:`dict` prioritizes +simplicity and performance. As a result, it does not retain the order +of item insertion [1]_, nor does it store multiple values per key. It +is a fast, unordered 1:1 mapping. + +The :class:`OrderedMultiDict` contrasts to the built-in :class:`dict`, +as a relatively maximalist, ordered 1:n subtype of +:class:`dict`. Virtually every feature of :class:`dict` has been +retooled to be intuitive in the face of this added +complexity. Additional methods have been added, such as +:class:`collections.Counter`-like functionality. + +A prime advantage of the :class:`OrderedMultiDict` (OMD) is its +non-destructive nature. Data can be added to an :class:`OMD` without being +rearranged or overwritten. The property can allow the developer to +work more freely with the data, as well as make more assumptions about +where input data will end up in the output, all without any extra +work. + +One great example of this is the :meth:`OMD.inverted()` method, which +returns a new OMD with the values as keys and the keys as values. All +the data and the respective order is still represented in the inverted +form, all from an operation which would be outright wrong and reckless +with a built-in :class:`dict` or :class:`collections.OrderedDict`. + +The OMD has been performance tuned to be suitable for a wide range of +usages, including as a basic unordered MultiDict. Special +thanks to `Mark Williams`_ for all his help. + +.. [1] As of 2015, `basic dicts on PyPy are ordered + `_, + and as of December 2017, `basic dicts in CPython 3 are now ordered + `_, as + well. +.. _Mark Williams: https://github.com/markrwilliams + +""" + +from collections.abc import KeysView, ValuesView, ItemsView +from itertools import zip_longest + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + + +PREV, NEXT, KEY, VALUE, SPREV, SNEXT = range(6) + + +__all__ = ['MultiDict', 'OMD', 'OrderedMultiDict', 'OneToOne', 'ManyToMany', 'subdict', 'FrozenDict'] + + +class OrderedMultiDict(dict): + """A MultiDict is a dictionary that can have multiple values per key + and the OrderedMultiDict (OMD) is a MultiDict that retains + original insertion order. Common use cases include: + + * handling query strings parsed from URLs + * inverting a dictionary to create a reverse index (values to keys) + * stacking data from multiple dictionaries in a non-destructive way + + The OrderedMultiDict constructor is identical to the built-in + :class:`dict`, and overall the API constitutes an intuitive + superset of the built-in type: + + >>> omd = OrderedMultiDict() + >>> omd['a'] = 1 + >>> omd['b'] = 2 + >>> omd.add('a', 3) + >>> omd.get('a') + 3 + >>> omd.getlist('a') + [1, 3] + + Some non-:class:`dict`-like behaviors also make an appearance, + such as support for :func:`reversed`: + + >>> list(reversed(omd)) + ['b', 'a'] + + Note that unlike some other MultiDicts, this OMD gives precedence + to the most recent value added. ``omd['a']`` refers to ``3``, not + ``1``. + + >>> omd + OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> omd.poplast('a') + 3 + >>> omd + OrderedMultiDict([('a', 1), ('b', 2)]) + >>> omd.pop('a') + 1 + >>> omd + OrderedMultiDict([('b', 2)]) + + If you want a safe-to-modify or flat dictionary, use + :meth:`OrderedMultiDict.todict()`. + + >>> from pprint import pprint as pp # preserve printed ordering + >>> omd = OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> pp(omd.todict()) + {'a': 3, 'b': 2} + >>> pp(omd.todict(multi=True)) + {'a': [1, 3], 'b': [2]} + + With ``multi=False``, items appear with the keys in to original + insertion order, alongside the most-recently inserted value for + that key. + + >>> OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]).items(multi=False) + [('a', 3), ('b', 2)] + + .. warning:: + + ``dict(omd)`` changed behavior `in Python 3.7 + `_ due to changes made to + support the transition from :class:`collections.OrderedDict` to + the built-in dictionary being ordered. Before 3.7, the result + would be a new dictionary, with values that were lists, similar + to ``omd.todict(multi=True)`` (but only shallow-copy; the lists + were direct references to OMD internal structures). From 3.7 + onward, the values became singular, like + ``omd.todict(multi=False)``. For reliable cross-version + behavior, just use :meth:`~OrderedMultiDict.todict()`. + + """ + def __new__(cls, *a, **kw): + ret = super().__new__(cls) + ret._clear_ll() + return ret + + def __init__(self, *args, **kwargs): + if len(args) > 1: + raise TypeError('%s expected at most 1 argument, got %s' + % (self.__class__.__name__, len(args))) + super().__init__() + + if args: + self.update_extend(args[0]) + if kwargs: + self.update(kwargs) + + def __getstate__(self): + return list(self.iteritems(multi=True)) + + def __setstate__(self, state): + self.clear() + self.update_extend(state) + + def _clear_ll(self): + try: + _map = self._map + except AttributeError: + _map = self._map = {} + self.root = [] + _map.clear() + self.root[:] = [self.root, self.root, None] + + def _insert(self, k, v): + root = self.root + cells = self._map.setdefault(k, []) + last = root[PREV] + cell = [last, root, k, v] + last[NEXT] = root[PREV] = cell + cells.append(cell) + + def add(self, k, v): + """Add a single value *v* under a key *k*. Existing values under *k* + are preserved. + """ + values = super().setdefault(k, []) + self._insert(k, v) + values.append(v) + + def addlist(self, k, v): + """Add an iterable of values underneath a specific key, preserving + any values already under that key. + + >>> omd = OrderedMultiDict([('a', -1)]) + >>> omd.addlist('a', range(3)) + >>> omd + OrderedMultiDict([('a', -1), ('a', 0), ('a', 1), ('a', 2)]) + + Called ``addlist`` for consistency with :meth:`getlist`, but + tuples and other sequences and iterables work. + """ + if not v: + return + self_insert = self._insert + values = super().setdefault(k, []) + for subv in v: + self_insert(k, subv) + values.extend(v) + + def get(self, k, default=None): + """Return the value for key *k* if present in the dictionary, else + *default*. If *default* is not given, ``None`` is returned. + This method never raises a :exc:`KeyError`. + + To get all values under a key, use :meth:`OrderedMultiDict.getlist`. + """ + return super().get(k, [default])[-1] + + def getlist(self, k, default=_MISSING): + """Get all values for key *k* as a list, if *k* is in the + dictionary, else *default*. The list returned is a copy and + can be safely mutated. If *default* is not given, an empty + :class:`list` is returned. + """ + try: + return super().__getitem__(k)[:] + except KeyError: + if default is _MISSING: + return [] + return default + + def clear(self): + "Empty the dictionary." + super().clear() + self._clear_ll() + + def setdefault(self, k, default=_MISSING): + """If key *k* is in the dictionary, return its value. If not, insert + *k* with a value of *default* and return *default*. *default* + defaults to ``None``. See :meth:`dict.setdefault` for more + information. + """ + if not super().__contains__(k): + self[k] = None if default is _MISSING else default + return self[k] + + def copy(self): + "Return a shallow copy of the dictionary." + return self.__class__(self.iteritems(multi=True)) + + @classmethod + def fromkeys(cls, keys, default=None): + """Create a dictionary from a list of keys, with all the values + set to *default*, or ``None`` if *default* is not set. + """ + return cls([(k, default) for k in keys]) + + def update(self, E, **F): + """Add items from a dictionary or iterable (and/or keyword arguments), + overwriting values under an existing key. See + :meth:`dict.update` for more details. + """ + # E and F are throwback names to the dict() __doc__ + if E is self: + return + self_add = self.add + if isinstance(E, OrderedMultiDict): + for k in E: + if k in self: + del self[k] + for k, v in E.iteritems(multi=True): + self_add(k, v) + elif callable(getattr(E, 'keys', None)): + for k in E.keys(): + self[k] = E[k] + else: + seen = set() + seen_add = seen.add + for k, v in E: + if k not in seen and k in self: + del self[k] + seen_add(k) + self_add(k, v) + for k in F: + self[k] = F[k] + return + + def update_extend(self, E, **F): + """Add items from a dictionary, iterable, and/or keyword + arguments without overwriting existing items present in the + dictionary. Like :meth:`update`, but adds to existing keys + instead of overwriting them. + """ + if E is self: + iterator = iter(E.items()) + elif isinstance(E, OrderedMultiDict): + iterator = E.iteritems(multi=True) + elif hasattr(E, 'keys'): + iterator = ((k, E[k]) for k in E.keys()) + else: + iterator = E + + self_add = self.add + for k, v in iterator: + self_add(k, v) + + def __setitem__(self, k, v): + if super().__contains__(k): + self._remove_all(k) + self._insert(k, v) + super().__setitem__(k, [v]) + + def __getitem__(self, k): + return super().__getitem__(k)[-1] + + def __delitem__(self, k): + super().__delitem__(k) + self._remove_all(k) + + def __eq__(self, other): + if self is other: + return True + try: + if len(other) != len(self): + return False + except TypeError: + return False + if isinstance(other, OrderedMultiDict): + selfi = self.iteritems(multi=True) + otheri = other.iteritems(multi=True) + zipped_items = zip_longest(selfi, otheri, fillvalue=(None, None)) + for (selfk, selfv), (otherk, otherv) in zipped_items: + if selfk != otherk or selfv != otherv: + return False + if not(next(selfi, _MISSING) is _MISSING + and next(otheri, _MISSING) is _MISSING): + # leftovers (TODO: watch for StopIteration?) + return False + return True + elif hasattr(other, 'keys'): + for selfk in self: + try: + other[selfk] == self[selfk] + except KeyError: + return False + return True + return False + + def __ne__(self, other): + return not (self == other) + + def __ior__(self, other): + self.update(other) + return self + + def pop(self, k, default=_MISSING): + """Remove all values under key *k*, returning the most-recently + inserted value. Raises :exc:`KeyError` if the key is not + present and no *default* is provided. + """ + try: + return self.popall(k)[-1] + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + + def popall(self, k, default=_MISSING): + """Remove all values under key *k*, returning them in the form of + a list. Raises :exc:`KeyError` if the key is not present and no + *default* is provided. + """ + super_self = super() + if super_self.__contains__(k): + self._remove_all(k) + if default is _MISSING: + return super_self.pop(k) + return super_self.pop(k, default) + + def poplast(self, k=_MISSING, default=_MISSING): + """Remove and return the most-recently inserted value under the key + *k*, or the most-recently inserted key if *k* is not + provided. If no values remain under *k*, it will be removed + from the OMD. Raises :exc:`KeyError` if *k* is not present in + the dictionary, or the dictionary is empty. + """ + if k is _MISSING: + if self: + k = self.root[PREV][KEY] + else: + if default is _MISSING: + raise KeyError('empty %r' % type(self)) + return default + try: + self._remove(k) + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + values = super().__getitem__(k) + v = values.pop() + if not values: + super().__delitem__(k) + return v + + def _remove(self, k): + values = self._map[k] + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + if not values: + del self._map[k] + + def _remove_all(self, k): + values = self._map[k] + while values: + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + del self._map[k] + + def iteritems(self, multi=False): + """Iterate over the OMD's items in insertion order. By default, + yields only the most-recently inserted value for each key. Set + *multi* to ``True`` to get all inserted items. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY], curr[VALUE] + curr = curr[NEXT] + else: + for key in self.iterkeys(): + yield key, self[key] + + def iterkeys(self, multi=False): + """Iterate over the OMD's keys in insertion order. By default, yields + each key once, according to the most recent insertion. Set + *multi* to ``True`` to get all keys, including duplicates, in + insertion order. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY] + curr = curr[NEXT] + else: + yielded = set() + yielded_add = yielded.add + while curr is not root: + k = curr[KEY] + if k not in yielded: + yielded_add(k) + yield k + curr = curr[NEXT] + + def itervalues(self, multi=False): + """Iterate over the OMD's values in insertion order. By default, + yields the most-recently inserted value per unique key. Set + *multi* to ``True`` to get all values according to insertion + order. + """ + for k, v in self.iteritems(multi=multi): + yield v + + def todict(self, multi=False): + """Gets a basic :class:`dict` of the items in this dictionary. Keys + are the same as the OMD, values are the most recently inserted + values for each key. + + Setting the *multi* arg to ``True`` is yields the same + result as calling :class:`dict` on the OMD, except that all the + value lists are copies that can be safely mutated. + """ + if multi: + return {k: self.getlist(k) for k in self} + return {k: self[k] for k in self} + + def sorted(self, key=None, reverse=False): + """Similar to the built-in :func:`sorted`, except this method returns + a new :class:`OrderedMultiDict` sorted by the provided key + function, optionally reversed. + + Args: + key (callable): A callable to determine the sort key of + each element. The callable should expect an **item** + (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict(zip(range(3), range(3))) + >>> omd.sorted(reverse=True) + OrderedMultiDict([(2, 2), (1, 1), (0, 0)]) + + Note that the key function receives an **item** (key-value + tuple), so the recommended signature looks like: + + >>> omd = OrderedMultiDict(zip('hello', 'world')) + >>> omd.sorted(key=lambda i: i[1]) # i[0] is the key, i[1] is the val + OrderedMultiDict([('o', 'd'), ('l', 'l'), ('e', 'o'), ('l', 'r'), ('h', 'w')]) + """ + cls = self.__class__ + return cls(sorted(self.iteritems(multi=True), key=key, reverse=reverse)) + + def sortedvalues(self, key=None, reverse=False): + """Returns a copy of the :class:`OrderedMultiDict` with the same keys + in the same order as the original OMD, but the values within + each keyspace have been sorted according to *key* and + *reverse*. + + Args: + key (callable): A single-argument callable to determine + the sort key of each element. The callable should expect + an **item** (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict() + >>> omd.addlist('even', [6, 2]) + >>> omd.addlist('odd', [1, 5]) + >>> omd.add('even', 4) + >>> omd.add('odd', 3) + >>> somd = omd.sortedvalues() + >>> somd.getlist('even') + [2, 4, 6] + >>> somd.keys(multi=True) == omd.keys(multi=True) + True + >>> omd == somd + False + >>> somd + OrderedMultiDict([('even', 2), ('even', 4), ('odd', 1), ('odd', 3), ('even', 6), ('odd', 5)]) + + As demonstrated above, contents and key order are + retained. Only value order changes. + """ + try: + superself_iteritems = super().iteritems() + except AttributeError: + superself_iteritems = super().items() + # (not reverse) because they pop off in reverse order for reinsertion + sorted_val_map = {k: sorted(v, key=key, reverse=(not reverse)) + for k, v in superself_iteritems} + ret = self.__class__() + for k in self.iterkeys(multi=True): + ret.add(k, sorted_val_map[k].pop()) + return ret + + def inverted(self): + """Returns a new :class:`OrderedMultiDict` with values and keys + swapped, like creating dictionary transposition or reverse + index. Insertion order is retained and all keys and values + are represented in the output. + + >>> omd = OMD([(0, 2), (1, 2)]) + >>> omd.inverted().getlist(2) + [0, 1] + + Inverting twice yields a copy of the original: + + >>> omd.inverted().inverted() + OrderedMultiDict([(0, 2), (1, 2)]) + """ + return self.__class__((v, k) for k, v in self.iteritems(multi=True)) + + def counts(self): + """Returns a mapping from key to number of values inserted under that + key. Like :py:class:`collections.Counter`, but returns a new + :class:`OrderedMultiDict`. + """ + # Returns an OMD because Counter/OrderedDict may not be + # available, and neither Counter nor dict maintain order. + super_getitem = super().__getitem__ + return self.__class__((k, len(super_getitem(k))) for k in self) + + def keys(self, multi=False): + """Returns a list containing the output of :meth:`iterkeys`. See + that method's docs for more details. + """ + return list(self.iterkeys(multi=multi)) + + def values(self, multi=False): + """Returns a list containing the output of :meth:`itervalues`. See + that method's docs for more details. + """ + return list(self.itervalues(multi=multi)) + + def items(self, multi=False): + """Returns a list containing the output of :meth:`iteritems`. See + that method's docs for more details. + """ + return list(self.iteritems(multi=multi)) + + def __iter__(self): + return self.iterkeys() + + def __reversed__(self): + root = self.root + curr = root[PREV] + lengths = {} + lengths_sd = lengths.setdefault + get_values = super().__getitem__ + while curr is not root: + k = curr[KEY] + vals = get_values(k) + if lengths_sd(k, 1) == len(vals): + yield k + lengths[k] += 1 + curr = curr[PREV] + + def __repr__(self): + cn = self.__class__.__name__ + kvs = ', '.join([repr((k, v)) for k, v in self.iteritems(multi=True)]) + return f'{cn}([{kvs}])' + + def viewkeys(self): + "OMD.viewkeys() -> a set-like object providing a view on OMD's keys" + return KeysView(self) + + def viewvalues(self): + "OMD.viewvalues() -> an object providing a view on OMD's values" + return ValuesView(self) + + def viewitems(self): + "OMD.viewitems() -> a set-like object providing a view on OMD's items" + return ItemsView(self) + + +# A couple of convenient aliases +OMD = OrderedMultiDict +MultiDict = OrderedMultiDict + + +class FastIterOrderedMultiDict(OrderedMultiDict): + """An OrderedMultiDict backed by a skip list. Iteration over keys + is faster and uses constant memory but adding duplicate key-value + pairs is slower. Brainchild of Mark Williams. + """ + def _clear_ll(self): + # TODO: always reset objects? (i.e., no else block below) + try: + _map = self._map + except AttributeError: + _map = self._map = {} + self.root = [] + _map.clear() + self.root[:] = [self.root, self.root, + None, None, + self.root, self.root] + + def _insert(self, k, v): + root = self.root + empty = [] + cells = self._map.setdefault(k, empty) + last = root[PREV] + + if cells is empty: + cell = [last, root, + k, v, + last, root] + # was the last one skipped? + if last[SPREV][SNEXT] is root: + last[SPREV][SNEXT] = cell + last[NEXT] = last[SNEXT] = root[PREV] = root[SPREV] = cell + cells.append(cell) + else: + # if the previous was skipped, go back to the cell that + # skipped it + sprev = last[SPREV] if (last[SPREV][SNEXT] is not last) else last + cell = [last, root, + k, v, + sprev, root] + # skip me + last[SNEXT] = root + last[NEXT] = root[PREV] = root[SPREV] = cell + cells.append(cell) + + def _remove(self, k): + cells = self._map[k] + cell = cells.pop() + if not cells: + del self._map[k] + cell[PREV][SNEXT] = cell[SNEXT] + + if cell[PREV][SPREV][SNEXT] is cell: + cell[PREV][SPREV][SNEXT] = cell[NEXT] + elif cell[SNEXT] is cell[NEXT]: + cell[SPREV][SNEXT], cell[SNEXT][SPREV] = cell[SNEXT], cell[SPREV] + + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + + def _remove_all(self, k): + cells = self._map.pop(k) + while cells: + cell = cells.pop() + if cell[PREV][SPREV][SNEXT] is cell: + cell[PREV][SPREV][SNEXT] = cell[NEXT] + elif cell[SNEXT] is cell[NEXT]: + cell[SPREV][SNEXT], cell[SNEXT][SPREV] = cell[SNEXT], cell[SPREV] + + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + cell[PREV][SNEXT] = cell[SNEXT] + + def iteritems(self, multi=False): + next_link = NEXT if multi else SNEXT + root = self.root + curr = root[next_link] + while curr is not root: + yield curr[KEY], curr[VALUE] + curr = curr[next_link] + + def iterkeys(self, multi=False): + next_link = NEXT if multi else SNEXT + root = self.root + curr = root[next_link] + while curr is not root: + yield curr[KEY] + curr = curr[next_link] + + def __reversed__(self): + root = self.root + curr = root[PREV] + while curr is not root: + if curr[SPREV][SNEXT] is not curr: + curr = curr[SPREV] + if curr is root: + break + yield curr[KEY] + curr = curr[PREV] + + +_OTO_INV_MARKER = object() +_OTO_UNIQUE_MARKER = object() + + +class OneToOne(dict): + """Implements a one-to-one mapping dictionary. In addition to + inheriting from and behaving exactly like the builtin + :class:`dict`, all values are automatically added as keys on a + reverse mapping, available as the `inv` attribute. This + arrangement keeps key and value namespaces distinct. + + Basic operations are intuitive: + + >>> oto = OneToOne({'a': 1, 'b': 2}) + >>> print(oto['a']) + 1 + >>> print(oto.inv[1]) + a + >>> len(oto) + 2 + + Overwrites happens in both directions: + + >>> oto.inv[1] = 'c' + >>> print(oto.get('a')) + None + >>> len(oto) + 2 + + For a very similar project, with even more one-to-one + functionality, check out `bidict `_. + """ + __slots__ = ('inv',) + + def __init__(self, *a, **kw): + raise_on_dupe = False + if a: + if a[0] is _OTO_INV_MARKER: + self.inv = a[1] + dict.__init__(self, [(v, k) for k, v in self.inv.items()]) + return + elif a[0] is _OTO_UNIQUE_MARKER: + a, raise_on_dupe = a[1:], True + + dict.__init__(self, *a, **kw) + self.inv = self.__class__(_OTO_INV_MARKER, self) + + if len(self) == len(self.inv): + # if lengths match, that means everything's unique + return + + if not raise_on_dupe: + dict.clear(self) + dict.update(self, [(v, k) for k, v in self.inv.items()]) + return + + # generate an error message if the values aren't 1:1 + + val_multidict = {} + for k, v in self.items(): + val_multidict.setdefault(v, []).append(k) + + dupes = {v: k_list for v, k_list in + val_multidict.items() if len(k_list) > 1} + + raise ValueError('expected unique values, got multiple keys for' + ' the following values: %r' % dupes) + + @classmethod + def unique(cls, *a, **kw): + """This alternate constructor for OneToOne will raise an exception + when input values overlap. For instance: + + >>> OneToOne.unique({'a': 1, 'b': 1}) + Traceback (most recent call last): + ... + ValueError: expected unique values, got multiple keys for the following values: ... + + This even works across inputs: + + >>> a_dict = {'a': 2} + >>> OneToOne.unique(a_dict, b=2) + Traceback (most recent call last): + ... + ValueError: expected unique values, got multiple keys for the following values: ... + """ + return cls(_OTO_UNIQUE_MARKER, *a, **kw) + + def __setitem__(self, key, val): + hash(val) # ensure val is a valid key + if key in self: + dict.__delitem__(self.inv, self[key]) + if val in self.inv: + del self.inv[val] + dict.__setitem__(self, key, val) + dict.__setitem__(self.inv, val, key) + + def __delitem__(self, key): + dict.__delitem__(self.inv, self[key]) + dict.__delitem__(self, key) + + def clear(self): + dict.clear(self) + dict.clear(self.inv) + + def copy(self): + return self.__class__(self) + + def pop(self, key, default=_MISSING): + if key in self: + dict.__delitem__(self.inv, self[key]) + return dict.pop(self, key) + if default is not _MISSING: + return default + raise KeyError() + + def popitem(self): + key, val = dict.popitem(self) + dict.__delitem__(self.inv, val) + return key, val + + def setdefault(self, key, default=None): + if key not in self: + self[key] = default + return self[key] + + def update(self, dict_or_iterable, **kw): + keys_vals = [] + if isinstance(dict_or_iterable, dict): + for val in dict_or_iterable.values(): + hash(val) + keys_vals = list(dict_or_iterable.items()) + else: + for key, val in dict_or_iterable: + hash(key) + hash(val) + keys_vals = list(dict_or_iterable) + for val in kw.values(): + hash(val) + keys_vals.extend(kw.items()) + for key, val in keys_vals: + self[key] = val + + def __repr__(self): + cn = self.__class__.__name__ + dict_repr = dict.__repr__(self) + return f"{cn}({dict_repr})" + + +# marker for the secret handshake used internally to set up the invert ManyToMany +_PAIRING = object() + + +class ManyToMany: + """ + a dict-like entity that represents a many-to-many relationship + between two groups of objects + + behaves like a dict-of-tuples; also has .inv which is kept + up to date which is a dict-of-tuples in the other direction + + also, can be used as a directed graph among hashable python objects + """ + def __init__(self, items=None): + self.data = {} + if type(items) is tuple and items and items[0] is _PAIRING: + self.inv = items[1] + else: + self.inv = self.__class__((_PAIRING, self)) + if items: + self.update(items) + return + + def get(self, key, default=frozenset()): + try: + return self[key] + except KeyError: + return default + + def __getitem__(self, key): + return frozenset(self.data[key]) + + def __setitem__(self, key, vals): + vals = set(vals) + if key in self: + to_remove = self.data[key] - vals + vals -= self.data[key] + for val in to_remove: + self.remove(key, val) + for val in vals: + self.add(key, val) + + def __delitem__(self, key): + for val in self.data.pop(key): + self.inv.data[val].remove(key) + if not self.inv.data[val]: + del self.inv.data[val] + + def update(self, iterable): + """given an iterable of (key, val), add them all""" + if type(iterable) is type(self): + other = iterable + for k in other.data: + if k not in self.data: + self.data[k] = other.data[k] + else: + self.data[k].update(other.data[k]) + for k in other.inv.data: + if k not in self.inv.data: + self.inv.data[k] = other.inv.data[k] + else: + self.inv.data[k].update(other.inv.data[k]) + elif callable(getattr(iterable, 'keys', None)): + for k in iterable.keys(): + self.add(k, iterable[k]) + else: + for key, val in iterable: + self.add(key, val) + return + + def add(self, key, val): + if key not in self.data: + self.data[key] = set() + self.data[key].add(val) + if val not in self.inv.data: + self.inv.data[val] = set() + self.inv.data[val].add(key) + + def remove(self, key, val): + self.data[key].remove(val) + if not self.data[key]: + del self.data[key] + self.inv.data[val].remove(key) + if not self.inv.data[val]: + del self.inv.data[val] + + def replace(self, key, newkey): + """ + replace instances of key by newkey + """ + if key not in self.data: + return + self.data[newkey] = fwdset = self.data.pop(key) + for val in fwdset: + revset = self.inv.data[val] + revset.remove(key) + revset.add(newkey) + + def iteritems(self): + for key in self.data: + for val in self.data[key]: + yield key, val + + def keys(self): + return self.data.keys() + + def __contains__(self, key): + return key in self.data + + def __iter__(self): + return self.data.__iter__() + + def __len__(self): + return self.data.__len__() + + def __eq__(self, other): + return type(self) == type(other) and self.data == other.data + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({list(self.iteritems())!r})' + + +def subdict(d, keep=None, drop=None): + """Compute the "subdictionary" of a dict, *d*. + + A subdict is to a dict what a subset is a to set. If *A* is a + subdict of *B*, that means that all keys of *A* are present in + *B*. + + Returns a new dict with any keys in *drop* removed, and any keys + in *keep* still present, provided they were in the original + dict. *keep* defaults to all keys, *drop* defaults to empty, so + without one of these arguments, calling this function is + equivalent to calling ``dict()``. + + >>> from pprint import pprint as pp + >>> pp(subdict({'a': 1, 'b': 2})) + {'a': 1, 'b': 2} + >>> subdict({'a': 1, 'b': 2, 'c': 3}, drop=['b', 'c']) + {'a': 1} + >>> pp(subdict({'a': 1, 'b': 2, 'c': 3}, keep=['a', 'c'])) + {'a': 1, 'c': 3} + + """ + if keep is None: + keep = d.keys() + if drop is None: + drop = [] + + keys = set(keep) - set(drop) + + return type(d)([(k, v) for k, v in d.items() if k in keys]) + + +class FrozenHashError(TypeError): + pass + + +class FrozenDict(dict): + """An immutable dict subtype that is hashable and can itself be used + as a :class:`dict` key or :class:`set` entry. What + :class:`frozenset` is to :class:`set`, FrozenDict is to + :class:`dict`. + + There was once an attempt to introduce such a type to the standard + library, but it was rejected: `PEP 416 `_. + + Because FrozenDict is a :class:`dict` subtype, it automatically + works everywhere a dict would, including JSON serialization. + + """ + __slots__ = ('_hash',) + + def updated(self, *a, **kw): + """Make a copy and add items from a dictionary or iterable (and/or + keyword arguments), overwriting values under an existing + key. See :meth:`dict.update` for more details. + """ + data = dict(self) + data.update(*a, **kw) + return type(self)(data) + + @classmethod + def fromkeys(cls, keys, value=None): + # one of the lesser known and used/useful dict methods + return cls(dict.fromkeys(keys, value)) + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({dict.__repr__(self)})' + + def __reduce_ex__(self, protocol): + return type(self), (dict(self),) + + def __hash__(self): + try: + ret = self._hash + except AttributeError: + try: + ret = self._hash = hash(frozenset(self.items())) + except Exception as e: + ret = self._hash = FrozenHashError(e) + + if ret.__class__ is FrozenHashError: + raise ret + + return ret + + def __copy__(self): + return self # immutable types don't copy, see tuple's behavior + + # block everything else + def _raise_frozen_typeerror(self, *a, **kw): + "raises a TypeError, because FrozenDicts are immutable" + raise TypeError('%s object is immutable' % self.__class__.__name__) + + __ior__ = __setitem__ = __delitem__ = update = _raise_frozen_typeerror + setdefault = pop = popitem = clear = _raise_frozen_typeerror + + del _raise_frozen_typeerror + + +# end dictutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/easterutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/easterutils.py new file mode 100644 index 0000000000000000000000000000000000000000..02a930a6b26d714b1037fff3059293a6a23ac0e6 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/easterutils.py @@ -0,0 +1,44 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +def gobs_program(): + """ + A pure-Python implementation of Gob's Algorithm (2006). A brief + explanation can be found here: + https://www.youtube.com/watch?v=JbnjusltDHk + """ + while True: + print("Penus", end=" ") + + +if __name__ == '__main__': + gobs_program() diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/ecoutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/ecoutils.py new file mode 100644 index 0000000000000000000000000000000000000000..23fb25fbf329a4b10ea5c4fa5c3fd250257b12ee --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/ecoutils.py @@ -0,0 +1,479 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""As a programming ecosystem grows, so do the chances of runtime +variability. + +Python boasts one of the widest deployments for a high-level +programming environment, making it a viable target for all manner of +application. But with breadth comes variance, so it's important to +know what you're working with. + +Some basic variations that are common among development machines: + +* **Executable runtime**: CPython, PyPy, Jython, etc., plus build date and compiler +* **Language version**: 2.7 through 3.12 +* **Host operating system**: Windows, OS X, Ubuntu, Debian, CentOS, RHEL, etc. +* **Features**: 64-bit, IPv6, Unicode character support (UCS-2/UCS-4) +* **Built-in library support**: OpenSSL, threading, SQLite, zlib +* **User environment**: umask, ulimit, working directory path +* **Machine info**: CPU count, hostname, filesystem encoding + +See the full example profile below for more. + +ecoutils was created to quantify that variability. ecoutils quickly +produces an information-dense description of critical runtime factors, +with minimal side effects. In short, ecoutils is like browser and user +agent analytics, but for Python environments. + +Transmission and collection +--------------------------- + +The data is all JSON serializable, and is suitable for sending to a +central analytics server. An HTTP-backed service for this can be found +at: https://github.com/mahmoud/espymetrics/ + +Notable omissions +----------------- + +Due to space constraints (and possibly latency constraints), the +following information is deemed not dense enough, and thus omitted: + +* :data:`sys.path` +* full :mod:`sysconfig` +* environment variables (:data:`os.environ`) + +Compatibility +------------- + +So far ecoutils has has been tested on Python 3.7+ and PyPy3. +Various versions have been tested on Ubuntu, Debian, +RHEL, OS X, FreeBSD, and Windows 7. + +.. note:: + + ``boltons.ecoutils`` historically supported back to Python 2.4, but in 2024, + due to increasing testing burden, ecoutils support tracks the same + versions of Python as the rest of the boltons package. + For older Pythons, see `this version`_ from boltons 23.0.0. + +.. _this version: https://github.com/mahmoud/boltons/blob/4b1d728f31a8378b193be9c966c853be0a57527d/boltons/ecoutils.py + +Profile generation +------------------ + +Profiles are generated by :func:`ecoutils.get_profile`. + +When run as a module, ecoutils will call :func:`~ecoutils.get_profile` +and print a profile in JSON format:: + + $ python -m boltons.ecoutils + { + "_eco_version": "1.0.0", + "cpu_count": 4, + "cwd": "/home/mahmoud/projects/boltons", + "fs_encoding": "UTF-8", + "guid": "6b139e7bbf5ad4ed8d4063bf6235b4d2", + "hostfqdn": "mahmoud-host", + "hostname": "mahmoud-host", + "linux_dist_name": "Ubuntu", + "linux_dist_version": "14.04", + "python": { + "argv": "boltons/ecoutils.py", + "bin": "/usr/bin/python", + "build_date": "Jun 22 2015 17:58:13", + "compiler": "GCC 4.8.2", + "features": { + "64bit": true, + "expat": "expat_2.1.0", + "ipv6": true, + "openssl": "OpenSSL 1.0.1f 6 Jan 2014", + "readline": true, + "sqlite": "3.8.2", + "threading": true, + "tkinter": "8.6", + "unicode_wide": true, + "zlib": "1.2.8" + }, + "version": "2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]", + "version_info": [ + 2, + 7, + 6, + "final", + 0 + ] + }, + "time_utc": "2016-05-24 07:59:40.473140", + "time_utc_offset": -8.0, + "ulimit_hard": 4096, + "ulimit_soft": 1024, + "umask": "002", + "uname": { + "machine": "x86_64", + "node": "mahmoud-host", + "processor": "x86_64", + "release": "3.13.0-85-generic", + "system": "Linux", + "version": "#129-Ubuntu SMP Thu Mar 17 20:50:15 UTC 2016" + }, + "username": "mahmoud" + } + +``pip install boltons`` and try it yourself! + +""" + +import re +import os +import sys +import json +import time +import random +import socket +import struct +import getpass +import datetime +import platform + +ECO_VERSION = '1.1.0' # see version history below + + +try: + getrandbits = random.SystemRandom().getrandbits + HAVE_URANDOM = True +except Exception: + HAVE_URANDOM = False + getrandbits = random.getrandbits + + +# 128-bit GUID just like a UUID, but backwards compatible to 2.4 +INSTANCE_ID = hex(getrandbits(128))[2:-1].lower() + +IS_64BIT = struct.calcsize("P") > 4 +HAVE_UCS4 = getattr(sys, 'maxunicode', 0) > 65536 +HAVE_READLINE = True + +try: + import readline +except Exception: + HAVE_READLINE = False + +try: + import sqlite3 + SQLITE_VERSION = sqlite3.sqlite_version +except Exception: + # note: 2.5 and older have sqlite, but not sqlite3 + SQLITE_VERSION = '' + + +try: + + import ssl + try: + OPENSSL_VERSION = ssl.OPENSSL_VERSION + except AttributeError: + # This is a conservative estimate for Python <2.6 + # SSL module added in 2006, when 0.9.7 was standard + OPENSSL_VERSION = 'OpenSSL >0.8.0' +except Exception: + OPENSSL_VERSION = '' + + +try: + import tkinter + TKINTER_VERSION = str(tkinter.TkVersion) +except Exception: + TKINTER_VERSION = '' + + +try: + import zlib + ZLIB_VERSION = zlib.ZLIB_VERSION +except Exception: + ZLIB_VERSION = '' + + +try: + from xml.parsers import expat + EXPAT_VERSION = expat.EXPAT_VERSION +except Exception: + EXPAT_VERSION = '' + + +try: + from multiprocessing import cpu_count + CPU_COUNT = cpu_count() +except Exception: + CPU_COUNT = 0 + +try: + import threading + HAVE_THREADING = True +except Exception: + HAVE_THREADING = False + + +try: + HAVE_IPV6 = socket.has_ipv6 +except Exception: + HAVE_IPV6 = False + + +try: + from resource import getrlimit, RLIMIT_NOFILE + RLIMIT_FDS_SOFT, RLIMIT_FDS_HARD = getrlimit(RLIMIT_NOFILE) +except Exception: + RLIMIT_FDS_SOFT, RLIMIT_FDS_HARD = 0, 0 + + +START_TIME_INFO = {'time_utc': str(datetime.datetime.now(datetime.timezone.utc)), + 'time_utc_offset': -time.timezone / 3600.0} + + +def get_python_info(): + ret = {} + ret['argv'] = _escape_shell_args(sys.argv) + ret['bin'] = sys.executable + + # Even though compiler/build_date are already here, they're + # actually parsed from the version string. So, in the rare case of + # the unparsable version string, we're still transmitting it. + ret['version'] = ' '.join(sys.version.split()) + + ret['compiler'] = platform.python_compiler() + ret['build_date'] = platform.python_build()[1] + ret['version_info'] = list(sys.version_info) + + ret['features'] = {'openssl': OPENSSL_VERSION, + 'expat': EXPAT_VERSION, + 'sqlite': SQLITE_VERSION, + 'tkinter': TKINTER_VERSION, + 'zlib': ZLIB_VERSION, + 'unicode_wide': HAVE_UCS4, + 'readline': HAVE_READLINE, + '64bit': IS_64BIT, + 'ipv6': HAVE_IPV6, + 'threading': HAVE_THREADING, + 'urandom': HAVE_URANDOM} + + return ret + + +def get_profile(**kwargs): + """The main entrypoint to ecoutils. Calling this will return a + JSON-serializable dictionary of information about the current + process. + + It is very unlikely that the information returned will change + during the lifetime of the process, and in most cases the majority + of the information stays the same between runs as well. + + :func:`get_profile` takes one optional keyword argument, *scrub*, + a :class:`bool` that, if True, blanks out identifiable + information. This includes current working directory, hostname, + Python executable path, command-line arguments, and + username. Values are replaced with '-', but for compatibility keys + remain in place. + + """ + scrub = kwargs.pop('scrub', False) + if kwargs: + raise TypeError(f'unexpected keyword arguments: {kwargs.keys()!r}') + ret = {} + try: + ret['username'] = getpass.getuser() + except Exception: + ret['username'] = '' + ret['guid'] = str(INSTANCE_ID) + ret['hostname'] = socket.gethostname() + ret['hostfqdn'] = socket.getfqdn() + uname = platform.uname() + ret['uname'] = {'system': uname[0], + 'node': uname[1], + 'release': uname[2], # linux: distro name + 'version': uname[3], # linux: kernel version + 'machine': uname[4], + 'processor': uname[5]} + try: + # TODO: removed in 3.7, replaced with freedesktop_os_release in 3.10 + linux_dist = platform.linux_distribution() + except Exception: + linux_dist = ('', '', '') + ret['linux_dist_name'] = linux_dist[0] + ret['linux_dist_version'] = linux_dist[1] + ret['cpu_count'] = CPU_COUNT + + ret['fs_encoding'] = sys.getfilesystemencoding() + ret['ulimit_soft'] = RLIMIT_FDS_SOFT + ret['ulimit_hard'] = RLIMIT_FDS_HARD + ret['cwd'] = os.getcwd() + ret['umask'] = oct(os.umask(os.umask(2))).rjust(3, '0') + + ret['python'] = get_python_info() + ret.update(START_TIME_INFO) + ret['_eco_version'] = ECO_VERSION + + if scrub: + # mask identifiable information + ret['cwd'] = '-' + ret['hostname'] = '-' + ret['hostfqdn'] = '-' + ret['python']['bin'] = '-' + ret['python']['argv'] = '-' + ret['uname']['node'] = '-' + ret['username'] = '-' + + return ret + + +def dumps(val, indent): + if indent: + return json.dumps(val, sort_keys=True, indent=indent) + return json.dumps(val, sort_keys=True) + + +def get_profile_json(indent=False): + if indent: + indent = 2 + else: + indent = 0 + + data_dict = get_profile() + return dumps(data_dict, indent) + + +def main(): + print(get_profile_json(indent=True)) + +############################################# +# The shell escaping copied in from strutils +############################################# + + +def _escape_shell_args(args, sep=' ', style=None): + if not style: + if sys.platform == 'win32': + style = 'cmd' + else: + style = 'sh' + + if style == 'sh': + return _args2sh(args, sep=sep) + elif style == 'cmd': + return _args2cmd(args, sep=sep) + + raise ValueError("style expected one of 'cmd' or 'sh', not %r" % style) + + +_find_sh_unsafe = re.compile(r'[^a-zA-Z0-9_@%+=:,./-]').search + + +def _args2sh(args, sep=' '): + # see strutils + ret_list = [] + + for arg in args: + if not arg: + ret_list.append("''") + continue + if _find_sh_unsafe(arg) is None: + ret_list.append(arg) + continue + # use single quotes, and put single quotes into double quotes + # the string $'b is then quoted as '$'"'"'b' + ret_list.append("'" + arg.replace("'", "'\"'\"'") + "'") + + return ' '.join(ret_list) + + +def _args2cmd(args, sep=' '): + # see strutils + result = [] + needquote = False + for arg in args: + bs_buf = [] + + # Add a space to separate this argument from the others + if result: + result.append(' ') + + needquote = (" " in arg) or ("\t" in arg) or not arg + if needquote: + result.append('"') + + for c in arg: + if c == '\\': + # Don't know if we need to double yet. + bs_buf.append(c) + elif c == '"': + # Double backslashes. + result.append('\\' * len(bs_buf)*2) + bs_buf = [] + result.append('\\"') + else: + # Normal char + if bs_buf: + result.extend(bs_buf) + bs_buf = [] + result.append(c) + + # Add remaining backslashes, if any. + if bs_buf: + result.extend(bs_buf) + + if needquote: + result.extend(bs_buf) + result.append('"') + + return ''.join(result) + + +############################ +# End shell escaping code +############################ + +if __name__ == '__main__': + main() + + +""" + +ecoutils protocol version history +--------------------------------- + +The version is ECO_VERSION module-level constant, and _eco_version key +in the dictionary returned from ecoutils.get_profile(). + +1.1.0 - (boltons version 24.0.0+) Drop Python <=3.6 compat +1.0.1 - (boltons version 16.3.2+) Remove uuid dependency and add HAVE_URANDOM +1.0.0 - (boltons version 16.3.0-16.3.1) Initial release + +""" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/excutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/excutils.py new file mode 100644 index 0000000000000000000000000000000000000000..fa3262d4d8d21207341f3f1ae4ec9b26eb866fea --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/excutils.py @@ -0,0 +1,287 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import sys +import traceback +import linecache +from collections import namedtuple + +# TODO: last arg or first arg? (last arg makes it harder to *args +# into, but makes it more readable in the default exception +# __repr__ output) +# TODO: Multiexception wrapper + + +__all__ = ['ExceptionCauseMixin'] + + +class ExceptionCauseMixin(Exception): + """ + A mixin class for wrapping an exception in another exception, or + otherwise indicating an exception was caused by another exception. + + This is most useful in concurrent or failure-intolerant scenarios, + where just because one operation failed, doesn't mean the remainder + should be aborted, or that it's the appropriate time to raise + exceptions. + + This is still a work in progress, but an example use case at the + bottom of this module. + + NOTE: when inheriting, you will probably want to put the + ExceptionCauseMixin first. Builtin exceptions are not good about + calling super() + """ + + cause = None + + def __new__(cls, *args, **kw): + cause = None + if args and isinstance(args[0], Exception): + cause, args = args[0], args[1:] + ret = super().__new__(cls, *args, **kw) + ret.cause = cause + if cause is None: + return ret + root_cause = getattr(cause, 'root_cause', None) + if root_cause is None: + ret.root_cause = cause + else: + ret.root_cause = root_cause + + full_trace = getattr(cause, 'full_trace', None) + if full_trace is not None: + ret.full_trace = list(full_trace) + ret._tb = list(cause._tb) + ret._stack = list(cause._stack) + return ret + + try: + exc_type, exc_value, exc_tb = sys.exc_info() + if exc_type is None and exc_value is None: + return ret + if cause is exc_value or root_cause is exc_value: + # handles when cause is the current exception or when + # there are multiple wraps while handling the original + # exception, but a cause was never provided + ret._tb = _extract_from_tb(exc_tb) + ret._stack = _extract_from_frame(exc_tb.tb_frame) + ret.full_trace = ret._stack[:-1] + ret._tb + finally: + del exc_tb + return ret + + def get_str(self): + """ + Get formatted the formatted traceback and exception + message. This function exists separately from __str__() + because __str__() is somewhat specialized for the built-in + traceback module's particular usage. + """ + ret = [] + trace_str = self._get_trace_str() + if trace_str: + ret.extend(['Traceback (most recent call last):\n', trace_str]) + ret.append(self._get_exc_str()) + return ''.join(ret) + + def _get_message(self): + args = getattr(self, 'args', []) + if self.cause: + args = args[1:] + if args and args[0]: + return args[0] + return '' + + def _get_trace_str(self): + if not self.cause: + return super().__repr__() + if self.full_trace: + return ''.join(traceback.format_list(self.full_trace)) + return '' + + def _get_exc_str(self, incl_name=True): + cause_str = _format_exc(self.root_cause) + message = self._get_message() + ret = [] + if incl_name: + ret = [self.__class__.__name__, ': '] + if message: + ret.extend([message, ' (caused by ', cause_str, ')']) + else: + ret.extend([' caused by ', cause_str]) + return ''.join(ret) + + def __str__(self): + if not self.cause: + return super().__str__() + trace_str = self._get_trace_str() + ret = [] + if trace_str: + message = self._get_message() + if message: + ret.extend([message, ' --- ']) + ret.extend(['Wrapped traceback (most recent call last):\n', + trace_str, + self._get_exc_str(incl_name=True)]) + return ''.join(ret) + else: + return self._get_exc_str(incl_name=False) + + +def _format_exc(exc, message=None): + if message is None: + message = exc + exc_str = traceback._format_final_exc_line(exc.__class__.__name__, message) + return exc_str.rstrip() + + +_BaseTBItem = namedtuple('_BaseTBItem', 'filename, lineno, name, line') + + +class _TBItem(_BaseTBItem): + def __repr__(self): + ret = super().__repr__() + ret += ' <%r>' % self.frame_id + return ret + + +class _DeferredLine: + def __init__(self, filename, lineno, module_globals=None): + self.filename = filename + self.lineno = lineno + module_globals = module_globals or {} + self.module_globals = {k: v for k, v in module_globals.items() + if k in ('__name__', '__loader__')} + + def __eq__(self, other): + return (self.lineno, self.filename) == (other.lineno, other.filename) + + def __ne__(self, other): + return (self.lineno, self.filename) != (other.lineno, other.filename) + + def __str__(self): + if hasattr(self, '_line'): + return self._line + linecache.checkcache(self.filename) + line = linecache.getline(self.filename, + self.lineno, + self.module_globals) + if line: + line = line.strip() + else: + line = None + self._line = line + return line + + def __repr__(self): + return repr(str(self)) + + def __len__(self): + return len(str(self)) + + def strip(self): + return str(self).strip() + + +def _extract_from_frame(f=None, limit=None): + ret = [] + if f is None: + f = sys._getframe(1) # cross-impl yadayada + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while f is not None and n < limit: + filename = f.f_code.co_filename + lineno = f.f_lineno + name = f.f_code.co_name + line = _DeferredLine(filename, lineno, f.f_globals) + item = _TBItem(filename, lineno, name, line) + item.frame_id = id(f) + ret.append(item) + f = f.f_back + n += 1 + ret.reverse() + return ret + + +def _extract_from_tb(tb, limit=None): + ret = [] + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while tb is not None and n < limit: + filename = tb.tb_frame.f_code.co_filename + lineno = tb.tb_lineno + name = tb.tb_frame.f_code.co_name + line = _DeferredLine(filename, lineno, tb.tb_frame.f_globals) + item = _TBItem(filename, lineno, name, line) + item.frame_id = id(tb.tb_frame) + ret.append(item) + tb = tb.tb_next + n += 1 + return ret + + +# An Example/Prototest: + + +class MathError(ExceptionCauseMixin, ValueError): + pass + + +def whoops_math(): + return 1/0 + + +def math_lol(n=0): + if n < 3: + return math_lol(n=n+1) + try: + return whoops_math() + except ZeroDivisionError as zde: + exc = MathError(zde, 'ya done messed up') + raise exc + +def main(): + try: + math_lol() + except ValueError as me: + exc = MathError(me, 'hi') + raise exc + + +if __name__ == '__main__': + try: + main() + except Exception: + import pdb;pdb.post_mortem() + raise diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/fileutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/fileutils.py new file mode 100644 index 0000000000000000000000000000000000000000..2a0577047d11697e2eba6cd639f6a3319100c243 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/fileutils.py @@ -0,0 +1,727 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Virtually every Python programmer has used Python for wrangling +disk contents, and ``fileutils`` collects solutions to some of the +most commonly-found gaps in the standard library. +""" + + +import os +import re +import sys +import stat +import errno +import fnmatch +from shutil import copy2, copystat, Error + + +__all__ = ['mkdir_p', 'atomic_save', 'AtomicSaver', 'FilePerms', + 'iter_find_files', 'copytree'] + + +FULL_PERMS = 0o777 +RW_PERMS = 438 +_SINGLE_FULL_PERM = 7 + + +def mkdir_p(path): + """Creates a directory and any parent directories that may need to + be created along the way, without raising errors for any existing + directories. This function mimics the behavior of the ``mkdir -p`` + command available in Linux/BSD environments, but also works on + Windows. + """ + try: + os.makedirs(path) + except OSError as exc: + if exc.errno == errno.EEXIST and os.path.isdir(path): + return + raise + return + + +class FilePerms: + """The :class:`FilePerms` type is used to represent standard POSIX + filesystem permissions: + + * Read + * Write + * Execute + + Across three classes of user: + + * Owning (u)ser + * Owner's (g)roup + * Any (o)ther user + + This class assists with computing new permissions, as well as + working with numeric octal ``777``-style and ``rwx``-style + permissions. Currently it only considers the bottom 9 permission + bits; it does not support sticky bits or more advanced permission + systems. + + Args: + user (str): A string in the 'rwx' format, omitting characters + for which owning user's permissions are not provided. + group (str): A string in the 'rwx' format, omitting characters + for which owning group permissions are not provided. + other (str): A string in the 'rwx' format, omitting characters + for which owning other/world permissions are not provided. + + There are many ways to use :class:`FilePerms`: + + >>> FilePerms(user='rwx', group='xrw', other='wxr') # note character order + FilePerms(user='rwx', group='rwx', other='rwx') + >>> int(FilePerms('r', 'r', '')) + 288 + >>> oct(288)[-3:] # XXX Py3k + '440' + + See also the :meth:`FilePerms.from_int` and + :meth:`FilePerms.from_path` classmethods for useful alternative + ways to construct :class:`FilePerms` objects. + """ + # TODO: consider more than the lower 9 bits + class _FilePermProperty: + _perm_chars = 'rwx' + _perm_set = frozenset('rwx') + _perm_val = {'r': 4, 'w': 2, 'x': 1} # for sorting + + def __init__(self, attribute, offset): + self.attribute = attribute + self.offset = offset + + def __get__(self, fp_obj, type_=None): + if fp_obj is None: + return self + return getattr(fp_obj, self.attribute) + + def __set__(self, fp_obj, value): + cur = getattr(fp_obj, self.attribute) + if cur == value: + return + try: + invalid_chars = set(str(value)) - self._perm_set + except TypeError: + raise TypeError('expected string, not %r' % value) + if invalid_chars: + raise ValueError('got invalid chars %r in permission' + ' specification %r, expected empty string' + ' or one or more of %r' + % (invalid_chars, value, self._perm_chars)) + + def sort_key(c): return self._perm_val[c] + new_value = ''.join(sorted(set(value), + key=sort_key, reverse=True)) + setattr(fp_obj, self.attribute, new_value) + self._update_integer(fp_obj, new_value) + + def _update_integer(self, fp_obj, value): + mode = 0 + key = 'xwr' + for symbol in value: + bit = 2 ** key.index(symbol) + mode |= (bit << (self.offset * 3)) + fp_obj._integer |= mode + + def __init__(self, user='', group='', other=''): + self._user, self._group, self._other = '', '', '' + self._integer = 0 + self.user = user + self.group = group + self.other = other + + @classmethod + def from_int(cls, i): + """Create a :class:`FilePerms` object from an integer. + + >>> FilePerms.from_int(0o644) # note the leading zero-oh for octal + FilePerms(user='rw', group='r', other='r') + """ + i &= FULL_PERMS + key = ('', 'x', 'w', 'xw', 'r', 'rx', 'rw', 'rwx') + parts = [] + while i: + parts.append(key[i & _SINGLE_FULL_PERM]) + i >>= 3 + parts.reverse() + return cls(*parts) + + @classmethod + def from_path(cls, path): + """Make a new :class:`FilePerms` object based on the permissions + assigned to the file or directory at *path*. + + Args: + path (str): Filesystem path of the target file. + + Here's an example that holds true on most systems: + + >>> import tempfile + >>> 'r' in FilePerms.from_path(tempfile.gettempdir()).user + True + """ + stat_res = os.stat(path) + return cls.from_int(stat.S_IMODE(stat_res.st_mode)) + + def __int__(self): + return self._integer + + # Sphinx tip: attribute docstrings come after the attribute + user = _FilePermProperty('_user', 2) + "Stores the ``rwx``-formatted *user* permission." + group = _FilePermProperty('_group', 1) + "Stores the ``rwx``-formatted *group* permission." + other = _FilePermProperty('_other', 0) + "Stores the ``rwx``-formatted *other* permission." + + def __repr__(self): + cn = self.__class__.__name__ + return ('%s(user=%r, group=%r, other=%r)' + % (cn, self.user, self.group, self.other)) + +#### + + +_TEXT_OPENFLAGS = os.O_RDWR | os.O_CREAT | os.O_EXCL +if hasattr(os, 'O_NOINHERIT'): + _TEXT_OPENFLAGS |= os.O_NOINHERIT +if hasattr(os, 'O_NOFOLLOW'): + _TEXT_OPENFLAGS |= os.O_NOFOLLOW +_BIN_OPENFLAGS = _TEXT_OPENFLAGS +if hasattr(os, 'O_BINARY'): + _BIN_OPENFLAGS |= os.O_BINARY + + +try: + import fcntl as fcntl +except ImportError: + def set_cloexec(fd): + "Dummy set_cloexec for platforms without fcntl support" + pass +else: + def set_cloexec(fd): + """Does a best-effort :func:`fcntl.fcntl` call to set a fd to be + automatically closed by any future child processes. + + Implementation from the :mod:`tempfile` module. + """ + try: + flags = fcntl.fcntl(fd, fcntl.F_GETFD, 0) + except OSError: + pass + else: + # flags read successfully, modify + flags |= fcntl.FD_CLOEXEC + fcntl.fcntl(fd, fcntl.F_SETFD, flags) + return + + +def atomic_save(dest_path, **kwargs): + """A convenient interface to the :class:`AtomicSaver` type. Example: + + >>> try: + ... with atomic_save("file.txt", text_mode=True) as fo: + ... _ = fo.write('bye') + ... 1/0 # will error + ... fo.write('bye') + ... except ZeroDivisionError: + ... pass # at least our file.txt didn't get overwritten + + See the :class:`AtomicSaver` documentation for details. + """ + return AtomicSaver(dest_path, **kwargs) + + +def path_to_unicode(path): + if isinstance(path, str): + return path + encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() + return path.decode(encoding) + + +if os.name == 'nt': + import ctypes + from ctypes import c_wchar_p + from ctypes.wintypes import DWORD, LPVOID + + _ReplaceFile = ctypes.windll.kernel32.ReplaceFile + _ReplaceFile.argtypes = [c_wchar_p, c_wchar_p, c_wchar_p, + DWORD, LPVOID, LPVOID] + + def replace(src, dst): + # argument names match stdlib docs, docstring below + try: + # ReplaceFile fails if the dest file does not exist, so + # first try to rename it into position + os.rename(src, dst) + return + except OSError as we: + if we.errno == errno.EEXIST: + pass # continue with the ReplaceFile logic below + else: + raise + + src = path_to_unicode(src) + dst = path_to_unicode(dst) + res = _ReplaceFile(c_wchar_p(dst), c_wchar_p(src), + None, 0, None, None) + if not res: + raise OSError(f'failed to replace {dst!r} with {src!r}') + return + + def atomic_rename(src, dst, overwrite=False): + "Rename *src* to *dst*, replacing *dst* if *overwrite is True" + if overwrite: + replace(src, dst) + else: + os.rename(src, dst) + return +else: + # wrapper func for cross compat + docs + def replace(src, dst): + # os.replace does the same thing on unix + return os.rename(src, dst) + + def atomic_rename(src, dst, overwrite=False): + "Rename *src* to *dst*, replacing *dst* if *overwrite is True" + if overwrite: + os.rename(src, dst) + else: + os.link(src, dst) + os.unlink(src) + return + + +_atomic_rename = atomic_rename # backwards compat + +replace.__doc__ = """Similar to :func:`os.replace` in Python 3.3+, +this function will atomically create or replace the file at path +*dst* with the file at path *src*. + +On Windows, this function uses the ReplaceFile API for maximum +possible atomicity on a range of filesystems. +""" + + +class AtomicSaver: + """``AtomicSaver`` is a configurable `context manager`_ that provides + a writable :class:`file` which will be moved into place as long as + no exceptions are raised within the context manager's block. These + "part files" are created in the same directory as the destination + path to ensure atomic move operations (i.e., no cross-filesystem + moves occur). + + Args: + dest_path (str): The path where the completed file will be + written. + overwrite (bool): Whether to overwrite the destination file if + it exists at completion time. Defaults to ``True``. + file_perms (int): Integer representation of file permissions + for the newly-created file. Defaults are, when the + destination path already exists, to copy the permissions + from the previous file, or if the file did not exist, to + respect the user's configured `umask`_, usually resulting + in octal 0644 or 0664. + text_mode (bool): Whether to open the destination file in text + mode (i.e., ``'w'`` not ``'wb'``). Defaults to ``False`` (``wb``). + part_file (str): Name of the temporary *part_file*. Defaults + to *dest_path* + ``.part``. Note that this argument is + just the filename, and not the full path of the part + file. To guarantee atomic saves, part files are always + created in the same directory as the destination path. + overwrite_part (bool): Whether to overwrite the *part_file*, + should it exist at setup time. Defaults to ``False``, + which results in an :exc:`OSError` being raised on + pre-existing part files. Be careful of setting this to + ``True`` in situations when multiple threads or processes + could be writing to the same part file. + rm_part_on_exc (bool): Remove *part_file* on exception cases. + Defaults to ``True``, but ``False`` can be useful for + recovery in some cases. Note that resumption is not + automatic and by default an :exc:`OSError` is raised if + the *part_file* exists. + + Practically, the AtomicSaver serves a few purposes: + + * Avoiding overwriting an existing, valid file with a partially + written one. + * Providing a reasonable guarantee that a part file only has one + writer at a time. + * Optional recovery of partial data in failure cases. + + .. _context manager: https://docs.python.org/2/reference/compound_stmts.html#with + .. _umask: https://en.wikipedia.org/wiki/Umask + + """ + _default_file_perms = RW_PERMS + + # TODO: option to abort if target file modify date has changed since start? + def __init__(self, dest_path, **kwargs): + self.dest_path = dest_path + self.overwrite = kwargs.pop('overwrite', True) + self.file_perms = kwargs.pop('file_perms', None) + self.overwrite_part = kwargs.pop('overwrite_part', False) + self.part_filename = kwargs.pop('part_file', None) + self.rm_part_on_exc = kwargs.pop('rm_part_on_exc', True) + self.text_mode = kwargs.pop('text_mode', False) + self.buffering = kwargs.pop('buffering', -1) + if kwargs: + raise TypeError(f'unexpected kwargs: {kwargs.keys()!r}') + + self.dest_path = os.path.abspath(self.dest_path) + self.dest_dir = os.path.dirname(self.dest_path) + if not self.part_filename: + self.part_path = dest_path + '.part' + else: + self.part_path = os.path.join(self.dest_dir, self.part_filename) + self.mode = 'w+' if self.text_mode else 'w+b' + self.open_flags = _TEXT_OPENFLAGS if self.text_mode else _BIN_OPENFLAGS + + self.part_file = None + + def _open_part_file(self): + do_chmod = True + file_perms = self.file_perms + if file_perms is None: + try: + # try to copy from file being replaced + stat_res = os.stat(self.dest_path) + file_perms = stat.S_IMODE(stat_res.st_mode) + except OSError: + # default if no destination file exists + file_perms = self._default_file_perms + do_chmod = False # respect the umask + + fd = os.open(self.part_path, self.open_flags, file_perms) + set_cloexec(fd) + self.part_file = os.fdopen(fd, self.mode, self.buffering) + + # if default perms are overridden by the user or previous dest_path + # chmod away the effects of the umask + if do_chmod: + try: + os.chmod(self.part_path, file_perms) + except OSError: + self.part_file.close() + raise + return + + def setup(self): + """Called on context manager entry (the :keyword:`with` statement), + the ``setup()`` method creates the temporary file in the same + directory as the destination file. + + ``setup()`` tests for a writable directory with rename permissions + early, as the part file may not be written to immediately (not + using :func:`os.access` because of the potential issues of + effective vs. real privileges). + + If the caller is not using the :class:`AtomicSaver` as a + context manager, this method should be called explicitly + before writing. + """ + if os.path.lexists(self.dest_path): + if not self.overwrite: + raise OSError(errno.EEXIST, + 'Overwrite disabled and file already exists', + self.dest_path) + if self.overwrite_part and os.path.lexists(self.part_path): + os.unlink(self.part_path) + self._open_part_file() + return + + def __enter__(self): + self.setup() + return self.part_file + + def __exit__(self, exc_type, exc_val, exc_tb): + if self.part_file: + # Ensure data is flushed and synced to disk before closing + self.part_file.flush() + os.fsync(self.part_file.fileno()) + self.part_file.close() + if exc_type: + if self.rm_part_on_exc: + try: + os.unlink(self.part_path) + except Exception: + pass # avoid masking original error + return + try: + atomic_rename(self.part_path, self.dest_path, + overwrite=self.overwrite) + except OSError: + if self.rm_part_on_exc: + try: + os.unlink(self.part_path) + except Exception: + pass # avoid masking original error + raise # could not save destination file + return + + +def iter_find_files(directory, patterns, ignored=None, include_dirs=False, max_depth=None): + """Returns a generator that yields file paths under a *directory*, + matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also + supports *ignored* patterns. + + Args: + directory (str): Path that serves as the root of the + search. Yielded paths will include this as a prefix. + patterns (str or list): A single pattern or list of + glob-formatted patterns to find under *directory*. + ignored (str or list): A single pattern or list of + glob-formatted patterns to ignore. + include_dirs (bool): Whether to include directories that match + patterns, as well. Defaults to ``False``. + max_depth (int): traverse up to this level of subdirectory. + I.e., 0 for the specified *directory* only, 1 for *directory* + and one level of subdirectory. + + For example, finding Python files in the current directory: + + >>> _CUR_DIR = os.path.dirname(os.path.abspath(__file__)) + >>> filenames = sorted(iter_find_files(_CUR_DIR, '*.py')) + >>> os.path.basename(filenames[-1]) + 'urlutils.py' + + Or, Python files while ignoring emacs lockfiles: + + >>> filenames = iter_find_files(_CUR_DIR, '*.py', ignored='.#*') + + .. _glob: https://en.wikipedia.org/wiki/Glob_%28programming%29 + + """ + if isinstance(patterns, str): + patterns = [patterns] + pats_re = re.compile('|'.join([fnmatch.translate(p) for p in patterns])) + + if not ignored: + ignored = [] + elif isinstance(ignored, str): + ignored = [ignored] + ign_re = re.compile('|'.join([fnmatch.translate(p) for p in ignored])) + start_depth = len(directory.split(os.path.sep)) + for root, dirs, files in os.walk(directory): + if max_depth is not None and (len(root.split(os.path.sep)) - start_depth) > max_depth: + continue + if include_dirs: + for basename in dirs: + if pats_re.match(basename): + if ignored and ign_re.match(basename): + continue + filename = os.path.join(root, basename) + yield filename + + for basename in files: + if pats_re.match(basename): + if ignored and ign_re.match(basename): + continue + filename = os.path.join(root, basename) + yield filename + return + + +def copy_tree(src, dst, symlinks=False, ignore=None): + """The ``copy_tree`` function is an exact copy of the built-in + :func:`shutil.copytree`, with one key difference: it will not + raise an exception if part of the tree already exists. It achieves + this by using :func:`mkdir_p`. + + As of Python 3.8, you may pass :func:`shutil.copytree` the + `dirs_exist_ok=True` flag to achieve the same effect. + + Args: + src (str): Path of the source directory to copy. + dst (str): Destination path. Existing directories accepted. + symlinks (bool): If ``True``, copy symlinks rather than their + contents. + ignore (callable): A callable that takes a path and directory + listing, returning the files within the listing to be ignored. + + For more details, check out :func:`shutil.copytree` and + :func:`shutil.copy2`. + + """ + names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + + mkdir_p(dst) + errors = [] + for name in names: + if name in ignored_names: + continue + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + try: + if symlinks and os.path.islink(srcname): + linkto = os.readlink(srcname) + os.symlink(linkto, dstname) + elif os.path.isdir(srcname): + copytree(srcname, dstname, symlinks, ignore) + else: + # Will raise a SpecialFileError for unsupported file types + copy2(srcname, dstname) + # catch the Error from the recursive copytree so that we can + # continue with other files + except Error as e: + errors.extend(e.args[0]) + except OSError as why: + errors.append((srcname, dstname, str(why))) + try: + copystat(src, dst) + except OSError as why: + errors.append((src, dst, str(why))) + if errors: + raise Error(errors) + + +copytree = copy_tree # alias for drop-in replacement of shutil + + +# like open(os.devnull) but with even fewer side effects +class DummyFile: + # TODO: raise ValueErrors on closed for all methods? + # TODO: enforce read/write + def __init__(self, path, mode='r', buffering=None): + self.name = path + self.mode = mode + self.closed = False + self.errors = None + self.isatty = False + self.encoding = None + self.newlines = None + self.softspace = 0 + + def close(self): + self.closed = True + + def fileno(self): + return -1 + + def flush(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def next(self): + raise StopIteration() + + def read(self, size=0): + if self.closed: + raise ValueError('I/O operation on a closed file') + return '' + + def readline(self, size=0): + if self.closed: + raise ValueError('I/O operation on a closed file') + return '' + + def readlines(self, size=0): + if self.closed: + raise ValueError('I/O operation on a closed file') + return [] + + def seek(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def tell(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return 0 + + def truncate(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def write(self, string): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def writelines(self, list_of_strings): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def __next__(self): + raise StopIteration() + + def __enter__(self): + if self.closed: + raise ValueError('I/O operation on a closed file') + return + + def __exit__(self, exc_type, exc_val, exc_tb): + return + + +def rotate_file(filename, *, keep: int = 5): + """ + If *filename.ext* exists, it will be moved to *filename.1.ext*, + with all conflicting filenames being moved up by one, dropping any files beyond *keep*. + + After rotation, *filename* will be available for creation as a new file. + + Fails if *filename* is not a file or if *keep* is not > 0. + """ + if keep < 1: + raise ValueError(f'expected "keep" to be >=1, not {keep}') + if not os.path.exists(filename): + return + if not os.path.isfile(filename): + raise ValueError(f'expected {filename} to be a file') + + fn_root, fn_ext = os.path.splitext(filename) + kept_names = [] + for i in range(1, keep + 1): + if fn_ext: + kept_names.append(f'{fn_root}.{i}{fn_ext}') + else: + kept_names.append(f'{fn_root}.{i}') + + fns = [filename] + kept_names + for orig_name, kept_name in reversed(list(zip(fns, fns[1:]))): + if not os.path.exists(orig_name): + continue + os.rename(orig_name, kept_name) + + if os.path.exists(kept_names[-1]): + os.remove(kept_names[-1]) + + return diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/formatutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/formatutils.py new file mode 100644 index 0000000000000000000000000000000000000000..303403493c2421f5950285b012f777e3742ec463 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/formatutils.py @@ -0,0 +1,356 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""`PEP 3101`_ introduced the :meth:`str.format` method, and what +would later be called "new-style" string formatting. For the sake of +explicit correctness, it is probably best to refer to Python's dual +string formatting capabilities as *bracket-style* and +*percent-style*. There is overlap, but one does not replace the +other. + + * Bracket-style is more pluggable, slower, and uses a method. + * Percent-style is simpler, faster, and uses an operator. + +Bracket-style formatting brought with it a much more powerful toolbox, +but it was far from a full one. :meth:`str.format` uses `more powerful +syntax`_, but `the tools and idioms`_ for working with +that syntax are not well-developed nor well-advertised. + +``formatutils`` adds several functions for working with bracket-style +format strings: + + * :class:`DeferredValue`: Defer fetching or calculating a value + until format time. + * :func:`get_format_args`: Parse the positional and keyword + arguments out of a format string. + * :func:`tokenize_format_str`: Tokenize a format string into + literals and :class:`BaseFormatField` objects. + * :func:`construct_format_field_str`: Assists in programmatic + construction of format strings. + * :func:`infer_positional_format_args`: Converts anonymous + references in 2.7+ format strings to explicit positional arguments + suitable for usage with Python 2.6. + +.. _more powerful syntax: https://docs.python.org/2/library/string.html#format-string-syntax +.. _the tools and idioms: https://docs.python.org/2/library/string.html#string-formatting +.. _PEP 3101: https://www.python.org/dev/peps/pep-3101/ +""" +# TODO: also include percent-formatting utils? +# TODO: include lithoxyl.formatters.Formatter (or some adaptation)? + + +import re +from string import Formatter + +__all__ = ['DeferredValue', 'get_format_args', 'tokenize_format_str', + 'construct_format_field_str', 'infer_positional_format_args', + 'BaseFormatField'] + + +_pos_farg_re = re.compile('({{)|' # escaped open-brace + '(}})|' # escaped close-brace + r'({[:!.\[}])') # anon positional format arg + + +def construct_format_field_str(fname, fspec, conv): + """ + Constructs a format field string from the field name, spec, and + conversion character (``fname``, ``fspec``, ``conv``). See Python + String Formatting for more info. + """ + if fname is None: + return '' + ret = '{' + fname + if conv: + ret += '!' + conv + if fspec: + ret += ':' + fspec + ret += '}' + return ret + + +def split_format_str(fstr): + """Does very basic splitting of a format string, returns a list of + strings. For full tokenization, see :func:`tokenize_format_str`. + + """ + ret = [] + + for lit, fname, fspec, conv in Formatter().parse(fstr): + if fname is None: + ret.append((lit, None)) + continue + field_str = construct_format_field_str(fname, fspec, conv) + ret.append((lit, field_str)) + return ret + + +def infer_positional_format_args(fstr): + """Takes format strings with anonymous positional arguments, (e.g., + "{}" and {:d}), and converts them into numbered ones for explicitness and + compatibility with 2.6. + + Returns a string with the inferred positional arguments. + """ + # TODO: memoize + ret, max_anon = '', 0 + # look for {: or {! or {. or {[ or {} + start, end, prev_end = 0, 0, 0 + for match in _pos_farg_re.finditer(fstr): + start, end, group = match.start(), match.end(), match.group() + if prev_end < start: + ret += fstr[prev_end:start] + prev_end = end + if group == '{{' or group == '}}': + ret += group + continue + ret += f'{{{max_anon}{group[1:]}' + max_anon += 1 + ret += fstr[prev_end:] + return ret + + +# This approach is hardly exhaustive but it works for most builtins +_INTCHARS = 'bcdoxXn' +_FLOATCHARS = 'eEfFgGn%' +_TYPE_MAP = dict([(x, int) for x in _INTCHARS] + + [(x, float) for x in _FLOATCHARS]) +_TYPE_MAP['s'] = str + + +def get_format_args(fstr): + """ + Turn a format string into two lists of arguments referenced by the + format string. One is positional arguments, and the other is named + arguments. Each element of the list includes the name and the + nominal type of the field. + + # >>> get_format_args("{noun} is {1:d} years old{punct}") + # ([(1, )], [('noun', ), ('punct', )]) + + # XXX: Py3k + >>> get_format_args("{noun} is {1:d} years old{punct}") == \ + ([(1, int)], [('noun', str), ('punct', str)]) + True + """ + # TODO: memoize + formatter = Formatter() + fargs, fkwargs, _dedup = [], [], set() + + def _add_arg(argname, type_char='s'): + if argname not in _dedup: + _dedup.add(argname) + argtype = _TYPE_MAP.get(type_char, str) # TODO: unicode + try: + fargs.append((int(argname), argtype)) + except ValueError: + fkwargs.append((argname, argtype)) + + for lit, fname, fspec, conv in formatter.parse(fstr): + if fname is not None: + type_char = fspec[-1:] + fname_list = re.split('[.[]', fname) + if len(fname_list) > 1: + raise ValueError('encountered compound format arg: %r' % fname) + try: + base_fname = fname_list[0] + assert base_fname + except (IndexError, AssertionError): + raise ValueError('encountered anonymous positional argument') + _add_arg(fname, type_char) + for sublit, subfname, _, _ in formatter.parse(fspec): + # TODO: positional and anon args not allowed here. + if subfname is not None: + _add_arg(subfname) + return fargs, fkwargs + + +def tokenize_format_str(fstr, resolve_pos=True): + """Takes a format string, turns it into a list of alternating string + literals and :class:`BaseFormatField` tokens. By default, also + infers anonymous positional references into explicit, numbered + positional references. To disable this behavior set *resolve_pos* + to ``False``. + """ + ret = [] + if resolve_pos: + fstr = infer_positional_format_args(fstr) + formatter = Formatter() + for lit, fname, fspec, conv in formatter.parse(fstr): + if lit: + ret.append(lit) + if fname is None: + continue + ret.append(BaseFormatField(fname, fspec, conv)) + return ret + + +class BaseFormatField: + """A class representing a reference to an argument inside of a + bracket-style format string. For instance, in ``"{greeting}, + world!"``, there is a field named "greeting". + + These fields can have many options applied to them. See the + Python docs on `Format String Syntax`_ for the full details. + + .. _Format String Syntax: https://docs.python.org/2/library/string.html#string-formatting + """ + def __init__(self, fname, fspec='', conv=None): + self.set_fname(fname) + self.set_fspec(fspec) + self.set_conv(conv) + + def set_fname(self, fname): + "Set the field name." + + path_list = re.split('[.[]', fname) # TODO + + self.base_name = path_list[0] + self.fname = fname + self.subpath = path_list[1:] + self.is_positional = not self.base_name or self.base_name.isdigit() + + def set_fspec(self, fspec): + "Set the field spec." + fspec = fspec or '' + subfields = [] + for sublit, subfname, _, _ in Formatter().parse(fspec): + if subfname is not None: + subfields.append(subfname) + self.subfields = subfields + self.fspec = fspec + self.type_char = fspec[-1:] + self.type_func = _TYPE_MAP.get(self.type_char, str) + + def set_conv(self, conv): + """There are only two built-in converters: ``s`` and ``r``. They are + somewhat rare and appearlike ``"{ref!r}"``.""" + # TODO + self.conv = conv + self.conv_func = None # TODO + + @property + def fstr(self): + "The current state of the field in string format." + return construct_format_field_str(self.fname, self.fspec, self.conv) + + def __repr__(self): + cn = self.__class__.__name__ + args = [self.fname] + if self.conv is not None: + args.extend([self.fspec, self.conv]) + elif self.fspec != '': + args.append(self.fspec) + args_repr = ', '.join([repr(a) for a in args]) + return f'{cn}({args_repr})' + + def __str__(self): + return self.fstr + + +_UNSET = object() + + +class DeferredValue: + """:class:`DeferredValue` is a wrapper type, used to defer computing + values which would otherwise be expensive to stringify and + format. This is most valuable in areas like logging, where one + would not want to waste time formatting a value for a log message + which will subsequently be filtered because the message's log + level was DEBUG and the logger was set to only emit CRITICAL + messages. + + The :class:``DeferredValue`` is initialized with a callable that + takes no arguments and returns the value, which can be of any + type. By default DeferredValue only calls that callable once, and + future references will get a cached value. This behavior can be + disabled by setting *cache_value* to ``False``. + + Args: + + func (function): A callable that takes no arguments and + computes the value being represented. + cache_value (bool): Whether subsequent usages will call *func* + again. Defaults to ``True``. + + >>> import sys + >>> dv = DeferredValue(lambda: len(sys._current_frames())) + >>> output = "works great in all {0} threads!".format(dv) + + PROTIP: To keep lines shorter, use: ``from formatutils import + DeferredValue as DV`` + """ + def __init__(self, func, cache_value=True): + self.func = func + self.cache_value = cache_value + self._value = _UNSET + + def get_value(self): + """Computes, optionally caches, and returns the value of the + *func*. If ``get_value()`` has been called before, a cached + value may be returned depending on the *cache_value* option + passed to the constructor. + """ + if self._value is not _UNSET and self.cache_value: + value = self._value + else: + value = self.func() + if self.cache_value: + self._value = value + return value + + def __int__(self): + return int(self.get_value()) + + def __float__(self): + return float(self.get_value()) + + def __str__(self): + return str(self.get_value()) + + def __unicode__(self): + return str(self.get_value()) + + def __repr__(self): + return repr(self.get_value()) + + def __format__(self, fmt): + value = self.get_value() + + pt = fmt[-1:] # presentation type + type_conv = _TYPE_MAP.get(pt, str) + + try: + return value.__format__(fmt) + except (ValueError, TypeError): + # TODO: this may be overkill + return type_conv(value).__format__(fmt) + +# end formatutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/funcutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/funcutils.py new file mode 100644 index 0000000000000000000000000000000000000000..0bdc28e9bf54bef76741eae72ae838517e0a87d9 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/funcutils.py @@ -0,0 +1,1007 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's built-in :mod:`functools` module builds several useful +utilities on top of Python's first-class function +support. ``funcutils`` generally stays in the same vein, adding to and +correcting Python's standard metaprogramming facilities. +""" + +import sys +import re +import inspect +import functools +import itertools +from inspect import formatannotation +from types import FunctionType, MethodType + +# For legacy compatibility. +# boltons used to offer an implementation of total_ordering for Python <2.7 +from functools import total_ordering as total_ordering + +try: + from .typeutils import make_sentinel + NO_DEFAULT = make_sentinel(var_name='NO_DEFAULT') +except ImportError: + NO_DEFAULT = object() + + +def inspect_formatargspec( + args, varargs=None, varkw=None, defaults=None, + kwonlyargs=(), kwonlydefaults={}, annotations={}, + formatarg=str, + formatvarargs=lambda name: '*' + name, + formatvarkw=lambda name: '**' + name, + formatvalue=lambda value: '=' + repr(value), + formatreturns=lambda text: ' -> ' + text, + formatannotation=formatannotation): + """Copy formatargspec from python 3.7 standard library. + Python 3 has deprecated formatargspec and requested that Signature + be used instead, however this requires a full reimplementation + of formatargspec() in terms of creating Parameter objects and such. + Instead of introducing all the object-creation overhead and having + to reinvent from scratch, just copy their compatibility routine. + """ + + def formatargandannotation(arg): + result = formatarg(arg) + if arg in annotations: + result += ': ' + formatannotation(annotations[arg]) + return result + specs = [] + if defaults: + firstdefault = len(args) - len(defaults) + for i, arg in enumerate(args): + spec = formatargandannotation(arg) + if defaults and i >= firstdefault: + spec = spec + formatvalue(defaults[i - firstdefault]) + specs.append(spec) + if varargs is not None: + specs.append(formatvarargs(formatargandannotation(varargs))) + else: + if kwonlyargs: + specs.append('*') + if kwonlyargs: + for kwonlyarg in kwonlyargs: + spec = formatargandannotation(kwonlyarg) + if kwonlydefaults and kwonlyarg in kwonlydefaults: + spec += formatvalue(kwonlydefaults[kwonlyarg]) + specs.append(spec) + if varkw is not None: + specs.append(formatvarkw(formatargandannotation(varkw))) + result = '(' + ', '.join(specs) + ')' + if 'return' in annotations: + result += formatreturns(formatannotation(annotations['return'])) + return result + + +def get_module_callables(mod, ignore=None): + """Returns two maps of (*types*, *funcs*) from *mod*, optionally + ignoring based on the :class:`bool` return value of the *ignore* + callable. *mod* can be a string name of a module in + :data:`sys.modules` or the module instance itself. + """ + if isinstance(mod, str): + mod = sys.modules[mod] + types, funcs = {}, {} + for attr_name in dir(mod): + if ignore and ignore(attr_name): + continue + try: + attr = getattr(mod, attr_name) + except Exception: + continue + try: + attr_mod_name = attr.__module__ + except AttributeError: + continue + if attr_mod_name != mod.__name__: + continue + if isinstance(attr, type): + types[attr_name] = attr + elif callable(attr): + funcs[attr_name] = attr + return types, funcs + + +def mro_items(type_obj): + """Takes a type and returns an iterator over all class variables + throughout the type hierarchy (respecting the MRO). + + >>> sorted(set([k for k, v in mro_items(int) if not k.startswith('__') and 'bytes' not in k and not callable(v)])) + ['denominator', 'imag', 'numerator', 'real'] + """ + # TODO: handle slots? + return itertools.chain.from_iterable(ct.__dict__.items() + for ct in type_obj.__mro__) + + +def dir_dict(obj, raise_exc=False): + """Return a dictionary of attribute names to values for a given + object. Unlike ``obj.__dict__``, this function returns all + attributes on the object, including ones on parent classes. + """ + # TODO: separate function for handling descriptors on types? + ret = {} + for k in dir(obj): + try: + ret[k] = getattr(obj, k) + except Exception: + if raise_exc: + raise + return ret + + +def copy_function(orig, copy_dict=True): + """Returns a shallow copy of the function, including code object, + globals, closure, etc. + + >>> func = lambda: func + >>> func() is func + True + >>> func_copy = copy_function(func) + >>> func_copy() is func + True + >>> func_copy is not func + True + + Args: + orig (function): The function to be copied. Must be a + function, not just any method or callable. + copy_dict (bool): Also copy any attributes set on the function + instance. Defaults to ``True``. + """ + ret = FunctionType(orig.__code__, + orig.__globals__, + name=orig.__name__, + argdefs=getattr(orig, "__defaults__", None), + closure=getattr(orig, "__closure__", None)) + if hasattr(orig, "__kwdefaults__"): + ret.__kwdefaults__ = orig.__kwdefaults__ + if copy_dict: + ret.__dict__.update(orig.__dict__) + return ret + + +def partial_ordering(cls): + """Class decorator, similar to :func:`functools.total_ordering`, + except it is used to define `partial orderings`_ (i.e., it is + possible that *x* is neither greater than, equal to, or less than + *y*). It assumes the presence of the ``__le__()`` and ``__ge__()`` + method, but nothing else. It will not override any existing + additional comparison methods. + + .. _partial orderings: https://en.wikipedia.org/wiki/Partially_ordered_set + + >>> @partial_ordering + ... class MySet(set): + ... def __le__(self, other): + ... return self.issubset(other) + ... def __ge__(self, other): + ... return self.issuperset(other) + ... + >>> a = MySet([1,2,3]) + >>> b = MySet([1,2]) + >>> c = MySet([1,2,4]) + >>> b < a + True + >>> b > a + False + >>> b < c + True + >>> a < c + False + >>> c > a + False + """ + def __lt__(self, other): return self <= other and not self >= other + def __gt__(self, other): return self >= other and not self <= other + def __eq__(self, other): return self >= other and self <= other + + if not hasattr(cls, '__lt__'): cls.__lt__ = __lt__ + if not hasattr(cls, '__gt__'): cls.__gt__ = __gt__ + if not hasattr(cls, '__eq__'): cls.__eq__ = __eq__ + + return cls + + +class InstancePartial(functools.partial): + """:class:`functools.partial` is a huge convenience for anyone + working with Python's great first-class functions. It allows + developers to curry arguments and incrementally create simpler + callables for a variety of use cases. + + Unfortunately there's one big gap in its usefulness: + methods. Partials just don't get bound as methods and + automatically handed a reference to ``self``. The + ``InstancePartial`` type remedies this by inheriting from + :class:`functools.partial` and implementing the necessary + descriptor protocol. There are no other differences in + implementation or usage. :class:`CachedInstancePartial`, below, + has the same ability, but is slightly more efficient. + + """ + @property + def _partialmethod(self): + # py3.13 switched from _partialmethod to __partialmethod__, this is kept for backwards compat <=py3.12 + return self.__partialmethod__ + + @property + def __partialmethod__(self): + return functools.partialmethod(self.func, *self.args, **self.keywords) + + def __get__(self, obj, obj_type): + return MethodType(self, obj) + + + +class CachedInstancePartial(functools.partial): + """The ``CachedInstancePartial`` is virtually the same as + :class:`InstancePartial`, adding support for method-usage to + :class:`functools.partial`, except that upon first access, it + caches the bound method on the associated object, speeding it up + for future accesses, and bringing the method call overhead to + about the same as non-``partial`` methods. + + See the :class:`InstancePartial` docstring for more details. + """ + @property + def _partialmethod(self): + # py3.13 switched from _partialmethod to __partialmethod__, this is kept for backwards compat <=py3.12 + return self.__partialmethod__ + + @property + def __partialmethod__(self): + return functools.partialmethod(self.func, *self.args, **self.keywords) + + def __set_name__(self, obj_type, name): + self.__name__ = name + + def __get__(self, obj, obj_type): + # These assignments could've been in __init__, but there was + # no simple way to do it without breaking one of PyPy or Py3. + self.__name__ = getattr(self, "__name__", None) + self.__doc__ = self.func.__doc__ + self.__module__ = self.func.__module__ + + name = self.__name__ + + if obj is None: + return MethodType(self, obj) + try: + # since this is a data descriptor, this block + # is probably only hit once (per object) + return obj.__dict__[name] + except KeyError: + obj.__dict__[name] = ret = MethodType(self, obj) + return ret + + +partial = CachedInstancePartial + + +def format_invocation(name='', args=(), kwargs=None, **kw): + """Given a name, positional arguments, and keyword arguments, format + a basic Python-style function call. + + >>> print(format_invocation('func', args=(1, 2), kwargs={'c': 3})) + func(1, 2, c=3) + >>> print(format_invocation('a_func', args=(1,))) + a_func(1) + >>> print(format_invocation('kw_func', kwargs=[('a', 1), ('b', 2)])) + kw_func(a=1, b=2) + + """ + _repr = kw.pop('repr', repr) + if kw: + raise TypeError('unexpected keyword args: %r' % ', '.join(kw.keys())) + kwargs = kwargs or {} + a_text = ', '.join([_repr(a) for a in args]) + if isinstance(kwargs, dict): + kwarg_items = [(k, kwargs[k]) for k in sorted(kwargs)] + else: + kwarg_items = kwargs + kw_text = ', '.join([f'{k}={_repr(v)}' for k, v in kwarg_items]) + + all_args_text = a_text + if all_args_text and kw_text: + all_args_text += ', ' + all_args_text += kw_text + + return f'{name}({all_args_text})' + + +def format_exp_repr(obj, pos_names, req_names=None, opt_names=None, opt_key=None): + """Render an expression-style repr of an object, based on attribute + names, which are assumed to line up with arguments to an initializer. + + >>> class Flag(object): + ... def __init__(self, length, width, depth=None): + ... self.length = length + ... self.width = width + ... self.depth = depth + ... + + That's our Flag object, here are some example reprs for it: + + >>> flag = Flag(5, 10) + >>> print(format_exp_repr(flag, ['length', 'width'], [], ['depth'])) + Flag(5, 10) + >>> flag2 = Flag(5, 15, 2) + >>> print(format_exp_repr(flag2, ['length'], ['width', 'depth'])) + Flag(5, width=15, depth=2) + + By picking the pos_names, req_names, opt_names, and opt_key, you + can fine-tune how you want the repr to look. + + Args: + obj (object): The object whose type name will be used and + attributes will be checked + pos_names (list): Required list of attribute names which will be + rendered as positional arguments in the output repr. + req_names (list): List of attribute names which will always + appear in the keyword arguments in the output repr. Defaults to None. + opt_names (list): List of attribute names which may appear in + the keyword arguments in the output repr, provided they pass + the *opt_key* check. Defaults to None. + opt_key (callable): A function or callable which checks whether + an opt_name should be in the repr. Defaults to a + ``None``-check. + + """ + cn = type(obj).__name__ + req_names = req_names or [] + opt_names = opt_names or [] + uniq_names, all_names = set(), [] + for name in req_names + opt_names: + if name in uniq_names: + continue + uniq_names.add(name) + all_names.append(name) + + if opt_key is None: + opt_key = lambda v: v is None + assert callable(opt_key) + + args = [getattr(obj, name, None) for name in pos_names] + + kw_items = [(name, getattr(obj, name, None)) for name in all_names] + kw_items = [(name, val) for name, val in kw_items + if not (name in opt_names and opt_key(val))] + + return format_invocation(cn, args, kw_items) + + +def format_nonexp_repr(obj, req_names=None, opt_names=None, opt_key=None): + """Format a non-expression-style repr + + Some object reprs look like object instantiation, e.g., App(r=[], mw=[]). + + This makes sense for smaller, lower-level objects whose state + roundtrips. But a lot of objects contain values that don't + roundtrip, like types and functions. + + For those objects, there is the non-expression style repr, which + mimic's Python's default style to make a repr like so: + + >>> class Flag(object): + ... def __init__(self, length, width, depth=None): + ... self.length = length + ... self.width = width + ... self.depth = depth + ... + >>> flag = Flag(5, 10) + >>> print(format_nonexp_repr(flag, ['length', 'width'], ['depth'])) + + + If no attributes are specified or set, utilizes the id, not unlike Python's + built-in behavior. + + >>> print(format_nonexp_repr(flag)) + + """ + cn = obj.__class__.__name__ + req_names = req_names or [] + opt_names = opt_names or [] + uniq_names, all_names = set(), [] + for name in req_names + opt_names: + if name in uniq_names: + continue + uniq_names.add(name) + all_names.append(name) + + if opt_key is None: + opt_key = lambda v: v is None + assert callable(opt_key) + + items = [(name, getattr(obj, name, None)) for name in all_names] + labels = [f'{name}={val!r}' for name, val in items + if not (name in opt_names and opt_key(val))] + if not labels: + labels = ['id=%s' % id(obj)] + ret = '<{} {}>'.format(cn, ' '.join(labels)) + return ret + + + +# # # +# # # Function builder +# # # + + +def wraps(func, injected=None, expected=None, **kw): + """Decorator factory to apply update_wrapper() to a wrapper function. + + Modeled after built-in :func:`functools.wraps`. Returns a decorator + that invokes update_wrapper() with the decorated function as the wrapper + argument and the arguments to wraps() as the remaining arguments. + Default arguments are as for update_wrapper(). This is a convenience + function to simplify applying partial() to update_wrapper(). + + Same example as in update_wrapper's doc but with wraps: + + >>> from boltons.funcutils import wraps + >>> + >>> def print_return(func): + ... @wraps(func) + ... def wrapper(*args, **kwargs): + ... ret = func(*args, **kwargs) + ... print(ret) + ... return ret + ... return wrapper + ... + >>> @print_return + ... def example(): + ... '''docstring''' + ... return 'example return value' + >>> + >>> val = example() + example return value + >>> example.__name__ + 'example' + >>> example.__doc__ + 'docstring' + """ + return partial(update_wrapper, func=func, build_from=None, + injected=injected, expected=expected, **kw) + + +def update_wrapper(wrapper, func, injected=None, expected=None, build_from=None, **kw): + """Modeled after the built-in :func:`functools.update_wrapper`, + this function is used to make your wrapper function reflect the + wrapped function's: + + * Name + * Documentation + * Module + * Signature + + The built-in :func:`functools.update_wrapper` copies the first three, but + does not copy the signature. This version of ``update_wrapper`` can copy + the inner function's signature exactly, allowing seamless usage + and :mod:`introspection `. Usage is identical to the + built-in version:: + + >>> from boltons.funcutils import update_wrapper + >>> + >>> def print_return(func): + ... def wrapper(*args, **kwargs): + ... ret = func(*args, **kwargs) + ... print(ret) + ... return ret + ... return update_wrapper(wrapper, func) + ... + >>> @print_return + ... def example(): + ... '''docstring''' + ... return 'example return value' + >>> + >>> val = example() + example return value + >>> example.__name__ + 'example' + >>> example.__doc__ + 'docstring' + + In addition, the boltons version of update_wrapper supports + modifying the outer signature. By passing a list of + *injected* argument names, those arguments will be removed from + the outer wrapper's signature, allowing your decorator to provide + arguments that aren't passed in. + + Args: + + wrapper (function) : The callable to which the attributes of + *func* are to be copied. + func (function): The callable whose attributes are to be copied. + injected (list): An optional list of argument names which + should not appear in the new wrapper's signature. + expected (list): An optional list of argument names (or (name, + default) pairs) representing new arguments introduced by + the wrapper (the opposite of *injected*). See + :meth:`FunctionBuilder.add_arg()` for more details. + build_from (function): The callable from which the new wrapper + is built. Defaults to *func*, unless *wrapper* is partial object + built from *func*, in which case it defaults to *wrapper*. + Useful in some specific cases where *wrapper* and *func* have the + same arguments but differ on which are keyword-only and positional-only. + update_dict (bool): Whether to copy other, non-standard + attributes of *func* over to the wrapper. Defaults to True. + inject_to_varkw (bool): Ignore missing arguments when a + ``**kwargs``-type catch-all is present. Defaults to True. + hide_wrapped (bool): Remove reference to the wrapped function(s) + in the updated function. + + In opposition to the built-in :func:`functools.update_wrapper` bolton's + version returns a copy of the function and does not modify anything in place. + For more in-depth wrapping of functions, see the + :class:`FunctionBuilder` type, on which update_wrapper was built. + """ + if injected is None: + injected = [] + elif isinstance(injected, str): + injected = [injected] + else: + injected = list(injected) + + expected_items = _parse_wraps_expected(expected) + + if isinstance(func, (classmethod, staticmethod)): + raise TypeError('wraps does not support wrapping classmethods and' + ' staticmethods, change the order of wrapping to' + ' wrap the underlying function: %r' + % (getattr(func, '__func__', None),)) + + update_dict = kw.pop('update_dict', True) + inject_to_varkw = kw.pop('inject_to_varkw', True) + hide_wrapped = kw.pop('hide_wrapped', False) + if kw: + raise TypeError('unexpected kwargs: %r' % kw.keys()) + + if isinstance(wrapper, functools.partial) and func is wrapper.func: + build_from = build_from or wrapper + + fb = FunctionBuilder.from_func(build_from or func) + + for arg in injected: + try: + fb.remove_arg(arg) + except MissingArgument: + if inject_to_varkw and fb.varkw is not None: + continue # keyword arg will be caught by the varkw + raise + + for arg, default in expected_items: + fb.add_arg(arg, default) # may raise ExistingArgument + + if fb.is_async: + fb.body = 'return await _call(%s)' % fb.get_invocation_str() + else: + fb.body = 'return _call(%s)' % fb.get_invocation_str() + + execdict = dict(_call=wrapper, _func=func) + fully_wrapped = fb.get_func(execdict, with_dict=update_dict) + + if hide_wrapped and hasattr(fully_wrapped, '__wrapped__'): + del fully_wrapped.__dict__['__wrapped__'] + elif not hide_wrapped: + fully_wrapped.__wrapped__ = func # ref to the original function (#115) + + return fully_wrapped + + +def _parse_wraps_expected(expected): + # expected takes a pretty powerful argument, it's processed + # here. admittedly this would be less trouble if I relied on + # OrderedDict (there's an impl of that in the commit history if + # you look + if expected is None: + expected = [] + elif isinstance(expected, str): + expected = [(expected, NO_DEFAULT)] + + expected_items = [] + try: + expected_iter = iter(expected) + except TypeError as e: + raise ValueError('"expected" takes string name, sequence of string names,' + ' iterable of (name, default) pairs, or a mapping of ' + ' {name: default}, not %r (got: %r)' % (expected, e)) + for argname in expected_iter: + if isinstance(argname, str): + # dict keys and bare strings + try: + default = expected[argname] + except TypeError: + default = NO_DEFAULT + else: + # pairs + try: + argname, default = argname + except (TypeError, ValueError): + raise ValueError('"expected" takes string name, sequence of string names,' + ' iterable of (name, default) pairs, or a mapping of ' + ' {name: default}, not %r') + if not isinstance(argname, str): + raise ValueError(f'all "expected" argnames must be strings, not {argname!r}') + + expected_items.append((argname, default)) + + return expected_items + + +class FunctionBuilder: + """The FunctionBuilder type provides an interface for programmatically + creating new functions, either based on existing functions or from + scratch. + + Values are passed in at construction or set as attributes on the + instance. For creating a new function based of an existing one, + see the :meth:`~FunctionBuilder.from_func` classmethod. At any + point, :meth:`~FunctionBuilder.get_func` can be called to get a + newly compiled function, based on the values configured. + + >>> fb = FunctionBuilder('return_five', doc='returns the integer 5', + ... body='return 5') + >>> f = fb.get_func() + >>> f() + 5 + >>> fb.varkw = 'kw' + >>> f_kw = fb.get_func() + >>> f_kw(ignored_arg='ignored_val') + 5 + + Note that function signatures themselves changed quite a bit in + Python 3, so several arguments are only applicable to + FunctionBuilder in Python 3. Except for *name*, all arguments to + the constructor are keyword arguments. + + Args: + name (str): Name of the function. + doc (str): `Docstring`_ for the function, defaults to empty. + module (str): Name of the module from which this function was + imported. Defaults to None. + body (str): String version of the code representing the body + of the function. Defaults to ``'pass'``, which will result + in a function which does nothing and returns ``None``. + args (list): List of argument names, defaults to empty list, + denoting no arguments. + varargs (str): Name of the catch-all variable for positional + arguments. E.g., "args" if the resultant function is to have + ``*args`` in the signature. Defaults to None. + varkw (str): Name of the catch-all variable for keyword + arguments. E.g., "kwargs" if the resultant function is to have + ``**kwargs`` in the signature. Defaults to None. + defaults (tuple): A tuple containing default argument values for + those arguments that have defaults. + kwonlyargs (list): Argument names which are only valid as + keyword arguments. **Python 3 only.** + kwonlydefaults (dict): A mapping, same as normal *defaults*, + but only for the *kwonlyargs*. **Python 3 only.** + annotations (dict): Mapping of type hints and so + forth. **Python 3 only.** + filename (str): The filename that will appear in + tracebacks. Defaults to "boltons.funcutils.FunctionBuilder". + indent (int): Number of spaces with which to indent the + function *body*. Values less than 1 will result in an error. + dict (dict): Any other attributes which should be added to the + functions compiled with this FunctionBuilder. + + All of these arguments are also made available as attributes which + can be mutated as necessary. + + .. _Docstring: https://en.wikipedia.org/wiki/Docstring#Python + + """ + + _argspec_defaults = {'args': list, + 'varargs': lambda: None, + 'varkw': lambda: None, + 'defaults': lambda: None, + 'kwonlyargs': list, + 'kwonlydefaults': dict, + 'annotations': dict} + + @classmethod + def _argspec_to_dict(cls, f): + argspec = inspect.getfullargspec(f) + return {attr: getattr(argspec, attr) + for attr in cls._argspec_defaults} + + _defaults = {'doc': str, + 'dict': dict, + 'is_async': lambda: False, + 'module': lambda: None, + 'body': lambda: 'pass', + 'indent': lambda: 4, + "annotations": dict, + 'filename': lambda: 'boltons.funcutils.FunctionBuilder'} + + _defaults.update(_argspec_defaults) + + _compile_count = itertools.count() + + def __init__(self, name, **kw): + self.name = name + for a, default_factory in self._defaults.items(): + val = kw.pop(a, None) + if val is None: + val = default_factory() + setattr(self, a, val) + + if kw: + raise TypeError('unexpected kwargs: %r' % kw.keys()) + return + + # def get_argspec(self): # TODO + + def get_sig_str(self, with_annotations=True): + """Return function signature as a string. + + with_annotations is ignored on Python 2. On Python 3 signature + will omit annotations if it is set to False. + """ + if with_annotations: + annotations = self.annotations + else: + annotations = {} + + return inspect_formatargspec(self.args, + self.varargs, + self.varkw, + [], + self.kwonlyargs, + {}, + annotations) + + _KWONLY_MARKER = re.compile(r""" + \* # a star + \s* # followed by any amount of whitespace + , # followed by a comma + \s* # followed by any amount of whitespace + """, re.VERBOSE) + + def get_invocation_str(self): + kwonly_pairs = None + formatters = {} + if self.kwonlyargs: + kwonly_pairs = {arg: arg + for arg in self.kwonlyargs} + formatters['formatvalue'] = lambda value: '=' + value + + sig = inspect_formatargspec(self.args, + self.varargs, + self.varkw, + [], + kwonly_pairs, + kwonly_pairs, + {}, + **formatters) + sig = self._KWONLY_MARKER.sub('', sig) + return sig[1:-1] + + @classmethod + def from_func(cls, func): + """Create a new FunctionBuilder instance based on an existing + function. The original function will not be stored or + modified. + """ + # TODO: copy_body? gonna need a good signature regex. + # TODO: might worry about __closure__? + if not callable(func): + raise TypeError(f'expected callable object, not {func!r}') + + if isinstance(func, functools.partial): + kwargs = {'name': func.func.__name__, + 'doc': func.func.__doc__, + 'module': getattr(func.func, '__module__', None), # e.g., method_descriptor + 'annotations': getattr(func.func, "__annotations__", {}), + 'dict': getattr(func.func, '__dict__', {})} + else: + kwargs = {'name': func.__name__, + 'doc': func.__doc__, + 'module': getattr(func, '__module__', None), # e.g., method_descriptor + 'annotations': getattr(func, "__annotations__", {}), + 'dict': getattr(func, '__dict__', {})} + + kwargs.update(cls._argspec_to_dict(func)) + + if inspect.iscoroutinefunction(func): + kwargs['is_async'] = True + + return cls(**kwargs) + + def get_func(self, execdict=None, add_source=True, with_dict=True): + """Compile and return a new function based on the current values of + the FunctionBuilder. + + Args: + execdict (dict): The dictionary representing the scope in + which the compilation should take place. Defaults to an empty + dict. + add_source (bool): Whether to add the source used to a + special ``__source__`` attribute on the resulting + function. Defaults to True. + with_dict (bool): Add any custom attributes, if + applicable. Defaults to True. + + To see an example of usage, see the implementation of + :func:`~boltons.funcutils.wraps`. + """ + execdict = execdict or {} + body = self.body or self._default_body + + tmpl = 'def {name}{sig_str}:' + tmpl += '\n{body}' + + if self.is_async: + tmpl = 'async ' + tmpl + + body = _indent(self.body, ' ' * self.indent) + + name = self.name.replace('<', '_').replace('>', '_') # lambdas + src = tmpl.format(name=name, sig_str=self.get_sig_str(with_annotations=False), + doc=self.doc, body=body) + self._compile(src, execdict) + func = execdict[name] + + func.__name__ = self.name + func.__doc__ = self.doc + func.__defaults__ = self.defaults + func.__kwdefaults__ = self.kwonlydefaults + func.__annotations__ = self.annotations + + if with_dict: + func.__dict__.update(self.dict) + func.__module__ = self.module + # TODO: caller module fallback? + + if add_source: + func.__source__ = src + + return func + + def get_defaults_dict(self): + """Get a dictionary of function arguments with defaults and the + respective values. + """ + ret = dict(reversed(list(zip(reversed(self.args), + reversed(self.defaults or []))))) + kwonlydefaults = getattr(self, 'kwonlydefaults', None) + if kwonlydefaults: + ret.update(kwonlydefaults) + return ret + + def get_arg_names(self, only_required=False): + arg_names = tuple(self.args) + tuple(getattr(self, 'kwonlyargs', ())) + if only_required: + defaults_dict = self.get_defaults_dict() + arg_names = tuple([an for an in arg_names if an not in defaults_dict]) + return arg_names + + def add_arg(self, arg_name, default=NO_DEFAULT, kwonly=False): + """Add an argument with optional *default* (defaults to + ``funcutils.NO_DEFAULT``). Pass *kwonly=True* to add a + keyword-only argument + """ + if arg_name in self.args: + raise ExistingArgument(f'arg {arg_name!r} already in func {self.name} arg list') + if arg_name in self.kwonlyargs: + raise ExistingArgument(f'arg {arg_name!r} already in func {self.name} kwonly arg list') + if not kwonly: + self.args.append(arg_name) + if default is not NO_DEFAULT: + self.defaults = (self.defaults or ()) + (default,) + else: + self.kwonlyargs.append(arg_name) + if default is not NO_DEFAULT: + self.kwonlydefaults[arg_name] = default + + def remove_arg(self, arg_name): + """Remove an argument from this FunctionBuilder's argument list. The + resulting function will have one less argument per call to + this function. + + Args: + arg_name (str): The name of the argument to remove. + + Raises a :exc:`ValueError` if the argument is not present. + + """ + args = self.args + d_dict = self.get_defaults_dict() + try: + args.remove(arg_name) + except ValueError: + try: + self.kwonlyargs.remove(arg_name) + except (AttributeError, ValueError): + # missing from both + exc = MissingArgument('arg %r not found in %s argument list:' + ' %r' % (arg_name, self.name, args)) + exc.arg_name = arg_name + raise exc + else: + self.kwonlydefaults.pop(arg_name, None) + else: + d_dict.pop(arg_name, None) + self.defaults = tuple([d_dict[a] for a in args if a in d_dict]) + return + + def _compile(self, src, execdict): + + filename = ('<%s-%d>' + % (self.filename, next(self._compile_count),)) + try: + code = compile(src, filename, 'single') + exec(code, execdict) + except Exception: + raise + return execdict + + +class MissingArgument(ValueError): + pass + + +class ExistingArgument(ValueError): + pass + + +def _indent(text, margin, newline='\n', key=bool): + "based on boltons.strutils.indent" + indented_lines = [(margin + line if key(line) else line) + for line in text.splitlines()] + return newline.join(indented_lines) + + +def noop(*args, **kwargs): + """ + Simple function that should be used when no effect is desired. + An alternative to checking for an optional function type parameter. + + e.g. + def decorate(func, pre_func=None, post_func=None): + if pre_func: + pre_func() + func() + if post_func: + post_func() + + vs + + def decorate(func, pre_func=noop, post_func=noop): + pre_func() + func() + post_func() + """ + return None + +# end funcutils.py diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/gcutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/gcutils.py new file mode 100644 index 0000000000000000000000000000000000000000..1db18b462ae47ec4a53ba990634d539b1cfe1c8e --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/gcutils.py @@ -0,0 +1,164 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""The Python Garbage Collector (`GC`_) doesn't usually get too much +attention, probably because: + + - Python's `reference counting`_ effectively handles the vast majority of + unused objects + - People are slowly learning to avoid implementing `object.__del__()`_ + - The collection itself strikes a good balance between simplicity and + power (`tunable generation sizes`_) + - The collector itself is fast and rarely the cause of long pauses + associated with GC in other runtimes + +Even so, for many applications, the time will come when the developer +will need to track down: + + - Circular references + - Misbehaving objects (locks, ``__del__()``) + - Memory leaks + - Or just ways to shave off a couple percent of execution time + +Thanks to the :mod:`gc` module, the GC is a well-instrumented entry +point for exactly these tasks, and ``gcutils`` aims to facilitate it +further. + +.. _GC: https://docs.python.org/2/glossary.html#term-garbage-collection +.. _reference counting: https://docs.python.org/2/glossary.html#term-reference-count +.. _object.__del__(): https://docs.python.org/2/glossary.html#term-reference-count +.. _tunable generation sizes: https://docs.python.org/2/library/gc.html#gc.set_threshold +""" +# TODO: type survey + + +import gc +import sys + +__all__ = ['get_all', 'GCToggler', 'toggle_gc', 'toggle_gc_postcollect'] + + +def get_all(type_obj, include_subtypes=True): + """Get a list containing all instances of a given type. This will + work for the vast majority of types out there. + + >>> class Ratking(object): pass + >>> wiki, hak, sport = Ratking(), Ratking(), Ratking() + >>> len(get_all(Ratking)) + 3 + + However, there are some exceptions. For example, ``get_all(bool)`` + returns an empty list because ``True`` and ``False`` are + themselves built-in and not tracked. + + >>> get_all(bool) + [] + + Still, it's not hard to see how this functionality can be used to + find all instances of a leaking type and track them down further + using :func:`gc.get_referrers` and :func:`gc.get_referents`. + + ``get_all()`` is optimized such that getting instances of + user-created types is quite fast. Setting *include_subtypes* to + ``False`` will further increase performance in cases where + instances of subtypes aren't required. + + .. note:: + + There are no guarantees about the state of objects returned by + ``get_all()``, especially in concurrent environments. For + instance, it is possible for an object to be in the middle of + executing its ``__init__()`` and be only partially constructed. + """ + # TODO: old-style classes + if not isinstance(type_obj, type): + raise TypeError('expected a type, not %r' % type_obj) + try: + type_is_tracked = gc.is_tracked(type_obj) + except AttributeError: + type_is_tracked = False # Python 2.6 and below don't get the speedup + if type_is_tracked: + to_check = gc.get_referrers(type_obj) + else: + to_check = gc.get_objects() + + if include_subtypes: + ret = [x for x in to_check if isinstance(x, type_obj)] + else: + ret = [x for x in to_check if type(x) is type_obj] + return ret + + +_IS_PYPY = '__pypy__' in sys.builtin_module_names +if _IS_PYPY: + # pypy's gc is just different, y'all + del get_all + + +class GCToggler: + """The ``GCToggler`` is a context-manager that allows one to safely + take more control of your garbage collection schedule. Anecdotal + experience says certain object-creation-heavy tasks see speedups + of around 10% by simply doing one explicit collection at the very + end, especially if most of the objects will stay resident. + + Two GCTogglers are already present in the ``gcutils`` module: + + - :data:`toggle_gc` simply turns off GC at context entrance, and + re-enables at exit + - :data:`toggle_gc_postcollect` does the same, but triggers an + explicit collection after re-enabling. + + >>> with toggle_gc: + ... x = [object() for i in range(1000)] + + Between those two instances, the ``GCToggler`` type probably won't + be used much directly, but is documented for inheritance purposes. + """ + def __init__(self, postcollect=False): + self.postcollect = postcollect + + def __enter__(self): + gc.disable() + + def __exit__(self, exc_type, exc_val, exc_tb): + gc.enable() + if self.postcollect: + gc.collect() + + +toggle_gc = GCToggler() +"""A context manager for disabling GC for a code block. See +:class:`GCToggler` for more details.""" + + +toggle_gc_postcollect = GCToggler(postcollect=True) +"""A context manager for disabling GC for a code block, and collecting +before re-enabling. See :class:`GCToggler` for more details.""" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/ioutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/ioutils.py new file mode 100644 index 0000000000000000000000000000000000000000..bfcaf3fc1923eedf788b4fb403d699f7743d8d09 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/ioutils.py @@ -0,0 +1,587 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Coding decl above needed for rendering the emdash properly in the +# documentation. + +""" +Module ``ioutils`` implements a number of helper classes and functions which +are useful when dealing with input, output, and bytestreams in a variety of +ways. +""" +import os +from io import BytesIO, IOBase +from abc import ( + ABCMeta, + abstractmethod, + abstractproperty, +) +from errno import EINVAL +from codecs import EncodedFile +from tempfile import TemporaryFile +from itertools import zip_longest + +READ_CHUNK_SIZE = 21333 +""" +Number of bytes to read at a time. The value is ~ 1/3rd of 64k which means that +the value will easily fit in the L2 cache of most processors even if every +codepoint in a string is three bytes long which makes it a nice fast default +value. +""" + + +class SpooledIOBase(IOBase): + """ + A base class shared by the SpooledBytesIO and SpooledStringIO classes. + + The SpooledTemporaryFile class is missing several attributes and methods + present in the StringIO implementation. This brings the api as close to + parity as possible so that classes derived from SpooledIOBase can be used + as near drop-in replacements to save memory. + """ + __metaclass__ = ABCMeta + + def __init__(self, max_size=5000000, dir=None): + self._max_size = max_size + self._dir = dir + + def _checkClosed(self, msg=None): + """Raise a ValueError if file is closed""" + if self.closed: + raise ValueError('I/O operation on closed file.' + if msg is None else msg) + @abstractmethod + def read(self, n=-1): + """Read n characters from the buffer""" + + @abstractmethod + def write(self, s): + """Write into the buffer""" + + @abstractmethod + def seek(self, pos, mode=0): + """Seek to a specific point in a file""" + + @abstractmethod + def readline(self, length=None): + """Returns the next available line""" + + @abstractmethod + def readlines(self, sizehint=0): + """Returns a list of all lines from the current position forward""" + + def writelines(self, lines): + """ + Write lines to the file from an interable. + + NOTE: writelines() does NOT add line separators. + """ + self._checkClosed() + for line in lines: + self.write(line) + + @abstractmethod + def rollover(self): + """Roll file-like-object over into a real temporary file""" + + @abstractmethod + def tell(self): + """Return the current position""" + + @abstractproperty + def buffer(self): + """Should return a flo instance""" + + @abstractproperty + def _rolled(self): + """Returns whether the file has been rolled to a real file or not""" + + @abstractproperty + def len(self): + """Returns the length of the data""" + + def _get_softspace(self): + return self.buffer.softspace + + def _set_softspace(self, val): + self.buffer.softspace = val + + softspace = property(_get_softspace, _set_softspace) + + @property + def _file(self): + return self.buffer + + def close(self): + return self.buffer.close() + + def flush(self): + self._checkClosed() + return self.buffer.flush() + + def isatty(self): + self._checkClosed() + return self.buffer.isatty() + + @property + def closed(self): + return self.buffer.closed + + @property + def pos(self): + return self.tell() + + @property + def buf(self): + return self.getvalue() + + def fileno(self): + self.rollover() + return self.buffer.fileno() + + def truncate(self, size=None): + """ + Truncate the contents of the buffer. + + Custom version of truncate that takes either no arguments (like the + real SpooledTemporaryFile) or a single argument that truncates the + value to a certain index location. + """ + self._checkClosed() + if size is None: + return self.buffer.truncate() + + if size < 0: + raise OSError(EINVAL, "Negative size not allowed") + + # Emulate truncation to a particular location + pos = self.tell() + self.seek(size) + self.buffer.truncate() + if pos < size: + self.seek(pos) + + def getvalue(self): + """Return the entire files contents.""" + self._checkClosed() + pos = self.tell() + self.seek(0) + val = self.read() + self.seek(pos) + return val + + def seekable(self): + return True + + def readable(self): + return True + + def writable(self): + return True + + def __next__(self): + self._checkClosed() + line = self.readline() + if not line: + pos = self.buffer.tell() + self.buffer.seek(0, os.SEEK_END) + if pos == self.buffer.tell(): + raise StopIteration + else: + self.buffer.seek(pos) + return line + + next = __next__ + + def __len__(self): + return self.len + + def __iter__(self): + self._checkClosed() + return self + + def __enter__(self): + self._checkClosed() + return self + + def __exit__(self, *args): + self._file.close() + + def __eq__(self, other): + if isinstance(other, self.__class__): + self_pos = self.tell() + other_pos = other.tell() + try: + self.seek(0) + other.seek(0) + eq = True + for self_line, other_line in zip_longest(self, other): + if self_line != other_line: + eq = False + break + self.seek(self_pos) + other.seek(other_pos) + except Exception: + # Attempt to return files to original position if there were any errors + try: + self.seek(self_pos) + except Exception: + pass + try: + other.seek(other_pos) + except Exception: + pass + raise + else: + return eq + return False + + def __ne__(self, other): + return not self.__eq__(other) + + def __bool__(self): + return True + + def __del__(self): + """Can fail when called at program exit so suppress traceback.""" + try: + self.close() + except Exception: + pass + + +class SpooledBytesIO(SpooledIOBase): + """ + SpooledBytesIO is a spooled file-like-object that only accepts bytes. On + Python 2.x this means the 'str' type; on Python 3.x this means the 'bytes' + type. Bytes are written in and retrieved exactly as given, but it will + raise TypeErrors if something other than bytes are written. + + Example:: + + >>> from boltons import ioutils + >>> with ioutils.SpooledBytesIO() as f: + ... f.write(b"Happy IO") + ... _ = f.seek(0) + ... isinstance(f.getvalue(), bytes) + True + """ + + def read(self, n=-1): + self._checkClosed() + return self.buffer.read(n) + + def write(self, s): + self._checkClosed() + if not isinstance(s, bytes): + raise TypeError("bytes expected, got {}".format( + type(s).__name__ + )) + + if self.tell() + len(s) >= self._max_size: + self.rollover() + self.buffer.write(s) + + def seek(self, pos, mode=0): + self._checkClosed() + return self.buffer.seek(pos, mode) + + def readline(self, length=None): + self._checkClosed() + if length: + return self.buffer.readline(length) + else: + return self.buffer.readline() + + def readlines(self, sizehint=0): + return self.buffer.readlines(sizehint) + + def rollover(self): + """Roll the StringIO over to a TempFile""" + if not self._rolled: + tmp = TemporaryFile(dir=self._dir) + pos = self.buffer.tell() + tmp.write(self.buffer.getvalue()) + tmp.seek(pos) + self.buffer.close() + self._buffer = tmp + + @property + def _rolled(self): + return not isinstance(self.buffer, BytesIO) + + @property + def buffer(self): + try: + return self._buffer + except AttributeError: + self._buffer = BytesIO() + return self._buffer + + @property + def len(self): + """Determine the length of the file""" + pos = self.tell() + if self._rolled: + self.seek(0) + val = os.fstat(self.fileno()).st_size + else: + self.seek(0, os.SEEK_END) + val = self.tell() + self.seek(pos) + return val + + def tell(self): + self._checkClosed() + return self.buffer.tell() + + +class SpooledStringIO(SpooledIOBase): + """ + SpooledStringIO is a spooled file-like-object that only accepts unicode + values. On Python 2.x this means the 'unicode' type and on Python 3.x this + means the 'str' type. Values are accepted as unicode and then coerced into + utf-8 encoded bytes for storage. On retrieval, the values are returned as + unicode. + + Example:: + + >>> from boltons import ioutils + >>> with ioutils.SpooledStringIO() as f: + ... f.write(u"\u2014 Hey, an emdash!") + ... _ = f.seek(0) + ... isinstance(f.read(), str) + True + + """ + def __init__(self, *args, **kwargs): + self._tell = 0 + super().__init__(*args, **kwargs) + + def read(self, n=-1): + self._checkClosed() + ret = self.buffer.reader.read(n, n) + self._tell = self.tell() + len(ret) + return ret + + def write(self, s): + self._checkClosed() + if not isinstance(s, str): + raise TypeError("str expected, got {}".format( + type(s).__name__ + )) + current_pos = self.tell() + if self.buffer.tell() + len(s.encode('utf-8')) >= self._max_size: + self.rollover() + self.buffer.write(s.encode('utf-8')) + self._tell = current_pos + len(s) + + def _traverse_codepoints(self, current_position, n): + """Traverse from current position to the right n codepoints""" + dest = current_position + n + while True: + if current_position == dest: + # By chance we've landed on the right position, break + break + + # If the read would take us past the intended position then + # seek only enough to cover the offset + if current_position + READ_CHUNK_SIZE > dest: + self.read(dest - current_position) + break + else: + ret = self.read(READ_CHUNK_SIZE) + + # Increment our current position + current_position += READ_CHUNK_SIZE + + # If we kept reading but there was nothing here, break + # as we are at the end of the file + if not ret: + break + + return dest + + def seek(self, pos, mode=0): + """Traverse from offset to the specified codepoint""" + self._checkClosed() + # Seek to position from the start of the file + if mode == os.SEEK_SET: + self.buffer.seek(0) + self._traverse_codepoints(0, pos) + self._tell = pos + # Seek to new position relative to current position + elif mode == os.SEEK_CUR: + start_pos = self.tell() + self._traverse_codepoints(self.tell(), pos) + self._tell = start_pos + pos + elif mode == os.SEEK_END: + self.buffer.seek(0) + dest_position = self.len - pos + self._traverse_codepoints(0, dest_position) + self._tell = dest_position + else: + raise ValueError( + f"Invalid whence ({mode}, should be 0, 1, or 2)" + ) + return self.tell() + + def readline(self, length=None): + self._checkClosed() + ret = self.buffer.readline(length).decode('utf-8') + self._tell = self.tell() + len(ret) + return ret + + def readlines(self, sizehint=0): + ret = [x.decode('utf-8') for x in self.buffer.readlines(sizehint)] + self._tell = self.tell() + sum(len(x) for x in ret) + return ret + + @property + def buffer(self): + try: + return self._buffer + except AttributeError: + self._buffer = EncodedFile(BytesIO(), data_encoding='utf-8') + return self._buffer + + @property + def _rolled(self): + return not isinstance(self.buffer.stream, BytesIO) + + def rollover(self): + """Roll the buffer over to a TempFile""" + if not self._rolled: + tmp = EncodedFile(TemporaryFile(dir=self._dir), + data_encoding='utf-8') + pos = self.buffer.tell() + tmp.write(self.buffer.getvalue()) + tmp.seek(pos) + self.buffer.close() + self._buffer = tmp + + def tell(self): + """Return the codepoint position""" + self._checkClosed() + return self._tell + + @property + def len(self): + """Determine the number of codepoints in the file""" + pos = self.buffer.tell() + self.buffer.seek(0) + total = 0 + while True: + ret = self.read(READ_CHUNK_SIZE) + if not ret: + break + total += len(ret) + self.buffer.seek(pos) + return total + + +def is_text_fileobj(fileobj): + if getattr(fileobj, 'encoding', False): + # codecs.open and io.TextIOBase + return True + if getattr(fileobj, 'getvalue', False): + # StringIO.StringIO / io.StringIO + try: + if isinstance(fileobj.getvalue(), str): + return True + except Exception: + pass + return False + + +class MultiFileReader: + """Takes a list of open files or file-like objects and provides an + interface to read from them all contiguously. Like + :func:`itertools.chain()`, but for reading files. + + >>> mfr = MultiFileReader(BytesIO(b'ab'), BytesIO(b'cd'), BytesIO(b'e')) + >>> mfr.read(3).decode('ascii') + u'abc' + >>> mfr.read(3).decode('ascii') + u'de' + + The constructor takes as many fileobjs as you hand it, and will + raise a TypeError on non-file-like objects. A ValueError is raised + when file-like objects are a mix of bytes- and text-handling + objects (for instance, BytesIO and StringIO). + """ + + def __init__(self, *fileobjs): + if not all([callable(getattr(f, 'read', None)) and + callable(getattr(f, 'seek', None)) for f in fileobjs]): + raise TypeError('MultiFileReader expected file-like objects' + ' with .read() and .seek()') + if all([is_text_fileobj(f) for f in fileobjs]): + # codecs.open and io.TextIOBase + self._joiner = '' + elif any([is_text_fileobj(f) for f in fileobjs]): + raise ValueError('All arguments to MultiFileReader must handle' + ' bytes OR text, not a mix') + else: + # open/file and io.BytesIO + self._joiner = b'' + self._fileobjs = fileobjs + self._index = 0 + + def read(self, amt=None): + """Read up to the specified *amt*, seamlessly bridging across + files. Returns the appropriate type of string (bytes or text) + for the input, and returns an empty string when the files are + exhausted. + """ + if not amt: + return self._joiner.join(f.read() for f in self._fileobjs) + parts = [] + while amt > 0 and self._index < len(self._fileobjs): + parts.append(self._fileobjs[self._index].read(amt)) + got = len(parts[-1]) + if got < amt: + self._index += 1 + amt -= got + return self._joiner.join(parts) + + def seek(self, offset, whence=os.SEEK_SET): + """Enables setting position of the file cursor to a given + *offset*. Currently only supports ``offset=0``. + """ + if whence != os.SEEK_SET: + raise NotImplementedError( + 'MultiFileReader.seek() only supports os.SEEK_SET') + if offset != 0: + raise NotImplementedError( + 'MultiFileReader only supports seeking to start at this time') + for f in self._fileobjs: + f.seek(0) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/iterutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/iterutils.py new file mode 100644 index 0000000000000000000000000000000000000000..e0a5b900173d93689acf0e6b09dd75d87924da5b --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/iterutils.py @@ -0,0 +1,1609 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""":mod:`itertools` is full of great examples of Python generator +usage. However, there are still some critical gaps. ``iterutils`` +fills many of those gaps with featureful, tested, and Pythonic +solutions. + +Many of the functions below have two versions, one which +returns an iterator (denoted by the ``*_iter`` naming pattern), and a +shorter-named convenience form that returns a list. Some of the +following are based on examples in itertools docs. +""" + +import os +import math +import time +import codecs +import random +import itertools +from itertools import zip_longest +from collections.abc import Mapping, Sequence, Set, ItemsView, Iterable + + +try: + from .typeutils import make_sentinel + _UNSET = make_sentinel('_UNSET') + _REMAP_EXIT = make_sentinel('_REMAP_EXIT') +except ImportError: + _REMAP_EXIT = object() + _UNSET = object() + + +def is_iterable(obj): + """Similar in nature to :func:`callable`, ``is_iterable`` returns + ``True`` if an object is `iterable`_, ``False`` if not. + + >>> is_iterable([]) + True + >>> is_iterable(object()) + False + + .. _iterable: https://docs.python.org/2/glossary.html#term-iterable + """ + try: + iter(obj) + except TypeError: + return False + return True + + +def is_scalar(obj): + """A near-mirror of :func:`is_iterable`. Returns ``False`` if an + object is an iterable container type. Strings are considered + scalar as well, because strings are more often treated as whole + values as opposed to iterables of 1-character substrings. + + >>> is_scalar(object()) + True + >>> is_scalar(range(10)) + False + >>> is_scalar('hello') + True + """ + return not is_iterable(obj) or isinstance(obj, (str, bytes)) + + +def is_collection(obj): + """The opposite of :func:`is_scalar`. Returns ``True`` if an object + is an iterable other than a string. + + >>> is_collection(object()) + False + >>> is_collection(range(10)) + True + >>> is_collection('hello') + False + """ + return is_iterable(obj) and not isinstance(obj, (str, bytes)) + + +def split(src, sep=None, maxsplit=None): + """Splits an iterable based on a separator. Like :meth:`str.split`, + but for all iterables. Returns a list of lists. + + >>> split(['hi', 'hello', None, None, 'sup', None, 'soap', None]) + [['hi', 'hello'], ['sup'], ['soap']] + + See :func:`split_iter` docs for more info. + """ + return list(split_iter(src, sep, maxsplit)) + + +def split_iter(src, sep=None, maxsplit=None): + """Splits an iterable based on a separator, *sep*, a max of + *maxsplit* times (no max by default). *sep* can be: + + * a single value + * an iterable of separators + * a single-argument callable that returns True when a separator is + encountered + + ``split_iter()`` yields lists of non-separator values. A separator will + never appear in the output. + + >>> list(split_iter(['hi', 'hello', None, None, 'sup', None, 'soap', None])) + [['hi', 'hello'], ['sup'], ['soap']] + + Note that ``split_iter`` is based on :func:`str.split`, so if + *sep* is ``None``, ``split()`` **groups** separators. If empty lists + are desired between two contiguous ``None`` values, simply use + ``sep=[None]``: + + >>> list(split_iter(['hi', 'hello', None, None, 'sup', None])) + [['hi', 'hello'], ['sup']] + >>> list(split_iter(['hi', 'hello', None, None, 'sup', None], sep=[None])) + [['hi', 'hello'], [], ['sup'], []] + + Using a callable separator: + + >>> falsy_sep = lambda x: not x + >>> list(split_iter(['hi', 'hello', None, '', 'sup', False], falsy_sep)) + [['hi', 'hello'], [], ['sup'], []] + + See :func:`split` for a list-returning version. + + """ + if not is_iterable(src): + raise TypeError('expected an iterable') + + if maxsplit is not None: + maxsplit = int(maxsplit) + if maxsplit == 0: + yield [src] + return + + if callable(sep): + sep_func = sep + elif not is_scalar(sep): + sep = frozenset(sep) + def sep_func(x): return x in sep + else: + def sep_func(x): return x == sep + + cur_group = [] + split_count = 0 + for s in src: + if maxsplit is not None and split_count >= maxsplit: + def sep_func(x): return False + if sep_func(s): + if sep is None and not cur_group: + # If sep is none, str.split() "groups" separators + # check the str.split() docs for more info + continue + split_count += 1 + yield cur_group + cur_group = [] + else: + cur_group.append(s) + + if cur_group or sep is not None: + yield cur_group + return + + +def lstrip(iterable, strip_value=None): + """Strips values from the beginning of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.lstrip. Returns a list. + + >>> lstrip(['Foo', 'Bar', 'Bam'], 'Foo') + ['Bar', 'Bam'] + + """ + return list(lstrip_iter(iterable, strip_value)) + + +def lstrip_iter(iterable, strip_value=None): + """Strips values from the beginning of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.lstrip. Returns a generator. + + >>> list(lstrip_iter(['Foo', 'Bar', 'Bam'], 'Foo')) + ['Bar', 'Bam'] + + """ + iterator = iter(iterable) + for i in iterator: + if i != strip_value: + yield i + break + for i in iterator: + yield i + + +def rstrip(iterable, strip_value=None): + """Strips values from the end of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.rstrip. Returns a list. + + >>> rstrip(['Foo', 'Bar', 'Bam'], 'Bam') + ['Foo', 'Bar'] + + """ + return list(rstrip_iter(iterable, strip_value)) + + +def rstrip_iter(iterable, strip_value=None): + """Strips values from the end of an iterable. Stripped items will + match the value of the argument strip_value. Functionality is analogous + to that of the method str.rstrip. Returns a generator. + + >>> list(rstrip_iter(['Foo', 'Bar', 'Bam'], 'Bam')) + ['Foo', 'Bar'] + + """ + iterator = iter(iterable) + for i in iterator: + if i == strip_value: + cache = list() + cache.append(i) + broken = False + for i in iterator: + if i == strip_value: + cache.append(i) + else: + broken = True + break + if not broken: # Return to caller here because the end of the + return # iterator has been reached + yield from cache + yield i + + +def strip(iterable, strip_value=None): + """Strips values from the beginning and end of an iterable. Stripped items + will match the value of the argument strip_value. Functionality is + analogous to that of the method str.strip. Returns a list. + + >>> strip(['Fu', 'Foo', 'Bar', 'Bam', 'Fu'], 'Fu') + ['Foo', 'Bar', 'Bam'] + + """ + return list(strip_iter(iterable, strip_value)) + + +def strip_iter(iterable, strip_value=None): + """Strips values from the beginning and end of an iterable. Stripped items + will match the value of the argument strip_value. Functionality is + analogous to that of the method str.strip. Returns a generator. + + >>> list(strip_iter(['Fu', 'Foo', 'Bar', 'Bam', 'Fu'], 'Fu')) + ['Foo', 'Bar', 'Bam'] + + """ + return rstrip_iter(lstrip_iter(iterable, strip_value), strip_value) + + +def chunked(src, size, count=None, **kw): + """Returns a list of *count* chunks, each with *size* elements, + generated from iterable *src*. If *src* is not evenly divisible by + *size*, the final chunk will have fewer than *size* elements. + Provide the *fill* keyword argument to provide a pad value and + enable padding, otherwise no padding will take place. + + >>> chunked(range(10), 3) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] + >>> chunked(range(10), 3, fill=None) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, None, None]] + >>> chunked(range(10), 3, count=2) + [[0, 1, 2], [3, 4, 5]] + + See :func:`chunked_iter` for more info. + """ + chunk_iter = chunked_iter(src, size, **kw) + if count is None: + return list(chunk_iter) + else: + return list(itertools.islice(chunk_iter, count)) + + +def _validate_positive_int(value, name, strictly_positive=True): + value = int(value) + if value < 0 or (strictly_positive and value == 0): + raise ValueError('expected a positive integer ' + name) + return value + + +def chunked_iter(src, size, **kw): + """Generates *size*-sized chunks from *src* iterable. Unless the + optional *fill* keyword argument is provided, iterables not evenly + divisible by *size* will have a final chunk that is smaller than + *size*. + + >>> list(chunked_iter(range(10), 3)) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] + >>> list(chunked_iter(range(10), 3, fill=None)) + [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, None, None]] + + Note that ``fill=None`` in fact uses ``None`` as the fill value. + """ + # TODO: add count kwarg? + if not is_iterable(src): + raise TypeError('expected an iterable') + size = _validate_positive_int(size, 'chunk size') + do_fill = True + try: + fill_val = kw.pop('fill') + except KeyError: + do_fill = False + fill_val = None + if kw: + raise ValueError('got unexpected keyword arguments: %r' % kw.keys()) + if not src: + return + + def postprocess(chk): return chk + if isinstance(src, (str, bytes)): + def postprocess(chk, _sep=type(src)()): return _sep.join(chk) + if isinstance(src, bytes): + def postprocess(chk): return bytes(chk) + src_iter = iter(src) + while True: + cur_chunk = list(itertools.islice(src_iter, size)) + if not cur_chunk: + break + lc = len(cur_chunk) + if lc < size and do_fill: + cur_chunk[lc:] = [fill_val] * (size - lc) + yield postprocess(cur_chunk) + return + + +def chunk_ranges(input_size, chunk_size, input_offset=0, overlap_size=0, align=False): + """Generates *chunk_size*-sized chunk ranges for an input with length *input_size*. + Optionally, a start of the input can be set via *input_offset*, and + and overlap between the chunks may be specified via *overlap_size*. + Also, if *align* is set to *True*, any items with *i % (chunk_size-overlap_size) == 0* + are always at the beginning of the chunk. + + Returns an iterator of (start, end) tuples, one tuple per chunk. + + >>> list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5)) + [(10, 15), (15, 20)] + >>> list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5, overlap_size=1)) + [(10, 15), (14, 19), (18, 20)] + >>> list(chunk_ranges(input_offset=10, input_size=10, chunk_size=5, overlap_size=2)) + [(10, 15), (13, 18), (16, 20)] + + >>> list(chunk_ranges(input_offset=4, input_size=15, chunk_size=5, align=False)) + [(4, 9), (9, 14), (14, 19)] + >>> list(chunk_ranges(input_offset=4, input_size=15, chunk_size=5, align=True)) + [(4, 5), (5, 10), (10, 15), (15, 19)] + + >>> list(chunk_ranges(input_offset=2, input_size=15, chunk_size=5, overlap_size=1, align=False)) + [(2, 7), (6, 11), (10, 15), (14, 17)] + >>> list(chunk_ranges(input_offset=2, input_size=15, chunk_size=5, overlap_size=1, align=True)) + [(2, 5), (4, 9), (8, 13), (12, 17)] + >>> list(chunk_ranges(input_offset=3, input_size=15, chunk_size=5, overlap_size=1, align=True)) + [(3, 5), (4, 9), (8, 13), (12, 17), (16, 18)] + """ + input_size = _validate_positive_int( + input_size, 'input_size', strictly_positive=False) + chunk_size = _validate_positive_int(chunk_size, 'chunk_size') + input_offset = _validate_positive_int( + input_offset, 'input_offset', strictly_positive=False) + overlap_size = _validate_positive_int( + overlap_size, 'overlap_size', strictly_positive=False) + + input_stop = input_offset + input_size + + if align: + initial_chunk_len = chunk_size - \ + input_offset % (chunk_size - overlap_size) + if initial_chunk_len != overlap_size: + yield (input_offset, min(input_offset + initial_chunk_len, input_stop)) + if input_offset + initial_chunk_len >= input_stop: + return + input_offset = input_offset + initial_chunk_len - overlap_size + + for i in range(input_offset, input_stop, chunk_size - overlap_size): + yield (i, min(i + chunk_size, input_stop)) + + if i + chunk_size >= input_stop: + return + + +def pairwise(src, end=_UNSET): + """Convenience function for calling :func:`windowed` on *src*, with + *size* set to 2. + + >>> pairwise(range(5)) + [(0, 1), (1, 2), (2, 3), (3, 4)] + >>> pairwise([]) + [] + + Unless *end* is set, the number of pairs is always one less than + the number of elements in the iterable passed in, except on an empty input, + which will return an empty list. + + With *end* set, a number of pairs equal to the length of *src* is returned, + with the last item of the last pair being equal to *end*. + + >>> list(pairwise(range(3), end=None)) + [(0, 1), (1, 2), (2, None)] + + This way, *end* values can be useful as sentinels to signal the end of the iterable. + """ + return windowed(src, 2, fill=end) + + +def pairwise_iter(src, end=_UNSET): + """Convenience function for calling :func:`windowed_iter` on *src*, + with *size* set to 2. + + >>> list(pairwise_iter(range(5))) + [(0, 1), (1, 2), (2, 3), (3, 4)] + >>> list(pairwise_iter([])) + [] + + Unless *end* is set, the number of pairs is always one less + than the number of elements in the iterable passed in, + or zero, when *src* is empty. + + With *end* set, a number of pairs equal to the length of *src* is returned, + with the last item of the last pair being equal to *end*. + + >>> list(pairwise_iter(range(3), end=None)) + [(0, 1), (1, 2), (2, None)] + + This way, *end* values can be useful as sentinels to signal the end + of the iterable. For infinite iterators, setting *end* has no effect. + """ + return windowed_iter(src, 2, fill=end) + + +def windowed(src, size, fill=_UNSET): + """Returns tuples with exactly length *size*. If *fill* is unset + and the iterable is too short to make a window of length *size*, + no tuples are returned. See :func:`windowed_iter` for more. + """ + return list(windowed_iter(src, size, fill=fill)) + + +def windowed_iter(src, size, fill=_UNSET): + """Returns tuples with length *size* which represent a sliding + window over iterable *src*. + + >>> list(windowed_iter(range(7), 3)) + [(0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 6)] + + If *fill* is unset, and the iterable is too short to make a window + of length *size*, then no window tuples are returned. + + >>> list(windowed_iter(range(3), 5)) + [] + + With *fill* set, the iterator always yields a number of windows + equal to the length of the *src* iterable. + + >>> windowed(range(4), 3, fill=None) + [(0, 1, 2), (1, 2, 3), (2, 3, None), (3, None, None)] + + This way, *fill* values can be useful to signal the end of the iterable. + For infinite iterators, setting *fill* has no effect. + """ + tees = itertools.tee(src, size) + if fill is _UNSET: + try: + for i, t in enumerate(tees): + for _ in range(i): + next(t) + except StopIteration: + return zip([]) + return zip(*tees) + + for i, t in enumerate(tees): + for _ in range(i): + try: + next(t) + except StopIteration: + continue + return zip_longest(*tees, fillvalue=fill) + + +def xfrange(stop, start=None, step=1.0): + """Same as :func:`frange`, but generator-based instead of returning a + list. + + >>> tuple(xfrange(1, 3, step=0.75)) + (1.0, 1.75, 2.5) + + See :func:`frange` for more details. + """ + if not step: + raise ValueError('step must be non-zero') + if start is None: + start, stop = 0.0, stop * 1.0 + else: + # swap when all args are used + stop, start = start * 1.0, stop * 1.0 + cur = start + while cur < stop: + yield cur + cur += step + + +def frange(stop, start=None, step=1.0): + """A :func:`range` clone for float-based ranges. + + >>> frange(5) + [0.0, 1.0, 2.0, 3.0, 4.0] + >>> frange(6, step=1.25) + [0.0, 1.25, 2.5, 3.75, 5.0] + >>> frange(100.5, 101.5, 0.25) + [100.5, 100.75, 101.0, 101.25] + >>> frange(5, 0) + [] + >>> frange(5, 0, step=-1.25) + [5.0, 3.75, 2.5, 1.25] + """ + if not step: + raise ValueError('step must be non-zero') + if start is None: + start, stop = 0.0, stop * 1.0 + else: + # swap when all args are used + stop, start = start * 1.0, stop * 1.0 + count = int(math.ceil((stop - start) / step)) + ret = [None] * count + if not ret: + return ret + ret[0] = start + for i in range(1, count): + ret[i] = ret[i - 1] + step + return ret + + +def backoff(start, stop, count=None, factor=2.0, jitter=False): + """Returns a list of geometrically-increasing floating-point numbers, + suitable for usage with `exponential backoff`_. Exactly like + :func:`backoff_iter`, but without the ``'repeat'`` option for + *count*. See :func:`backoff_iter` for more details. + + .. _exponential backoff: https://en.wikipedia.org/wiki/Exponential_backoff + + >>> backoff(1, 10) + [1.0, 2.0, 4.0, 8.0, 10.0] + """ + if count == 'repeat': + raise ValueError("'repeat' supported in backoff_iter, not backoff") + return list(backoff_iter(start, stop, count=count, + factor=factor, jitter=jitter)) + + +def backoff_iter(start, stop, count=None, factor=2.0, jitter=False): + """Generates a sequence of geometrically-increasing floats, suitable + for usage with `exponential backoff`_. Starts with *start*, + increasing by *factor* until *stop* is reached, optionally + stopping iteration once *count* numbers are yielded. *factor* + defaults to 2. In general retrying with properly-configured + backoff creates a better-behaved component for a larger service + ecosystem. + + .. _exponential backoff: https://en.wikipedia.org/wiki/Exponential_backoff + + >>> list(backoff_iter(1.0, 10.0, count=5)) + [1.0, 2.0, 4.0, 8.0, 10.0] + >>> list(backoff_iter(1.0, 10.0, count=8)) + [1.0, 2.0, 4.0, 8.0, 10.0, 10.0, 10.0, 10.0] + >>> list(backoff_iter(0.25, 100.0, factor=10)) + [0.25, 2.5, 25.0, 100.0] + + A simplified usage example: + + .. code-block:: python + + for timeout in backoff_iter(0.25, 5.0): + try: + res = network_call() + break + except Exception as e: + log(e) + time.sleep(timeout) + + An enhancement for large-scale systems would be to add variation, + or *jitter*, to timeout values. This is done to avoid a thundering + herd on the receiving end of the network call. + + Finally, for *count*, the special value ``'repeat'`` can be passed to + continue yielding indefinitely. + + Args: + + start (float): Positive number for baseline. + stop (float): Positive number for maximum. + count (int): Number of steps before stopping + iteration. Defaults to the number of steps between *start* and + *stop*. Pass the string, `'repeat'`, to continue iteration + indefinitely. + factor (float): Rate of exponential increase. Defaults to `2.0`, + e.g., `[1, 2, 4, 8, 16]`. + jitter (float): A factor between `-1.0` and `1.0`, used to + uniformly randomize and thus spread out timeouts in a distributed + system, avoiding rhythm effects. Positive values use the base + backoff curve as a maximum, negative values use the curve as a + minimum. Set to 1.0 or `True` for a jitter approximating + Ethernet's time-tested backoff solution. Defaults to `False`. + + """ + start = float(start) + stop = float(stop) + factor = float(factor) + if start < 0.0: + raise ValueError('expected start >= 0, not %r' % start) + if factor < 1.0: + raise ValueError('expected factor >= 1.0, not %r' % factor) + if stop == 0.0: + raise ValueError('expected stop >= 0') + if stop < start: + raise ValueError('expected stop >= start, not %r' % stop) + if count is None: + denom = start if start else 1 + count = 1 + math.ceil(math.log(stop/denom, factor)) + count = count if start else count + 1 + if count != 'repeat' and count < 0: + raise ValueError('count must be positive or "repeat", not %r' % count) + if jitter: + jitter = float(jitter) + if not (-1.0 <= jitter <= 1.0): + raise ValueError('expected jitter -1 <= j <= 1, not: %r' % jitter) + + cur, i = start, 0 + while count == 'repeat' or i < count: + if not jitter: + cur_ret = cur + elif jitter: + cur_ret = cur - (cur * jitter * random.random()) + yield cur_ret + i += 1 + if cur == 0: + cur = 1 + elif cur < stop: + cur *= factor + if cur > stop: + cur = stop + return + + +def bucketize(src, key=bool, value_transform=None, key_filter=None): + """Group values in the *src* iterable by the value returned by *key*. + + >>> bucketize(range(5)) + {False: [0], True: [1, 2, 3, 4]} + >>> is_odd = lambda x: x % 2 == 1 + >>> bucketize(range(5), is_odd) + {False: [0, 2, 4], True: [1, 3]} + + *key* is :class:`bool` by default, but can either be a callable or a string or a list + if it is a string, it is the name of the attribute on which to bucketize objects. + + >>> bucketize([1+1j, 2+2j, 1, 2], key='real') + {1.0: [(1+1j), 1], 2.0: [(2+2j), 2]} + + if *key* is a list, it contains the buckets where to put each object + + >>> bucketize([1,2,365,4,98],key=[0,1,2,0,2]) + {0: [1, 4], 1: [2], 2: [365, 98]} + + + Value lists are not deduplicated: + + >>> bucketize([None, None, None, 'hello']) + {False: [None, None, None], True: ['hello']} + + Bucketize into more than 3 groups + + >>> bucketize(range(10), lambda x: x % 3) + {0: [0, 3, 6, 9], 1: [1, 4, 7], 2: [2, 5, 8]} + + ``bucketize`` has a couple of advanced options useful in certain + cases. *value_transform* can be used to modify values as they are + added to buckets, and *key_filter* will allow excluding certain + buckets from being collected. + + >>> bucketize(range(5), value_transform=lambda x: x*x) + {False: [0], True: [1, 4, 9, 16]} + + >>> bucketize(range(10), key=lambda x: x % 3, key_filter=lambda k: k % 3 != 1) + {0: [0, 3, 6, 9], 2: [2, 5, 8]} + + Note in some of these examples there were at most two keys, ``True`` and + ``False``, and each key present has a list with at least one + item. See :func:`partition` for a version specialized for binary + use cases. + + """ + if not is_iterable(src): + raise TypeError('expected an iterable') + elif isinstance(key, list): + if len(key) != len(src): + raise ValueError("key and src have to be the same length") + src = zip(key, src) + + if isinstance(key, str): + def key_func(x): return getattr(x, key, x) + elif callable(key): + key_func = key + elif isinstance(key, list): + def key_func(x): return x[0] + else: + raise TypeError('expected key to be callable or a string or a list') + + if value_transform is None: + def value_transform(x): return x + if not callable(value_transform): + raise TypeError('expected callable value transform function') + if isinstance(key, list): + f = value_transform + def value_transform(x): return f(x[1]) + + ret = {} + for val in src: + key_of_val = key_func(val) + if key_filter is None or key_filter(key_of_val): + ret.setdefault(key_of_val, []).append(value_transform(val)) + return ret + + +def partition(src, key=bool): + """No relation to :meth:`str.partition`, ``partition`` is like + :func:`bucketize`, but for added convenience returns a tuple of + ``(truthy_values, falsy_values)``. + + >>> nonempty, empty = partition(['', '', 'hi', '', 'bye']) + >>> nonempty + ['hi', 'bye'] + + *key* defaults to :class:`bool`, but can be carefully overridden to + use either a function that returns either ``True`` or ``False`` or + a string name of the attribute on which to partition objects. + + >>> import string + >>> is_digit = lambda x: x in string.digits + >>> decimal_digits, hexletters = partition(string.hexdigits, is_digit) + >>> ''.join(decimal_digits), ''.join(hexletters) + ('0123456789', 'abcdefABCDEF') + """ + bucketized = bucketize(src, key) + return bucketized.get(True, []), bucketized.get(False, []) + + +def unique(src, key=None): + """``unique()`` returns a list of unique values, as determined by + *key*, in the order they first appeared in the input iterable, + *src*. + + >>> ones_n_zeros = '11010110001010010101010' + >>> ''.join(unique(ones_n_zeros)) + '10' + + See :func:`unique_iter` docs for more details. + """ + return list(unique_iter(src, key)) + + +def unique_iter(src, key=None): + """Yield unique elements from the iterable, *src*, based on *key*, + in the order in which they first appeared in *src*. + + >>> repetitious = [1, 2, 3] * 10 + >>> list(unique_iter(repetitious)) + [1, 2, 3] + + By default, *key* is the object itself, but *key* can either be a + callable or, for convenience, a string name of the attribute on + which to uniqueify objects, falling back on identity when the + attribute is not present. + + >>> pleasantries = ['hi', 'hello', 'ok', 'bye', 'yes'] + >>> list(unique_iter(pleasantries, key=lambda x: len(x))) + ['hi', 'hello', 'bye'] + """ + if not is_iterable(src): + raise TypeError('expected an iterable, not %r' % type(src)) + if key is None: + def key_func(x): return x + elif callable(key): + key_func = key + elif isinstance(key, str): + def key_func(x): return getattr(x, key, x) + else: + raise TypeError('"key" expected a string or callable, not %r' % key) + seen = set() + for i in src: + k = key_func(i) + if k not in seen: + seen.add(k) + yield i + return + + +def redundant(src, key=None, groups=False): + """The complement of :func:`unique()`. + + By default returns non-unique/duplicate values as a list of the + *first* redundant value in *src*. Pass ``groups=True`` to get + groups of all values with redundancies, ordered by position of the + first redundant value. This is useful in conjunction with some + normalizing *key* function. + + >>> redundant([1, 2, 3, 4]) + [] + >>> redundant([1, 2, 3, 2, 3, 3, 4]) + [2, 3] + >>> redundant([1, 2, 3, 2, 3, 3, 4], groups=True) + [[2, 2], [3, 3, 3]] + + An example using a *key* function to do case-insensitive + redundancy detection. + + >>> redundant(['hi', 'Hi', 'HI', 'hello'], key=str.lower) + ['Hi'] + >>> redundant(['hi', 'Hi', 'HI', 'hello'], groups=True, key=str.lower) + [['hi', 'Hi', 'HI']] + + *key* should also be used when the values in *src* are not hashable. + + .. note:: + + This output of this function is designed for reporting + duplicates in contexts when a unique input is desired. Due to + the grouped return type, there is no streaming equivalent of + this function for the time being. + + """ + if key is None: + pass + elif callable(key): + key_func = key + elif isinstance(key, (str, bytes)): + def key_func(x): return getattr(x, key, x) + else: + raise TypeError('"key" expected a string or callable, not %r' % key) + seen = {} # key to first seen item + redundant_order = [] + redundant_groups = {} + for i in src: + k = key_func(i) if key else i + if k not in seen: + seen[k] = i + else: + if k in redundant_groups: + if groups: + redundant_groups[k].append(i) + else: + redundant_order.append(k) + redundant_groups[k] = [seen[k], i] + if not groups: + ret = [redundant_groups[k][1] for k in redundant_order] + else: + ret = [redundant_groups[k] for k in redundant_order] + return ret + + +def one(src, default=None, key=None): + """Along the same lines as builtins, :func:`all` and :func:`any`, and + similar to :func:`first`, ``one()`` returns the single object in + the given iterable *src* that evaluates to ``True``, as determined + by callable *key*. If unset, *key* defaults to :class:`bool`. If + no such objects are found, *default* is returned. If *default* is + not passed, ``None`` is returned. + + If *src* has more than one object that evaluates to ``True``, or + if there is no object that fulfills such condition, return + *default*. It's like an `XOR`_ over an iterable. + + >>> one((True, False, False)) + True + >>> one((True, False, True)) + >>> one((0, 0, 'a')) + 'a' + >>> one((0, False, None)) + >>> one((True, True), default=False) + False + >>> bool(one(('', 1))) + True + >>> one((10, 20, 30, 42), key=lambda i: i > 40) + 42 + + See `Martín Gaitán's original repo`_ for further use cases. + + .. _Martín Gaitán's original repo: https://github.com/mgaitan/one + .. _XOR: https://en.wikipedia.org/wiki/Exclusive_or + + """ + ones = list(itertools.islice(filter(key, src), 2)) + return ones[0] if len(ones) == 1 else default + + +def first(iterable, default=None, key=None): + """Return first element of *iterable* that evaluates to ``True``, else + return ``None`` or optional *default*. Similar to :func:`one`. + + >>> first([0, False, None, [], (), 42]) + 42 + >>> first([0, False, None, [], ()]) is None + True + >>> first([0, False, None, [], ()], default='ohai') + 'ohai' + >>> import re + >>> m = first(re.match(regex, 'abc') for regex in ['b.*', 'a(.*)']) + >>> m.group(1) + 'bc' + + The optional *key* argument specifies a one-argument predicate function + like that used for *filter()*. The *key* argument, if supplied, should be + in keyword form. For example, finding the first even number in an iterable: + + >>> first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0) + 4 + + Contributed by Hynek Schlawack, author of `the original standalone module`_. + + .. _the original standalone module: https://github.com/hynek/first + """ + return next(filter(key, iterable), default) + + +def flatten_iter(iterable): + """``flatten_iter()`` yields all the elements from *iterable* while + collapsing any nested iterables. + + >>> nested = [[1, 2], [[3], [4, 5]]] + >>> list(flatten_iter(nested)) + [1, 2, 3, 4, 5] + """ + for item in iterable: + if isinstance(item, Iterable) and not isinstance(item, (str, bytes)): + yield from flatten_iter(item) + else: + yield item + + +def flatten(iterable): + """``flatten()`` returns a collapsed list of all the elements from + *iterable* while collapsing any nested iterables. + + >>> nested = [[1, 2], [[3], [4, 5]]] + >>> flatten(nested) + [1, 2, 3, 4, 5] + """ + return list(flatten_iter(iterable)) + + +def same(iterable, ref=_UNSET): + """``same()`` returns ``True`` when all values in *iterable* are + equal to one another, or optionally a reference value, + *ref*. Similar to :func:`all` and :func:`any` in that it evaluates + an iterable and returns a :class:`bool`. ``same()`` returns + ``True`` for empty iterables. + + >>> same([]) + True + >>> same([1]) + True + >>> same(['a', 'a', 'a']) + True + >>> same(range(20)) + False + >>> same([[], []]) + True + >>> same([[], []], ref='test') + False + + """ + iterator = iter(iterable) + if ref is _UNSET: + ref = next(iterator, ref) + return all(val == ref for val in iterator) + + +def default_visit(path, key, value): + # print('visit(%r, %r, %r)' % (path, key, value)) + return key, value + + +# enable the extreme: monkeypatching iterutils with a different default_visit +_orig_default_visit = default_visit + + +def default_enter(path, key, value): + # print('enter(%r, %r)' % (key, value)) + if isinstance(value, (str, bytes)): + return value, False + elif isinstance(value, Mapping): + return value.__class__(), ItemsView(value) + elif isinstance(value, Sequence): + return value.__class__(), enumerate(value) + elif isinstance(value, Set): + return value.__class__(), enumerate(value) + else: + # files, strings, other iterables, and scalars are not + # traversed + return value, False + + +def default_exit(path, key, old_parent, new_parent, new_items): + # print('exit(%r, %r, %r, %r, %r)' + # % (path, key, old_parent, new_parent, new_items)) + ret = new_parent + if isinstance(new_parent, Mapping): + new_parent.update(new_items) + elif isinstance(new_parent, Sequence): + vals = [v for i, v in new_items] + try: + new_parent.extend(vals) + except AttributeError: + ret = new_parent.__class__(vals) # tuples + elif isinstance(new_parent, Set): + vals = [v for i, v in new_items] + try: + new_parent.update(vals) + except AttributeError: + ret = new_parent.__class__(vals) # frozensets + else: + raise RuntimeError('unexpected iterable type: %r' % type(new_parent)) + return ret + + +def remap(root, visit=default_visit, enter=default_enter, exit=default_exit, + **kwargs): + """The remap ("recursive map") function is used to traverse and + transform nested structures. Lists, tuples, sets, and dictionaries + are just a few of the data structures nested into heterogeneous + tree-like structures that are so common in programming. + Unfortunately, Python's built-in ways to manipulate collections + are almost all flat. List comprehensions may be fast and succinct, + but they do not recurse, making it tedious to apply quick changes + or complex transforms to real-world data. + + remap goes where list comprehensions cannot. + + Here's an example of removing all Nones from some data: + + >>> from pprint import pprint + >>> reviews = {'Star Trek': {'TNG': 10, 'DS9': 8.5, 'ENT': None}, + ... 'Babylon 5': 6, 'Dr. Who': None} + >>> pprint(remap(reviews, lambda p, k, v: v is not None)) + {'Babylon 5': 6, 'Star Trek': {'DS9': 8.5, 'TNG': 10}} + + Notice how both Nones have been removed despite the nesting in the + dictionary. Not bad for a one-liner, and that's just the beginning. + See `this remap cookbook`_ for more delicious recipes. + + .. _this remap cookbook: http://sedimental.org/remap.html + + remap takes four main arguments: the object to traverse and three + optional callables which determine how the remapped object will be + created. + + Args: + + root: The target object to traverse. By default, remap + supports iterables like :class:`list`, :class:`tuple`, + :class:`dict`, and :class:`set`, but any object traversable by + *enter* will work. + visit (callable): This function is called on every item in + *root*. It must accept three positional arguments, *path*, + *key*, and *value*. *path* is simply a tuple of parents' + keys. *visit* should return the new key-value pair. It may + also return ``True`` as shorthand to keep the old item + unmodified, or ``False`` to drop the item from the new + structure. *visit* is called after *enter*, on the new parent. + + The *visit* function is called for every item in root, + including duplicate items. For traversable values, it is + called on the new parent object, after all its children + have been visited. The default visit behavior simply + returns the key-value pair unmodified. + enter (callable): This function controls which items in *root* + are traversed. It accepts the same arguments as *visit*: the + path, the key, and the value of the current item. It returns a + pair of the blank new parent, and an iterator over the items + which should be visited. If ``False`` is returned instead of + an iterator, the value will not be traversed. + + The *enter* function is only called once per unique value. The + default enter behavior support mappings, sequences, and + sets. Strings and all other iterables will not be traversed. + exit (callable): This function determines how to handle items + once they have been visited. It gets the same three + arguments as the other functions -- *path*, *key*, *value* + -- plus two more: the blank new parent object returned + from *enter*, and a list of the new items, as remapped by + *visit*. + + Like *enter*, the *exit* function is only called once per + unique value. The default exit behavior is to simply add + all new items to the new parent, e.g., using + :meth:`list.extend` and :meth:`dict.update` to add to the + new parent. Immutable objects, such as a :class:`tuple` or + :class:`namedtuple`, must be recreated from scratch, but + use the same type as the new parent passed back from the + *enter* function. + reraise_visit (bool): A pragmatic convenience for the *visit* + callable. When set to ``False``, remap ignores any errors + raised by the *visit* callback. Items causing exceptions + are kept. See examples for more details. + trace (bool): Pass ``trace=True`` to print out the entire + traversal. Or pass a tuple of ``'visit'``, ``'enter'``, + or ``'exit'`` to print only the selected events. + + remap is designed to cover the majority of cases with just the + *visit* callable. While passing in multiple callables is very + empowering, remap is designed so very few cases should require + passing more than one function. + + When passing *enter* and *exit*, it's common and easiest to build + on the default behavior. Simply add ``from boltons.iterutils import + default_enter`` (or ``default_exit``), and have your enter/exit + function call the default behavior before or after your custom + logic. See `this example`_. + + Duplicate and self-referential objects (aka reference loops) are + automatically handled internally, `as shown here`_. + + .. _this example: http://sedimental.org/remap.html#sort_all_lists + .. _as shown here: http://sedimental.org/remap.html#corner_cases + + """ + # TODO: improve argument formatting in sphinx doc + # TODO: enter() return (False, items) to continue traverse but cancel copy? + if not callable(visit): + raise TypeError('visit expected callable, not: %r' % visit) + if not callable(enter): + raise TypeError('enter expected callable, not: %r' % enter) + if not callable(exit): + raise TypeError('exit expected callable, not: %r' % exit) + reraise_visit = kwargs.pop('reraise_visit', True) + trace = kwargs.pop('trace', ()) + if trace is True: + trace = ('visit', 'enter', 'exit') + elif isinstance(trace, str): + trace = (trace,) + if not isinstance(trace, (tuple, list, set)): + raise TypeError('trace expected tuple of event names, not: %r' % trace) + trace_enter, trace_exit, trace_visit = 'enter' in trace, 'exit' in trace, 'visit' in trace + + if kwargs: + raise TypeError('unexpected keyword arguments: %r' % kwargs.keys()) + + path, registry, stack = (), {}, [(None, root)] + new_items_stack = [] + while stack: + key, value = stack.pop() + id_value = id(value) + if key is _REMAP_EXIT: + key, new_parent, old_parent = value + id_value = id(old_parent) + path, new_items = new_items_stack.pop() + if trace_exit: + print(' .. remap exit:', path, '-', key, '-', + old_parent, '-', new_parent, '-', new_items) + value = exit(path, key, old_parent, new_parent, new_items) + if trace_exit: + print(' .. remap exit result:', value) + registry[id_value] = value + if not new_items_stack: + continue + elif id_value in registry: + value = registry[id_value] + else: + if trace_enter: + print(' .. remap enter:', path, '-', key, '-', value) + res = enter(path, key, value) + if trace_enter: + print(' .. remap enter result:', res) + try: + new_parent, new_items = res + except TypeError: + # TODO: handle False? + raise TypeError('enter should return a tuple of (new_parent,' + ' items_iterator), not: %r' % res) + if new_items is not False: + # traverse unless False is explicitly passed + registry[id_value] = new_parent + new_items_stack.append((path, [])) + if value is not root: + path += (key,) + stack.append((_REMAP_EXIT, (key, new_parent, value))) + if new_items: + stack.extend(reversed(list(new_items))) + if trace_enter: + print(' .. remap stack size now:', len(stack)) + continue + if visit is _orig_default_visit: + # avoid function call overhead by inlining identity operation + visited_item = (key, value) + else: + try: + if trace_visit: + print(' .. remap visit:', path, '-', key, '-', value) + visited_item = visit(path, key, value) + except Exception: + if reraise_visit: + raise + visited_item = True + if visited_item is False: + if trace_visit: + print(' .. remap visit result: ') + continue # drop + elif visited_item is True: + visited_item = (key, value) + if trace_visit: + print(' .. remap visit result:', visited_item) + # TODO: typecheck? + # raise TypeError('expected (key, value) from visit(),' + # ' not: %r' % visited_item) + try: + new_items_stack[-1][1].append(visited_item) + except IndexError: + raise TypeError('expected remappable root, not: %r' % root) + return value + + +class PathAccessError(KeyError, IndexError, TypeError): + """An amalgamation of KeyError, IndexError, and TypeError, + representing what can occur when looking up a path in a nested + object. + """ + + def __init__(self, exc, seg, path): + self.exc = exc + self.seg = seg + self.path = path + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({self.exc!r}, {self.seg!r}, {self.path!r})' + + def __str__(self): + return ('could not access %r from path %r, got error: %r' + % (self.seg, self.path, self.exc)) + + +def get_path(root, path, default=_UNSET): + """Retrieve a value from a nested object via a tuple representing the + lookup path. + + >>> root = {'a': {'b': {'c': [[1], [2], [3]]}}} + >>> get_path(root, ('a', 'b', 'c', 2, 0)) + 3 + + The path tuple format is intentionally consistent with that of + :func:`remap`, but a single dotted string can also be passed. + + One of get_path's chief aims is improved error messaging. EAFP is + great, but the error messages are not. + + For instance, ``root['a']['b']['c'][2][1]`` gives back + ``IndexError: list index out of range`` + + What went out of range where? get_path currently raises + ``PathAccessError: could not access 2 from path ('a', 'b', 'c', 2, + 1), got error: IndexError('list index out of range',)``, a + subclass of IndexError and KeyError. + + You can also pass a default that covers the entire operation, + should the lookup fail at any level. + + Args: + root: The target nesting of dictionaries, lists, or other + objects supporting ``__getitem__``. + path (tuple): A sequence of strings and integers to be successively + looked up within *root*. A dot-separated (``a.b``) string may + also be passed. + default: The value to be returned should any + ``PathAccessError`` exceptions be raised. + """ + if isinstance(path, str): + path = path.split('.') + cur = root + try: + for seg in path: + try: + cur = cur[seg] + except (KeyError, IndexError) as exc: + raise PathAccessError(exc, seg, path) + except TypeError as exc: + # either string index in a list, or a parent that + # doesn't support indexing + try: + seg = int(seg) + cur = cur[seg] + except (ValueError, KeyError, IndexError, TypeError): + if not is_iterable(cur): + exc = TypeError('%r object is not indexable' + % type(cur).__name__) + raise PathAccessError(exc, seg, path) + except PathAccessError: + if default is _UNSET: + raise + return default + return cur + + +def research(root, query=lambda p, k, v: True, reraise=False, enter=default_enter): + """The :func:`research` function uses :func:`remap` to recurse over + any data nested in *root*, and find values which match a given + criterion, specified by the *query* callable. + + Results are returned as a list of ``(path, value)`` pairs. The + paths are tuples in the same format accepted by + :func:`get_path`. This can be useful for comparing values nested + in two or more different structures. + + Here's a simple example that finds all integers: + + >>> root = {'a': {'b': 1, 'c': (2, 'd', 3)}, 'e': None} + >>> res = research(root, query=lambda p, k, v: isinstance(v, int)) + >>> print(sorted(res)) + [(('a', 'b'), 1), (('a', 'c', 0), 2), (('a', 'c', 2), 3)] + + Note how *query* follows the same, familiar ``path, key, value`` + signature as the ``visit`` and ``enter`` functions on + :func:`remap`, and returns a :class:`bool`. + + Args: + root: The target object to search. Supports the same types of + objects as :func:`remap`, including :class:`list`, + :class:`tuple`, :class:`dict`, and :class:`set`. + query (callable): The function called on every object to + determine whether to include it in the search results. The + callable must accept three arguments, *path*, *key*, and + *value*, commonly abbreviated *p*, *k*, and *v*, same as + *enter* and *visit* from :func:`remap`. + reraise (bool): Whether to reraise exceptions raised by *query* + or to simply drop the result that caused the error. + + + With :func:`research` it's easy to inspect the details of a data + structure, like finding values that are at a certain depth (using + ``len(p)``) and much more. If more advanced functionality is + needed, check out the code and make your own :func:`remap` + wrapper, and consider `submitting a patch`_! + + .. _submitting a patch: https://github.com/mahmoud/boltons/pulls + """ + ret = [] + + if not callable(query): + raise TypeError('query expected callable, not: %r' % query) + + def _enter(path, key, value): + try: + if query(path, key, value): + ret.append((path + (key,), value)) + except Exception: + if reraise: + raise + return enter(path, key, value) + + remap(root, enter=_enter) + return ret + + +# TODO: recollect() +# TODO: refilter() +# TODO: reiter() + + +# GUID iterators: 10x faster and somewhat more compact than uuid. + +class GUIDerator: + """The GUIDerator is an iterator that yields a globally-unique + identifier (GUID) on every iteration. The GUIDs produced are + hexadecimal strings. + + Testing shows it to be around 12x faster than the uuid module. By + default it is also more compact, partly due to its default 96-bit + (24-hexdigit) length. 96 bits of randomness means that there is a + 1 in 2 ^ 32 chance of collision after 2 ^ 64 iterations. If more + or less uniqueness is desired, the *size* argument can be adjusted + accordingly. + + Args: + size (int): character length of the GUID, defaults to 24. Lengths + between 20 and 36 are considered valid. + + The GUIDerator has built-in fork protection that causes it to + detect a fork on next iteration and reseed accordingly. + + """ + + def __init__(self, size=24): + self.size = size + if size < 20 or size > 36: + raise ValueError('expected 20 < size <= 36') + import hashlib + self._sha1 = hashlib.sha1 + self.count = itertools.count() + self.reseed() + + def reseed(self): + import socket + self.pid = os.getpid() + self.salt = '-'.join([str(self.pid), + socket.gethostname() or '', + str(time.time()), + os.urandom(6).hex()]) + return + + def __iter__(self): + return self + + def __next__(self): + if os.getpid() != self.pid: + self.reseed() + target_bytes = (self.salt + str(next(self.count))).encode('utf8') + hash_text = self._sha1(target_bytes).hexdigest()[:self.size] + return hash_text + + next = __next__ + + +class SequentialGUIDerator(GUIDerator): + """Much like the standard GUIDerator, the SequentialGUIDerator is an + iterator that yields a globally-unique identifier (GUID) on every + iteration. The GUIDs produced are hexadecimal strings. + + The SequentialGUIDerator differs in that it picks a starting GUID + value and increments every iteration. This yields GUIDs which are + of course unique, but also ordered and lexicographically sortable. + + The SequentialGUIDerator is around 50% faster than the normal + GUIDerator, making it almost 20x as fast as the built-in uuid + module. By default it is also more compact, partly due to its + 96-bit (24-hexdigit) default length. 96 bits of randomness means that + there is a 1 in 2 ^ 32 chance of collision after 2 ^ 64 + iterations. If more or less uniqueness is desired, the *size* + argument can be adjusted accordingly. + + Args: + size (int): character length of the GUID, defaults to 24. + + Note that with SequentialGUIDerator there is a chance of GUIDs + growing larger than the size configured. The SequentialGUIDerator + has built-in fork protection that causes it to detect a fork on + next iteration and reseed accordingly. + + """ + + def reseed(self): + super().reseed() + start_str = self._sha1(self.salt.encode('utf8')).hexdigest() + self.start = int(start_str[:self.size], 16) + self.start |= (1 << ((self.size * 4) - 2)) + + def __next__(self): + if os.getpid() != self.pid: + self.reseed() + return '%x' % (next(self.count) + self.start) + + next = __next__ + + +guid_iter = GUIDerator() +seq_guid_iter = SequentialGUIDerator() + + +def soft_sorted(iterable, first=None, last=None, key=None, reverse=False): + """For when you care about the order of some elements, but not about + others. + + Use this to float to the top and/or sink to the bottom a specific + ordering, while sorting the rest of the elements according to + normal :func:`sorted` rules. + + >>> soft_sorted(['two', 'b', 'one', 'a'], first=['one', 'two']) + ['one', 'two', 'a', 'b'] + >>> soft_sorted(range(7), first=[6, 15], last=[2, 4], reverse=True) + [6, 5, 3, 1, 0, 2, 4] + >>> import string + >>> ''.join(soft_sorted(string.hexdigits, first='za1', last='b', key=str.lower)) + 'aA1023456789cCdDeEfFbB' + + Args: + iterable (list): A list or other iterable to sort. + first (list): A sequence to enforce for elements which should + appear at the beginning of the returned list. + last (list): A sequence to enforce for elements which should + appear at the end of the returned list. + key (callable): Callable used to generate a comparable key for + each item to be sorted, same as the key in + :func:`sorted`. Note that entries in *first* and *last* + should be the keys for the items. Defaults to + passthrough/the identity function. + reverse (bool): Whether or not elements not explicitly ordered + by *first* and *last* should be in reverse order or not. + + Returns a new list in sorted order. + """ + first = first or [] + last = last or [] + key = key or (lambda x: x) + seq = list(iterable) + other = [x for x in seq if not ( + (first and key(x) in first) or (last and key(x) in last))] + other.sort(key=key, reverse=reverse) + + if first: + first = sorted([x for x in seq if key(x) in first], + key=lambda x: first.index(key(x))) + if last: + last = sorted([x for x in seq if key(x) in last], + key=lambda x: last.index(key(x))) + return first + other + last + + +def untyped_sorted(iterable, key=None, reverse=False): + """A version of :func:`sorted` which will happily sort an iterable of + heterogeneous types and return a new list, similar to legacy Python's + behavior. + + >>> untyped_sorted(['abc', 2.0, 1, 2, 'def']) + [1, 2.0, 2, 'abc', 'def'] + + Note how mutually orderable types are sorted as expected, as in + the case of the integers and floats above. + + .. note:: + + Results may vary across Python versions and builds, but the + function will produce a sorted list, except in the case of + explicitly unorderable objects. + + """ + class _Wrapper: + slots = ('obj',) + + def __init__(self, obj): + self.obj = obj + + def __lt__(self, other): + obj = key(self.obj) if key is not None else self.obj + other = key(other.obj) if key is not None else other.obj + try: + ret = obj < other + except TypeError: + ret = ((type(obj).__name__, id(type(obj)), obj) + < (type(other).__name__, id(type(other)), other)) + return ret + + if key is not None and not callable(key): + raise TypeError('expected function or callable object for key, not: %r' + % key) + + return sorted(iterable, key=_Wrapper, reverse=reverse) + + +""" +May actually be faster to do an isinstance check for a str path + +$ python -m timeit -s "x = [1]" "x[0]" +10000000 loops, best of 3: 0.0207 usec per loop +$ python -m timeit -s "x = [1]" "try: x[0] \nexcept: pass" +10000000 loops, best of 3: 0.029 usec per loop +$ python -m timeit -s "x = [1]" "try: x[1] \nexcept: pass" +1000000 loops, best of 3: 0.315 usec per loop +# setting up try/except is fast, only around 0.01us +# actually triggering the exception takes almost 10x as long + +$ python -m timeit -s "x = [1]" "isinstance(x, basestring)" +10000000 loops, best of 3: 0.141 usec per loop +$ python -m timeit -s "x = [1]" "isinstance(x, str)" +10000000 loops, best of 3: 0.131 usec per loop +$ python -m timeit -s "x = [1]" "try: x.split('.')\n except: pass" +1000000 loops, best of 3: 0.443 usec per loop +$ python -m timeit -s "x = [1]" "try: x.split('.') \nexcept AttributeError: pass" +1000000 loops, best of 3: 0.544 usec per loop +""" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/jsonutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/jsonutils.py new file mode 100644 index 0000000000000000000000000000000000000000..bf61b03a3b1d43e534f268f6dec577781c53eab3 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/jsonutils.py @@ -0,0 +1,267 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""``jsonutils`` aims to provide various helpers for working with +JSON. Currently it focuses on providing a reliable and intuitive means +of working with `JSON Lines`_-formatted files. + +.. _JSON Lines: http://jsonlines.org/ + +""" + + +import io +import os +import json + + +DEFAULT_BLOCKSIZE = 4096 + + +__all__ = ['JSONLIterator', 'reverse_iter_lines'] + + +def reverse_iter_lines(file_obj, blocksize=DEFAULT_BLOCKSIZE, preseek=True, encoding=None): + """Returns an iterator over the lines from a file object, in + reverse order, i.e., last line first, first line last. Uses the + :meth:`file.seek` method of file objects, and is tested compatible with + :class:`file` objects, as well as :class:`StringIO.StringIO`. + + Args: + file_obj (file): An open file object. Note that + ``reverse_iter_lines`` mutably reads from the file and + other functions should not mutably interact with the file + object after being passed. Files can be opened in bytes or + text mode. + blocksize (int): The block size to pass to + :meth:`file.read()`. Warning: keep this a fairly large + multiple of 2, defaults to 4096. + preseek (bool): Tells the function whether or not to automatically + seek to the end of the file. Defaults to ``True``. + ``preseek=False`` is useful in cases when the + file cursor is already in position, either at the end of + the file or in the middle for relative reverse line + generation. + + """ + # This function is a bit of a pain because it attempts to be byte/text agnostic + try: + encoding = encoding or file_obj.encoding + except AttributeError: + # BytesIO + encoding = None + else: + encoding = 'utf-8' + + # need orig_obj to keep alive otherwise __del__ on the TextWrapper will close the file + orig_obj = file_obj + try: + file_obj = orig_obj.detach() + except (AttributeError, io.UnsupportedOperation): + pass + + empty_bytes, newline_bytes, empty_text = b'', b'\n', '' + + if preseek: + file_obj.seek(0, os.SEEK_END) + buff = empty_bytes + cur_pos = file_obj.tell() + while 0 < cur_pos: + read_size = min(blocksize, cur_pos) + cur_pos -= read_size + file_obj.seek(cur_pos, os.SEEK_SET) + cur = file_obj.read(read_size) + buff = cur + buff + lines = buff.splitlines() + + if len(lines) < 2 or lines[0] == empty_bytes: + continue + if buff[-1:] == newline_bytes: + yield empty_text if encoding else empty_bytes + for line in lines[:0:-1]: + yield line.decode(encoding) if encoding else line + buff = lines[0] + if buff: + yield buff.decode(encoding) if encoding else buff + + + +""" +TODO: allow passthroughs for: + +json.load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]]) +""" + + +class JSONLIterator: + """The ``JSONLIterator`` is used to iterate over JSON-encoded objects + stored in the `JSON Lines format`_ (one object per line). + + Most notably it has the ability to efficiently read from the + bottom of files, making it very effective for reading in simple + append-only JSONL use cases. It also has the ability to start from + anywhere in the file and ignore corrupted lines. + + Args: + file_obj (file): An open file object. + ignore_errors (bool): Whether to skip over lines that raise an error on + deserialization (:func:`json.loads`). + reverse (bool): Controls the direction of the iteration. + Defaults to ``False``. If set to ``True`` and *rel_seek* + is unset, seeks to the end of the file before iteration + begins. + rel_seek (float): Used to preseek the start position of + iteration. Set to 0.0 for the start of the file, 1.0 for the + end, and anything in between. + + .. _JSON Lines format: http://jsonlines.org/ + """ + def __init__(self, file_obj, + ignore_errors=False, reverse=False, rel_seek=None): + self._reverse = bool(reverse) + self._file_obj = file_obj + self.ignore_errors = ignore_errors + + if rel_seek is None: + if reverse: + rel_seek = 1.0 + elif not -1.0 < rel_seek < 1.0: + raise ValueError("'rel_seek' expected a float between" + " -1.0 and 1.0, not %r" % rel_seek) + elif rel_seek < 0: + rel_seek = 1.0 - rel_seek + self._rel_seek = rel_seek + self._blocksize = 4096 + if rel_seek is not None: + self._init_rel_seek() + if self._reverse: + self._line_iter = reverse_iter_lines(self._file_obj, + blocksize=self._blocksize, + preseek=False) + else: + self._line_iter = iter(self._file_obj) + + @property + def cur_byte_pos(self): + "A property representing where in the file the iterator is reading." + return self._file_obj.tell() + + def _align_to_newline(self): + "Aligns the file object's position to the next newline." + fo, bsize = self._file_obj, self._blocksize + cur, total_read = '', 0 + cur_pos = fo.tell() + while '\n' not in cur: + cur = fo.read(bsize) + total_read += bsize + try: + newline_offset = cur.index('\n') + total_read - bsize + except ValueError: + raise # TODO: seek to end? + fo.seek(cur_pos + newline_offset) + + def _init_rel_seek(self): + "Sets the file object's position to the relative location set above." + rs, fo = self._rel_seek, self._file_obj + if rs == 0.0: + fo.seek(0, os.SEEK_SET) + else: + fo.seek(0, os.SEEK_END) + size = fo.tell() + if rs == 1.0: + self._cur_pos = size + else: + target = int(size * rs) + fo.seek(target, os.SEEK_SET) + self._align_to_newline() + self._cur_pos = fo.tell() + + def __iter__(self): + return self + + def next(self): + """Yields one :class:`dict` loaded with :func:`json.loads`, advancing + the file object by one line. Raises :exc:`StopIteration` upon reaching + the end of the file (or beginning, if ``reverse`` was set to ``True``. + """ + while 1: + line = next(self._line_iter).lstrip() + if not line: + continue + try: + obj = json.loads(line) + except Exception: + if not self.ignore_errors: + raise + continue + return obj + + __next__ = next + + +if __name__ == '__main__': + def _main(): + import sys + if '-h' in sys.argv or '--help' in sys.argv: + print('loads one or more JSON Line files for basic validation.') + return + verbose = False + if '-v' in sys.argv or '--verbose' in sys.argv: + verbose = True + file_count, obj_count = 0, 0 + filenames = sys.argv[1:] + for filename in filenames: + if filename in ('-h', '--help', '-v', '--verbose'): + continue + file_count += 1 + with open(filename, 'rb') as file_obj: + iterator = JSONLIterator(file_obj) + cur_obj_count = 0 + while 1: + try: + next(iterator) + except ValueError: + print('error reading object #%s around byte %s in %s' + % (cur_obj_count + 1, iterator.cur_byte_pos, filename)) + return + except StopIteration: + break + obj_count += 1 + cur_obj_count += 1 + if verbose and obj_count and obj_count % 100 == 0: + sys.stdout.write('.') + if obj_count % 10000: + sys.stdout.write('%s\n' % obj_count) + if verbose: + print('files checked: %s' % file_count) + print('objects loaded: %s' % obj_count) + return + + _main() diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/listutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/listutils.py new file mode 100644 index 0000000000000000000000000000000000000000..06b9da28f74488d45b98a8f949d7e34cfd930160 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/listutils.py @@ -0,0 +1,350 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's builtin :class:`list` is a very fast and efficient +sequence type, but it could be better for certain access patterns, +such as non-sequential insertion into a large lists. ``listutils`` +provides a pure-Python solution to this problem. + +For utilities for working with iterables and lists, check out +:mod:`iterutils`. For the a :class:`list`-based version of +:class:`collections.namedtuple`, check out :mod:`namedutils`. +""" + + +import operator +from math import log as math_log +from itertools import chain, islice + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + +# TODO: expose splaylist? +__all__ = ['BList', 'BarrelList'] + + +# TODO: comparators +# TODO: keep track of list lengths and bisect to the right list for +# faster getitem (and slightly slower setitem and delitem ops) + +class BarrelList(list): + """The ``BarrelList`` is a :class:`list` subtype backed by many + dynamically-scaled sublists, to provide better scaling and random + insertion/deletion characteristics. It is a subtype of the builtin + :class:`list` and has an identical API, supporting indexing, + slicing, sorting, etc. If application requirements call for + something more performant, consider the `blist module available on + PyPI`_. + + The name comes by way of Kurt Rose, who said it reminded him of + barrel shifters. Not sure how, but it's BList-like, so the name + stuck. BList is of course a reference to `B-trees`_. + + Args: + iterable: An optional iterable of initial values for the list. + + >>> blist = BList(range(100000)) + >>> blist.pop(50000) + 50000 + >>> len(blist) + 99999 + >>> len(blist.lists) # how many underlying lists + 8 + >>> slice_idx = blist.lists[0][-1] + >>> blist[slice_idx:slice_idx + 2] + BarrelList([11637, 11638]) + + Slicing is supported and works just fine across list borders, + returning another instance of the BarrelList. + + .. _blist module available on PyPI: https://pypi.python.org/pypi/blist + .. _B-trees: https://en.wikipedia.org/wiki/B-tree + + """ + + _size_factor = 1520 + "This size factor is the result of tuning using the tune() function below." + + def __init__(self, iterable=None): + self.lists = [[]] + if iterable: + self.extend(iterable) + + @property + def _cur_size_limit(self): + len_self, size_factor = len(self), self._size_factor + return int(round(size_factor * math_log(len_self + 2, 2))) + + def _translate_index(self, index): + if index < 0: + index += len(self) + rel_idx, lists = index, self.lists + for list_idx in range(len(lists)): + len_list = len(lists[list_idx]) + if rel_idx < len_list: + break + rel_idx -= len_list + if rel_idx < 0: + return None, None + return list_idx, rel_idx + + def _balance_list(self, list_idx): + if list_idx < 0: + list_idx += len(self.lists) + cur_list, len_self = self.lists[list_idx], len(self) + size_limit = self._cur_size_limit + if len(cur_list) > size_limit: + half_limit = size_limit // 2 + while len(cur_list) > half_limit: + next_list_idx = list_idx + 1 + self.lists.insert(next_list_idx, cur_list[-half_limit:]) + del cur_list[-half_limit:] + return True + return False + + def insert(self, index, item): + if len(self.lists) == 1: + self.lists[0].insert(index, item) + self._balance_list(0) + else: + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + self.lists[list_idx].insert(rel_idx, item) + self._balance_list(list_idx) + return + + def append(self, item): + self.lists[-1].append(item) + + def extend(self, iterable): + self.lists[-1].extend(iterable) + + def pop(self, *a): + lists = self.lists + if len(lists) == 1 and not a: + return self.lists[0].pop() + index = a and a[0] + if index == () or index is None or index == -1: + ret = lists[-1].pop() + if len(lists) > 1 and not lists[-1]: + lists.pop() + else: + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + ret = lists[list_idx].pop(rel_idx) + self._balance_list(list_idx) + return ret + + def iter_slice(self, start, stop, step=None): + iterable = self # TODO: optimization opportunities abound + # start_list_idx, stop_list_idx = 0, len(self.lists) + if start is None: + start = 0 + if stop is None: + stop = len(self) + if step is not None and step < 0: + step = -step + start, stop = -start, -stop - 1 + iterable = reversed(self) + if start < 0: + start += len(self) + # start_list_idx, start_rel_idx = self._translate_index(start) + if stop < 0: + stop += len(self) + # stop_list_idx, stop_rel_idx = self._translate_index(stop) + return islice(iterable, start, stop, step) + + def del_slice(self, start, stop, step=None): + if step is not None and abs(step) > 1: # punt + new_list = chain(self.iter_slice(0, start, step), + self.iter_slice(stop, None, step)) + self.lists[0][:] = new_list + self._balance_list(0) + return + if start is None: + start = 0 + if stop is None: + stop = len(self) + start_list_idx, start_rel_idx = self._translate_index(start) + stop_list_idx, stop_rel_idx = self._translate_index(stop) + if start_list_idx is None: + raise IndexError() + if stop_list_idx is None: + raise IndexError() + + if start_list_idx == stop_list_idx: + del self.lists[start_list_idx][start_rel_idx:stop_rel_idx] + elif start_list_idx < stop_list_idx: + del self.lists[start_list_idx + 1:stop_list_idx] + del self.lists[start_list_idx][start_rel_idx:] + del self.lists[stop_list_idx][:stop_rel_idx] + else: + assert False, ('start list index should never translate to' + ' greater than stop list index') + + __delslice__ = del_slice + + @classmethod + def from_iterable(cls, it): + return cls(it) + + def __iter__(self): + return chain.from_iterable(self.lists) + + def __reversed__(self): + return chain.from_iterable(reversed(l) for l in reversed(self.lists)) + + def __len__(self): + return sum([len(l) for l in self.lists]) + + def __contains__(self, item): + for cur in self.lists: + if item in cur: + return True + return False + + def __getitem__(self, index): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + iter_slice = self.iter_slice(start, stop, step) + ret = self.from_iterable(iter_slice) + return ret + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + return self.lists[list_idx][rel_idx] + + def __delitem__(self, index): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + self.del_slice(start, stop, step) + return + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + del self.lists[list_idx][rel_idx] + + def __setitem__(self, index, item): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + if len(self.lists) == 1: + self.lists[0][index] = item + else: + tmp = list(self) + tmp[index] = item + self.lists[:] = [tmp] + self._balance_list(0) + return + list_idx, rel_idx = self._translate_index(index) + if list_idx is None: + raise IndexError() + self.lists[list_idx][rel_idx] = item + + def __getslice__(self, start, stop): + iter_slice = self.iter_slice(start, stop, 1) + return self.from_iterable(iter_slice) + + def __setslice__(self, start, stop, sequence): + if len(self.lists) == 1: + self.lists[0][start:stop] = sequence + else: + tmp = list(self) + tmp[start:stop] = sequence + self.lists[:] = [tmp] + self._balance_list(0) + return + + def __repr__(self): + return f'{self.__class__.__name__}({list(self)!r})' + + def sort(self): + # poor pythonist's mergesort, it's faster than sorted(self) + # when the lists' average length is greater than 512. + if len(self.lists) == 1: + self.lists[0].sort() + else: + for li in self.lists: + li.sort() + tmp_sorted = sorted(chain.from_iterable(self.lists)) + del self.lists[:] + self.lists[0] = tmp_sorted + self._balance_list(0) + + def reverse(self): + for cur in self.lists: + cur.reverse() + self.lists.reverse() + + def count(self, item): + return sum([cur.count(item) for cur in self.lists]) + + def index(self, item): + len_accum = 0 + for cur in self.lists: + try: + rel_idx = cur.index(item) + return len_accum + rel_idx + except ValueError: + len_accum += len(cur) + raise ValueError(f'{item!r} is not in list') + + +BList = BarrelList + + +class SplayList(list): + """Like a `splay tree`_, the SplayList facilitates moving higher + utility items closer to the front of the list for faster access. + + .. _splay tree: https://en.wikipedia.org/wiki/Splay_tree + """ + + def shift(self, item_index, dest_index=0): + if item_index == dest_index: + return + item = self.pop(item_index) + self.insert(dest_index, item) + + def swap(self, item_index, dest_index): + self[dest_index], self[item_index] = self[item_index], self[dest_index] diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/mathutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/mathutils.py new file mode 100644 index 0000000000000000000000000000000000000000..1367a5413bbb9c6f3754da50c33b073641ac40df --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/mathutils.py @@ -0,0 +1,249 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""This module provides useful math functions on top of Python's +built-in :mod:`math` module. +""" + +from math import ceil as _ceil, floor as _floor +import bisect +import binascii + + +def clamp(x, lower=float('-inf'), upper=float('inf')): + """Limit a value to a given range. + + Args: + x (int or float): Number to be clamped. + lower (int or float): Minimum value for x. + upper (int or float): Maximum value for x. + + The returned value is guaranteed to be between *lower* and + *upper*. Integers, floats, and other comparable types can be + mixed. + + >>> clamp(1.0, 0, 5) + 1.0 + >>> clamp(-1.0, 0, 5) + 0 + >>> clamp(101.0, 0, 5) + 5 + >>> clamp(123, upper=5) + 5 + + Similar to `numpy's clip`_ function. + + .. _numpy's clip: http://docs.scipy.org/doc/numpy/reference/generated/numpy.clip.html + + """ + if upper < lower: + raise ValueError('expected upper bound (%r) >= lower bound (%r)' + % (upper, lower)) + return min(max(x, lower), upper) + + +def ceil(x, options=None): + """Return the ceiling of *x*. If *options* is set, return the smallest + integer or float from *options* that is greater than or equal to + *x*. + + Args: + x (int or float): Number to be tested. + options (iterable): Optional iterable of arbitrary numbers + (ints or floats). + + >>> VALID_CABLE_CSA = [1.5, 2.5, 4, 6, 10, 25, 35, 50] + >>> ceil(3.5, options=VALID_CABLE_CSA) + 4 + >>> ceil(4, options=VALID_CABLE_CSA) + 4 + """ + if options is None: + return _ceil(x) + options = sorted(options) + i = bisect.bisect_left(options, x) + if i == len(options): + raise ValueError("no ceil options greater than or equal to: %r" % x) + return options[i] + + +def floor(x, options=None): + """Return the floor of *x*. If *options* is set, return the largest + integer or float from *options* that is less than or equal to + *x*. + + Args: + x (int or float): Number to be tested. + options (iterable): Optional iterable of arbitrary numbers + (ints or floats). + + >>> VALID_CABLE_CSA = [1.5, 2.5, 4, 6, 10, 25, 35, 50] + >>> floor(3.5, options=VALID_CABLE_CSA) + 2.5 + >>> floor(2.5, options=VALID_CABLE_CSA) + 2.5 + + """ + if options is None: + return _floor(x) + options = sorted(options) + + i = bisect.bisect_right(options, x) + if not i: + raise ValueError("no floor options less than or equal to: %r" % x) + return options[i - 1] + + +class Bits: + ''' + An immutable bit-string or bit-array object. + Provides list-like access to bits as bools, + as well as bitwise masking and shifting operators. + Bits also make it easy to convert between many + different useful representations: + + * bytes -- good for serializing raw binary data + * int -- good for incrementing (e.g. to try all possible values) + * list of bools -- good for iterating over or treating as flags + * hex/bin string -- good for human readability + + ''' + __slots__ = ('val', 'len') + + def __init__(self, val=0, len_=None): + if type(val) is not int: + if type(val) is list: + val = ''.join(['1' if e else '0' for e in val]) + if type(val) is bytes: + val = val.decode('ascii') + if type(val) is str: + if len_ is None: + len_ = len(val) + if val.startswith('0x'): + len_ = (len_ - 2) * 4 + if val.startswith('0x'): + val = int(val, 16) + else: + if val: + val = int(val, 2) + else: + val = 0 + if type(val) is not int: + raise TypeError(f'initialized with bad type: {type(val).__name__}') + if val < 0: + raise ValueError('Bits cannot represent negative values') + if len_ is None: + len_ = len(f'{val:b}') + if val > 2 ** len_: + raise ValueError(f'value {val} cannot be represented with {len_} bits') + self.val = val # data is stored internally as integer + self.len = len_ + + def __getitem__(self, k): + if type(k) is slice: + return Bits(self.as_bin()[k]) + if type(k) is int: + if k >= self.len: + raise IndexError(k) + return bool((1 << (self.len - k - 1)) & self.val) + raise TypeError(type(k)) + + def __len__(self): + return self.len + + def __eq__(self, other): + if type(self) is not type(other): + return NotImplemented + return self.val == other.val and self.len == other.len + + def __or__(self, other): + if type(self) is not type(other): + return NotImplemented + return Bits(self.val | other.val, max(self.len, other.len)) + + def __and__(self, other): + if type(self) is not type(other): + return NotImplemented + return Bits(self.val & other.val, max(self.len, other.len)) + + def __lshift__(self, other): + return Bits(self.val << other, self.len + other) + + def __rshift__(self, other): + return Bits(self.val >> other, self.len - other) + + def __hash__(self): + return hash(self.val) + + def as_list(self): + return [c == '1' for c in self.as_bin()] + + def as_bin(self): + return f'{{0:0{self.len}b}}'.format(self.val) + + def as_hex(self): + # make template to pad out to number of bytes necessary to represent bits + tmpl = f'%0{2 * (self.len // 8 + ((self.len % 8) != 0))}X' + ret = tmpl % self.val + return ret + + def as_int(self): + return self.val + + def as_bytes(self): + return binascii.unhexlify(self.as_hex()) + + @classmethod + def from_list(cls, list_): + return cls(list_) + + @classmethod + def from_bin(cls, bin): + return cls(bin) + + @classmethod + def from_hex(cls, hex): + if isinstance(hex, bytes): + hex = hex.decode('ascii') + if not hex.startswith('0x'): + hex = '0x' + hex + return cls(hex) + + @classmethod + def from_int(cls, int_, len_=None): + return cls(int_, len_) + + @classmethod + def from_bytes(cls, bytes_): + return cls.from_hex(binascii.hexlify(bytes_)) + + def __repr__(self): + cn = self.__class__.__name__ + return f"{cn}('{self.as_bin()}')" diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/mboxutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/mboxutils.py new file mode 100644 index 0000000000000000000000000000000000000000..299d105955a2f303190f2e52b75d8e81b590852c --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/mboxutils.py @@ -0,0 +1,150 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Useful utilities for working with the `mbox`_-formatted +mailboxes. Credit to Mark Williams for these. + +.. _mbox: https://en.wikipedia.org/wiki/Mbox +""" + +import mailbox +import tempfile + + +DEFAULT_MAXMEM = 4 * 1024 * 1024 # 4MB + + +class mbox_readonlydir(mailbox.mbox): + """A subclass of :class:`mailbox.mbox` suitable for use with mboxs + insides a read-only mail directory, e.g., ``/var/mail``. Otherwise + the API is exactly the same as the built-in mbox. + + Deletes messages via truncation, in the manner of `Heirloom mailx`_. + + Args: + path (str): Path to the mbox file. + factory (type): Message type (defaults to :class:`rfc822.Message`) + create (bool): Create mailbox if it does not exist. (defaults + to ``True``) + maxmem (int): Specifies, in bytes, the largest sized mailbox + to attempt to copy into memory. Larger mailboxes + will be copied incrementally which is more + hazardous. (defaults to 4MB) + + .. note:: + + Because this truncates and rewrites parts of the mbox file, + this class can corrupt your mailbox. Only use this if you know + the built-in :class:`mailbox.mbox` does not work for your use + case. + + .. _Heirloom mailx: http://heirloom.sourceforge.net/mailx.html + """ + def __init__(self, path, factory=None, create=True, maxmem=1024 * 1024): + mailbox.mbox.__init__(self, path, factory, create) + self.maxmem = maxmem + + def flush(self): + """Write any pending changes to disk. This is called on mailbox + close and is usually not called explicitly. + + .. note:: + + This deletes messages via truncation. Interruptions may + corrupt your mailbox. + """ + + # Appending and basic assertions are the same as in mailbox.mbox.flush. + if not self._pending: + if self._pending_sync: + # Messages have only been added, so syncing the file + # is enough. + mailbox._sync_flush(self._file) + self._pending_sync = False + return + + # In order to be writing anything out at all, self._toc must + # already have been generated (and presumably has been modified + # by adding or deleting an item). + assert self._toc is not None + + # Check length of self._file; if it's changed, some other process + # has modified the mailbox since we scanned it. + self._file.seek(0, 2) + cur_len = self._file.tell() + if cur_len != self._file_length: + raise mailbox.ExternalClashError('Size of mailbox file changed ' + '(expected %i, found %i)' % + (self._file_length, cur_len)) + + self._file.seek(0) + + # Truncation logic begins here. Mostly the same except we + # can use tempfile because we're not doing rename(2). + with tempfile.TemporaryFile() as new_file: + new_toc = {} + self._pre_mailbox_hook(new_file) + for key in sorted(self._toc.keys()): + start, stop = self._toc[key] + self._file.seek(start) + self._pre_message_hook(new_file) + new_start = new_file.tell() + while True: + buffer = self._file.read(min(4096, + stop - self._file.tell())) + if buffer == '': + break + new_file.write(buffer) + new_toc[key] = (new_start, new_file.tell()) + self._post_message_hook(new_file) + self._file_length = new_file.tell() + + self._file.seek(0) + new_file.seek(0) + + # Copy back our messages + if self._file_length <= self.maxmem: + self._file.write(new_file.read()) + else: + while True: + buffer = new_file.read(4096) + if not buffer: + break + self._file.write(buffer) + + # Delete the rest. + self._file.truncate() + + # Same wrap up. + self._toc = new_toc + self._pending = False + self._pending_sync = False + if self._locked: + mailbox._lock_file(self._file, dotlock=False) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/namedutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/namedutils.py new file mode 100644 index 0000000000000000000000000000000000000000..0311f81468b69822335e0c3299c431a28d17aa9e --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/namedutils.py @@ -0,0 +1,385 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""\ +The ``namedutils`` module defines two lightweight container types: +:class:`namedtuple` and :class:`namedlist`. Both are subtypes of built-in +sequence types, which are very fast and efficient. They simply add +named attribute accessors for specific indexes within themselves. + +The :class:`namedtuple` is identical to the built-in +:class:`collections.namedtuple`, with a couple of enhancements, +including a ``__repr__`` more suitable to inheritance. + +The :class:`namedlist` is the mutable counterpart to the +:class:`namedtuple`, and is much faster and lighter-weight than +full-blown :class:`object`. Consider this if you're implementing nodes +in a tree, graph, or other mutable data structure. If you want an even +skinnier approach, you'll probably have to look to C. +""" + + +import sys as _sys +from collections import OrderedDict +from keyword import iskeyword as _iskeyword +from operator import itemgetter as _itemgetter + + +__all__ = ['namedlist', 'namedtuple'] + +# Tiny templates + +_repr_tmpl = '{name}=%r' + +_imm_field_tmpl = '''\ + {name} = _property(_itemgetter({index:d}), doc='Alias for field {index:d}') +''' + +_m_field_tmpl = '''\ + {name} = _property(_itemgetter({index:d}), _itemsetter({index:d}), doc='Alias for field {index:d}') +''' + +################################################################# +### namedtuple +################################################################# + +_namedtuple_tmpl = '''\ +class {typename}(tuple): + '{typename}({arg_list})' + + __slots__ = () + + _fields = {field_names!r} + + def __new__(_cls, {arg_list}): # TODO: tweak sig to make more extensible + 'Create new instance of {typename}({arg_list})' + return _tuple.__new__(_cls, ({arg_list})) + + @classmethod + def _make(cls, iterable, new=_tuple.__new__, len=len): + 'Make a new {typename} object from a sequence or iterable' + result = new(cls, iterable) + if len(result) != {num_fields:d}: + raise TypeError('Expected {num_fields:d}' + ' arguments, got %d' % len(result)) + return result + + def __repr__(self): + 'Return a nicely formatted representation string' + tmpl = self.__class__.__name__ + '({repr_fmt})' + return tmpl % self + + def _asdict(self): + 'Return a new OrderedDict which maps field names to their values' + return OrderedDict(zip(self._fields, self)) + + def _replace(_self, **kwds): + 'Return a new {typename} object replacing field(s) with new values' + result = _self._make(map(kwds.pop, {field_names!r}, _self)) + if kwds: + raise ValueError('Got unexpected field names: %r' % kwds.keys()) + return result + + def __getnewargs__(self): + 'Return self as a plain tuple. Used by copy and pickle.' + return tuple(self) + + __dict__ = _property(_asdict) + + def __getstate__(self): + 'Exclude the OrderedDict from pickling' # wat + pass + +{field_defs} +''' + +def namedtuple(typename, field_names, verbose=False, rename=False): + """Returns a new subclass of tuple with named fields. + + >>> Point = namedtuple('Point', ['x', 'y']) + >>> Point.__doc__ # docstring for the new class + 'Point(x, y)' + >>> p = Point(11, y=22) # instantiate with pos args or keywords + >>> p[0] + p[1] # indexable like a plain tuple + 33 + >>> x, y = p # unpack like a regular tuple + >>> x, y + (11, 22) + >>> p.x + p.y # fields also accessible by name + 33 + >>> d = p._asdict() # convert to a dictionary + >>> d['x'] + 11 + >>> Point(**d) # convert from a dictionary + Point(x=11, y=22) + >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields + Point(x=100, y=22) + """ + + # Validate the field names. At the user's option, either generate an error + # message or automatically replace the field name with a valid name. + if isinstance(field_names, str): + field_names = field_names.replace(',', ' ').split() + field_names = [str(x) for x in field_names] + if rename: + seen = set() + for index, name in enumerate(field_names): + if (not all(c.isalnum() or c == '_' for c in name) + or _iskeyword(name) + or not name + or name[0].isdigit() + or name.startswith('_') + or name in seen): + field_names[index] = '_%d' % index + seen.add(name) + for name in [typename] + field_names: + if not all(c.isalnum() or c == '_' for c in name): + raise ValueError('Type names and field names can only contain ' + 'alphanumeric characters and underscores: %r' + % name) + if _iskeyword(name): + raise ValueError('Type names and field names cannot be a ' + 'keyword: %r' % name) + if name[0].isdigit(): + raise ValueError('Type names and field names cannot start with ' + 'a number: %r' % name) + seen = set() + for name in field_names: + if name.startswith('_') and not rename: + raise ValueError('Field names cannot start with an underscore: ' + '%r' % name) + if name in seen: + raise ValueError('Encountered duplicate field name: %r' % name) + seen.add(name) + + # Fill-in the class template + fmt_kw = {'typename': typename} + fmt_kw['field_names'] = tuple(field_names) + fmt_kw['num_fields'] = len(field_names) + fmt_kw['arg_list'] = repr(tuple(field_names)).replace("'", "")[1:-1] + fmt_kw['repr_fmt'] = ', '.join(_repr_tmpl.format(name=name) + for name in field_names) + fmt_kw['field_defs'] = '\n'.join(_imm_field_tmpl.format(index=index, name=name) + for index, name in enumerate(field_names)) + class_definition = _namedtuple_tmpl.format(**fmt_kw) + + if verbose: + print(class_definition) + + # Execute the template string in a temporary namespace and support + # tracing utilities by setting a value for frame.f_globals['__name__'] + namespace = dict(_itemgetter=_itemgetter, + __name__='namedtuple_%s' % typename, + OrderedDict=OrderedDict, + _property=property, + _tuple=tuple) + try: + exec(class_definition, namespace) + except SyntaxError as e: + raise SyntaxError(e.msg + ':\n' + class_definition) + result = namespace[typename] + + # For pickling to work, the __module__ variable needs to be set to the frame + # where the named tuple is created. Bypass this step in environments where + # sys._getframe is not defined (Jython for example) or sys._getframe is not + # defined for arguments greater than 0 (IronPython). + try: + frame = _sys._getframe(1) + result.__module__ = frame.f_globals.get('__name__', '__main__') + except (AttributeError, ValueError): + pass + + return result + + +################################################################# +### namedlist +################################################################# + +_namedlist_tmpl = '''\ +class {typename}(list): + '{typename}({arg_list})' + + __slots__ = () + + _fields = {field_names!r} + + def __new__(_cls, {arg_list}): # TODO: tweak sig to make more extensible + 'Create new instance of {typename}({arg_list})' + return _list.__new__(_cls, ({arg_list})) + + def __init__(self, {arg_list}): # tuple didn't need this but list does + return _list.__init__(self, ({arg_list})) + + @classmethod + def _make(cls, iterable, new=_list, len=len): + 'Make a new {typename} object from a sequence or iterable' + # why did this function exist? why not just star the + # iterable like below? + result = cls(*iterable) + if len(result) != {num_fields:d}: + raise TypeError('Expected {num_fields:d} arguments,' + ' got %d' % len(result)) + return result + + def __repr__(self): + 'Return a nicely formatted representation string' + tmpl = self.__class__.__name__ + '({repr_fmt})' + return tmpl % tuple(self) + + def _asdict(self): + 'Return a new OrderedDict which maps field names to their values' + return OrderedDict(zip(self._fields, self)) + + def _replace(_self, **kwds): + 'Return a new {typename} object replacing field(s) with new values' + result = _self._make(map(kwds.pop, {field_names!r}, _self)) + if kwds: + raise ValueError('Got unexpected field names: %r' % kwds.keys()) + return result + + def __getnewargs__(self): + 'Return self as a plain list. Used by copy and pickle.' + return tuple(self) + + __dict__ = _property(_asdict) + + def __getstate__(self): + 'Exclude the OrderedDict from pickling' # wat + pass + +{field_defs} +''' + + +def namedlist(typename, field_names, verbose=False, rename=False): + """Returns a new subclass of list with named fields. + + >>> Point = namedlist('Point', ['x', 'y']) + >>> Point.__doc__ # docstring for the new class + 'Point(x, y)' + >>> p = Point(11, y=22) # instantiate with pos args or keywords + >>> p[0] + p[1] # indexable like a plain list + 33 + >>> x, y = p # unpack like a regular list + >>> x, y + (11, 22) + >>> p.x + p.y # fields also accessible by name + 33 + >>> d = p._asdict() # convert to a dictionary + >>> d['x'] + 11 + >>> Point(**d) # convert from a dictionary + Point(x=11, y=22) + >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields + Point(x=100, y=22) + """ + + # Validate the field names. At the user's option, either generate an error + # message or automatically replace the field name with a valid name. + if isinstance(field_names, str): + field_names = field_names.replace(',', ' ').split() + field_names = [str(x) for x in field_names] + if rename: + seen = set() + for index, name in enumerate(field_names): + if (not all(c.isalnum() or c == '_' for c in name) + or _iskeyword(name) + or not name + or name[0].isdigit() + or name.startswith('_') + or name in seen): + field_names[index] = '_%d' % index + seen.add(name) + for name in [typename] + field_names: + if not all(c.isalnum() or c == '_' for c in name): + raise ValueError('Type names and field names can only contain ' + 'alphanumeric characters and underscores: %r' + % name) + if _iskeyword(name): + raise ValueError('Type names and field names cannot be a ' + 'keyword: %r' % name) + if name[0].isdigit(): + raise ValueError('Type names and field names cannot start with ' + 'a number: %r' % name) + seen = set() + for name in field_names: + if name.startswith('_') and not rename: + raise ValueError('Field names cannot start with an underscore: ' + '%r' % name) + if name in seen: + raise ValueError('Encountered duplicate field name: %r' % name) + seen.add(name) + + # Fill-in the class template + fmt_kw = {'typename': typename} + fmt_kw['field_names'] = tuple(field_names) + fmt_kw['num_fields'] = len(field_names) + fmt_kw['arg_list'] = repr(tuple(field_names)).replace("'", "")[1:-1] + fmt_kw['repr_fmt'] = ', '.join(_repr_tmpl.format(name=name) + for name in field_names) + fmt_kw['field_defs'] = '\n'.join(_m_field_tmpl.format(index=index, name=name) + for index, name in enumerate(field_names)) + class_definition = _namedlist_tmpl.format(**fmt_kw) + + if verbose: + print(class_definition) + + def _itemsetter(key): + def _itemsetter(obj, value): + obj[key] = value + return _itemsetter + + # Execute the template string in a temporary namespace and support + # tracing utilities by setting a value for frame.f_globals['__name__'] + namespace = dict(_itemgetter=_itemgetter, + _itemsetter=_itemsetter, + __name__='namedlist_%s' % typename, + OrderedDict=OrderedDict, + _property=property, + _list=list) + try: + exec(class_definition, namespace) + except SyntaxError as e: + raise SyntaxError(e.msg + ':\n' + class_definition) + result = namespace[typename] + + # For pickling to work, the __module__ variable needs to be set to + # the frame where the named list is created. Bypass this step in + # environments where sys._getframe is not defined (Jython for + # example) or sys._getframe is not defined for arguments greater + # than 0 (IronPython). + try: + frame = _sys._getframe(1) + result.__module__ = frame.f_globals.get('__name__', '__main__') + except (AttributeError, ValueError): + pass + + return result diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/pathutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/pathutils.py new file mode 100644 index 0000000000000000000000000000000000000000..a8cb2602f31b5920c67c03027684b01c22bf371c --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/pathutils.py @@ -0,0 +1,183 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" +Functions for working with filesystem paths. + +The :func:`expandpath` function expands the tilde to $HOME and environment +variables to their values. + +The :func:`augpath` function creates variants of an existing path without +having to spend multiple lines of code splitting it up and stitching it back +together. + +The :func:`shrinkuser` function replaces your home directory with a tilde. +""" + +from os.path import (expanduser, expandvars, join, normpath, split, splitext) +import os + + +__all__ = [ + 'augpath', 'shrinkuser', 'expandpath', +] + + +def augpath(path, suffix='', prefix='', ext=None, base=None, dpath=None, + multidot=False): + """ + Augment a path by modifying its components. + + Creates a new path with a different extension, basename, directory, prefix, + and/or suffix. + + A prefix is inserted before the basename. A suffix is inserted + between the basename and the extension. The basename and extension can be + replaced with a new one. Essentially a path is broken down into components + (dpath, base, ext), and then recombined as (dpath, prefix, base, suffix, + ext) after replacing any specified component. + + Args: + path (str | PathLike): a path to augment + suffix (str, default=''): placed between the basename and extension + prefix (str, default=''): placed in front of the basename + ext (str, default=None): if specified, replaces the extension + base (str, default=None): if specified, replaces the basename without + extension + dpath (str | PathLike, default=None): if specified, replaces the + directory + multidot (bool, default=False): Allows extensions to contain multiple + dots. Specifically, if False, everything after the last dot in the + basename is the extension. If True, everything after the first dot + in the basename is the extension. + + Returns: + str: augmented path + + Example: + >>> path = 'foo.bar' + >>> suffix = '_suff' + >>> prefix = 'pref_' + >>> ext = '.baz' + >>> newpath = augpath(path, suffix, prefix, ext=ext, base='bar') + >>> print('newpath = %s' % (newpath,)) + newpath = pref_bar_suff.baz + + Example: + >>> augpath('foo.bar') + 'foo.bar' + >>> augpath('foo.bar', ext='.BAZ') + 'foo.BAZ' + >>> augpath('foo.bar', suffix='_') + 'foo_.bar' + >>> augpath('foo.bar', prefix='_') + '_foo.bar' + >>> augpath('foo.bar', base='baz') + 'baz.bar' + >>> augpath('foo.tar.gz', ext='.zip', multidot=True) + 'foo.zip' + >>> augpath('foo.tar.gz', ext='.zip', multidot=False) + 'foo.tar.zip' + >>> augpath('foo.tar.gz', suffix='_new', multidot=True) + 'foo_new.tar.gz' + """ + # Breakup path + orig_dpath, fname = split(path) + if multidot: + # The first dot defines the extension + parts = fname.split('.', 1) + orig_base = parts[0] + orig_ext = '' if len(parts) == 1 else '.' + parts[1] + else: + # The last dot defines the extension + orig_base, orig_ext = splitext(fname) + # Replace parts with specified augmentations + if dpath is None: + dpath = orig_dpath + if ext is None: + ext = orig_ext + if base is None: + base = orig_base + # Recombine into new path + new_fname = ''.join((prefix, base, suffix, ext)) + newpath = join(dpath, new_fname) + return newpath + + +def shrinkuser(path, home='~'): + """ + Inverse of :func:`os.path.expanduser`. + + Args: + path (str | PathLike): path in system file structure + home (str, default='~'): symbol used to replace the home path. + Defaults to '~', but you might want to use '$HOME' or + '%USERPROFILE%' instead. + + Returns: + str: path: shortened path replacing the home directory with a tilde + + Example: + >>> path = expanduser('~') + >>> assert path != '~' + >>> assert shrinkuser(path) == '~' + >>> assert shrinkuser(path + '1') == path + '1' + >>> assert shrinkuser(path + '/1') == join('~', '1') + >>> assert shrinkuser(path + '/1', '$HOME') == join('$HOME', '1') + """ + path = normpath(path) + userhome_dpath = expanduser('~') + if path.startswith(userhome_dpath): + if len(path) == len(userhome_dpath): + path = home + elif path[len(userhome_dpath)] == os.path.sep: + path = home + path[len(userhome_dpath):] + return path + + +def expandpath(path): + """ + Shell-like expansion of environment variables and tilde home directory. + + Args: + path (str | PathLike): the path to expand + + Returns: + str : expanded path + + Example: + >>> import os + >>> os.environ['SPAM'] = 'eggs' + >>> assert expandpath('~/$SPAM') == expanduser('~/eggs') + >>> assert expandpath('foo') == 'foo' + """ + path = expanduser(path) + path = expandvars(path) + return path diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/queueutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/queueutils.py new file mode 100644 index 0000000000000000000000000000000000000000..f6e4e4c28d0f0a394eb6deba7fec1f92b1344059 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/queueutils.py @@ -0,0 +1,223 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python comes with a many great data structures, from :class:`dict` +to :class:`collections.deque`, and no shortage of serviceable +algorithm implementations, from :func:`sorted` to :mod:`bisect`. But +priority queues are curiously relegated to an example documented in +:mod:`heapq`. Even there, the approach presented is not full-featured +and object-oriented. There is a built-in priority queue, +:class:`Queue.PriorityQueue`, but in addition to its austere API, it +carries the double-edged sword of threadsafety, making it fine for +multi-threaded, multi-consumer applications, but high-overhead for +cooperative/single-threaded use cases. + +The ``queueutils`` module currently provides two Queue +implementations: :class:`HeapPriorityQueue`, based on a heap, and +:class:`SortedPriorityQueue`, based on a sorted list. Both use a +unified API based on :class:`BasePriorityQueue` to facilitate testing +the slightly different performance characteristics on various +application use cases. + +>>> pq = PriorityQueue() +>>> pq.add('low priority task', 0) +>>> pq.add('high priority task', 2) +>>> pq.add('medium priority task 1', 1) +>>> pq.add('medium priority task 2', 1) +>>> len(pq) +4 +>>> pq.pop() +'high priority task' +>>> pq.peek() +'medium priority task 1' +>>> len(pq) +3 + +""" + + +from heapq import heappush, heappop +from bisect import insort +import itertools + +try: + from .typeutils import make_sentinel + _REMOVED = make_sentinel(var_name='_REMOVED') +except ImportError: + _REMOVED = object() + +try: + from .listutils import BList + # see BarrelList docstring for notes +except ImportError: + BList = list + + +__all__ = ['PriorityQueue', 'BasePriorityQueue', + 'HeapPriorityQueue', 'SortedPriorityQueue'] + + +# TODO: make Base a real abstract class +# TODO: add uniqueification + + +class BasePriorityQueue: + """The abstract base class for the other PriorityQueues in this + module. Override the ``_backend_type`` class attribute, as well as + the :meth:`_push_entry` and :meth:`_pop_entry` staticmethods for + custom subclass behavior. (Don't forget to use + :func:`staticmethod`). + + Args: + priority_key (callable): A function that takes *priority* as + passed in by :meth:`add` and returns a real number + representing the effective priority. + + """ + # negating priority means larger numbers = higher priority + _default_priority_key = staticmethod(lambda p: -float(p or 0)) + _backend_type = list + + def __init__(self, **kw): + self._pq = self._backend_type() + self._entry_map = {} + self._counter = itertools.count() + self._get_priority = kw.pop('priority_key', self._default_priority_key) + if kw: + raise TypeError('unexpected keyword arguments: %r' % kw.keys()) + + @staticmethod + def _push_entry(backend, entry): + pass # abstract + + @staticmethod + def _pop_entry(backend): + pass # abstract + + def add(self, task, priority=None): + """ + Add a task to the queue, or change the *task*'s priority if *task* + is already in the queue. *task* can be any hashable object, + and *priority* defaults to ``0``. Higher values representing + higher priority, but this behavior can be controlled by + setting *priority_key* in the constructor. + """ + priority = self._get_priority(priority) + if task in self._entry_map: + self.remove(task) + count = next(self._counter) + entry = [priority, count, task] + self._entry_map[task] = entry + self._push_entry(self._pq, entry) + + def remove(self, task): + """Remove a task from the priority queue. Raises :exc:`KeyError` if + the *task* is absent. + """ + entry = self._entry_map.pop(task) + entry[-1] = _REMOVED + + def _cull(self, raise_exc=True): + "Remove entries marked as removed by previous :meth:`remove` calls." + while self._pq: + priority, count, task = self._pq[0] + if task is _REMOVED: + self._pop_entry(self._pq) + continue + return + if raise_exc: + raise IndexError('empty priority queue') + + def peek(self, default=_REMOVED): + """Read the next value in the queue without removing it. Returns + *default* on an empty queue, or raises :exc:`KeyError` if + *default* is not set. + """ + try: + self._cull() + _, _, task = self._pq[0] + except IndexError: + if default is not _REMOVED: + return default + raise IndexError('peek on empty queue') + return task + + def pop(self, default=_REMOVED): + """Remove and return the next value in the queue. Returns *default* on + an empty queue, or raises :exc:`KeyError` if *default* is not + set. + """ + try: + self._cull() + _, _, task = self._pop_entry(self._pq) + del self._entry_map[task] + except IndexError: + if default is not _REMOVED: + return default + raise IndexError('pop on empty queue') + return task + + def __len__(self): + "Return the number of tasks in the queue." + return len(self._entry_map) + + +class HeapPriorityQueue(BasePriorityQueue): + """A priority queue inherited from :class:`BasePriorityQueue`, + backed by a list and based on the :func:`heapq.heappop` and + :func:`heapq.heappush` functions in the built-in :mod:`heapq` + module. + """ + @staticmethod + def _pop_entry(backend): + return heappop(backend) + + @staticmethod + def _push_entry(backend, entry): + heappush(backend, entry) + + +class SortedPriorityQueue(BasePriorityQueue): + """A priority queue inherited from :class:`BasePriorityQueue`, based + on the :func:`bisect.insort` approach for in-order insertion into + a sorted list. + """ + _backend_type = BList + + @staticmethod + def _pop_entry(backend): + return backend.pop(0) + + @staticmethod + def _push_entry(backend, entry): + insort(backend, entry) + + +PriorityQueue = SortedPriorityQueue diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/setutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/setutils.py new file mode 100644 index 0000000000000000000000000000000000000000..3ed5ab32052ebb2750f90a2bc07eab40b2249525 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/setutils.py @@ -0,0 +1,969 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""\ + +The :class:`set` type brings the practical expressiveness of +set theory to Python. It has a very rich API overall, but lacks a +couple of fundamental features. For one, sets are not ordered. On top +of this, sets are not indexable, i.e, ``my_set[8]`` will raise an +:exc:`TypeError`. The :class:`IndexedSet` type remedies both of these +issues without compromising on the excellent complexity +characteristics of Python's built-in set implementation. +""" + + +from bisect import bisect_left +from collections.abc import MutableSet +from itertools import chain, islice +import operator + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + + +__all__ = ['IndexedSet', 'complement'] + + +_COMPACTION_FACTOR = 8 + +# TODO: inherit from set() +# TODO: .discard_many(), .remove_many() +# TODO: raise exception on non-set params? +# TODO: technically reverse operators should probably reverse the +# order of the 'other' inputs and put self last (to try and maintain +# insertion order) + + +class IndexedSet(MutableSet): + """``IndexedSet`` is a :class:`collections.MutableSet` that maintains + insertion order and uniqueness of inserted elements. It's a hybrid + type, mostly like an OrderedSet, but also :class:`list`-like, in + that it supports indexing and slicing. + + Args: + other (iterable): An optional iterable used to initialize the set. + + >>> x = IndexedSet(list(range(4)) + list(range(8))) + >>> x + IndexedSet([0, 1, 2, 3, 4, 5, 6, 7]) + >>> x - set(range(2)) + IndexedSet([2, 3, 4, 5, 6, 7]) + >>> x[-1] + 7 + >>> fcr = IndexedSet('freecreditreport.com') + >>> ''.join(fcr[:fcr.index('.')]) + 'frecditpo' + + Standard set operators and interoperation with :class:`set` are + all supported: + + >>> fcr & set('cash4gold.com') + IndexedSet(['c', 'd', 'o', '.', 'm']) + + As you can see, the ``IndexedSet`` is almost like a ``UniqueList``, + retaining only one copy of a given value, in the order it was + first added. For the curious, the reason why IndexedSet does not + support setting items based on index (i.e, ``__setitem__()``), + consider the following dilemma:: + + my_indexed_set = [A, B, C, D] + my_indexed_set[2] = A + + At this point, a set requires only one *A*, but a :class:`list` would + overwrite *C*. Overwriting *C* would change the length of the list, + meaning that ``my_indexed_set[2]`` would not be *A*, as expected with a + list, but rather *D*. So, no ``__setitem__()``. + + Otherwise, the API strives to be as complete a union of the + :class:`list` and :class:`set` APIs as possible. + """ + def __init__(self, other=None): + self.item_index_map = dict() + self.item_list = [] + self.dead_indices = [] + self._compactions = 0 + self._c_max_size = 0 + if other: + self.update(other) + + # internal functions + @property + def _dead_index_count(self): + return len(self.item_list) - len(self.item_index_map) + + def _compact(self): + if not self.dead_indices: + return + self._compactions += 1 + dead_index_count = self._dead_index_count + items, index_map = self.item_list, self.item_index_map + self._c_max_size = max(self._c_max_size, len(items)) + for i, item in enumerate(self): + items[i] = item + index_map[item] = i + del items[-dead_index_count:] + del self.dead_indices[:] + + def _cull(self): + ded = self.dead_indices + if not ded: + return + items, ii_map = self.item_list, self.item_index_map + if not ii_map: + del items[:] + del ded[:] + elif len(ded) > 384: + self._compact() + elif self._dead_index_count > (len(items) / _COMPACTION_FACTOR): + self._compact() + elif items[-1] is _MISSING: # get rid of dead right hand side + num_dead = 1 + while items[-(num_dead + 1)] is _MISSING: + num_dead += 1 + if ded and ded[-1][1] == len(items): + del ded[-1] + del items[-num_dead:] + + def _get_real_index(self, index): + if index < 0: + index += len(self) + if not self.dead_indices: + return index + real_index = index + for d_start, d_stop in self.dead_indices: + if real_index < d_start: + break + real_index += d_stop - d_start + return real_index + + def _get_apparent_index(self, index): + if index < 0: + index += len(self) + if not self.dead_indices: + return index + apparent_index = index + for d_start, d_stop in self.dead_indices: + if index < d_start: + break + apparent_index -= d_stop - d_start + return apparent_index + + def _add_dead(self, start, stop=None): + # TODO: does not handle when the new interval subsumes + # multiple existing intervals + dints = self.dead_indices + if stop is None: + stop = start + 1 + cand_int = [start, stop] + if not dints: + dints.append(cand_int) + return + int_idx = bisect_left(dints, cand_int) + dint = dints[int_idx - 1] + d_start, d_stop = dint + if start <= d_start <= stop: + dint[0] = start + elif start <= d_stop <= stop: + dint[1] = stop + else: + dints.insert(int_idx, cand_int) + return + + # common operations (shared by set and list) + def __len__(self): + return len(self.item_index_map) + + def __contains__(self, item): + return item in self.item_index_map + + def __iter__(self): + return (item for item in self.item_list if item is not _MISSING) + + def __reversed__(self): + item_list = self.item_list + return (item for item in reversed(item_list) if item is not _MISSING) + + def __repr__(self): + return f'{self.__class__.__name__}({list(self)!r})' + + def __eq__(self, other): + if isinstance(other, IndexedSet): + return len(self) == len(other) and list(self) == list(other) + try: + return set(self) == set(other) + except TypeError: + return False + + @classmethod + def from_iterable(cls, it): + "from_iterable(it) -> create a set from an iterable" + return cls(it) + + # set operations + def add(self, item): + "add(item) -> add item to the set" + if item not in self.item_index_map: + self.item_index_map[item] = len(self.item_list) + self.item_list.append(item) + + def remove(self, item): + "remove(item) -> remove item from the set, raises if not present" + try: + didx = self.item_index_map.pop(item) + except KeyError: + raise KeyError(item) + self.item_list[didx] = _MISSING + self._add_dead(didx) + self._cull() + + def discard(self, item): + "discard(item) -> discard item from the set (does not raise)" + try: + self.remove(item) + except KeyError: + pass + + def clear(self): + "clear() -> empty the set" + del self.item_list[:] + del self.dead_indices[:] + self.item_index_map.clear() + + def isdisjoint(self, other): + "isdisjoint(other) -> return True if no overlap with other" + iim = self.item_index_map + for k in other: + if k in iim: + return False + return True + + def issubset(self, other): + "issubset(other) -> return True if other contains this set" + if len(other) < len(self): + return False + for k in self.item_index_map: + if k not in other: + return False + return True + + def issuperset(self, other): + "issuperset(other) -> return True if set contains other" + if len(other) > len(self): + return False + iim = self.item_index_map + for k in other: + if k not in iim: + return False + return True + + def union(self, *others): + "union(*others) -> return a new set containing this set and others" + return self.from_iterable(chain(self, *others)) + + def iter_intersection(self, *others): + "iter_intersection(*others) -> iterate over elements also in others" + for k in self: + for other in others: + if k not in other: + break + else: + yield k + return + + def intersection(self, *others): + "intersection(*others) -> get a set with overlap of this and others" + if len(others) == 1: + other = others[0] + return self.from_iterable(k for k in self if k in other) + return self.from_iterable(self.iter_intersection(*others)) + + def iter_difference(self, *others): + "iter_difference(*others) -> iterate over elements not in others" + for k in self: + for other in others: + if k in other: + break + else: + yield k + return + + def difference(self, *others): + "difference(*others) -> get a new set with elements not in others" + if len(others) == 1: + other = others[0] + return self.from_iterable(k for k in self if k not in other) + return self.from_iterable(self.iter_difference(*others)) + + def symmetric_difference(self, *others): + "symmetric_difference(*others) -> XOR set of this and others" + ret = self.union(*others) + return ret.difference(self.intersection(*others)) + + __or__ = __ror__ = union + __and__ = __rand__ = intersection + __sub__ = difference + __xor__ = __rxor__ = symmetric_difference + + def __rsub__(self, other): + vals = [x for x in other if x not in self] + return type(other)(vals) + + # in-place set operations + def update(self, *others): + "update(*others) -> add values from one or more iterables" + if not others: + return # raise? + elif len(others) == 1: + other = others[0] + else: + other = chain(others) + for o in other: + self.add(o) + + def intersection_update(self, *others): + "intersection_update(*others) -> discard self.difference(*others)" + for val in self.difference(*others): + self.discard(val) + + def difference_update(self, *others): + "difference_update(*others) -> discard self.intersection(*others)" + if self in others: + self.clear() + for val in self.intersection(*others): + self.discard(val) + + def symmetric_difference_update(self, other): # note singular 'other' + "symmetric_difference_update(other) -> in-place XOR with other" + if self is other: + self.clear() + for val in other: + if val in self: + self.discard(val) + else: + self.add(val) + + def __ior__(self, *others): + self.update(*others) + return self + + def __iand__(self, *others): + self.intersection_update(*others) + return self + + def __isub__(self, *others): + self.difference_update(*others) + return self + + def __ixor__(self, *others): + self.symmetric_difference_update(*others) + return self + + def iter_slice(self, start, stop, step=None): + "iterate over a slice of the set" + iterable = self + if start is not None: + start = self._get_real_index(start) + if stop is not None: + stop = self._get_real_index(stop) + if step is not None and step < 0: + step = -step + iterable = reversed(self) + return islice(iterable, start, stop, step) + + # list operations + def __getitem__(self, index): + try: + start, stop, step = index.start, index.stop, index.step + except AttributeError: + index = operator.index(index) + else: + iter_slice = self.iter_slice(start, stop, step) + return self.from_iterable(iter_slice) + if index < 0: + index += len(self) + real_index = self._get_real_index(index) + try: + ret = self.item_list[real_index] + except IndexError: + raise IndexError('IndexedSet index out of range') + return ret + + def pop(self, index=None): + "pop(index) -> remove the item at a given index (-1 by default)" + item_index_map = self.item_index_map + len_self = len(item_index_map) + if index is None or index == -1 or index == len_self - 1: + ret = self.item_list.pop() + del item_index_map[ret] + else: + real_index = self._get_real_index(index) + ret = self.item_list[real_index] + self.item_list[real_index] = _MISSING + del item_index_map[ret] + self._add_dead(real_index) + self._cull() + return ret + + def count(self, val): + "count(val) -> count number of instances of value (0 or 1)" + if val in self.item_index_map: + return 1 + return 0 + + def reverse(self): + "reverse() -> reverse the contents of the set in-place" + reversed_list = list(reversed(self)) + self.item_list[:] = reversed_list + for i, item in enumerate(self.item_list): + self.item_index_map[item] = i + del self.dead_indices[:] + + def sort(self, **kwargs): + "sort() -> sort the contents of the set in-place" + sorted_list = sorted(self, **kwargs) + if sorted_list == self.item_list: + return + self.item_list[:] = sorted_list + for i, item in enumerate(self.item_list): + self.item_index_map[item] = i + del self.dead_indices[:] + + def index(self, val): + "index(val) -> get the index of a value, raises if not present" + try: + return self._get_apparent_index(self.item_index_map[val]) + except KeyError: + cn = self.__class__.__name__ + raise ValueError(f'{val!r} is not in {cn}') + + +def complement(wrapped): + """Given a :class:`set`, convert it to a **complement set**. + + Whereas a :class:`set` keeps track of what it contains, a + `complement set + `_ keeps + track of what it does *not* contain. For example, look what + happens when we intersect a normal set with a complement set:: + + >>> list(set(range(5)) & complement(set([2, 3]))) + [0, 1, 4] + + We get the everything in the left that wasn't in the right, + because intersecting with a complement is the same as subtracting + a normal set. + + Args: + wrapped (set): A set or any other iterable which should be + turned into a complement set. + + All set methods and operators are supported by complement sets, + between other :func:`complement`-wrapped sets and/or regular + :class:`set` objects. + + Because a complement set only tracks what elements are *not* in + the set, functionality based on set contents is unavailable: + :func:`len`, :func:`iter` (and for loops), and ``.pop()``. But a + complement set can always be turned back into a regular set by + complementing it again: + + >>> s = set(range(5)) + >>> complement(complement(s)) == s + True + + .. note:: + + An empty complement set corresponds to the concept of a + `universal set `_ + from mathematics. + + Complement sets by example + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + Many uses of sets can be expressed more simply by using a + complement. Rather than trying to work out in your head the proper + way to invert an expression, you can just throw a complement on + the set. Consider this example of a name filter:: + + >>> class NamesFilter(object): + ... def __init__(self, allowed): + ... self._allowed = allowed + ... + ... def filter(self, names): + ... return [name for name in names if name in self._allowed] + >>> NamesFilter(set(['alice', 'bob'])).filter(['alice', 'bob', 'carol']) + ['alice', 'bob'] + + What if we want to just express "let all the names through"? + + We could try to enumerate all of the expected names:: + + ``NamesFilter({'alice', 'bob', 'carol'})`` + + But this is very brittle -- what if at some point over this + object is changed to filter ``['alice', 'bob', 'carol', 'dan']``? + + Even worse, what about the poor programmer who next works + on this piece of code? They cannot tell whether the purpose + of the large allowed set was "allow everything", or if 'dan' + was excluded for some subtle reason. + + A complement set lets the programmer intention be expressed + succinctly and directly:: + + NamesFilter(complement(set())) + + Not only is this code short and robust, it is easy to understand + the intention. + + """ + if type(wrapped) is _ComplementSet: + return wrapped.complemented() + if type(wrapped) is frozenset: + return _ComplementSet(excluded=wrapped) + return _ComplementSet(excluded=set(wrapped)) + + +def _norm_args_typeerror(other): + '''normalize args and raise type-error if there is a problem''' + if type(other) in (set, frozenset): + inc, exc = other, None + elif type(other) is _ComplementSet: + inc, exc = other._included, other._excluded + else: + raise TypeError('argument must be another set or complement(set)') + return inc, exc + + +def _norm_args_notimplemented(other): + '''normalize args and return NotImplemented (for overloaded operators)''' + if type(other) in (set, frozenset): + inc, exc = other, None + elif type(other) is _ComplementSet: + inc, exc = other._included, other._excluded + else: + return NotImplemented, None + return inc, exc + + +class _ComplementSet: + """ + helper class for complement() that implements the set methods + """ + __slots__ = ('_included', '_excluded') + + def __init__(self, included=None, excluded=None): + if included is None: + assert type(excluded) in (set, frozenset) + elif excluded is None: + assert type(included) in (set, frozenset) + else: + raise ValueError('one of included or excluded must be a set') + self._included, self._excluded = included, excluded + + def __repr__(self): + if self._included is None: + return f'complement({repr(self._excluded)})' + return f'complement(complement({repr(self._included)}))' + + def complemented(self): + '''return a complement of the current set''' + if type(self._included) is frozenset or type(self._excluded) is frozenset: + return _ComplementSet(included=self._excluded, excluded=self._included) + return _ComplementSet( + included=None if self._excluded is None else set(self._excluded), + excluded=None if self._included is None else set(self._included)) + + __invert__ = complemented + + def complement(self): + '''convert the current set to its complement in-place''' + self._included, self._excluded = self._excluded, self._included + + def __contains__(self, item): + if self._included is None: + return not item in self._excluded + return item in self._included + + def add(self, item): + if self._included is None: + if item in self._excluded: + self._excluded.remove(item) + else: + self._included.add(item) + + def remove(self, item): + if self._included is None: + self._excluded.add(item) + else: + self._included.remove(item) + + def pop(self): + if self._included is None: + raise NotImplementedError # self.missing.add(random.choice(gc.objects())) + return self._included.pop() + + def intersection(self, other): + try: + return self & other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __and__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(included=inc - self._excluded) + else: # - - + return _ComplementSet(excluded=self._excluded.union(other._excluded)) + else: + if inc is None: # + - + return _ComplementSet(included=exc - self._included) + else: # + + + return _ComplementSet(included=self._included.intersection(inc)) + + __rand__ = __and__ + + def __iand__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + self._excluded = inc - self._excluded # TODO: do this in place? + else: # - - + self._excluded |= exc + else: + if inc is None: # + - + self._included -= exc + self._included, self._excluded = None, self._included + else: # + + + self._included &= inc + return self + + def union(self, other): + try: + return self | other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __or__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(excluded=self._excluded - inc) + else: # - - + return _ComplementSet(excluded=self._excluded.intersection(exc)) + else: + if inc is None: # + - + return _ComplementSet(excluded=exc - self._included) + else: # + + + return _ComplementSet(included=self._included.union(inc)) + + __ror__ = __or__ + + def __ior__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + self._excluded -= inc + else: # - - + self._excluded &= exc + else: + if inc is None: # + - + self._included, self._excluded = None, exc - self._included # TODO: do this in place? + else: # + + + self._included |= inc + return self + + def update(self, items): + if type(items) in (set, frozenset): + inc, exc = items, None + elif type(items) is _ComplementSet: + inc, exc = items._included, items._excluded + else: + inc, exc = frozenset(items), None + if self._included is None: + if exc is None: # - + + self._excluded &= inc + else: # - - + self._excluded.discard(exc) + else: + if inc is None: # + - + self._included &= exc + self._included, self._excluded = None, self._excluded + else: # + + + self._included.update(inc) + + def discard(self, items): + if type(items) in (set, frozenset): + inc, exc = items, None + elif type(items) is _ComplementSet: + inc, exc = items._included, items._excluded + else: + inc, exc = frozenset(items), None + if self._included is None: + if exc is None: # - + + self._excluded.update(inc) + else: # - - + self._included, self._excluded = exc - self._excluded, None + else: + if inc is None: # + - + self._included &= exc + else: # + + + self._included.discard(inc) + + def symmetric_difference(self, other): + try: + return self ^ other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __xor__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(excluded=self._excluded - inc) + else: # - - + return _ComplementSet(included=self._excluded.symmetric_difference(exc)) + else: + if inc is None: # + - + return _ComplementSet(excluded=exc - self._included) + else: # + + + return _ComplementSet(included=self._included.symmetric_difference(inc)) + + __rxor__ = __xor__ + + def symmetric_difference_update(self, other): + inc, exc = _norm_args_typeerror(other) + if self._included is None: + if exc is None: # - + + self._excluded |= inc + else: # - - + self._excluded.symmetric_difference_update(exc) + self._included, self._excluded = self._excluded, None + else: + if inc is None: # + - + self._included |= exc + self._included, self._excluded = None, self._included + else: # + + + self._included.symmetric_difference_update(inc) + + def isdisjoint(self, other): + inc, exc = _norm_args_typeerror(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return inc.issubset(self._excluded) + else: # - - + return False + else: + if inc is None: # + - + return self._included.issubset(exc) + else: # + + + return self._included.isdisjoint(inc) + + def issubset(self, other): + '''everything missing from other is also missing from self''' + try: + return self <= other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __le__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return False + else: # - - + return self._excluded.issupserset(exc) + else: + if inc is None: # + - + return self._included.isdisjoint(exc) + else: # + + + return self._included.issubset(inc) + + def __lt__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return False + else: # - - + return self._excluded > exc + else: + if inc is None: # + - + return self._included.isdisjoint(exc) + else: # + + + return self._included < inc + + def issuperset(self, other): + '''everything missing from self is also missing from super''' + try: + return self >= other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __ge__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return not self._excluded.intersection(inc) + else: # - - + return self._excluded.issubset(exc) + else: + if inc is None: # + - + return False + else: # + + + return self._included.issupserset(inc) + + def __gt__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return not self._excluded.intersection(inc) + else: # - - + return self._excluded < exc + else: + if inc is None: # + - + return False + else: # + + + return self._included > inc + + def difference(self, other): + try: + return self - other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __sub__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + return _ComplementSet(excluded=self._excluded | inc) + else: # - - + return _ComplementSet(included=exc - self._excluded) + else: + if inc is None: # + - + return _ComplementSet(included=self._included & exc) + else: # + + + return _ComplementSet(included=self._included.difference(inc)) + + def __rsub__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + # rsub, so the expression being evaluated is "other - self" + if self._included is None: + if exc is None: # - + + return _ComplementSet(included=inc & self._excluded) + else: # - - + return _ComplementSet(included=self._excluded - exc) + else: + if inc is None: # + - + return _ComplementSet(excluded=exc | self._included) + else: # + + + return _ComplementSet(included=inc.difference(self._included)) + + def difference_update(self, other): + try: + self -= other + except NotImplementedError: + raise TypeError('argument must be another set or complement(set)') + + def __isub__(self, other): + inc, exc = _norm_args_notimplemented(other) + if inc is NotImplemented: + return NotImplemented + if self._included is None: + if exc is None: # - + + self._excluded |= inc + else: # - - + self._included, self._excluded = exc - self._excluded, None + else: + if inc is None: # + - + self._included &= exc + else: # + + + self._included.difference_update(inc) + return self + + def __eq__(self, other): + return ( + type(self) is type(other) + and self._included == other._included + and self._excluded == other._excluded) or ( + type(other) in (set, frozenset) and self._included == other) + + def __hash__(self): + return hash(self._included) ^ hash(self._excluded) + + def __len__(self): + if self._included is not None: + return len(self._included) + raise NotImplementedError('complemented sets have undefined length') + + def __iter__(self): + if self._included is not None: + return iter(self._included) + raise NotImplementedError('complemented sets have undefined contents') + + def __bool__(self): + if self._included is not None: + return bool(self._included) + return True + diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/socketutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/socketutils.py new file mode 100644 index 0000000000000000000000000000000000000000..387f84f0dde1e0d6a80a7c0518e39be4c6949855 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/socketutils.py @@ -0,0 +1,766 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""At its heart, Python can be viewed as an extension of the C +programming language. Springing from the most popular systems +programming language has made Python itself a great language for +systems programming. One key to success in this domain is Python's +very serviceable :mod:`socket` module and its :class:`socket.socket` +type. + +The ``socketutils`` module provides natural next steps to the ``socket`` +builtin: straightforward, tested building blocks for higher-level +protocols. + +The :class:`BufferedSocket` wraps an ordinary socket, providing a +layer of intuitive buffering for both sending and receiving. This +facilitates parsing messages from streams, i.e., all sockets with type +``SOCK_STREAM``. The BufferedSocket enables receiving until the next +relevant token, up to a certain size, or until the connection is +closed. For all of these, it provides consistent APIs to size +limiting, as well as timeouts that are compatible with multiple +concurrency paradigms. Use it to parse the next one-off text or binary +socket protocol you encounter. + +This module also provides the :class:`NetstringSocket`, a pure-Python +implementation of `the Netstring protocol`_, built on top of the +:class:`BufferedSocket`, serving as a ready-made, production-grade example. + +Special thanks to `Kurt Rose`_ for his original authorship and all his +contributions on this module. Also thanks to `Daniel J. Bernstein`_, the +original author of `Netstring`_. + +.. _the Netstring protocol: https://en.wikipedia.org/wiki/Netstring +.. _Kurt Rose: https://github.com/doublereedkurt +.. _Daniel J. Bernstein: https://cr.yp.to/ +.. _Netstring: https://cr.yp.to/proto/netstrings.txt + +""" + +import time +import socket + +try: + from threading import RLock +except Exception: + class RLock: + 'Dummy reentrant lock for builds without threads' + def __enter__(self): + pass + + def __exit__(self, exctype, excinst, exctb): + pass + + +try: + from .typeutils import make_sentinel + _UNSET = make_sentinel(var_name='_UNSET') +except ImportError: + _UNSET = object() + + +DEFAULT_TIMEOUT = 10 # 10 seconds +DEFAULT_MAXSIZE = 32 * 1024 # 32kb +_RECV_LARGE_MAXSIZE = 1024 ** 5 # 1PB + + +class BufferedSocket: + """Mainly provides recv_until and recv_size. recv, send, sendall, and + peek all function as similarly as possible to the built-in socket + API. + + This type has been tested against both the built-in socket type as + well as those from gevent and eventlet. It also features support + for sockets with timeouts set to 0 (aka nonblocking), provided the + caller is prepared to handle the EWOULDBLOCK exceptions. + + Args: + sock (socket): The connected socket to be wrapped. + timeout (float): The default timeout for sends and recvs, in + seconds. Set to ``None`` for no timeout, and 0 for + nonblocking. Defaults to *sock*'s own timeout if already set, + and 10 seconds otherwise. + maxsize (int): The default maximum number of bytes to be received + into the buffer before it is considered full and raises an + exception. Defaults to 32 kilobytes. + recvsize (int): The number of bytes to recv for every + lower-level :meth:`socket.recv` call. Defaults to *maxsize*. + + *timeout* and *maxsize* can both be overridden on individual socket + operations. + + All ``recv`` methods return bytestrings (:class:`bytes`) and can + raise :exc:`socket.error`. :exc:`Timeout`, + :exc:`ConnectionClosed`, and :exc:`MessageTooLong` all inherit + from :exc:`socket.error` and exist to provide better error + messages. Received bytes are always buffered, even if an exception + is raised. Use :meth:`BufferedSocket.getrecvbuffer` to retrieve + partial recvs. + + BufferedSocket does not replace the built-in socket by any + means. While the overlapping parts of the API are kept parallel to + the built-in :class:`socket.socket`, BufferedSocket does not + inherit from socket, and most socket functionality is only + available on the underlying socket. :meth:`socket.getpeername`, + :meth:`socket.getsockname`, :meth:`socket.fileno`, and others are + only available on the underlying socket that is wrapped. Use the + ``BufferedSocket.sock`` attribute to access it. See the examples + for more information on how to use BufferedSockets with built-in + sockets. + + The BufferedSocket is threadsafe, but consider the semantics of + your protocol before accessing a single socket from multiple + threads. Similarly, once the BufferedSocket is constructed, avoid + using the underlying socket directly. Only use it for operations + unrelated to messages, e.g., :meth:`socket.getpeername`. + + """ + def __init__(self, sock, timeout=_UNSET, + maxsize=DEFAULT_MAXSIZE, recvsize=_UNSET): + self.sock = sock + self.rbuf = b'' + self.sbuf = [] + self.maxsize = int(maxsize) + + if timeout is _UNSET: + if self.sock.gettimeout() is None: + self.timeout = DEFAULT_TIMEOUT + else: + self.timeout = self.sock.gettimeout() + else: + if timeout is None: + self.timeout = timeout + else: + self.timeout = float(timeout) + + if recvsize is _UNSET: + self._recvsize = self.maxsize + else: + self._recvsize = int(recvsize) + + self._send_lock = RLock() + self._recv_lock = RLock() + + def settimeout(self, timeout): + "Set the default *timeout* for future operations, in seconds." + self.timeout = timeout + + def gettimeout(self): + return self.timeout + + def setblocking(self, blocking): + self.timeout = None if blocking else 0.0 + + def setmaxsize(self, maxsize): + """Set the default maximum buffer size *maxsize* for future + operations, in bytes. Does not truncate the current buffer. + """ + self.maxsize = maxsize + + def getrecvbuffer(self): + "Returns the receive buffer bytestring (rbuf)." + with self._recv_lock: + return self.rbuf + + def getsendbuffer(self): + "Returns a copy of the send buffer list." + with self._send_lock: + return b''.join(self.sbuf) + + def recv(self, size, flags=0, timeout=_UNSET): + """Returns **up to** *size* bytes, using the internal buffer before + performing a single :meth:`socket.recv` operation. + + Args: + size (int): The maximum number of bytes to receive. + flags (int): Kept for API compatibility with sockets. Only + the default, ``0``, is valid. + timeout (float): The timeout for this operation. Can be + ``0`` for nonblocking and ``None`` for no + timeout. Defaults to the value set in the constructor + of BufferedSocket. + + If the operation does not complete in *timeout* seconds, a + :exc:`Timeout` is raised. Much like the built-in + :class:`socket.socket`, if this method returns an empty string, + then the socket is closed and recv buffer is empty. Further + calls to recv will raise :exc:`socket.error`. + + """ + with self._recv_lock: + if timeout is _UNSET: + timeout = self.timeout + if flags: + raise ValueError("non-zero flags not supported: %r" % flags) + if len(self.rbuf) >= size: + data, self.rbuf = self.rbuf[:size], self.rbuf[size:] + return data + if self.rbuf: + ret, self.rbuf = self.rbuf, b'' + return ret + self.sock.settimeout(timeout) + try: + data = self.sock.recv(self._recvsize) + except socket.timeout: + raise Timeout(timeout) # check the rbuf attr for more + if len(data) > size: + data, self.rbuf = data[:size], data[size:] + return data + + def peek(self, size, timeout=_UNSET): + """Returns *size* bytes from the socket and/or internal buffer. Bytes + are retained in BufferedSocket's internal recv buffer. To only + see bytes in the recv buffer, use :meth:`getrecvbuffer`. + + Args: + size (int): The exact number of bytes to peek at + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + + If the appropriate number of bytes cannot be fetched from the + buffer and socket before *timeout* expires, then a + :exc:`Timeout` will be raised. If the connection is closed, a + :exc:`ConnectionClosed` will be raised. + """ + with self._recv_lock: + if len(self.rbuf) >= size: + return self.rbuf[:size] + data = self.recv_size(size, timeout=timeout) + self.rbuf = data + self.rbuf + return data + + def recv_close(self, timeout=_UNSET, maxsize=_UNSET): + """Receive until the connection is closed, up to *maxsize* bytes. If + more than *maxsize* bytes are received, raises :exc:`MessageTooLong`. + """ + # recv_close works by using recv_size to request maxsize data, + # and ignoring ConnectionClose, returning and clearing the + # internal buffer instead. It raises an exception if + # ConnectionClosed isn't raised. + with self._recv_lock: + if maxsize is _UNSET: + maxsize = self.maxsize + if maxsize is None: + maxsize = _RECV_LARGE_MAXSIZE + try: + recvd = self.recv_size(maxsize + 1, timeout) + except ConnectionClosed: + ret, self.rbuf = self.rbuf, b'' + else: + # put extra received bytes (now in rbuf) after recvd + self.rbuf = recvd + self.rbuf + size_read = min(maxsize, len(self.rbuf)) + raise MessageTooLong(size_read) # check receive buffer + return ret + + def recv_until(self, delimiter, timeout=_UNSET, maxsize=_UNSET, + with_delimiter=False): + """Receive until *delimiter* is found, *maxsize* bytes have been read, + or *timeout* is exceeded. + + Args: + delimiter (bytes): One or more bytes to be searched for + in the socket stream. + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + maxsize (int): The maximum size for the internal buffer. + Defaults to the value set in the constructor. + with_delimiter (bool): Whether or not to include the + delimiter in the output. ``False`` by default, but + ``True`` is useful in cases where one is simply + forwarding the messages. + + ``recv_until`` will raise the following exceptions: + + * :exc:`Timeout` if more than *timeout* seconds expire. + * :exc:`ConnectionClosed` if the underlying socket is closed + by the sending end. + * :exc:`MessageTooLong` if the delimiter is not found in the + first *maxsize* bytes. + * :exc:`socket.error` if operating in nonblocking mode + (*timeout* equal to 0), or if some unexpected socket error + occurs, such as operating on a closed socket. + + """ + with self._recv_lock: + if maxsize is _UNSET: + maxsize = self.maxsize + if maxsize is None: + maxsize = _RECV_LARGE_MAXSIZE + if timeout is _UNSET: + timeout = self.timeout + len_delimiter = len(delimiter) + + sock = self.sock + recvd = bytearray(self.rbuf) + start = time.time() + find_offset_start = 0 # becomes a negative index below + + if not timeout: # covers None (no timeout) and 0 (nonblocking) + sock.settimeout(timeout) + try: + while 1: + offset = recvd.find(delimiter, find_offset_start, maxsize) + if offset != -1: # str.find returns -1 when no match found + if with_delimiter: # include delimiter in return + offset += len_delimiter + rbuf_offset = offset + else: + rbuf_offset = offset + len_delimiter + break + elif len(recvd) > maxsize: + raise MessageTooLong(maxsize, delimiter) # see rbuf + if timeout: + cur_timeout = timeout - (time.time() - start) + if cur_timeout <= 0.0: + raise socket.timeout() + sock.settimeout(cur_timeout) + nxt = sock.recv(self._recvsize) + if not nxt: + args = (len(recvd), delimiter) + msg = ('connection closed after reading %s bytes' + ' without finding symbol: %r' % args) + raise ConnectionClosed(msg) # check the recv buffer + recvd.extend(nxt) + find_offset_start = -len(nxt) - len_delimiter + 1 + except socket.timeout: + self.rbuf = bytes(recvd) + msg = ('read %s bytes without finding delimiter: %r' + % (len(recvd), delimiter)) + raise Timeout(timeout, msg) # check the recv buffer + except Exception: + self.rbuf = bytes(recvd) + raise + val, self.rbuf = bytes(recvd[:offset]), bytes(recvd[rbuf_offset:]) + return val + + def recv_size(self, size, timeout=_UNSET): + """Read off of the internal buffer, then off the socket, until + *size* bytes have been read. + + Args: + size (int): number of bytes to read before returning. + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + + If the appropriate number of bytes cannot be fetched from the + buffer and socket before *timeout* expires, then a + :exc:`Timeout` will be raised. If the connection is closed, a + :exc:`ConnectionClosed` will be raised. + """ + with self._recv_lock: + if timeout is _UNSET: + timeout = self.timeout + chunks = [] + total_bytes = 0 + try: + start = time.time() + self.sock.settimeout(timeout) + nxt = self.rbuf or self.sock.recv(self._recvsize) + while nxt: + total_bytes += len(nxt) + if total_bytes >= size: + break + chunks.append(nxt) + if timeout: + cur_timeout = timeout - (time.time() - start) + if cur_timeout <= 0.0: + raise socket.timeout() + self.sock.settimeout(cur_timeout) + nxt = self.sock.recv(self._recvsize) + else: + msg = ('connection closed after reading %s of %s requested' + ' bytes' % (total_bytes, size)) + raise ConnectionClosed(msg) # check recv buffer + except socket.timeout: + self.rbuf = b''.join(chunks) + msg = f'read {total_bytes} of {size} bytes' + raise Timeout(timeout, msg) # check recv buffer + except Exception: + # received data is still buffered in the case of errors + self.rbuf = b''.join(chunks) + raise + extra_bytes = total_bytes - size + if extra_bytes: + last, self.rbuf = nxt[:-extra_bytes], nxt[-extra_bytes:] + else: + last, self.rbuf = nxt, b'' + chunks.append(last) + return b''.join(chunks) + + def send(self, data, flags=0, timeout=_UNSET): + """Send the contents of the internal send buffer, as well as *data*, + to the receiving end of the connection. Returns the total + number of bytes sent. If no exception is raised, all of *data* was + sent and the internal send buffer is empty. + + Args: + data (bytes): The bytes to send. + flags (int): Kept for API compatibility with sockets. Only + the default 0 is valid. + timeout (float): The timeout for this operation. Can be 0 for + nonblocking and None for no timeout. Defaults to the value + set in the constructor of BufferedSocket. + + Will raise :exc:`Timeout` if the send operation fails to + complete before *timeout*. In the event of an exception, use + :meth:`BufferedSocket.getsendbuffer` to see which data was + unsent. + """ + with self._send_lock: + if timeout is _UNSET: + timeout = self.timeout + if flags: + raise ValueError("non-zero flags not supported") + sbuf = self.sbuf + sbuf.append(data) + if len(sbuf) > 1: + sbuf[:] = [b''.join([s for s in sbuf if s])] + self.sock.settimeout(timeout) + start, total_sent = time.time(), 0 + try: + while sbuf[0]: + sent = self.sock.send(sbuf[0]) + total_sent += sent + sbuf[0] = sbuf[0][sent:] + if timeout: + cur_timeout = timeout - (time.time() - start) + if cur_timeout <= 0.0: + raise socket.timeout() + self.sock.settimeout(cur_timeout) + except socket.timeout: + raise Timeout(timeout, '%s bytes unsent' % len(sbuf[0])) + return total_sent + + def sendall(self, data, flags=0, timeout=_UNSET): + """A passthrough to :meth:`~BufferedSocket.send`, retained for + parallelism to the :class:`socket.socket` API. + """ + return self.send(data, flags, timeout) + + def flush(self): + "Send the contents of the internal send buffer." + with self._send_lock: + self.send(b'') + return + + def buffer(self, data): + "Buffer *data* bytes for the next send operation." + with self._send_lock: + self.sbuf.append(data) + return + + # # # + # # # Passing through some socket basics + # # # + + def getsockname(self): + """Convenience function to return the wrapped socket's own address. + See :meth:`socket.getsockname` for more details. + """ + return self.sock.getsockname() + + def getpeername(self): + """Convenience function to return the remote address to which the + wrapped socket is connected. See :meth:`socket.getpeername` + for more details. + """ + return self.sock.getpeername() + + def getsockopt(self, level, optname, buflen=None): + """Convenience function passing through to the wrapped socket's + :meth:`socket.getsockopt`. + """ + args = (level, optname) + if buflen is not None: + args += (buflen,) + return self.sock.getsockopt(*args) + + def setsockopt(self, level, optname, value): + """Convenience function passing through to the wrapped socket's + :meth:`socket.setsockopt`. + """ + return self.sock.setsockopt(level, optname, value) + + @property + def type(self): + """A passthrough to the wrapped socket's type. Valid usages should + only ever see :data:`socket.SOCK_STREAM`. + """ + return self.sock.type + + @property + def family(self): + """A passthrough to the wrapped socket's family. BufferedSocket + supports all widely-used families, so this read-only attribute + can be one of :data:`socket.AF_INET` for IP, + :data:`socket.AF_INET6` for IPv6, and :data:`socket.AF_UNIX` + for UDS. + """ + return self.sock.family + + @property + def proto(self): + """A passthrough to the wrapped socket's protocol. The ``proto`` + attribute is very rarely used, so it's always 0, meaning "the + default" protocol. Pretty much all the practical information + is in :attr:`~BufferedSocket.type` and + :attr:`~BufferedSocket.family`, so you can go back to never + thinking about this. + """ + return self.sock.proto + + # # # + # # # Now for some more advanced interpretations of the builtin socket + # # # + + def fileno(self): + """Returns the file descriptor of the wrapped socket. -1 if it has + been closed on this end. + + Note that this makes the BufferedSocket selectable, i.e., + usable for operating system event loops without any external + libraries. Keep in mind that the operating system cannot know + about data in BufferedSocket's internal buffer. Exercise + discipline with calling ``recv*`` functions. + """ + return self.sock.fileno() + + def close(self): + """Closes the wrapped socket, and empties the internal buffers. The + send buffer is not flushed automatically, so if you have been + calling :meth:`~BufferedSocket.buffer`, be sure to call + :meth:`~BufferedSocket.flush` before calling this + method. After calling this method, future socket operations + will raise :exc:`socket.error`. + """ + with self._recv_lock: + with self._send_lock: + self.rbuf = b'' + self.rbuf_unconsumed = self.rbuf + self.sbuf[:] = [] + self.sock.close() + return + + def shutdown(self, how): + """Convenience method which passes through to the wrapped socket's + :meth:`~socket.shutdown`. Semantics vary by platform, so no + special internal handling is done with the buffers. This + method exists to facilitate the most common usage, wherein a + full ``shutdown`` is followed by a + :meth:`~BufferedSocket.close`. Developers requiring more + support, please open `an issue`_. + + .. _an issue: https://github.com/mahmoud/boltons/issues + """ + with self._recv_lock: + with self._send_lock: + self.sock.shutdown(how) + return + + # end BufferedSocket + + +class Error(socket.error): + """A subclass of :exc:`socket.error` from which all other + ``socketutils`` exceptions inherit. + + When using :class:`BufferedSocket` and other ``socketutils`` + types, generally you want to catch one of the specific exception + types below, or :exc:`socket.error`. + """ + pass + + +class ConnectionClosed(Error): + """Raised when receiving and the connection is unexpectedly closed + from the sending end. Raised from :class:`BufferedSocket`'s + :meth:`~BufferedSocket.peek`, :meth:`~BufferedSocket.recv_until`, + and :meth:`~BufferedSocket.recv_size`, and never from its + :meth:`~BufferedSocket.recv` or + :meth:`~BufferedSocket.recv_close`. + """ + pass + + +class MessageTooLong(Error): + """Raised from :meth:`BufferedSocket.recv_until` and + :meth:`BufferedSocket.recv_closed` when more than *maxsize* bytes are + read without encountering the delimiter or a closed connection, + respectively. + """ + def __init__(self, bytes_read=None, delimiter=None): + msg = 'message exceeded maximum size' + if bytes_read is not None: + msg += f'. {bytes_read} bytes read' + if delimiter is not None: + msg += f'. Delimiter not found: {delimiter!r}' + super().__init__(msg) + + +class Timeout(socket.timeout, Error): + """Inheriting from :exc:`socket.timeout`, Timeout is used to indicate + when a socket operation did not complete within the time + specified. Raised from any of :class:`BufferedSocket`'s ``recv`` + methods. + """ + def __init__(self, timeout, extra=""): + msg = 'socket operation timed out' + if timeout is not None: + msg += ' after %sms.' % (timeout * 1000) + if extra: + msg += ' ' + extra + super().__init__(msg) + + +class NetstringSocket: + """ + Reads and writes using the netstring protocol. + + More info: https://en.wikipedia.org/wiki/Netstring + Even more info: http://cr.yp.to/proto/netstrings.txt + """ + def __init__(self, sock, timeout=DEFAULT_TIMEOUT, maxsize=DEFAULT_MAXSIZE): + self.bsock = BufferedSocket(sock) + self.timeout = timeout + self.maxsize = maxsize + self._msgsize_maxsize = len(str(maxsize)) + 1 # len(str()) == log10 + + def fileno(self): + return self.bsock.fileno() + + def settimeout(self, timeout): + self.timeout = timeout + + def setmaxsize(self, maxsize): + self.maxsize = maxsize + self._msgsize_maxsize = self._calc_msgsize_maxsize(maxsize) + + def _calc_msgsize_maxsize(self, maxsize): + return len(str(maxsize)) + 1 # len(str()) == log10 + + def read_ns(self, timeout=_UNSET, maxsize=_UNSET): + if timeout is _UNSET: + timeout = self.timeout + + if maxsize is _UNSET: + maxsize = self.maxsize + msgsize_maxsize = self._msgsize_maxsize + else: + msgsize_maxsize = self._calc_msgsize_maxsize(maxsize) + + size_prefix = self.bsock.recv_until(b':', + timeout=timeout, + maxsize=msgsize_maxsize) + try: + size = int(size_prefix) + except ValueError: + raise NetstringInvalidSize('netstring message size must be valid' + ' integer, not %r' % size_prefix) + + if size > maxsize: + raise NetstringMessageTooLong(size, maxsize) + payload = self.bsock.recv_size(size) + if self.bsock.recv(1) != b',': + raise NetstringProtocolError("expected trailing ',' after message") + + return payload + + def write_ns(self, payload): + size = len(payload) + if size > self.maxsize: + raise NetstringMessageTooLong(size, self.maxsize) + data = str(size).encode('ascii') + b':' + payload + b',' + self.bsock.send(data) + + +class NetstringProtocolError(Error): + "Base class for all of socketutils' Netstring exception types." + pass + + +class NetstringInvalidSize(NetstringProtocolError): + """NetstringInvalidSize is raised when the ``:``-delimited size prefix + of the message does not contain a valid integer. + + Message showing valid size:: + + 5:hello, + + Here the ``5`` is the size. Anything in this prefix position that + is not parsable as a Python integer (i.e., :class:`int`) will raise + this exception. + """ + def __init__(self, msg): + super().__init__(msg) + + +class NetstringMessageTooLong(NetstringProtocolError): + """NetstringMessageTooLong is raised when the size prefix contains a + valid integer, but that integer is larger than the + :class:`NetstringSocket`'s configured *maxsize*. + + When this exception is raised, it's recommended to simply close + the connection instead of trying to recover. + """ + def __init__(self, size, maxsize): + msg = ('netstring message length exceeds configured maxsize: %s > %s' + % (size, maxsize)) + super().__init__(msg) + + +""" +attrs worth adding/passing through: + + +properties: type, proto + +For its main functionality, BufferedSocket can wrap any object that +has the following methods: + + - gettimeout() + - settimeout() + - recv(size) + - send(data) + +The following methods are passed through: + +... + +""" + +# TODO: buffered socket check socket.type == SOCK_STREAM? +# TODO: make recv_until support taking a regex +# TODO: including the delimiter in the recv_until return is not +# necessary, as ConnectionClosed differentiates empty messages +# from socket closes. diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/statsutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/statsutils.py new file mode 100644 index 0000000000000000000000000000000000000000..36a82230d80f2b6e32fcf07851da2aa2c4d7132b --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/statsutils.py @@ -0,0 +1,814 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""``statsutils`` provides tools aimed primarily at descriptive +statistics for data analysis, such as :func:`mean` (average), +:func:`median`, :func:`variance`, and many others, + +The :class:`Stats` type provides all the main functionality of the +``statsutils`` module. A :class:`Stats` object wraps a given dataset, +providing all statistical measures as property attributes. These +attributes cache their results, which allows efficient computation of +multiple measures, as many measures rely on other measures. For +example, relative standard deviation (:attr:`Stats.rel_std_dev`) +relies on both the mean and standard deviation. The Stats object +caches those results so no rework is done. + +The :class:`Stats` type's attributes have module-level counterparts for +convenience when the computation reuse advantages do not apply. + +>>> stats = Stats(range(42)) +>>> stats.mean +20.5 +>>> mean(range(42)) +20.5 + +Statistics is a large field, and ``statsutils`` is focused on a few +basic techniques that are useful in software. The following is a brief +introduction to those techniques. For a more in-depth introduction, +`Statistics for Software +`_, +an article I wrote on the topic. It introduces key terminology vital +to effective usage of statistics. + +Statistical moments +------------------- + +Python programmers are probably familiar with the concept of the +*mean* or *average*, which gives a rough quantitiative middle value by +which a sample can be can be generalized. However, the mean is just +the first of four `moment`_-based measures by which a sample or +distribution can be measured. + +The four `Standardized moments`_ are: + + 1. `Mean`_ - :func:`mean` - theoretical middle value + 2. `Variance`_ - :func:`variance` - width of value dispersion + 3. `Skewness`_ - :func:`skewness` - symmetry of distribution + 4. `Kurtosis`_ - :func:`kurtosis` - "peakiness" or "long-tailed"-ness + +For more information check out `the Moment article on Wikipedia`_. + +.. _moment: https://en.wikipedia.org/wiki/Moment_(mathematics) +.. _Standardized moments: https://en.wikipedia.org/wiki/Standardized_moment +.. _Mean: https://en.wikipedia.org/wiki/Mean +.. _Variance: https://en.wikipedia.org/wiki/Variance +.. _Skewness: https://en.wikipedia.org/wiki/Skewness +.. _Kurtosis: https://en.wikipedia.org/wiki/Kurtosis +.. _the Moment article on Wikipedia: https://en.wikipedia.org/wiki/Moment_(mathematics) + +Keep in mind that while these moments can give a bit more insight into +the shape and distribution of data, they do not guarantee a complete +picture. Wildly different datasets can have the same values for all +four moments, so generalize wisely. + +Robust statistics +----------------- + +Moment-based statistics are notorious for being easily skewed by +outliers. The whole field of robust statistics aims to mitigate this +dilemma. ``statsutils`` also includes several robust statistical methods: + + * `Median`_ - The middle value of a sorted dataset + * `Trimean`_ - Another robust measure of the data's central tendency + * `Median Absolute Deviation`_ (MAD) - A robust measure of + variability, a natural counterpart to :func:`variance`. + * `Trimming`_ - Reducing a dataset to only the middle majority of + data is a simple way of making other estimators more robust. + +.. _Median: https://en.wikipedia.org/wiki/Median +.. _Trimean: https://en.wikipedia.org/wiki/Trimean +.. _Median Absolute Deviation: https://en.wikipedia.org/wiki/Median_absolute_deviation +.. _Trimming: https://en.wikipedia.org/wiki/Trimmed_estimator + + +Online and Offline Statistics +----------------------------- + +Unrelated to computer networking, `online`_ statistics involve +calculating statistics in a `streaming`_ fashion, without all the data +being available. The :class:`Stats` type is meant for the more +traditional offline statistics when all the data is available. For +pure-Python online statistics accumulators, look at the `Lithoxyl`_ +system instrumentation package. + +.. _Online: https://en.wikipedia.org/wiki/Online_algorithm +.. _streaming: https://en.wikipedia.org/wiki/Streaming_algorithm +.. _Lithoxyl: https://github.com/mahmoud/lithoxyl + +""" + + +import bisect +from math import floor, ceil +from collections import Counter + + +class _StatsProperty: + def __init__(self, name, func): + self.name = name + self.func = func + self.internal_name = '_' + name + + doc = func.__doc__ or '' + pre_doctest_doc, _, _ = doc.partition('>>>') + self.__doc__ = pre_doctest_doc + + def __get__(self, obj, objtype=None): + if obj is None: + return self + if not obj.data: + return obj.default + try: + return getattr(obj, self.internal_name) + except AttributeError: + setattr(obj, self.internal_name, self.func(obj)) + return getattr(obj, self.internal_name) + + +class Stats: + """The ``Stats`` type is used to represent a group of unordered + statistical datapoints for calculations such as mean, median, and + variance. + + Args: + + data (list): List or other iterable containing numeric values. + default (float): A value to be returned when a given + statistical measure is not defined. 0.0 by default, but + ``float('nan')`` is appropriate for stricter applications. + use_copy (bool): By default Stats objects copy the initial + data into a new list to avoid issues with + modifications. Pass ``False`` to disable this behavior. + is_sorted (bool): Presorted data can skip an extra sorting + step for a little speed boost. Defaults to False. + + """ + def __init__(self, data, default=0.0, use_copy=True, is_sorted=False): + self._use_copy = use_copy + self._is_sorted = is_sorted + if use_copy: + self.data = list(data) + else: + self.data = data + + self.default = default + cls = self.__class__ + self._prop_attr_names = [a for a in dir(self) + if isinstance(getattr(cls, a, None), + _StatsProperty)] + self._pearson_precision = 0 + + def __len__(self): + return len(self.data) + + def __iter__(self): + return iter(self.data) + + def _get_sorted_data(self): + """When using a copy of the data, it's better to have that copy be + sorted, but we do it lazily using this method, in case no + sorted measures are used. I.e., if median is never called, + sorting would be a waste. + + When not using a copy, it's presumed that all optimizations + are on the user. + """ + if not self._use_copy: + return sorted(self.data) + elif not self._is_sorted: + self.data.sort() + return self.data + + def clear_cache(self): + """``Stats`` objects automatically cache intermediary calculations + that can be reused. For instance, accessing the ``std_dev`` + attribute after the ``variance`` attribute will be + significantly faster for medium-to-large datasets. + + If you modify the object by adding additional data points, + call this function to have the cached statistics recomputed. + + """ + for attr_name in self._prop_attr_names: + attr_name = getattr(self.__class__, attr_name).internal_name + if not hasattr(self, attr_name): + continue + delattr(self, attr_name) + return + + def _calc_count(self): + """The number of items in this Stats object. Returns the same as + :func:`len` on a Stats object, but provided for pandas terminology + parallelism. + + >>> Stats(range(20)).count + 20 + """ + return len(self.data) + count = _StatsProperty('count', _calc_count) + + def _calc_mean(self): + """ + The arithmetic mean, or "average". Sum of the values divided by + the number of values. + + >>> mean(range(20)) + 9.5 + >>> mean(list(range(19)) + [949]) # 949 is an arbitrary outlier + 56.0 + """ + return sum(self.data, 0.0) / len(self.data) + mean = _StatsProperty('mean', _calc_mean) + + def _calc_max(self): + """ + The maximum value present in the data. + + >>> Stats([2, 1, 3]).max + 3 + """ + if self._is_sorted: + return self.data[-1] + return max(self.data) + max = _StatsProperty('max', _calc_max) + + def _calc_min(self): + """ + The minimum value present in the data. + + >>> Stats([2, 1, 3]).min + 1 + """ + if self._is_sorted: + return self.data[0] + return min(self.data) + min = _StatsProperty('min', _calc_min) + + def _calc_median(self): + """ + The median is either the middle value or the average of the two + middle values of a sample. Compared to the mean, it's generally + more resilient to the presence of outliers in the sample. + + >>> median([2, 1, 3]) + 2 + >>> median(range(97)) + 48 + >>> median(list(range(96)) + [1066]) # 1066 is an arbitrary outlier + 48 + """ + return self._get_quantile(self._get_sorted_data(), 0.5) + median = _StatsProperty('median', _calc_median) + + def _calc_iqr(self): + """Inter-quartile range (IQR) is the difference between the 75th + percentile and 25th percentile. IQR is a robust measure of + dispersion, like standard deviation, but safer to compare + between datasets, as it is less influenced by outliers. + + >>> iqr([1, 2, 3, 4, 5]) + 2 + >>> iqr(range(1001)) + 500 + """ + return self.get_quantile(0.75) - self.get_quantile(0.25) + iqr = _StatsProperty('iqr', _calc_iqr) + + def _calc_trimean(self): + """The trimean is a robust measure of central tendency, like the + median, that takes the weighted average of the median and the + upper and lower quartiles. + + >>> trimean([2, 1, 3]) + 2.0 + >>> trimean(range(97)) + 48.0 + >>> trimean(list(range(96)) + [1066]) # 1066 is an arbitrary outlier + 48.0 + + """ + sorted_data = self._get_sorted_data() + gq = lambda q: self._get_quantile(sorted_data, q) + return (gq(0.25) + (2 * gq(0.5)) + gq(0.75)) / 4.0 + trimean = _StatsProperty('trimean', _calc_trimean) + + def _calc_variance(self): + """\ + Variance is the average of the squares of the difference between + each value and the mean. + + >>> variance(range(97)) + 784.0 + """ + global mean # defined elsewhere in this file + return mean(self._get_pow_diffs(2)) + variance = _StatsProperty('variance', _calc_variance) + + def _calc_std_dev(self): + """\ + Standard deviation. Square root of the variance. + + >>> std_dev(range(97)) + 28.0 + """ + return self.variance ** 0.5 + std_dev = _StatsProperty('std_dev', _calc_std_dev) + + def _calc_median_abs_dev(self): + """\ + Median Absolute Deviation is a robust measure of statistical + dispersion: http://en.wikipedia.org/wiki/Median_absolute_deviation + + >>> median_abs_dev(range(97)) + 24.0 + """ + global median # defined elsewhere in this file + sorted_vals = sorted(self.data) + x = float(median(sorted_vals)) + return median([abs(x - v) for v in sorted_vals]) + median_abs_dev = _StatsProperty('median_abs_dev', _calc_median_abs_dev) + mad = median_abs_dev # convenience + + def _calc_rel_std_dev(self): + """\ + Standard deviation divided by the absolute value of the average. + + http://en.wikipedia.org/wiki/Relative_standard_deviation + + >>> print('%1.3f' % rel_std_dev(range(97))) + 0.583 + """ + abs_mean = abs(self.mean) + if abs_mean: + return self.std_dev / abs_mean + else: + return self.default + rel_std_dev = _StatsProperty('rel_std_dev', _calc_rel_std_dev) + + def _calc_skewness(self): + """\ + Indicates the asymmetry of a curve. Positive values mean the bulk + of the values are on the left side of the average and vice versa. + + http://en.wikipedia.org/wiki/Skewness + + See the module docstring for more about statistical moments. + + >>> skewness(range(97)) # symmetrical around 48.0 + 0.0 + >>> left_skewed = skewness(list(range(97)) + list(range(10))) + >>> right_skewed = skewness(list(range(97)) + list(range(87, 97))) + >>> round(left_skewed, 3), round(right_skewed, 3) + (0.114, -0.114) + """ + data, s_dev = self.data, self.std_dev + if len(data) > 1 and s_dev > 0: + return (sum(self._get_pow_diffs(3)) / + float((len(data) - 1) * (s_dev ** 3))) + else: + return self.default + skewness = _StatsProperty('skewness', _calc_skewness) + + def _calc_kurtosis(self): + """\ + Indicates how much data is in the tails of the distribution. The + result is always positive, with the normal "bell-curve" + distribution having a kurtosis of 3. + + http://en.wikipedia.org/wiki/Kurtosis + + See the module docstring for more about statistical moments. + + >>> kurtosis(range(9)) + 1.99125 + + With a kurtosis of 1.99125, [0, 1, 2, 3, 4, 5, 6, 7, 8] is more + centrally distributed than the normal curve. + """ + data, s_dev = self.data, self.std_dev + if len(data) > 1 and s_dev > 0: + return (sum(self._get_pow_diffs(4)) / + float((len(data) - 1) * (s_dev ** 4))) + else: + return 0.0 + kurtosis = _StatsProperty('kurtosis', _calc_kurtosis) + + def _calc_pearson_type(self): + precision = self._pearson_precision + skewness = self.skewness + kurtosis = self.kurtosis + beta1 = skewness ** 2.0 + beta2 = kurtosis * 1.0 + + # TODO: range checks? + + c0 = (4 * beta2) - (3 * beta1) + c1 = skewness * (beta2 + 3) + c2 = (2 * beta2) - (3 * beta1) - 6 + + if round(c1, precision) == 0: + if round(beta2, precision) == 3: + return 0 # Normal + else: + if beta2 < 3: + return 2 # Symmetric Beta + elif beta2 > 3: + return 7 + elif round(c2, precision) == 0: + return 3 # Gamma + else: + k = c1 ** 2 / (4 * c0 * c2) + if k < 0: + return 1 # Beta + raise RuntimeError('missed a spot') + pearson_type = _StatsProperty('pearson_type', _calc_pearson_type) + + @staticmethod + def _get_quantile(sorted_data, q): + data, n = sorted_data, len(sorted_data) + idx = q / 1.0 * (n - 1) + idx_f, idx_c = int(floor(idx)), int(ceil(idx)) + if idx_f == idx_c: + return data[idx_f] + return (data[idx_f] * (idx_c - idx)) + (data[idx_c] * (idx - idx_f)) + + def get_quantile(self, q): + """Get a quantile from the dataset. Quantiles are floating point + values between ``0.0`` and ``1.0``, with ``0.0`` representing + the minimum value in the dataset and ``1.0`` representing the + maximum. ``0.5`` represents the median: + + >>> Stats(range(100)).get_quantile(0.5) + 49.5 + """ + q = float(q) + if not 0.0 <= q <= 1.0: + raise ValueError('expected q between 0.0 and 1.0, not %r' % q) + elif not self.data: + return self.default + return self._get_quantile(self._get_sorted_data(), q) + + def get_zscore(self, value): + """Get the z-score for *value* in the group. If the standard deviation + is 0, 0 inf or -inf will be returned to indicate whether the value is + equal to, greater than or below the group's mean. + """ + mean = self.mean + if self.std_dev == 0: + if value == mean: + return 0 + if value > mean: + return float('inf') + if value < mean: + return float('-inf') + return (float(value) - mean) / self.std_dev + + def trim_relative(self, amount=0.15): + """A utility function used to cut a proportion of values off each end + of a list of values. This has the effect of limiting the + effect of outliers. + + Args: + amount (float): A value between 0.0 and 0.5 to trim off of + each side of the data. + + .. note: + + This operation modifies the data in-place. It does not + make or return a copy. + + """ + trim = float(amount) + if not 0.0 <= trim < 0.5: + raise ValueError('expected amount between 0.0 and 0.5, not %r' + % trim) + size = len(self.data) + size_diff = int(size * trim) + if size_diff == 0.0: + return + self.data = self._get_sorted_data()[size_diff:-size_diff] + self.clear_cache() + + def _get_pow_diffs(self, power): + """ + A utility function used for calculating statistical moments. + """ + m = self.mean + return [(v - m) ** power for v in self.data] + + def _get_bin_bounds(self, count=None, with_max=False): + if not self.data: + return [0.0] # TODO: raise? + + data = self.data + len_data, min_data, max_data = len(data), min(data), max(data) + + if len_data < 4: + if not count: + count = len_data + dx = (max_data - min_data) / float(count) + bins = [min_data + (dx * i) for i in range(count)] + elif count is None: + # freedman algorithm for fixed-width bin selection + q25, q75 = self.get_quantile(0.25), self.get_quantile(0.75) + dx = 2 * (q75 - q25) / (len_data ** (1 / 3.0)) + bin_count = max(1, int(ceil((max_data - min_data) / dx))) + bins = [min_data + (dx * i) for i in range(bin_count + 1)] + bins = [b for b in bins if b < max_data] + else: + dx = (max_data - min_data) / float(count) + bins = [min_data + (dx * i) for i in range(count)] + + if with_max: + bins.append(float(max_data)) + + return bins + + def get_histogram_counts(self, bins=None, **kw): + """Produces a list of ``(bin, count)`` pairs comprising a histogram of + the Stats object's data, using fixed-width bins. See + :meth:`Stats.format_histogram` for more details. + + Args: + bins (int): maximum number of bins, or list of + floating-point bin boundaries. Defaults to the output of + Freedman's algorithm. + bin_digits (int): Number of digits used to round down the + bin boundaries. Defaults to 1. + + The output of this method can be stored and/or modified, and + then passed to :func:`statsutils.format_histogram_counts` to + achieve the same text formatting as the + :meth:`~Stats.format_histogram` method. This can be useful for + snapshotting over time. + """ + bin_digits = int(kw.pop('bin_digits', 1)) + if kw: + raise TypeError('unexpected keyword arguments: %r' % kw.keys()) + + if not bins: + bins = self._get_bin_bounds() + else: + try: + bin_count = int(bins) + except TypeError: + try: + bins = [float(x) for x in bins] + except Exception: + raise ValueError('bins expected integer bin count or list' + ' of float bin boundaries, not %r' % bins) + if self.min < bins[0]: + bins = [self.min] + bins + else: + bins = self._get_bin_bounds(bin_count) + + # floor and ceil really should have taken ndigits, like round() + round_factor = 10.0 ** bin_digits + bins = [floor(b * round_factor) / round_factor for b in bins] + bins = sorted(set(bins)) + + idxs = [bisect.bisect(bins, d) - 1 for d in self.data] + count_map = Counter(idxs) + + bin_counts = [(b, count_map.get(i, 0)) for i, b in enumerate(bins)] + + return bin_counts + + def format_histogram(self, bins=None, **kw): + """Produces a textual histogram of the data, using fixed-width bins, + allowing for simple visualization, even in console environments. + + >>> data = list(range(20)) + list(range(5, 15)) + [10] + >>> print(Stats(data).format_histogram(width=30)) + 0.0: 5 ######### + 4.4: 8 ############### + 8.9: 11 #################### + 13.3: 5 ######### + 17.8: 2 #### + + In this histogram, five values are between 0.0 and 4.4, eight + are between 4.4 and 8.9, and two values lie between 17.8 and + the max. + + You can specify the number of bins, or provide a list of + bin boundaries themselves. If no bins are provided, as in the + example above, `Freedman's algorithm`_ for bin selection is + used. + + Args: + bins (int): Maximum number of bins for the + histogram. Also accepts a list of floating-point + bin boundaries. If the minimum boundary is still + greater than the minimum value in the data, that + boundary will be implicitly added. Defaults to the bin + boundaries returned by `Freedman's algorithm`_. + bin_digits (int): Number of digits to round each bin + to. Note that bins are always rounded down to avoid + clipping any data. Defaults to 1. + width (int): integer number of columns in the longest line + in the histogram. Defaults to console width on Python + 3.3+, or 80 if that is not available. + format_bin (callable): Called on each bin to create a + label for the final output. Use this function to add + units, such as "ms" for milliseconds. + + Should you want something more programmatically reusable, see + the :meth:`~Stats.get_histogram_counts` method, the output of + is used by format_histogram. The :meth:`~Stats.describe` + method is another useful summarization method, albeit less + visual. + + .. _Freedman's algorithm: https://en.wikipedia.org/wiki/Freedman%E2%80%93Diaconis_rule + """ + width = kw.pop('width', None) + format_bin = kw.pop('format_bin', None) + bin_counts = self.get_histogram_counts(bins=bins, **kw) + return format_histogram_counts(bin_counts, + width=width, + format_bin=format_bin) + + def describe(self, quantiles=None, format=None): + """Provides standard summary statistics for the data in the Stats + object, in one of several convenient formats. + + Args: + quantiles (list): A list of numeric values to use as + quantiles in the resulting summary. All values must be + 0.0-1.0, with 0.5 representing the median. Defaults to + ``[0.25, 0.5, 0.75]``, representing the standard + quartiles. + format (str): Controls the return type of the function, + with one of three valid values: ``"dict"`` gives back + a :class:`dict` with the appropriate keys and + values. ``"list"`` is a list of key-value pairs in an + order suitable to pass to an OrderedDict or HTML + table. ``"text"`` converts the values to text suitable + for printing, as seen below. + + Here is the information returned by a default ``describe``, as + presented in the ``"text"`` format: + + >>> stats = Stats(range(1, 8)) + >>> print(stats.describe(format='text')) + count: 7 + mean: 4.0 + std_dev: 2.0 + mad: 2.0 + min: 1 + 0.25: 2.5 + 0.5: 4 + 0.75: 5.5 + max: 7 + + For more advanced descriptive statistics, check out my blog + post on the topic `Statistics for Software + `_. + + """ + if format is None: + format = 'dict' + elif format not in ('dict', 'list', 'text'): + raise ValueError('invalid format for describe,' + ' expected one of "dict"/"list"/"text", not %r' + % format) + quantiles = quantiles or [0.25, 0.5, 0.75] + q_items = [] + for q in quantiles: + q_val = self.get_quantile(q) + q_items.append((str(q), q_val)) + + items = [('count', self.count), + ('mean', self.mean), + ('std_dev', self.std_dev), + ('mad', self.mad), + ('min', self.min)] + + items.extend(q_items) + items.append(('max', self.max)) + if format == 'dict': + ret = dict(items) + elif format == 'list': + ret = items + elif format == 'text': + ret = '\n'.join(['{}{}'.format((label + ':').ljust(10), val) + for label, val in items]) + return ret + + +def describe(data, quantiles=None, format=None): + """A convenience function to get standard summary statistics useful + for describing most data. See :meth:`Stats.describe` for more + details. + + >>> print(describe(range(7), format='text')) + count: 7 + mean: 3.0 + std_dev: 2.0 + mad: 2.0 + min: 0 + 0.25: 1.5 + 0.5: 3 + 0.75: 4.5 + max: 6 + + See :meth:`Stats.format_histogram` for another very useful + summarization that uses textual visualization. + """ + return Stats(data).describe(quantiles=quantiles, format=format) + + +def _get_conv_func(attr_name): + def stats_helper(data, default=0.0): + return getattr(Stats(data, default=default, use_copy=False), + attr_name) + return stats_helper + + +for attr_name, attr in list(Stats.__dict__.items()): + if isinstance(attr, _StatsProperty): + if attr_name in ('max', 'min', 'count'): # don't shadow builtins + continue + if attr_name in ('mad',): # convenience aliases + continue + func = _get_conv_func(attr_name) + func.__doc__ = attr.func.__doc__ + globals()[attr_name] = func + delattr(Stats, '_calc_' + attr_name) +# cleanup +del attr +del attr_name +del func + + +def format_histogram_counts(bin_counts, width=None, format_bin=None): + """The formatting logic behind :meth:`Stats.format_histogram`, which + takes the output of :meth:`Stats.get_histogram_counts`, and passes + them to this function. + + Args: + bin_counts (list): A list of bin values to counts. + width (int): Number of character columns in the text output, + defaults to 80 or console width in Python 3.3+. + format_bin (callable): Used to convert bin values into string + labels. + """ + lines = [] + if not format_bin: + format_bin = lambda v: v + if not width: + try: + import shutil # python 3 convenience + width = shutil.get_terminal_size()[0] + except Exception: + width = 80 + + bins = [b for b, _ in bin_counts] + count_max = max([count for _, count in bin_counts]) + count_cols = len(str(count_max)) + + labels = ['%s' % format_bin(b) for b in bins] + label_cols = max([len(l) for l in labels]) + tmp_line = '{}: {} #'.format('x' * label_cols, count_max) + + bar_cols = max(width - len(tmp_line), 3) + line_k = float(bar_cols) / count_max + tmpl = "{label:>{label_cols}}: {count:>{count_cols}} {bar}" + for label, (bin_val, count) in zip(labels, bin_counts): + bar_len = int(round(count * line_k)) + bar = ('#' * bar_len) or '|' + line = tmpl.format(label=label, + label_cols=label_cols, + count=count, + count_cols=count_cols, + bar=bar) + lines.append(line) + + return '\n'.join(lines) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/strutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/strutils.py new file mode 100644 index 0000000000000000000000000000000000000000..1d43f2b0a1441a487a42e1885545a9fe531d5764 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/strutils.py @@ -0,0 +1,1289 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""So much practical programming involves string manipulation, which +Python readily accommodates. Still, there are dozens of basic and +common capabilities missing from the standard library, several of them +provided by ``strutils``. +""" + + +import builtins +import re +import sys +import uuid +import zlib +import string +import unicodedata +import collections +from collections.abc import Mapping +from gzip import GzipFile +from html.parser import HTMLParser +from html import entities as htmlentitydefs +from io import BytesIO as StringIO + + +__all__ = ['camel2under', 'under2camel', 'slugify', 'split_punct_ws', + 'unit_len', 'ordinalize', 'cardinalize', 'pluralize', 'singularize', + 'asciify', 'is_ascii', 'is_uuid', 'html2text', 'strip_ansi', + 'bytes2human', 'find_hashtags', 'a10n', 'gzip_bytes', 'gunzip_bytes', + 'iter_splitlines', 'indent', 'escape_shell_args', + 'args2cmd', 'args2sh', 'parse_int_list', 'format_int_list', + 'complement_int_list', 'int_ranges_from_int_list', 'MultiReplace', + 'multi_replace', 'unwrap_text', 'removeprefix'] + + +_punct_ws_str = string.punctuation + string.whitespace +_punct_re = re.compile('[' + _punct_ws_str + ']+') +_camel2under_re = re.compile('((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))') + + +def camel2under(camel_string): + """Converts a camelcased string to underscores. Useful for turning a + class name into a function name. + + >>> camel2under('BasicParseTest') + 'basic_parse_test' + """ + return _camel2under_re.sub(r'_\1', camel_string).lower() + + +def under2camel(under_string): + """Converts an underscored string to camelcased. Useful for turning a + function name into a class name. + + >>> under2camel('complex_tokenizer') + 'ComplexTokenizer' + """ + return ''.join(w.capitalize() or '_' for w in under_string.split('_')) + + +def slugify(text, delim='_', lower=True, ascii=False): + """ + A basic function that turns text full of scary characters + (i.e., punctuation and whitespace), into a relatively safe + lowercased string separated only by the delimiter specified + by *delim*, which defaults to ``_``. + + The *ascii* convenience flag will :func:`asciify` the slug if + you require ascii-only slugs. + + >>> slugify('First post! Hi!!!!~1 ') + 'first_post_hi_1' + + >>> slugify("Kurt Gödel's pretty cool.", ascii=True) == \ + b'kurt_goedel_s_pretty_cool' + True + + """ + ret = delim.join(split_punct_ws(text)) or delim if text else '' + if ascii: + ret = asciify(ret) + if lower: + ret = ret.lower() + return ret + + +def split_punct_ws(text): + """While :meth:`str.split` will split on whitespace, + :func:`split_punct_ws` will split on punctuation and + whitespace. This used internally by :func:`slugify`, above. + + >>> split_punct_ws('First post! Hi!!!!~1 ') + ['First', 'post', 'Hi', '1'] + """ + return [w for w in _punct_re.split(text) if w] + + +def unit_len(sized_iterable, unit_noun='item'): # TODO: len_units()/unitize()? + """Returns a plain-English description of an iterable's + :func:`len()`, conditionally pluralized with :func:`cardinalize`, + detailed below. + + >>> print(unit_len(range(10), 'number')) + 10 numbers + >>> print(unit_len('aeiou', 'vowel')) + 5 vowels + >>> print(unit_len([], 'worry')) + No worries + """ + count = len(sized_iterable) + units = cardinalize(unit_noun, count) + if count: + return f'{count} {units}' + return f'No {units}' + + +_ORDINAL_MAP = {'1': 'st', + '2': 'nd', + '3': 'rd'} # 'th' is the default + + +def ordinalize(number, ext_only=False): + """Turns *number* into its cardinal form, i.e., 1st, 2nd, + 3rd, 4th, etc. If the last character isn't a digit, it returns the + string value unchanged. + + Args: + number (int or str): Number to be cardinalized. + ext_only (bool): Whether to return only the suffix. Default ``False``. + + >>> print(ordinalize(1)) + 1st + >>> print(ordinalize(3694839230)) + 3694839230th + >>> print(ordinalize('hi')) + hi + >>> print(ordinalize(1515)) + 1515th + """ + numstr, ext = str(number), '' + if numstr and numstr[-1] in string.digits: + try: + # first check for teens + if numstr[-2] == '1': + ext = 'th' + else: + # all other cases + ext = _ORDINAL_MAP.get(numstr[-1], 'th') + except IndexError: + # single digit numbers (will reach here based on [-2] above) + ext = _ORDINAL_MAP.get(numstr[-1], 'th') + if ext_only: + return ext + else: + return numstr + ext + + +def cardinalize(unit_noun, count): + """Conditionally pluralizes a singular word *unit_noun* if + *count* is not one, preserving case when possible. + + >>> vowels = 'aeiou' + >>> print(len(vowels), cardinalize('vowel', len(vowels))) + 5 vowels + >>> print(3, cardinalize('Wish', 3)) + 3 Wishes + """ + if count == 1: + return unit_noun + return pluralize(unit_noun) + + +def singularize(word): + """Semi-intelligently converts an English plural *word* to its + singular form, preserving case pattern. + + >>> singularize('chances') + 'chance' + >>> singularize('Activities') + 'Activity' + >>> singularize('Glasses') + 'Glass' + >>> singularize('FEET') + 'FOOT' + + """ + orig_word, word = word, word.strip().lower() + if not word or word in _IRR_S2P: + return orig_word + + irr_singular = _IRR_P2S.get(word) + if irr_singular: + singular = irr_singular + elif not word.endswith('s'): + return orig_word + elif len(word) == 2: + singular = word[:-1] # or just return word? + elif word.endswith('ies') and word[-4:-3] not in 'aeiou': + singular = word[:-3] + 'y' + elif word.endswith('es') and word[-3] == 's': + singular = word[:-2] + else: + singular = word[:-1] + return _match_case(orig_word, singular) + + +def pluralize(word): + """Semi-intelligently converts an English *word* from singular form to + plural, preserving case pattern. + + >>> pluralize('friend') + 'friends' + >>> pluralize('enemy') + 'enemies' + >>> pluralize('Sheep') + 'Sheep' + """ + orig_word, word = word, word.strip().lower() + if not word or word in _IRR_P2S: + return orig_word + irr_plural = _IRR_S2P.get(word) + if irr_plural: + plural = irr_plural + elif word.endswith('y') and word[-2:-1] not in 'aeiou': + plural = word[:-1] + 'ies' + elif word[-1] == 's' or word.endswith('ch') or word.endswith('sh'): + plural = word if word.endswith('es') else word + 'es' + else: + plural = word + 's' + return _match_case(orig_word, plural) + + +def _match_case(master, disciple): + if not master.strip(): + return disciple + if master.lower() == master: + return disciple.lower() + elif master.upper() == master: + return disciple.upper() + elif master.title() == master: + return disciple.title() + return disciple + + +# Singular to plural map of irregular pluralizations +_IRR_S2P = {'addendum': 'addenda', 'alga': 'algae', 'alumna': 'alumnae', + 'alumnus': 'alumni', 'analysis': 'analyses', 'antenna': 'antennae', + 'appendix': 'appendices', 'axis': 'axes', 'bacillus': 'bacilli', + 'bacterium': 'bacteria', 'basis': 'bases', 'beau': 'beaux', + 'bison': 'bison', 'bureau': 'bureaus', 'cactus': 'cacti', + 'calf': 'calves', 'child': 'children', 'corps': 'corps', + 'corpus': 'corpora', 'crisis': 'crises', 'criterion': 'criteria', + 'curriculum': 'curricula', 'datum': 'data', 'deer': 'deer', + 'diagnosis': 'diagnoses', 'die': 'dice', 'dwarf': 'dwarves', + 'echo': 'echoes', 'elf': 'elves', 'ellipsis': 'ellipses', + 'embargo': 'embargoes', 'emphasis': 'emphases', 'erratum': 'errata', + 'fireman': 'firemen', 'fish': 'fish', 'focus': 'foci', + 'foot': 'feet', 'formula': 'formulae', 'formula': 'formulas', + 'fungus': 'fungi', 'genus': 'genera', 'goose': 'geese', + 'half': 'halves', 'hero': 'heroes', 'hippopotamus': 'hippopotami', + 'hoof': 'hooves', 'hypothesis': 'hypotheses', 'index': 'indices', + 'knife': 'knives', 'leaf': 'leaves', 'life': 'lives', + 'loaf': 'loaves', 'louse': 'lice', 'man': 'men', + 'matrix': 'matrices', 'means': 'means', 'medium': 'media', + 'memorandum': 'memoranda', 'millennium': 'milennia', 'moose': 'moose', + 'mosquito': 'mosquitoes', 'mouse': 'mice', 'nebula': 'nebulae', + 'neurosis': 'neuroses', 'nucleus': 'nuclei', 'oasis': 'oases', + 'octopus': 'octopi', 'offspring': 'offspring', 'ovum': 'ova', + 'ox': 'oxen', 'paralysis': 'paralyses', 'parenthesis': 'parentheses', + 'person': 'people', 'phenomenon': 'phenomena', 'potato': 'potatoes', + 'radius': 'radii', 'scarf': 'scarves', 'scissors': 'scissors', + 'self': 'selves', 'sense': 'senses', 'series': 'series', 'sheep': + 'sheep', 'shelf': 'shelves', 'species': 'species', 'stimulus': + 'stimuli', 'stratum': 'strata', 'syllabus': 'syllabi', 'symposium': + 'symposia', 'synopsis': 'synopses', 'synthesis': 'syntheses', + 'tableau': 'tableaux', 'that': 'those', 'thesis': 'theses', + 'thief': 'thieves', 'this': 'these', 'tomato': 'tomatoes', 'tooth': + 'teeth', 'torpedo': 'torpedoes', 'vertebra': 'vertebrae', 'veto': + 'vetoes', 'vita': 'vitae', 'watch': 'watches', 'wife': 'wives', + 'wolf': 'wolves', 'woman': 'women'} + + +# Reverse index of the above +_IRR_P2S = {v: k for k, v in _IRR_S2P.items()} + +HASHTAG_RE = re.compile(r"(?:^|\s)[##]{1}(\w+)", re.UNICODE) + + +def find_hashtags(string): + """Finds and returns all hashtags in a string, with the hashmark + removed. Supports full-width hashmarks for Asian languages and + does not false-positive on URL anchors. + + >>> find_hashtags('#atag http://asite/#ananchor') + ['atag'] + + ``find_hashtags`` also works with unicode hashtags. + """ + + # the following works, doctest just struggles with it + # >>> find_hashtags(u"can't get enough of that dignity chicken #肯德基 woo") + # [u'\u80af\u5fb7\u57fa'] + return HASHTAG_RE.findall(string) + + +def a10n(string): + """That thing where "internationalization" becomes "i18n", what's it + called? Abbreviation? Oh wait, no: ``a10n``. (It's actually a form + of `numeronym`_.) + + >>> a10n('abbreviation') + 'a10n' + >>> a10n('internationalization') + 'i18n' + >>> a10n('') + '' + + .. _numeronym: http://en.wikipedia.org/wiki/Numeronym + """ + if len(string) < 3: + return string + return f'{string[0]}{len(string[1:-1])}{string[-1]}' + + +# Based on https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences +ANSI_SEQUENCES = re.compile(r''' + \x1B # Sequence starts with ESC, i.e. hex 0x1B + (?: + [@-Z\\-_] # Second byte: + # all 0x40–0x5F range but CSI char, i.e ASCII @A–Z\]^_ + | # Or + \[ # CSI sequences, starting with [ + [0-?]* # Parameter bytes: + # range 0x30–0x3F, ASCII 0–9:;<=>? + [ -/]* # Intermediate bytes: + # range 0x20–0x2F, ASCII space and !"#$%&'()*+,-./ + [@-~] # Final byte + # range 0x40–0x7E, ASCII @A–Z[\]^_`a–z{|}~ + ) +''', re.VERBOSE) + + +def strip_ansi(text): + """Strips ANSI escape codes from *text*. Useful for the occasional + time when a log or redirected output accidentally captures console + color codes and the like. + + >>> strip_ansi('\x1b[0m\x1b[1;36mart\x1b[46;34m') + 'art' + + Supports str, bytes and bytearray content as input. Returns the + same type as the input. + + There's a lot of ANSI art available for testing on `sixteencolors.net`_. + This function does not interpret or render ANSI art, but you can do so with + `ansi2img`_ or `escapes.js`_. + + .. _sixteencolors.net: http://sixteencolors.net + .. _ansi2img: http://www.bedroomlan.org/projects/ansi2img + .. _escapes.js: https://github.com/atdt/escapes.js + """ + # TODO: move to cliutils.py + + # Transform any ASCII-like content to unicode to allow regex to match, and + # save input type for later. + target_type = None + # Unicode type aliased to str is code-smell for Boltons in Python 3 env. + if isinstance(text, (bytes, bytearray)): + target_type = type(text) + text = text.decode('utf-8') + + cleaned = ANSI_SEQUENCES.sub('', text) + + # Transform back the result to the same bytearray type provided by the user. + if target_type and target_type != type(cleaned): + cleaned = target_type(cleaned, 'utf-8') + + return cleaned + + +def asciify(text, ignore=False): + """Converts a unicode or bytestring, *text*, into a bytestring with + just ascii characters. Performs basic deaccenting for all you + Europhiles out there. + + Also, a gentle reminder that this is a **utility**, primarily meant + for slugification. Whenever possible, make your application work + **with** unicode, not against it. + + Args: + text (str): The string to be asciified. + ignore (bool): Configures final encoding to ignore remaining + unasciified string instead of replacing it. + + >>> asciify('Beyoncé') == b'Beyonce' + True + """ + try: + try: + return text.encode('ascii') + except UnicodeDecodeError: + # this usually means you passed in a non-unicode string + text = text.decode('utf-8') + return text.encode('ascii') + except UnicodeEncodeError: + mode = 'replace' + if ignore: + mode = 'ignore' + transd = unicodedata.normalize('NFKD', text.translate(DEACCENT_MAP)) + ret = transd.encode('ascii', mode) + return ret + + +def is_ascii(text): + """Check if a string or bytestring, *text*, is composed of ascii + characters only. Raises :exc:`ValueError` if argument is not text. + + Args: + text (str): The string to be checked. + + >>> is_ascii('Beyoncé') + False + >>> is_ascii('Beyonce') + True + """ + if isinstance(text, str): + try: + text.encode('ascii') + except UnicodeEncodeError: + return False + elif isinstance(text, bytes): + try: + text.decode('ascii') + except UnicodeDecodeError: + return False + else: + raise ValueError('expected text or bytes, not %r' % type(text)) + return True + + +class DeaccenterDict(dict): + "A small caching dictionary for deaccenting." + def __missing__(self, key): + ch = self.get(key) + if ch is not None: + return ch + try: + de = unicodedata.decomposition(chr(key)) + p1, _, p2 = de.rpartition(' ') + if int(p2, 16) == 0x308: + ch = self.get(key) + else: + ch = int(p1, 16) + except (IndexError, ValueError): + ch = self.get(key, key) + self[key] = ch + return ch + + +# http://chmullig.com/2009/12/python-unicode-ascii-ifier/ +# For something more complete, investigate the unidecode +# or isounidecode packages, which are capable of performing +# crude transliteration. +_BASE_DEACCENT_MAP = { + 0xc6: "AE", # Æ LATIN CAPITAL LETTER AE + 0xd0: "D", # Ð LATIN CAPITAL LETTER ETH + 0xd8: "OE", # Ø LATIN CAPITAL LETTER O WITH STROKE + 0xde: "Th", # Þ LATIN CAPITAL LETTER THORN + 0xc4: 'Ae', # Ä LATIN CAPITAL LETTER A WITH DIAERESIS + 0xd6: 'Oe', # Ö LATIN CAPITAL LETTER O WITH DIAERESIS + 0xdc: 'Ue', # Ü LATIN CAPITAL LETTER U WITH DIAERESIS + 0xc0: "A", # À LATIN CAPITAL LETTER A WITH GRAVE + 0xc1: "A", # Á LATIN CAPITAL LETTER A WITH ACUTE + 0xc3: "A", # Ã LATIN CAPITAL LETTER A WITH TILDE + 0xc7: "C", # Ç LATIN CAPITAL LETTER C WITH CEDILLA + 0xc8: "E", # È LATIN CAPITAL LETTER E WITH GRAVE + 0xc9: "E", # É LATIN CAPITAL LETTER E WITH ACUTE + 0xca: "E", # Ê LATIN CAPITAL LETTER E WITH CIRCUMFLEX + 0xcc: "I", # Ì LATIN CAPITAL LETTER I WITH GRAVE + 0xcd: "I", # Í LATIN CAPITAL LETTER I WITH ACUTE + 0xd2: "O", # Ò LATIN CAPITAL LETTER O WITH GRAVE + 0xd3: "O", # Ó LATIN CAPITAL LETTER O WITH ACUTE + 0xd5: "O", # Õ LATIN CAPITAL LETTER O WITH TILDE + 0xd9: "U", # Ù LATIN CAPITAL LETTER U WITH GRAVE + 0xda: "U", # Ú LATIN CAPITAL LETTER U WITH ACUTE + 0xdf: "ss", # ß LATIN SMALL LETTER SHARP S + 0xe6: "ae", # æ LATIN SMALL LETTER AE + 0xf0: "d", # ð LATIN SMALL LETTER ETH + 0xf8: "oe", # ø LATIN SMALL LETTER O WITH STROKE + 0xfe: "th", # þ LATIN SMALL LETTER THORN, + 0xe4: 'ae', # ä LATIN SMALL LETTER A WITH DIAERESIS + 0xf6: 'oe', # ö LATIN SMALL LETTER O WITH DIAERESIS + 0xfc: 'ue', # ü LATIN SMALL LETTER U WITH DIAERESIS + 0xe0: "a", # à LATIN SMALL LETTER A WITH GRAVE + 0xe1: "a", # á LATIN SMALL LETTER A WITH ACUTE + 0xe3: "a", # ã LATIN SMALL LETTER A WITH TILDE + 0xe7: "c", # ç LATIN SMALL LETTER C WITH CEDILLA + 0xe8: "e", # è LATIN SMALL LETTER E WITH GRAVE + 0xe9: "e", # é LATIN SMALL LETTER E WITH ACUTE + 0xea: "e", # ê LATIN SMALL LETTER E WITH CIRCUMFLEX + 0xec: "i", # ì LATIN SMALL LETTER I WITH GRAVE + 0xed: "i", # í LATIN SMALL LETTER I WITH ACUTE + 0xf2: "o", # ò LATIN SMALL LETTER O WITH GRAVE + 0xf3: "o", # ó LATIN SMALL LETTER O WITH ACUTE + 0xf5: "o", # õ LATIN SMALL LETTER O WITH TILDE + 0xf9: "u", # ù LATIN SMALL LETTER U WITH GRAVE + 0xfa: "u", # ú LATIN SMALL LETTER U WITH ACUTE + 0x2018: "'", # ‘ LEFT SINGLE QUOTATION MARK + 0x2019: "'", # ’ RIGHT SINGLE QUOTATION MARK + 0x201c: '"', # “ LEFT DOUBLE QUOTATION MARK + 0x201d: '"', # ” RIGHT DOUBLE QUOTATION MARK + } + + +DEACCENT_MAP = DeaccenterDict(_BASE_DEACCENT_MAP) + + +_SIZE_SYMBOLS = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') +_SIZE_BOUNDS = [(1024 ** i, sym) for i, sym in enumerate(_SIZE_SYMBOLS)] +_SIZE_RANGES = list(zip(_SIZE_BOUNDS, _SIZE_BOUNDS[1:])) + + +def bytes2human(nbytes, ndigits=0): + """Turns an integer value of *nbytes* into a human readable format. Set + *ndigits* to control how many digits after the decimal point + should be shown (default ``0``). + + >>> bytes2human(128991) + '126K' + >>> bytes2human(100001221) + '95M' + >>> bytes2human(0, 2) + '0.00B' + """ + abs_bytes = abs(nbytes) + for (size, symbol), (next_size, next_symbol) in _SIZE_RANGES: + if abs_bytes <= next_size: + break + hnbytes = float(nbytes) / size + return '{hnbytes:.{ndigits}f}{symbol}'.format(hnbytes=hnbytes, + ndigits=ndigits, + symbol=symbol) + + +class HTMLTextExtractor(HTMLParser): + def __init__(self): + self.reset() + self.strict = False + self.convert_charrefs = True + self.result = [] + + def handle_data(self, d): + self.result.append(d) + + def handle_charref(self, number): + if number[0] == 'x' or number[0] == 'X': + codepoint = int(number[1:], 16) + else: + codepoint = int(number) + self.result.append(chr(codepoint)) + + def handle_entityref(self, name): + try: + codepoint = htmlentitydefs.name2codepoint[name] + except KeyError: + self.result.append('&' + name + ';') + else: + self.result.append(chr(codepoint)) + + def get_text(self): + return ''.join(self.result) + + +def html2text(html): + """Strips tags from HTML text, returning markup-free text. Also, does + a best effort replacement of entities like " " + + >>> r = html2text(u'Test &(\u0394ημώ)') + >>> r == u'Test &(\u0394\u03b7\u03bc\u03ce)' + True + """ + # based on answers to http://stackoverflow.com/questions/753052/ + s = HTMLTextExtractor() + s.feed(html) + return s.get_text() + + +_EMPTY_GZIP_BYTES = b'\x1f\x8b\x08\x089\xf3\xb9U\x00\x03empty\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00' +_NON_EMPTY_GZIP_BYTES = b'\x1f\x8b\x08\x08\xbc\xf7\xb9U\x00\x03not_empty\x00K\xaa,I-N\xcc\xc8\xafT\xe4\x02\x00\xf3nb\xbf\x0b\x00\x00\x00' + + +def gunzip_bytes(bytestring): + """The :mod:`gzip` module is great if you have a file or file-like + object, but what if you just have bytes. StringIO is one + possibility, but it's often faster, easier, and simpler to just + use this one-liner. Use this tried-and-true utility function to + decompress gzip from bytes. + + >>> gunzip_bytes(_EMPTY_GZIP_BYTES) == b'' + True + >>> gunzip_bytes(_NON_EMPTY_GZIP_BYTES).rstrip() == b'bytesahoy!' + True + """ + return zlib.decompress(bytestring, 16 + zlib.MAX_WBITS) + + +def gzip_bytes(bytestring, level=6): + """Turn some bytes into some compressed bytes. + + >>> len(gzip_bytes(b'a' * 10000)) + 46 + + Args: + bytestring (bytes): Bytes to be compressed + level (int): An integer, 1-9, controlling the + speed/compression. 1 is fastest, least compressed, 9 is + slowest, but most compressed. + + Note that all levels of gzip are pretty fast these days, though + it's not really a competitor in compression, at any level. + """ + out = StringIO() + f = GzipFile(fileobj=out, mode='wb', compresslevel=level) + f.write(bytestring) + f.close() + return out.getvalue() + + + +_line_ending_re = re.compile(r'(\r\n|\n|\x0b|\f|\r|\x85|\x2028|\x2029)', + re.UNICODE) + + +def iter_splitlines(text): + r"""Like :meth:`str.splitlines`, but returns an iterator of lines + instead of a list. Also similar to :meth:`file.next`, as that also + lazily reads and yields lines from a file. + + This function works with a variety of line endings, but as always, + be careful when mixing line endings within a file. + + >>> list(iter_splitlines('\nhi\nbye\n')) + ['', 'hi', 'bye', ''] + >>> list(iter_splitlines('\r\nhi\rbye\r\n')) + ['', 'hi', 'bye', ''] + >>> list(iter_splitlines('')) + [] + """ + prev_end, len_text = 0, len(text) + # print('last: %r' % last_idx) + # start, end = None, None + for match in _line_ending_re.finditer(text): + start, end = match.start(1), match.end(1) + # print(start, end) + if prev_end <= start: + yield text[prev_end:start] + if end == len_text: + yield '' + prev_end = end + tail = text[prev_end:] + if tail: + yield tail + return + + +def indent(text, margin, newline='\n', key=bool): + """The missing counterpart to the built-in :func:`textwrap.dedent`. + + Args: + text (str): The text to indent. + margin (str): The string to prepend to each line. + newline (str): The newline used to rejoin the lines (default: ``\\n``) + key (callable): Called on each line to determine whether to + indent it. Default: :class:`bool`, to ensure that empty lines do + not get whitespace added. + """ + indented_lines = [(margin + line if key(line) else line) + for line in iter_splitlines(text)] + return newline.join(indented_lines) + + +def is_uuid(obj, version=4): + """Check the argument is either a valid UUID object or string. + + Args: + obj (object): The test target. Strings and UUID objects supported. + version (int): The target UUID version, set to 0 to skip version check. + + >>> is_uuid('e682ccca-5a4c-4ef2-9711-73f9ad1e15ea') + True + >>> is_uuid('0221f0d9-d4b9-11e5-a478-10ddb1c2feb9') + False + >>> is_uuid('0221f0d9-d4b9-11e5-a478-10ddb1c2feb9', version=1) + True + """ + if not isinstance(obj, uuid.UUID): + try: + obj = uuid.UUID(obj) + except (TypeError, ValueError, AttributeError): + return False + if version and obj.version != int(version): + return False + return True + + +def escape_shell_args(args, sep=' ', style=None): + """Returns an escaped version of each string in *args*, according to + *style*. + + Args: + args (list): A list of arguments to escape and join together + sep (str): The separator used to join the escaped arguments. + style (str): The style of escaping to use. Can be one of + ``cmd`` or ``sh``, geared toward Windows and Linux/BSD/etc., + respectively. If *style* is ``None``, then it is picked + according to the system platform. + + See :func:`args2cmd` and :func:`args2sh` for details and example + output for each style. + """ + if not style: + style = 'cmd' if sys.platform == 'win32' else 'sh' + + if style == 'sh': + return args2sh(args, sep=sep) + elif style == 'cmd': + return args2cmd(args, sep=sep) + + raise ValueError("style expected one of 'cmd' or 'sh', not %r" % style) + + +_find_sh_unsafe = re.compile(r'[^a-zA-Z0-9_@%+=:,./-]').search + + +def args2sh(args, sep=' '): + """Return a shell-escaped string version of *args*, separated by + *sep*, based on the rules of sh, bash, and other shells in the + Linux/BSD/MacOS ecosystem. + + >>> print(args2sh(['aa', '[bb]', "cc'cc", 'dd"dd'])) + aa '[bb]' 'cc'"'"'cc' 'dd"dd' + + As you can see, arguments with no special characters are not + escaped, arguments with special characters are quoted with single + quotes, and single quotes themselves are quoted with double + quotes. Double quotes are handled like any other special + character. + + Based on code from the :mod:`pipes`/:mod:`shlex` modules. Also + note that :mod:`shlex` and :mod:`argparse` have functions to split + and parse strings escaped in this manner. + """ + ret_list = [] + + for arg in args: + if not arg: + ret_list.append("''") + continue + if _find_sh_unsafe(arg) is None: + ret_list.append(arg) + continue + # use single quotes, and put single quotes into double quotes + # the string $'b is then quoted as '$'"'"'b' + ret_list.append("'" + arg.replace("'", "'\"'\"'") + "'") + + return ' '.join(ret_list) + + +def args2cmd(args, sep=' '): + r"""Return a shell-escaped string version of *args*, separated by + *sep*, using the same rules as the Microsoft C runtime. + + >>> print(args2cmd(['aa', '[bb]', "cc'cc", 'dd"dd'])) + aa [bb] cc'cc dd\"dd + + As you can see, escaping is through backslashing and not quoting, + and double quotes are the only special character. See the comment + in the code for more details. Based on internal code from the + :mod:`subprocess` module. + + """ + # technique description from subprocess below + """ + 1) Arguments are delimited by white space, which is either a + space or a tab. + + 2) A string surrounded by double quotation marks is + interpreted as a single argument, regardless of white space + contained within. A quoted string can be embedded in an + argument. + + 3) A double quotation mark preceded by a backslash is + interpreted as a literal double quotation mark. + + 4) Backslashes are interpreted literally, unless they + immediately precede a double quotation mark. + + 5) If backslashes immediately precede a double quotation mark, + every pair of backslashes is interpreted as a literal + backslash. If the number of backslashes is odd, the last + backslash escapes the next double quotation mark as + described in rule 3. + + See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx + or search http://msdn.microsoft.com for + "Parsing C++ Command-Line Arguments" + """ + result = [] + needquote = False + for arg in args: + bs_buf = [] + + # Add a space to separate this argument from the others + if result: + result.append(' ') + + needquote = (" " in arg) or ("\t" in arg) or not arg + if needquote: + result.append('"') + + for c in arg: + if c == '\\': + # Don't know if we need to double yet. + bs_buf.append(c) + elif c == '"': + # Double backslashes. + result.append('\\' * len(bs_buf)*2) + bs_buf = [] + result.append('\\"') + else: + # Normal char + if bs_buf: + result.extend(bs_buf) + bs_buf = [] + result.append(c) + + # Add remaining backslashes, if any. + if bs_buf: + result.extend(bs_buf) + + if needquote: + result.extend(bs_buf) + result.append('"') + + return ''.join(result) + + +def parse_int_list(range_string, delim=',', range_delim='-'): + """Returns a sorted list of positive integers based on + *range_string*. Reverse of :func:`format_int_list`. + + Args: + range_string (str): String of comma separated positive + integers or ranges (e.g. '1,2,4-6,8'). Typical of a custom + page range string used in printer dialogs. + delim (char): Defaults to ','. Separates integers and + contiguous ranges of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous + range of integers. + + >>> parse_int_list('1,3,5-8,10-11,15') + [1, 3, 5, 6, 7, 8, 10, 11, 15] + + """ + output = [] + + for x in range_string.strip().split(delim): + + # Range + if range_delim in x: + range_limits = list(map(int, x.split(range_delim))) + output += list(range(min(range_limits), max(range_limits)+1)) + + # Empty String + elif not x: + continue + + # Integer + else: + output.append(int(x)) + + return sorted(output) + + +def format_int_list(int_list, delim=',', range_delim='-', delim_space=False): + """Returns a sorted range string from a list of positive integers + (*int_list*). Contiguous ranges of integers are collapsed to min + and max values. Reverse of :func:`parse_int_list`. + + Args: + int_list (list): List of positive integers to be converted + into a range string (e.g. [1,2,4,5,6,8]). + delim (char): Defaults to ','. Separates integers and + contiguous ranges of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous + range of integers. + delim_space (bool): Defaults to ``False``. If ``True``, adds a + space after all *delim* characters. + + >>> format_int_list([1,3,5,6,7,8,10,11,15]) + '1,3,5-8,10-11,15' + + """ + output = [] + contig_range = collections.deque() + + for x in sorted(int_list): + + # Handle current (and first) value. + if len(contig_range) < 1: + contig_range.append(x) + + # Handle current value, given multiple previous values are contiguous. + elif len(contig_range) > 1: + delta = x - contig_range[-1] + + # Current value is contiguous. + if delta == 1: + contig_range.append(x) + + # Current value is non-contiguous. + elif delta > 1: + range_substr = '{:d}{}{:d}'.format(min(contig_range), + range_delim, + max(contig_range)) + output.append(range_substr) + contig_range.clear() + contig_range.append(x) + + # Current value repeated. + else: + continue + + # Handle current value, given no previous contiguous integers + else: + delta = x - contig_range[0] + + # Current value is contiguous. + if delta == 1: + contig_range.append(x) + + # Current value is non-contiguous. + elif delta > 1: + output.append(f'{contig_range.popleft():d}') + contig_range.append(x) + + # Current value repeated. + else: + continue + + # Handle the last value. + else: + + # Last value is non-contiguous. + if len(contig_range) == 1: + output.append(f'{contig_range.popleft():d}') + contig_range.clear() + + # Last value is part of contiguous range. + elif len(contig_range) > 1: + range_substr = '{:d}{}{:d}'.format(min(contig_range), + range_delim, + max(contig_range)) + output.append(range_substr) + contig_range.clear() + + if delim_space: + output_str = (delim+' ').join(output) + else: + output_str = delim.join(output) + + return output_str + + +def complement_int_list( + range_string, range_start=0, range_end=None, + delim=',', range_delim='-'): + """ Returns range string that is the complement of the one provided as + *range_string* parameter. + + These range strings are of the kind produce by :func:`format_int_list`, and + parseable by :func:`parse_int_list`. + + Args: + range_string (str): String of comma separated positive integers or + ranges (e.g. '1,2,4-6,8'). Typical of a custom page range string + used in printer dialogs. + range_start (int): A positive integer from which to start the resulting + range. Value is inclusive. Defaults to ``0``. + range_end (int): A positive integer from which the produced range is + stopped. Value is exclusive. Defaults to the maximum value found in + the provided ``range_string``. + delim (char): Defaults to ','. Separates integers and contiguous ranges + of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous range of + integers. + + >>> complement_int_list('1,3,5-8,10-11,15') + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=0) + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=1) + '2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=2) + '2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=3) + '4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=15) + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=14) + '0,2,4,9,12-13' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=13) + '0,2,4,9,12' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=20) + '0,2,4,9,12-14,16-19' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=0) + '' + + >>> complement_int_list('1,3,5-8,10-11,15', range_start=-1) + '0,2,4,9,12-14' + + >>> complement_int_list('1,3,5-8,10-11,15', range_end=-1) + '' + + >>> complement_int_list('1,3,5-8', range_start=1, range_end=1) + '' + + >>> complement_int_list('1,3,5-8', range_start=2, range_end=2) + '' + + >>> complement_int_list('1,3,5-8', range_start=2, range_end=3) + '2' + + >>> complement_int_list('1,3,5-8', range_start=-10, range_end=-5) + '' + + >>> complement_int_list('1,3,5-8', range_start=20, range_end=10) + '' + + >>> complement_int_list('') + '' + """ + int_list = set(parse_int_list(range_string, delim, range_delim)) + if range_end is None: + if int_list: + range_end = max(int_list) + 1 + else: + range_end = range_start + complement_values = set( + range(range_end)) - int_list - set(range(range_start)) + return format_int_list(complement_values, delim, range_delim) + + +def int_ranges_from_int_list(range_string, delim=',', range_delim='-'): + """ Transform a string of ranges (*range_string*) into a tuple of tuples. + + Args: + range_string (str): String of comma separated positive integers or + ranges (e.g. '1,2,4-6,8'). Typical of a custom page range string + used in printer dialogs. + delim (char): Defaults to ','. Separates integers and contiguous ranges + of integers. + range_delim (char): Defaults to '-'. Indicates a contiguous range of + integers. + + >>> int_ranges_from_int_list('1,3,5-8,10-11,15') + ((1, 1), (3, 3), (5, 8), (10, 11), (15, 15)) + + >>> int_ranges_from_int_list('1') + ((1, 1),) + + >>> int_ranges_from_int_list('') + () + """ + int_tuples = [] + # Normalize the range string to our internal format for processing. + range_string = format_int_list( + parse_int_list(range_string, delim, range_delim)) + if range_string: + for bounds in range_string.split(','): + if '-' in bounds: + start, end = bounds.split('-') + else: + start, end = bounds, bounds + int_tuples.append((int(start), int(end))) + return tuple(int_tuples) + + +class MultiReplace: + """ + MultiReplace is a tool for doing multiple find/replace actions in one pass. + + Given a mapping of values to be replaced it allows for all of the matching + values to be replaced in a single pass which can save a lot of performance + on very large strings. In addition to simple replace, it also allows for + replacing based on regular expressions. + + Keyword Arguments: + + :type regex: bool + :param regex: Treat search keys as regular expressions [Default: False] + :type flags: int + :param flags: flags to pass to the regex engine during compile + + Dictionary Usage:: + + from boltons import strutils + s = strutils.MultiReplace({ + 'foo': 'zoo', + 'cat': 'hat', + 'bat': 'kraken' + }) + new = s.sub('The foo bar cat ate a bat') + new == 'The zoo bar hat ate a kraken' + + Iterable Usage:: + + from boltons import strutils + s = strutils.MultiReplace([ + ('foo', 'zoo'), + ('cat', 'hat'), + ('bat', 'kraken)' + ]) + new = s.sub('The foo bar cat ate a bat') + new == 'The zoo bar hat ate a kraken' + + + The constructor can be passed a dictionary or other mapping as well as + an iterable of tuples. If given an iterable, the substitution will be run + in the order the replacement values are specified in the iterable. This is + also true if it is given an OrderedDict. If given a dictionary then the + order will be non-deterministic:: + + >>> 'foo bar baz'.replace('foo', 'baz').replace('baz', 'bar') + 'bar bar bar' + >>> m = MultiReplace({'foo': 'baz', 'baz': 'bar'}) + >>> m.sub('foo bar baz') + 'baz bar bar' + + This is because the order of replacement can matter if you're inserting + something that might be replaced by a later substitution. Pay attention and + if you need to rely on order then consider using a list of tuples instead + of a dictionary. + """ + + def __init__(self, sub_map, **kwargs): + """Compile any regular expressions that have been passed.""" + options = { + 'regex': False, + 'flags': 0, + } + options.update(kwargs) + self.group_map = {} + regex_values = [] + + if isinstance(sub_map, Mapping): + sub_map = sub_map.items() + + for idx, vals in enumerate(sub_map): + group_name = f'group{idx}' + if isinstance(vals[0], str): + # If we're not treating input strings like a regex, escape it + if not options['regex']: + exp = re.escape(vals[0]) + else: + exp = vals[0] + else: + exp = vals[0].pattern + + regex_values.append(f'(?P<{group_name}>{exp})') + self.group_map[group_name] = vals[1] + + self.combined_pattern = re.compile( + '|'.join(regex_values), + flags=options['flags'] + ) + + def _get_value(self, match): + """Given a match object find replacement value.""" + group_dict = match.groupdict() + key = [x for x in group_dict if group_dict[x]][0] + return self.group_map[key] + + def sub(self, text): + """ + Run substitutions on the input text. + + Given an input string, run all substitutions given in the + constructor. + """ + return self.combined_pattern.sub(self._get_value, text) + + +def multi_replace(text, sub_map, **kwargs): + """ + Shortcut function to invoke MultiReplace in a single call. + + Example Usage:: + + from boltons.strutils import multi_replace + new = multi_replace( + 'The foo bar cat ate a bat', + {'foo': 'zoo', 'cat': 'hat', 'bat': 'kraken'} + ) + new == 'The zoo bar hat ate a kraken' + """ + m = MultiReplace(sub_map, **kwargs) + return m.sub(text) + + +def unwrap_text(text, ending='\n\n'): + r""" + Unwrap text, the natural complement to :func:`textwrap.wrap`. + + >>> text = "Short \n lines \nwrapped\nsmall.\n\nAnother\nparagraph." + >>> unwrap_text(text) + 'Short lines wrapped small.\n\nAnother paragraph.' + + Args: + text: A string to unwrap. + ending (str): The string to join all unwrapped paragraphs + by. Pass ``None`` to get the list. Defaults to '\n\n' for + compatibility with Markdown and RST. + + """ + all_grafs = [] + cur_graf = [] + for line in text.splitlines(): + line = line.strip() + if line: + cur_graf.append(line) + else: + all_grafs.append(' '.join(cur_graf)) + cur_graf = [] + if cur_graf: + all_grafs.append(' '.join(cur_graf)) + if ending is None: + return all_grafs + return ending.join(all_grafs) + +def removeprefix(text: str, prefix: str) -> str: + r""" + Remove `prefix` from start of `text` if present. + + Backport of `str.removeprefix` for Python versions less than 3.9. + + Args: + text: A string to remove the prefix from. + prefix: The string to remove from the beginning of `text`. + """ + if text.startswith(prefix): + return text[len(prefix):] + return text diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/tableutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/tableutils.py new file mode 100644 index 0000000000000000000000000000000000000000..46f155eb08ac6e0aa90db05e4768ec23f4ad6af1 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/tableutils.py @@ -0,0 +1,583 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""If there is one recurring theme in ``boltons``, it is that Python +has excellent datastructures that constitute a good foundation for +most quick manipulations, as well as building applications. However, +Python usage has grown much faster than builtin data structure +power. Python has a growing need for more advanced general-purpose +data structures which behave intuitively. + +The :class:`Table` class is one example. When handed one- or +two-dimensional data, it can provide useful, if basic, text and HTML +renditions of small to medium sized data. It also heuristically +handles recursive data of various formats (lists, dicts, namedtuples, +objects). + +For more advanced :class:`Table`-style manipulation check out the +`pandas`_ DataFrame. + +.. _pandas: http://pandas.pydata.org/ + +""" + + +from html import escape as html_escape +import types +from itertools import islice +from collections.abc import Sequence, Mapping, MutableSequence + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + +""" +Some idle feature thoughts: + +* shift around column order without rearranging data +* gotta make it so you can add additional items, not just initialize with +* maybe a shortcut would be to allow adding of Tables to other Tables +* what's the perf of preallocating lists and overwriting items versus + starting from empty? +* is it possible to effectively tell the difference between when a + Table is from_data()'d with a single row (list) or with a list of lists? +* CSS: white-space pre-line or pre-wrap maybe? +* Would be nice to support different backends (currently uses lists + exclusively). Sometimes large datasets come in list-of-dicts and + list-of-tuples format and it's desirable to cut down processing overhead. + +TODO: make iterable on rows? +""" + +__all__ = ['Table'] + + +def to_text(obj, maxlen=None): + try: + text = str(obj) + except Exception: + try: + text = str(repr(obj)) + except Exception: + text = str(object.__repr__(obj)) + if maxlen and len(text) > maxlen: + text = text[:maxlen - 3] + '...' + # TODO: inverse of ljust/rjust/center + return text + + +def escape_html(obj, maxlen=None): + text = to_text(obj, maxlen=maxlen) + return html_escape(text, quote=True) + + +_DNR = {type(None), bool, complex, float, type(NotImplemented), slice, + str, bytes, int, + types.FunctionType, types.MethodType, + types.BuiltinFunctionType, types.GeneratorType} + + +class UnsupportedData(TypeError): + pass + + +class InputType: + def __init__(self, *a, **kw): + pass + + def get_entry_seq(self, data_seq, headers): + return [self.get_entry(entry, headers) for entry in data_seq] + + +class DictInputType(InputType): + def check_type(self, obj): + return isinstance(obj, Mapping) + + def guess_headers(self, obj): + return sorted(obj.keys()) + + def get_entry(self, obj, headers): + return [obj.get(h) for h in headers] + + def get_entry_seq(self, obj, headers): + return [[ci.get(h) for h in headers] for ci in obj] + + +class ObjectInputType(InputType): + def check_type(self, obj): + return type(obj) not in _DNR and hasattr(obj, '__class__') + + def guess_headers(self, obj): + headers = [] + for attr in dir(obj): + # an object's __dict__ could technically have non-string keys + try: + val = getattr(obj, attr) + except Exception: + # seen on greenlet: `run` shows in dir() but raises + # AttributeError. Also properties misbehave. + continue + if callable(val): + continue + headers.append(attr) + return headers + + def get_entry(self, obj, headers): + values = [] + for h in headers: + try: + values.append(getattr(obj, h)) + except Exception: + values.append(None) + return values + + +# might be better to hardcode list support since it's so close to the +# core or might be better to make this the copy-style from_* importer +# and have the non-copy style be hardcoded in __init__ +class ListInputType(InputType): + def check_type(self, obj): + return isinstance(obj, MutableSequence) + + def guess_headers(self, obj): + return None + + def get_entry(self, obj, headers): + return obj + + def get_entry_seq(self, obj_seq, headers): + return obj_seq + + +class TupleInputType(InputType): + def check_type(self, obj): + return isinstance(obj, tuple) + + def guess_headers(self, obj): + return None + + def get_entry(self, obj, headers): + return list(obj) + + def get_entry_seq(self, obj_seq, headers): + return [list(t) for t in obj_seq] + + +class NamedTupleInputType(InputType): + def check_type(self, obj): + return hasattr(obj, '_fields') and isinstance(obj, tuple) + + def guess_headers(self, obj): + return list(obj._fields) + + def get_entry(self, obj, headers): + return [getattr(obj, h, None) for h in headers] + + def get_entry_seq(self, obj_seq, headers): + return [[getattr(obj, h, None) for h in headers] for obj in obj_seq] + + +class Table: + """ + This Table class is meant to be simple, low-overhead, and extensible. Its + most common use would be for translation between in-memory data + structures and serialization formats, such as HTML and console-ready text. + + As such, it stores data in list-of-lists format, and *does not* copy + lists passed in. It also reserves the right to modify those lists in a + "filling" process, whereby short lists are extended to the width of + the table (usually determined by number of headers). This greatly + reduces overhead and processing/validation that would have to occur + otherwise. + + General description of headers behavior: + + Headers describe the columns, but are not part of the data, however, + if the *headers* argument is omitted, Table tries to infer header + names from the data. It is possible to have a table with no headers, + just pass in ``headers=None``. + + Supported inputs: + + * :class:`list` of :class:`list` objects + * :class:`dict` (list/single) + * :class:`object` (list/single) + * :class:`collections.namedtuple` (list/single) + * TODO: DB API cursor? + * TODO: json + + Supported outputs: + + * HTML + * Pretty text (also usable as GF Markdown) + * TODO: CSV + * TODO: json + * TODO: json lines + + To minimize resident size, the Table data is stored as a list of lists. + """ + + # order definitely matters here + _input_types = [DictInputType(), ListInputType(), + NamedTupleInputType(), TupleInputType(), + ObjectInputType()] + + _html_tr, _html_tr_close = '', '' + _html_th, _html_th_close = '', '' + _html_td, _html_td_close = '', '' + _html_thead, _html_thead_close = '', '' + _html_tbody, _html_tbody_close = '', '' + + # _html_tfoot, _html_tfoot_close = '', '' + _html_table_tag, _html_table_tag_close = '', '
' + + def __init__(self, data=None, headers=_MISSING, metadata=None): + if headers is _MISSING: + headers = [] + if data: + headers, data = list(data[0]), islice(data, 1, None) + self.headers = headers or [] + self.metadata = metadata or {} + self._data = [] + self._width = 0 + + self.extend(data) + + def extend(self, data): + """ + Append the given data to the end of the Table. + """ + if not data: + return + self._data.extend(data) + self._set_width() + self._fill() + + def _set_width(self, reset=False): + if reset: + self._width = 0 + if self._width: + return + if self.headers: + self._width = len(self.headers) + return + self._width = max([len(d) for d in self._data]) + + def _fill(self): + width, filler = self._width, [None] + if not width: + return + for d in self._data: + rem = width - len(d) + if rem > 0: + d.extend(filler * rem) + return + + @classmethod + def from_dict(cls, data, headers=_MISSING, max_depth=1, metadata=None): + """Create a Table from a :class:`dict`. Operates the same as + :meth:`from_data`, but forces interpretation of the data as a + Mapping. + """ + return cls.from_data(data=data, headers=headers, + max_depth=max_depth, _data_type=DictInputType(), + metadata=metadata) + + @classmethod + def from_list(cls, data, headers=_MISSING, max_depth=1, metadata=None): + """Create a Table from a :class:`list`. Operates the same as + :meth:`from_data`, but forces the interpretation of the data + as a Sequence. + """ + return cls.from_data(data=data, headers=headers, + max_depth=max_depth, _data_type=ListInputType(), + metadata=metadata) + + @classmethod + def from_object(cls, data, headers=_MISSING, max_depth=1, metadata=None): + """Create a Table from an :class:`object`. Operates the same as + :meth:`from_data`, but forces the interpretation of the data + as an object. May be useful for some :class:`dict` and + :class:`list` subtypes. + """ + return cls.from_data(data=data, headers=headers, + max_depth=max_depth, _data_type=ObjectInputType(), + metadata=metadata) + + @classmethod + def from_data(cls, data, headers=_MISSING, max_depth=1, **kwargs): + + """Create a Table from any supported data, heuristically + selecting how to represent the data in Table format. + + Args: + data (object): Any object or iterable with data to be + imported to the Table. + + headers (iterable): An iterable of headers to be matched + to the data. If not explicitly passed, headers will be + guessed for certain datatypes. + + max_depth (int): The level to which nested Tables should + be created (default: 1). + + _data_type (InputType subclass): For advanced use cases, + do not guess the type of the input data, use this data + type instead. + """ + # TODO: seen/cycle detection/reuse ? + # maxdepth follows the same behavior as find command + # i.e., it doesn't work if max_depth=0 is passed in + metadata = kwargs.pop('metadata', None) + _data_type = kwargs.pop('_data_type', None) + + if max_depth < 1: + # return data instead? + return cls(headers=headers, metadata=metadata) + is_seq = isinstance(data, Sequence) + if is_seq: + if not data: + return cls(headers=headers, metadata=metadata) + to_check = data[0] + if not _data_type: + for it in cls._input_types: + if it.check_type(to_check): + _data_type = it + break + else: + # not particularly happy about this rewind-y approach + is_seq = False + to_check = data + else: + if type(data) in _DNR: + # hmm, got scalar data. + # raise an exception or make an exception, nahmsayn? + return cls([[data]], headers=headers, metadata=metadata) + to_check = data + if not _data_type: + for it in cls._input_types: + if it.check_type(to_check): + _data_type = it + break + else: + raise UnsupportedData('unsupported data type %r' + % type(data)) + if headers is _MISSING: + headers = _data_type.guess_headers(to_check) + if is_seq: + entries = _data_type.get_entry_seq(data, headers) + else: + entries = [_data_type.get_entry(data, headers)] + if max_depth > 1: + new_max_depth = max_depth - 1 + for i, entry in enumerate(entries): + for j, cell in enumerate(entry): + if type(cell) in _DNR: + # optimization to avoid function overhead + continue + try: + entries[i][j] = cls.from_data(cell, + max_depth=new_max_depth) + except UnsupportedData: + continue + return cls(entries, headers=headers, metadata=metadata) + + def __len__(self): + return len(self._data) + + def __getitem__(self, idx): + return self._data[idx] + + def __repr__(self): + cn = self.__class__.__name__ + if self.headers: + return f'{cn}(headers={self.headers!r}, data={self._data!r})' + else: + return f'{cn}({self._data!r})' + + def to_html(self, orientation=None, wrapped=True, + with_headers=True, with_newlines=True, + with_metadata=False, max_depth=1): + """Render this Table to HTML. Configure the structure of Table + HTML by subclassing and overriding ``_html_*`` class + attributes. + + Args: + orientation (str): one of 'auto', 'horizontal', or + 'vertical' (or the first letter of any of + those). Default 'auto'. + wrapped (bool): whether or not to include the wrapping + '
' tags. Default ``True``, set to + ``False`` if appending multiple Table outputs or an + otherwise customized HTML wrapping tag is needed. + with_newlines (bool): Set to ``True`` if output should + include added newlines to make the HTML more + readable. Default ``False``. + with_metadata (bool/str): Set to ``True`` if output should + be preceded with a Table of preset metadata, if it + exists. Set to special value ``'bottom'`` if the + metadata Table HTML should come *after* the main HTML output. + max_depth (int): Indicate how deeply to nest HTML tables + before simply reverting to :func:`repr`-ing the nested + data. + + Returns: + A text string of the HTML of the rendered table. + + """ + lines = [] + headers = [] + if with_metadata and self.metadata: + metadata_table = Table.from_data(self.metadata, + max_depth=max_depth) + metadata_html = metadata_table.to_html(with_headers=True, + with_newlines=with_newlines, + with_metadata=False, + max_depth=max_depth) + if with_metadata != 'bottom': + lines.append(metadata_html) + lines.append('
') + + if with_headers and self.headers: + headers.extend(self.headers) + headers.extend([None] * (self._width - len(self.headers))) + if wrapped: + lines.append(self._html_table_tag) + orientation = orientation or 'auto' + ol = orientation[0].lower() + if ol == 'a': + ol = 'h' if len(self) > 1 else 'v' + if ol == 'h': + self._add_horizontal_html_lines(lines, headers=headers, + max_depth=max_depth) + elif ol == 'v': + self._add_vertical_html_lines(lines, headers=headers, + max_depth=max_depth) + else: + raise ValueError("expected one of 'auto', 'vertical', or" + " 'horizontal', not %r" % orientation) + if with_metadata and self.metadata and with_metadata == 'bottom': + lines.append('
') + lines.append(metadata_html) + + if wrapped: + lines.append(self._html_table_tag_close) + sep = '\n' if with_newlines else '' + return sep.join(lines) + + def get_cell_html(self, value): + """Called on each value in an HTML table. By default it simply escapes + the HTML. Override this method to add additional conditions + and behaviors, but take care to ensure the final output is + HTML escaped. + """ + return escape_html(value) + + def _add_horizontal_html_lines(self, lines, headers, max_depth): + esc = self.get_cell_html + new_depth = max_depth - 1 if max_depth > 1 else max_depth + if max_depth > 1: + new_depth = max_depth - 1 + if headers: + _thth = self._html_th_close + self._html_th + lines.append(self._html_thead) + lines.append(self._html_tr + self._html_th + + _thth.join([esc(h) for h in headers]) + + self._html_th_close + self._html_tr_close) + lines.append(self._html_thead_close) + trtd, _tdtd, _td_tr = (self._html_tr + self._html_td, + self._html_td_close + self._html_td, + self._html_td_close + self._html_tr_close) + lines.append(self._html_tbody) + for row in self._data: + if max_depth > 1: + _fill_parts = [] + for cell in row: + if isinstance(cell, Table): + _fill_parts.append(cell.to_html(max_depth=new_depth)) + else: + _fill_parts.append(esc(cell)) + else: + _fill_parts = [esc(c) for c in row] + lines.append(''.join([trtd, _tdtd.join(_fill_parts), _td_tr])) + lines.append(self._html_tbody_close) + + def _add_vertical_html_lines(self, lines, headers, max_depth): + esc = self.get_cell_html + new_depth = max_depth - 1 if max_depth > 1 else max_depth + tr, th, _th = self._html_tr, self._html_th, self._html_th_close + td, _tdtd = self._html_td, self._html_td_close + self._html_td + _td_tr = self._html_td_close + self._html_tr_close + for i in range(self._width): + line_parts = [tr] + if headers: + line_parts.extend([th, esc(headers[i]), _th]) + if max_depth > 1: + new_depth = max_depth - 1 + _fill_parts = [] + for row in self._data: + cell = row[i] + if isinstance(cell, Table): + _fill_parts.append(cell.to_html(max_depth=new_depth)) + else: + _fill_parts.append(esc(row[i])) + else: + _fill_parts = [esc(row[i]) for row in self._data] + line_parts.extend([td, _tdtd.join(_fill_parts), _td_tr]) + lines.append(''.join(line_parts)) + + def to_text(self, with_headers=True, maxlen=None): + """Get the Table's textual representation. Only works well + for Tables with non-recursive data. + + Args: + with_headers (bool): Whether to include a header row at the top. + maxlen (int): Max length of data in each cell. + """ + lines = [] + widths = [] + headers = list(self.headers) + text_data = [[to_text(cell, maxlen=maxlen) for cell in row] + for row in self._data] + for idx in range(self._width): + cur_widths = [len(cur) for cur in text_data] + if with_headers: + cur_widths.append(len(to_text(headers[idx], maxlen=maxlen))) + widths.append(max(cur_widths)) + if with_headers: + lines.append(' | '.join([h.center(widths[i]) + for i, h in enumerate(headers)])) + lines.append('-|-'.join(['-' * w for w in widths])) + for row in text_data: + lines.append(' | '.join([cell.center(widths[j]) + for j, cell in enumerate(row)])) + return '\n'.join(lines) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/tbutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/tbutils.py new file mode 100644 index 0000000000000000000000000000000000000000..bfc49840cc92ccebf5506914c69c14252b158cfe --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/tbutils.py @@ -0,0 +1,820 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""One of the oft-cited tenets of Python is that it is better to ask +forgiveness than permission. That is, there are many cases where it is +more inclusive and correct to handle exceptions than spend extra lines +and execution time checking for conditions. This philosophy makes good +exception handling features all the more important. Unfortunately +Python's :mod:`traceback` module is woefully behind the times. + +The ``tbutils`` module provides two disparate but complementary featuresets: + + 1. With :class:`ExceptionInfo` and :class:`TracebackInfo`, the + ability to extract, construct, manipulate, format, and serialize + exceptions, tracebacks, and callstacks. + 2. With :class:`ParsedException`, the ability to find and parse tracebacks + from captured output such as logs and stdout. + +There is also the :class:`ContextualTracebackInfo` variant of +:class:`TracebackInfo`, which includes much more information from each +frame of the callstack, including values of locals and neighboring +lines of code. +""" + + +import re +import sys +import linecache + + +# TODO: chaining primitives? what are real use cases where these help? + +# TODO: print_* for backwards compatibility +# __all__ = ['extract_stack', 'extract_tb', 'format_exception', +# 'format_exception_only', 'format_list', 'format_stack', +# 'format_tb', 'print_exc', 'format_exc', 'print_exception', +# 'print_last', 'print_stack', 'print_tb'] + + +__all__ = ['ExceptionInfo', 'TracebackInfo', 'Callpoint', + 'ContextualExceptionInfo', 'ContextualTracebackInfo', + 'ContextualCallpoint', 'print_exception', 'ParsedException'] + + +class Callpoint: + """The Callpoint is a lightweight object used to represent a single + entry in the code of a call stack. It stores the code-related + metadata of a given frame. Available attributes are the same as + the parameters below. + + Args: + func_name (str): the function name + lineno (int): the line number + module_name (str): the module name + module_path (str): the filesystem path of the module + lasti (int): the index of bytecode execution + line (str): the single-line code content (if available) + + """ + __slots__ = ('func_name', 'lineno', 'module_name', 'module_path', 'lasti', + 'line') + + def __init__(self, module_name, module_path, func_name, + lineno, lasti, line=None): + self.func_name = func_name + self.lineno = lineno + self.module_name = module_name + self.module_path = module_path + self.lasti = lasti + self.line = line + + def to_dict(self): + "Get a :class:`dict` copy of the Callpoint. Useful for serialization." + ret = {} + for slot in self.__slots__: + try: + val = getattr(self, slot) + except AttributeError: + pass + else: + ret[slot] = str(val) if isinstance(val, _DeferredLine) else val + return ret + + @classmethod + def from_current(cls, level=1): + "Creates a Callpoint from the location of the calling function." + frame = sys._getframe(level) + return cls.from_frame(frame) + + @classmethod + def from_frame(cls, frame): + "Create a Callpoint object from data extracted from the given frame." + func_name = frame.f_code.co_name + lineno = frame.f_lineno + module_name = frame.f_globals.get('__name__', '') + module_path = frame.f_code.co_filename + lasti = frame.f_lasti + line = _DeferredLine(module_path, lineno, frame.f_globals) + return cls(module_name, module_path, func_name, + lineno, lasti, line=line) + + @classmethod + def from_tb(cls, tb): + """Create a Callpoint from the traceback of the current + exception. Main difference with :meth:`from_frame` is that + ``lineno`` and ``lasti`` come from the traceback, which is to + say the line that failed in the try block, not the line + currently being executed (in the except block). + """ + func_name = tb.tb_frame.f_code.co_name + lineno = tb.tb_lineno + lasti = tb.tb_lasti + module_name = tb.tb_frame.f_globals.get('__name__', '') + module_path = tb.tb_frame.f_code.co_filename + line = _DeferredLine(module_path, lineno, tb.tb_frame.f_globals) + return cls(module_name, module_path, func_name, + lineno, lasti, line=line) + + def __repr__(self): + cn = self.__class__.__name__ + args = [getattr(self, s, None) for s in self.__slots__] + if not any(args): + return super().__repr__() + else: + return '{}({})'.format(cn, ', '.join([repr(a) for a in args])) + + def tb_frame_str(self): + """Render the Callpoint as it would appear in a standard printed + Python traceback. Returns a string with filename, line number, + function name, and the actual code line of the error on up to + two lines. + """ + ret = ' File "{}", line {}, in {}\n'.format(self.module_path, + self.lineno, + self.func_name) + if self.line: + ret += f' {str(self.line).strip()}\n' + return ret + + +class _DeferredLine: + """The _DeferredLine type allows Callpoints and TracebackInfos to be + constructed without potentially hitting the filesystem, as is the + normal behavior of the standard Python :mod:`traceback` and + :mod:`linecache` modules. Calling :func:`str` fetches and caches + the line. + + Args: + filename (str): the path of the file containing the line + lineno (int): the number of the line in question + module_globals (dict): an optional dict of module globals, + used to handle advanced use cases using custom module loaders. + + """ + __slots__ = ('filename', 'lineno', '_line', '_mod_name', '_mod_loader') + + def __init__(self, filename, lineno, module_globals=None): + self.filename = filename + self.lineno = lineno + if module_globals is None: + self._mod_name = None + self._mod_loader = None + else: + self._mod_name = module_globals.get('__name__') + self._mod_loader = module_globals.get('__loader__') + + def __eq__(self, other): + return (self.lineno, self.filename) == (other.lineno, other.filename) + + def __ne__(self, other): + return not self == other + + def __str__(self): + ret = getattr(self, '_line', None) + if ret is not None: + return ret + try: + linecache.checkcache(self.filename) + mod_globals = {'__name__': self._mod_name, + '__loader__': self._mod_loader} + line = linecache.getline(self.filename, + self.lineno, + mod_globals) + line = line.rstrip() + except KeyError: + line = '' + self._line = line + return line + + def __repr__(self): + return repr(str(self)) + + def __len__(self): + return len(str(self)) + + +# TODO: dedup frames, look at __eq__ on _DeferredLine +class TracebackInfo: + """The TracebackInfo class provides a basic representation of a stack + trace, be it from an exception being handled or just part of + normal execution. It is basically a wrapper around a list of + :class:`Callpoint` objects representing frames. + + Args: + frames (list): A list of frame objects in the stack. + + .. note :: + + ``TracebackInfo`` can represent both exception tracebacks and + non-exception tracebacks (aka stack traces). As a result, there + is no ``TracebackInfo.from_current()``, as that would be + ambiguous. Instead, call :meth:`TracebackInfo.from_frame` + without the *frame* argument for a stack trace, or + :meth:`TracebackInfo.from_traceback` without the *tb* argument + for an exception traceback. + """ + callpoint_type = Callpoint + + def __init__(self, frames): + self.frames = frames + + @classmethod + def from_frame(cls, frame=None, level=1, limit=None): + """Create a new TracebackInfo *frame* by recurring up in the stack a + max of *limit* times. If *frame* is unset, get the frame from + :func:`sys._getframe` using *level*. + + Args: + frame (types.FrameType): frame object from + :func:`sys._getframe` or elsewhere. Defaults to result + of :func:`sys.get_frame`. + level (int): If *frame* is unset, the desired frame is + this many levels up the stack from the invocation of + this method. Default ``1`` (i.e., caller of this method). + limit (int): max number of parent frames to extract + (defaults to :data:`sys.tracebacklimit`) + + """ + ret = [] + if frame is None: + frame = sys._getframe(level) + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while frame is not None and n < limit: + item = cls.callpoint_type.from_frame(frame) + ret.append(item) + frame = frame.f_back + n += 1 + ret.reverse() + return cls(ret) + + @classmethod + def from_traceback(cls, tb=None, limit=None): + """Create a new TracebackInfo from the traceback *tb* by recurring + up in the stack a max of *limit* times. If *tb* is unset, get + the traceback from the currently handled exception. If no + exception is being handled, raise a :exc:`ValueError`. + + Args: + + frame (types.TracebackType): traceback object from + :func:`sys.exc_info` or elsewhere. If absent or set to + ``None``, defaults to ``sys.exc_info()[2]``, and + raises a :exc:`ValueError` if no exception is + currently being handled. + limit (int): max number of parent frames to extract + (defaults to :data:`sys.tracebacklimit`) + + """ + ret = [] + if tb is None: + tb = sys.exc_info()[2] + if tb is None: + raise ValueError('no tb set and no exception being handled') + if limit is None: + limit = getattr(sys, 'tracebacklimit', 1000) + n = 0 + while tb is not None and n < limit: + item = cls.callpoint_type.from_tb(tb) + ret.append(item) + tb = tb.tb_next + n += 1 + return cls(ret) + + @classmethod + def from_dict(cls, d): + "Complements :meth:`TracebackInfo.to_dict`." + # TODO: check this. + return cls(d['frames']) + + def to_dict(self): + """Returns a dict with a list of :class:`Callpoint` frames converted + to dicts. + """ + return {'frames': [f.to_dict() for f in self.frames]} + + def __len__(self): + return len(self.frames) + + def __iter__(self): + return iter(self.frames) + + def __repr__(self): + cn = self.__class__.__name__ + + if self.frames: + frame_part = f' last={self.frames[-1]!r}' + else: + frame_part = '' + + return f'<{cn} frames={len(self.frames)}{frame_part}>' + + def __str__(self): + return self.get_formatted() + + def get_formatted(self): + """Returns a string as formatted in the traditional Python + built-in style observable when an exception is not caught. In + other words, mimics :func:`traceback.format_tb` and + :func:`traceback.format_stack`. + """ + ret = 'Traceback (most recent call last):\n' + ret += ''.join([f.tb_frame_str() for f in self.frames]) + return ret + + +class ExceptionInfo: + """An ExceptionInfo object ties together three main fields suitable + for representing an instance of an exception: The exception type + name, a string representation of the exception itself (the + exception message), and information about the traceback (stored as + a :class:`TracebackInfo` object). + + These fields line up with :func:`sys.exc_info`, but unlike the + values returned by that function, ExceptionInfo does not hold any + references to the real exception or traceback. This property makes + it suitable for serialization or long-term retention, without + worrying about formatting pitfalls, circular references, or leaking memory. + + Args: + + exc_type (str): The exception type name. + exc_msg (str): String representation of the exception value. + tb_info (TracebackInfo): Information about the stack trace of the + exception. + + Like the :class:`TracebackInfo`, ExceptionInfo is most commonly + instantiated from one of its classmethods: :meth:`from_exc_info` + or :meth:`from_current`. + """ + + #: Override this in inherited types to control the TracebackInfo type used + tb_info_type = TracebackInfo + + def __init__(self, exc_type, exc_msg, tb_info): + # TODO: additional fields for SyntaxErrors + self.exc_type = exc_type + self.exc_msg = exc_msg + self.tb_info = tb_info + + @classmethod + def from_exc_info(cls, exc_type, exc_value, traceback): + """Create an :class:`ExceptionInfo` object from the exception's type, + value, and traceback, as returned by :func:`sys.exc_info`. See + also :meth:`from_current`. + """ + type_str = exc_type.__name__ + type_mod = exc_type.__module__ + if type_mod not in ("__main__", "__builtin__", "exceptions", "builtins"): + type_str = f'{type_mod}.{type_str}' + val_str = _some_str(exc_value) + tb_info = cls.tb_info_type.from_traceback(traceback) + return cls(type_str, val_str, tb_info) + + @classmethod + def from_current(cls): + """Create an :class:`ExceptionInfo` object from the current exception + being handled, by way of :func:`sys.exc_info`. Will raise an + exception if no exception is currently being handled. + """ + return cls.from_exc_info(*sys.exc_info()) + + def to_dict(self): + """Get a :class:`dict` representation of the ExceptionInfo, suitable + for JSON serialization. + """ + return {'exc_type': self.exc_type, + 'exc_msg': self.exc_msg, + 'exc_tb': self.tb_info.to_dict()} + + def __repr__(self): + cn = self.__class__.__name__ + try: + len_frames = len(self.tb_info.frames) + last_frame = f', last={self.tb_info.frames[-1]!r}' + except Exception: + len_frames = 0 + last_frame = '' + args = (cn, self.exc_type, self.exc_msg, len_frames, last_frame) + return '<%s [%s: %s] (%s frames%s)>' % args + + def get_formatted(self): + """Returns a string formatted in the traditional Python + built-in style observable when an exception is not caught. In + other words, mimics :func:`traceback.format_exception`. + """ + # TODO: add SyntaxError formatting + tb_str = self.tb_info.get_formatted() + return ''.join([tb_str, f'{self.exc_type}: {self.exc_msg}']) + + def get_formatted_exception_only(self): + return f'{self.exc_type}: {self.exc_msg}' + + +class ContextualCallpoint(Callpoint): + """The ContextualCallpoint is a :class:`Callpoint` subtype with the + exact same API and storing two additional values: + + 1. :func:`repr` outputs for local variables from the Callpoint's scope + 2. A number of lines before and after the Callpoint's line of code + + The ContextualCallpoint is used by the :class:`ContextualTracebackInfo`. + """ + def __init__(self, *a, **kw): + self.local_reprs = kw.pop('local_reprs', {}) + self.pre_lines = kw.pop('pre_lines', []) + self.post_lines = kw.pop('post_lines', []) + super().__init__(*a, **kw) + + @classmethod + def from_frame(cls, frame): + "Identical to :meth:`Callpoint.from_frame`" + ret = super().from_frame(frame) + ret._populate_local_reprs(frame.f_locals) + ret._populate_context_lines() + return ret + + @classmethod + def from_tb(cls, tb): + "Identical to :meth:`Callpoint.from_tb`" + ret = super().from_tb(tb) + ret._populate_local_reprs(tb.tb_frame.f_locals) + ret._populate_context_lines() + return ret + + def _populate_context_lines(self, pivot=8): + DL, lineno = _DeferredLine, self.lineno + try: + module_globals = self.line.module_globals + except AttributeError: + module_globals = None + start_line = max(0, lineno - pivot) + pre_lines = [DL(self.module_path, ln, module_globals) + for ln in range(start_line, lineno)] + self.pre_lines[:] = pre_lines + post_lines = [DL(self.module_path, ln, module_globals) + for ln in range(lineno + 1, lineno + 1 + pivot)] + self.post_lines[:] = post_lines + return + + def _populate_local_reprs(self, f_locals): + local_reprs = self.local_reprs + for k, v in f_locals.items(): + try: + local_reprs[k] = repr(v) + except Exception: + surrogate = '' % type(v).__name__ + local_reprs[k] = surrogate + return + + def to_dict(self): + """ + Same principle as :meth:`Callpoint.to_dict`, but with the added + contextual values. With ``ContextualCallpoint.to_dict()``, + each frame will now be represented like:: + + {'func_name': 'print_example', + 'lineno': 0, + 'module_name': 'example_module', + 'module_path': '/home/example/example_module.pyc', + 'lasti': 0, + 'line': 'print "example"', + 'locals': {'variable': '"value"'}, + 'pre_lines': ['variable = "value"'], + 'post_lines': []} + + The locals dictionary and line lists are copies and can be mutated + freely. + """ + ret = super().to_dict() + ret['locals'] = dict(self.local_reprs) + + # get the line numbers and textual lines + # without assuming DeferredLines + start_line = self.lineno - len(self.pre_lines) + pre_lines = [{'lineno': start_line + i, 'line': str(l)} + for i, l in enumerate(self.pre_lines)] + # trim off leading empty lines + for i, item in enumerate(pre_lines): + if item['line']: + break + if i: + pre_lines = pre_lines[i:] + ret['pre_lines'] = pre_lines + + # now post_lines + post_lines = [{'lineno': self.lineno + i, 'line': str(l)} + for i, l in enumerate(self.post_lines)] + _last = 0 + for i, item in enumerate(post_lines): + if item['line']: + _last = i + post_lines = post_lines[:_last + 1] + ret['post_lines'] = post_lines + return ret + + +class ContextualTracebackInfo(TracebackInfo): + """The ContextualTracebackInfo type is a :class:`TracebackInfo` + subtype that is used by :class:`ContextualExceptionInfo` and uses + the :class:`ContextualCallpoint` as its frame-representing + primitive. + """ + callpoint_type = ContextualCallpoint + + +class ContextualExceptionInfo(ExceptionInfo): + """The ContextualTracebackInfo type is a :class:`TracebackInfo` + subtype that uses the :class:`ContextualCallpoint` as its + frame-representing primitive. + + It carries with it most of the exception information required to + recreate the widely recognizable "500" page for debugging Django + applications. + """ + tb_info_type = ContextualTracebackInfo + + +# TODO: clean up & reimplement -- specifically for syntax errors +def format_exception_only(etype, value): + """Format the exception part of a traceback. + + The arguments are the exception type and value such as given by + sys.last_type and sys.last_value. The return value is a list of + strings, each ending in a newline. + + Normally, the list contains a single string; however, for + SyntaxError exceptions, it contains several lines that (when + printed) display detailed information about where the syntax + error occurred. + + The message indicating which exception occurred is always the last + string in the list. + + """ + # Gracefully handle (the way Python 2.4 and earlier did) the case of + # being called with (None, None). + if etype is None: + return [_format_final_exc_line(etype, value)] + + stype = etype.__name__ + smod = etype.__module__ + if smod not in ("__main__", "builtins", "exceptions"): + stype = smod + '.' + stype + + if not issubclass(etype, SyntaxError): + return [_format_final_exc_line(stype, value)] + + # It was a syntax error; show exactly where the problem was found. + lines = [] + filename = value.filename or "" + lineno = str(value.lineno) or '?' + lines.append(f' File "{filename}", line {lineno}\n') + badline = value.text + offset = value.offset + if badline is not None: + lines.append(' %s\n' % badline.strip()) + if offset is not None: + caretspace = badline.rstrip('\n')[:offset].lstrip() + # non-space whitespace (likes tabs) must be kept for alignment + caretspace = ((c.isspace() and c or ' ') for c in caretspace) + # only three spaces to account for offset1 == pos 0 + lines.append(' %s^\n' % ''.join(caretspace)) + msg = value.msg or "" + lines.append(f"{stype}: {msg}\n") + return lines + + +# TODO: use asciify, improved if necessary +def _some_str(value): + try: + return str(value) + except Exception: + pass + return '' % type(value).__name__ + + +def _format_final_exc_line(etype, value): + valuestr = _some_str(value) + if value is None or not valuestr: + line = "%s\n" % etype + else: + line = f"{etype}: {valuestr}\n" + return line + + +def print_exception(etype, value, tb, limit=None, file=None): + """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. + + This differs from print_tb() in the following ways: (1) if + traceback is not None, it prints a header "Traceback (most recent + call last):"; (2) it prints the exception type and value after the + stack trace; (3) if type is SyntaxError and value has the + appropriate format, it prints the line where the syntax error + occurred with a caret on the next line indicating the approximate + position of the error. + """ + + if file is None: + file = sys.stderr + if tb: + tbi = TracebackInfo.from_traceback(tb, limit) + print(str(tbi), end='', file=file) + + for line in format_exception_only(etype, value): + print(line, end='', file=file) + + +def fix_print_exception(): + """ + Sets the default exception hook :func:`sys.excepthook` to the + :func:`tbutils.print_exception` that uses all the ``tbutils`` + facilities to provide a consistent output behavior. + """ + sys.excepthook = print_exception + + +_frame_re = re.compile(r'^File "(?P.+)", line (?P\d+)' + r', in (?P.+)$') +_se_frame_re = re.compile(r'^File "(?P.+)", line (?P\d+)') +_underline_re = re.compile(r'^[~^ ]*$') + +# TODO: ParsedException generator over large bodies of text + +class ParsedException: + """Stores a parsed traceback and exception as would be typically + output by :func:`sys.excepthook` or + :func:`traceback.print_exception`. + + .. note: + + Does not currently store SyntaxError details such as column. + + """ + def __init__(self, exc_type_name, exc_msg, frames=None): + self.exc_type = exc_type_name + self.exc_msg = exc_msg + self.frames = list(frames or []) + + @property + def source_file(self): + """ + The file path of module containing the function that raised the + exception, or None if not available. + """ + try: + return self.frames[-1]['filepath'] + except IndexError: + return None + + def to_dict(self): + "Get a copy as a JSON-serializable :class:`dict`." + return {'exc_type': self.exc_type, + 'exc_msg': self.exc_msg, + 'frames': list(self.frames)} + + def __repr__(self): + cn = self.__class__.__name__ + return ('%s(%r, %r, frames=%r)' + % (cn, self.exc_type, self.exc_msg, self.frames)) + + def to_string(self): + """Formats the exception and its traceback into the standard format, + as returned by the traceback module. + + ``ParsedException.from_string(text).to_string()`` should yield + ``text``. + + .. note:: + + Note that this method does not output "anchors" (e.g., + ``~~~~~^^``), as were added in Python 3.13. See the built-in + ``traceback`` module if these are necessary. + """ + lines = ['Traceback (most recent call last):'] + + for frame in self.frames: + lines.append(' File "{}", line {}, in {}'.format(frame['filepath'], + frame['lineno'], + frame['funcname'])) + source_line = frame.get('source_line') + if source_line: + lines.append(f' {source_line}') + if self.exc_msg: + lines.append(f'{self.exc_type}: {self.exc_msg}') + else: + lines.append(f'{self.exc_type}') + return '\n'.join(lines) + + @classmethod + def from_string(cls, tb_str): + """Parse a traceback and exception from the text *tb_str*. This text + is expected to have been decoded, otherwise it will be + interpreted as UTF-8. + + This method does not search a larger body of text for + tracebacks. If the first line of the text passed does not + match one of the known patterns, a :exc:`ValueError` will be + raised. This method will ignore trailing text after the end of + the first traceback. + + Args: + tb_str (str): The traceback text (:class:`unicode` or UTF-8 bytes) + """ + if not isinstance(tb_str, str): + tb_str = tb_str.decode('utf-8') + tb_lines = tb_str.lstrip().splitlines() + + # First off, handle some ignored exceptions. These can be the + # result of exceptions raised by __del__ during garbage + # collection + while tb_lines: + cl = tb_lines[-1] + if cl.startswith('Exception ') and cl.endswith('ignored'): + tb_lines.pop() + else: + break + if tb_lines and tb_lines[0].strip() == 'Traceback (most recent call last):': + start_line = 1 + frame_re = _frame_re + elif len(tb_lines) > 1 and tb_lines[-2].lstrip().startswith('^'): + # This is to handle the slight formatting difference + # associated with SyntaxErrors, which also don't really + # have tracebacks + start_line = 0 + frame_re = _se_frame_re + else: + raise ValueError('unrecognized traceback string format') + + frames = [] + line_no = start_line + while True: + frame_line = tb_lines[line_no].strip() + frame_match = frame_re.match(frame_line) + if frame_match: + frame_dict = frame_match.groupdict() + try: + next_line = tb_lines[line_no + 1] + except IndexError: + # We read what we could + next_line = '' + next_line_stripped = next_line.strip() + if ( + frame_re.match(next_line_stripped) or + # The exception message will not be indented + # This check is to avoid overrunning on eval-like + # tracebacks where the last frame doesn't have source + # code in the traceback + not next_line.startswith(' ') + ): + frame_dict['source_line'] = '' + else: + frame_dict['source_line'] = next_line_stripped + line_no += 1 + if _underline_re.match(tb_lines[line_no + 1]): + # To deal with anchors + line_no += 1 + else: + break + line_no += 1 + frames.append(frame_dict) + + try: + exc_line = '\n'.join(tb_lines[line_no:]) + exc_type, _, exc_msg = exc_line.partition(': ') + except Exception: + exc_type, exc_msg = '', '' + + return cls(exc_type, exc_msg, frames) + + +ParsedTB = ParsedException # legacy alias diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/timeutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/timeutils.py new file mode 100644 index 0000000000000000000000000000000000000000..82f201ee94699223728de0cc1799b755707e2b65 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/timeutils.py @@ -0,0 +1,566 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's :mod:`datetime` module provides some of the most complex +and powerful primitives in the Python standard library. Time is +nontrivial, but thankfully its support is first-class in +Python. ``dateutils`` provides some additional tools for working with +time. + +Additionally, timeutils provides a few basic utilities for working +with timezones in Python. The Python :mod:`datetime` module's +documentation describes how to create a +:class:`~datetime.datetime`-compatible :class:`~datetime.tzinfo` +subtype. It even provides a few examples. + +The following module defines usable forms of the timezones in those +docs, as well as a couple other useful ones, :data:`UTC` (aka GMT) and +:data:`LocalTZ` (representing the local timezone as configured in the +operating system). For timezones beyond these, as well as a higher +degree of accuracy in corner cases, check out `pytz`_ and `dateutil`_. + +.. _pytz: https://pypi.python.org/pypi/pytz +.. _dateutil: https://dateutil.readthedocs.io/en/stable/index.html +""" + +import re +import time +import bisect +import operator +from datetime import tzinfo, timedelta, date, datetime, timezone + + +# For legacy compatibility. +# boltons used to offer an implementation of total_seconds for Python <2.7 +total_seconds = timedelta.total_seconds + + +def dt_to_timestamp(dt): + """Converts from a :class:`~datetime.datetime` object to an integer + timestamp, suitable interoperation with :func:`time.time` and + other `Epoch-based timestamps`. + + .. _Epoch-based timestamps: https://en.wikipedia.org/wiki/Unix_time + + >>> timestamp = int(time.time()) + >>> utc_dt = datetime.fromtimestamp(timestamp, timezone.utc) + >>> timestamp - dt_to_timestamp(utc_dt) + 0.0 + + ``dt_to_timestamp`` supports both timezone-aware and naïve + :class:`~datetime.datetime` objects. Note that it assumes naïve + datetime objects are implied UTC, such as those generated with + :meth:`datetime.datetime.utcnow`. If your datetime objects are + local time, such as those generated with + :meth:`datetime.datetime.now`, first convert it using the + :meth:`datetime.datetime.replace` method with ``tzinfo=`` + :class:`LocalTZ` object in this module, then pass the result of + that to ``dt_to_timestamp``. + """ + if dt.tzinfo: + td = dt - EPOCH_AWARE + else: + td = dt.replace(tzinfo=timezone.utc) - EPOCH_AWARE + return timedelta.total_seconds(td) + + +_NONDIGIT_RE = re.compile(r'\D') + + +def isoparse(iso_str): + """Parses the limited subset of `ISO8601-formatted time`_ strings as + returned by :meth:`datetime.datetime.isoformat`. + + >>> epoch_dt = datetime.fromtimestamp(0, timezone.utc).replace(tzinfo=None) + >>> iso_str = epoch_dt.isoformat() + >>> print(iso_str) + 1970-01-01T00:00:00 + >>> isoparse(iso_str) + datetime.datetime(1970, 1, 1, 0, 0) + + >>> utcnow = datetime.now(timezone.utc).replace(tzinfo=None) + >>> utcnow == isoparse(utcnow.isoformat()) + True + + For further datetime parsing, see the `iso8601`_ package for strict + ISO parsing and `dateutil`_ package for loose parsing and more. + + .. _ISO8601-formatted time: https://en.wikipedia.org/wiki/ISO_8601 + .. _iso8601: https://pypi.python.org/pypi/iso8601 + .. _dateutil: https://pypi.python.org/pypi/python-dateutil + + """ + dt_args = [int(p) for p in _NONDIGIT_RE.split(iso_str)] + return datetime(*dt_args) + + +_BOUNDS = [(0, timedelta(seconds=1), 'second'), + (1, timedelta(seconds=60), 'minute'), + (1, timedelta(seconds=3600), 'hour'), + (1, timedelta(days=1), 'day'), + (1, timedelta(days=7), 'week'), + (2, timedelta(days=30), 'month'), + (1, timedelta(days=365), 'year')] +_BOUNDS = [(b[0] * b[1], b[1], b[2]) for b in _BOUNDS] +_BOUND_DELTAS = [b[0] for b in _BOUNDS] + +_FLOAT_PATTERN = r'[+-]?\ *(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?' +_PARSE_TD_RE = re.compile(r"((?P%s)\s*(?P\w)\w*)" % _FLOAT_PATTERN) +_PARSE_TD_KW_MAP = {unit[0]: unit + 's' + for _, _, unit in reversed(_BOUNDS[:-2])} + + +def parse_timedelta(text): + """Robustly parses a short text description of a time period into a + :class:`datetime.timedelta`. Supports weeks, days, hours, minutes, + and seconds, with or without decimal points: + + Args: + text (str): Text to parse. + Returns: + datetime.timedelta + Raises: + ValueError: on parse failure. + + >>> parse_td('1d 2h 3.5m 0s') == timedelta(days=1, seconds=7410) + True + + Also supports full words and whitespace. + + >>> parse_td('2 weeks 1 day') == timedelta(days=15) + True + + Negative times are supported, too: + + >>> parse_td('-1.5 weeks 3m 20s') == timedelta(days=-11, seconds=43400) + True + """ + td_kwargs = {} + for match in _PARSE_TD_RE.finditer(text): + value, unit = match.group('value'), match.group('unit') + try: + unit_key = _PARSE_TD_KW_MAP[unit] + except KeyError: + raise ValueError('invalid time unit %r, expected one of %r' + % (unit, _PARSE_TD_KW_MAP.keys())) + try: + value = float(value) + except ValueError: + raise ValueError('invalid time value for unit %r: %r' + % (unit, value)) + td_kwargs[unit_key] = value + return timedelta(**td_kwargs) + + +parse_td = parse_timedelta # legacy alias + + +def _cardinalize_time_unit(unit, value): + # removes dependency on strutils; nice and simple because + # all time units cardinalize normally + if value == 1: + return unit + return unit + 's' + + +def decimal_relative_time(d, other=None, ndigits=0, cardinalize=True): + """Get a tuple representing the relative time difference between two + :class:`~datetime.datetime` objects or one + :class:`~datetime.datetime` and now. + + Args: + d (datetime): The first datetime object. + other (datetime): An optional second datetime object. If + unset, defaults to the current time as determined + :meth:`datetime.utcnow`. + ndigits (int): The number of decimal digits to round to, + defaults to ``0``. + cardinalize (bool): Whether to pluralize the time unit if + appropriate, defaults to ``True``. + Returns: + (float, str): A tuple of the :class:`float` difference and + respective unit of time, pluralized if appropriate and + *cardinalize* is set to ``True``. + + Unlike :func:`relative_time`, this method's return is amenable to + localization into other languages and custom phrasing and + formatting. + + >>> now = datetime.now(timezone.utc).replace(tzinfo=None) + >>> decimal_relative_time(now - timedelta(days=1, seconds=3600), now) + (1.0, 'day') + >>> decimal_relative_time(now - timedelta(seconds=0.002), now, ndigits=5) + (0.002, 'seconds') + >>> decimal_relative_time(now, now - timedelta(days=900), ndigits=1) + (-2.5, 'years') + + """ + if other is None: + other = datetime.now(timezone.utc).replace(tzinfo=None) + diff = other - d + diff_seconds = timedelta.total_seconds(diff) + abs_diff = abs(diff) + b_idx = bisect.bisect(_BOUND_DELTAS, abs_diff) - 1 + bbound, bunit, bname = _BOUNDS[b_idx] + f_diff = diff_seconds / timedelta.total_seconds(bunit) + rounded_diff = round(f_diff, ndigits) + if cardinalize: + return rounded_diff, _cardinalize_time_unit(bname, abs(rounded_diff)) + return rounded_diff, bname + + +def relative_time(d, other=None, ndigits=0): + """Get a string representation of the difference between two + :class:`~datetime.datetime` objects or one + :class:`~datetime.datetime` and the current time. Handles past and + future times. + + Args: + d (datetime): The first datetime object. + other (datetime): An optional second datetime object. If + unset, defaults to the current time as determined + :meth:`datetime.utcnow`. + ndigits (int): The number of decimal digits to round to, + defaults to ``0``. + Returns: + A short English-language string. + + >>> now = datetime.now(timezone.utc).replace(tzinfo=None) + >>> relative_time(now, ndigits=1) + '0 seconds ago' + >>> relative_time(now - timedelta(days=1, seconds=36000), ndigits=1) + '1.4 days ago' + >>> relative_time(now + timedelta(days=7), now, ndigits=1) + '1 week from now' + + """ + drt, unit = decimal_relative_time(d, other, ndigits, cardinalize=True) + phrase = 'ago' + if drt < 0: + phrase = 'from now' + return f'{abs(drt):g} {unit} {phrase}' + + +def strpdate(string, format): + """Parse the date string according to the format in `format`. Returns a + :class:`date` object. Internally, :meth:`datetime.strptime` is used to + parse the string and thus conversion specifiers for time fields (e.g. `%H`) + may be provided; these will be parsed but ignored. + + Args: + string (str): The date string to be parsed. + format (str): The `strptime`_-style date format string. + Returns: + datetime.date + + .. _`strptime`: https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior + + >>> strpdate('2016-02-14', '%Y-%m-%d') + datetime.date(2016, 2, 14) + >>> strpdate('26/12 (2015)', '%d/%m (%Y)') + datetime.date(2015, 12, 26) + >>> strpdate('20151231 23:59:59', '%Y%m%d %H:%M:%S') + datetime.date(2015, 12, 31) + >>> strpdate('20160101 00:00:00.001', '%Y%m%d %H:%M:%S.%f') + datetime.date(2016, 1, 1) + """ + whence = datetime.strptime(string, format) + return whence.date() + + +def daterange(start, stop, step=1, inclusive=False): + """In the spirit of :func:`range` and :func:`xrange`, the `daterange` + generator that yields a sequence of :class:`~datetime.date` + objects, starting at *start*, incrementing by *step*, until *stop* + is reached. + + When *inclusive* is True, the final date may be *stop*, **if** + *step* falls evenly on it. By default, *step* is one day. See + details below for many more details. + + Args: + start (datetime.date): The starting date The first value in + the sequence. + stop (datetime.date): The stopping date. By default not + included in return. Can be `None` to yield an infinite + sequence. + step (int): The value to increment *start* by to reach + *stop*. Can be an :class:`int` number of days, a + :class:`datetime.timedelta`, or a :class:`tuple` of integers, + `(year, month, day)`. Positive and negative *step* values + are supported. + inclusive (bool): Whether or not the *stop* date can be + returned. *stop* is only returned when a *step* falls evenly + on it. + + >>> christmas = date(year=2015, month=12, day=25) + >>> boxing_day = date(year=2015, month=12, day=26) + >>> new_year = date(year=2016, month=1, day=1) + >>> for day in daterange(christmas, new_year): + ... print(repr(day)) + datetime.date(2015, 12, 25) + datetime.date(2015, 12, 26) + datetime.date(2015, 12, 27) + datetime.date(2015, 12, 28) + datetime.date(2015, 12, 29) + datetime.date(2015, 12, 30) + datetime.date(2015, 12, 31) + >>> for day in daterange(christmas, boxing_day): + ... print(repr(day)) + datetime.date(2015, 12, 25) + >>> for day in daterange(date(2017, 5, 1), date(2017, 8, 1), + ... step=(0, 1, 0), inclusive=True): + ... print(repr(day)) + datetime.date(2017, 5, 1) + datetime.date(2017, 6, 1) + datetime.date(2017, 7, 1) + datetime.date(2017, 8, 1) + + *Be careful when using stop=None, as this will yield an infinite + sequence of dates.* + """ + if not isinstance(start, date): + raise TypeError("start expected datetime.date instance") + if stop and not isinstance(stop, date): + raise TypeError("stop expected datetime.date instance or None") + try: + y_step, m_step, d_step = step + except TypeError: + y_step, m_step, d_step = 0, 0, step + else: + y_step, m_step = int(y_step), int(m_step) + if isinstance(d_step, int): + d_step = timedelta(days=int(d_step)) + elif isinstance(d_step, timedelta): + pass + else: + raise ValueError('step expected int, timedelta, or tuple' + ' (year, month, day), not: %r' % step) + + m_step += y_step * 12 + + if stop is None: + finished = lambda now, stop: False + elif start <= stop: + finished = operator.gt if inclusive else operator.ge + else: + finished = operator.lt if inclusive else operator.le + now = start + + while not finished(now, stop): + yield now + if m_step: + m_y_step, cur_month = divmod((now.month - 1) + m_step, 12) + now = now.replace(year=now.year + m_y_step, + month=(cur_month + 1)) + now = now + d_step + return + + +# Timezone support (brought in from tzutils) + + +ZERO = timedelta(0) +HOUR = timedelta(hours=1) + + +class ConstantTZInfo(tzinfo): + """ + A :class:`~datetime.tzinfo` subtype whose *offset* remains constant + (no daylight savings). + + Args: + name (str): Name of the timezone. + offset (datetime.timedelta): Offset of the timezone. + """ + def __init__(self, name="ConstantTZ", offset=ZERO): + self.name = name + self.offset = offset + + @property + def utcoffset_hours(self): + return timedelta.total_seconds(self.offset) / (60 * 60) + + def utcoffset(self, dt): + return self.offset + + def tzname(self, dt): + return self.name + + def dst(self, dt): + return ZERO + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}(name={self.name!r}, offset={self.offset!r})' + + +UTC = ConstantTZInfo('UTC') +EPOCH_AWARE = datetime.fromtimestamp(0, UTC) + + +class LocalTZInfo(tzinfo): + """The ``LocalTZInfo`` type takes data available in the time module + about the local timezone and makes a practical + :class:`datetime.tzinfo` to represent the timezone settings of the + operating system. + + For a more in-depth integration with the operating system, check + out `tzlocal`_. It builds on `pytz`_ and implements heuristics for + many versions of major operating systems to provide the official + ``pytz`` tzinfo, instead of the LocalTZ generalization. + + .. _tzlocal: https://pypi.python.org/pypi/tzlocal + .. _pytz: https://pypi.python.org/pypi/pytz + + """ + _std_offset = timedelta(seconds=-time.timezone) + _dst_offset = _std_offset + if time.daylight: + _dst_offset = timedelta(seconds=-time.altzone) + + def is_dst(self, dt): + dt_t = (dt.year, dt.month, dt.day, dt.hour, dt.minute, + dt.second, dt.weekday(), 0, -1) + local_t = time.localtime(time.mktime(dt_t)) + return local_t.tm_isdst > 0 + + def utcoffset(self, dt): + if self.is_dst(dt): + return self._dst_offset + return self._std_offset + + def dst(self, dt): + if self.is_dst(dt): + return self._dst_offset - self._std_offset + return ZERO + + def tzname(self, dt): + return time.tzname[self.is_dst(dt)] + + def __repr__(self): + return '%s()' % self.__class__.__name__ + + +LocalTZ = LocalTZInfo() + + +def _first_sunday_on_or_after(dt): + days_to_go = 6 - dt.weekday() + if days_to_go: + dt += timedelta(days_to_go) + return dt + + +# US DST Rules +# +# This is a simplified (i.e., wrong for a few cases) set of rules for US +# DST start and end times. For a complete and up-to-date set of DST rules +# and timezone definitions, visit the Olson Database (or try pytz): +# http://www.twinsun.com/tz/tz-link.htm +# http://sourceforge.net/projects/pytz/ (might not be up-to-date) +# +# In the US, since 2007, DST starts at 2am (standard time) on the second +# Sunday in March, which is the first Sunday on or after Mar 8. +DSTSTART_2007 = datetime(1, 3, 8, 2) +# and ends at 2am (DST time; 1am standard time) on the first Sunday of Nov. +DSTEND_2007 = datetime(1, 11, 1, 1) +# From 1987 to 2006, DST used to start at 2am (standard time) on the first +# Sunday in April and to end at 2am (DST time; 1am standard time) on the last +# Sunday of October, which is the first Sunday on or after Oct 25. +DSTSTART_1987_2006 = datetime(1, 4, 1, 2) +DSTEND_1987_2006 = datetime(1, 10, 25, 1) +# From 1967 to 1986, DST used to start at 2am (standard time) on the last +# Sunday in April (the one on or after April 24) and to end at 2am (DST time; +# 1am standard time) on the last Sunday of October, which is the first Sunday +# on or after Oct 25. +DSTSTART_1967_1986 = datetime(1, 4, 24, 2) +DSTEND_1967_1986 = DSTEND_1987_2006 + + +class USTimeZone(tzinfo): + """Copied directly from the Python docs, the ``USTimeZone`` is a + :class:`datetime.tzinfo` subtype used to create the + :data:`Eastern`, :data:`Central`, :data:`Mountain`, and + :data:`Pacific` tzinfo types. + """ + def __init__(self, hours, reprname, stdname, dstname): + self.stdoffset = timedelta(hours=hours) + self.reprname = reprname + self.stdname = stdname + self.dstname = dstname + + def __repr__(self): + return self.reprname + + def tzname(self, dt): + if self.dst(dt): + return self.dstname + else: + return self.stdname + + def utcoffset(self, dt): + return self.stdoffset + self.dst(dt) + + def dst(self, dt): + if dt is None or dt.tzinfo is None: + # An exception may be sensible here, in one or both cases. + # It depends on how you want to treat them. The default + # fromutc() implementation (called by the default astimezone() + # implementation) passes a datetime with dt.tzinfo is self. + return ZERO + assert dt.tzinfo is self + + # Find start and end times for US DST. For years before 1967, return + # ZERO for no DST. + if 2006 < dt.year: + dststart, dstend = DSTSTART_2007, DSTEND_2007 + elif 1986 < dt.year < 2007: + dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006 + elif 1966 < dt.year < 1987: + dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986 + else: + return ZERO + + start = _first_sunday_on_or_after(dststart.replace(year=dt.year)) + end = _first_sunday_on_or_after(dstend.replace(year=dt.year)) + + # Can't compare naive to aware objects, so strip the timezone + # from dt first. + if start <= dt.replace(tzinfo=None) < end: + return HOUR + else: + return ZERO + + +Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") +Central = USTimeZone(-6, "Central", "CST", "CDT") +Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") +Pacific = USTimeZone(-8, "Pacific", "PST", "PDT") diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/typeutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/typeutils.py new file mode 100644 index 0000000000000000000000000000000000000000..875e2e2b0412bc7fee0a11726371bac402566ee5 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/typeutils.py @@ -0,0 +1,180 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Python's built-in :mod:`functools` module builds several useful +utilities on top of Python's first-class function support. +``typeutils`` attempts to do the same for metaprogramming with types +and instances. +""" +import sys +from collections import deque + +_issubclass = issubclass + + +def make_sentinel(name='_MISSING', var_name=None): + """Creates and returns a new **instance** of a new class, suitable for + usage as a "sentinel", a kind of singleton often used to indicate + a value is missing when ``None`` is a valid input. + + Args: + name (str): Name of the Sentinel + var_name (str): Set this name to the name of the variable in + its respective module enable pickleability. Note: + pickleable sentinels should be global constants at the top + level of their module. + + >>> make_sentinel(var_name='_MISSING') + _MISSING + + The most common use cases here in boltons are as default values + for optional function arguments, partly because of its + less-confusing appearance in automatically generated + documentation. Sentinels also function well as placeholders in queues + and linked lists. + + .. note:: + + By design, additional calls to ``make_sentinel`` with the same + values will not produce equivalent objects. + + >>> make_sentinel('TEST') == make_sentinel('TEST') + False + >>> type(make_sentinel('TEST')) == type(make_sentinel('TEST')) + False + + """ + class Sentinel: + def __init__(self): + self.name = name + self.var_name = var_name + + def __repr__(self): + if self.var_name: + return self.var_name + return f'{self.__class__.__name__}({self.name!r})' + + if var_name: + def __reduce__(self): + return self.var_name + + def __bool__(self): + return False + + def __copy__(self): + return self + + def __deepcopy__(self, _memo): + return self + + if var_name: + frame = sys._getframe(1) + module = frame.f_globals.get('__name__') + if not module or module not in sys.modules: + raise ValueError('Pickleable sentinel objects (with var_name) can only' + ' be created from top-level module scopes') + Sentinel.__module__ = module + + return Sentinel() + + +def issubclass(subclass, baseclass): + """Just like the built-in :func:`issubclass`, this function checks + whether *subclass* is inherited from *baseclass*. Unlike the + built-in function, this ``issubclass`` will simply return + ``False`` if either argument is not suitable (e.g., if *subclass* + is not an instance of :class:`type`), instead of raising + :exc:`TypeError`. + + Args: + subclass (type): The target class to check. + baseclass (type): The base class *subclass* will be checked against. + + >>> class MyObject(object): pass + ... + >>> issubclass(MyObject, object) # always a fun fact + True + >>> issubclass('hi', 'friend') + False + """ + try: + return _issubclass(subclass, baseclass) + except TypeError: + return False + + +def get_all_subclasses(cls): + """Recursively finds and returns a :class:`list` of all types + inherited from *cls*. + + >>> class A(object): + ... pass + ... + >>> class B(A): + ... pass + ... + >>> class C(B): + ... pass + ... + >>> class D(A): + ... pass + ... + >>> [t.__name__ for t in get_all_subclasses(A)] + ['B', 'D', 'C'] + >>> [t.__name__ for t in get_all_subclasses(B)] + ['C'] + + """ + try: + to_check = deque(cls.__subclasses__()) + except (AttributeError, TypeError): + raise TypeError('expected type object, not %r' % cls) + seen, ret = set(), [] + while to_check: + cur = to_check.popleft() + if cur in seen: + continue + ret.append(cur) + seen.add(cur) + to_check.extend(cur.__subclasses__()) + return ret + + +class classproperty: + """Much like a :class:`property`, but the wrapped get function is a + class method. For simplicity, only read-only properties are + implemented. + """ + + def __init__(self, fn): + self.fn = fn + + def __get__(self, instance, cls): + return self.fn(cls) diff --git a/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/urlutils.py b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/urlutils.py new file mode 100644 index 0000000000000000000000000000000000000000..45d3e73e87820a34a622540cdf1a29cb34b895c3 --- /dev/null +++ b/miniconda3/pkgs/boltons-25.0.0-py313h06a4308_0/lib/python3.13/site-packages/boltons/urlutils.py @@ -0,0 +1,1606 @@ +# Copyright (c) 2013, Mahmoud Hashemi +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * The names of the contributors may not be used to endorse or +# promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""":mod:`urlutils` is a module dedicated to one of software's most +versatile, well-aged, and beloved data structures: the URL, also known +as the `Uniform Resource Locator`_. + +Among other things, this module is a full reimplementation of URLs, +without any reliance on the :mod:`urlparse` or :mod:`urllib` standard +library modules. The centerpiece and top-level interface of urlutils +is the :class:`URL` type. Also featured is the :func:`find_all_links` +convenience function. Some low-level functions and constants are also +below. + +The implementations in this module are based heavily on `RFC 3986`_ and +`RFC 3987`_, and incorporates details from several other RFCs and `W3C +documents`_. + +.. _Uniform Resource Locator: https://en.wikipedia.org/wiki/Uniform_Resource_Locator +.. _RFC 3986: https://tools.ietf.org/html/rfc3986 +.. _RFC 3987: https://tools.ietf.org/html/rfc3987 +.. _W3C documents: https://www.w3.org/TR/uri-clarification/ + +""" + +import re +import socket +import string +from unicodedata import normalize + +# The unreserved URI characters (per RFC 3986 Section 2.3) +_UNRESERVED_CHARS = frozenset('~-._0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz') + +# URL parsing regex (based on RFC 3986 Appendix B, with modifications) +_URL_RE = re.compile(r'^((?P[^:/?#]+):)?' + r'((?P<_netloc_sep>//)(?P[^/?#]*))?' + r'(?P[^?#]*)' + r'(\?(?P[^#]*))?' + r'(#(?P.*))?') + + +_HEX_CHAR_MAP = {(a + b).encode('ascii'): + chr(int(a + b, 16)).encode('charmap') + for a in string.hexdigits for b in string.hexdigits} +_ASCII_RE = re.compile('([\x00-\x7f]+)') + + +# This port list painstakingly curated by hand searching through +# https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml +# and +# https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml +SCHEME_PORT_MAP = {'acap': 674, 'afp': 548, 'dict': 2628, 'dns': 53, + 'file': None, 'ftp': 21, 'git': 9418, 'gopher': 70, + 'http': 80, 'https': 443, 'imap': 143, 'ipp': 631, + 'ipps': 631, 'irc': 194, 'ircs': 6697, 'ldap': 389, + 'ldaps': 636, 'mms': 1755, 'msrp': 2855, 'msrps': None, + 'mtqp': 1038, 'nfs': 111, 'nntp': 119, 'nntps': 563, + 'pop': 110, 'prospero': 1525, 'redis': 6379, 'rsync': 873, + 'rtsp': 554, 'rtsps': 322, 'rtspu': 5005, 'sftp': 22, + 'smb': 445, 'snmp': 161, 'ssh': 22, 'steam': None, + 'svn': 3690, 'telnet': 23, 'ventrilo': 3784, 'vnc': 5900, + 'wais': 210, 'ws': 80, 'wss': 443, 'xmpp': None} + +# This list of schemes that don't use authorities is also from the link above. +NO_NETLOC_SCHEMES = {'urn', 'about', 'bitcoin', 'blob', 'data', 'geo', + 'magnet', 'mailto', 'news', 'pkcs11', + 'sip', 'sips', 'tel'} +# As of Mar 11, 2017, there were 44 netloc schemes, and 13 non-netloc + +# RFC 3986 section 2.2, Reserved Characters +_GEN_DELIMS = frozenset(':/?#[]@') +_SUB_DELIMS = frozenset("!$&'()*+,;=") +_ALL_DELIMS = _GEN_DELIMS | _SUB_DELIMS + +_USERINFO_SAFE = _UNRESERVED_CHARS | _SUB_DELIMS +_USERINFO_DELIMS = _ALL_DELIMS - _USERINFO_SAFE +_PATH_SAFE = _UNRESERVED_CHARS | _SUB_DELIMS | set(':@') +_PATH_DELIMS = _ALL_DELIMS - _PATH_SAFE +_FRAGMENT_SAFE = _UNRESERVED_CHARS | _PATH_SAFE | set('/?') +_FRAGMENT_DELIMS = _ALL_DELIMS - _FRAGMENT_SAFE +_QUERY_SAFE = _UNRESERVED_CHARS | _FRAGMENT_SAFE - set('&=+') +_QUERY_DELIMS = _ALL_DELIMS - _QUERY_SAFE + + +class URLParseError(ValueError): + """Exception inheriting from :exc:`ValueError`, raised when failing to + parse a URL. Mostly raised on invalid ports and IPv6 addresses. + """ + pass + + +DEFAULT_ENCODING = 'utf8' + + +def to_unicode(obj): + try: + return str(obj) + except UnicodeDecodeError: + return str(obj, encoding=DEFAULT_ENCODING) + + +# regex from gruber via tornado +# doesn't support ipv6 +# doesn't support mailto (netloc-less schemes) +_FIND_ALL_URL_RE = re.compile(r"""\b((?:([\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\s&()<>]|&|")*(?:[^!"#$%'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&|")*\)))+)""") + + +def find_all_links(text, with_text=False, default_scheme='https', schemes=()): + """This function uses heuristics to searches plain text for strings + that look like URLs, returning a :class:`list` of :class:`URL` + objects. It supports limiting the accepted schemes, and returning + interleaved text as well. + + >>> find_all_links('Visit https://boltons.rtfd.org!') + [URL(u'https://boltons.rtfd.org')] + >>> find_all_links('Visit https://boltons.rtfd.org!', with_text=True) + [u'Visit ', URL(u'https://boltons.rtfd.org'), u'!'] + + Args: + text (str): The text to search. + + with_text (bool): Whether or not to interleave plaintext blocks + with the returned URL objects. Having all tokens can be + useful for transforming the text, e.g., replacing links with + HTML equivalents. Defaults to ``False``. + + default_scheme (str): Many URLs are written without the scheme + component. This function can match a reasonable subset of + those, provided *default_scheme* is set to a string. Set to + ``False`` to disable matching scheme-less URLs. Defaults to + ``'https'``. + + schemes (list): A list of strings that a URL's scheme must + match in order to be included in the results. Defaults to + empty, which matches all schemes. + + .. note:: Currently this function does not support finding IPv6 + addresses or URLs with netloc-less schemes, like mailto. + + """ + text = to_unicode(text) + prev_end, start, end = 0, None, None + ret = [] + _add = ret.append + + def _add_text(t): + if ret and isinstance(ret[-1], str): + ret[-1] += t + else: + _add(t) + + for match in _FIND_ALL_URL_RE.finditer(text): + start, end = match.start(1), match.end(1) + if prev_end < start and with_text: + _add(text[prev_end:start]) + prev_end = end + try: + cur_url_text = match.group(0) + cur_url = URL(cur_url_text) + if not cur_url.scheme: + if default_scheme: + cur_url = URL(default_scheme + '://' + cur_url_text) + else: + _add_text(text[start:end]) + continue + if schemes and cur_url.scheme not in schemes: + _add_text(text[start:end]) + else: + _add(cur_url) + except URLParseError: + # currently this should only be hit with broken port + # strings. the regex above doesn't support ipv6 addresses + if with_text: + _add_text(text[start:end]) + + if with_text: + tail = text[prev_end:] + if tail: + _add_text(tail) + + return ret + + +def _make_quote_map(safe_chars): + ret = {} + # v is included in the dict for py3 mostly, because bytestrings + # are iterables of ints, of course! + for i, v in zip(range(256), range(256)): + c = chr(v) + if c in safe_chars: + ret[c] = ret[v] = c + else: + ret[c] = ret[v] = f'%{i:02X}' + return ret + + +_USERINFO_PART_QUOTE_MAP = _make_quote_map(_USERINFO_SAFE) +_PATH_PART_QUOTE_MAP = _make_quote_map(_PATH_SAFE) +_QUERY_PART_QUOTE_MAP = _make_quote_map(_QUERY_SAFE) +_FRAGMENT_QUOTE_MAP = _make_quote_map(_FRAGMENT_SAFE) + + +def quote_path_part(text, full_quote=True): + """ + Percent-encode a single segment of a URL path. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_PATH_PART_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_PATH_PART_QUOTE_MAP[t] if t in _PATH_DELIMS else t + for t in text]) + + +def quote_query_part(text, full_quote=True): + """ + Percent-encode a single query string key or value. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_QUERY_PART_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_QUERY_PART_QUOTE_MAP[t] if t in _QUERY_DELIMS else t + for t in text]) + + +def quote_fragment_part(text, full_quote=True): + """Quote the fragment part of the URL. Fragments don't have + subdelimiters, so the whole URL fragment can be passed. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_FRAGMENT_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_FRAGMENT_QUOTE_MAP[t] if t in _FRAGMENT_DELIMS else t + for t in text]) + + +def quote_userinfo_part(text, full_quote=True): + """Quote special characters in either the username or password + section of the URL. Note that userinfo in URLs is considered + deprecated in many circles (especially browsers), and support for + percent-encoded userinfo can be spotty. + """ + if full_quote: + bytestr = normalize('NFC', to_unicode(text)).encode('utf8') + return ''.join([_USERINFO_PART_QUOTE_MAP[b] for b in bytestr]) + return ''.join([_USERINFO_PART_QUOTE_MAP[t] if t in _USERINFO_DELIMS + else t for t in text]) + + +def unquote(string, encoding='utf-8', errors='replace'): + """Percent-decode a string, by replacing %xx escapes with their + single-character equivalent. The optional *encoding* and *errors* + parameters specify how to decode percent-encoded sequences into + Unicode characters, as accepted by the :meth:`bytes.decode()` method. By + default, percent-encoded sequences are decoded with UTF-8, and + invalid sequences are replaced by a placeholder character. + + >>> unquote(u'abc%20def') + u'abc def' + """ + if '%' not in string: + string.split + return string + if encoding is None: + encoding = 'utf-8' + if errors is None: + errors = 'replace' + bits = _ASCII_RE.split(string) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote_to_bytes(bits[i]).decode(encoding, errors)) + append(bits[i + 1]) + return ''.join(res) + + +def unquote_to_bytes(string): + """unquote_to_bytes('abc%20def') -> b'abc def'.""" + # Note: strings are encoded as UTF-8. This is only an issue if it contains + # unescaped non-ASCII characters, which URIs should not. + if not string: + # Is it a string-like object? + string.split + return b'' + if isinstance(string, str): + string = string.encode('utf-8') + bits = string.split(b'%') + if len(bits) == 1: + return string + # import pdb;pdb.set_trace() + res = [bits[0]] + append = res.append + + for item in bits[1:]: + try: + append(_HEX_CHAR_MAP[item[:2]]) + append(item[2:]) + except KeyError: + append(b'%') + append(item) + return b''.join(res) + + +def register_scheme(text, uses_netloc=None, default_port=None): + """Registers new scheme information, resulting in correct port and + slash behavior from the URL object. There are dozens of standard + schemes preregistered, so this function is mostly meant for + proprietary internal customizations or stopgaps on missing + standards information. If a scheme seems to be missing, please + `file an issue`_! + + Args: + text (str): Text representing the scheme. + (the 'http' in 'http://hatnote.com') + uses_netloc (bool): Does the scheme support specifying a + network host? For instance, "http" does, "mailto" does not. + default_port (int): The default port, if any, for netloc-using + schemes. + + .. _file an issue: https://github.com/mahmoud/boltons/issues + """ + text = text.lower() + if default_port is not None: + try: + default_port = int(default_port) + except ValueError: + raise ValueError('default_port expected integer or None, not %r' + % (default_port,)) + + if uses_netloc is True: + SCHEME_PORT_MAP[text] = default_port + elif uses_netloc is False: + if default_port is not None: + raise ValueError('unexpected default port while specifying' + ' non-netloc scheme: %r' % default_port) + NO_NETLOC_SCHEMES.add(text) + elif uses_netloc is not None: + raise ValueError('uses_netloc expected True, False, or None') + + return + + +def resolve_path_parts(path_parts): + """Normalize the URL path by resolving segments of '.' and '..', + resulting in a dot-free path. See RFC 3986 section 5.2.4, Remove + Dot Segments. + """ + # TODO: what to do with multiple slashes + ret = [] + + for part in path_parts: + if part == '.': + pass + elif part == '..': + if ret and (len(ret) > 1 or ret[0]): # prevent unrooting + ret.pop() + else: + ret.append(part) + + if list(path_parts[-1:]) in (['.'], ['..']): + ret.append('') + + return ret + + +class cachedproperty: + """The ``cachedproperty`` is used similar to :class:`property`, except + that the wrapped method is only called once. This is commonly used + to implement lazy attributes. + + After the property has been accessed, the value is stored on the + instance itself, using the same name as the cachedproperty. This + allows the cache to be cleared with :func:`delattr`, or through + manipulating the object's ``__dict__``. + """ + def __init__(self, func): + self.__doc__ = getattr(func, '__doc__') + self.func = func + + def __get__(self, obj, objtype=None): + if obj is None: + return self + value = obj.__dict__[self.func.__name__] = self.func(obj) + return value + + def __repr__(self): + cn = self.__class__.__name__ + return f'<{cn} func={self.func}>' + + +class URL: + r"""The URL is one of the most ubiquitous data structures in the + virtual and physical landscape. From blogs to billboards, URLs are + so common, that it's easy to overlook their complexity and + power. + + There are 8 parts of a URL, each with its own semantics and + special characters: + + * :attr:`~URL.scheme` + * :attr:`~URL.username` + * :attr:`~URL.password` + * :attr:`~URL.host` + * :attr:`~URL.port` + * :attr:`~URL.path` + * :attr:`~URL.query_params` (query string parameters) + * :attr:`~URL.fragment` + + Each is exposed as an attribute on the URL object. RFC 3986 offers + this brief structural summary of the main URL components:: + + foo://user:pass@example.com:8042/over/there?name=ferret#nose + \_/ \_______/ \_________/ \__/\_________/ \_________/ \__/ + | | | | | | | + scheme userinfo host port path query fragment + + And here's how that example can be manipulated with the URL type: + + >>> url = URL('foo://example.com:8042/over/there?name=ferret#nose') + >>> print(url.host) + example.com + >>> print(url.get_authority()) + example.com:8042 + >>> print(url.qp['name']) # qp is a synonym for query_params + ferret + + URL's approach to encoding is that inputs are decoded as much as + possible, and data remains in this decoded state until re-encoded + using the :meth:`~URL.to_text()` method. In this way, it's similar + to Python's current approach of encouraging immediate decoding of + bytes to text. + + Note that URL instances are mutable objects. If an immutable + representation of the URL is desired, the string from + :meth:`~URL.to_text()` may be used. For an immutable, but + almost-as-featureful, URL object, check out the `hyperlink + package`_. + + .. _hyperlink package: https://github.com/mahmoud/hyperlink + + """ + + # public attributes (for comparison, see __eq__): + _cmp_attrs = ('scheme', 'uses_netloc', 'username', 'password', + 'family', 'host', 'port', 'path', 'query_params', 'fragment') + + def __init__(self, url=''): + # TODO: encoding param. The encoding that underlies the + # percent-encoding is always utf8 for IRIs, but can be Latin-1 + # for other usage schemes. + ud = DEFAULT_PARSED_URL + if url: + if isinstance(url, URL): + url = url.to_text() # better way to copy URLs? + elif isinstance(url, bytes): + try: + url = url.decode(DEFAULT_ENCODING) + except UnicodeDecodeError as ude: + raise URLParseError('expected text or %s-encoded bytes.' + ' try decoding the url bytes and' + ' passing the result. (got: %s)' + % (DEFAULT_ENCODING, ude)) + ud = parse_url(url) + + _e = '' + self.scheme = ud['scheme'] or _e + self._netloc_sep = ud['_netloc_sep'] or _e + self.username = (unquote(ud['username']) + if '%' in (ud['username'] or _e) else ud['username'] or _e) + self.password = (unquote(ud['password']) + if '%' in (ud['password'] or _e) else ud['password'] or _e) + self.family = ud['family'] + + if not ud['host']: + self.host = _e + else: + try: + self.host = ud['host'].encode("ascii") + except UnicodeEncodeError: + self.host = ud['host'] # already non-ascii text + else: + self.host = self.host.decode("idna") + + self.port = ud['port'] + self.path_parts = tuple([unquote(p) if '%' in p else p for p + in (ud['path'] or _e).split('/')]) + self._query = ud['query'] or _e + self.fragment = (unquote(ud['fragment']) + if '%' in (ud['fragment'] or _e) else ud['fragment'] or _e) + # TODO: possibly use None as marker for empty vs missing + return + + @classmethod + def from_parts(cls, scheme=None, host=None, path_parts=(), query_params=(), + fragment='', port=None, username=None, password=None): + """Build a new URL from parts. Note that the respective arguments are + not in the order they would appear in a URL: + + Args: + scheme (str): The scheme of a URL, e.g., 'http' + host (str): The host string, e.g., 'hatnote.com' + path_parts (tuple): The individual text segments of the + path, e.g., ('post', '123') + query_params (dict): An OMD, dict, or list of (key, value) + pairs representing the keys and values of the URL's query + parameters. + fragment (str): The fragment of the URL, e.g., 'anchor1' + port (int): The integer port of URL, automatic defaults are + available for registered schemes. + username (str): The username for the userinfo part of the URL. + password (str): The password for the userinfo part of the URL. + + Note that this method does relatively little + validation. :meth:`URL.to_text()` should be used to check if + any errors are produced while composing the final textual URL. + """ + ret = cls() + + ret.scheme = scheme + ret.host = host + ret.path_parts = tuple(path_parts) or ('',) + ret.query_params.update(query_params) + ret.fragment = fragment + ret.port = port + ret.username = username + ret.password = password + + return ret + + @cachedproperty + def query_params(self): + """The parsed form of the query string of the URL, represented as a + :class:`~dictutils.OrderedMultiDict`. Also available as the + handy alias ``qp``. + + >>> url = URL('http://boltons.readthedocs.io/?utm_source=doctest&python=great') + >>> url.qp.keys() + [u'utm_source', u'python'] + """ + return QueryParamDict.from_text(self._query) + + qp = query_params + + @property + def path(self): + "The URL's path, in text form." + return '/'.join([quote_path_part(p, full_quote=False) + for p in self.path_parts]) + + @path.setter + def path(self, path_text): + self.path_parts = tuple([unquote(p) if '%' in p else p + for p in to_unicode(path_text).split('/')]) + return + + @property + def uses_netloc(self): + """Whether or not a URL uses :code:`:` or :code:`://` to separate the + scheme from the rest of the URL depends on the scheme's own + standard definition. There is no way to infer this behavior + from other parts of the URL. A scheme either supports network + locations or it does not. + + The URL type's approach to this is to check for explicitly + registered schemes, with common schemes like HTTP + preregistered. This is the same approach taken by + :mod:`urlparse`. + + URL adds two additional heuristics if the scheme as a whole is + not registered. First, it attempts to check the subpart of the + scheme after the last ``+`` character. This adds intuitive + behavior for schemes like ``git+ssh``. Second, if a URL with + an unrecognized scheme is loaded, it will maintain the + separator it sees. + + >>> print(URL('fakescheme://test.com').to_text()) + fakescheme://test.com + >>> print(URL('mockscheme:hello:world').to_text()) + mockscheme:hello:world + + """ + default = self._netloc_sep + if self.scheme in SCHEME_PORT_MAP: + return True + if self.scheme in NO_NETLOC_SCHEMES: + return False + if self.scheme.split('+')[-1] in SCHEME_PORT_MAP: + return True + return default + + @property + def default_port(self): + """Return the default port for the currently-set scheme. Returns + ``None`` if the scheme is unrecognized. See + :func:`register_scheme` above. If :attr:`~URL.port` matches + this value, no port is emitted in the output of + :meth:`~URL.to_text()`. + + Applies the same '+' heuristic detailed in :meth:`URL.uses_netloc`. + """ + try: + return SCHEME_PORT_MAP[self.scheme] + except KeyError: + return SCHEME_PORT_MAP.get(self.scheme.split('+')[-1]) + + def normalize(self, with_case=True): + """Resolve any "." and ".." references in the path, as well as + normalize scheme and host casing. To turn off case + normalization, pass ``with_case=False``. + + More information can be found in `Section 6.2.2 of RFC 3986`_. + + .. _Section 6.2.2 of RFC 3986: https://tools.ietf.org/html/rfc3986#section-6.2.2 + """ + self.path_parts = resolve_path_parts(self.path_parts) + + if with_case: + self.scheme = self.scheme.lower() + self.host = self.host.lower() + return + + def navigate(self, dest): + """Factory method that returns a _new_ :class:`URL` based on a given + destination, *dest*. Useful for navigating those relative + links with ease. + + The newly created :class:`URL` is normalized before being returned. + + >>> url = URL('http://boltons.readthedocs.io') + >>> url.navigate('en/latest/') + URL(u'http://boltons.readthedocs.io/en/latest/') + + Args: + dest (str): A string or URL object representing the destination + + More information can be found in `Section 5 of RFC 3986`_. + + .. _Section 5 of RFC 3986: https://tools.ietf.org/html/rfc3986#section-5 + """ + orig_dest = None + if not isinstance(dest, URL): + dest, orig_dest = URL(dest), dest + if dest.scheme and dest.host: + # absolute URLs replace everything, but don't make an + # extra copy if we don't have to + return URL(dest) if orig_dest is None else dest + query_params = dest.query_params + + if dest.path: + if dest.path.startswith('/'): # absolute path + new_path_parts = list(dest.path_parts) + else: # relative path + new_path_parts = list(self.path_parts[:-1]) \ + + list(dest.path_parts) + else: + new_path_parts = list(self.path_parts) + if not query_params: + query_params = self.query_params + + ret = self.from_parts(scheme=dest.scheme or self.scheme, + host=dest.host or self.host, + port=dest.port or self.port, + path_parts=new_path_parts, + query_params=query_params, + fragment=dest.fragment, + username=dest.username or self.username, + password=dest.password or self.password) + ret.normalize() + return ret + + def get_authority(self, full_quote=False, with_userinfo=False): + """Used by URL schemes that have a network location, + :meth:`~URL.get_authority` combines :attr:`username`, + :attr:`password`, :attr:`host`, and :attr:`port` into one + string, the *authority*, that is used for + connecting to a network-accessible resource. + + Used internally by :meth:`~URL.to_text()` and can be useful + for labeling connections. + + >>> url = URL('ftp://user@ftp.debian.org:2121/debian/README') + >>> print(url.get_authority()) + ftp.debian.org:2121 + >>> print(url.get_authority(with_userinfo=True)) + user@ftp.debian.org:2121 + + Args: + full_quote (bool): Whether or not to apply IDNA encoding. + Defaults to ``False``. + with_userinfo (bool): Whether or not to include username + and password, technically part of the + authority. Defaults to ``False``. + + """ + parts = [] + _add = parts.append + if self.username and with_userinfo: + _add(quote_userinfo_part(self.username)) + if self.password: + _add(':') + _add(quote_userinfo_part(self.password)) + _add('@') + if self.host: + if self.family == socket.AF_INET6: + _add('[') + _add(self.host) + _add(']') + elif full_quote: + _add(self.host.encode('idna').decode('ascii')) + else: + _add(self.host) + # TODO: 0 port? + if self.port and self.port != self.default_port: + _add(':') + _add(str(self.port)) + return ''.join(parts) + + def to_text(self, full_quote=False): + """Render a string representing the current state of the URL + object. + + >>> url = URL('http://listen.hatnote.com') + >>> url.fragment = 'en' + >>> print(url.to_text()) + http://listen.hatnote.com#en + + By setting the *full_quote* flag, the URL can either be fully + quoted or minimally quoted. The most common characteristic of + an encoded-URL is the presence of percent-encoded text (e.g., + %60). Unquoted URLs are more readable and suitable + for display, whereas fully-quoted URLs are more conservative + and generally necessary for sending over the network. + """ + scheme = self.scheme + path = '/'.join([quote_path_part(p, full_quote=full_quote) + for p in self.path_parts]) + authority = self.get_authority(full_quote=full_quote, + with_userinfo=True) + query_string = self.query_params.to_text(full_quote=full_quote) + fragment = quote_fragment_part(self.fragment, full_quote=full_quote) + + parts = [] + _add = parts.append + if scheme: + _add(scheme) + _add(':') + if authority: + _add('//') + _add(authority) + elif (scheme and path[:2] != '//' and self.uses_netloc): + _add('//') + if path: + if scheme and authority and path[:1] != '/': + _add('/') + # TODO: i think this is here because relative paths + # with absolute authorities = undefined + _add(path) + if query_string: + _add('?') + _add(query_string) + if fragment: + _add('#') + _add(fragment) + return ''.join(parts) + + def __repr__(self): + cn = self.__class__.__name__ + return f'{cn}({self.to_text()!r})' + + def __str__(self): + return self.to_text() + + def __unicode__(self): + return self.to_text() + + def __eq__(self, other): + for attr in self._cmp_attrs: + if not getattr(self, attr) == getattr(other, attr, None): + return False + return True + + def __ne__(self, other): + return not self == other + + +try: + from socket import inet_pton +except ImportError: + # from https://gist.github.com/nnemkin/4966028 + import ctypes + + class _sockaddr(ctypes.Structure): + _fields_ = [("sa_family", ctypes.c_short), + ("__pad1", ctypes.c_ushort), + ("ipv4_addr", ctypes.c_byte * 4), + ("ipv6_addr", ctypes.c_byte * 16), + ("__pad2", ctypes.c_ulong)] + + WSAStringToAddressA = ctypes.windll.ws2_32.WSAStringToAddressA + WSAAddressToStringA = ctypes.windll.ws2_32.WSAAddressToStringA + + def inet_pton(address_family, ip_string): + addr = _sockaddr() + ip_string = ip_string.encode('ascii') + addr.sa_family = address_family + addr_size = ctypes.c_int(ctypes.sizeof(addr)) + + if WSAStringToAddressA(ip_string, address_family, None, ctypes.byref(addr), ctypes.byref(addr_size)) != 0: + raise OSError(ctypes.FormatError()) + + if address_family == socket.AF_INET: + return ctypes.string_at(addr.ipv4_addr, 4) + if address_family == socket.AF_INET6: + return ctypes.string_at(addr.ipv6_addr, 16) + raise OSError('unknown address family') + + +def parse_host(host): + """\ + Low-level function used to parse the host portion of a URL. + + Returns a tuple of (family, host) where *family* is a + :mod:`socket` module constant or ``None``, and host is a string. + + >>> parse_host('googlewebsite.com') == (None, 'googlewebsite.com') + True + >>> parse_host('[::1]') == (socket.AF_INET6, '::1') + True + >>> parse_host('192.168.1.1') == (socket.AF_INET, '192.168.1.1') + True + + Odd doctest formatting above due to py3's switch from int to enums + for :mod:`socket` constants. + + """ + if not host: + return None, '' + if ':' in host and '[' == host[0] and ']' == host[-1]: + host = host[1:-1] + try: + inet_pton(socket.AF_INET6, host) + except OSError as se: + raise URLParseError(f'invalid IPv6 host: {host!r} ({se!r})') + except UnicodeEncodeError: + pass # TODO: this can't be a real host right? + else: + family = socket.AF_INET6 + return family, host + try: + inet_pton(socket.AF_INET, host) + except (OSError, UnicodeEncodeError): + family = None # not an IP + else: + family = socket.AF_INET + return family, host + + +def parse_url(url_text): + """\ + Used to parse the text for a single URL into a dictionary, used + internally by the :class:`URL` type. + + Note that "URL" has a very narrow, standards-based + definition. While :func:`parse_url` may raise + :class:`URLParseError` under a very limited number of conditions, + such as non-integer port, a surprising number of strings are + technically valid URLs. For instance, the text ``"url"`` is a + valid URL, because it is a relative path. + + In short, do not expect this function to validate form inputs or + other more colloquial usages of URLs. + + >>> res = parse_url('http://127.0.0.1:3000/?a=1') + >>> sorted(res.keys()) # res is a basic dictionary + ['_netloc_sep', 'authority', 'family', 'fragment', 'host', 'password', 'path', 'port', 'query', 'scheme', 'username'] + """ + url_text = str(url_text) + # raise TypeError('parse_url expected text, not %r' % url_str) + um = _URL_RE.match(url_text) + try: + gs = um.groupdict() + except AttributeError: + raise URLParseError('could not parse url: %r' % url_text) + + au_text = gs['authority'] + user, pw, hostinfo = None, None, au_text + + if au_text: + userinfo, sep, hostinfo = au_text.rpartition('@') + if sep: + # TODO: empty userinfo error? + user, _, pw = userinfo.partition(':') + + host, port = None, None + if hostinfo: + host, sep, port_str = hostinfo.partition(':') + if sep: + if host and host[0] == '[' and ']' in port_str: + host_right, _, port_str = port_str.partition(']') + host = host + ':' + host_right + ']' + if port_str and port_str[0] == ':': + port_str = port_str[1:] + + try: + port = int(port_str) + except ValueError: + if port_str: # empty ports ok according to RFC 3986 6.2.3 + raise URLParseError('expected integer for port, not %r' + % port_str) + port = None + + family, host = parse_host(host) + + gs['username'] = user + gs['password'] = pw + gs['family'] = family + gs['host'] = host + gs['port'] = port + return gs + + +DEFAULT_PARSED_URL = parse_url('') + + +def parse_qsl(qs, keep_blank_values=True, encoding=DEFAULT_ENCODING): + """ + Converts a query string into a list of (key, value) pairs. + """ + pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')] + ret = [] + for pair in pairs: + if not pair: + continue + key, _, value = pair.partition('=') + if not value: + if keep_blank_values: + value = None + else: + continue + key = unquote(key.replace('+', ' ')) + if value: + value = unquote(value.replace('+', ' ')) + ret.append((key, value)) + return ret + + +""" +# What follows is the OrderedMultiDict from dictutils.py, circa +# 20161021, used for the QueryParamDict, toward the bottom. +""" + +from collections.abc import KeysView, ValuesView, ItemsView +from itertools import zip_longest + +try: + from .typeutils import make_sentinel + _MISSING = make_sentinel(var_name='_MISSING') +except ImportError: + _MISSING = object() + + +PREV, NEXT, KEY, VALUE, SPREV, SNEXT = range(6) + + +class OrderedMultiDict(dict): + """A MultiDict is a dictionary that can have multiple values per key + and the OrderedMultiDict (OMD) is a MultiDict that retains + original insertion order. Common use cases include: + + * handling query strings parsed from URLs + * inverting a dictionary to create a reverse index (values to keys) + * stacking data from multiple dictionaries in a non-destructive way + + The OrderedMultiDict constructor is identical to the built-in + :class:`dict`, and overall the API constitutes an intuitive + superset of the built-in type: + + >>> omd = OrderedMultiDict() + >>> omd['a'] = 1 + >>> omd['b'] = 2 + >>> omd.add('a', 3) + >>> omd.get('a') + 3 + >>> omd.getlist('a') + [1, 3] + + Some non-:class:`dict`-like behaviors also make an appearance, + such as support for :func:`reversed`: + + >>> list(reversed(omd)) + ['b', 'a'] + + Note that unlike some other MultiDicts, this OMD gives precedence + to the most recent value added. ``omd['a']`` refers to ``3``, not + ``1``. + + >>> omd + OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> omd.poplast('a') + 3 + >>> omd + OrderedMultiDict([('a', 1), ('b', 2)]) + >>> omd.pop('a') + 1 + >>> omd + OrderedMultiDict([('b', 2)]) + + If you want a safe-to-modify or flat dictionary, use + :meth:`OrderedMultiDict.todict()`. + + >>> from pprint import pprint as pp # preserve printed ordering + >>> omd = OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]) + >>> pp(omd.todict()) + {'a': 3, 'b': 2} + >>> pp(omd.todict(multi=True)) + {'a': [1, 3], 'b': [2]} + + With ``multi=False``, items appear with the keys in to original + insertion order, alongside the most-recently inserted value for + that key. + + >>> OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]).items(multi=False) + [('a', 3), ('b', 2)] + + .. warning:: + + ``dict(omd)`` changed behavior `in Python 3.7 + `_ due to changes made to + support the transition from :class:`collections.OrderedDict` to + the built-in dictionary being ordered. Before 3.7, the result + would be a new dictionary, with values that were lists, similar + to ``omd.todict(multi=True)`` (but only shallow-copy; the lists + were direct references to OMD internal structures). From 3.7 + onward, the values became singular, like + ``omd.todict(multi=False)``. For reliable cross-version + behavior, just use :meth:`~OrderedMultiDict.todict()`. + + """ + def __new__(cls, *a, **kw): + ret = super().__new__(cls) + ret._clear_ll() + return ret + + def __init__(self, *args, **kwargs): + if len(args) > 1: + raise TypeError('%s expected at most 1 argument, got %s' + % (self.__class__.__name__, len(args))) + super().__init__() + + if args: + self.update_extend(args[0]) + if kwargs: + self.update(kwargs) + + def __getstate__(self): + return list(self.iteritems(multi=True)) + + def __setstate__(self, state): + self.clear() + self.update_extend(state) + + def _clear_ll(self): + try: + _map = self._map + except AttributeError: + _map = self._map = {} + self.root = [] + _map.clear() + self.root[:] = [self.root, self.root, None] + + def _insert(self, k, v): + root = self.root + cells = self._map.setdefault(k, []) + last = root[PREV] + cell = [last, root, k, v] + last[NEXT] = root[PREV] = cell + cells.append(cell) + + def add(self, k, v): + """Add a single value *v* under a key *k*. Existing values under *k* + are preserved. + """ + values = super().setdefault(k, []) + self._insert(k, v) + values.append(v) + + def addlist(self, k, v): + """Add an iterable of values underneath a specific key, preserving + any values already under that key. + + >>> omd = OrderedMultiDict([('a', -1)]) + >>> omd.addlist('a', range(3)) + >>> omd + OrderedMultiDict([('a', -1), ('a', 0), ('a', 1), ('a', 2)]) + + Called ``addlist`` for consistency with :meth:`getlist`, but + tuples and other sequences and iterables work. + """ + if not v: + return + self_insert = self._insert + values = super().setdefault(k, []) + for subv in v: + self_insert(k, subv) + values.extend(v) + + def get(self, k, default=None): + """Return the value for key *k* if present in the dictionary, else + *default*. If *default* is not given, ``None`` is returned. + This method never raises a :exc:`KeyError`. + + To get all values under a key, use :meth:`OrderedMultiDict.getlist`. + """ + return super().get(k, [default])[-1] + + def getlist(self, k, default=_MISSING): + """Get all values for key *k* as a list, if *k* is in the + dictionary, else *default*. The list returned is a copy and + can be safely mutated. If *default* is not given, an empty + :class:`list` is returned. + """ + try: + return super().__getitem__(k)[:] + except KeyError: + if default is _MISSING: + return [] + return default + + def clear(self): + "Empty the dictionary." + super().clear() + self._clear_ll() + + def setdefault(self, k, default=_MISSING): + """If key *k* is in the dictionary, return its value. If not, insert + *k* with a value of *default* and return *default*. *default* + defaults to ``None``. See :meth:`dict.setdefault` for more + information. + """ + if not super().__contains__(k): + self[k] = None if default is _MISSING else default + return self[k] + + def copy(self): + "Return a shallow copy of the dictionary." + return self.__class__(self.iteritems(multi=True)) + + @classmethod + def fromkeys(cls, keys, default=None): + """Create a dictionary from a list of keys, with all the values + set to *default*, or ``None`` if *default* is not set. + """ + return cls([(k, default) for k in keys]) + + def update(self, E, **F): + """Add items from a dictionary or iterable (and/or keyword arguments), + overwriting values under an existing key. See + :meth:`dict.update` for more details. + """ + # E and F are throwback names to the dict() __doc__ + if E is self: + return + self_add = self.add + if isinstance(E, OrderedMultiDict): + for k in E: + if k in self: + del self[k] + for k, v in E.iteritems(multi=True): + self_add(k, v) + elif callable(getattr(E, 'keys', None)): + for k in E.keys(): + self[k] = E[k] + else: + seen = set() + seen_add = seen.add + for k, v in E: + if k not in seen and k in self: + del self[k] + seen_add(k) + self_add(k, v) + for k in F: + self[k] = F[k] + return + + def update_extend(self, E, **F): + """Add items from a dictionary, iterable, and/or keyword + arguments without overwriting existing items present in the + dictionary. Like :meth:`update`, but adds to existing keys + instead of overwriting them. + """ + if E is self: + iterator = iter(E.items()) + elif isinstance(E, OrderedMultiDict): + iterator = E.iteritems(multi=True) + elif hasattr(E, 'keys'): + iterator = ((k, E[k]) for k in E.keys()) + else: + iterator = E + + self_add = self.add + for k, v in iterator: + self_add(k, v) + + def __setitem__(self, k, v): + if super().__contains__(k): + self._remove_all(k) + self._insert(k, v) + super().__setitem__(k, [v]) + + def __getitem__(self, k): + return super().__getitem__(k)[-1] + + def __delitem__(self, k): + super().__delitem__(k) + self._remove_all(k) + + def __eq__(self, other): + if self is other: + return True + try: + if len(other) != len(self): + return False + except TypeError: + return False + if isinstance(other, OrderedMultiDict): + selfi = self.iteritems(multi=True) + otheri = other.iteritems(multi=True) + zipped_items = zip_longest(selfi, otheri, fillvalue=(None, None)) + for (selfk, selfv), (otherk, otherv) in zipped_items: + if selfk != otherk or selfv != otherv: + return False + if not(next(selfi, _MISSING) is _MISSING + and next(otheri, _MISSING) is _MISSING): + # leftovers (TODO: watch for StopIteration?) + return False + return True + elif hasattr(other, 'keys'): + for selfk in self: + try: + other[selfk] == self[selfk] + except KeyError: + return False + return True + return False + + def __ne__(self, other): + return not (self == other) + + def __ior__(self, other): + self.update(other) + return self + + def pop(self, k, default=_MISSING): + """Remove all values under key *k*, returning the most-recently + inserted value. Raises :exc:`KeyError` if the key is not + present and no *default* is provided. + """ + try: + return self.popall(k)[-1] + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + + def popall(self, k, default=_MISSING): + """Remove all values under key *k*, returning them in the form of + a list. Raises :exc:`KeyError` if the key is not present and no + *default* is provided. + """ + super_self = super() + if super_self.__contains__(k): + self._remove_all(k) + if default is _MISSING: + return super_self.pop(k) + return super_self.pop(k, default) + + def poplast(self, k=_MISSING, default=_MISSING): + """Remove and return the most-recently inserted value under the key + *k*, or the most-recently inserted key if *k* is not + provided. If no values remain under *k*, it will be removed + from the OMD. Raises :exc:`KeyError` if *k* is not present in + the dictionary, or the dictionary is empty. + """ + if k is _MISSING: + if self: + k = self.root[PREV][KEY] + else: + if default is _MISSING: + raise KeyError('empty %r' % type(self)) + return default + try: + self._remove(k) + except KeyError: + if default is _MISSING: + raise KeyError(k) + return default + values = super().__getitem__(k) + v = values.pop() + if not values: + super().__delitem__(k) + return v + + def _remove(self, k): + values = self._map[k] + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + if not values: + del self._map[k] + + def _remove_all(self, k): + values = self._map[k] + while values: + cell = values.pop() + cell[PREV][NEXT], cell[NEXT][PREV] = cell[NEXT], cell[PREV] + del self._map[k] + + def iteritems(self, multi=False): + """Iterate over the OMD's items in insertion order. By default, + yields only the most-recently inserted value for each key. Set + *multi* to ``True`` to get all inserted items. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY], curr[VALUE] + curr = curr[NEXT] + else: + for key in self.iterkeys(): + yield key, self[key] + + def iterkeys(self, multi=False): + """Iterate over the OMD's keys in insertion order. By default, yields + each key once, according to the most recent insertion. Set + *multi* to ``True`` to get all keys, including duplicates, in + insertion order. + """ + root = self.root + curr = root[NEXT] + if multi: + while curr is not root: + yield curr[KEY] + curr = curr[NEXT] + else: + yielded = set() + yielded_add = yielded.add + while curr is not root: + k = curr[KEY] + if k not in yielded: + yielded_add(k) + yield k + curr = curr[NEXT] + + def itervalues(self, multi=False): + """Iterate over the OMD's values in insertion order. By default, + yields the most-recently inserted value per unique key. Set + *multi* to ``True`` to get all values according to insertion + order. + """ + for k, v in self.iteritems(multi=multi): + yield v + + def todict(self, multi=False): + """Gets a basic :class:`dict` of the items in this dictionary. Keys + are the same as the OMD, values are the most recently inserted + values for each key. + + Setting the *multi* arg to ``True`` is yields the same + result as calling :class:`dict` on the OMD, except that all the + value lists are copies that can be safely mutated. + """ + if multi: + return {k: self.getlist(k) for k in self} + return {k: self[k] for k in self} + + def sorted(self, key=None, reverse=False): + """Similar to the built-in :func:`sorted`, except this method returns + a new :class:`OrderedMultiDict` sorted by the provided key + function, optionally reversed. + + Args: + key (callable): A callable to determine the sort key of + each element. The callable should expect an **item** + (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict(zip(range(3), range(3))) + >>> omd.sorted(reverse=True) + OrderedMultiDict([(2, 2), (1, 1), (0, 0)]) + + Note that the key function receives an **item** (key-value + tuple), so the recommended signature looks like: + + >>> omd = OrderedMultiDict(zip('hello', 'world')) + >>> omd.sorted(key=lambda i: i[1]) # i[0] is the key, i[1] is the val + OrderedMultiDict([('o', 'd'), ('l', 'l'), ('e', 'o'), ('l', 'r'), ('h', 'w')]) + """ + cls = self.__class__ + return cls(sorted(self.iteritems(multi=True), key=key, reverse=reverse)) + + def sortedvalues(self, key=None, reverse=False): + """Returns a copy of the :class:`OrderedMultiDict` with the same keys + in the same order as the original OMD, but the values within + each keyspace have been sorted according to *key* and + *reverse*. + + Args: + key (callable): A single-argument callable to determine + the sort key of each element. The callable should expect + an **item** (key-value pair tuple). + reverse (bool): Set to ``True`` to reverse the ordering. + + >>> omd = OrderedMultiDict() + >>> omd.addlist('even', [6, 2]) + >>> omd.addlist('odd', [1, 5]) + >>> omd.add('even', 4) + >>> omd.add('odd', 3) + >>> somd = omd.sortedvalues() + >>> somd.getlist('even') + [2, 4, 6] + >>> somd.keys(multi=True) == omd.keys(multi=True) + True + >>> omd == somd + False + >>> somd + OrderedMultiDict([('even', 2), ('even', 4), ('odd', 1), ('odd', 3), ('even', 6), ('odd', 5)]) + + As demonstrated above, contents and key order are + retained. Only value order changes. + """ + try: + superself_iteritems = super().iteritems() + except AttributeError: + superself_iteritems = super().items() + # (not reverse) because they pop off in reverse order for reinsertion + sorted_val_map = {k: sorted(v, key=key, reverse=(not reverse)) + for k, v in superself_iteritems} + ret = self.__class__() + for k in self.iterkeys(multi=True): + ret.add(k, sorted_val_map[k].pop()) + return ret + + def inverted(self): + """Returns a new :class:`OrderedMultiDict` with values and keys + swapped, like creating dictionary transposition or reverse + index. Insertion order is retained and all keys and values + are represented in the output. + + >>> omd = OMD([(0, 2), (1, 2)]) + >>> omd.inverted().getlist(2) + [0, 1] + + Inverting twice yields a copy of the original: + + >>> omd.inverted().inverted() + OrderedMultiDict([(0, 2), (1, 2)]) + """ + return self.__class__((v, k) for k, v in self.iteritems(multi=True)) + + def counts(self): + """Returns a mapping from key to number of values inserted under that + key. Like :py:class:`collections.Counter`, but returns a new + :class:`OrderedMultiDict`. + """ + # Returns an OMD because Counter/OrderedDict may not be + # available, and neither Counter nor dict maintain order. + super_getitem = super().__getitem__ + return self.__class__((k, len(super_getitem(k))) for k in self) + + def keys(self, multi=False): + """Returns a list containing the output of :meth:`iterkeys`. See + that method's docs for more details. + """ + return list(self.iterkeys(multi=multi)) + + def values(self, multi=False): + """Returns a list containing the output of :meth:`itervalues`. See + that method's docs for more details. + """ + return list(self.itervalues(multi=multi)) + + def items(self, multi=False): + """Returns a list containing the output of :meth:`iteritems`. See + that method's docs for more details. + """ + return list(self.iteritems(multi=multi)) + + def __iter__(self): + return self.iterkeys() + + def __reversed__(self): + root = self.root + curr = root[PREV] + lengths = {} + lengths_sd = lengths.setdefault + get_values = super().__getitem__ + while curr is not root: + k = curr[KEY] + vals = get_values(k) + if lengths_sd(k, 1) == len(vals): + yield k + lengths[k] += 1 + curr = curr[PREV] + + def __repr__(self): + cn = self.__class__.__name__ + kvs = ', '.join([repr((k, v)) for k, v in self.iteritems(multi=True)]) + return f'{cn}([{kvs}])' + + def viewkeys(self): + "OMD.viewkeys() -> a set-like object providing a view on OMD's keys" + return KeysView(self) + + def viewvalues(self): + "OMD.viewvalues() -> an object providing a view on OMD's values" + return ValuesView(self) + + def viewitems(self): + "OMD.viewitems() -> a set-like object providing a view on OMD's items" + return ItemsView(self) + + + +try: + # try to import the built-in one anyways + from .dictutils import OrderedMultiDict +except ImportError: + pass + +OMD = OrderedMultiDict + + +class QueryParamDict(OrderedMultiDict): + """A subclass of :class:`~dictutils.OrderedMultiDict` specialized for + representing query string values. Everything is fully unquoted on + load and all parsed keys and values are strings by default. + + As the name suggests, multiple values are supported and insertion + order is preserved. + + >>> qp = QueryParamDict.from_text(u'key=val1&key=val2&utm_source=rtd') + >>> qp.getlist('key') + [u'val1', u'val2'] + >>> qp['key'] + u'val2' + >>> qp.add('key', 'val3') + >>> qp.to_text() + 'key=val1&key=val2&utm_source=rtd&key=val3' + + See :class:`~dictutils.OrderedMultiDict` for more API features. + """ + + @classmethod + def from_text(cls, query_string): + """ + Parse *query_string* and return a new :class:`QueryParamDict`. + """ + pairs = parse_qsl(query_string, keep_blank_values=True) + return cls(pairs) + + def to_text(self, full_quote=False): + """ + Render and return a query string. + + Args: + full_quote (bool): Whether or not to percent-quote special + characters or leave them decoded for readability. + """ + ret_list = [] + for k, v in self.iteritems(multi=True): + key = quote_query_part(to_unicode(k), full_quote=full_quote) + if v is None: + ret_list.append(key) + else: + val = quote_query_part(to_unicode(v), full_quote=full_quote) + ret_list.append('='.join((key, val))) + return '&'.join(ret_list) + +# end urlutils.py diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0.conda b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..baec3e8bd6172dca04d8816d299d555cc612255a --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d13694da029eb587dcdce691e4a6a1590ac5de65f0cde234fff849fd7985168 +size 381299 diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/about.json b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/about.json new file mode 100644 index 0000000000000000000000000000000000000000..a8128f9393d34daeb1938ea171e94140568446a7 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/about.json @@ -0,0 +1,177 @@ +{ + "channels": [ + "https://repo.anaconda.com/pkgs/main", + "https://repo.anaconda.com/pkgs/r", + "https://repo.anaconda.com/pkgs/r" + ], + "conda_build_version": "25.1.2", + "conda_version": "25.1.1", + "description": "Python CFFI bindings to the Brotli library", + "dev_url": "https://github.com/python-hyper/brotlicffi", + "doc_url": "https://github.com/python-hyper/brotlicffi/blob/main/README.rst", + "env_vars": { + "CIO_TEST": "" + }, + "extra": { + "copy_test_source_files": true, + "final": true, + "recipe-maintainers": [ + "sarthakpati", + "sethmlarson", + "katietz" + ], + "skip-lints": [ + "host_section_needs_exact_pinnings" + ] + }, + "home": "https://github.com/python-hyper/brotlicffi", + "identifiers": [], + "keywords": [], + "license": "MIT", + "license_family": "MIT", + "license_file": "LICENSE", + "root_pkgs": [ + "_libgcc_mutex 0.1 main", + "ca-certificates 2025.11.4 h06a4308_0", + "ld_impl_linux-64 2.40 h12ee557_0", + "libstdcxx-ng 11.2.0 h1234567_1", + "nlohmann_json 3.11.2 h6a678d5_0", + "pybind11-abi 5 hd3eb1b0_0", + "tzdata 2025a h04d1e81_0", + "libgomp 11.2.0 h1234567_1", + "_openmp_mutex 5.1 1_gnu", + "libgcc-ng 11.2.0 h1234567_1", + "bzip2 1.0.8 h5eee18b_6", + "c-ares 1.19.1 h5eee18b_0", + "cpp-expected 1.1.0 hdb19cb5_0", + "expat 2.7.3 h3385a95_0", + "fmt 9.1.0 hdb19cb5_1", + "icu 73.1 h6a678d5_0", + "libev 4.33 h7f8727e_1", + "libffi 3.4.4 h6a678d5_1", + "libuuid 1.41.5 h5eee18b_0", + "lz4-c 1.9.4 h6a678d5_1", + "ncurses 6.4 h6a678d5_0", + "reproc 14.2.4 h6a678d5_2", + "simdjson 3.10.1 hdb19cb5_0", + "xz 5.4.6 h5eee18b_1", + "yaml-cpp 0.8.0 h6a678d5_1", + "zlib 1.2.13 h5eee18b_1", + "libedit 3.1.20230828 h5eee18b_0", + "libnghttp2 1.57.0 h2d74bed_0", + "libssh2 1.11.1 h251f7ec_0", + "libxml2 2.13.5 hfdd30dd_0", + "pcre2 10.42 hebb0a14_1", + "readline 8.2 h5eee18b_0", + "reproc-cpp 14.2.4 h6a678d5_2", + "spdlog 1.11.0 hdb19cb5_0", + "patch 2.8 hb25bd0a_0", + "zstd 1.5.6 hc292b87_0", + "krb5 1.20.1 h143b758_1", + "libarchive 3.7.7 hfab0078_0", + "libsolv 0.7.30 he621ea3_1", + "sqlite 3.45.3 h5eee18b_0", + "python 3.12.9 h5148396_0", + "libmamba 2.0.5 haf1ee3a_1", + "menuinst 2.2.0 py312h06a4308_1", + "anaconda-anon-usage 0.5.0 py312hfc0e8ea_100", + "annotated-types 0.6.0 py312h06a4308_0", + "archspec 0.2.3 pyhd3eb1b0_0", + "boltons 24.1.0 py312h06a4308_0", + "brotli-python 1.0.9 py312h6a678d5_9", + "charset-normalizer 3.3.2 pyhd3eb1b0_0", + "distro 1.9.0 py312h06a4308_0", + "frozendict 2.4.2 py312h06a4308_0", + "idna 3.7 py312h06a4308_0", + "jsonpointer 2.1 pyhd3eb1b0_0", + "libmambapy 2.0.5 py312hdb19cb5_1", + "mdurl 0.1.0 py312h06a4308_0", + "packaging 24.2 py312h06a4308_0", + "platformdirs 3.10.0 py312h06a4308_0", + "pluggy 1.5.0 py312h06a4308_0", + "pycosat 0.6.6 py312h5eee18b_2", + "pycparser 2.21 pyhd3eb1b0_0", + "pygments 2.15.1 py312h06a4308_1", + "pysocks 1.7.1 py312h06a4308_0", + "ruamel.yaml.clib 0.2.8 py312h5eee18b_0", + "setuptools 75.8.0 py312h06a4308_0", + "tqdm 4.67.1 py312he106c6f_0", + "truststore 0.10.0 py312h06a4308_0", + "typing_extensions 4.12.2 py312h06a4308_0", + "wheel 0.45.1 py312h06a4308_0", + "cffi 1.17.1 py312h1fdaa30_1", + "jsonpatch 1.33 py312h06a4308_1", + "markdown-it-py 2.2.0 py312h06a4308_1", + "pip 25.0 py312h06a4308_0", + "ruamel.yaml 0.18.6 py312h5eee18b_0", + "typing-extensions 4.12.2 py312h06a4308_0", + "urllib3 2.3.0 py312h06a4308_0", + "cryptography 43.0.3 py312h7825ff9_1", + "pydantic-core 2.27.1 py312h4aa5aa6_0", + "requests 2.32.3 py312h06a4308_1", + "rich 13.9.4 py312h06a4308_0", + "zstandard 0.23.0 py312h2c38b39_1", + "conda-content-trust 0.2.0 py312h06a4308_1", + "conda-package-streaming 0.11.0 py312h06a4308_0", + "pydantic 2.10.3 py312h06a4308_0", + "conda-package-handling 2.4.0 py312h06a4308_0", + "conda 25.1.1 py312h06a4308_0", + "conda-anaconda-tos 0.1.2 py312h06a4308_0", + "conda-libmamba-solver 25.1.1 pyhd3eb1b0_0", + "libiconv 1.16 h5eee18b_3", + "liblief 0.12.3 h6a678d5_0", + "libsodium 1.0.20 heac8642_0", + "libunistring 1.3 hb25bd0a_0", + "openssl 3.0.18 hd6dcaed_0", + "patchelf 0.17.2 h6a678d5_0", + "perl 5.40.2 0_h5eee18b_perl5", + "pthread-stubs 0.3 h0ce48e5_1", + "xorg-libxau 1.0.12 h9b100fa_0", + "xorg-libxdmcp 1.1.5 h9b100fa_0", + "xorg-xorgproto 2024.1 h5eee18b_1", + "yaml 0.2.5 h7b6447c_0", + "libxcb 1.17.0 h9b100fa_0", + "gettext 0.21.0 hedfda30_2", + "xorg-libx11 1.8.12 h9b100fa_1", + "libidn2 2.3.8 hf80d704_0", + "tk 8.6.15 h54e0aa7_0", + "libcurl 8.16.0 heebcbe5_0", + "git 2.51.0 pl5382h000ed5b_0", + "argcomplete 3.6.2 py312h06a4308_0", + "attrs 25.4.0 py312h06a4308_2", + "certifi 2025.10.5 py312h06a4308_0", + "chardet 5.2.0 py312h06a4308_0", + "click 8.2.1 py312h06a4308_0", + "filelock 3.20.0 py312h06a4308_0", + "jmespath 1.0.1 py312h06a4308_0", + "markupsafe 3.0.2 py312h5eee18b_0", + "more-itertools 10.8.0 py312h06a4308_0", + "pkginfo 1.12.0 py312h06a4308_0", + "psutil 7.0.0 py312hee96239_1", + "py-lief 0.12.3 py312h6a678d5_0", + "python-libarchive-c 5.1 pyhd3eb1b0_0", + "pytz 2025.2 py312h06a4308_0", + "pyyaml 6.0.2 py312h5eee18b_0", + "rpds-py 0.28.0 py312h498d7c9_0", + "six 1.17.0 py312h06a4308_0", + "soupsieve 2.5 py312h06a4308_0", + "tomlkit 0.13.2 py312h06a4308_0", + "xmltodict 0.14.2 py312h06a4308_0", + "jinja2 3.1.6 py312h06a4308_0", + "python-dateutil 2.9.0post0 py312h06a4308_2", + "referencing 0.37.0 py312h06a4308_0", + "yq 3.4.3 py312h06a4308_0", + "beautifulsoup4 4.13.5 py312h06a4308_0", + "botocore 1.40.54 py312h06a4308_0", + "jsonschema-specifications 2023.7.1 py312h06a4308_1", + "pynacl 1.5.0 py312h2630517_2", + "jsonschema 4.25.0 py312h06a4308_1", + "s3transfer 0.14.0 py312h06a4308_0", + "boto3 1.40.54 py312h06a4308_0", + "conda-anaconda-telemetry 0.3.0 pyhd3eb1b0_1", + "conda-index 0.5.0 py312h06a4308_0", + "conda-build 25.1.2 py312h06a4308_0" + ], + "summary": "Python CFFI bindings to the Brotli library", + "tags": [] +} \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/files b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/files new file mode 100644 index 0000000000000000000000000000000000000000..7d05fe6a32d655b03a29004f1217b9adced0c21d --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/files @@ -0,0 +1,15 @@ +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/INSTALLER +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/METADATA +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/RECORD +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/REQUESTED +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/WHEEL +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/direct_url.json +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/licenses/LICENSE +lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/top_level.txt +lib/python3.13/site-packages/brotlicffi/__init__.py +lib/python3.13/site-packages/brotlicffi/__pycache__/__init__.cpython-313.pyc +lib/python3.13/site-packages/brotlicffi/__pycache__/_api.cpython-313.pyc +lib/python3.13/site-packages/brotlicffi/__pycache__/_build.cpython-313.pyc +lib/python3.13/site-packages/brotlicffi/_api.py +lib/python3.13/site-packages/brotlicffi/_brotlicffi.abi3.so +lib/python3.13/site-packages/brotlicffi/_build.py diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/git b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/git new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/hash_input.json b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/hash_input.json new file mode 100644 index 0000000000000000000000000000000000000000..5e8a32fd9677a899ab5636a49868081d25a1f681 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/hash_input.json @@ -0,0 +1,11 @@ +{ + "c_compiler_version": "14.3.0", + "c_stdlib": "sysroot", + "c_stdlib_version": "2.28", + "target_platform": "linux-64", + "c_compiler": "gcc", + "channel_targets": "defaults", + "cxx_compiler_version": "14.3.0", + "cxx_compiler": "gxx", + "__glibc": "__glibc >=2.28,<3.0.a0" +} \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/index.json b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/index.json new file mode 100644 index 0000000000000000000000000000000000000000..3ed63610553057c3d839c0a34bde29d2d5727d7d --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/index.json @@ -0,0 +1,20 @@ +{ + "arch": "x86_64", + "build": "py313h7354ed3_0", + "build_number": 0, + "depends": [ + "__glibc >=2.28,<3.0.a0", + "cffi >=1.17.0", + "libgcc >=14", + "libstdcxx >=14", + "python >=3.13,<3.14.0a0", + "python_abi 3.13.* *_cp313" + ], + "license": "MIT", + "license_family": "MIT", + "name": "brotlicffi", + "platform": "linux", + "subdir": "linux-64", + "timestamp": 1764961365931, + "version": "1.2.0.0" +} \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/licenses/LICENSE b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d6466b602473a2683ccf84a9f6c6dce140a058e3 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/licenses/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Cory Benfield + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/paths.json b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/paths.json new file mode 100644 index 0000000000000000000000000000000000000000..a1fbe4bd5bce6d489d61ad3aabbdd364f55818cc --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/paths.json @@ -0,0 +1,95 @@ +{ + "paths": [ + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/INSTALLER", + "path_type": "hardlink", + "sha256": "d0edee15f91b406f3f99726e44eb990be6e34fd0345b52b910c568e0eef6a2a8", + "size_in_bytes": 5 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/METADATA", + "path_type": "hardlink", + "sha256": "2e4bafc5a4edf61c2ebcc211410af4b9b4ccc23228fa5955d286a008610caf08", + "size_in_bytes": 6437 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/RECORD", + "path_type": "hardlink", + "sha256": "f42108c8a623a2df2842786354e5ac8fb5a0b47ff249ada3af2c4a53257cf813", + "size_in_bytes": 1184 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/REQUESTED", + "path_type": "hardlink", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "size_in_bytes": 0 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/WHEEL", + "path_type": "hardlink", + "sha256": "6906c35aa95a6ab88f84f10d39ff732de00450ef653c75c86921518a03ad9fc1", + "size_in_bytes": 103 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/direct_url.json", + "path_type": "hardlink", + "sha256": "a554876de23fdcdbbfd40efafbc185b5caf6273a007a33afc9241a40b54f2a63", + "size_in_bytes": 100 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/licenses/LICENSE", + "path_type": "hardlink", + "sha256": "f3e9c29e3db36dc305a4be68a8a225f93949852ce2d19b5b0a3c099eee6509c5", + "size_in_bytes": 1056 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/top_level.txt", + "path_type": "hardlink", + "sha256": "40db176816f56fb1450e844e80c0681d30f07ec5a26bb757e462d18540cfc973", + "size_in_bytes": 23 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi/__init__.py", + "path_type": "hardlink", + "sha256": "35a55dfc833d87d8de1e7387f71511fbae3a66ef1389422e56d0e1e65d6ea60d", + "size_in_bytes": 224 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi/__pycache__/__init__.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "a6993350ac3263a2eff350c9066933373fef80f9d14650f7f9ce1714f9630d6e", + "size_in_bytes": 449 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi/__pycache__/_api.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "9ecf81851999a5b5badf3f3f0b3017a9adf09abd4625251f08e0d3ad8aacec9e", + "size_in_bytes": 20178 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi/__pycache__/_build.cpython-313.pyc", + "path_type": "hardlink", + "sha256": "c9091435d8e4bb195bc7db840a98d3556672c3d3bfb45706d5b61e98d9594463", + "size_in_bytes": 9767 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi/_api.py", + "path_type": "hardlink", + "sha256": "f529edbf7e45ce053bf3e2a9dc0a8bc12133dd6b5c724e447d19ebd2bb374e88", + "size_in_bytes": 19563 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi/_brotlicffi.abi3.so", + "path_type": "hardlink", + "sha256": "127085fae8f4a7d5a50754018518e4e67e6feb931920fd85fa14ed2fe0d11783", + "size_in_bytes": 899376 + }, + { + "_path": "lib/python3.13/site-packages/brotlicffi/_build.py", + "path_type": "hardlink", + "sha256": "26cf85a2f6f3348b11f0285f5971fc42ea6cec9b939b73d6468de1edc278e251", + "size_in_bytes": 9328 + } + ], + "paths_version": 1 +} \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/conda_build_config.yaml b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/conda_build_config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c7e405f3472f0dfe19e561acb9d229b081f92998 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/conda_build_config.yaml @@ -0,0 +1,32 @@ +c_compiler: gcc +c_compiler_version: 14.3.0 +c_stdlib: sysroot +c_stdlib_version: '2.28' +channel_targets: defaults +cpu_optimization_target: nocona +cran_mirror: https://cran.r-project.org +cxx_compiler: gxx +cxx_compiler_version: 14.3.0 +extend_keys: +- ignore_version +- pin_run_as_build +- extend_keys +- ignore_build_only_deps +fortran_compiler: gfortran +ignore_build_only_deps: +- numpy +- python +lua: '5' +numpy: '1.26' +perl: 5.26.2 +pin_run_as_build: + python: + max_pin: x.x + min_pin: x.x + r-base: + max_pin: x.x + min_pin: x.x +platform: linux-64 +python: '3.13' +r_base: '3.5' +target_platform: linux-64 diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/meta.yaml b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ecc7159eb8e46d83b2118143f927d9a2f9ee303a --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/meta.yaml @@ -0,0 +1,109 @@ +# This file created by conda-build 25.1.2 +# meta.yaml template originally from: +# /home/task_176496126124857/brotlicffi-feedstock/recipe, last modified Fri Dec 5 19:01:22 2025 +# ------------------------------------------------ + +package: + name: brotlicffi + version: 1.2.0.0 +source: + sha256: 34345d8d1f9d534fcac2249e57a4c3c8801a33c9942ff9f8574f67a175e17adb + url: https://pypi.org/packages/source/b/brotlicffi/brotlicffi-1.2.0.0.tar.gz +build: + number: '0' + script: /home/task_176496126124857/conda-bld/brotlicffi_1764961326114/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh/bin/python + -m pip install . --no-deps --no-build-isolation -vv + string: py313h7354ed3_0 +requirements: + build: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - binutils_impl_linux-64 2.44 h4b9a079_2 + - binutils_linux-64 2.44 hc03a8fd_2 + - gcc_impl_linux-64 14.3.0 h4943218_4 + - gcc_linux-64 14.3.0 hda73cce_12 + - gxx_impl_linux-64 14.3.0 he634eba_4 + - gxx_linux-64 14.3.0 hca8765c_12 + - kernel-headers_linux-64 4.18.0 h3108a97_1 + - ld_impl_linux-64 2.44 h153f514_2 + - libgcc 15.2.0 h69a1729_7 + - libgcc-devel_linux-64 14.3.0 he7458c1_104 + - libgomp 15.2.0 h4751f2c_7 + - libsanitizer 14.3.0 hd4faa28_4 + - libstdcxx 15.2.0 h39759b7_7 + - libstdcxx-devel_linux-64 14.3.0 he7458c1_104 + - sysroot_linux-64 2.28 h3108a97_1 + - tzdata 2025b h04d1e81_0 + host: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - bzip2 1.0.8 h5eee18b_6 + - ca-certificates 2025.12.2 h06a4308_0 + - cffi 2.0.0 py313h4eded50_1 + - expat 2.7.3 h7354ed3_1 + - ld_impl_linux-64 2.44 h153f514_2 + - libexpat 2.7.3 h7354ed3_1 + - libffi 3.4.4 h6a678d5_1 + - libgcc 15.2.0 h69a1729_7 + - libgcc-ng 15.2.0 h166f726_7 + - libgomp 15.2.0 h4751f2c_7 + - libmpdec 4.0.0 h5eee18b_0 + - libstdcxx 15.2.0 h39759b7_7 + - libstdcxx-ng 15.2.0 hc03a8fd_7 + - libuuid 1.41.5 h5eee18b_0 + - libxcb 1.17.0 h9b100fa_0 + - libzlib 1.3.1 hb25bd0a_0 + - ncurses 6.5 h7934f7d_0 + - openssl 3.0.18 hd6dcaed_0 + - pip 25.3 pyhc872135_0 + - pthread-stubs 0.3 h0ce48e5_1 + - pycparser 2.23 py313h06a4308_0 + - python 3.13.10 hcf712cf_100_cp313 + - python_abi 3.13 3_cp313 + - readline 8.3 hc2a1206_0 + - setuptools 80.9.0 py313h06a4308_0 + - sqlite 3.51.0 h2a70700_0 + - tk 8.6.15 h54e0aa7_0 + - tzdata 2025b h04d1e81_0 + - wheel 0.45.1 py313h06a4308_0 + - xorg-libx11 1.8.12 h9b100fa_1 + - xorg-libxau 1.0.12 h9b100fa_0 + - xorg-libxdmcp 1.1.5 h9b100fa_0 + - xorg-xorgproto 2024.1 h5eee18b_1 + - xz 5.6.4 h5eee18b_1 + - zlib 1.3.1 hb25bd0a_0 + run: + - __glibc >=2.28,<3.0.a0 + - cffi >=1.17.0 + - libgcc >=14 + - libstdcxx >=14 + - python >=3.13,<3.14.0a0 + - python_abi 3.13.* *_cp313 +test: + commands: + - pip check + - python -c "from importlib.metadata import version; assert(version('brotlicffi')=='1.2.0.0')" + imports: + - brotlicffi + requires: + - pip + source_files: + - test +about: + description: Python CFFI bindings to the Brotli library + dev_url: https://github.com/python-hyper/brotlicffi + doc_url: https://github.com/python-hyper/brotlicffi/blob/main/README.rst + home: https://github.com/python-hyper/brotlicffi + license: MIT + license_family: MIT + license_file: LICENSE + summary: Python CFFI bindings to the Brotli library +extra: + copy_test_source_files: true + final: true + recipe-maintainers: + - katietz + - sarthakpati + - sethmlarson + skip-lints: + - host_section_needs_exact_pinnings diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/meta.yaml.template b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/meta.yaml.template new file mode 100644 index 0000000000000000000000000000000000000000..660cf4912181a77d74e9fa94ba718c3bebda6deb --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/recipe/meta.yaml.template @@ -0,0 +1,64 @@ +{% set name = "brotlicffi" %} +{% set version = "1.2.0.0" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz + sha256: 34345d8d1f9d534fcac2249e57a4c3c8801a33c9942ff9f8574f67a175e17adb + +build: + number: 0 + script: {{ PYTHON }} -m pip install . --no-deps --no-build-isolation -vv + skip: true # [py<38] + +requirements: + build: + - {{ stdlib('c') }} + - {{ compiler('c') }} + - {{ compiler('cxx') }} + host: + - pip + - python + - setuptools + - cffi >=1.0.0 # [py<313] + - cffi >=1.17.0 # [py>=313] + run: + - cffi >=1.0.0 # [py<313] + - cffi >=1.17.0 # [py>=313] + - python + +test: + source_files: + - test + imports: + - brotlicffi + commands: + - pip check + - python -c "from importlib.metadata import version; assert(version('{{ name }}')=='{{ version }}')" + # Cannot invoke upstream tests because of missing 'testdata' directory in git/pypi sources + # ImportError while loading conftest '/.../conda-bld/brotlicffi_1762941054066/test_tmp/test/conftest.py'. + # E FileNotFoundError: [Errno 2] No such file or directory: '...conda-bld/brotlicffi_1762941054066/test_tmp/libbrotli/tests/testdata' + # - pytest -v test + requires: + - pip + +about: + home: https://github.com/python-hyper/brotlicffi + summary: Python CFFI bindings to the Brotli library + description: Python CFFI bindings to the Brotli library + license: MIT + license_family: MIT + license_file: LICENSE + dev_url: https://github.com/python-hyper/brotlicffi + doc_url: https://github.com/python-hyper/brotlicffi/blob/main/README.rst + +extra: + skip-lints: + - host_section_needs_exact_pinnings + recipe-maintainers: + - sarthakpati + - sethmlarson + - katietz \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/repodata_record.json b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/repodata_record.json new file mode 100644 index 0000000000000000000000000000000000000000..5dff19c8c1f329bbe4ce3dc8f3567f373feaf2ed --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/repodata_record.json @@ -0,0 +1,27 @@ +{ + "arch": "x86_64", + "build": "py313h7354ed3_0", + "build_number": 0, + "channel": "https://repo.anaconda.com/pkgs/main/linux-64/", + "constrains": [], + "depends": [ + "__glibc >=2.28,<3.0.a0", + "cffi >=1.17.0", + "libgcc >=14", + "libstdcxx >=14", + "python >=3.13,<3.14.0a0", + "python_abi 3.13.* *_cp313" + ], + "fn": "brotlicffi-1.2.0.0-py313h7354ed3_0.conda", + "license": "MIT", + "license_family": "MIT", + "md5": "d309f82c145a73fedf7bc6930f689dba", + "name": "brotlicffi", + "platform": "linux", + "sha256": "1d13694da029eb587dcdce691e4a6a1590ac5de65f0cde234fff849fd7985168", + "size": 381299, + "subdir": "linux-64", + "timestamp": 1764961365000, + "url": "https://repo.anaconda.com/pkgs/main/linux-64/brotlicffi-1.2.0.0-py313h7354ed3_0.conda", + "version": "1.2.0.0" +} \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/run_test.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/run_test.py new file mode 100644 index 0000000000000000000000000000000000000000..653a16d060963189f8e7dbe7b53d87803be7f5b6 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/run_test.py @@ -0,0 +1,3 @@ +print("import: 'brotlicffi'") +import brotlicffi + diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/run_test.sh b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/run_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..9e9bb6cafd637cf568354545a97c50b6a1179873 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/run_test.sh @@ -0,0 +1,9 @@ + + +set -ex + + + +pip check +python -c "from importlib.metadata import version; assert(version('brotlicffi')=='1.2.0.0')" +exit 0 diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/conftest.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..e1de0645c5eecd55a632548dd45b3caed8286a07 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/conftest.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +import os +import os.path + +import pytest + +# Statically look for all the files. +curdir = os.path.split(os.path.dirname(__file__))[0] +TEST_DATA_DIR = os.path.join(curdir, 'libbrotli', 'tests', 'testdata') +simple_test_files = [ + os.path.join(TEST_DATA_DIR, p) for p in os.listdir(TEST_DATA_DIR) +] +compressed_simple_test_files = set( + f for f in simple_test_files if f.endswith('.compressed') +) + + +@pytest.fixture(params=compressed_simple_test_files) +def simple_compressed_file(request): + """ + Returns a two-tuple: (uncompressed_file, compressed_file), from the Brotli + test fixtures. + """ + file = request.param + return (file[:-len('.compressed')], file) + + +@pytest.fixture(scope='session') +def one_compressed_file(): + return os.path.join(TEST_DATA_DIR, 'alice29.txt') diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_compatibility.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_compatibility.py new file mode 100644 index 0000000000000000000000000000000000000000..8aeadab4df4800df48774911890c91dbc1a8fcd6 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_compatibility.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +""" +test_compatibility +~~~~~~~~~~~~~~~~~~ + +Tests for names that exist purely for compatibility purposes. +""" +import re +from os.path import abspath, join, dirname +import brotlicffi + + +def test_compatible_names(): + """ + Encoder modes are also defined as individual top-level names with the same + names as in brotlimodule.cc from the library. + """ + assert brotlicffi.MODE_GENERIC is brotlicffi.BrotliEncoderMode.GENERIC + assert brotlicffi.MODE_TEXT is brotlicffi.BrotliEncoderMode.TEXT + assert brotlicffi.MODE_FONT is brotlicffi.BrotliEncoderMode.FONT + + +def test_brotli_version(): + """ + Test that the __version__ starts with the + Brotli version that's compiled with. + """ + version_h = join( + dirname(dirname(abspath(__file__))), "libbrotli/c/common/version.h" + ) + with open(version_h) as f: + brotli_versions = dict( + re.findall( + r"#define BROTLI_VERSION_(MAJOR|MINOR|PATCH) ([0-9]+)", + f.read() + ) + ) + assert brotlicffi.__version__.startswith( + "%s.%s.%s." % ( + brotli_versions["MAJOR"], + brotli_versions["MINOR"], + brotli_versions["PATCH"] + ) + ) diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_simple_compression.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_simple_compression.py new file mode 100644 index 0000000000000000000000000000000000000000..a4805877961752621d26315d0467f8a258c63a98 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_simple_compression.py @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +""" +test_simple_compression +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Tests for compression of single chunks. +""" +import brotlicffi + +import pytest + +from hypothesis import given, settings +from hypothesis.strategies import binary, integers, sampled_from, one_of + + +def test_roundtrip_compression_with_files(simple_compressed_file): + """ + Roundtripping data through the compressor works correctly. + """ + with open(simple_compressed_file[0], 'rb') as f: + uncompressed_data = f.read() + + assert brotlicffi.decompress( + brotlicffi.compress(uncompressed_data) + ) == uncompressed_data + + +@pytest.mark.slow +@settings(deadline=None) +@given( + chunk_size=integers(min_value=1, max_value=2**12), + mode=sampled_from(list(brotlicffi.BrotliEncoderMode)), + quality=integers(min_value=0, max_value=11), + lgwin=integers(min_value=10, max_value=24), + lgblock=one_of( + integers(min_value=0, max_value=0), + integers(min_value=16, max_value=24) + ), +) +def test_streaming_compression(one_compressed_file, + chunk_size, + mode, + quality, + lgwin, + lgblock): + """ + Confirm that the streaming compressor works as expected. + """ + compressed_chunks = [] + c = brotlicffi.Compressor( + mode=mode, quality=quality, lgwin=lgwin, lgblock=lgblock + ) + with open(one_compressed_file, 'rb') as f: + while True: + next_data = f.read(chunk_size) + if not next_data: + break + + compressed_chunks.append(c.compress(next_data)) + + compressed_chunks.append(c.finish()) + decompressed = brotlicffi.decompress(b''.join(compressed_chunks)) + with open(one_compressed_file, 'rb') as f: + assert decompressed == f.read() + + +@pytest.mark.slow +@settings(deadline=None) +@given( + chunk_size=integers(min_value=1, max_value=2**12), + mode=sampled_from(list(brotlicffi.BrotliEncoderMode)), + quality=integers(min_value=0, max_value=11), + lgwin=integers(min_value=10, max_value=24), + lgblock=one_of( + integers(min_value=0, max_value=0), + integers(min_value=16, max_value=24) + ), +) +def test_streaming_compression_flush(one_compressed_file, + chunk_size, + mode, + quality, + lgwin, + lgblock): + """ + Confirm that the streaming compressor works as expected, including flushes + after each chunk. + """ + compressed_chunks = [] + c = brotlicffi.Compressor( + mode=mode, quality=quality, lgwin=lgwin, lgblock=lgblock + ) + with open(one_compressed_file, 'rb') as f: + while True: + next_data = f.read(chunk_size) + if not next_data: + break + + compressed_chunks.append(c.compress(next_data)) + compressed_chunks.append(c.flush()) + + compressed_chunks.append(c.finish()) + decompressed = brotlicffi.decompress(b''.join(compressed_chunks)) + with open(one_compressed_file, 'rb') as f: + assert decompressed == f.read() + + +@given(binary()) +def test_compressed_data_roundtrips(s): + assert brotlicffi.decompress(brotlicffi.compress(s)) == s + + +@given(binary()) +def test_process_alias(s): + c1 = brotlicffi.Compressor() + c2 = brotlicffi.Compressor() + d1 = brotlicffi.Decompressor() + d2 = brotlicffi.Decompressor() + s1 = c1.compress(s) + c1.finish() + s2 = c2.process(s) + c2.finish() + assert ( + (d1.decompress(s1) + d1.finish()) + == (d2.process(s2) + d2.finish()) + == s + ) + + +@pytest.mark.parametrize( + "params", + [ + {"mode": 52}, + {"quality": 52}, + {"lgwin": 52}, + {"lgblock": 52}, + ] +) +def test_bad_compressor_parameters(params): + with pytest.raises(brotlicffi.error): + brotlicffi.Compressor(**params) diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_simple_decompression.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_simple_decompression.py new file mode 100644 index 0000000000000000000000000000000000000000..232a7308715dbb73b421e18d9ca5dd2bec94caa1 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test/test_simple_decompression.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- +""" +test_simple_decompression +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Tests for decompression of single chunks. +""" +import brotlicffi + +import pytest + + +def test_decompression(simple_compressed_file): + """ + Decompressing files returns their original form using decompress. + """ + with open(simple_compressed_file[0], 'rb') as f: + uncompressed_data = f.read() + + with open(simple_compressed_file[1], 'rb') as f: + compressed_data = f.read() + + assert brotlicffi.decompress(compressed_data) == uncompressed_data + + +def test_decompressobj(simple_compressed_file): + with open(simple_compressed_file[0], 'rb') as f: + uncompressed_data = f.read() + + with open(simple_compressed_file[1], 'rb') as f: + compressed_data = f.read() + + o = brotlicffi.Decompressor() + data = o.decompress(compressed_data) + data += o.flush() + data += o.finish() + + assert data == uncompressed_data + + +# `more_data_limit` allows testing `decompress(b'')` with and without a limit. +@pytest.mark.parametrize('more_data_limit', [100, None]) +def test_decompressobj_with_output_buffer_limit( + simple_compressed_file, more_data_limit +): + """ + Test decompression with `output_buffer_limit` set. + """ + with open(simple_compressed_file[0], 'rb') as f: + uncompressed_data = f.read() + + with open(simple_compressed_file[1], 'rb') as f: + compressed_data = f.read() + + o = brotlicffi.Decompressor() + assert o.can_accept_more_data() + small_limit = 100 + result = o.decompress(compressed_data, output_buffer_limit=small_limit) + assert len(result) <= small_limit + + # Ensure `output_buffer_limit` of zero works. + assert o.decompress(b'', output_buffer_limit=0) == b'' + + if o._unconsumed_data: + with pytest.raises( + brotlicffi.error, + match=( + r"brotli: decoder process called with data when " + r"'can_accept_more_data\(\)' is False" + ), + ): + o.decompress(b'additional data') + + if not o.is_finished(): + assert not o.can_accept_more_data() + + # Continue decompressing with empty input. + all_output = [result] + while not o.can_accept_more_data() and not o.is_finished(): + more_output = o.decompress( + b'', output_buffer_limit=more_data_limit + ) + if more_data_limit is not None: + assert len(more_output) <= more_data_limit + all_output.append(more_output) + assert o.can_accept_more_data() or o.is_finished() + + final_result = b''.join(all_output) + assert final_result == uncompressed_data + + +def test_drip_feed(simple_compressed_file): + """ + Sending in the data one byte at a time still works. + """ + with open(simple_compressed_file[0], 'rb') as f: + uncompressed_data = f.read() + + with open(simple_compressed_file[1], 'rb') as f: + compressed_data = f.read() + + outdata = [] + o = brotlicffi.Decompressor() + for i in range(0, len(compressed_data)): + assert not o.is_finished() + outdata.append(o.decompress(compressed_data[i:i+1])) + + assert o.is_finished() + outdata.append(o.flush()) + assert o.is_finished() + outdata.append(o.finish()) + assert o.is_finished() + + assert b''.join(outdata) == uncompressed_data + + +@pytest.mark.parametrize('exception_cls', [brotlicffi.Error, brotlicffi.error]) +def test_streaming_decompression_fails_properly_on_garbage(exception_cls): + """ + Garbage data properly fails decompression. + """ + o = brotlicffi.Decompressor() + with pytest.raises(exception_cls): + o.decompress(b'some random garbage') + assert not o.is_finished() + + +@pytest.mark.parametrize('exception_cls', [brotlicffi.Error, brotlicffi.error]) +@pytest.mark.parametrize('bogus', (b'some random garbage', b'bogus')) +def test_decompression_fails_properly_on_garbage(bogus, exception_cls): + """ + Garbage data properly fails decompression. + """ + with pytest.raises(exception_cls): + brotlicffi.decompress(bogus) diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test_time_dependencies.json b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test_time_dependencies.json new file mode 100644 index 0000000000000000000000000000000000000000..215362c1832b66eb448cdeeadbb1db3470d5adb4 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/info/test/test_time_dependencies.json @@ -0,0 +1 @@ +["pip"] \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/INSTALLER b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..f79e4cb9aaf0b2d9e8ba78861e2071317b2384b3 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/INSTALLER @@ -0,0 +1 @@ +conda \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/METADATA b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..dd0c5e58e83e49bd7641da322c24dbaeb6a2740f --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/METADATA @@ -0,0 +1,227 @@ +Metadata-Version: 2.4 +Name: brotlicffi +Version: 1.2.0.0 +Summary: Python CFFI bindings to the Brotli library +Home-page: https://github.com/python-hyper/brotlicffi +Author: Cory Benfield +Author-email: cory@lukasa.co.uk +License: MIT +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Requires-Python: >=3.8 +License-File: LICENSE +Requires-Dist: cffi>=1.0.0; python_version < "3.13" +Requires-Dist: cffi>=1.17.0; python_version >= "3.13" +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: home-page +Dynamic: license +Dynamic: license-file +Dynamic: requires-dist +Dynamic: requires-python +Dynamic: summary + +BrotliCFFI +========== + +.. image:: https://img.shields.io/pypi/v/brotlicffi + :alt: Version + :target: https://pypi.org/project/brotlicffi + +.. image:: https://img.shields.io/conda/vn/conda-forge/brotlicffi + :alt: Version-Conda + :target: https://anaconda.org/conda-forge/brotlicffi + +.. image:: https://pepy.tech/badge/brotlicffi + :alt: Downloads + :target: https://pepy.tech/project/brotlicffi + +.. image:: https://img.shields.io/github/workflow/status/python-hyper/brotlicffi/CI/master + :alt: CI Status + :target: https://github.com/python-hyper/brotlicffi/actions + +This library contains Python CFFI bindings for the reference Brotli encoder/decoder, +`available here`_. This allows Python software to use the Brotli compression +algorithm directly from Python code. + +Install from PyPI: + +.. code-block:: + + $ python -m pip install brotlicffi + +Install from Conda: + +.. code-block:: + + $ conda install -c conda-forge brotlicffi + +To use it simply, try this: + +.. code-block:: python + + import brotlicffi + data = brotlicffi.decompress(compressed_data) + +More information can be found `in the documentation`_. + +.. _available here: https://github.com/google/brotli +.. _in the documentation: https://brotlipy.readthedocs.org + +Using BrotliCFFI in Projects +---------------------------- + +The API is 100% compatible with the `Brotli Python C bindings`_. +We recommend installing the C bindings on CPython and the CFFI +bindings everywhere else (PyPy, etc) + +Essentially you use requirements like this: + + .. code-block:: python + + install_requires=[ + "brotli; platform_python_implementation == 'CPython'", + "brotlicffi; platform_python_implementation != 'CPython'" + ] + +and then import the correct Brotli library like so: + + .. code-block:: python + + try: + import brotlicffi as brotli + except ImportError: + import brotli + +We provide an `example project`_ that shows how to use both +libraries together to support Brotli with multiple Python implementations. + +.. _Brotli Python C bindings: https://pypi.org/project/Brotli +.. _example project: https://github.com/python-hyper/brotlipy/tree/master/example + +License +------- + +The source code of BrotliCFFI is available under the MIT license. Brotli itself +is made available under the Version 2.0 of the Apache Software License. See the +LICENSE and libbrotli/LICENSE files for more information. + +Authors +------- + +BrotliCFFI/brotlipy was authored by Cory Benfield and +is currently maintained by Seth Michael Larson. + + +Changelog +========= + +1.2.0.0 (2025-11-21) +-------------------- + +- Upgraded libbrotli to v1.2.0. +- Added ``output_buffer_limit`` parameter to ``Decompressor.decompress()`` and + ``Decompressor.process()`` methods to allow mitigation of unexpectedly large + output. This addresses potential security concerns where maliciously crafted + compressed data could result in excessive memory usage during decompression. + + +1.1.0.0 (2023-09-14) +-------------------- + +- Upgraded libbrotli to v1.1.0 +- Added explicit support for Python 3.10, 3.11, and 3.12 +- Removed support for Python 2.7, 3.5, and 3.6 + + +1.0.9.2 (2021-04-06) +-------------------- + +- Added ``manylinux_aarch64`` wheels + + +1.0.9.1 (2021-01-27) +-------------------- + +- Avoid byte/string comparison warning in error message construction + + +1.0.9.0 (2021-01-20) +-------------------- + +- Updated to v1.0.9 of the Brotli library +- Library version now follows Brotli version +- Removed the ``dictionary`` parameter from ``compress`` and ``Compressor`` +- **NOTE:** Python 2.7 wheels for Windows likely won't work until + `google/brotli#848`_ is resolved + +.. _google/brotli#848: https://github.com/google/brotli/issues/848 + +0.8.0 (2020-11-30) +------------------ + +- Renamed the package on PyPI to ``brotlicffi``, all further updates will be + published to the new package. Using the ``brotlipy`` is deprecated. +- Changed the importable namespace from ``brotli`` to ``brotlicffi`` to no longer + conflict with the ``Brotli`` PyPI package. +- Added ``process()`` method to ``Compressor`` and ``Decompressor``. +- Added ``is_finished()`` method to ``Decompressor``. + +0.7.0 (2017-05-30) +------------------ + +- Update to v0.6.0 of the Brotli library. + +0.6.0 (2016-09-08) +------------------ + +- Resolved a bug where ``decompress()`` would return an empty bytestring + instead of erroring if the provided bytestring was small enough. +- Added the ``finish()`` method to the streaming decompressor. + +0.5.1 (2016-08-17) +------------------ + +- Update to v0.5.2 of the Brotli library. +- Add new exception type (``Error``). +- Add compatibility with C++ brotli library by aliasing ``Error`` to ``error``. +- Extra error checking of input parameters to the compressor. + +0.5.0 (2016-08-16) +------------------ + +- Update to v0.5.0 of the Brotli library. +- Extend one-shot compression API to include all control parameters. +- Added streaming/incremental compression API. +- Added flags to control compression mode. + +0.4.0 (2016-08-01) +------------------ + +Update to v0.4.0 of the Brotli library. + +0.3.0 (2016-05-11) +------------------ + +Update to v0.3.0 of the Brotli library. + +0.2.0 (2015-10-05) +------------------ + +Fix broken ``brotli.compress`` support on Windows. + +0.1.3 (2015-10-05) +------------------ + +- Added basic for ``brotli.compress`` through a C wrapper included in this + library. diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/RECORD b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..567dbea23829621580c7ba9372ce537c0b6a345a --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/RECORD @@ -0,0 +1,15 @@ +brotlicffi-1.2.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +brotlicffi-1.2.0.0.dist-info/METADATA,sha256=LkuvxaTt9hwuvMIRQQr0ubTMwjIo-llV0oagCGEMrwg,6437 +brotlicffi-1.2.0.0.dist-info/RECORD,, +brotlicffi-1.2.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +brotlicffi-1.2.0.0.dist-info/WHEEL,sha256=aQbDWqlaariPhPENOf9zLeAEUO9lPHXIaSFRigOtn8E,103 +brotlicffi-1.2.0.0.dist-info/direct_url.json,sha256=pVSHbeI_3Nu_1A76-8GFtcr2JzoAejOvySQaQLVPKmM,100 +brotlicffi-1.2.0.0.dist-info/licenses/LICENSE,sha256=8-nCnj2zbcMFpL5oqKIl-TlJhSzi0ZtbCjwJnu5lCcU,1056 +brotlicffi-1.2.0.0.dist-info/top_level.txt,sha256=QNsXaBb1b7FFDoROgMBoHTDwfsWia7dX5GLRhUDPyXM,23 +brotlicffi/__init__.py,sha256=NaVd_IM9h9jeHnOH9xUR-646Zu8TiUIuVtDh5l1upg0,224 +brotlicffi/__pycache__/__init__.cpython-313.pyc,, +brotlicffi/__pycache__/_api.cpython-313.pyc,, +brotlicffi/__pycache__/_build.cpython-313.pyc,, +brotlicffi/_api.py,sha256=9Sntv35FzgU78-Kp3AqLwSEz3Wtcck5EfRnr0rs3Tog,19563 +brotlicffi/_brotlicffi.abi3.so,sha256=IufFo3ndRinZCMccqGSeOolvYhXGzNS-x5sKOzhcVXw,899376 +brotlicffi/_build.py,sha256=Js-FovbzNIsR8ChfWXH8Qups7JuTm3PWRo3h7cJ44lE,9328 diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/REQUESTED b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/WHEEL b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..0643952b52c30583bae522eb4c1411eefa034232 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp313-abi3-linux_x86_64 + diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/direct_url.json b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/direct_url.json new file mode 100644 index 0000000000000000000000000000000000000000..6271558295c8582345b48c3a7cee30109f681aa0 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/direct_url.json @@ -0,0 +1 @@ +{"dir_info": {}, "url": "file:///home/task_176496126124857/conda-bld/brotlicffi_1764961326114/work"} \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/licenses/LICENSE b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d6466b602473a2683ccf84a9f6c6dce140a058e3 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/licenses/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Cory Benfield + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/top_level.txt b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..697e753b0e8f0effe0b3ff3b52a22225f93e5b05 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi-1.2.0.0.dist-info/top_level.txt @@ -0,0 +1,2 @@ +_brotlicffi +brotlicffi diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/__init__.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4ad22f00a1e6619ed34ebb40cc0572ae6318fbcb --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/__init__.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +# flake8: noqa +from ._api import ( + decompress, Decompressor, compress, BrotliEncoderMode, DEFAULT_MODE, + Compressor, MODE_GENERIC, MODE_TEXT, MODE_FONT, error, Error +) + +__version__ = "1.2.0.0" diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/_api.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/_api.py new file mode 100644 index 0000000000000000000000000000000000000000..b7e34bebe37fa3749198511eab99808f84e79187 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/_api.py @@ -0,0 +1,557 @@ +# -*- coding: utf-8 -*- +import math +import enum + +from ._brotlicffi import ffi, lib + + +class error(Exception): + """ + Raised whenever an error is encountered with compressing or decompressing + data using brotlicffi. + + .. versionadded:: 0.5.1 + """ + pass + + +#: An alias of :class:`error ` that +#: exists for compatibility with the original CFFI brotli module. +#: +#: .. versionadded: 0.8.0 +Error = error + + +class BrotliEncoderMode(enum.IntEnum): + """ + Compression modes for the Brotli encoder. + + .. versionadded:: 0.5.0 + """ + #: Default compression mode. The compressor does not know anything in + #: advance about the properties of the input. + GENERIC = lib.BROTLI_MODE_GENERIC + + #: Compression mode for UTF-8 format text input. + TEXT = lib.BROTLI_MODE_TEXT + + #: Compression mode used in WOFF 2.0 + FONT = lib.BROTLI_MODE_FONT + + +# Define some names for compatibility with the C module. + +#: The default compression mode for brotli. +DEFAULT_MODE = BrotliEncoderMode(lib.BROTLI_DEFAULT_MODE) + + +#: A compression mode where the compressor does not know anything in advance +#: about the properties of the input. +#: +#: .. note:: This name is defined for compatibility with the Brotli C +#: extension. If you're not interested in that compatibility, it is +#: recommended that you use :class:`BrotliEncoderMode +#: ` instead. +#: +#: .. versionadded:: 0.5.0 +MODE_GENERIC = BrotliEncoderMode.GENERIC + + +#: A compression mode for UTF-8 format text input. +#: +#: .. note:: This name is defined for compatibility with the Brotli C +#: extension. If you're not interested in that compatibility, it is +#: recommended that you use :class:`BrotliEncoderMode +#: ` instead. +#: +#: .. versionadded:: 0.5.0 +MODE_TEXT = BrotliEncoderMode.TEXT + + +#: The compression mode used in WOFF 2.0. +#: +#: .. note:: This name is defined for compatibility with the Brotli C +#: extension. If you're not interested in that compatibility, it is +#: recommended that you use :class:`BrotliEncoderMode +#: ` instead. +#: +#: .. versionadded:: 0.5.0 +MODE_FONT = BrotliEncoderMode.FONT + + +def decompress(data): + """ + Decompress a complete Brotli-compressed string. + + :param data: A bytestring containing Brotli-compressed data. + """ + d = Decompressor() + data = d.decompress(data) + d.finish() + return data + + +def compress(data, + mode=DEFAULT_MODE, + quality=lib.BROTLI_DEFAULT_QUALITY, + lgwin=lib.BROTLI_DEFAULT_WINDOW, + lgblock=0): + """ + Compress a string using Brotli. + + .. versionchanged:: 0.5.0 + Added ``mode``, ``quality``, `lgwin``, ``lgblock``, and ``dictionary`` + parameters. + + :param data: A bytestring containing the data to compress. + :type data: ``bytes`` + + :param mode: The encoder mode. + :type mode: :class:`BrotliEncoderMode` or ``int`` + + :param quality: Controls the compression-speed vs compression-density + tradeoffs. The higher the quality, the slower the compression. The + range of this value is 0 to 11. + :type quality: ``int`` + + :param lgwin: The base-2 logarithm of the sliding window size. The range of + this value is 10 to 24. + :type lgwin: ``int`` + + :param lgblock: The base-2 logarithm of the maximum input block size. The + range of this value is 16 to 24. If set to 0, the value will be set + based on ``quality``. + :type lgblock: ``int`` + + :returns: The compressed bytestring. + :rtype: ``bytes`` + """ + # This method uses private variables on the Compressor object, and + # generally does a whole lot of stuff that's not supported by the public + # API. The goal here is to minimise the number of allocations and copies + # we have to do. Users should prefer this method over the Compressor if + # they know they have single-shot data. + compressor = Compressor( + mode=mode, + quality=quality, + lgwin=lgwin, + lgblock=lgblock + ) + compressed_data = compressor._compress(data, lib.BROTLI_OPERATION_FINISH) + assert lib.BrotliEncoderIsFinished(compressor._encoder) == lib.BROTLI_TRUE + assert ( + lib.BrotliEncoderHasMoreOutput(compressor._encoder) == lib.BROTLI_FALSE + ) + return compressed_data + + +def _validate_mode(val): + """ + Validate that the mode is valid. + """ + try: + val = BrotliEncoderMode(val) + except ValueError: + raise error("%s is not a valid encoder mode" % val) + + +def _validate_quality(val): + """ + Validate that the quality setting is valid. + """ + if not (0 <= val <= 11): + raise error( + "%d is not a valid quality, must be between 0 and 11" % val + ) + + +def _validate_lgwin(val): + """ + Validate that the lgwin setting is valid. + """ + if not (10 <= val <= 24): + raise error("%d is not a valid lgwin, must be between 10 and 24" % val) + + +def _validate_lgblock(val): + """ + Validate that the lgblock setting is valid. + """ + if (val != 0) and not (16 <= val <= 24): + raise error( + "%d is not a valid lgblock, must be either 0 or between 16 and 24" + % val + ) + + +def _set_parameter(encoder, parameter, parameter_name, val): + """ + This helper function sets a specific Brotli encoder parameter, checking + the return code and raising :class:`Error ` if it is + invalid. + """ + rc = lib.BrotliEncoderSetParameter(encoder, parameter, val) + + if parameter == lib.BROTLI_PARAM_MODE: + _validate_mode(val) + elif parameter == lib.BROTLI_PARAM_QUALITY: + _validate_quality(val) + elif parameter == lib.BROTLI_PARAM_LGWIN: + _validate_lgwin(val) + elif parameter == lib.BROTLI_PARAM_LGBLOCK: + _validate_lgblock(val) + else: # pragma: no cover + raise RuntimeError("Unexpected parameter!") + + # This block is defensive: I see no way to hit it, but as long as the + # function returns a value we can live in hope that the brotli folks will + # enforce their own constraints. + if rc != lib.BROTLI_TRUE: # pragma: no cover + raise error( + "Error setting parameter %s: %d" % (parameter_name, val) + ) + + +class Compressor(object): + """ + An object that allows for streaming compression of data using the Brotli + compression algorithm. + + .. versionadded:: 0.5.0 + + :param mode: The encoder mode. + :type mode: :class:`BrotliEncoderMode` or ``int`` + + :param quality: Controls the compression-speed vs compression-density + tradeoffs. The higher the quality, the slower the compression. The + range of this value is 0 to 11. + :type quality: ``int`` + + :param lgwin: The base-2 logarithm of the sliding window size. The range of + this value is 10 to 24. + :type lgwin: ``int`` + + :param lgblock: The base-2 logarithm of the maximum input block size. The + range of this value is 16 to 24. If set to 0, the value will be set + based on ``quality``. + :type lgblock: ``int`` + + :param dictionary: A pre-set dictionary for LZ77. Please use this with + caution: if a dictionary is used for compression, the same dictionary + **must** be used for decompression! + :type dictionary: ``bytes`` + """ + _dictionary = None + _dictionary_size = None + + def __init__(self, + mode=DEFAULT_MODE, + quality=lib.BROTLI_DEFAULT_QUALITY, + lgwin=lib.BROTLI_DEFAULT_WINDOW, + lgblock=0): + enc = lib.BrotliEncoderCreateInstance( + ffi.NULL, ffi.NULL, ffi.NULL + ) + if not enc: # pragma: no cover + raise RuntimeError("Unable to allocate Brotli encoder!") + + enc = ffi.gc(enc, lib.BrotliEncoderDestroyInstance) + + # Configure the encoder appropriately. + _set_parameter(enc, lib.BROTLI_PARAM_MODE, "mode", mode) + _set_parameter(enc, lib.BROTLI_PARAM_QUALITY, "quality", quality) + _set_parameter(enc, lib.BROTLI_PARAM_LGWIN, "lgwin", lgwin) + _set_parameter(enc, lib.BROTLI_PARAM_LGBLOCK, "lgblock", lgblock) + + self._encoder = enc + + def _compress(self, data, operation): + """ + This private method compresses some data in a given mode. This is used + because almost all of the code uses the exact same setup. It wouldn't + have to, but it doesn't hurt at all. + """ + # The 'algorithm' for working out how big to make this buffer is from + # the Brotli source code, brotlimodule.cc. + original_output_size = int( + math.ceil(len(data) + (len(data) >> 2) + 10240) + ) + available_out = ffi.new("size_t *") + available_out[0] = original_output_size + output_buffer = ffi.new("uint8_t []", available_out[0]) + ptr_to_output_buffer = ffi.new("uint8_t **", output_buffer) + input_size = ffi.new("size_t *", len(data)) + input_buffer = ffi.new("uint8_t []", data) + ptr_to_input_buffer = ffi.new("uint8_t **", input_buffer) + + rc = lib.BrotliEncoderCompressStream( + self._encoder, + operation, + input_size, + ptr_to_input_buffer, + available_out, + ptr_to_output_buffer, + ffi.NULL + ) + if rc != lib.BROTLI_TRUE: # pragma: no cover + raise error("Error encountered compressing data.") + + assert not input_size[0] + + size_of_output = original_output_size - available_out[0] + return ffi.buffer(output_buffer, size_of_output)[:] + + def compress(self, data): + """ + Incrementally compress more data. + + :param data: A bytestring containing data to compress. + :returns: A bytestring containing some compressed data. May return the + empty bytestring if not enough data has been inserted into the + compressor to create the output yet. + """ + return self._compress(data, lib.BROTLI_OPERATION_PROCESS) + + process = compress + + def flush(self): + """ + Flush the compressor. This will emit the remaining output data, but + will not destroy the compressor. It can be used, for example, to ensure + that given chunks of content will decompress immediately. + """ + chunks = [self._compress(b'', lib.BROTLI_OPERATION_FLUSH)] + + while lib.BrotliEncoderHasMoreOutput(self._encoder) == lib.BROTLI_TRUE: + chunks.append(self._compress(b'', lib.BROTLI_OPERATION_FLUSH)) + + return b''.join(chunks) + + def finish(self): + """ + Finish the compressor. This will emit the remaining output data and + transition the compressor to a completed state. The compressor cannot + be used again after this point, and must be replaced. + """ + chunks = [] + while lib.BrotliEncoderIsFinished(self._encoder) == lib.BROTLI_FALSE: + chunks.append(self._compress(b'', lib.BROTLI_OPERATION_FINISH)) + + return b''.join(chunks) + + +class Decompressor(object): + """ + An object that allows for streaming decompression of Brotli-compressed + data. + + .. versionchanged:: 0.5.0 + Added ``dictionary`` parameter. + + .. versionchanged:: 1.2.0 + Added ``can_accept_more_data()`` method and optional + ``output_buffer_limit`` parameter to ``process()``/``decompress()``. + + :param dictionary: A pre-set dictionary for LZ77. Please use this with + caution: if a dictionary is used for compression, the same dictionary + **must** be used for decompression! + :type dictionary: ``bytes`` + """ + _dictionary = None + _dictionary_size = None + _unconsumed_data = None + + def __init__(self, dictionary=b''): + dec = lib.BrotliDecoderCreateInstance(ffi.NULL, ffi.NULL, ffi.NULL) + self._decoder = ffi.gc(dec, lib.BrotliDecoderDestroyInstance) + self._unconsumed_data = b'' + + if dictionary: + self._dictionary = ffi.new("uint8_t []", dictionary) + self._dictionary_size = len(dictionary) + lib.BrotliDecoderSetCustomDictionary( + self._decoder, + self._dictionary_size, + self._dictionary + ) + + @staticmethod + def _calculate_buffer_size( + input_data_len, output_buffer_limit, chunks_len, chunks_num + ): + if output_buffer_limit is not None: + return output_buffer_limit - chunks_len + # When `decompress(b'')` is called without `output_buffer_limit`. + elif input_data_len == 0: + # libbrotli would use 32 KB as a starting buffer size and double it + # each time, capped at 16 MB. + # https://github.com/google/brotli/blob/028fb5a23661f123017c060daa546b55cf4bde29/python/_brotli.c#L291-L292 + return 1 << min(chunks_num + 15, 24) + else: + # Allocate a buffer that's hopefully overlarge, but if it's not we + # don't mind: we'll spin around again. + return 5 * input_data_len + + def decompress(self, data, output_buffer_limit=None): + """ + Decompress part of a complete Brotli-compressed string. + + .. versionchanged:: 1.2.0 + Added ``output_buffer_limit`` parameter. + + :param data: A bytestring containing Brotli-compressed data. + :param output_buffer_limit: Optional maximum size for the output + buffer. If set, the output buffer will not grow once its size + equals or exceeds this value. If the limit is reached, further + calls to process (potentially with empty input) will continue to + yield more data. Following process() calls must only be called + with empty input until can_accept_more_data() returns True. + :type output_buffer_limit: ``int`` or ``None`` + :returns: A bytestring containing the decompressed data. + """ + if self._unconsumed_data and data: + raise error( + "brotli: decoder process called with data when " + "'can_accept_more_data()' is False" + ) + + # We should avoid operations on the `self._unconsumed_data` if no data + # is to be processed. + if output_buffer_limit is not None and output_buffer_limit <= 0: + return b'' + + # Use unconsumed data if available, use new data otherwise. + if self._unconsumed_data: + input_data = self._unconsumed_data + self._unconsumed_data = b'' + else: + input_data = data + + chunks = [] + chunks_len = 0 + + available_in = ffi.new("size_t *", len(input_data)) + in_buffer = ffi.new("uint8_t[]", input_data) + next_in = ffi.new("uint8_t **", in_buffer) + + while True: + buffer_size = self._calculate_buffer_size( + input_data_len=len(input_data), + output_buffer_limit=output_buffer_limit, + chunks_len=chunks_len, + chunks_num=len(chunks), + ) + + available_out = ffi.new("size_t *", buffer_size) + out_buffer = ffi.new("uint8_t[]", buffer_size) + next_out = ffi.new("uint8_t **", out_buffer) + + rc = lib.BrotliDecoderDecompressStream(self._decoder, + available_in, + next_in, + available_out, + next_out, + ffi.NULL) + + # First, check for errors. + if rc == lib.BROTLI_DECODER_RESULT_ERROR: + error_code = lib.BrotliDecoderGetErrorCode(self._decoder) + error_message = lib.BrotliDecoderErrorString(error_code) + raise error( + b"Decompression error: %s" % ffi.string(error_message) + ) + + # Next, copy the result out. + chunk = ffi.buffer(out_buffer, buffer_size - available_out[0])[:] + chunks.append(chunk) + chunks_len += len(chunk) + + # Save any unconsumed input for the next call. + if available_in[0] > 0: + remaining_input = ffi.buffer(next_in[0], available_in[0])[:] + self._unconsumed_data = remaining_input + + # Check if we've reached the output limit. + if ( + output_buffer_limit is not None + and chunks_len >= output_buffer_limit + ): + break + + if rc == lib.BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: + assert available_in[0] == 0 + break + elif rc == lib.BROTLI_DECODER_RESULT_SUCCESS: + break + else: + # It's cool if we need more output, we just loop again. + assert rc == lib.BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT + + return b''.join(chunks) + + process = decompress + + def flush(self): + """ + Complete the decompression, return whatever data is remaining to be + decompressed. + + .. deprecated:: 0.4.0 + + This method is no longer required, as decompress() will now + decompress eagerly. + + :returns: A bytestring containing the remaining decompressed data. + """ + return b'' + + def finish(self): + """ + Finish the decompressor. As the decompressor decompresses eagerly, this + will never actually emit any data. However, it will potentially throw + errors if a truncated or damaged data stream has been used. + + Note that, once this method is called, the decompressor is no longer + safe for further use and must be thrown away. + """ + assert ( + lib.BrotliDecoderHasMoreOutput(self._decoder) == lib.BROTLI_FALSE + ) + if not self.is_finished(): + raise error("Decompression error: incomplete compressed stream.") + + return b'' + + def is_finished(self): + """ + Returns ``True`` if the decompression stream + is complete, ``False`` otherwise + """ + return lib.BrotliDecoderIsFinished(self._decoder) == lib.BROTLI_TRUE + + def can_accept_more_data(self): + """ + Checks if the decompressor can accept more compressed data. + + If the ``output_buffer_limit`` parameter was used with + ``decompress()`` or ``process()``, this method should be checked to + determine if the decompressor is ready to accept new input. When the + output buffer limit is reached, the decompressor may still have + unconsumed input data or internal buffered output, and calling + ``decompress(b'')`` repeatedly will continue producing output until + this method returns ``True``. + + .. versionadded:: 1.2.0 + + :returns: ``True`` if the decompressor is ready to accept more + compressed data via ``decompress()`` or ``process()``, ``False`` + if the decompressor needs to output some data via + ``decompress(b'')``/``process(b'')`` before being provided any + more compressed data. + :rtype: ``bool`` + """ + if len(self._unconsumed_data) > 0: + return False + if lib.BrotliDecoderHasMoreOutput(self._decoder) == lib.BROTLI_TRUE: + return False + return True diff --git a/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/_build.py b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/_build.py new file mode 100644 index 0000000000000000000000000000000000000000..115be2e9bf04c40d26e2920f1d03c5c947129f64 --- /dev/null +++ b/miniconda3/pkgs/brotlicffi-1.2.0.0-py313h7354ed3_0/lib/python3.13/site-packages/brotlicffi/_build.py @@ -0,0 +1,207 @@ +# -*- coding: utf-8 -*- +import os +import sys + +from cffi import FFI +ffi = FFI() + +USE_SHARED_BROTLI = os.environ.get("USE_SHARED_BROTLI") +if USE_SHARED_BROTLI != "1": + libraries = ['libbrotli'] +else: + libraries = ['brotlienc', 'brotlidec'] + + if 'win32' not in str(sys.platform).lower(): + libraries.append('stdc++') + + +ffi.set_source( + "_brotlicffi", + """#include + #include + """, + libraries=libraries, + include_dirs=["libbrotli/c", "libbrotli/c/include", "libbrotli/c/common"] +) + +ffi.cdef(""" + /* common/types.h */ + typedef bool BROTLI_BOOL; + #define BROTLI_TRUE ... + #define BROTLI_FALSE ... + + /* dec/state.h */ + /* Allocating function pointer. Function MUST return 0 in the case of + failure. Otherwise it MUST return a valid pointer to a memory region of + at least size length. Neither items nor size are allowed to be 0. + opaque argument is a pointer provided by client and could be used to + bind function to specific object (memory pool). */ + typedef void* (*brotli_alloc_func)(void* opaque, size_t size); + + /* Deallocating function pointer. Function SHOULD be no-op in the case the + address is 0. */ + typedef void (*brotli_free_func)(void* opaque, void* address); + + /* dec/decode.h */ + + typedef enum { + /* Decoding error, e.g. corrupt input or memory allocation problem */ + BROTLI_DECODER_RESULT_ERROR = 0, + /* Decoding successfully completed */ + BROTLI_DECODER_RESULT_SUCCESS = 1, + /* Partially done; should be called again with more input */ + BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT = 2, + /* Partially done; should be called again with more output */ + BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT = 3 + } BrotliDecoderResult; + + typedef enum {...} BrotliDecoderErrorCode; + typedef ... BrotliDecoderState; + + /* Creates the instance of BrotliDecoderState and initializes it. + |alloc_func| and |free_func| MUST be both zero or both non-zero. In the + case they are both zero, default memory allocators are used. |opaque| is + passed to |alloc_func| and |free_func| when they are called. */ + BrotliDecoderState* BrotliDecoderCreateInstance(brotli_alloc_func, + brotli_free_func, + void *); + + /* Deinitializes and frees BrotliDecoderState instance. */ + void BrotliDecoderDestroyInstance(BrotliDecoderState* state); + + /* Decompresses the data. Supports partial input and output. + + Must be called with an allocated input buffer in |*next_in| and an + allocated output buffer in |*next_out|. The values |*available_in| and + |*available_out| must specify the allocated size in |*next_in| and + |*next_out| respectively. + + After each call, |*available_in| will be decremented by the amount of + input bytes consumed, and the |*next_in| pointer will be incremented by + that amount. Similarly, |*available_out| will be decremented by the + amount of output bytes written, and the |*next_out| pointer will be + incremented by that amount. |total_out|, if it is not a null-pointer, + will be set to the number of bytes decompressed since the last state + initialization. + + Input is never overconsumed, so |next_in| and |available_in| could be + passed to the next consumer after decoding is complete. */ + BrotliDecoderResult BrotliDecoderDecompressStream(BrotliDecoderState* s, + size_t* available_in, + const uint8_t** next_in, + size_t* available_out, + uint8_t** next_out, + size_t* total_out); + + /* Returns true, if decoder has some unconsumed output. + Otherwise returns false. */ + BROTLI_BOOL BrotliDecoderHasMoreOutput(const BrotliDecoderState* s); + + /* Returns true, if decoder has already received some input bytes. + Otherwise returns false. */ + BROTLI_BOOL BrotliDecoderIsUsed(const BrotliDecoderState* s); + + /* Returns true, if decoder is in a state where we reached the end of the + input and produced all of the output; returns false otherwise. */ + BROTLI_BOOL BrotliDecoderIsFinished(const BrotliDecoderState* s); + + /* Returns detailed error code after BrotliDecompressStream returns + BROTLI_DECODER_RESULT_ERROR. */ + BrotliDecoderErrorCode BrotliDecoderGetErrorCode( + const BrotliDecoderState* s); + + const char* BrotliDecoderErrorString(BrotliDecoderErrorCode c); + + /* enc/encode.h */ + typedef ... BrotliEncoderState; + + typedef enum BrotliEncoderParameter { + BROTLI_PARAM_MODE = 0, + /* Controls the compression-speed vs compression-density tradeoffs. The + higher the quality, the slower the compression. Range is 0 to 11. */ + BROTLI_PARAM_QUALITY = 1, + /* Base 2 logarithm of the sliding window size. Range is 10 to 24. */ + BROTLI_PARAM_LGWIN = 2, + /* Base 2 logarithm of the maximum input block size. Range is 16 to 24. + If set to 0, the value will be set based on the quality. */ + BROTLI_PARAM_LGBLOCK = 3 + } BrotliEncoderParameter; + + typedef enum BrotliEncoderMode { + /* Default compression mode. The compressor does not know anything in + advance about the properties of the input. */ + BROTLI_MODE_GENERIC = 0, + /* Compression mode for UTF-8 format text input. */ + BROTLI_MODE_TEXT = 1, + /* Compression mode used in WOFF 2.0. */ + BROTLI_MODE_FONT = 2 + } BrotliEncoderMode; + + int BROTLI_DEFAULT_QUALITY = 11; + int BROTLI_DEFAULT_WINDOW = 22; + #define BROTLI_DEFAULT_MODE ... + + typedef enum BrotliEncoderOperation { + BROTLI_OPERATION_PROCESS = 0, + /* Request output stream to flush. Performed when input stream is + depleted and there is enough space in output stream. */ + BROTLI_OPERATION_FLUSH = 1, + /* Request output stream to finish. Performed when input stream is + depleted and there is enough space in output stream. */ + BROTLI_OPERATION_FINISH = 2 + } BrotliEncoderOperation; + + /* Creates the instance of BrotliEncoderState and initializes it. + |alloc_func| and |free_func| MUST be both zero or both non-zero. In the + case they are both zero, default memory allocators are used. |opaque| is + passed to |alloc_func| and |free_func| when they are called. */ + BrotliEncoderState* BrotliEncoderCreateInstance(brotli_alloc_func, + brotli_free_func, + void *); + + /* Deinitializes and frees BrotliEncoderState instance. */ + void BrotliEncoderDestroyInstance(BrotliEncoderState* state); + + /* Compresses the data in |input_buffer| into |encoded_buffer|, and sets + |*encoded_size| to the compressed length. + BROTLI_DEFAULT_QUALITY, BROTLI_DEFAULT_WINDOW and BROTLI_DEFAULT_MODE + should be used as |quality|, |lgwin| and |mode| if there are no specific + requirements to encoder speed and compression ratio. + If compression fails, |*encoded_size| is set to 0. + If BrotliEncoderMaxCompressedSize(|input_size|) is not zero, then + |*encoded_size| is never set to the bigger value. + Returns false if there was an error and true otherwise. */ + BROTLI_BOOL BrotliEncoderCompress(int quality, + int lgwin, + BrotliEncoderMode mode, + size_t input_size, + const uint8_t* input_buffer, + size_t* encoded_size, + uint8_t* encoded_buffer); + + BROTLI_BOOL BrotliEncoderCompressStream(BrotliEncoderState* s, + BrotliEncoderOperation op, + size_t* available_in, + const uint8_t** next_in, + size_t* available_out, + uint8_t** next_out, + size_t* total_out); + + BROTLI_BOOL BrotliEncoderSetParameter(BrotliEncoderState* state, + BrotliEncoderParameter p, + uint32_t value); + + /* Check if encoder is in "finished" state, i.e. no more input is + acceptable and no more output will be produced. + Works only with BrotliEncoderCompressStream workflow. + Returns 1 if stream is finished and 0 otherwise. */ + BROTLI_BOOL BrotliEncoderIsFinished(BrotliEncoderState* s); + + /* Check if encoder has more output bytes in internal buffer. + Works only with BrotliEncoderCompressStream workflow. + Returns 1 if has more output (in internal buffer) and 0 otherwise. */ + BROTLI_BOOL BrotliEncoderHasMoreOutput(BrotliEncoderState* s); +""") + +if __name__ == '__main__': + ffi.compile() diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6.conda b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6.conda new file mode 100644 index 0000000000000000000000000000000000000000..bc5faa65f135ebfd258144a81db0aa3089bb39ae --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:235f266d5f9c3c61748bb1af0eff21bc7ed2a2a356b97ff28d9c1135039b08b0 +size 268384 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzcmp b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzcmp new file mode 100644 index 0000000000000000000000000000000000000000..bd96c27c39871d6802675b182f7cf4481bec96ca --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzcmp @@ -0,0 +1,76 @@ +#!/bin/sh +# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh + +# Bzcmp/diff wrapped for bzip2, +# adapted from zdiff by Philippe Troin for Debian GNU/Linux. + +# Bzcmp and bzdiff are used to invoke the cmp or the diff pro- +# gram on compressed files. All options specified are passed +# directly to cmp or diff. If only 1 file is specified, then +# the files compared are file1 and an uncompressed file1.gz. +# If two files are specified, then they are uncompressed (if +# necessary) and fed to cmp or diff. The exit status from cmp +# or diff is preserved. + +PATH="/usr/bin:/bin:$PATH"; export PATH +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *cmp) comp=${CMP-cmp} ;; + *) comp=${DIFF-diff} ;; +esac + +OPTIONS= +FILES= +for ARG +do + case "$ARG" in + -*) OPTIONS="$OPTIONS $ARG";; + *) if test -f "$ARG"; then + FILES="$FILES $ARG" + else + echo "${prog}: $ARG not found or not a regular file" + exit 1 + fi ;; + esac +done +if test -z "$FILES"; then + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi +set $FILES +if test $# -eq 1; then + FILE=`echo "$1" | sed 's/.bz2$//'` + bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE" + STAT="$?" + +elif test $# -eq 2; then + case "$1" in + *.bz2) + case "$2" in + *.bz2) + F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` + tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || { + echo 'cannot create a temporary file' >&2 + exit 1 + } + bzip2 -cdfq "$2" > "$tmp" + bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp" + STAT="$?" + /bin/rm -f "$tmp";; + + *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" + STAT="$?";; + esac;; + *) case "$2" in + *.bz2) + bzip2 -cdfq "$2" | $comp $OPTIONS "$1" - + STAT="$?";; + *) $comp $OPTIONS "$1" "$2" + STAT="$?";; + esac;; + esac +else + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi +exit "$STAT" diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzdiff b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzdiff new file mode 100644 index 0000000000000000000000000000000000000000..bd96c27c39871d6802675b182f7cf4481bec96ca --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzdiff @@ -0,0 +1,76 @@ +#!/bin/sh +# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh + +# Bzcmp/diff wrapped for bzip2, +# adapted from zdiff by Philippe Troin for Debian GNU/Linux. + +# Bzcmp and bzdiff are used to invoke the cmp or the diff pro- +# gram on compressed files. All options specified are passed +# directly to cmp or diff. If only 1 file is specified, then +# the files compared are file1 and an uncompressed file1.gz. +# If two files are specified, then they are uncompressed (if +# necessary) and fed to cmp or diff. The exit status from cmp +# or diff is preserved. + +PATH="/usr/bin:/bin:$PATH"; export PATH +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *cmp) comp=${CMP-cmp} ;; + *) comp=${DIFF-diff} ;; +esac + +OPTIONS= +FILES= +for ARG +do + case "$ARG" in + -*) OPTIONS="$OPTIONS $ARG";; + *) if test -f "$ARG"; then + FILES="$FILES $ARG" + else + echo "${prog}: $ARG not found or not a regular file" + exit 1 + fi ;; + esac +done +if test -z "$FILES"; then + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi +set $FILES +if test $# -eq 1; then + FILE=`echo "$1" | sed 's/.bz2$//'` + bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE" + STAT="$?" + +elif test $# -eq 2; then + case "$1" in + *.bz2) + case "$2" in + *.bz2) + F=`echo "$2" | sed 's|.*/||;s|.bz2$||'` + tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || { + echo 'cannot create a temporary file' >&2 + exit 1 + } + bzip2 -cdfq "$2" > "$tmp" + bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp" + STAT="$?" + /bin/rm -f "$tmp";; + + *) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" + STAT="$?";; + esac;; + *) case "$2" in + *.bz2) + bzip2 -cdfq "$2" | $comp $OPTIONS "$1" - + STAT="$?";; + *) $comp $OPTIONS "$1" "$2" + STAT="$?";; + esac;; + esac +else + echo "Usage: $prog [${comp}_options] file [file]" + exit 1 +fi +exit "$STAT" diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzegrep b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzegrep new file mode 100644 index 0000000000000000000000000000000000000000..0314ca6038b03a9d36d5b5f877cab0cdbc2425e1 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzegrep @@ -0,0 +1,85 @@ +#!/bin/sh + +# Bzgrep wrapped for bzip2, +# adapted from zgrep by Philippe Troin for Debian GNU/Linux. +## zgrep notice: +## zgrep -- a wrapper around a grep program that decompresses files as needed +## Adapted from a version sent by Charles Levert + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *egrep) grep=${EGREP-egrep} ;; + *fgrep) grep=${FGREP-fgrep} ;; + *) grep=${GREP-grep} ;; +esac +pat="" +while test $# -ne 0; do + case "$1" in + -e | -f) opt="$opt $1"; shift; pat="$1" + if test "$grep" = grep; then # grep is buggy with -e on SVR4 + grep=egrep + fi;; + -A | -B) opt="$opt $1 $2"; shift;; + -*) opt="$opt $1";; + *) if test -z "$pat"; then + pat="$1" + else + break; + fi;; + esac + shift +done + +if test -z "$pat"; then + echo "grep through bzip2 files" + echo "usage: $prog [grep_options] pattern [files]" + exit 1 +fi + +list=0 +silent=0 +op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'` +case "$op" in + *l*) list=1 +esac +case "$op" in + *h*) silent=1 +esac + +if test $# -eq 0; then + bzip2 -cdfq | $grep $opt "$pat" + exit $? +fi + +res=0 +for i do + if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi + if test $list -eq 1; then + bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i + r=$? + elif test $# -eq 1 -o $silent -eq 1; then + bzip2 -cdfq "$i" | $grep $opt "$pat" + r=$? + else + j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g') + j=`printf "%s" "$j" | tr '\n' ' '` + # A trick adapted from + # https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J + # that has the same effect as the following bash code: + # bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" + # r=${PIPESTATUS[1]} + exec 3>&1 + eval ` + exec 4>&1 >&3 3>&- + { + bzip2 -cdfq "$i" 4>&- + } | { + $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 + } | sed "s|^|${j}:|" + ` + fi + test "$r" -ne 0 && res="$r" +done +exit $res diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzfgrep b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzfgrep new file mode 100644 index 0000000000000000000000000000000000000000..0314ca6038b03a9d36d5b5f877cab0cdbc2425e1 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzfgrep @@ -0,0 +1,85 @@ +#!/bin/sh + +# Bzgrep wrapped for bzip2, +# adapted from zgrep by Philippe Troin for Debian GNU/Linux. +## zgrep notice: +## zgrep -- a wrapper around a grep program that decompresses files as needed +## Adapted from a version sent by Charles Levert + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *egrep) grep=${EGREP-egrep} ;; + *fgrep) grep=${FGREP-fgrep} ;; + *) grep=${GREP-grep} ;; +esac +pat="" +while test $# -ne 0; do + case "$1" in + -e | -f) opt="$opt $1"; shift; pat="$1" + if test "$grep" = grep; then # grep is buggy with -e on SVR4 + grep=egrep + fi;; + -A | -B) opt="$opt $1 $2"; shift;; + -*) opt="$opt $1";; + *) if test -z "$pat"; then + pat="$1" + else + break; + fi;; + esac + shift +done + +if test -z "$pat"; then + echo "grep through bzip2 files" + echo "usage: $prog [grep_options] pattern [files]" + exit 1 +fi + +list=0 +silent=0 +op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'` +case "$op" in + *l*) list=1 +esac +case "$op" in + *h*) silent=1 +esac + +if test $# -eq 0; then + bzip2 -cdfq | $grep $opt "$pat" + exit $? +fi + +res=0 +for i do + if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi + if test $list -eq 1; then + bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i + r=$? + elif test $# -eq 1 -o $silent -eq 1; then + bzip2 -cdfq "$i" | $grep $opt "$pat" + r=$? + else + j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g') + j=`printf "%s" "$j" | tr '\n' ' '` + # A trick adapted from + # https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J + # that has the same effect as the following bash code: + # bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" + # r=${PIPESTATUS[1]} + exec 3>&1 + eval ` + exec 4>&1 >&3 3>&- + { + bzip2 -cdfq "$i" 4>&- + } | { + $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 + } | sed "s|^|${j}:|" + ` + fi + test "$r" -ne 0 && res="$r" +done +exit $res diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzgrep b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzgrep new file mode 100644 index 0000000000000000000000000000000000000000..0314ca6038b03a9d36d5b5f877cab0cdbc2425e1 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzgrep @@ -0,0 +1,85 @@ +#!/bin/sh + +# Bzgrep wrapped for bzip2, +# adapted from zgrep by Philippe Troin for Debian GNU/Linux. +## zgrep notice: +## zgrep -- a wrapper around a grep program that decompresses files as needed +## Adapted from a version sent by Charles Levert + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *egrep) grep=${EGREP-egrep} ;; + *fgrep) grep=${FGREP-fgrep} ;; + *) grep=${GREP-grep} ;; +esac +pat="" +while test $# -ne 0; do + case "$1" in + -e | -f) opt="$opt $1"; shift; pat="$1" + if test "$grep" = grep; then # grep is buggy with -e on SVR4 + grep=egrep + fi;; + -A | -B) opt="$opt $1 $2"; shift;; + -*) opt="$opt $1";; + *) if test -z "$pat"; then + pat="$1" + else + break; + fi;; + esac + shift +done + +if test -z "$pat"; then + echo "grep through bzip2 files" + echo "usage: $prog [grep_options] pattern [files]" + exit 1 +fi + +list=0 +silent=0 +op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'` +case "$op" in + *l*) list=1 +esac +case "$op" in + *h*) silent=1 +esac + +if test $# -eq 0; then + bzip2 -cdfq | $grep $opt "$pat" + exit $? +fi + +res=0 +for i do + if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi + if test $list -eq 1; then + bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i + r=$? + elif test $# -eq 1 -o $silent -eq 1; then + bzip2 -cdfq "$i" | $grep $opt "$pat" + r=$? + else + j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g') + j=`printf "%s" "$j" | tr '\n' ' '` + # A trick adapted from + # https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J + # that has the same effect as the following bash code: + # bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|" + # r=${PIPESTATUS[1]} + exec 3>&1 + eval ` + exec 4>&1 >&3 3>&- + { + bzip2 -cdfq "$i" 4>&- + } | { + $grep $opt "$pat" 4>&-; echo "r=$?;" >&4 + } | sed "s|^|${j}:|" + ` + fi + test "$r" -ne 0 && res="$r" +done +exit $res diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzip2recover b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzip2recover new file mode 100644 index 0000000000000000000000000000000000000000..6d9fb9e02c944c3055ac4801f6d7e3cd638062da Binary files /dev/null and b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzip2recover differ diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzless b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzless new file mode 100644 index 0000000000000000000000000000000000000000..d314043404976e58329f611c195d5c49eb917655 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzless @@ -0,0 +1,61 @@ +#!/bin/sh + +# Bzmore wrapped for bzip2, +# adapted from zmore by Philippe Troin for Debian GNU/Linux. + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *less) more=less ;; + *) more=more ;; +esac + +if test "`echo -n a`" = "-n a"; then + # looks like a SysV system: + n1=''; n2='\c' +else + n1='-n'; n2='' +fi +oldtty=`stty -g 2>/dev/null` +if stty -cbreak 2>/dev/null; then + cb='cbreak'; ncb='-cbreak' +else + # 'stty min 1' resets eof to ^a on both SunOS and SysV! + cb='min 1 -icanon'; ncb='icanon eof ^d' +fi +if test $? -eq 0 -a -n "$oldtty"; then + trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15 +else + trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15 +fi + +if test $# = 0; then + if test -t 0; then + echo usage: $prog files... + else + bzip2 -cdfq | eval $more + fi +else + FIRST=1 + for FILE + do + if test $FIRST -eq 0; then + echo $n1 "--More--(Next file: $FILE)$n2" + stty $cb -echo 2>/dev/null + ANS=`dd bs=1 count=1 2>/dev/null` + stty $ncb echo 2>/dev/null + echo " " + if test "$ANS" = 'e' -o "$ANS" = 'q'; then + exit + fi + fi + if test "$ANS" != 's'; then + echo "------> $FILE <------" + bzip2 -cdfq "$FILE" | eval $more + fi + if test -t; then + FIRST=0 + fi + done +fi diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzmore b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzmore new file mode 100644 index 0000000000000000000000000000000000000000..d314043404976e58329f611c195d5c49eb917655 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/bin/bzmore @@ -0,0 +1,61 @@ +#!/bin/sh + +# Bzmore wrapped for bzip2, +# adapted from zmore by Philippe Troin for Debian GNU/Linux. + +PATH="/usr/bin:$PATH"; export PATH + +prog=`echo $0 | sed 's|.*/||'` +case "$prog" in + *less) more=less ;; + *) more=more ;; +esac + +if test "`echo -n a`" = "-n a"; then + # looks like a SysV system: + n1=''; n2='\c' +else + n1='-n'; n2='' +fi +oldtty=`stty -g 2>/dev/null` +if stty -cbreak 2>/dev/null; then + cb='cbreak'; ncb='-cbreak' +else + # 'stty min 1' resets eof to ^a on both SunOS and SysV! + cb='min 1 -icanon'; ncb='icanon eof ^d' +fi +if test $? -eq 0 -a -n "$oldtty"; then + trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15 +else + trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15 +fi + +if test $# = 0; then + if test -t 0; then + echo usage: $prog files... + else + bzip2 -cdfq | eval $more + fi +else + FIRST=1 + for FILE + do + if test $FIRST -eq 0; then + echo $n1 "--More--(Next file: $FILE)$n2" + stty $cb -echo 2>/dev/null + ANS=`dd bs=1 count=1 2>/dev/null` + stty $ncb echo 2>/dev/null + echo " " + if test "$ANS" = 'e' -o "$ANS" = 'q'; then + exit + fi + fi + if test "$ANS" != 's'; then + echo "------> $FILE <------" + bzip2 -cdfq "$FILE" | eval $more + fi + if test -t; then + FIRST=0 + fi + done +fi diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/include/bzlib.h b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/include/bzlib.h new file mode 100644 index 0000000000000000000000000000000000000000..8966a6c5804e87a37354e28882117af0876fa0d2 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/include/bzlib.h @@ -0,0 +1,282 @@ + +/*-------------------------------------------------------------*/ +/*--- Public header file for the library. ---*/ +/*--- bzlib.h ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.8 of 13 July 2019 + Copyright (C) 1996-2019 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#ifndef _BZLIB_H +#define _BZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BZ_RUN 0 +#define BZ_FLUSH 1 +#define BZ_FINISH 2 + +#define BZ_OK 0 +#define BZ_RUN_OK 1 +#define BZ_FLUSH_OK 2 +#define BZ_FINISH_OK 3 +#define BZ_STREAM_END 4 +#define BZ_SEQUENCE_ERROR (-1) +#define BZ_PARAM_ERROR (-2) +#define BZ_MEM_ERROR (-3) +#define BZ_DATA_ERROR (-4) +#define BZ_DATA_ERROR_MAGIC (-5) +#define BZ_IO_ERROR (-6) +#define BZ_UNEXPECTED_EOF (-7) +#define BZ_OUTBUFF_FULL (-8) +#define BZ_CONFIG_ERROR (-9) + +typedef + struct { + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *,int,int); + void (*bzfree)(void *,void *); + void *opaque; + } + bz_stream; + + +#ifndef BZ_IMPORT +#define BZ_EXPORT +#endif + +#ifndef BZ_NO_STDIO +/* Need a definitition for FILE */ +#include +#endif + +#ifdef _WIN32 +# include +# ifdef small + /* windows.h define small to char */ +# undef small +# endif +# ifdef BZ_EXPORT +# define BZ_API(func) WINAPI func +# define BZ_EXTERN extern +# else + /* import windows dll dynamically */ +# define BZ_API(func) (WINAPI * func) +# define BZ_EXTERN +# endif +#else +# define BZ_API(func) func +# define BZ_EXTERN extern +#endif + + +/*-- Core (low-level) library functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, + int small + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm + ); + + + +/*-- High(er) level library functions --*/ + +#ifndef BZ_NO_STDIO +#define BZ_MAX_UNUSED 5000 + +typedef void BZFILE; + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused + ); + +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 + ); +#endif + + +/*-- Utility functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity + ); + + +/*-- + Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ + +BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( + void + ); + +#ifndef BZ_NO_STDIO +BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( + const char *path, + const char *mode + ); + +BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( + int fd, + const char *mode + ); + +BZ_EXTERN int BZ_API(BZ2_bzread) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzwrite) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzflush) ( + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzclose) ( + BZFILE* b + ); + +BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( + BZFILE *b, + int *errnum + ); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/*-------------------------------------------------------------*/ +/*--- end bzlib.h ---*/ +/*-------------------------------------------------------------*/ diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/about.json b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/about.json new file mode 100644 index 0000000000000000000000000000000000000000..39eec4e3d2702b64bd0b03e7926c0af9f59a3acc --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/about.json @@ -0,0 +1,136 @@ +{ + "channels": [ + "https://repo.anaconda.com/pkgs/main" + ], + "conda_build_version": "24.1.2", + "conda_version": "24.1.2", + "description": "Bzip2 is a freely available high-quality data compressor. It typically\ncompresses files to within 10% to 15% of the best available techniques,\nwhilst being around twice as fast at compression and six times faster\nat decompression.\n", + "dev_url": "https://sourceware.org/git/?p=bzip2.git", + "doc_url": "https://sourceware.org/bzip2/docs.html", + "env_vars": { + "CIO_TEST": "" + }, + "extra": { + "copy_test_source_files": true, + "final": true, + "flow_run_id": "d98ea40d-0d6e-431e-a29d-65b4841389b5", + "recipe-maintainers": [ + "jakirkham", + "jjhelmus", + "pelson", + "jlanga", + "mingwandroid", + "msarahan" + ], + "remote_url": "git@github.com:AnacondaRecipes/bzip2-feedstock.git", + "sha": "de4f0e44ad8e6cffffb605bc99e429bcaee425b7" + }, + "home": "https://sourceware.org/bzip2/", + "identifiers": [], + "keywords": [], + "license": "bzip2-1.0.8", + "license_family": "BSD", + "license_file": "LICENSE", + "root_pkgs": [ + "_libgcc_mutex 0.1 main", + "_openmp_mutex 5.1 1_gnu", + "archspec 0.2.1 pyhd3eb1b0_0", + "boltons 23.0.0 py39h06a4308_0", + "brotli-python 1.0.9 py39h6a678d5_7", + "bzip2 1.0.8 h7b6447c_0", + "c-ares 1.19.1 h5eee18b_0", + "charset-normalizer 2.0.4 pyhd3eb1b0_0", + "conda-content-trust 0.2.0 py39h06a4308_0", + "conda-package-handling 2.2.0 py39h06a4308_0", + "conda-package-streaming 0.9.0 py39h06a4308_0", + "fmt 9.1.0 hdb19cb5_0", + "icu 73.1 h6a678d5_0", + "idna 3.4 py39h06a4308_0", + "jsonpatch 1.32 pyhd3eb1b0_0", + "jsonpointer 2.1 pyhd3eb1b0_0", + "krb5 1.20.1 h143b758_1", + "ld_impl_linux-64 2.38 h1181459_1", + "libarchive 3.6.2 h6ac8c49_2", + "libev 4.33 h7f8727e_1", + "libffi 3.4.4 h6a678d5_0", + "libgcc-ng 11.2.0 h1234567_1", + "libgomp 11.2.0 h1234567_1", + "libnghttp2 1.57.0 h2d74bed_0", + "libsolv 0.7.24 he621ea3_0", + "libssh2 1.10.0 hdbd6064_2", + "libstdcxx-ng 11.2.0 h1234567_1", + "libxml2 2.10.4 hf1b16e4_1", + "lz4-c 1.9.4 h6a678d5_0", + "ncurses 6.4 h6a678d5_0", + "packaging 23.1 py39h06a4308_0", + "pcre2 10.42 hebb0a14_0", + "pluggy 1.0.0 py39h06a4308_1", + "pybind11-abi 4 hd3eb1b0_1", + "pycosat 0.6.6 py39h5eee18b_0", + "pycparser 2.21 pyhd3eb1b0_0", + "pysocks 1.7.1 py39h06a4308_0", + "python 3.9.18 h955ad1f_0", + "readline 8.2 h5eee18b_0", + "reproc 14.2.4 h295c915_1", + "reproc-cpp 14.2.4 h295c915_1", + "ruamel.yaml 0.17.21 py39h5eee18b_0", + "ruamel.yaml.clib 0.2.6 py39h5eee18b_1", + "sqlite 3.41.2 h5eee18b_0", + "tk 8.6.12 h1ccaba5_0", + "tqdm 4.65.0 py39hb070fc8_0", + "wheel 0.41.2 py39h06a4308_0", + "yaml-cpp 0.8.0 h6a678d5_0", + "zlib 1.2.13 h5eee18b_0", + "zstandard 0.19.0 py39h5eee18b_0", + "zstd 1.5.5 hc292b87_0", + "attrs 23.1.0 py39h06a4308_0", + "beautifulsoup4 4.12.2 py39h06a4308_0", + "ca-certificates 2023.12.12 h06a4308_0", + "certifi 2024.2.2 py39h06a4308_0", + "cffi 1.16.0 py39h5eee18b_0", + "chardet 4.0.0 py39h06a4308_1003", + "click 8.1.7 py39h06a4308_0", + "conda 24.1.2 py39h06a4308_0", + "conda-build 24.1.2 py39h06a4308_0", + "conda-index 0.4.0 pyhd3eb1b0_0", + "conda-libmamba-solver 24.1.0 pyhd3eb1b0_0", + "cryptography 42.0.2 py39hdda0065_0", + "distro 1.8.0 py39h06a4308_0", + "filelock 3.13.1 py39h06a4308_0", + "jinja2 3.1.3 py39h06a4308_0", + "jsonschema 4.19.2 py39h06a4308_0", + "jsonschema-specifications 2023.7.1 py39h06a4308_0", + "libcurl 8.5.0 h251f7ec_0", + "libedit 3.1.20230828 h5eee18b_0", + "liblief 0.12.3 h6a678d5_0", + "libmamba 1.5.6 haf1ee3a_0", + "libmambapy 1.5.6 py39h2dafd23_0", + "markupsafe 2.1.3 py39h5eee18b_0", + "menuinst 2.0.2 py39h06a4308_0", + "more-itertools 10.1.0 py39h06a4308_0", + "openssl 3.0.13 h7f8727e_0", + "patch 2.7.6 h7b6447c_1001", + "patchelf 0.17.2 h6a678d5_0", + "pip 23.3.1 py39h06a4308_0", + "pkginfo 1.9.6 py39h06a4308_0", + "platformdirs 3.10.0 py39h06a4308_0", + "psutil 5.9.0 py39h5eee18b_0", + "py-lief 0.12.3 py39h6a678d5_0", + "pyopenssl 24.0.0 py39h06a4308_0", + "python-libarchive-c 2.9 pyhd3eb1b0_1", + "pytz 2023.3.post1 py39h06a4308_0", + "pyyaml 6.0.1 py39h5eee18b_0", + "referencing 0.30.2 py39h06a4308_0", + "requests 2.31.0 py39h06a4308_1", + "rpds-py 0.10.6 py39hb02cf49_0", + "setuptools 68.2.2 py39h06a4308_0", + "soupsieve 2.5 py39h06a4308_0", + "tomli 2.0.1 py39h06a4308_0", + "tzdata 2023d h04d1e81_0", + "urllib3 2.1.0 py39h06a4308_1", + "xz 5.4.5 h5eee18b_0", + "yaml 0.2.5 h7b6447c_0" + ], + "summary": "high-quality data compressor", + "tags": [] +} \ No newline at end of file diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/files b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/files new file mode 100644 index 0000000000000000000000000000000000000000..5223bc08dc004a51cd4f75d67780bcacca4e41f2 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/files @@ -0,0 +1,24 @@ +bin/bunzip2 +bin/bzcat +bin/bzcmp +bin/bzdiff +bin/bzegrep +bin/bzfgrep +bin/bzgrep +bin/bzip2 +bin/bzip2recover +bin/bzless +bin/bzmore +include/bzlib.h +lib/libbz2.a +lib/libbz2.so +lib/libbz2.so.1.0 +lib/libbz2.so.1.0.8 +man/man1/bzcmp.1 +man/man1/bzdiff.1 +man/man1/bzegrep.1 +man/man1/bzfgrep.1 +man/man1/bzgrep.1 +man/man1/bzip2.1 +man/man1/bzless.1 +man/man1/bzmore.1 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/git b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/git new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/hash_input.json b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/hash_input.json new file mode 100644 index 0000000000000000000000000000000000000000..ee39e60397517178c5c519bf3ca4e0388499ec07 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/hash_input.json @@ -0,0 +1,6 @@ +{ + "c_compiler_version": "11.2.0", + "channel_targets": "defaults", + "target_platform": "linux-64", + "c_compiler": "gcc" +} \ No newline at end of file diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/index.json b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/index.json new file mode 100644 index 0000000000000000000000000000000000000000..2664e4b295abd548c95c43666a8b1d1ecc59a883 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/index.json @@ -0,0 +1,15 @@ +{ + "arch": "x86_64", + "build": "h5eee18b_6", + "build_number": 6, + "depends": [ + "libgcc-ng >=11.2.0" + ], + "license": "bzip2-1.0.8", + "license_family": "BSD", + "name": "bzip2", + "platform": "linux", + "subdir": "linux-64", + "timestamp": 1714510571510, + "version": "1.0.8" +} \ No newline at end of file diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/licenses/LICENSE b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..81a37eab7a5be1a34456f38adb74928cc9073e9b --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/licenses/LICENSE @@ -0,0 +1,42 @@ + +-------------------------------------------------------------------------- + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2019 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@acm.org +bzip2/libbzip2 version 1.0.8 of 13 July 2019 + +-------------------------------------------------------------------------- diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/paths.json b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/paths.json new file mode 100644 index 0000000000000000000000000000000000000000..3253d42d2e5d8ebd12e6f53653067f241f15843a --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/paths.json @@ -0,0 +1,149 @@ +{ + "paths": [ + { + "_path": "bin/bunzip2", + "path_type": "hardlink", + "sha256": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed", + "size_in_bytes": 299464 + }, + { + "_path": "bin/bzcat", + "path_type": "hardlink", + "sha256": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed", + "size_in_bytes": 299464 + }, + { + "_path": "bin/bzcmp", + "path_type": "softlink", + "sha256": "1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012", + "size_in_bytes": 2140 + }, + { + "_path": "bin/bzdiff", + "path_type": "hardlink", + "sha256": "1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012", + "size_in_bytes": 2140 + }, + { + "_path": "bin/bzegrep", + "path_type": "softlink", + "sha256": "a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9", + "size_in_bytes": 2054 + }, + { + "_path": "bin/bzfgrep", + "path_type": "softlink", + "sha256": "a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9", + "size_in_bytes": 2054 + }, + { + "_path": "bin/bzgrep", + "path_type": "hardlink", + "sha256": "a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9", + "size_in_bytes": 2054 + }, + { + "_path": "bin/bzip2", + "path_type": "hardlink", + "sha256": "8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed", + "size_in_bytes": 299464 + }, + { + "_path": "bin/bzip2recover", + "path_type": "hardlink", + "sha256": "4713d7b2cdf7a82857e47b9001665d26656a0eb13dc830430a42f5d6fe5fe0b6", + "size_in_bytes": 30920 + }, + { + "_path": "bin/bzless", + "path_type": "softlink", + "sha256": "836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d", + "size_in_bytes": 1259 + }, + { + "_path": "bin/bzmore", + "path_type": "hardlink", + "sha256": "836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d", + "size_in_bytes": 1259 + }, + { + "_path": "include/bzlib.h", + "path_type": "hardlink", + "sha256": "6ac62e811669598ee30c9e1c379b9e627f6ff17a5a3dc1e0b4fa8b8ea75e580d", + "size_in_bytes": 6240 + }, + { + "_path": "lib/libbz2.a", + "path_type": "hardlink", + "sha256": "4377dc3d8f7542568b6365cd6bb06970b53c20e9a71b7d54271874f7868be500", + "size_in_bytes": 264138 + }, + { + "_path": "lib/libbz2.so", + "path_type": "softlink", + "sha256": "4979469ae49ac144f62202f75bbdd69b17197aedb879d633337c8cf7e4aba301", + "size_in_bytes": 229016 + }, + { + "_path": "lib/libbz2.so.1.0", + "path_type": "softlink", + "sha256": "4979469ae49ac144f62202f75bbdd69b17197aedb879d633337c8cf7e4aba301", + "size_in_bytes": 229016 + }, + { + "_path": "lib/libbz2.so.1.0.8", + "path_type": "hardlink", + "sha256": "4979469ae49ac144f62202f75bbdd69b17197aedb879d633337c8cf7e4aba301", + "size_in_bytes": 229016 + }, + { + "_path": "man/man1/bzcmp.1", + "path_type": "hardlink", + "sha256": "172cde42c47a6d50c244e39d993097dcd3882427d57303078643849cf10a81c4", + "size_in_bytes": 18 + }, + { + "_path": "man/man1/bzdiff.1", + "path_type": "hardlink", + "sha256": "32d1a7cd115430398e58537532584ef2ab76343c9f094dcd1253d9c4c0f705bf", + "size_in_bytes": 897 + }, + { + "_path": "man/man1/bzegrep.1", + "path_type": "hardlink", + "sha256": "cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182", + "size_in_bytes": 18 + }, + { + "_path": "man/man1/bzfgrep.1", + "path_type": "hardlink", + "sha256": "cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182", + "size_in_bytes": 18 + }, + { + "_path": "man/man1/bzgrep.1", + "path_type": "hardlink", + "sha256": "924aa4a7c7c1467400181e4c0ee1b527db142b6399a717171f2351b72b5899df", + "size_in_bytes": 1297 + }, + { + "_path": "man/man1/bzip2.1", + "path_type": "hardlink", + "sha256": "27b984bb2e8bbee2651d11cda87449cfc4138d2e479b9eaa77b8f60fa5d0bf5d", + "size_in_bytes": 16266 + }, + { + "_path": "man/man1/bzless.1", + "path_type": "hardlink", + "sha256": "216898f9b8acf61eeb471ecf23e47c1452dfd648f7f38d7d3bf48627072dc52c", + "size_in_bytes": 18 + }, + { + "_path": "man/man1/bzmore.1", + "path_type": "hardlink", + "sha256": "ccfcf3f995e11adae3035e287252091bb72d165da21e0c385a4965d17c9051c7", + "size_in_bytes": 4310 + } + ], + "paths_version": 1 +} \ No newline at end of file diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/0001-cross.patch b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/0001-cross.patch new file mode 100644 index 0000000000000000000000000000000000000000..5398fb28690def3079b888fbc482742b3244abe6 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/0001-cross.patch @@ -0,0 +1,52 @@ +diff --git a/Makefile b/Makefile +index 9754ddf..b5512de 100644 +--- a/Makefile ++++ b/Makefile +@@ -15,16 +15,16 @@ + SHELL=/bin/sh + + # To assist in cross-compiling +-CC=gcc +-AR=ar +-RANLIB=ranlib +-LDFLAGS= ++CC?=gcc ++AR?=ar ++RANLIB?=ranlib + + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS?=-Wall -Winline -O2 -g ++CFLAGS=$(CFLAGS) $(BIGFILES) + + # Where you want it installed when you do 'make install' +-PREFIX=/usr/local ++PREFIX=$PREFIX + + + OBJS= blocksort.o \ +diff --git a/Makefile-libbz2_so b/Makefile-libbz2_so +index e58791b..f4b9fa2 100644 +--- a/Makefile-libbz2_so ++++ b/Makefile-libbz2_so +@@ -22,9 +22,18 @@ + + + SHELL=/bin/sh +-CC=gcc ++ ++# To assist in cross-compiling ++CC?=gcc ++AR?=ar ++RANLIB?=ranlib ++ + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS?=-Wall -Winline -O2 -g ++CFLAGS=$(CFLAGS) $(BIGFILES) ++ ++# Where you want it installed when you do 'make install' ++PREFIX=$PREFIX + + OBJS= blocksort.o \ + huffman.o \ diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/bld.bat b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/bld.bat new file mode 100644 index 0000000000000000000000000000000000000000..b88c3061d0ddb97efbbcaaaf5792f22b1bcc3105 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/bld.bat @@ -0,0 +1,32 @@ +@echo on + +REM The bzip2 executable uses the environment variables BZIP2 and BZIP to initialise its ArgList +REM conda sets these values from conda_build_config.yaml and bzip2 tries to open a file called "1.0" +set BZIP2= +set BZIP= + +REM Build step +nmake -f makefile.msc +if errorlevel 1 exit 1 + +REM Install step +copy bzlib.h %LIBRARY_INC% || exit 1 +copy libbz2_static.lib %LIBRARY_LIB% || exit 1 +REM Some packages expect 'bzip2.lib', so make another copy +copy libbz2_static.lib %LIBRARY_LIB%\bzip2_static.lib || exit 1 + +copy libbz2.lib %LIBRARY_LIB% || exit 1 +REM Some packages expect 'bzip2.lib', so make copies +copy libbz2.lib %LIBRARY_LIB%\bzip2.lib || exit 1 +copy libbz2.exp %LIBRARY_LIB%\libbz2.exp || exit 1 +copy libbz2.def %LIBRARY_LIB%\libbz2.def || exit 1 + +copy libbz2.dll %LIBRARY_BIN% || exit 1 +REM Some packages expect 'bzip2.dll', so make copies +copy libbz2.dll %LIBRARY_BIN%\bzip2.dll || exit 1 + +REM Copy also uppercased variant of the dll +copy LIBBZ2.dll %LIBRARY_BIN%\LIBBZ2.dll || exit 1 + +REM Copy exe files +copy *.exe %LIBRARY_BIN% || exit 1 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/build.sh b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/build.sh new file mode 100644 index 0000000000000000000000000000000000000000..301155c90fe00bdd41bd65c231c11b590525e07b --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/build.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# toolchain flags + bzip flags + fpic +export CFLAGS="${CFLAGS} -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 -fPIC" +USED_CC=${GCC:-${CC}} +make install PREFIX="${PREFIX}" CFLAGS="${CFLAGS}" CC="${USED_CC}" + +# build shared library +if [[ ${target_platform} =~ .*linux*. ]]; then + make -f Makefile-libbz2_so CFLAGS="${CFLAGS}" CC="${USED_CC}" + ln -s libbz2.so."${PKG_VERSION}" libbz2.so + cp -d libbz2.so* "${PREFIX}"/lib/ +elif [[ ${target_platform} == osx-* ]]; then + ${USED_CC} -shared -Wl,-install_name -Wl,libbz2.dylib -o libbz2.${PKG_VERSION}.dylib blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o ${LDFLAGS} + cp libbz2."${PKG_VERSION}".dylib "${PREFIX}"/lib/ + ln -s libbz2."${PKG_VERSION}".dylib "${PREFIX}"/lib/libbz2.dylib +fi diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/build_dll.patch b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/build_dll.patch new file mode 100644 index 0000000000000000000000000000000000000000..4ffb8f6ba03ba12b94dbdea603d92642fb8f64bf --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/build_dll.patch @@ -0,0 +1,89 @@ +From 170f403ee2355d71dd6bca6ff463b7c341ad04dc Mon Sep 17 00:00:00 2001 +From: Serhii Kupriienko +Date: Mon, 12 Feb 2024 15:55:52 +0200 +Subject: [PATCH] Fix the dll creation, remove DESCRIPTION. +The following changes were taken from https://github.com/philr/bzip2-windows/tree/v1.0.8.0/patches. +They are licensed under the MIT and Copyright (c) 2015-2019 Philip Ross. + +--- + libbz2.def | 1 - + makefile.msc | 30 ++++++++++++++++++------------ + 2 files changed, 18 insertions(+), 13 deletions(-) + +diff --git a/libbz2.def b/libbz2.def +index 2dc0dd8..b8de2aa 100644 +--- a/libbz2.def ++++ b/libbz2.def +@@ -1,5 +1,4 @@ + LIBRARY LIBBZ2 +-DESCRIPTION "libbzip2: library for data compression" + EXPORTS + BZ2_bzCompressInit + BZ2_bzCompress +diff --git a/makefile.msc b/makefile.msc +index 799a18a..0e0bc85 100644 +--- a/makefile.msc ++++ b/makefile.msc +@@ -14,14 +14,17 @@ OBJS= blocksort.obj \ + decompress.obj \ + bzlib.obj + +-all: lib bzip2 test ++all: dll lib bzip2 test + +-bzip2: lib +- $(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj +- $(CC) $(CFLAGS) -o bzip2recover bzip2recover.c ++bzip2: dll ++ $(CC) $(CFLAGS) /Febzip2 bzip2.c libbz2.lib setargv.obj ++ $(CC) $(CFLAGS) /Febzip2recover bzip2recover.c ++ ++dll: $(OBJS) libbz2.def ++ link /dll /implib:libbz2.lib /out:libbz2.dll /def:libbz2.def $(OBJS) + + lib: $(OBJS) +- lib /out:libbz2.lib $(OBJS) ++ lib /out:libbz2_static.lib $(OBJS) + + test: bzip2 + type words1 +@@ -37,7 +40,7 @@ test: bzip2 + @echo is too clever for its own good. Disable this option. + @echo The correct size for sample3.ref is 120,244. If it + @echo is 150,251, WinZip has messed it up. +- fc sample1.bz2 sample1.rb2 ++ fc sample1.bz2 sample1.rb2 + fc sample2.bz2 sample2.rb2 + fc sample3.bz2 sample3.rb2 + fc sample1.tst sample1.ref +@@ -46,18 +49,21 @@ test: bzip2 + + + +-clean: ++clean: + del *.obj +- del libbz2.lib ++ del libbz2.lib ++ del libbz2.dll ++ del libbz2.exp ++ del libbz2-static.lib + del bzip2.exe + del bzip2recover.exe +- del sample1.rb2 +- del sample2.rb2 ++ del sample1.rb2 ++ del sample2.rb2 + del sample3.rb2 +- del sample1.tst ++ del sample1.tst + del sample2.tst + del sample3.tst + + .c.obj: +- $(CC) $(CFLAGS) -c $*.c -o $*.obj ++ $(CC) $(CFLAGS) -c $*.c /Fo$*.obj + +-- +2.39.0 + diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/bz2.c b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/bz2.c new file mode 100644 index 0000000000000000000000000000000000000000..b1fab3c5f0b81777a81ec111cab0d5cd3dfe36b5 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/bz2.c @@ -0,0 +1,56 @@ +#include +#include +#include + +int main(int argc, char **argv) +{ + if (argc < 2) + { + fprintf(stderr, "ERROR: usage bz2 file\n"); + exit(1); + } + + FILE *fp; + fp = fopen(argv[1], "r"); + + if (NULL == fp) + { + fprintf(stderr, "fopen (%s): \n", argv[1]); + exit(1); + } + + BZFILE *bzf; + int bzerror; + bzf = BZ2_bzReadOpen(&bzerror, fp, 0, 0, NULL, 0); + + if (BZ_OK != bzerror) + { + fprintf(stderr, "bzReadOpen (%s): %d\n", argv[1], bzerror); + exit(1); + } + + char buf[BUFSIZ]; + int bzRead_r; + bzRead_r = BZ2_bzRead(&bzerror, bzf, buf, BUFSIZ); + + switch (bzerror) + { + case BZ_OK: + case BZ_STREAM_END: + printf("%4d/%4d: %.*s\n", bzRead_r, BUFSIZ, bzRead_r, buf); + break; + default: + fprintf(stderr, "bzRead (%s): %d\n", argv[1], bzerror); + exit(1); + } + + BZ2_bzReadClose(&bzerror, bzf); + + if (BZ_OK != bzerror) + { + fprintf(stderr, "bzReadClose (%s): %d\n", argv[1], bzerror); + exit(1); + } + + return 0; +} \ No newline at end of file diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/conda_build_config.yaml b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/conda_build_config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f005c036e10c25c8955cc82d491c6b90753688a4 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/conda_build_config.yaml @@ -0,0 +1,101 @@ +VERBOSE_AT: V=1 +VERBOSE_CM: VERBOSE=1 +apr: 1.6.3 +blas_impl: mkl +boost: '1.82' +boost_cpp: '1.82' +bzip2: '1.0' +c_compiler: gcc +c_compiler_version: 11.2.0 +cairo: '1.16' +channel_targets: defaults +clang_variant: clang +cpu_optimization_target: nocona +cran_mirror: https://mran.microsoft.com/snapshot/2018-01-01 +cxx_compiler: gxx +cxx_compiler_version: 11.2.0 +cyrus_sasl: 2.1.28 +dbus: '1' +expat: '2' +extend_keys: +- ignore_version +- pin_run_as_build +- extend_keys +- ignore_build_only_deps +fontconfig: '2.14' +fortran_compiler: gfortran +fortran_compiler_version: 11.2.0 +freetype: '2.10' +g2clib: '1.6' +geos: 3.8.0 +giflib: '5' +glib: '2' +gmp: '6.1' +gnu: 2.12.2 +gst_plugins_base: '1.14' +gstreamer: '1.14' +harfbuzz: 4.3.0 +hdf4: '4.2' +hdf5: 1.12.1 +hdfeos2: '2.20' +hdfeos5: '5.1' +icu: '73' +ignore_build_only_deps: +- python +- numpy +jpeg: '9' +libcurl: 8.1.1 +libdap4: '3.19' +libffi: '3.4' +libgd: 2.3.3 +libgdal: 3.6.2 +libgsasl: '1.10' +libkml: '1.3' +libnetcdf: '4.8' +libpng: '1.6' +libprotobuf: 3.20.3 +libtiff: '4.2' +libwebp: 1.3.2 +libxml2: '2.10' +libxslt: '1.1' +llvm_variant: llvm +lua: '5' +lzo: '2' +mkl: 2023.* +mpfr: '4' +numpy: '1.26' +openblas: 0.3.21 +openjpeg: '2.3' +openssl: '3.0' +perl: '5.34' +pin_run_as_build: + python: + max_pin: x.x + min_pin: x.x + r-base: + max_pin: x.x + min_pin: x.x + libboost: + max_pin: x.x.x +pixman: '0.40' +proj: 9.3.1 +proj4: 5.2.0 +python: '3.12' +python_impl: cpython +python_implementation: cpython +r_base: '3.5' +r_implementation: mro-base +r_version: 3.5.0 +readline: '8.0' +rust_compiler: rust +rust_compiler_version: 1.71.1 +serf: 1.3.9 +sqlite: '3' +target_platform: linux-64 +tk: '8.6' +xz: '5' +zip_keys: +- - python + - numpy +zlib: '1.2' +zstd: 1.5.2 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/meta.yaml b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..66d9a7b63bb48fdab42451096ae2e2606d98ce0c --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/meta.yaml @@ -0,0 +1,90 @@ +# This file created by conda-build 24.1.2 +# meta.yaml template originally from: +# /feedstock/recipe, last modified Tue Apr 30 20:55:40 2024 +# ------------------------------------------------ + +package: + name: bzip2 + version: 1.0.8 +source: + patches: + - 0001-cross.patch + sha256: ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 + url: https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz +build: + number: '6' + run_exports: + - bzip2 >=1.0.8,<2.0a0 + string: h5eee18b_6 +requirements: + build: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - _sysroot_linux-64_curr_repodata_hack 3 haa98f57_10 + - binutils_impl_linux-64 2.38 h2a08ee3_1 + - binutils_linux-64 2.38.0 hc2dff05_0 + - gcc_impl_linux-64 11.2.0 h1234567_1 + - gcc_linux-64 11.2.0 h5c386dc_0 + - kernel-headers_linux-64 3.10.0 h57e8cba_10 + - ld_impl_linux-64 2.38 h1181459_1 + - libgcc-devel_linux-64 11.2.0 h1234567_1 + - libgcc-ng 11.2.0 h1234567_1 + - libgomp 11.2.0 h1234567_1 + - libstdcxx-ng 11.2.0 h1234567_1 + - make 4.2.1 h1bed415_1 + - patch 2.7.6 h7b6447c_1001 + - sysroot_linux-64 2.17 h57e8cba_10 + host: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - libgcc-ng 11.2.0 h1234567_1 + - libgomp 11.2.0 h1234567_1 + run: + - libgcc-ng >=11.2.0 +test: + commands: + - bzip2 --help + - test -f ${PREFIX}/bin/bunzip2 + - test -f ${PREFIX}/bin/bzcat + - test -f ${PREFIX}/bin/bzcmp + - test -f ${PREFIX}/bin/bzdiff + - test -f ${PREFIX}/bin/bzegrep + - test -f ${PREFIX}/bin/bzfgrep + - test -f ${PREFIX}/bin/bzgrep + - test -f ${PREFIX}/bin/bzip2recover + - test -f ${PREFIX}/bin/bzip2 + - test -f ${PREFIX}/bin/bzless + - test -f ${PREFIX}/bin/bzmore + - test -f ${PREFIX}/include/bzlib.h + - test -f ${PREFIX}/lib/libbz2.a + - test -f ${PREFIX}/lib/libbz2${SHLIB_EXT} +about: + description: 'Bzip2 is a freely available high-quality data compressor. It typically + + compresses files to within 10% to 15% of the best available techniques, + + whilst being around twice as fast at compression and six times faster + + at decompression. + + ' + dev_url: https://sourceware.org/git/?p=bzip2.git + doc_url: https://sourceware.org/bzip2/docs.html + home: https://sourceware.org/bzip2/ + license: bzip2-1.0.8 + license_family: BSD + license_file: LICENSE + summary: high-quality data compressor +extra: + copy_test_source_files: true + final: true + flow_run_id: d98ea40d-0d6e-431e-a29d-65b4841389b5 + recipe-maintainers: + - jakirkham + - jjhelmus + - jlanga + - mingwandroid + - msarahan + - pelson + remote_url: git@github.com:AnacondaRecipes/bzip2-feedstock.git + sha: de4f0e44ad8e6cffffb605bc99e429bcaee425b7 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/meta.yaml.template b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/meta.yaml.template new file mode 100644 index 0000000000000000000000000000000000000000..54091344f48dbd5b6ee3d35e518a9c249f92e317 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/meta.yaml.template @@ -0,0 +1,80 @@ +{% set name = "bzip2" %} +{% set version = "1.0.8" %} + +package: + name: {{ name }} + version: {{ version }} + +source: + url: https://sourceware.org/pub/{{ name }}/{{ name }}-{{ version }}.tar.gz + sha256: ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 + patches: + - 0001-cross.patch # [not win] + # 2024/2/23: build_dll.patch might not be required in future versions. + # Check it before building the next release. + - build_dll.patch # [win] + +build: + number: 6 + run_exports: + - {{ pin_subpackage('bzip2') }} + +requirements: + build: + - {{ compiler('c') }} + - m2-patch # [win] + - patch # [not win] + - make # [unix] + +test: + files: # [win] + - bz2.c # [win] + requires: # [win] + - {{ compiler('c') }} # [win] + commands: + - bzip2 --help + {% set bzip2_executables = [ + "bunzip2", + "bzcat", + "bzcmp", + "bzdiff", + "bzegrep", + "bzfgrep", + "bzgrep", + "bzip2recover", + "bzip2", + "bzless", + "bzmore" + ] %} + {% for executable in bzip2_executables %} + - test -f ${PREFIX}/bin/{{ executable }} # [unix] + {% endfor %} + - test -f ${PREFIX}/include/bzlib.h # [unix] + - test -f ${PREFIX}/lib/libbz2.a # [unix] + - test -f ${PREFIX}/lib/libbz2${SHLIB_EXT} # [unix] + +about: + home: https://sourceware.org/bzip2/ + license_family: BSD + license_file: LICENSE + # Important that the SPDX License List (https://spdx.org/licenses/) doesn't have the license name `bzip2-1.0.8` because only `bzip2-1.0.6` exists but it's incorrect. + # The real name must be `bzip2-1.0.8`, + # see the upstream LICENSE file https://sourceware.org/git/?p=bzip2.git;a=blob;f=LICENSE;h=81a37eab7a5be1a34456f38adb74928cc9073e9b;hb=9de658d248f9fd304afa3321dd7a9de1280356ec#l40 + license: bzip2-1.0.8 + summary: high-quality data compressor + description: | + Bzip2 is a freely available high-quality data compressor. It typically + compresses files to within 10% to 15% of the best available techniques, + whilst being around twice as fast at compression and six times faster + at decompression. + doc_url: https://sourceware.org/bzip2/docs.html + dev_url: https://sourceware.org/git/?p=bzip2.git + +extra: + recipe-maintainers: + - jakirkham + - jjhelmus + - pelson + - jlanga + - mingwandroid + - msarahan diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/run_test.bat b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/run_test.bat new file mode 100644 index 0000000000000000000000000000000000000000..d630e0afc7cc4afcfa298c0199ed1575b6a72868 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/recipe/run_test.bat @@ -0,0 +1,35 @@ +@echo on + +if not exist %LIBRARY_INC%\bzlib.h exit 1 +if not exist %LIBRARY_LIB%\bzip2.lib exit 1 +if not exist %LIBRARY_BIN%\bzip2.dll exit 1 +if not exist %LIBRARY_LIB%\libbz2.lib exit 1 +if not exist %LIBRARY_LIB%\libbz2.exp exit 1 +if not exist %LIBRARY_LIB%\libbz2.def exit 1 +if not exist %LIBRARY_BIN%\libbz2.dll exit 1 +if not exist %LIBRARY_LIB%\bzip2_static.lib exit 1 +if not exist %LIBRARY_LIB%\libbz2_static.lib exit 1 +if not exist %LIBRARY_BIN%\bzip2.exe exit 1 +if not exist %LIBRARY_BIN%\bzip2recover.exe exit 1 + +echo "hello world" >foo +REM Compress a file +bzip2.exe -zv foo +if errorlevel 1 exit /B 1 + +REM Decompress the file +bzip2.exe -dc foo.bz2 +if errorlevel 1 exit /B 1 + +REM Compile bz2.c with the import library and /MD option, +REM see https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170#remarks +%CC% /MD /Febz2 bz2.c /I%PREFIX%\Library\include\ /link /LIBPATH:"%PREFIX%\Library\lib" libbz2.lib +if errorlevel 1 exit /B 1 + +:: Uncomment for the debugging purposes only to check the dynamic libraries +::ldd bz2.exe +::if errorlevel 1 exit /B 1 + +REM Decompress the file by a compiled executable +bz2 foo.bz2 +if errorlevel 1 exit /B 1 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/repodata_record.json b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/repodata_record.json new file mode 100644 index 0000000000000000000000000000000000000000..719d6e123fe68c80eba88dc20d6e9e329c5054bf --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/repodata_record.json @@ -0,0 +1,22 @@ +{ + "arch": "x86_64", + "build": "h5eee18b_6", + "build_number": 6, + "channel": "https://repo.anaconda.com/pkgs/main/linux-64/", + "constrains": [], + "depends": [ + "libgcc-ng >=11.2.0" + ], + "fn": "bzip2-1.0.8-h5eee18b_6.conda", + "license": "bzip2-1.0.8", + "license_family": "BSD", + "md5": "f21a3ff51c1b271977f53ce956a69297", + "name": "bzip2", + "platform": "linux", + "sha256": "235f266d5f9c3c61748bb1af0eff21bc7ed2a2a356b97ff28d9c1135039b08b0", + "size": 268384, + "subdir": "linux-64", + "timestamp": 1714510571000, + "url": "https://repo.anaconda.com/pkgs/main/linux-64/bzip2-1.0.8-h5eee18b_6.conda", + "version": "1.0.8" +} \ No newline at end of file diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/run_exports.json b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/run_exports.json new file mode 100644 index 0000000000000000000000000000000000000000..5f5b96c234ef5d6317d2aba24695d17803ecca2a --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/run_exports.json @@ -0,0 +1 @@ +{"weak": ["bzip2 >=1.0.8,<2.0a0"]} \ No newline at end of file diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/test/run_test.sh b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/test/run_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..8b5bc1ace58c8d68b95c27417e346fec5023fc28 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/info/test/run_test.sh @@ -0,0 +1,22 @@ + + +set -ex + + + +bzip2 --help +test -f ${PREFIX}/bin/bunzip2 +test -f ${PREFIX}/bin/bzcat +test -f ${PREFIX}/bin/bzcmp +test -f ${PREFIX}/bin/bzdiff +test -f ${PREFIX}/bin/bzegrep +test -f ${PREFIX}/bin/bzfgrep +test -f ${PREFIX}/bin/bzgrep +test -f ${PREFIX}/bin/bzip2recover +test -f ${PREFIX}/bin/bzip2 +test -f ${PREFIX}/bin/bzless +test -f ${PREFIX}/bin/bzmore +test -f ${PREFIX}/include/bzlib.h +test -f ${PREFIX}/lib/libbz2.a +test -f ${PREFIX}/lib/libbz2${SHLIB_EXT} +exit 0 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzcmp.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzcmp.1 new file mode 100644 index 0000000000000000000000000000000000000000..2ba7e12e201289270ebfa24ff05319546d9acccd --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzcmp.1 @@ -0,0 +1 @@ +.so man1/bzdiff.1 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzdiff.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzdiff.1 new file mode 100644 index 0000000000000000000000000000000000000000..adb7a8e724ef28af51c53562132e7fdb2a433fba --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzdiff.1 @@ -0,0 +1,47 @@ +\"Shamelessly copied from zmore.1 by Philippe Troin +\"for Debian GNU/Linux +.TH BZDIFF 1 +.SH NAME +bzcmp, bzdiff \- compare bzip2 compressed files +.SH SYNOPSIS +.B bzcmp +[ cmp_options ] file1 +[ file2 ] +.br +.B bzdiff +[ diff_options ] file1 +[ file2 ] +.SH DESCRIPTION +.I Bzcmp +and +.I bzdiff +are used to invoke the +.I cmp +or the +.I diff +program on bzip2 compressed files. All options specified are passed +directly to +.I cmp +or +.IR diff "." +If only 1 file is specified, then the files compared are +.I file1 +and an uncompressed +.IR file1 ".bz2." +If two files are specified, then they are uncompressed if necessary and fed to +.I cmp +or +.IR diff "." +The exit status from +.I cmp +or +.I diff +is preserved. +.SH "SEE ALSO" +cmp(1), diff(1), bzmore(1), bzless(1), bzgrep(1), bzip2(1) +.SH BUGS +Messages from the +.I cmp +or +.I diff +programs refer to temporary filenames instead of those specified. diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzegrep.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzegrep.1 new file mode 100644 index 0000000000000000000000000000000000000000..b208cf5aec12ae399a3b00a8a94228171186f070 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzegrep.1 @@ -0,0 +1 @@ +.so man1/bzgrep.1 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzfgrep.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzfgrep.1 new file mode 100644 index 0000000000000000000000000000000000000000..b208cf5aec12ae399a3b00a8a94228171186f070 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzfgrep.1 @@ -0,0 +1 @@ +.so man1/bzgrep.1 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzgrep.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzgrep.1 new file mode 100644 index 0000000000000000000000000000000000000000..930af8c7fcb8205c91befbc33f0ef99cd85f6e1a --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzgrep.1 @@ -0,0 +1,56 @@ +\"Shamelessly copied from zmore.1 by Philippe Troin +\"for Debian GNU/Linux +.TH BZGREP 1 +.SH NAME +bzgrep, bzfgrep, bzegrep \- search possibly bzip2 compressed files for a regular expression +.SH SYNOPSIS +.B bzgrep +[ grep_options ] +.BI [\ -e\ ] " pattern" +.IR filename ".\|.\|." +.br +.B bzegrep +[ egrep_options ] +.BI [\ -e\ ] " pattern" +.IR filename ".\|.\|." +.br +.B bzfgrep +[ fgrep_options ] +.BI [\ -e\ ] " pattern" +.IR filename ".\|.\|." +.SH DESCRIPTION +.IR Bzgrep +is used to invoke the +.I grep +on bzip2-compressed files. All options specified are passed directly to +.I grep. +If no file is specified, then the standard input is decompressed +if necessary and fed to grep. +Otherwise the given files are uncompressed if necessary and fed to +.I grep. +.PP +If +.I bzgrep +is invoked as +.I bzegrep +or +.I bzfgrep +then +.I egrep +or +.I fgrep +is used instead of +.I grep. +If the GREP environment variable is set, +.I bzgrep +uses it as the +.I grep +program to be invoked. For example: + + for sh: GREP=fgrep bzgrep string files + for csh: (setenv GREP fgrep; bzgrep string files) +.SH AUTHOR +Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe +Troin for Debian GNU/Linux. +.SH "SEE ALSO" +grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1) diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzip2.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzip2.1 new file mode 100644 index 0000000000000000000000000000000000000000..0cbcdab00ed82151a5b06951c837692785184082 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzip2.1 @@ -0,0 +1,454 @@ +.PU +.TH bzip2 1 +.SH NAME +bzip2, bunzip2 \- a block-sorting file compressor, v1.0.8 +.br +bzcat \- decompresses files to stdout +.br +bzip2recover \- recovers data from damaged bzip2 files + +.SH SYNOPSIS +.ll +8 +.B bzip2 +.RB [ " \-cdfkqstvzVL123456789 " ] +[ +.I "filenames \&..." +] +.ll -8 +.br +.B bunzip2 +.RB [ " \-fkvsVL " ] +[ +.I "filenames \&..." +] +.br +.B bzcat +.RB [ " \-s " ] +[ +.I "filenames \&..." +] +.br +.B bzip2recover +.I "filename" + +.SH DESCRIPTION +.I bzip2 +compresses files using the Burrows-Wheeler block sorting +text compression algorithm, and Huffman coding. Compression is +generally considerably better than that achieved by more conventional +LZ77/LZ78-based compressors, and approaches the performance of the PPM +family of statistical compressors. + +The command-line options are deliberately very similar to +those of +.I GNU gzip, +but they are not identical. + +.I bzip2 +expects a list of file names to accompany the +command-line flags. Each file is replaced by a compressed version of +itself, with the name "original_name.bz2". +Each compressed file +has the same modification date, permissions, and, when possible, +ownership as the corresponding original, so that these properties can +be correctly restored at decompression time. File name handling is +naive in the sense that there is no mechanism for preserving original +file names, permissions, ownerships or dates in filesystems which lack +these concepts, or have serious file name length restrictions, such as +MS-DOS. + +.I bzip2 +and +.I bunzip2 +will by default not overwrite existing +files. If you want this to happen, specify the \-f flag. + +If no file names are specified, +.I bzip2 +compresses from standard +input to standard output. In this case, +.I bzip2 +will decline to +write compressed output to a terminal, as this would be entirely +incomprehensible and therefore pointless. + +.I bunzip2 +(or +.I bzip2 \-d) +decompresses all +specified files. Files which were not created by +.I bzip2 +will be detected and ignored, and a warning issued. +.I bzip2 +attempts to guess the filename for the decompressed file +from that of the compressed file as follows: + + filename.bz2 becomes filename + filename.bz becomes filename + filename.tbz2 becomes filename.tar + filename.tbz becomes filename.tar + anyothername becomes anyothername.out + +If the file does not end in one of the recognised endings, +.I .bz2, +.I .bz, +.I .tbz2 +or +.I .tbz, +.I bzip2 +complains that it cannot +guess the name of the original file, and uses the original name +with +.I .out +appended. + +As with compression, supplying no +filenames causes decompression from +standard input to standard output. + +.I bunzip2 +will correctly decompress a file which is the +concatenation of two or more compressed files. The result is the +concatenation of the corresponding uncompressed files. Integrity +testing (\-t) +of concatenated +compressed files is also supported. + +You can also compress or decompress files to the standard output by +giving the \-c flag. Multiple files may be compressed and +decompressed like this. The resulting outputs are fed sequentially to +stdout. Compression of multiple files +in this manner generates a stream +containing multiple compressed file representations. Such a stream +can be decompressed correctly only by +.I bzip2 +version 0.9.0 or +later. Earlier versions of +.I bzip2 +will stop after decompressing +the first file in the stream. + +.I bzcat +(or +.I bzip2 -dc) +decompresses all specified files to +the standard output. + +.I bzip2 +will read arguments from the environment variables +.I BZIP2 +and +.I BZIP, +in that order, and will process them +before any arguments read from the command line. This gives a +convenient way to supply default arguments. + +Compression is always performed, even if the compressed +file is slightly +larger than the original. Files of less than about one hundred bytes +tend to get larger, since the compression mechanism has a constant +overhead in the region of 50 bytes. Random data (including the output +of most file compressors) is coded at about 8.05 bits per byte, giving +an expansion of around 0.5%. + +As a self-check for your protection, +.I +bzip2 +uses 32-bit CRCs to +make sure that the decompressed version of a file is identical to the +original. This guards against corruption of the compressed data, and +against undetected bugs in +.I bzip2 +(hopefully very unlikely). The +chances of data corruption going undetected is microscopic, about one +chance in four billion for each file processed. Be aware, though, that +the check occurs upon decompression, so it can only tell you that +something is wrong. It can't help you +recover the original uncompressed +data. You can use +.I bzip2recover +to try to recover data from +damaged files. + +Return values: 0 for a normal exit, 1 for environmental problems (file +not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt +compressed file, 3 for an internal consistency error (eg, bug) which +caused +.I bzip2 +to panic. + +.SH OPTIONS +.TP +.B \-c --stdout +Compress or decompress to standard output. +.TP +.B \-d --decompress +Force decompression. +.I bzip2, +.I bunzip2 +and +.I bzcat +are +really the same program, and the decision about what actions to take is +done on the basis of which name is used. This flag overrides that +mechanism, and forces +.I bzip2 +to decompress. +.TP +.B \-z --compress +The complement to \-d: forces compression, regardless of the +invocation name. +.TP +.B \-t --test +Check integrity of the specified file(s), but don't decompress them. +This really performs a trial decompression and throws away the result. +.TP +.B \-f --force +Force overwrite of output files. Normally, +.I bzip2 +will not overwrite +existing output files. Also forces +.I bzip2 +to break hard links +to files, which it otherwise wouldn't do. + +bzip2 normally declines to decompress files which don't have the +correct magic header bytes. If forced (-f), however, it will pass +such files through unmodified. This is how GNU gzip behaves. +.TP +.B \-k --keep +Keep (don't delete) input files during compression +or decompression. +.TP +.B \-s --small +Reduce memory usage, for compression, decompression and testing. Files +are decompressed and tested using a modified algorithm which only +requires 2.5 bytes per block byte. This means any file can be +decompressed in 2300k of memory, albeit at about half the normal speed. + +During compression, \-s selects a block size of 200k, which limits +memory use to around the same figure, at the expense of your compression +ratio. In short, if your machine is low on memory (8 megabytes or +less), use \-s for everything. See MEMORY MANAGEMENT below. +.TP +.B \-q --quiet +Suppress non-essential warning messages. Messages pertaining to +I/O errors and other critical events will not be suppressed. +.TP +.B \-v --verbose +Verbose mode -- show the compression ratio for each file processed. +Further \-v's increase the verbosity level, spewing out lots of +information which is primarily of interest for diagnostic purposes. +.TP +.B \-L --license -V --version +Display the software version, license terms and conditions. +.TP +.B \-1 (or \-\-fast) to \-9 (or \-\-best) +Set the block size to 100 k, 200 k .. 900 k when compressing. Has no +effect when decompressing. See MEMORY MANAGEMENT below. +The \-\-fast and \-\-best aliases are primarily for GNU gzip +compatibility. In particular, \-\-fast doesn't make things +significantly faster. +And \-\-best merely selects the default behaviour. +.TP +.B \-- +Treats all subsequent arguments as file names, even if they start +with a dash. This is so you can handle files with names beginning +with a dash, for example: bzip2 \-- \-myfilename. +.TP +.B \--repetitive-fast --repetitive-best +These flags are redundant in versions 0.9.5 and above. They provided +some coarse control over the behaviour of the sorting algorithm in +earlier versions, which was sometimes useful. 0.9.5 and above have an +improved algorithm which renders these flags irrelevant. + +.SH MEMORY MANAGEMENT +.I bzip2 +compresses large files in blocks. The block size affects +both the compression ratio achieved, and the amount of memory needed for +compression and decompression. The flags \-1 through \-9 +specify the block size to be 100,000 bytes through 900,000 bytes (the +default) respectively. At decompression time, the block size used for +compression is read from the header of the compressed file, and +.I bunzip2 +then allocates itself just enough memory to decompress +the file. Since block sizes are stored in compressed files, it follows +that the flags \-1 to \-9 are irrelevant to and so ignored +during decompression. + +Compression and decompression requirements, +in bytes, can be estimated as: + + Compression: 400k + ( 8 x block size ) + + Decompression: 100k + ( 4 x block size ), or + 100k + ( 2.5 x block size ) + +Larger block sizes give rapidly diminishing marginal returns. Most of +the compression comes from the first two or three hundred k of block +size, a fact worth bearing in mind when using +.I bzip2 +on small machines. +It is also important to appreciate that the decompression memory +requirement is set at compression time by the choice of block size. + +For files compressed with the default 900k block size, +.I bunzip2 +will require about 3700 kbytes to decompress. To support decompression +of any file on a 4 megabyte machine, +.I bunzip2 +has an option to +decompress using approximately half this amount of memory, about 2300 +kbytes. Decompression speed is also halved, so you should use this +option only where necessary. The relevant flag is -s. + +In general, try and use the largest block size memory constraints allow, +since that maximises the compression achieved. Compression and +decompression speed are virtually unaffected by block size. + +Another significant point applies to files which fit in a single block +-- that means most files you'd encounter using a large block size. The +amount of real memory touched is proportional to the size of the file, +since the file is smaller than a block. For example, compressing a file +20,000 bytes long with the flag -9 will cause the compressor to +allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560 +kbytes of it. Similarly, the decompressor will allocate 3700k but only +touch 100k + 20000 * 4 = 180 kbytes. + +Here is a table which summarises the maximum memory usage for different +block sizes. Also recorded is the total compressed size for 14 files of +the Calgary Text Compression Corpus totalling 3,141,622 bytes. This +column gives some feel for how compression varies with block size. +These figures tend to understate the advantage of larger block sizes for +larger files, since the Corpus is dominated by smaller files. + + Compress Decompress Decompress Corpus + Flag usage usage -s usage Size + + -1 1200k 500k 350k 914704 + -2 2000k 900k 600k 877703 + -3 2800k 1300k 850k 860338 + -4 3600k 1700k 1100k 846899 + -5 4400k 2100k 1350k 845160 + -6 5200k 2500k 1600k 838626 + -7 6100k 2900k 1850k 834096 + -8 6800k 3300k 2100k 828642 + -9 7600k 3700k 2350k 828642 + +.SH RECOVERING DATA FROM DAMAGED FILES +.I bzip2 +compresses files in blocks, usually 900kbytes long. Each +block is handled independently. If a media or transmission error causes +a multi-block .bz2 +file to become damaged, it may be possible to +recover data from the undamaged blocks in the file. + +The compressed representation of each block is delimited by a 48-bit +pattern, which makes it possible to find the block boundaries with +reasonable certainty. Each block also carries its own 32-bit CRC, so +damaged blocks can be distinguished from undamaged ones. + +.I bzip2recover +is a simple program whose purpose is to search for +blocks in .bz2 files, and write each block out into its own .bz2 +file. You can then use +.I bzip2 +\-t +to test the +integrity of the resulting files, and decompress those which are +undamaged. + +.I bzip2recover +takes a single argument, the name of the damaged file, +and writes a number of files "rec00001file.bz2", +"rec00002file.bz2", etc, containing the extracted blocks. +The output filenames are designed so that the use of +wildcards in subsequent processing -- for example, +"bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in +the correct order. + +.I bzip2recover +should be of most use dealing with large .bz2 +files, as these will contain many blocks. It is clearly +futile to use it on damaged single-block files, since a +damaged block cannot be recovered. If you wish to minimise +any potential data loss through media or transmission errors, +you might consider compressing with a smaller +block size. + +.SH PERFORMANCE NOTES +The sorting phase of compression gathers together similar strings in the +file. Because of this, files containing very long runs of repeated +symbols, like "aabaabaabaab ..." (repeated several hundred times) may +compress more slowly than normal. Versions 0.9.5 and above fare much +better than previous versions in this respect. The ratio between +worst-case and average-case compression time is in the region of 10:1. +For previous versions, this figure was more like 100:1. You can use the +\-vvvv option to monitor progress in great detail, if you want. + +Decompression speed is unaffected by these phenomena. + +.I bzip2 +usually allocates several megabytes of memory to operate +in, and then charges all over it in a fairly random fashion. This means +that performance, both for compressing and decompressing, is largely +determined by the speed at which your machine can service cache misses. +Because of this, small changes to the code to reduce the miss rate have +been observed to give disproportionately large performance improvements. +I imagine +.I bzip2 +will perform best on machines with very large caches. + +.SH CAVEATS +I/O error messages are not as helpful as they could be. +.I bzip2 +tries hard to detect I/O errors and exit cleanly, but the details of +what the problem is sometimes seem rather misleading. + +This manual page pertains to version 1.0.8 of +.I bzip2. +Compressed data created by this version is entirely forwards and +backwards compatible with the previous public releases, versions +0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the following +exception: 0.9.0 and above can correctly decompress multiple +concatenated compressed files. 0.1pl2 cannot do this; it will stop +after decompressing just the first file in the stream. + +.I bzip2recover +versions prior to 1.0.2 used 32-bit integers to represent +bit positions in compressed files, so they could not handle compressed +files more than 512 megabytes long. Versions 1.0.2 and above use +64-bit ints on some platforms which support them (GNU supported +targets, and Windows). To establish whether or not bzip2recover was +built with such a limitation, run it without arguments. In any event +you can build yourself an unlimited version if you can recompile it +with MaybeUInt64 set to be an unsigned 64-bit integer. + + + +.SH AUTHOR +Julian Seward, jseward@acm.org. + +https://sourceware.org/bzip2/ + +The ideas embodied in +.I bzip2 +are due to (at least) the following +people: Michael Burrows and David Wheeler (for the block sorting +transformation), David Wheeler (again, for the Huffman coder), Peter +Fenwick (for the structured coding model in the original +.I bzip, +and many refinements), and Alistair Moffat, Radford Neal and Ian Witten +(for the arithmetic coder in the original +.I bzip). +I am much +indebted for their help, support and advice. See the manual in the +source distribution for pointers to sources of documentation. Christian +von Roques encouraged me to look for faster sorting algorithms, so as to +speed up compression. Bela Lubkin encouraged me to improve the +worst-case compression performance. +Donna Robinson XMLised the documentation. +The bz* scripts are derived from those of GNU gzip. +Many people sent patches, helped +with portability problems, lent machines, gave advice and were generally +helpful. diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzless.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzless.1 new file mode 100644 index 0000000000000000000000000000000000000000..b849965938bed4048b65f842a3dc7f69770e66a3 --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzless.1 @@ -0,0 +1 @@ +.so man1/bzmore.1 diff --git a/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzmore.1 b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzmore.1 new file mode 100644 index 0000000000000000000000000000000000000000..b437d3b031f5dc1290359496971d2c2545b188ff --- /dev/null +++ b/miniconda3/pkgs/bzip2-1.0.8-h5eee18b_6/man/man1/bzmore.1 @@ -0,0 +1,152 @@ +.\"Shamelessly copied from zmore.1 by Philippe Troin +.\"for Debian GNU/Linux +.TH BZMORE 1 +.SH NAME +bzmore, bzless \- file perusal filter for crt viewing of bzip2 compressed text +.SH SYNOPSIS +.B bzmore +[ name ... ] +.br +.B bzless +[ name ... ] +.SH NOTE +In the following description, +.I bzless +and +.I less +can be used interchangeably with +.I bzmore +and +.I more. +.SH DESCRIPTION +.I Bzmore +is a filter which allows examination of compressed or plain text files +one screenful at a time on a soft-copy terminal. +.I bzmore +works on files compressed with +.I bzip2 +and also on uncompressed files. +If a file does not exist, +.I bzmore +looks for a file of the same name with the addition of a .bz2 suffix. +.PP +.I Bzmore +normally pauses after each screenful, printing --More-- +at the bottom of the screen. +If the user then types a carriage return, one more line is displayed. +If the user hits a space, +another screenful is displayed. Other possibilities are enumerated later. +.PP +.I Bzmore +looks in the file +.I /etc/termcap +to determine terminal characteristics, +and to determine the default window size. +On a terminal capable of displaying 24 lines, +the default window size is 22 lines. +Other sequences which may be typed when +.I bzmore +pauses, and their effects, are as follows (\fIi\fP is an optional integer +argument, defaulting to 1) : +.PP +.IP \fIi\|\fP +display +.I i +more lines, (or another screenful if no argument is given) +.PP +.IP ^D +display 11 more lines (a ``scroll''). +If +.I i +is given, then the scroll size is set to \fIi\|\fP. +.PP +.IP d +same as ^D (control-D) +.PP +.IP \fIi\|\fPz +same as typing a space except that \fIi\|\fP, if present, becomes the new +window size. Note that the window size reverts back to the default at the +end of the current file. +.PP +.IP \fIi\|\fPs +skip \fIi\|\fP lines and print a screenful of lines +.PP +.IP \fIi\|\fPf +skip \fIi\fP screenfuls and print a screenful of lines +.PP +.IP "q or Q" +quit reading the current file; go on to the next (if any) +.PP +.IP "e or q" +When the prompt --More--(Next file: +.IR file ) +is printed, this command causes bzmore to exit. +.PP +.IP s +When the prompt --More--(Next file: +.IR file ) +is printed, this command causes bzmore to skip the next file and continue. +.PP +.IP = +Display the current line number. +.PP +.IP \fIi\|\fP/expr +search for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP +If the pattern is not found, +.I bzmore +goes on to the next file (if any). +Otherwise, a screenful is displayed, starting two lines before the place +where the expression was found. +The user's erase and kill characters may be used to edit the regular +expression. +Erasing back past the first column cancels the search command. +.PP +.IP \fIi\|\fPn +search for the \fIi\|\fP-th occurrence of the last regular expression entered. +.PP +.IP !command +invoke a shell with \fIcommand\|\fP. +The character `!' in "command" are replaced with the +previous shell command. The sequence "\\!" is replaced by "!". +.PP +.IP ":q or :Q" +quit reading the current file; go on to the next (if any) +(same as q or Q). +.PP +.IP . +(dot) repeat the previous command. +.PP +The commands take effect immediately, i.e., it is not necessary to +type a carriage return. +Up to the time when the command character itself is given, +the user may hit the line kill character to cancel the numerical +argument being formed. +In addition, the user may hit the erase character to redisplay the +--More-- message. +.PP +At any time when output is being sent to the terminal, the user can +hit the quit key (normally control\-\\). +.I Bzmore +will stop sending output, and will display the usual --More-- +prompt. +The user may then enter one of the above commands in the normal manner. +Unfortunately, some output is lost when this is done, due to the +fact that any characters waiting in the terminal's output queue +are flushed when the quit signal occurs. +.PP +The terminal is set to +.I noecho +mode by this program so that the output can be continuous. +What you type will thus not show on your terminal, except for the / and ! +commands. +.PP +If the standard output is not a teletype, then +.I bzmore +acts just like +.I bzcat, +except that a header is printed before each file. +.SH FILES +.DT +/etc/termcap Terminal data base +.SH "SEE ALSO" +more(1), less(1), bzip2(1), bzdiff(1), bzgrep(1) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0.conda b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..61782e3da4521758fb1acb961a59e476e3cf6dc2 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5bdd98c8c2ef2bbe52b0fb018ddda3e62f91b2f96089e66e903052e1e91498e +size 206586 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/bin/adig b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/bin/adig new file mode 100644 index 0000000000000000000000000000000000000000..d1532b4d67ce0d4bed68359e83fb5fef0c055fcb Binary files /dev/null and b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/bin/adig differ diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/bin/ahost b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/bin/ahost new file mode 100644 index 0000000000000000000000000000000000000000..b09d3e1a94546195fcaaa86cb57dcc15ae9b31fc Binary files /dev/null and b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/bin/ahost differ diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares.h b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares.h new file mode 100644 index 0000000000000000000000000000000000000000..7fe3ec78f4e65118a0ac726b4b67705082164f1d --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares.h @@ -0,0 +1,1229 @@ +/* MIT License + * + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ + +#ifndef ARES__H +#define ARES__H + +#include "ares_version.h" /* c-ares version defines */ +#include "ares_build.h" /* c-ares build definitions */ + +#if defined(_WIN32) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +#endif + +#ifdef CARES_HAVE_SYS_TYPES_H +# include +#endif + +#ifdef CARES_HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef CARES_HAVE_SYS_SELECT_H +# include +#endif + +#ifdef CARES_HAVE_WINSOCK2_H +# include +/* To aid with linking against a static c-ares build, lets tell the microsoft + * compiler to pull in needed dependencies */ +# ifdef _MSC_VER +# pragma comment(lib, "ws2_32") +# pragma comment(lib, "advapi32") +# pragma comment(lib, "iphlpapi") +# endif +#endif + +#ifdef CARES_HAVE_WS2TCPIP_H +# include +#endif + +#ifdef CARES_HAVE_WINDOWS_H +# include +#endif + +/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish + libc5-based Linux systems. Only include it on system that are known to + require it! */ +#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ + defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ + defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ + defined(__QNX__) || defined(__MVS__) || defined(__HAIKU__) +# include +#endif + +#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) +# include +#endif + +#if !defined(_WIN32) +# include +#endif + +#ifdef WATT32 +# include +#endif + +#if defined(ANDROID) || defined(__ANDROID__) +# include +#endif + +typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; +typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** c-ares external API function linkage decorations. +*/ + +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__SYMBIAN32__) +# ifdef CARES_STATICLIB +# define CARES_EXTERN +# else +# ifdef CARES_BUILDING_LIBRARY +# define CARES_EXTERN __declspec(dllexport) +# else +# define CARES_EXTERN __declspec(dllimport) +# endif +# endif +#else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define CARES_EXTERN __attribute__((visibility("default"))) +# elif defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 900 +# define CARES_EXTERN __attribute__((visibility("default"))) +# elif defined(__SUNPRO_C) +# define CARES_EXTERN _global +# else +# define CARES_EXTERN +# endif +#endif + +#ifdef __GNUC__ +# define CARES_GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#else +# define CARES_GCC_VERSION 0 +#endif + +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif + +#ifdef CARES_NO_DEPRECATED +# define CARES_DEPRECATED +# define CARES_DEPRECATED_FOR(f) +#else +# if CARES_GCC_VERSION >= 30200 || __has_attribute(__deprecated__) +# define CARES_DEPRECATED __attribute__((__deprecated__)) +# else +# define CARES_DEPRECATED +# endif + +# if CARES_GCC_VERSION >= 40500 || defined(__clang__) +# define CARES_DEPRECATED_FOR(f) \ + __attribute__((deprecated("Use " #f " instead"))) +# elif defined(_MSC_VER) +# define CARES_DEPRECATED_FOR(f) __declspec(deprecated("Use " #f " instead")) +# else +# define CARES_DEPRECATED_FOR(f) CARES_DEPRECATED +# endif +#endif + +typedef enum { + ARES_SUCCESS = 0, + + /* Server error codes (ARES_ENODATA indicates no relevant answer) */ + ARES_ENODATA = 1, + ARES_EFORMERR = 2, + ARES_ESERVFAIL = 3, + ARES_ENOTFOUND = 4, + ARES_ENOTIMP = 5, + ARES_EREFUSED = 6, + + /* Locally generated error codes */ + ARES_EBADQUERY = 7, + ARES_EBADNAME = 8, + ARES_EBADFAMILY = 9, + ARES_EBADRESP = 10, + ARES_ECONNREFUSED = 11, + ARES_ETIMEOUT = 12, + ARES_EOF = 13, + ARES_EFILE = 14, + ARES_ENOMEM = 15, + ARES_EDESTRUCTION = 16, + ARES_EBADSTR = 17, + + /* ares_getnameinfo error codes */ + ARES_EBADFLAGS = 18, + + /* ares_getaddrinfo error codes */ + ARES_ENONAME = 19, + ARES_EBADHINTS = 20, + + /* Uninitialized library error code */ + ARES_ENOTINITIALIZED = 21, /* introduced in 1.7.0 */ + + /* ares_library_init error codes */ + ARES_ELOADIPHLPAPI = 22, /* introduced in 1.7.0 */ + ARES_EADDRGETNETWORKPARAMS = 23, /* introduced in 1.7.0 */ + + /* More error codes */ + ARES_ECANCELLED = 24, /* introduced in 1.7.0 */ + + /* More ares_getaddrinfo error codes */ + ARES_ESERVICE = 25, /* ares_getaddrinfo() was passed a text service name that + * is not recognized. introduced in 1.16.0 */ + + ARES_ENOSERVER = 26 /* No DNS servers were configured */ +} ares_status_t; + +typedef enum { + ARES_FALSE = 0, + ARES_TRUE = 1 +} ares_bool_t; + +/*! Values for ARES_OPT_EVENT_THREAD */ +typedef enum { + /*! Default (best choice) event system */ + ARES_EVSYS_DEFAULT = 0, + /*! Win32 IOCP/AFD_POLL event system */ + ARES_EVSYS_WIN32 = 1, + /*! Linux epoll */ + ARES_EVSYS_EPOLL = 2, + /*! BSD/MacOS kqueue */ + ARES_EVSYS_KQUEUE = 3, + /*! POSIX poll() */ + ARES_EVSYS_POLL = 4, + /*! last fallback on Unix-like systems, select() */ + ARES_EVSYS_SELECT = 5 +} ares_evsys_t; + +/* Flag values */ +#define ARES_FLAG_USEVC (1 << 0) +#define ARES_FLAG_PRIMARY (1 << 1) +#define ARES_FLAG_IGNTC (1 << 2) +#define ARES_FLAG_NORECURSE (1 << 3) +#define ARES_FLAG_STAYOPEN (1 << 4) +#define ARES_FLAG_NOSEARCH (1 << 5) +#define ARES_FLAG_NOALIASES (1 << 6) +#define ARES_FLAG_NOCHECKRESP (1 << 7) +#define ARES_FLAG_EDNS (1 << 8) +#define ARES_FLAG_NO_DFLT_SVR (1 << 9) +#define ARES_FLAG_DNS0x20 (1 << 10) + +/* Option mask values */ +#define ARES_OPT_FLAGS (1 << 0) +#define ARES_OPT_TIMEOUT (1 << 1) +#define ARES_OPT_TRIES (1 << 2) +#define ARES_OPT_NDOTS (1 << 3) +#define ARES_OPT_UDP_PORT (1 << 4) +#define ARES_OPT_TCP_PORT (1 << 5) +#define ARES_OPT_SERVERS (1 << 6) +#define ARES_OPT_DOMAINS (1 << 7) +#define ARES_OPT_LOOKUPS (1 << 8) +#define ARES_OPT_SOCK_STATE_CB (1 << 9) +#define ARES_OPT_SORTLIST (1 << 10) +#define ARES_OPT_SOCK_SNDBUF (1 << 11) +#define ARES_OPT_SOCK_RCVBUF (1 << 12) +#define ARES_OPT_TIMEOUTMS (1 << 13) +#define ARES_OPT_ROTATE (1 << 14) +#define ARES_OPT_EDNSPSZ (1 << 15) +#define ARES_OPT_NOROTATE (1 << 16) +#define ARES_OPT_RESOLVCONF (1 << 17) +#define ARES_OPT_HOSTS_FILE (1 << 18) +#define ARES_OPT_UDP_MAX_QUERIES (1 << 19) +#define ARES_OPT_MAXTIMEOUTMS (1 << 20) +#define ARES_OPT_QUERY_CACHE (1 << 21) +#define ARES_OPT_EVENT_THREAD (1 << 22) +#define ARES_OPT_SERVER_FAILOVER (1 << 23) + +/* Nameinfo flag values */ +#define ARES_NI_NOFQDN (1 << 0) +#define ARES_NI_NUMERICHOST (1 << 1) +#define ARES_NI_NAMEREQD (1 << 2) +#define ARES_NI_NUMERICSERV (1 << 3) +#define ARES_NI_DGRAM (1 << 4) +#define ARES_NI_TCP 0 +#define ARES_NI_UDP ARES_NI_DGRAM +#define ARES_NI_SCTP (1 << 5) +#define ARES_NI_DCCP (1 << 6) +#define ARES_NI_NUMERICSCOPE (1 << 7) +#define ARES_NI_LOOKUPHOST (1 << 8) +#define ARES_NI_LOOKUPSERVICE (1 << 9) +/* Reserved for future use */ +#define ARES_NI_IDN (1 << 10) +#define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11) +#define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12) + +/* Addrinfo flag values */ +#define ARES_AI_CANONNAME (1 << 0) +#define ARES_AI_NUMERICHOST (1 << 1) +#define ARES_AI_PASSIVE (1 << 2) +#define ARES_AI_NUMERICSERV (1 << 3) +#define ARES_AI_V4MAPPED (1 << 4) +#define ARES_AI_ALL (1 << 5) +#define ARES_AI_ADDRCONFIG (1 << 6) +#define ARES_AI_NOSORT (1 << 7) +#define ARES_AI_ENVHOSTS (1 << 8) +/* Reserved for future use */ +#define ARES_AI_IDN (1 << 10) +#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11) +#define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12) +#define ARES_AI_CANONIDN (1 << 13) + +#define ARES_AI_MASK \ + (ARES_AI_CANONNAME | ARES_AI_NUMERICHOST | ARES_AI_PASSIVE | \ + ARES_AI_NUMERICSERV | ARES_AI_V4MAPPED | ARES_AI_ALL | ARES_AI_ADDRCONFIG) +#define ARES_GETSOCK_MAXNUM \ + 16 /* ares_getsock() can return info about this \ + many sockets */ +#define ARES_GETSOCK_READABLE(bits, num) (bits & (1 << (num))) +#define ARES_GETSOCK_WRITABLE(bits, num) \ + (bits & (1 << ((num) + ARES_GETSOCK_MAXNUM))) + +/* c-ares library initialization flag values */ +#define ARES_LIB_INIT_NONE (0) +#define ARES_LIB_INIT_WIN32 (1 << 0) +#define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32) + +/* Server state callback flag values */ +#define ARES_SERV_STATE_UDP (1 << 0) /* Query used UDP */ +#define ARES_SERV_STATE_TCP (1 << 1) /* Query used TCP */ + +/* + * Typedef our socket type + */ + +#ifndef ares_socket_typedef +# if defined(_WIN32) && !defined(WATT32) +typedef SOCKET ares_socket_t; +# define ARES_SOCKET_BAD INVALID_SOCKET +# else +typedef int ares_socket_t; +# define ARES_SOCKET_BAD -1 +# endif +# define ares_socket_typedef +#endif /* ares_socket_typedef */ + +typedef void (*ares_sock_state_cb)(void *data, ares_socket_t socket_fd, + int readable, int writable); + +struct apattern; + +/* Options controlling server failover behavior. + * The retry chance is the probability (1/N) by which we will retry a failed + * server instead of the best server when selecting a server to send queries + * to. + * The retry delay is the minimum time in milliseconds to wait between doing + * such retries (applied per-server). + */ +struct ares_server_failover_options { + unsigned short retry_chance; + size_t retry_delay; +}; + +/* NOTE about the ares_options struct to users and developers. + + This struct will remain looking like this. It will not be extended nor + shrunk in future releases, but all new options will be set by ares_set_*() + options instead of with the ares_init_options() function. + + Eventually (in a galaxy far far away), all options will be settable by + ares_set_*() options and the ares_init_options() function will become + deprecated. + + When new options are added to c-ares, they are not added to this + struct. And they are not "saved" with the ares_save_options() function but + instead we encourage the use of the ares_dup() function. Needless to say, + if you add config options to c-ares you need to make sure ares_dup() + duplicates this new option. + + */ +struct ares_options { + int flags; + int timeout; /* in seconds or milliseconds, depending on options */ + int tries; + int ndots; + unsigned short udp_port; /* host byte order */ + unsigned short tcp_port; /* host byte order */ + int socket_send_buffer_size; + int socket_receive_buffer_size; + struct in_addr *servers; + int nservers; + char **domains; + int ndomains; + char *lookups; + ares_sock_state_cb sock_state_cb; + void *sock_state_cb_data; + struct apattern *sortlist; + int nsort; + int ednspsz; + char *resolvconf_path; + char *hosts_path; + int udp_max_queries; + int maxtimeout; /* in milliseconds */ + unsigned int qcache_max_ttl; /* Maximum TTL for query cache, 0=disabled */ + ares_evsys_t evsys; + struct ares_server_failover_options server_failover_opts; +}; + +struct hostent; +struct timeval; +struct sockaddr; +struct ares_channeldata; +struct ares_addrinfo; +struct ares_addrinfo_hints; + +/* Legacy typedef, don't use, you can't specify "const" */ +typedef struct ares_channeldata *ares_channel; + +/* Current main channel typedef */ +typedef struct ares_channeldata ares_channel_t; + +/* + * NOTE: before c-ares 1.7.0 we would most often use the system in6_addr + * struct below when ares itself was built, but many apps would use this + * private version since the header checked a HAVE_* define for it. Starting + * with 1.7.0 we always declare and use our own to stop relying on the + * system's one. + */ +struct ares_in6_addr { + union { + unsigned char _S6_u8[16]; + } _S6_un; +}; + +struct ares_addr { + int family; + + union { + struct in_addr addr4; + struct ares_in6_addr addr6; + } addr; +}; + +/* DNS record parser, writer, and helpers */ +#include "ares_dns_record.h" + +typedef void (*ares_callback)(void *arg, int status, int timeouts, + unsigned char *abuf, int alen); + +typedef void (*ares_callback_dnsrec)(void *arg, ares_status_t status, + size_t timeouts, + const ares_dns_record_t *dnsrec); + +typedef void (*ares_host_callback)(void *arg, int status, int timeouts, + struct hostent *hostent); + +typedef void (*ares_nameinfo_callback)(void *arg, int status, int timeouts, + char *node, char *service); + +typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd, int type, + void *data); + +typedef int (*ares_sock_config_callback)(ares_socket_t socket_fd, int type, + void *data); + +typedef void (*ares_addrinfo_callback)(void *arg, int status, int timeouts, + struct ares_addrinfo *res); + +typedef void (*ares_server_state_callback)(const char *server_string, + ares_bool_t success, int flags, + void *data); + +typedef void (*ares_pending_write_cb)(void *data); + +CARES_EXTERN int ares_library_init(int flags); + +CARES_EXTERN int ares_library_init_mem(int flags, void *(*amalloc)(size_t size), + void (*afree)(void *ptr), + void *(*arealloc)(void *ptr, + size_t size)); + +#if defined(ANDROID) || defined(__ANDROID__) +CARES_EXTERN void ares_library_init_jvm(JavaVM *jvm); +CARES_EXTERN int ares_library_init_android(jobject connectivity_manager); +CARES_EXTERN int ares_library_android_initialized(void); +#endif + +#define CARES_HAVE_ARES_LIBRARY_INIT 1 +#define CARES_HAVE_ARES_LIBRARY_CLEANUP 1 + +CARES_EXTERN int ares_library_initialized(void); + +CARES_EXTERN void ares_library_cleanup(void); + +CARES_EXTERN const char *ares_version(int *version); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_init_options) int ares_init( + ares_channel_t **channelptr); + +CARES_EXTERN int ares_init_options(ares_channel_t **channelptr, + const struct ares_options *options, + int optmask); + +CARES_EXTERN int ares_save_options(const ares_channel_t *channel, + struct ares_options *options, int *optmask); + +CARES_EXTERN void ares_destroy_options(struct ares_options *options); + +CARES_EXTERN int ares_dup(ares_channel_t **dest, const ares_channel_t *src); + +CARES_EXTERN ares_status_t ares_reinit(ares_channel_t *channel); + +CARES_EXTERN void ares_destroy(ares_channel_t *channel); + +CARES_EXTERN void ares_cancel(ares_channel_t *channel); + +/* These next 3 configure local binding for the out-going socket + * connection. Use these to specify source IP and/or network device + * on multi-homed systems. + */ +CARES_EXTERN void ares_set_local_ip4(ares_channel_t *channel, + unsigned int local_ip); + +/* local_ip6 should be 16 bytes in length */ +CARES_EXTERN void ares_set_local_ip6(ares_channel_t *channel, + const unsigned char *local_ip6); + +/* local_dev_name should be null terminated. */ +CARES_EXTERN void ares_set_local_dev(ares_channel_t *channel, + const char *local_dev_name); + +CARES_EXTERN void ares_set_socket_callback(ares_channel_t *channel, + ares_sock_create_callback callback, + void *user_data); + +CARES_EXTERN void ares_set_socket_configure_callback( + ares_channel_t *channel, ares_sock_config_callback callback, void *user_data); + +CARES_EXTERN void + ares_set_server_state_callback(ares_channel_t *channel, + ares_server_state_callback callback, + void *user_data); + +CARES_EXTERN void ares_set_pending_write_cb(ares_channel_t *channel, + ares_pending_write_cb callback, + void *user_data); + +CARES_EXTERN void ares_process_pending_write(ares_channel_t *channel); + +CARES_EXTERN int ares_set_sortlist(ares_channel_t *channel, + const char *sortstr); + +CARES_EXTERN void ares_getaddrinfo(ares_channel_t *channel, const char *node, + const char *service, + const struct ares_addrinfo_hints *hints, + ares_addrinfo_callback callback, void *arg); + +CARES_EXTERN void ares_freeaddrinfo(struct ares_addrinfo *ai); + +/* + * Virtual function set to have user-managed socket IO. + * Note that all functions need to be defined, and when + * set, the library will not do any bind nor set any + * socket options, assuming the client handles these + * through either socket creation or the + * ares_sock_config_callback call. + */ +struct iovec; + +struct ares_socket_functions { + ares_socket_t (*asocket)(int, int, int, void *); + int (*aclose)(ares_socket_t, void *); + int (*aconnect)(ares_socket_t, const struct sockaddr *, ares_socklen_t, + void *); + ares_ssize_t (*arecvfrom)(ares_socket_t, void *, size_t, int, + struct sockaddr *, ares_socklen_t *, void *); + ares_ssize_t (*asendv)(ares_socket_t, const struct iovec *, int, void *); +}; + +CARES_EXTERN CARES_DEPRECATED_FOR( + ares_set_socket_functions_ex) void ares_set_socket_functions(ares_channel_t + *channel, + const struct + ares_socket_functions + *funcs, + void *user_data); + +/*! Flags defining behavior of socket functions */ +typedef enum { + /*! Strongly recommended to create sockets as non-blocking and set this + * flag */ + ARES_SOCKFUNC_FLAG_NONBLOCKING = 1 << 0 +} ares_sockfunc_flags_t; + +/*! Socket options in request to asetsockopt() in struct + * ares_socket_functions_ex */ +typedef enum { + /*! Set the send buffer size. Value is a pointer to an int. (SO_SNDBUF) */ + ARES_SOCKET_OPT_SENDBUF_SIZE, + /*! Set the recv buffer size. Value is a pointer to an int. (SO_RCVBUF) */ + ARES_SOCKET_OPT_RECVBUF_SIZE, + /*! Set the network interface to use as the source for communication. + * Value is a C string. (SO_BINDTODEVICE) */ + ARES_SOCKET_OPT_BIND_DEVICE, + /*! Enable TCP Fast Open. Value is a pointer to an ares_bool_t. On some + * systems this could be a no-op if it is known it is on by default and + * return success. Other systems may be a no-op if known the system does + * not support the feature and returns failure with errno set to ENOSYS or + * WSASetLastError(WSAEOPNOTSUPP). + */ + ARES_SOCKET_OPT_TCP_FASTOPEN +} ares_socket_opt_t; + +/*! Flags for behavior during connect */ +typedef enum { + /*! Connect using TCP Fast Open */ + ARES_SOCKET_CONN_TCP_FASTOPEN = 1 << 0 +} ares_socket_connect_flags_t; + +/*! Flags for behavior during bind */ +typedef enum { + /*! Bind is for a TCP connection */ + ARES_SOCKET_BIND_TCP = 1 << 0, + /*! Bind is for a client connection, not server */ + ARES_SOCKET_BIND_CLIENT = 1 << 1 +} ares_socket_bind_flags_t; + +/*! Socket functions to call rather than using OS-native functions */ +struct ares_socket_functions_ex { + /*! ABI Version: must be "1" */ + unsigned int version; + + /*! Flags indicating behavior of the subsystem. One or more + * ares_sockfunc_flags_t */ + unsigned int flags; + + /*! REQUIRED. Create a new socket file descriptor. The file descriptor must + * be opened in non-blocking mode (so that reads and writes never block). + * Recommended other options would be to disable signals on write errors + * (SO_NOSIGPIPE), Disable the Nagle algorithm on SOCK_STREAM (TCP_NODELAY), + * and to automatically close file descriptors on exec (FD_CLOEXEC). + * + * \param[in] domain Socket domain. Valid values are AF_INET, AF_INET6. + * \param[in] type Socket type. Valid values are SOCK_STREAM (tcp) and + * SOCK_DGRAM (udp). + * \param[in] protocol In general this should be ignored, may be passed as + * 0 (use as default for type), or may be IPPROTO_UDP + * or IPPROTO_TCP. + * \param[in] user_data Pointer provided to ares_set_socket_functions_ex(). + * \return ARES_SOCKET_BAD on error, or socket file descriptor on success. + * On error, it is expected to set errno (or WSASetLastError()) to an + * appropriate reason code such as EAFNOSUPPORT / WSAAFNOSUPPORT. */ + ares_socket_t (*asocket)(int domain, int type, int protocol, void *user_data); + + /*! REQUIRED. Close a socket file descriptor. + * \param[in] sock Socket file descriptor returned from asocket. + * \param[in] user_data Pointer provided to ares_set_socket_functions_ex(). + * \return 0 on success. On failure, should set errno (or WSASetLastError) + * to an appropriate code such as EBADF / WSAEBADF */ + int (*aclose)(ares_socket_t sock, void *user_data); + + + /*! REQUIRED. Set socket option. This shares a similar syntax to the BSD + * setsockopt() call, however we use our own options. The value is typically + * a pointer to the desired value and each option has its own data type it + * will express in the documentation. + * + * \param[in] sock Socket file descriptor returned from asocket. + * \param[in] opt Option to set. + * \param[in] val Pointer to value for option. + * \param[in] val_size Size of value. + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return Return 0 on success, otherwise -1 should be returned with an + * appropriate errno (or WSASetLastError()) set. If error is ENOSYS / + * WSAEOPNOTSUPP an error will not be propagated as it will take it + * to mean it is an intentional decision to not support the feature. + */ + int (*asetsockopt)(ares_socket_t sock, ares_socket_opt_t opt, const void *val, + ares_socklen_t val_size, void *user_data); + + /*! REQUIRED. Connect to the remote using the supplied address. For UDP + * sockets this will bind the file descriptor to only send and receive packets + * from the remote address provided. + * + * \param[in] sock Socket file descriptor returned from asocket. + * \param[in] address Address to connect to + * \param[in] address_len Size of address structure passed + * \param[in] flags One or more ares_socket_connect_flags_t + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return Return 0 upon successful establishement, otherwise -1 should be + * returned with an appropriate errno (or WSASetLastError()) set. It + * is generally expected that most TCP connections (not using TCP Fast Open) + * will return -1 with an error of EINPROGRESS / WSAEINPROGRESS due to the + * non-blocking nature of the connection. It is then the responsibility of + * the implementation to notify of writability on the socket to indicate the + * connection has succeeded (or readability on failure to retrieve the + * appropriate error). + */ + int (*aconnect)(ares_socket_t sock, const struct sockaddr *address, + ares_socklen_t address_len, unsigned int flags, + void *user_data); + + /*! REQUIRED. Attempt to read data from the remote. + * + * \param[in] sock Socket file descriptor returned from asocket. + * \param[in,out] buffer Allocated buffer to place data read from + * socket. + * \param[in] length Size of buffer + * \param[in] flags Unused, always 0. + * \param[in,out] address Buffer to hold address data was received from. + * May be NULL if address not desired. + * \param[in,out] address_len Input size of address buffer, output actual + * written size. Must be NULL if address is NULL. + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return -1 on error with appropriate errno (or WSASetLastError()) set, + * such as EWOULDBLOCK / EAGAIN / WSAEWOULDBLOCK, or ECONNRESET / + * WSAECONNRESET. + */ + ares_ssize_t (*arecvfrom)(ares_socket_t sock, void *buffer, size_t length, + int flags, struct sockaddr *address, + ares_socklen_t *address_len, void *user_data); + + /*! REQUIRED. Attempt to send data to the remote. Optional address may be + * specified which may be useful on unbound UDP sockets (though currently not + * used), and TCP FastOpen where the connection is delayed until first write. + * + * \param[in] sock Socket file descriptor returned from asocket. + * \param[in] buffer Containing data to place onto wire. + * \param[in] length Size of buffer + * \param[in] flags Flags for writing. Currently only used flag is + * MSG_NOSIGNAL if the host OS has such a flag. In + * general flags can be ignored. + * \param[in] address Buffer containing address to send data to. May + * be NULL. + * \param[in,out] address_len Size of address buffer. Must be 0 if address + * is NULL. + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return Number of bytes written. -1 on error with appropriate errno (or + * WSASetLastError()) set. + */ + ares_ssize_t (*asendto)(ares_socket_t sock, const void *buffer, size_t length, + int flags, const struct sockaddr *address, + ares_socklen_t address_len, void *user_data); + + /*! Optional. Retrieve the local address of the socket. + * + * \param[in] sock Socket file descriptor returned from asocket + * \param[in,out] address Buffer to hold address + * \param[in,out] address_len Size of address buffer on input, written size + * on output. + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return 0 on success. -1 on error with an appropriate errno (or + * WSASetLastError()) set. + */ + int (*agetsockname)(ares_socket_t sock, struct sockaddr *address, + ares_socklen_t *address_len, void *user_data); + + /*! Optional. Bind the socket to an address. This can be used for client + * connections to bind the source address for packets before connect, or + * for server connections to bind to an address and port before listening. + * Currently c-ares only supports client connections. + * + * \param[in] sock Socket file descriptor returned from asocket + * \param[in] flags ares_socket_bind_flags_t flags. + * \param[in] address Buffer containing address. + * \param[in] address_len Size of address buffer. + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return 0 on success. -1 on error with an appropriate errno (or + * WSASetLastError()) set. + */ + int (*abind)(ares_socket_t sock, unsigned int flags, + const struct sockaddr *address, socklen_t address_len, + void *user_data); + + /* Optional. Convert an interface name into the interface index. If this + * callback is not specified, then IPv6 Link-Local DNS servers cannot be used. + * + * \param[in] ifname Interface Name as NULL-terminated string. + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return 0 on failure, otherwise interface index. + */ + unsigned int (*aif_nametoindex)(const char *ifname, void *user_data); + + /* Optional. Convert an interface index into the interface name. If this + * callback is not specified, then IPv6 Link-Local DNS servers cannot be used. + * + * \param[in] ifindex Interface index, must be > 0 + * \param[in] ifname_buf Buffer to hold interface name. Must be at least + * IFNAMSIZ in length or 32 bytes if IFNAMSIZ isn't + * defined. + * \param[in] ifname_buf_len Size of ifname_buf for verification. + * \param[in] user_data Pointer provided to + * ares_set_socket_functions_ex(). + * \return NULL on failure, otherwise pointer to provided ifname_buf + */ + const char *(*aif_indextoname)(unsigned int ifindex, char *ifname_buf, + size_t ifname_buf_len, void *user_data); +}; + +/*! Override the native socket functions for the OS with the provided set. + * An optional user data thunk may be specified which will be passed to + * each registered callback. Replaces ares_set_socket_functions(). + * + * \param[in] channel An initialized c-ares channel. + * \param[in] funcs Structure registering the implementations for the + * various functions. See the structure definition. + * This will be duplicated and does not need to exist + * past the life of this call. + * \param[in] user_data User data thunk which will be passed to each call of + * the registered callbacks. + * \return ARES_SUCCESS on success, or another error code such as ARES_EFORMERR + * on misuse. + */ +CARES_EXTERN ares_status_t ares_set_socket_functions_ex( + ares_channel_t *channel, const struct ares_socket_functions_ex *funcs, + void *user_data); + + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_send_dnsrec) void ares_send( + ares_channel_t *channel, const unsigned char *qbuf, int qlen, + ares_callback callback, void *arg); + +/*! Send a DNS query as an ares_dns_record_t with a callback containing the + * parsed DNS record. + * + * \param[in] channel Pointer to channel on which queries will be sent. + * \param[in] dnsrec DNS Record to send + * \param[in] callback Callback function invoked on completion or failure of + * the query sequence. + * \param[in] arg Additional argument passed to the callback function. + * \param[out] qid Query ID + * \return One of the c-ares status codes. + */ +CARES_EXTERN ares_status_t ares_send_dnsrec(ares_channel_t *channel, + const ares_dns_record_t *dnsrec, + ares_callback_dnsrec callback, + void *arg, unsigned short *qid); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_query_dnsrec) void ares_query( + ares_channel_t *channel, const char *name, int dnsclass, int type, + ares_callback callback, void *arg); + +/*! Perform a DNS query with a callback containing the parsed DNS record. + * + * \param[in] channel Pointer to channel on which queries will be sent. + * \param[in] name Query name + * \param[in] dnsclass DNS Class + * \param[in] type DNS Record Type + * \param[in] callback Callback function invoked on completion or failure of + * the query sequence. + * \param[in] arg Additional argument passed to the callback function. + * \param[out] qid Query ID + * \return One of the c-ares status codes. + */ +CARES_EXTERN ares_status_t ares_query_dnsrec(ares_channel_t *channel, + const char *name, + ares_dns_class_t dnsclass, + ares_dns_rec_type_t type, + ares_callback_dnsrec callback, + void *arg, unsigned short *qid); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_search_dnsrec) void ares_search( + ares_channel_t *channel, const char *name, int dnsclass, int type, + ares_callback callback, void *arg); + +/*! Search for a complete DNS message. + * + * \param[in] channel Pointer to channel on which queries will be sent. + * \param[in] dnsrec Pointer to initialized and filled DNS record object. + * \param[in] callback Callback function invoked on completion or failure of + * the query sequence. + * \param[in] arg Additional argument passed to the callback function. + * \return One of the c-ares status codes. In all cases, except + * ARES_EFORMERR due to misuse, this error code will also be sent + * to the provided callback. + */ +CARES_EXTERN ares_status_t ares_search_dnsrec(ares_channel_t *channel, + const ares_dns_record_t *dnsrec, + ares_callback_dnsrec callback, + void *arg); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_getaddrinfo) void ares_gethostbyname( + ares_channel_t *channel, const char *name, int family, + ares_host_callback callback, void *arg); + +CARES_EXTERN int ares_gethostbyname_file(ares_channel_t *channel, + const char *name, int family, + struct hostent **host); + +CARES_EXTERN void ares_gethostbyaddr(ares_channel_t *channel, const void *addr, + int addrlen, int family, + ares_host_callback callback, void *arg); + +CARES_EXTERN void ares_getnameinfo(ares_channel_t *channel, + const struct sockaddr *sa, + ares_socklen_t salen, int flags, + ares_nameinfo_callback callback, void *arg); + +CARES_EXTERN CARES_DEPRECATED_FOR( + ARES_OPT_EVENT_THREAD or + ARES_OPT_SOCK_STATE_CB) int ares_fds(const ares_channel_t *channel, + fd_set *read_fds, fd_set *write_fds); + +CARES_EXTERN CARES_DEPRECATED_FOR( + ARES_OPT_EVENT_THREAD or + ARES_OPT_SOCK_STATE_CB) int ares_getsock(const ares_channel_t *channel, + ares_socket_t *socks, int numsocks); + +CARES_EXTERN struct timeval *ares_timeout(const ares_channel_t *channel, + struct timeval *maxtv, + struct timeval *tv); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_process_fds) void ares_process( + ares_channel_t *channel, fd_set *read_fds, fd_set *write_fds); + +/*! Events used by ares_fd_events_t */ +typedef enum { + ARES_FD_EVENT_NONE = 0, /*!< No events */ + ARES_FD_EVENT_READ = 1 << 0, /*!< Read event (including disconnect/error) */ + ARES_FD_EVENT_WRITE = 1 << 1 /*!< Write event */ +} ares_fd_eventflag_t; + +/*! Type holding a file descriptor and mask of events, used by + * ares_process_fds() */ +typedef struct { + ares_socket_t fd; /*!< File descriptor */ + unsigned int events; /*!< Mask of ares_fd_eventflag_t */ +} ares_fd_events_t; + +/*! Flags used by ares_process_fds() */ +typedef enum { + ARES_PROCESS_FLAG_NONE = 0, /*!< No flag value */ + ARES_PROCESS_FLAG_SKIP_NON_FD = 1 << 0 /*!< skip any processing unrelated to + * the file descriptor events passed + * in */ +} ares_process_flag_t; + +/*! Process events on multiple file descriptors based on the event mask + * associated with each file descriptor. Recommended over calling + * ares_process_fd() multiple times since it would trigger additional logic + * such as timeout processing on each call. + * + * \param[in] channel Initialized ares channel + * \param[in] events Array of file descriptors with events. May be NULL if + * no events, but may have timeouts to process. + * \param[in] nevents Number of elements in the events array. May be 0 if + * no events, but may have timeouts to process. + * \param[in] flags Flags to alter behavior of the process command. + * \return ARES_ENOMEM on out of memory, ARES_EFORMERR on misuse, + * otherwise ARES_SUCCESS + */ +CARES_EXTERN ares_status_t ares_process_fds(ares_channel_t *channel, + const ares_fd_events_t *events, + size_t nevents, unsigned int flags); + +CARES_EXTERN void ares_process_fd(ares_channel_t *channel, + ares_socket_t read_fd, + ares_socket_t write_fd); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_record_create) int ares_create_query( + const char *name, int dnsclass, int type, unsigned short id, int rd, + unsigned char **buf, int *buflen, int max_udp_size); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_record_create) int ares_mkquery( + const char *name, int dnsclass, int type, unsigned short id, int rd, + unsigned char **buf, int *buflen); + +CARES_EXTERN int ares_expand_name(const unsigned char *encoded, + const unsigned char *abuf, int alen, char **s, + long *enclen); + +CARES_EXTERN int ares_expand_string(const unsigned char *encoded, + const unsigned char *abuf, int alen, + unsigned char **s, long *enclen); + +struct ares_addrttl { + struct in_addr ipaddr; + int ttl; +}; + +struct ares_addr6ttl { + struct ares_in6_addr ip6addr; + int ttl; +}; + +struct ares_caa_reply { + struct ares_caa_reply *next; + int critical; + unsigned char *property; + size_t plength; /* plength excludes null termination */ + unsigned char *value; + size_t length; /* length excludes null termination */ +}; + +struct ares_srv_reply { + struct ares_srv_reply *next; + char *host; + unsigned short priority; + unsigned short weight; + unsigned short port; +}; + +struct ares_mx_reply { + struct ares_mx_reply *next; + char *host; + unsigned short priority; +}; + +struct ares_txt_reply { + struct ares_txt_reply *next; + unsigned char *txt; + size_t length; /* length excludes null termination */ +}; + +/* NOTE: This structure is a superset of ares_txt_reply + */ +struct ares_txt_ext { + struct ares_txt_ext *next; + unsigned char *txt; + size_t length; + /* 1 - if start of new record + * 0 - if a chunk in the same record */ + unsigned char record_start; +}; + +struct ares_naptr_reply { + struct ares_naptr_reply *next; + unsigned char *flags; + unsigned char *service; + unsigned char *regexp; + char *replacement; + unsigned short order; + unsigned short preference; +}; + +struct ares_soa_reply { + char *nsname; + char *hostmaster; + unsigned int serial; + unsigned int refresh; + unsigned int retry; + unsigned int expire; + unsigned int minttl; +}; + +struct ares_uri_reply { + struct ares_uri_reply *next; + unsigned short priority; + unsigned short weight; + char *uri; + int ttl; +}; + +/* + * Similar to addrinfo, but with extra ttl and missing canonname. + */ +struct ares_addrinfo_node { + int ai_ttl; + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + ares_socklen_t ai_addrlen; + struct sockaddr *ai_addr; + struct ares_addrinfo_node *ai_next; +}; + +/* + * alias - label of the resource record. + * name - value (canonical name) of the resource record. + * See RFC2181 10.1.1. CNAME terminology. + */ +struct ares_addrinfo_cname { + int ttl; + char *alias; + char *name; + struct ares_addrinfo_cname *next; +}; + +struct ares_addrinfo { + struct ares_addrinfo_cname *cnames; + struct ares_addrinfo_node *nodes; + char *name; +}; + +struct ares_addrinfo_hints { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; +}; + +/* +** Parse the buffer, starting at *abuf and of length alen bytes, previously +** obtained from an ares_search call. Put the results in *host, if nonnull. +** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with +** their TTLs in that array, and set *naddrttls to the number of addresses +** so written. +*/ + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_a_reply( + const unsigned char *abuf, int alen, struct hostent **host, + struct ares_addrttl *addrttls, int *naddrttls); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_aaaa_reply( + const unsigned char *abuf, int alen, struct hostent **host, + struct ares_addr6ttl *addrttls, int *naddrttls); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_caa_reply( + const unsigned char *abuf, int alen, struct ares_caa_reply **caa_out); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_ptr_reply( + const unsigned char *abuf, int alen, const void *addr, int addrlen, + int family, struct hostent **host); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_ns_reply( + const unsigned char *abuf, int alen, struct hostent **host); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_srv_reply( + const unsigned char *abuf, int alen, struct ares_srv_reply **srv_out); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_mx_reply( + const unsigned char *abuf, int alen, struct ares_mx_reply **mx_out); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_txt_reply( + const unsigned char *abuf, int alen, struct ares_txt_reply **txt_out); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_txt_reply_ext( + const unsigned char *abuf, int alen, struct ares_txt_ext **txt_out); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_naptr_reply( + const unsigned char *abuf, int alen, struct ares_naptr_reply **naptr_out); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_soa_reply( + const unsigned char *abuf, int alen, struct ares_soa_reply **soa_out); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_dns_parse) int ares_parse_uri_reply( + const unsigned char *abuf, int alen, struct ares_uri_reply **uri_out); + +CARES_EXTERN void ares_free_string(void *str); + +CARES_EXTERN void ares_free_hostent(struct hostent *host); + +CARES_EXTERN void ares_free_data(void *dataptr); + +CARES_EXTERN const char *ares_strerror(int code); + +struct ares_addr_node { + struct ares_addr_node *next; + int family; + + union { + struct in_addr addr4; + struct ares_in6_addr addr6; + } addr; +}; + +struct ares_addr_port_node { + struct ares_addr_port_node *next; + int family; + + union { + struct in_addr addr4; + struct ares_in6_addr addr6; + } addr; + + int udp_port; + int tcp_port; +}; + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_set_servers_csv) int ares_set_servers( + ares_channel_t *channel, const struct ares_addr_node *servers); + +CARES_EXTERN +CARES_DEPRECATED_FOR(ares_set_servers_ports_csv) +int ares_set_servers_ports(ares_channel_t *channel, + const struct ares_addr_port_node *servers); + +/* Incoming string format: host[:port][,host[:port]]... */ +CARES_EXTERN int ares_set_servers_csv(ares_channel_t *channel, + const char *servers); +CARES_EXTERN int ares_set_servers_ports_csv(ares_channel_t *channel, + const char *servers); +CARES_EXTERN char *ares_get_servers_csv(const ares_channel_t *channel); + +CARES_EXTERN CARES_DEPRECATED_FOR(ares_get_servers_csv) int ares_get_servers( + const ares_channel_t *channel, struct ares_addr_node **servers); + +CARES_EXTERN +CARES_DEPRECATED_FOR(ares_get_servers_csv) +int ares_get_servers_ports(const ares_channel_t *channel, + struct ares_addr_port_node **servers); + +CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst, + ares_socklen_t size); + +CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst); + +/*! Whether or not the c-ares library was built with threadsafety + * + * \return ARES_TRUE if built with threadsafety, ARES_FALSE if not + */ +CARES_EXTERN ares_bool_t ares_threadsafety(void); + + +/*! Block until notified that there are no longer any queries in queue, or + * the specified timeout has expired. + * + * \param[in] channel Initialized ares channel + * \param[in] timeout_ms Number of milliseconds to wait for the queue to be + * empty. -1 for Infinite. + * \return ARES_ENOTIMP if not built with threading support, ARES_ETIMEOUT + * if requested timeout expires, ARES_SUCCESS when queue is empty. + */ +CARES_EXTERN ares_status_t ares_queue_wait_empty(ares_channel_t *channel, + int timeout_ms); + + +/*! Retrieve the total number of active queries pending answers from servers. + * Some c-ares requests may spawn multiple queries, such as ares_getaddrinfo() + * when using AF_UNSPEC, which will be reflected in this number. + * + * \param[in] channel Initialized ares channel + * \return Number of active queries to servers + */ +CARES_EXTERN size_t ares_queue_active_queries(const ares_channel_t *channel); + +#ifdef __cplusplus +} +#endif + +#endif /* ARES__H */ diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_build.h b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_build.h new file mode 100644 index 0000000000000000000000000000000000000000..25bf2193b8cefa41f55aa1d9f20edd1e677b9cdc --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_build.h @@ -0,0 +1,47 @@ +#ifndef __CARES_BUILD_H +#define __CARES_BUILD_H +/* + * Copyright (C) The c-ares project and its contributors + * SPDX-License-Identifier: MIT + */ + +#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t +#define CARES_TYPEOF_ARES_SSIZE_T ssize_t + +/* Prefix names with CARES_ to make sure they don't conflict with other config.h + * files. We need to include some dependent headers that may be system specific + * for C-Ares */ +#define CARES_HAVE_SYS_TYPES_H +#define CARES_HAVE_SYS_SOCKET_H +#define CARES_HAVE_SYS_SELECT_H +/* #undef CARES_HAVE_WINDOWS_H */ +/* #undef CARES_HAVE_WS2TCPIP_H */ +/* #undef CARES_HAVE_WINSOCK2_H */ +#define CARES_HAVE_ARPA_NAMESER_H +#define CARES_HAVE_ARPA_NAMESER_COMPAT_H + +#ifdef CARES_HAVE_SYS_TYPES_H +# include +#endif + +#ifdef CARES_HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef CARES_HAVE_SYS_SELECT_H +# include +#endif + +#ifdef CARES_HAVE_WINSOCK2_H +# include +#endif + +#ifdef CARES_HAVE_WS2TCPIP_H +# include +#endif + +#ifdef CARES_HAVE_WINDOWS_H +# include +#endif + +#endif /* __CARES_BUILD_H */ diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_dns.h b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_dns.h new file mode 100644 index 0000000000000000000000000000000000000000..46edbbbc5289c6f3d4a709349751ddc68f78fdfe --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_dns.h @@ -0,0 +1,127 @@ +/* MIT License + * + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef HEADER_CARES_DNS_H +#define HEADER_CARES_DNS_H + +/* + * NOTE TO INTEGRATORS: + * + * This header is made public due to legacy projects relying on it. + * Please do not use the macros within this header, or include this + * header in your project as it may be removed in the future. + */ + + +/* + * Macro DNS__16BIT reads a network short (16 bit) given in network + * byte order, and returns its value as an unsigned short. + */ +#define DNS__16BIT(p) \ + ((unsigned short)((unsigned int)0xffff & \ + (((unsigned int)((unsigned char)(p)[0]) << 8U) | \ + ((unsigned int)((unsigned char)(p)[1]))))) + +/* + * Macro DNS__32BIT reads a network long (32 bit) given in network + * byte order, and returns its value as an unsigned int. + */ +#define DNS__32BIT(p) \ + ((unsigned int)(((unsigned int)((unsigned char)(p)[0]) << 24U) | \ + ((unsigned int)((unsigned char)(p)[1]) << 16U) | \ + ((unsigned int)((unsigned char)(p)[2]) << 8U) | \ + ((unsigned int)((unsigned char)(p)[3])))) + +#define DNS__SET16BIT(p, v) \ + (((p)[0] = (unsigned char)(((v) >> 8) & 0xff)), \ + ((p)[1] = (unsigned char)((v) & 0xff))) +#define DNS__SET32BIT(p, v) \ + (((p)[0] = (unsigned char)(((v) >> 24) & 0xff)), \ + ((p)[1] = (unsigned char)(((v) >> 16) & 0xff)), \ + ((p)[2] = (unsigned char)(((v) >> 8) & 0xff)), \ + ((p)[3] = (unsigned char)((v) & 0xff))) + +#if 0 +/* we cannot use this approach on systems where we can't access 16/32 bit + data on un-aligned addresses */ +# define DNS__16BIT(p) ntohs(*(unsigned short *)(p)) +# define DNS__32BIT(p) ntohl(*(unsigned long *)(p)) +# define DNS__SET16BIT(p, v) *(unsigned short *)(p) = htons(v) +# define DNS__SET32BIT(p, v) *(unsigned long *)(p) = htonl(v) +#endif + +/* Macros for parsing a DNS header */ +#define DNS_HEADER_QID(h) DNS__16BIT(h) +#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1) +#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf) +#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1) +#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1) +#define DNS_HEADER_RD(h) ((h)[2] & 0x1) +#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1) +#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7) +#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf) +#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4) +#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6) +#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8) +#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10) + +/* Macros for constructing a DNS header */ +#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v) +#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 7)) +#define DNS_HEADER_SET_OPCODE(h, v) \ + ((h)[2] |= (unsigned char)(((v) & 0xf) << 3)) +#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 2)) +#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 1)) +#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (unsigned char)((v) & 0x1)) +#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (unsigned char)(((v) & 0x1) << 7)) +#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (unsigned char)(((v) & 0x7) << 4)) +#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (unsigned char)((v) & 0xf)) +#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v) +#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v) +#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v) +#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v) + +/* Macros for parsing the fixed part of a DNS question */ +#define DNS_QUESTION_TYPE(q) DNS__16BIT(q) +#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2) + +/* Macros for constructing the fixed part of a DNS question */ +#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v) +#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v) + +/* Macros for parsing the fixed part of a DNS resource record */ +#define DNS_RR_TYPE(r) DNS__16BIT(r) +#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2) +#define DNS_RR_TTL(r) DNS__32BIT((r) + 4) +#define DNS_RR_LEN(r) DNS__16BIT((r) + 8) + +/* Macros for constructing the fixed part of a DNS resource record */ +#define DNS_RR_SET_TYPE(r, v) DNS__SET16BIT(r, v) +#define DNS_RR_SET_CLASS(r, v) DNS__SET16BIT((r) + 2, v) +#define DNS_RR_SET_TTL(r, v) DNS__SET32BIT((r) + 4, v) +#define DNS_RR_SET_LEN(r, v) DNS__SET16BIT((r) + 8, v) + +#endif /* HEADER_CARES_DNS_H */ diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_dns_record.h b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_dns_record.h new file mode 100644 index 0000000000000000000000000000000000000000..cec9f47f63d8f51967497cb510ab7d3bcd82356a --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_dns_record.h @@ -0,0 +1,1118 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef __ARES_DNS_RECORD_H +#define __ARES_DNS_RECORD_H + +/* Include ares.h, not this file directly */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \addtogroup ares_dns_record DNS Record Handling + * + * This is a set of functions to create and manipulate DNS records. + * + * @{ + */ + +/*! DNS Record types handled by c-ares. Some record types may only be valid + * on requests (e.g. ARES_REC_TYPE_ANY), and some may only be valid on + * responses */ +typedef enum { + ARES_REC_TYPE_A = 1, /*!< Host address. */ + ARES_REC_TYPE_NS = 2, /*!< Authoritative server. */ + ARES_REC_TYPE_CNAME = 5, /*!< Canonical name. */ + ARES_REC_TYPE_SOA = 6, /*!< Start of authority zone. */ + ARES_REC_TYPE_PTR = 12, /*!< Domain name pointer. */ + ARES_REC_TYPE_HINFO = 13, /*!< Host information. */ + ARES_REC_TYPE_MX = 15, /*!< Mail routing information. */ + ARES_REC_TYPE_TXT = 16, /*!< Text strings. */ + ARES_REC_TYPE_SIG = 24, /*!< RFC 2535 / RFC 2931. SIG Record */ + ARES_REC_TYPE_AAAA = 28, /*!< RFC 3596. Ip6 Address. */ + ARES_REC_TYPE_SRV = 33, /*!< RFC 2782. Server Selection. */ + ARES_REC_TYPE_NAPTR = 35, /*!< RFC 3403. Naming Authority Pointer */ + ARES_REC_TYPE_OPT = 41, /*!< RFC 6891. EDNS0 option (meta-RR) */ + + ARES_REC_TYPE_TLSA = 52, /*!< RFC 6698. DNS-Based Authentication of Named + * Entities (DANE) Transport Layer Security + * (TLS) Protocol: TLSA */ + ARES_REC_TYPE_SVCB = 64, /*!< RFC 9460. General Purpose Service Binding */ + ARES_REC_TYPE_HTTPS = 65, /*!< RFC 9460. Service Binding type for use with + * HTTPS */ + ARES_REC_TYPE_ANY = 255, /*!< Wildcard match. Not response RR. */ + ARES_REC_TYPE_URI = 256, /*!< RFC 7553. Uniform Resource Identifier */ + ARES_REC_TYPE_CAA = 257, /*!< RFC 6844. Certification Authority + * Authorization. */ + ARES_REC_TYPE_RAW_RR = 65536 /*!< Used as an indicator that the RR record + * is not parsed, but provided in wire + * format */ +} ares_dns_rec_type_t; + +/*! DNS Classes for requests and responses. */ +typedef enum { + ARES_CLASS_IN = 1, /*!< Internet */ + ARES_CLASS_CHAOS = 3, /*!< CHAOS */ + ARES_CLASS_HESOID = 4, /*!< Hesoid [Dyer 87] */ + ARES_CLASS_NONE = 254, /*!< RFC 2136 */ + ARES_CLASS_ANY = 255 /*!< Any class (requests only) */ +} ares_dns_class_t; + +/*! DNS RR Section type */ +typedef enum { + ARES_SECTION_ANSWER = 1, /*!< Answer section */ + ARES_SECTION_AUTHORITY = 2, /*!< Authority section */ + ARES_SECTION_ADDITIONAL = 3 /*!< Additional information section */ +} ares_dns_section_t; + +/*! DNS Header opcodes */ +typedef enum { + ARES_OPCODE_QUERY = 0, /*!< Standard query */ + ARES_OPCODE_IQUERY = 1, /*!< Inverse query. Obsolete. */ + ARES_OPCODE_STATUS = 2, /*!< Name server status query */ + ARES_OPCODE_NOTIFY = 4, /*!< Zone change notification (RFC 1996) */ + ARES_OPCODE_UPDATE = 5 /*!< Zone update message (RFC2136) */ +} ares_dns_opcode_t; + +/*! DNS Header flags */ +typedef enum { + ARES_FLAG_QR = 1 << 0, /*!< QR. If set, is a response */ + ARES_FLAG_AA = 1 << 1, /*!< Authoritative Answer. If set, is authoritative */ + ARES_FLAG_TC = 1 << 2, /*!< Truncation. If set, is truncated response */ + ARES_FLAG_RD = 1 << 3, /*!< Recursion Desired. If set, recursion is desired */ + ARES_FLAG_RA = 1 << 4, /*!< Recursion Available. If set, server supports + * recursion */ + ARES_FLAG_AD = 1 << 5, /*!< RFC 2065. Authentic Data bit indicates in a + * response that the data included has been verified by + * the server providing it */ + ARES_FLAG_CD = 1 << 6 /*!< RFC 2065. Checking Disabled bit indicates in a + * query that non-verified data is acceptable to the + * resolver sending the query. */ +} ares_dns_flags_t; + +/*! DNS Response Codes from server */ +typedef enum { + ARES_RCODE_NOERROR = 0, /*!< Success */ + ARES_RCODE_FORMERR = 1, /*!< Format error. The name server was unable + * to interpret the query. */ + ARES_RCODE_SERVFAIL = 2, /*!< Server Failure. The name server was + * unable to process this query due to a + * problem with the nameserver */ + ARES_RCODE_NXDOMAIN = 3, /*!< Name Error. Meaningful only for + * responses from an authoritative name + * server, this code signifies that the + * domain name referenced in the query does + * not exist. */ + ARES_RCODE_NOTIMP = 4, /*!< Not implemented. The name server does + * not support the requested kind of + * query */ + ARES_RCODE_REFUSED = 5, /*!< Refused. The name server refuses to + * perform the specified operation for + * policy reasons. */ + ARES_RCODE_YXDOMAIN = 6, /*!< RFC 2136. Some name that ought not to + * exist, does exist. */ + ARES_RCODE_YXRRSET = 7, /*!< RFC 2136. Some RRset that ought to not + * exist, does exist. */ + ARES_RCODE_NXRRSET = 8, /*!< RFC 2136. Some RRset that ought to exist, + * does not exist. */ + ARES_RCODE_NOTAUTH = 9, /*!< RFC 2136. The server is not authoritative + * for the zone named in the Zone section. + */ + ARES_RCODE_NOTZONE = 10, /*!< RFC 2136. A name used in the Prerequisite + * or Update Section is not within the zone + * denoted by the Zone Section. */ + ARES_RCODE_DSOTYPEI = 11, /*!< RFC 8409. DSO-TYPE Not implemented */ + ARES_RCODE_BADSIG = 16, /*!< RFC 8945. TSIG Signature Failure */ + ARES_RCODE_BADKEY = 17, /*!< RFC 8945. Key not recognized. */ + ARES_RCODE_BADTIME = 18, /*!< RFC 8945. Signature out of time window. */ + ARES_RCODE_BADMODE = 19, /*!< RFC 2930. Bad TKEY Mode */ + ARES_RCODE_BADNAME = 20, /*!< RFC 2930. Duplicate Key Name */ + ARES_RCODE_BADALG = 21, /*!< RFC 2930. Algorithm not supported */ + ARES_RCODE_BADTRUNC = 22, /*!< RFC 8945. Bad Truncation */ + ARES_RCODE_BADCOOKIE = 23 /*!< RFC 7873. Bad/missing Server Cookie */ +} ares_dns_rcode_t; + +/*! Data types used */ +typedef enum { + ARES_DATATYPE_INADDR = 1, /*!< struct in_addr * type */ + ARES_DATATYPE_INADDR6 = 2, /*!< struct ares_in6_addr * type */ + ARES_DATATYPE_U8 = 3, /*!< 8bit unsigned integer */ + ARES_DATATYPE_U16 = 4, /*!< 16bit unsigned integer */ + ARES_DATATYPE_U32 = 5, /*!< 32bit unsigned integer */ + ARES_DATATYPE_NAME = 6, /*!< Null-terminated string of a domain name */ + ARES_DATATYPE_STR = 7, /*!< Null-terminated string */ + ARES_DATATYPE_BIN = 8, /*!< Binary data */ + ARES_DATATYPE_BINP = 9, /*!< Officially defined as binary data, but likely + * printable. Guaranteed to have a NULL + * terminator for convenience (not included in + * length) */ + ARES_DATATYPE_OPT = 10, /*!< Array of options. 16bit identifier, BIN + * data. */ + ARES_DATATYPE_ABINP = 11 /*!< Array of binary data, likely printable. + * Guaranteed to have a NULL terminator for + * convenience (not included in length) */ +} ares_dns_datatype_t; + +/*! Keys used for all RR Types. We take the record type and multiply by 100 + * to ensure we have a proper offset between keys so we can keep these sorted + */ +typedef enum { + /*! A Record. Address. Datatype: INADDR */ + ARES_RR_A_ADDR = (ARES_REC_TYPE_A * 100) + 1, + /*! NS Record. Name. Datatype: NAME */ + ARES_RR_NS_NSDNAME = (ARES_REC_TYPE_NS * 100) + 1, + /*! CNAME Record. CName. Datatype: NAME */ + ARES_RR_CNAME_CNAME = (ARES_REC_TYPE_CNAME * 100) + 1, + /*! SOA Record. MNAME, Primary Source of Data. Datatype: NAME */ + ARES_RR_SOA_MNAME = (ARES_REC_TYPE_SOA * 100) + 1, + /*! SOA Record. RNAME, Mailbox of person responsible. Datatype: NAME */ + ARES_RR_SOA_RNAME = (ARES_REC_TYPE_SOA * 100) + 2, + /*! SOA Record. Serial, version. Datatype: U32 */ + ARES_RR_SOA_SERIAL = (ARES_REC_TYPE_SOA * 100) + 3, + /*! SOA Record. Refresh, zone refersh interval. Datatype: U32 */ + ARES_RR_SOA_REFRESH = (ARES_REC_TYPE_SOA * 100) + 4, + /*! SOA Record. Retry, failed refresh retry interval. Datatype: U32 */ + ARES_RR_SOA_RETRY = (ARES_REC_TYPE_SOA * 100) + 5, + /*! SOA Record. Expire, upper limit on authority. Datatype: U32 */ + ARES_RR_SOA_EXPIRE = (ARES_REC_TYPE_SOA * 100) + 6, + /*! SOA Record. Minimum, RR TTL. Datatype: U32 */ + ARES_RR_SOA_MINIMUM = (ARES_REC_TYPE_SOA * 100) + 7, + /*! PTR Record. DNAME, pointer domain. Datatype: NAME */ + ARES_RR_PTR_DNAME = (ARES_REC_TYPE_PTR * 100) + 1, + /*! HINFO Record. CPU. Datatype: STR */ + ARES_RR_HINFO_CPU = (ARES_REC_TYPE_HINFO * 100) + 1, + /*! HINFO Record. OS. Datatype: STR */ + ARES_RR_HINFO_OS = (ARES_REC_TYPE_HINFO * 100) + 2, + /*! MX Record. Preference. Datatype: U16 */ + ARES_RR_MX_PREFERENCE = (ARES_REC_TYPE_MX * 100) + 1, + /*! MX Record. Exchange, domain. Datatype: NAME */ + ARES_RR_MX_EXCHANGE = (ARES_REC_TYPE_MX * 100) + 2, + /*! TXT Record. Data. Datatype: ABINP */ + ARES_RR_TXT_DATA = (ARES_REC_TYPE_TXT * 100) + 1, + /*! SIG Record. Type Covered. Datatype: U16 */ + ARES_RR_SIG_TYPE_COVERED = (ARES_REC_TYPE_SIG * 100) + 1, + /*! SIG Record. Algorithm. Datatype: U8 */ + ARES_RR_SIG_ALGORITHM = (ARES_REC_TYPE_SIG * 100) + 2, + /*! SIG Record. Labels. Datatype: U8 */ + ARES_RR_SIG_LABELS = (ARES_REC_TYPE_SIG * 100) + 3, + /*! SIG Record. Original TTL. Datatype: U32 */ + ARES_RR_SIG_ORIGINAL_TTL = (ARES_REC_TYPE_SIG * 100) + 4, + /*! SIG Record. Signature Expiration. Datatype: U32 */ + ARES_RR_SIG_EXPIRATION = (ARES_REC_TYPE_SIG * 100) + 5, + /*! SIG Record. Signature Inception. Datatype: U32 */ + ARES_RR_SIG_INCEPTION = (ARES_REC_TYPE_SIG * 100) + 6, + /*! SIG Record. Key Tag. Datatype: U16 */ + ARES_RR_SIG_KEY_TAG = (ARES_REC_TYPE_SIG * 100) + 7, + /*! SIG Record. Signers Name. Datatype: NAME */ + ARES_RR_SIG_SIGNERS_NAME = (ARES_REC_TYPE_SIG * 100) + 8, + /*! SIG Record. Signature. Datatype: BIN */ + ARES_RR_SIG_SIGNATURE = (ARES_REC_TYPE_SIG * 100) + 9, + /*! AAAA Record. Address. Datatype: INADDR6 */ + ARES_RR_AAAA_ADDR = (ARES_REC_TYPE_AAAA * 100) + 1, + /*! SRV Record. Priority. Datatype: U16 */ + ARES_RR_SRV_PRIORITY = (ARES_REC_TYPE_SRV * 100) + 2, + /*! SRV Record. Weight. Datatype: U16 */ + ARES_RR_SRV_WEIGHT = (ARES_REC_TYPE_SRV * 100) + 3, + /*! SRV Record. Port. Datatype: U16 */ + ARES_RR_SRV_PORT = (ARES_REC_TYPE_SRV * 100) + 4, + /*! SRV Record. Target domain. Datatype: NAME */ + ARES_RR_SRV_TARGET = (ARES_REC_TYPE_SRV * 100) + 5, + /*! NAPTR Record. Order. Datatype: U16 */ + ARES_RR_NAPTR_ORDER = (ARES_REC_TYPE_NAPTR * 100) + 1, + /*! NAPTR Record. Preference. Datatype: U16 */ + ARES_RR_NAPTR_PREFERENCE = (ARES_REC_TYPE_NAPTR * 100) + 2, + /*! NAPTR Record. Flags. Datatype: STR */ + ARES_RR_NAPTR_FLAGS = (ARES_REC_TYPE_NAPTR * 100) + 3, + /*! NAPTR Record. Services. Datatype: STR */ + ARES_RR_NAPTR_SERVICES = (ARES_REC_TYPE_NAPTR * 100) + 4, + /*! NAPTR Record. Regexp. Datatype: STR */ + ARES_RR_NAPTR_REGEXP = (ARES_REC_TYPE_NAPTR * 100) + 5, + /*! NAPTR Record. Replacement. Datatype: NAME */ + ARES_RR_NAPTR_REPLACEMENT = (ARES_REC_TYPE_NAPTR * 100) + 6, + /*! OPT Record. UDP Size. Datatype: U16 */ + ARES_RR_OPT_UDP_SIZE = (ARES_REC_TYPE_OPT * 100) + 1, + /*! OPT Record. Version. Datatype: U8 */ + ARES_RR_OPT_VERSION = (ARES_REC_TYPE_OPT * 100) + 3, + /*! OPT Record. Flags. Datatype: U16 */ + ARES_RR_OPT_FLAGS = (ARES_REC_TYPE_OPT * 100) + 4, + /*! OPT Record. Options. Datatype: OPT */ + ARES_RR_OPT_OPTIONS = (ARES_REC_TYPE_OPT * 100) + 5, + /*! TLSA Record. Certificate Usage. Datatype: U8 */ + ARES_RR_TLSA_CERT_USAGE = (ARES_REC_TYPE_TLSA * 100) + 1, + /*! TLSA Record. Selector. Datatype: U8 */ + ARES_RR_TLSA_SELECTOR = (ARES_REC_TYPE_TLSA * 100) + 2, + /*! TLSA Record. Matching Type. Datatype: U8 */ + ARES_RR_TLSA_MATCH = (ARES_REC_TYPE_TLSA * 100) + 3, + /*! TLSA Record. Certificate Association Data. Datatype: BIN */ + ARES_RR_TLSA_DATA = (ARES_REC_TYPE_TLSA * 100) + 4, + /*! SVCB Record. SvcPriority. Datatype: U16 */ + ARES_RR_SVCB_PRIORITY = (ARES_REC_TYPE_SVCB * 100) + 1, + /*! SVCB Record. TargetName. Datatype: NAME */ + ARES_RR_SVCB_TARGET = (ARES_REC_TYPE_SVCB * 100) + 2, + /*! SVCB Record. SvcParams. Datatype: OPT */ + ARES_RR_SVCB_PARAMS = (ARES_REC_TYPE_SVCB * 100) + 3, + /*! HTTPS Record. SvcPriority. Datatype: U16 */ + ARES_RR_HTTPS_PRIORITY = (ARES_REC_TYPE_HTTPS * 100) + 1, + /*! HTTPS Record. TargetName. Datatype: NAME */ + ARES_RR_HTTPS_TARGET = (ARES_REC_TYPE_HTTPS * 100) + 2, + /*! HTTPS Record. SvcParams. Datatype: OPT */ + ARES_RR_HTTPS_PARAMS = (ARES_REC_TYPE_HTTPS * 100) + 3, + /*! URI Record. Priority. Datatype: U16 */ + ARES_RR_URI_PRIORITY = (ARES_REC_TYPE_URI * 100) + 1, + /*! URI Record. Weight. Datatype: U16 */ + ARES_RR_URI_WEIGHT = (ARES_REC_TYPE_URI * 100) + 2, + /*! URI Record. Target domain. Datatype: NAME */ + ARES_RR_URI_TARGET = (ARES_REC_TYPE_URI * 100) + 3, + /*! CAA Record. Critical flag. Datatype: U8 */ + ARES_RR_CAA_CRITICAL = (ARES_REC_TYPE_CAA * 100) + 1, + /*! CAA Record. Tag/Property. Datatype: STR */ + ARES_RR_CAA_TAG = (ARES_REC_TYPE_CAA * 100) + 2, + /*! CAA Record. Value. Datatype: BINP */ + ARES_RR_CAA_VALUE = (ARES_REC_TYPE_CAA * 100) + 3, + /*! RAW Record. RR Type. Datatype: U16 */ + ARES_RR_RAW_RR_TYPE = (ARES_REC_TYPE_RAW_RR * 100) + 1, + /*! RAW Record. RR Data. Datatype: BIN */ + ARES_RR_RAW_RR_DATA = (ARES_REC_TYPE_RAW_RR * 100) + 2 +} ares_dns_rr_key_t; + +/*! TLSA Record ARES_RR_TLSA_CERT_USAGE known values */ +typedef enum { + /*! Certificate Usage 0. CA Constraint. */ + ARES_TLSA_USAGE_CA = 0, + /*! Certificate Usage 1. Service Certificate Constraint. */ + ARES_TLSA_USAGE_SERVICE = 1, + /*! Certificate Usage 2. Trust Anchor Assertion. */ + ARES_TLSA_USAGE_TRUSTANCHOR = 2, + /*! Certificate Usage 3. Domain-issued certificate. */ + ARES_TLSA_USAGE_DOMAIN = 3 +} ares_tlsa_usage_t; + +/*! TLSA Record ARES_RR_TLSA_SELECTOR known values */ +typedef enum { + /*! Full Certificate */ + ARES_TLSA_SELECTOR_FULL = 0, + /*! DER-encoded SubjectPublicKeyInfo */ + ARES_TLSA_SELECTOR_SUBJPUBKEYINFO = 1 +} ares_tlsa_selector_t; + +/*! TLSA Record ARES_RR_TLSA_MATCH known values */ +typedef enum { + /*! Exact match */ + ARES_TLSA_MATCH_EXACT = 0, + /*! Sha256 match */ + ARES_TLSA_MATCH_SHA256 = 1, + /*! Sha512 match */ + ARES_TLSA_MATCH_SHA512 = 2 +} ares_tlsa_match_t; + +/*! SVCB (and HTTPS) RR known parameters */ +typedef enum { + /*! Mandatory keys in this RR (RFC 9460 Section 8) */ + ARES_SVCB_PARAM_MANDATORY = 0, + /*! Additional supported protocols (RFC 9460 Section 7.1) */ + ARES_SVCB_PARAM_ALPN = 1, + /*! No support for default protocol (RFC 9460 Section 7.1) */ + ARES_SVCB_PARAM_NO_DEFAULT_ALPN = 2, + /*! Port for alternative endpoint (RFC 9460 Section 7.2) */ + ARES_SVCB_PARAM_PORT = 3, + /*! IPv4 address hints (RFC 9460 Section 7.3) */ + ARES_SVCB_PARAM_IPV4HINT = 4, + /*! RESERVED (held for Encrypted ClientHello) */ + ARES_SVCB_PARAM_ECH = 5, + /*! IPv6 address hints (RFC 9460 Section 7.3) */ + ARES_SVCB_PARAM_IPV6HINT = 6 +} ares_svcb_param_t; + +/*! OPT RR known parameters */ +typedef enum { + /*! RFC 8764. Apple's DNS Long-Lived Queries Protocol */ + ARES_OPT_PARAM_LLQ = 1, + /*! http://files.dns-sd.org/draft-sekar-dns-ul.txt: Update Lease */ + ARES_OPT_PARAM_UL = 2, + /*! RFC 5001. Name Server Identification */ + ARES_OPT_PARAM_NSID = 3, + /*! RFC 6975. DNSSEC Algorithm Understood */ + ARES_OPT_PARAM_DAU = 5, + /*! RFC 6975. DS Hash Understood */ + ARES_OPT_PARAM_DHU = 6, + /*! RFC 6975. NSEC3 Hash Understood */ + ARES_OPT_PARAM_N3U = 7, + /*! RFC 7871. Client Subnet */ + ARES_OPT_PARAM_EDNS_CLIENT_SUBNET = 8, + /*! RFC 7314. Expire Timer */ + ARES_OPT_PARAM_EDNS_EXPIRE = 9, + /*! RFC 7873. Client and Server Cookies */ + ARES_OPT_PARAM_COOKIE = 10, + /*! RFC 7828. TCP Keepalive timeout */ + ARES_OPT_PARAM_EDNS_TCP_KEEPALIVE = 11, + /*! RFC 7830. Padding */ + ARES_OPT_PARAM_PADDING = 12, + /*! RFC 7901. Chain query requests */ + ARES_OPT_PARAM_CHAIN = 13, + /*! RFC 8145. Signaling Trust Anchor Knowledge in DNSSEC */ + ARES_OPT_PARAM_EDNS_KEY_TAG = 14, + /*! RFC 8914. Extended ERROR code and message */ + ARES_OPT_PARAM_EXTENDED_DNS_ERROR = 15 +} ares_opt_param_t; + +/*! Data type for option records for keys like ARES_RR_OPT_OPTIONS and + * ARES_RR_HTTPS_PARAMS returned by ares_dns_opt_get_datatype() */ +typedef enum { + /*! No value allowed for this option */ + ARES_OPT_DATATYPE_NONE = 1, + /*! List of strings, each prefixed with a single octet representing the length + */ + ARES_OPT_DATATYPE_STR_LIST = 2, + /*! List of 8bit integers, concatenated */ + ARES_OPT_DATATYPE_U8_LIST = 3, + /*! 16bit integer in network byte order */ + ARES_OPT_DATATYPE_U16 = 4, + /*! list of 16bit integer in network byte order, concatenated. */ + ARES_OPT_DATATYPE_U16_LIST = 5, + /*! 32bit integer in network byte order */ + ARES_OPT_DATATYPE_U32 = 6, + /*! list 32bit integer in network byte order, concatenated */ + ARES_OPT_DATATYPE_U32_LIST = 7, + /*! List of ipv4 addresses in network byte order, concatenated */ + ARES_OPT_DATATYPE_INADDR4_LIST = 8, + /*! List of ipv6 addresses in network byte order, concatenated */ + ARES_OPT_DATATYPE_INADDR6_LIST = 9, + /*! Binary Data */ + ARES_OPT_DATATYPE_BIN = 10, + /*! DNS Domain Name Format */ + ARES_OPT_DATATYPE_NAME = 11 +} ares_dns_opt_datatype_t; + +/*! Data type for flags to ares_dns_parse() */ +typedef enum { + /*! Parse Answers from RFC 1035 that allow name compression as RAW */ + ARES_DNS_PARSE_AN_BASE_RAW = 1 << 0, + /*! Parse Authority from RFC 1035 that allow name compression as RAW */ + ARES_DNS_PARSE_NS_BASE_RAW = 1 << 1, + /*! Parse Additional from RFC 1035 that allow name compression as RAW */ + ARES_DNS_PARSE_AR_BASE_RAW = 1 << 2, + /*! Parse Answers from later RFCs (no name compression) RAW */ + ARES_DNS_PARSE_AN_EXT_RAW = 1 << 3, + /*! Parse Authority from later RFCs (no name compression) as RAW */ + ARES_DNS_PARSE_NS_EXT_RAW = 1 << 4, + /*! Parse Additional from later RFCs (no name compression) as RAW */ + ARES_DNS_PARSE_AR_EXT_RAW = 1 << 5 +} ares_dns_parse_flags_t; + +/*! String representation of DNS Record Type + * + * \param[in] type DNS Record Type + * \return string + */ +CARES_EXTERN const char *ares_dns_rec_type_tostr(ares_dns_rec_type_t type); + +/*! String representation of DNS Class + * + * \param[in] qclass DNS Class + * \return string + */ +CARES_EXTERN const char *ares_dns_class_tostr(ares_dns_class_t qclass); + +/*! String representation of DNS OpCode + * + * \param[in] opcode DNS OpCode + * \return string + */ +CARES_EXTERN const char *ares_dns_opcode_tostr(ares_dns_opcode_t opcode); + +/*! String representation of DNS Resource Record Parameter + * + * \param[in] key DNS Resource Record parameter + * \return string + */ +CARES_EXTERN const char *ares_dns_rr_key_tostr(ares_dns_rr_key_t key); + +/*! String representation of DNS Resource Record section + * + * \param[in] section Section + * \return string + */ +CARES_EXTERN const char *ares_dns_section_tostr(ares_dns_section_t section); + +/*! Convert DNS class name as string to ares_dns_class_t + * + * \param[out] qclass Pointer passed by reference to write class + * \param[in] str String to convert + * \return ARES_TRUE on success + */ +CARES_EXTERN ares_bool_t ares_dns_class_fromstr(ares_dns_class_t *qclass, + const char *str); + +/*! Convert DNS record type as string to ares_dns_rec_type_t + * + * \param[out] qtype Pointer passed by reference to write record type + * \param[in] str String to convert + * \return ARES_TRUE on success + */ +CARES_EXTERN ares_bool_t ares_dns_rec_type_fromstr(ares_dns_rec_type_t *qtype, + const char *str); + + +/*! Convert DNS response code as string to from ares_dns_rcode_t + * + * \param[in] rcode Response code to convert + * \return ARES_TRUE on success + */ +CARES_EXTERN const char *ares_dns_rcode_tostr(ares_dns_rcode_t rcode); + +/*! Convert any valid ip address (ipv4 or ipv6) into struct ares_addr and + * return the starting pointer of the network byte order address and the + * length of the address (4 or 16). + * + * \param[in] ipaddr ASCII string form of the ip address + * \param[in,out] addr Must set "family" member to one of AF_UNSPEC, + * AF_INET, AF_INET6 on input. + * \param[out] out_len Length of binary form address + * \return Pointer to start of binary address or NULL on error. + */ +CARES_EXTERN const void *ares_dns_pton(const char *ipaddr, + struct ares_addr *addr, size_t *out_len); + +/*! Convert an ip address into the PTR format for in-addr.arpa or in6.arpa + * + * \param[in] addr properly filled address structure + * \return String representing PTR, use ares_free_string() to free + */ +CARES_EXTERN char *ares_dns_addr_to_ptr(const struct ares_addr *addr); + + +/*! The options/parameters extensions to some RRs can be somewhat opaque, this + * is a helper to return the best match for a datatype for interpreting the + * option record. + * + * \param[in] key Key associated with options/parameters + * \param[in] opt Option Key/Parameter + * \return Datatype + */ +CARES_EXTERN ares_dns_opt_datatype_t + ares_dns_opt_get_datatype(ares_dns_rr_key_t key, unsigned short opt); + +/*! The options/parameters extensions to some RRs can be somewhat opaque, this + * is a helper to return the name if the option is known. + * + * \param[in] key Key associated with options/parameters + * \param[in] opt Option Key/Parameter + * \return name, or NULL if not known. + */ +CARES_EXTERN const char *ares_dns_opt_get_name(ares_dns_rr_key_t key, + unsigned short opt); + + +/*! Retrieve a list of Resource Record keys that can be set or retrieved for + * the Resource record type. + * + * \param[in] type Record Type + * \param[out] cnt Number of keys returned + * \return array of keys associated with Resource Record + */ +CARES_EXTERN const ares_dns_rr_key_t * + ares_dns_rr_get_keys(ares_dns_rec_type_t type, size_t *cnt); + +/*! Retrieve the datatype associated with a Resource Record key. + * + * \param[in] key Resource Record Key + * \return datatype + */ +CARES_EXTERN ares_dns_datatype_t + ares_dns_rr_key_datatype(ares_dns_rr_key_t key); + +/*! Retrieve the DNS Resource Record type associated with a Resource Record key. + * + * \param[in] key Resource Record Key + * \return DNS Resource Record Type + */ +CARES_EXTERN ares_dns_rec_type_t + ares_dns_rr_key_to_rec_type(ares_dns_rr_key_t key); + +/*! Opaque data type representing a DNS RR (Resource Record) */ +struct ares_dns_rr; + +/*! Typedef for opaque data type representing a DNS RR (Resource Record) */ +typedef struct ares_dns_rr ares_dns_rr_t; + +/*! Opaque data type representing a DNS Query Data QD Packet */ +struct ares_dns_qd; + +/*! Typedef for opaque data type representing a DNS Query Data QD Packet */ +typedef struct ares_dns_qd ares_dns_qd_t; + +/*! Opaque data type representing a DNS Packet */ +struct ares_dns_record; + +/*! Typedef for opaque data type representing a DNS Packet */ +typedef struct ares_dns_record ares_dns_record_t; + + +/*! Create a new DNS record object + * + * \param[out] dnsrec Pointer passed by reference for a newly allocated + * record object. Must be ares_dns_record_destroy()'d by + * caller. + * \param[in] id DNS Query ID. If structuring a new query to be sent + * with ares_send(), this value should be zero. + * \param[in] flags DNS Flags from \ares_dns_flags_t + * \param[in] opcode DNS OpCode (typically ARES_OPCODE_QUERY) + * \param[in] rcode DNS RCode + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_record_create(ares_dns_record_t **dnsrec, + unsigned short id, + unsigned short flags, + ares_dns_opcode_t opcode, + ares_dns_rcode_t rcode); + +/*! Destroy a DNS record object + * + * \param[in] dnsrec Initialized record object + */ +CARES_EXTERN void ares_dns_record_destroy(ares_dns_record_t *dnsrec); + +/*! Get the DNS Query ID + * + * \param[in] dnsrec Initialized record object + * \return DNS query id + */ +CARES_EXTERN unsigned short + ares_dns_record_get_id(const ares_dns_record_t *dnsrec); + +/*! Overwrite the DNS query id + * + * \param[in] dnsrec Initialized record object + * \param[in] id DNS query id + * \return ARES_TRUE on success, ARES_FALSE on usage error + */ +CARES_EXTERN ares_bool_t ares_dns_record_set_id(ares_dns_record_t *dnsrec, + unsigned short id); + +/*! Get the DNS Record Flags + * + * \param[in] dnsrec Initialized record object + * \return One or more \ares_dns_flags_t + */ +CARES_EXTERN unsigned short + ares_dns_record_get_flags(const ares_dns_record_t *dnsrec); + +/*! Get the DNS Record OpCode + * + * \param[in] dnsrec Initialized record object + * \return opcode + */ +CARES_EXTERN ares_dns_opcode_t + ares_dns_record_get_opcode(const ares_dns_record_t *dnsrec); + +/*! Get the DNS Record RCode + * + * \param[in] dnsrec Initialized record object + * \return rcode + */ +CARES_EXTERN ares_dns_rcode_t + ares_dns_record_get_rcode(const ares_dns_record_t *dnsrec); + +/*! Add a query to the DNS Record. Typically a record will have only 1 + * query. Most DNS servers will reject queries with more than 1 question. + * + * \param[in] dnsrec Initialized record object + * \param[in] name Name/Hostname of request + * \param[in] qtype Type of query + * \param[in] qclass Class of query (typically ARES_CLASS_IN) + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec, + const char *name, + ares_dns_rec_type_t qtype, + ares_dns_class_t qclass); + +/*! Replace the question name with a new name. This may be used when performing + * a search with aliases. + * + * Note that this will invalidate the name pointer returned from + * ares_dns_record_query_get(). + * + * \param[in] dnsrec Initialized record object + * \param[in] idx Index of question (typically 0) + * \param[in] name Name to use as replacement. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_record_query_set_name( + ares_dns_record_t *dnsrec, size_t idx, const char *name); + + +/*! Replace the question type with a different type. This may be used when + * needing to query more than one address class (e.g. A and AAAA) + * + * \param[in] dnsrec Initialized record object + * \param[in] idx Index of question (typically 0) + * \param[in] qtype Record Type to use as replacement. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_record_query_set_type( + ares_dns_record_t *dnsrec, size_t idx, ares_dns_rec_type_t qtype); + +/*! Get the count of queries in the DNS Record + * + * \param[in] dnsrec Initialized record object + * \return count of queries + */ +CARES_EXTERN size_t ares_dns_record_query_cnt(const ares_dns_record_t *dnsrec); + +/*! Get the data about the query at the provided index. + * + * \param[in] dnsrec Initialized record object + * \param[in] idx Index of query + * \param[out] name Optional. Returns name, may pass NULL if not desired. + * This pointer will be invalided by any call to + * ares_dns_record_query_set_name(). + * \param[out] qtype Optional. Returns record type, may pass NULL. + * \param[out] qclass Optional. Returns class, may pass NULL. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_record_query_get( + const ares_dns_record_t *dnsrec, size_t idx, const char **name, + ares_dns_rec_type_t *qtype, ares_dns_class_t *qclass); + +/*! Get the count of Resource Records in the provided section + * + * \param[in] dnsrec Initialized record object + * \param[in] sect Section. ARES_SECTION_ANSWER is most used. + * \return count of resource records. + */ +CARES_EXTERN size_t ares_dns_record_rr_cnt(const ares_dns_record_t *dnsrec, + ares_dns_section_t sect); + + +/*! Add a Resource Record to the DNS Record. + * + * \param[out] rr_out Pointer to created resource record. This pointer + * is owned by the DNS record itself, this is just made + * available to facilitate adding RR-specific fields. + * \param[in] dnsrec Initialized record object + * \param[in] sect Section to add resource record to + * \param[in] name Resource Record name/hostname + * \param[in] type Record Type + * \param[in] rclass Class + * \param[in] ttl TTL + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_record_rr_add( + ares_dns_rr_t **rr_out, ares_dns_record_t *dnsrec, ares_dns_section_t sect, + const char *name, ares_dns_rec_type_t type, ares_dns_class_t rclass, + unsigned int ttl); + +/*! Fetch a writable resource record based on the section and index. + * + * \param[in] dnsrec Initialized record object + * \param[in] sect Section for resource record + * \param[in] idx Index of resource record in section + * \return NULL on misuse, otherwise a writable pointer to the resource record + */ +CARES_EXTERN ares_dns_rr_t *ares_dns_record_rr_get(ares_dns_record_t *dnsrec, + ares_dns_section_t sect, + size_t idx); + +/*! Fetch a non-writeable resource record based on the section and index. + * + * \param[in] dnsrec Initialized record object + * \param[in] sect Section for resource record + * \param[in] idx Index of resource record in section + * \return NULL on misuse, otherwise a const pointer to the resource record + */ +CARES_EXTERN const ares_dns_rr_t * + ares_dns_record_rr_get_const(const ares_dns_record_t *dnsrec, + ares_dns_section_t sect, size_t idx); + + +/*! Remove the resource record based on the section and index + * + * \param[in] dnsrec Initialized record object + * \param[in] sect Section for resource record + * \param[in] idx Index of resource record in section + * \return ARES_SUCCESS on success, otherwise an error code. + */ +CARES_EXTERN ares_status_t ares_dns_record_rr_del(ares_dns_record_t *dnsrec, + ares_dns_section_t sect, + size_t idx); + + +/*! Retrieve the resource record Name/Hostname + * + * \param[in] rr Pointer to resource record + * \return Name + */ +CARES_EXTERN const char *ares_dns_rr_get_name(const ares_dns_rr_t *rr); + +/*! Retrieve the resource record type + * + * \param[in] rr Pointer to resource record + * \return type + */ +CARES_EXTERN ares_dns_rec_type_t ares_dns_rr_get_type(const ares_dns_rr_t *rr); + +/*! Retrieve the resource record class + * + * \param[in] rr Pointer to resource record + * \return class + */ +CARES_EXTERN ares_dns_class_t ares_dns_rr_get_class(const ares_dns_rr_t *rr); + +/*! Retrieve the resource record TTL + * + * \param[in] rr Pointer to resource record + * \return TTL + */ +CARES_EXTERN unsigned int ares_dns_rr_get_ttl(const ares_dns_rr_t *rr); + +/*! Set ipv4 address data type for specified resource record and key. Can + * only be used on keys with datatype ARES_DATATYPE_INADDR + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] addr Pointer to ipv4 address to use. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_set_addr(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const struct in_addr *addr); + +/*! Set ipv6 address data type for specified resource record and key. Can + * only be used on keys with datatype ARES_DATATYPE_INADDR6 + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] addr Pointer to ipv6 address to use. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t + ares_dns_rr_set_addr6(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, + const struct ares_in6_addr *addr); + +/*! Set string data for specified resource record and key. Can + * only be used on keys with datatype ARES_DATATYPE_STR or ARES_DATATYPE_NAME. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] val Pointer to string to set. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_set_str(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const char *val); + +/*! Set 8bit unsigned integer for specified resource record and key. Can + * only be used on keys with datatype ARES_DATATYPE_U8 + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] val 8bit unsigned integer + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_set_u8(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned char val); + +/*! Set 16bit unsigned integer for specified resource record and key. Can + * only be used on keys with datatype ARES_DATATYPE_U16 + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] val 16bit unsigned integer + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_set_u16(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short val); + +/*! Set 32bit unsigned integer for specified resource record and key. Can + * only be used on keys with datatype ARES_DATATYPE_U32 + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] val 32bit unsigned integer + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_set_u32(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned int val); + +/*! Set binary (BIN or BINP) data for specified resource record and key. Can + * only be used on keys with datatype ARES_DATATYPE_BIN or ARES_DATATYPE_BINP. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] val Pointer to binary data. + * \param[in] len Length of binary data + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const unsigned char *val, + size_t len); + +/*! Add binary array value (ABINP) data for specified resource record and key. + * Can only be used on keys with datatype ARES_DATATYPE_ABINP. The value will + * Be added as the last element in the array. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] val Pointer to binary data. + * \param[in] len Length of binary data + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const unsigned char *val, + size_t len); + +/*! Delete binary array value (ABINP) data for specified resource record and + * key by specified index. Can only be used on keys with datatype + * ARES_DATATYPE_ABINP. The value at the index will be deleted. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] idx Index to delete + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_del_abin(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + size_t idx); + +/*! Set the option for the RR + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] opt Option record key id. + * \param[out] val Optional. Value to associate with option. + * \param[out] val_len Length of value passed. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_rr_set_opt(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short opt, + const unsigned char *val, + size_t val_len); + +/*! Delete the option for the RR by id + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] opt Option record key id. + * \return ARES_SUCCESS if removed, ARES_ENOTFOUND if not found + */ +CARES_EXTERN ares_status_t ares_dns_rr_del_opt_byid(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short opt); + +/*! Retrieve a pointer to the ipv4 address. Can only be used on keys with + * datatype ARES_DATATYPE_INADDR. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return pointer to ipv4 address or NULL on error + */ +CARES_EXTERN const struct in_addr * + ares_dns_rr_get_addr(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key); + +/*! Retrieve a pointer to the ipv6 address. Can only be used on keys with + * datatype ARES_DATATYPE_INADDR6. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return pointer to ipv6 address or NULL on error + */ +CARES_EXTERN const struct ares_in6_addr * + ares_dns_rr_get_addr6(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key); + +/*! Retrieve a pointer to the string. Can only be used on keys with + * datatype ARES_DATATYPE_STR and ARES_DATATYPE_NAME. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return pointer string or NULL on error + */ +CARES_EXTERN const char *ares_dns_rr_get_str(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +/*! Retrieve an 8bit unsigned integer. Can only be used on keys with + * datatype ARES_DATATYPE_U8. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return 8bit unsigned integer + */ +CARES_EXTERN unsigned char ares_dns_rr_get_u8(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +/*! Retrieve an 16bit unsigned integer. Can only be used on keys with + * datatype ARES_DATATYPE_U16. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return 16bit unsigned integer + */ +CARES_EXTERN unsigned short ares_dns_rr_get_u16(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +/*! Retrieve an 32bit unsigned integer. Can only be used on keys with + * datatype ARES_DATATYPE_U32. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return 32bit unsigned integer + */ +CARES_EXTERN unsigned int ares_dns_rr_get_u32(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +/*! Retrieve a pointer to the binary data. Can only be used on keys with + * datatype ARES_DATATYPE_BIN, ARES_DATATYPE_BINP, or ARES_DATATYPE_ABINP. + * If BINP or ABINP, the data is guaranteed to have a NULL terminator which + * is NOT included in the length. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[out] len Length of binary data returned + * \return pointer binary data or NULL on error + */ +CARES_EXTERN const unsigned char * + ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, + size_t *len); + +/*! Retrieve the count of the array of stored binary values. Can only be used on + * keys with datatype ARES_DATATYPE_ABINP. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return count of values + */ +CARES_EXTERN size_t ares_dns_rr_get_abin_cnt(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +/*! Retrieve a pointer to the binary array data from the specified index. Can + * only be used on keys with datatype ARES_DATATYPE_ABINP. If ABINP, the data + * is guaranteed to have a NULL terminator which is NOT included in the length. + * If want all array membersconcatenated, may use ares_dns_rr_get_bin() + * instead. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] idx Index of value to retrieve + * \param[out] len Length of binary data returned + * \return pointer binary data or NULL on error + */ +CARES_EXTERN const unsigned char * + ares_dns_rr_get_abin(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, + size_t idx, size_t *len); + + +/*! Retrieve the number of options stored for the RR. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \return count, or 0 if none. + */ +CARES_EXTERN size_t ares_dns_rr_get_opt_cnt(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +/*! Retrieve the option for the RR by index. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] idx Index of option record + * \param[out] val Optional. Pointer passed by reference to hold value. + * Options may not have values. Value if returned is + * guaranteed to be NULL terminated, however in most + * cases it is not printable. + * \param[out] val_len Optional. Pointer passed by reference to hold value + * length. + * \return option key/id on success, 65535 on misuse. + */ +CARES_EXTERN unsigned short + ares_dns_rr_get_opt(const ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key, + size_t idx, const unsigned char **val, size_t *val_len); + +/*! Retrieve the option for the RR by the option key/id. + * + * \param[in] dns_rr Pointer to resource record + * \param[in] key DNS Resource Record Key + * \param[in] opt Option record key id (this is not the index). + * \param[out] val Optional. Pointer passed by reference to hold value. + * Options may not have values. Value if returned is + * guaranteed to be NULL terminated, however in most cases + * it is not printable. + * \param[out] val_len Optional. Pointer passed by reference to hold value + * length. + * \return ARES_TRUE on success, ARES_FALSE on misuse. + */ +CARES_EXTERN ares_bool_t ares_dns_rr_get_opt_byid(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short opt, + const unsigned char **val, + size_t *val_len); + +/*! Parse a complete DNS message. + * + * \param[in] buf pointer to bytes to be parsed + * \param[in] buf_len Length of buf provided + * \param[in] flags Flags dictating how the message should be parsed. + * \param[out] dnsrec Pointer passed by reference for a new DNS record object + * that must be ares_dns_record_destroy()'d by caller. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_parse(const unsigned char *buf, + size_t buf_len, unsigned int flags, + ares_dns_record_t **dnsrec); + +/*! Write a complete DNS message + * + * \param[in] dnsrec Pointer to initialized and filled DNS record object. + * \param[out] buf Pointer passed by reference to be filled in with with + * DNS message. Must be ares_free()'d by caller. + * \param[out] buf_len Length of returned buffer containing DNS message. + * \return ARES_SUCCESS on success + */ +CARES_EXTERN ares_status_t ares_dns_write(const ares_dns_record_t *dnsrec, + unsigned char **buf, size_t *buf_len); + + +/*! Duplicate a complete DNS message. This does not copy internal members + * (such as the ttl decrement capability). + * + * \param[in] dnsrec Pointer to initialized and filled DNS record object. + * \return duplicated DNS record object, or NULL on out of memory. + */ +CARES_EXTERN ares_dns_record_t * + ares_dns_record_duplicate(const ares_dns_record_t *dnsrec); + +/*! @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ARES_DNS_RECORD_H */ diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_nameser.h b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_nameser.h new file mode 100644 index 0000000000000000000000000000000000000000..cf0e3b2d8abf8a6b8e3beb1c7b973a3d64193414 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_nameser.h @@ -0,0 +1,510 @@ +/* MIT License + * + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ + +#ifndef ARES_NAMESER_H +#define ARES_NAMESER_H + +#include "ares_build.h" + +#ifdef CARES_HAVE_ARPA_NAMESER_H +# include +#endif +#ifdef CARES_HAVE_ARPA_NAMESER_COMPAT_H +# include +#endif + +/* ============================================================================ + * arpa/nameser.h may or may not provide ALL of the below defines, so check + * each one individually and set if not + * ============================================================================ + */ + +#ifndef NS_PACKETSZ +# define NS_PACKETSZ 512 /* maximum packet size */ +#endif + +#ifndef NS_MAXDNAME +# define NS_MAXDNAME 256 /* maximum domain name */ +#endif + +#ifndef NS_MAXCDNAME +# define NS_MAXCDNAME 255 /* maximum compressed domain name */ +#endif + +#ifndef NS_MAXLABEL +# define NS_MAXLABEL 63 +#endif + +#ifndef NS_HFIXEDSZ +# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#endif + +#ifndef NS_QFIXEDSZ +# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#endif + +#ifndef NS_RRFIXEDSZ +# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#endif + +#ifndef NS_INT16SZ +# define NS_INT16SZ 2 +#endif + +#ifndef NS_INADDRSZ +# define NS_INADDRSZ 4 +#endif + +#ifndef NS_IN6ADDRSZ +# define NS_IN6ADDRSZ 16 +#endif + +#ifndef NS_CMPRSFLGS +# define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ +#endif + +#ifndef NS_DEFAULTPORT +# define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ +#endif + +/* ============================================================================ + * arpa/nameser.h should provide these enumerations always, so if not found, + * provide them + * ============================================================================ + */ +#ifndef CARES_HAVE_ARPA_NAMESER_H + +typedef enum __ns_class { + ns_c_invalid = 0, /* Cookie. */ + ns_c_in = 1, /* Internet. */ + ns_c_2 = 2, /* unallocated/unsupported. */ + ns_c_chaos = 3, /* MIT Chaos-net. */ + ns_c_hs = 4, /* MIT Hesiod. */ + /* Query class values which do not appear in resource records */ + ns_c_none = 254, /* for prereq. sections in update requests */ + ns_c_any = 255, /* Wildcard match. */ + ns_c_max = 65536 +} ns_class; + +typedef enum __ns_type { + ns_t_invalid = 0, /* Cookie. */ + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* Ip6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_kx = 36, /* Key Exchange */ + ns_t_cert = 37, /* Certification record */ + ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ + ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ + ns_t_sink = 40, /* Kitchen sink (experimental) */ + ns_t_opt = 41, /* EDNS0 option (meta-RR) */ + ns_t_apl = 42, /* Address prefix list (RFC3123) */ + ns_t_ds = 43, /* Delegation Signer (RFC4034) */ + ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */ + ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */ + ns_t_nsec = 47, /* Next Secure (RFC4034) */ + ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */ + ns_t_tkey = 249, /* Transaction key */ + ns_t_tsig = 250, /* Transaction signature. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_uri = 256, /* Uniform Resource Identifier (RFC7553) */ + ns_t_caa = 257, /* Certification Authority Authorization. */ + ns_t_max = 65536 +} ns_type; + +typedef enum __ns_opcode { + ns_o_query = 0, /* Standard query. */ + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ + ns_o_status = 2, /* Name server status query (unsupported). */ + /* Opcode 3 is undefined/reserved. */ + ns_o_notify = 4, /* Zone change notification. */ + ns_o_update = 5, /* Zone update message. */ + ns_o_max = 6 +} ns_opcode; + +typedef enum __ns_rcode { + ns_r_noerror = 0, /* No error occurred. */ + ns_r_formerr = 1, /* Format error. */ + ns_r_servfail = 2, /* Server failure. */ + ns_r_nxdomain = 3, /* Name error. */ + ns_r_notimpl = 4, /* Unimplemented. */ + ns_r_refused = 5, /* Operation refused. */ + /* these are for BIND_UPDATE */ + ns_r_yxdomain = 6, /* Name exists */ + ns_r_yxrrset = 7, /* RRset exists */ + ns_r_nxrrset = 8, /* RRset does not exist */ + ns_r_notauth = 9, /* Not authoritative for zone */ + ns_r_notzone = 10, /* Zone of record different from zone section */ + ns_r_max = 11, + /* The following are TSIG extended errors */ + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +#endif /* CARES_HAVE_ARPA_NAMESER_H */ + + +/* ============================================================================ + * arpa/nameser_compat.h typically sets these. However on some systems + * arpa/nameser.h does, but may not set all of them. Lets conditionally + * define each + * ============================================================================ + */ + +#ifndef PACKETSZ +# define PACKETSZ NS_PACKETSZ +#endif + +#ifndef MAXDNAME +# define MAXDNAME NS_MAXDNAME +#endif + +#ifndef MAXCDNAME +# define MAXCDNAME NS_MAXCDNAME +#endif + +#ifndef MAXLABEL +# define MAXLABEL NS_MAXLABEL +#endif + +#ifndef HFIXEDSZ +# define HFIXEDSZ NS_HFIXEDSZ +#endif + +#ifndef QFIXEDSZ +# define QFIXEDSZ NS_QFIXEDSZ +#endif + +#ifndef RRFIXEDSZ +# define RRFIXEDSZ NS_RRFIXEDSZ +#endif + +#ifndef INDIR_MASK +# define INDIR_MASK NS_CMPRSFLGS +#endif + +#ifndef NAMESERVER_PORT +# define NAMESERVER_PORT NS_DEFAULTPORT +#endif + + +/* opcodes */ +#ifndef O_QUERY +# define O_QUERY 0 /* ns_o_query */ +#endif +#ifndef O_IQUERY +# define O_IQUERY 1 /* ns_o_iquery */ +#endif +#ifndef O_STATUS +# define O_STATUS 2 /* ns_o_status */ +#endif +#ifndef O_NOTIFY +# define O_NOTIFY 4 /* ns_o_notify */ +#endif +#ifndef O_UPDATE +# define O_UPDATE 5 /* ns_o_update */ +#endif + + +/* response codes */ +#ifndef SERVFAIL +# define SERVFAIL ns_r_servfail +#endif +#ifndef NOTIMP +# define NOTIMP ns_r_notimpl +#endif +#ifndef REFUSED +# define REFUSED ns_r_refused +#endif +#if defined(_WIN32) && !defined(HAVE_ARPA_NAMESER_COMPAT_H) && defined(NOERROR) +# undef NOERROR /* it seems this is already defined in winerror.h */ +#endif +#ifndef NOERROR +# define NOERROR ns_r_noerror +#endif +#ifndef FORMERR +# define FORMERR ns_r_formerr +#endif +#ifndef NXDOMAIN +# define NXDOMAIN ns_r_nxdomain +#endif +/* Non-standard response codes, use numeric values */ +#ifndef YXDOMAIN +# define YXDOMAIN 6 /* ns_r_yxdomain */ +#endif +#ifndef YXRRSET +# define YXRRSET 7 /* ns_r_yxrrset */ +#endif +#ifndef NXRRSET +# define NXRRSET 8 /* ns_r_nxrrset */ +#endif +#ifndef NOTAUTH +# define NOTAUTH 9 /* ns_r_notauth */ +#endif +#ifndef NOTZONE +# define NOTZONE 10 /* ns_r_notzone */ +#endif +#ifndef TSIG_BADSIG +# define TSIG_BADSIG 16 /* ns_r_badsig */ +#endif +#ifndef TSIG_BADKEY +# define TSIG_BADKEY 17 /* ns_r_badkey */ +#endif +#ifndef TSIG_BADTIME +# define TSIG_BADTIME 18 /* ns_r_badtime */ +#endif + + +/* classes */ +#ifndef C_IN +# define C_IN 1 /* ns_c_in */ +#endif +#ifndef C_CHAOS +# define C_CHAOS 3 /* ns_c_chaos */ +#endif +#ifndef C_HS +# define C_HS 4 /* ns_c_hs */ +#endif +#ifndef C_NONE +# define C_NONE 254 /* ns_c_none */ +#endif +#ifndef C_ANY +# define C_ANY 255 /* ns_c_any */ +#endif + + +/* types */ +#ifndef T_A +# define T_A 1 /* ns_t_a */ +#endif +#ifndef T_NS +# define T_NS 2 /* ns_t_ns */ +#endif +#ifndef T_MD +# define T_MD 3 /* ns_t_md */ +#endif +#ifndef T_MF +# define T_MF 4 /* ns_t_mf */ +#endif +#ifndef T_CNAME +# define T_CNAME 5 /* ns_t_cname */ +#endif +#ifndef T_SOA +# define T_SOA 6 /* ns_t_soa */ +#endif +#ifndef T_MB +# define T_MB 7 /* ns_t_mb */ +#endif +#ifndef T_MG +# define T_MG 8 /* ns_t_mg */ +#endif +#ifndef T_MR +# define T_MR 9 /* ns_t_mr */ +#endif +#ifndef T_NULL +# define T_NULL 10 /* ns_t_null */ +#endif +#ifndef T_WKS +# define T_WKS 11 /* ns_t_wks */ +#endif +#ifndef T_PTR +# define T_PTR 12 /* ns_t_ptr */ +#endif +#ifndef T_HINFO +# define T_HINFO 13 /* ns_t_hinfo */ +#endif +#ifndef T_MINFO +# define T_MINFO 14 /* ns_t_minfo */ +#endif +#ifndef T_MX +# define T_MX 15 /* ns_t_mx */ +#endif +#ifndef T_TXT +# define T_TXT 16 /* ns_t_txt */ +#endif +#ifndef T_RP +# define T_RP 17 /* ns_t_rp */ +#endif +#ifndef T_AFSDB +# define T_AFSDB 18 /* ns_t_afsdb */ +#endif +#ifndef T_X25 +# define T_X25 19 /* ns_t_x25 */ +#endif +#ifndef T_ISDN +# define T_ISDN 20 /* ns_t_isdn */ +#endif +#ifndef T_RT +# define T_RT 21 /* ns_t_rt */ +#endif +#ifndef T_NSAP +# define T_NSAP 22 /* ns_t_nsap */ +#endif +#ifndef T_NSAP_PTR +# define T_NSAP_PTR 23 /* ns_t_nsap_ptr */ +#endif +#ifndef T_SIG +# define T_SIG 24 /* ns_t_sig */ +#endif +#ifndef T_KEY +# define T_KEY 25 /* ns_t_key */ +#endif +#ifndef T_PX +# define T_PX 26 /* ns_t_px */ +#endif +#ifndef T_GPOS +# define T_GPOS 27 /* ns_t_gpos */ +#endif +#ifndef T_AAAA +# define T_AAAA 28 /* ns_t_aaaa */ +#endif +#ifndef T_LOC +# define T_LOC 29 /* ns_t_loc */ +#endif +#ifndef T_NXT +# define T_NXT 30 /* ns_t_nxt */ +#endif +#ifndef T_EID +# define T_EID 31 /* ns_t_eid */ +#endif +#ifndef T_NIMLOC +# define T_NIMLOC 32 /* ns_t_nimloc */ +#endif +#ifndef T_SRV +# define T_SRV 33 /* ns_t_srv */ +#endif +#ifndef T_ATMA +# define T_ATMA 34 /* ns_t_atma */ +#endif +#ifndef T_NAPTR +# define T_NAPTR 35 /* ns_t_naptr */ +#endif +#ifndef T_KX +# define T_KX 36 /* ns_t_kx */ +#endif +#ifndef T_CERT +# define T_CERT 37 /* ns_t_cert */ +#endif +#ifndef T_A6 +# define T_A6 38 /* ns_t_a6 */ +#endif +#ifndef T_DNAME +# define T_DNAME 39 /* ns_t_dname */ +#endif +#ifndef T_SINK +# define T_SINK 40 /* ns_t_sink */ +#endif +#ifndef T_OPT +# define T_OPT 41 /* ns_t_opt */ +#endif +#ifndef T_APL +# define T_APL 42 /* ns_t_apl */ +#endif +#ifndef T_DS +# define T_DS 43 /* ns_t_ds */ +#endif +#ifndef T_SSHFP +# define T_SSHFP 44 /* ns_t_sshfp */ +#endif +#ifndef T_RRSIG +# define T_RRSIG 46 /* ns_t_rrsig */ +#endif +#ifndef T_NSEC +# define T_NSEC 47 /* ns_t_nsec */ +#endif +#ifndef T_DNSKEY +# define T_DNSKEY 48 /* ns_t_dnskey */ +#endif +#ifndef T_TKEY +# define T_TKEY 249 /* ns_t_tkey */ +#endif +#ifndef T_TSIG +# define T_TSIG 250 /* ns_t_tsig */ +#endif +#ifndef T_IXFR +# define T_IXFR 251 /* ns_t_ixfr */ +#endif +#ifndef T_AXFR +# define T_AXFR 252 /* ns_t_axfr */ +#endif +#ifndef T_MAILB +# define T_MAILB 253 /* ns_t_mailb */ +#endif +#ifndef T_MAILA +# define T_MAILA 254 /* ns_t_maila */ +#endif +#ifndef T_ANY +# define T_ANY 255 /* ns_t_any */ +#endif +#ifndef T_URI +# define T_URI 256 /* ns_t_uri */ +#endif +#ifndef T_CAA +# define T_CAA 257 /* ns_t_caa */ +#endif +#ifndef T_MAX +# define T_MAX 65536 /* ns_t_max */ +#endif + + +#endif /* ARES_NAMESER_H */ diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_version.h b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_version.h new file mode 100644 index 0000000000000000000000000000000000000000..006029c12dfe916423c94380812314b1eebdc564 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/include/ares_version.h @@ -0,0 +1,47 @@ +/* MIT License + * + * Copyright (c) Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ + +#ifndef ARES__VERSION_H +#define ARES__VERSION_H + +/* This is the global package copyright */ +#define ARES_COPYRIGHT "2004 - 2025 Daniel Stenberg, ." + +#define ARES_VERSION_MAJOR 1 +#define ARES_VERSION_MINOR 34 +#define ARES_VERSION_PATCH 6 +#define ARES_VERSION_STR "1.34.6" + +/* NOTE: We cannot make the version string a C preprocessor stringify operation + * due to assumptions made by integrators that aren't properly using + * pkgconf or cmake and are doing their own detection based on parsing + * this header */ + +#define ARES_VERSION \ + ((ARES_VERSION_MAJOR << 16) | (ARES_VERSION_MINOR << 8) | \ + (ARES_VERSION_PATCH)) + +#endif diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/about.json b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/about.json new file mode 100644 index 0000000000000000000000000000000000000000..14a6d8f345c9c74cd11df7922660a5119ead6940 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/about.json @@ -0,0 +1,179 @@ +{ + "channels": [ + "https://repo.anaconda.com/pkgs/main", + "https://repo.anaconda.com/pkgs/r", + "https://repo.anaconda.com/pkgs/r" + ], + "conda_build_version": "25.1.2", + "conda_version": "25.1.1", + "description": "c-ares is a C library for asynchronous DNS requests (including name resolves).\n", + "dev_url": "https://github.com/c-ares/c-ares", + "doc_url": "https://c-ares.org/docs.html", + "env_vars": { + "CIO_TEST": "" + }, + "extra": { + "copy_test_source_files": true, + "final": true, + "parent_recipe": { + "name": "c-ares-split", + "path": "/home/task_176907749310659/c-ares-feedstock/recipe", + "version": "1.34.6" + }, + "recipe-maintainers": [ + "ocefpaf", + "wesm", + "xhochy" + ] + }, + "home": "https://c-ares.org", + "identifiers": [], + "keywords": [], + "license": "MIT", + "license_family": "MIT", + "license_file": "LICENSE.md", + "root_pkgs": [ + "_libgcc_mutex 0.1 main", + "ca-certificates 2025.11.4 h06a4308_0", + "ld_impl_linux-64 2.40 h12ee557_0", + "libstdcxx-ng 11.2.0 h1234567_1", + "nlohmann_json 3.11.2 h6a678d5_0", + "pybind11-abi 5 hd3eb1b0_0", + "tzdata 2025a h04d1e81_0", + "libgomp 11.2.0 h1234567_1", + "_openmp_mutex 5.1 1_gnu", + "libgcc-ng 11.2.0 h1234567_1", + "bzip2 1.0.8 h5eee18b_6", + "c-ares 1.19.1 h5eee18b_0", + "cpp-expected 1.1.0 hdb19cb5_0", + "expat 2.7.3 h3385a95_0", + "fmt 9.1.0 hdb19cb5_1", + "icu 73.1 h6a678d5_0", + "libev 4.33 h7f8727e_1", + "libffi 3.4.4 h6a678d5_1", + "libuuid 1.41.5 h5eee18b_0", + "lz4-c 1.9.4 h6a678d5_1", + "ncurses 6.4 h6a678d5_0", + "reproc 14.2.4 h6a678d5_2", + "simdjson 3.10.1 hdb19cb5_0", + "xz 5.4.6 h5eee18b_1", + "yaml-cpp 0.8.0 h6a678d5_1", + "zlib 1.2.13 h5eee18b_1", + "libedit 3.1.20230828 h5eee18b_0", + "libnghttp2 1.57.0 h2d74bed_0", + "libssh2 1.11.1 h251f7ec_0", + "libxml2 2.13.5 hfdd30dd_0", + "pcre2 10.42 hebb0a14_1", + "readline 8.2 h5eee18b_0", + "reproc-cpp 14.2.4 h6a678d5_2", + "spdlog 1.11.0 hdb19cb5_0", + "patch 2.8 hb25bd0a_0", + "zstd 1.5.6 hc292b87_0", + "krb5 1.20.1 h143b758_1", + "libarchive 3.7.7 hfab0078_0", + "libsolv 0.7.30 he621ea3_1", + "sqlite 3.45.3 h5eee18b_0", + "python 3.12.9 h5148396_0", + "libmamba 2.0.5 haf1ee3a_1", + "menuinst 2.2.0 py312h06a4308_1", + "anaconda-anon-usage 0.5.0 py312hfc0e8ea_100", + "annotated-types 0.6.0 py312h06a4308_0", + "archspec 0.2.3 pyhd3eb1b0_0", + "boltons 24.1.0 py312h06a4308_0", + "brotli-python 1.0.9 py312h6a678d5_9", + "charset-normalizer 3.3.2 pyhd3eb1b0_0", + "distro 1.9.0 py312h06a4308_0", + "frozendict 2.4.2 py312h06a4308_0", + "idna 3.7 py312h06a4308_0", + "jsonpointer 2.1 pyhd3eb1b0_0", + "libmambapy 2.0.5 py312hdb19cb5_1", + "mdurl 0.1.0 py312h06a4308_0", + "packaging 24.2 py312h06a4308_0", + "platformdirs 3.10.0 py312h06a4308_0", + "pluggy 1.5.0 py312h06a4308_0", + "pycosat 0.6.6 py312h5eee18b_2", + "pycparser 2.21 pyhd3eb1b0_0", + "pygments 2.15.1 py312h06a4308_1", + "pysocks 1.7.1 py312h06a4308_0", + "ruamel.yaml.clib 0.2.8 py312h5eee18b_0", + "setuptools 75.8.0 py312h06a4308_0", + "tqdm 4.67.1 py312he106c6f_0", + "truststore 0.10.0 py312h06a4308_0", + "typing_extensions 4.12.2 py312h06a4308_0", + "wheel 0.45.1 py312h06a4308_0", + "cffi 1.17.1 py312h1fdaa30_1", + "jsonpatch 1.33 py312h06a4308_1", + "markdown-it-py 2.2.0 py312h06a4308_1", + "pip 25.0 py312h06a4308_0", + "ruamel.yaml 0.18.6 py312h5eee18b_0", + "typing-extensions 4.12.2 py312h06a4308_0", + "urllib3 2.3.0 py312h06a4308_0", + "cryptography 43.0.3 py312h7825ff9_1", + "pydantic-core 2.27.1 py312h4aa5aa6_0", + "requests 2.32.3 py312h06a4308_1", + "rich 13.9.4 py312h06a4308_0", + "zstandard 0.23.0 py312h2c38b39_1", + "conda-content-trust 0.2.0 py312h06a4308_1", + "conda-package-streaming 0.11.0 py312h06a4308_0", + "pydantic 2.10.3 py312h06a4308_0", + "conda-package-handling 2.4.0 py312h06a4308_0", + "conda 25.1.1 py312h06a4308_0", + "conda-anaconda-tos 0.1.2 py312h06a4308_0", + "conda-libmamba-solver 25.1.1 pyhd3eb1b0_0", + "libiconv 1.16 h5eee18b_3", + "liblief 0.12.3 h6a678d5_0", + "libsodium 1.0.20 heac8642_0", + "libunistring 1.3 hb25bd0a_0", + "openssl 3.0.18 hd6dcaed_0", + "patchelf 0.17.2 h6a678d5_0", + "perl 5.40.2 0_h5eee18b_perl5", + "pthread-stubs 0.3 h0ce48e5_1", + "xorg-libxau 1.0.12 h9b100fa_0", + "xorg-libxdmcp 1.1.5 h9b100fa_0", + "xorg-xorgproto 2024.1 h5eee18b_1", + "yaml 0.2.5 h7b6447c_0", + "libxcb 1.17.0 h9b100fa_0", + "gettext 0.21.0 hedfda30_2", + "xorg-libx11 1.8.12 h9b100fa_1", + "libidn2 2.3.8 hf80d704_0", + "tk 8.6.15 h54e0aa7_0", + "libcurl 8.16.0 heebcbe5_0", + "git 2.51.0 pl5382h000ed5b_0", + "argcomplete 3.6.2 py312h06a4308_0", + "attrs 25.4.0 py312h06a4308_2", + "certifi 2025.10.5 py312h06a4308_0", + "chardet 5.2.0 py312h06a4308_0", + "click 8.2.1 py312h06a4308_0", + "filelock 3.20.0 py312h06a4308_0", + "jmespath 1.0.1 py312h06a4308_0", + "markupsafe 3.0.2 py312h5eee18b_0", + "more-itertools 10.8.0 py312h06a4308_0", + "pkginfo 1.12.0 py312h06a4308_0", + "psutil 7.0.0 py312hee96239_1", + "py-lief 0.12.3 py312h6a678d5_0", + "python-libarchive-c 5.1 pyhd3eb1b0_0", + "pytz 2025.2 py312h06a4308_0", + "pyyaml 6.0.2 py312h5eee18b_0", + "rpds-py 0.28.0 py312h498d7c9_0", + "six 1.17.0 py312h06a4308_0", + "soupsieve 2.5 py312h06a4308_0", + "tomlkit 0.13.2 py312h06a4308_0", + "xmltodict 0.14.2 py312h06a4308_0", + "jinja2 3.1.6 py312h06a4308_0", + "python-dateutil 2.9.0post0 py312h06a4308_2", + "referencing 0.37.0 py312h06a4308_0", + "yq 3.4.3 py312h06a4308_0", + "beautifulsoup4 4.13.5 py312h06a4308_0", + "botocore 1.40.54 py312h06a4308_0", + "jsonschema-specifications 2023.7.1 py312h06a4308_1", + "pynacl 1.5.0 py312h2630517_2", + "jsonschema 4.25.0 py312h06a4308_1", + "s3transfer 0.14.0 py312h06a4308_0", + "boto3 1.40.54 py312h06a4308_0", + "conda-anaconda-telemetry 0.3.0 pyhd3eb1b0_1", + "conda-index 0.5.0 py312h06a4308_0", + "conda-build 25.1.2 py312h06a4308_0" + ], + "summary": "This is c-ares, an asynchronous resolver library", + "tags": [] +} \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/files b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/files new file mode 100644 index 0000000000000000000000000000000000000000..0c10760a6a1e19e2896463b738365053b605afda --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/files @@ -0,0 +1,169 @@ +bin/adig +bin/ahost +include/ares.h +include/ares_build.h +include/ares_dns.h +include/ares_dns_record.h +include/ares_nameser.h +include/ares_version.h +lib/cmake/c-ares/c-ares-config-version.cmake +lib/cmake/c-ares/c-ares-config.cmake +lib/cmake/c-ares/c-ares-targets-release.cmake +lib/cmake/c-ares/c-ares-targets.cmake +lib/libcares.so +lib/libcares.so.2 +lib/libcares.so.2.19.5 +lib/pkgconfig/libcares.pc +share/man/man1/adig.1 +share/man/man1/ahost.1 +share/man/man3/ares_cancel.3 +share/man/man3/ares_create_query.3 +share/man/man3/ares_destroy.3 +share/man/man3/ares_destroy_options.3 +share/man/man3/ares_dns_class_fromstr.3 +share/man/man3/ares_dns_class_t.3 +share/man/man3/ares_dns_class_tostr.3 +share/man/man3/ares_dns_datatype_t.3 +share/man/man3/ares_dns_flags_t.3 +share/man/man3/ares_dns_mapping.3 +share/man/man3/ares_dns_opcode_t.3 +share/man/man3/ares_dns_opcode_tostr.3 +share/man/man3/ares_dns_opt_datatype_t.3 +share/man/man3/ares_dns_opt_get_datatype.3 +share/man/man3/ares_dns_opt_get_name.3 +share/man/man3/ares_dns_parse.3 +share/man/man3/ares_dns_rcode_t.3 +share/man/man3/ares_dns_rcode_tostr.3 +share/man/man3/ares_dns_rec_type_fromstr.3 +share/man/man3/ares_dns_rec_type_t.3 +share/man/man3/ares_dns_rec_type_tostr.3 +share/man/man3/ares_dns_record.3 +share/man/man3/ares_dns_record_create.3 +share/man/man3/ares_dns_record_destroy.3 +share/man/man3/ares_dns_record_duplicate.3 +share/man/man3/ares_dns_record_get_flags.3 +share/man/man3/ares_dns_record_get_id.3 +share/man/man3/ares_dns_record_get_opcode.3 +share/man/man3/ares_dns_record_get_rcode.3 +share/man/man3/ares_dns_record_query_add.3 +share/man/man3/ares_dns_record_query_cnt.3 +share/man/man3/ares_dns_record_query_get.3 +share/man/man3/ares_dns_record_query_set_name.3 +share/man/man3/ares_dns_record_query_set_type.3 +share/man/man3/ares_dns_record_rr_add.3 +share/man/man3/ares_dns_record_rr_cnt.3 +share/man/man3/ares_dns_record_rr_del.3 +share/man/man3/ares_dns_record_rr_get.3 +share/man/man3/ares_dns_record_rr_get_const.3 +share/man/man3/ares_dns_record_set_id.3 +share/man/man3/ares_dns_rr.3 +share/man/man3/ares_dns_rr_add_abin.3 +share/man/man3/ares_dns_rr_del_abin.3 +share/man/man3/ares_dns_rr_del_opt_byid.3 +share/man/man3/ares_dns_rr_get_abin.3 +share/man/man3/ares_dns_rr_get_abin_cnt.3 +share/man/man3/ares_dns_rr_get_addr.3 +share/man/man3/ares_dns_rr_get_addr6.3 +share/man/man3/ares_dns_rr_get_bin.3 +share/man/man3/ares_dns_rr_get_class.3 +share/man/man3/ares_dns_rr_get_keys.3 +share/man/man3/ares_dns_rr_get_name.3 +share/man/man3/ares_dns_rr_get_opt.3 +share/man/man3/ares_dns_rr_get_opt_byid.3 +share/man/man3/ares_dns_rr_get_opt_cnt.3 +share/man/man3/ares_dns_rr_get_str.3 +share/man/man3/ares_dns_rr_get_ttl.3 +share/man/man3/ares_dns_rr_get_type.3 +share/man/man3/ares_dns_rr_get_u16.3 +share/man/man3/ares_dns_rr_get_u32.3 +share/man/man3/ares_dns_rr_get_u8.3 +share/man/man3/ares_dns_rr_key_datatype.3 +share/man/man3/ares_dns_rr_key_t.3 +share/man/man3/ares_dns_rr_key_to_rec_type.3 +share/man/man3/ares_dns_rr_key_tostr.3 +share/man/man3/ares_dns_rr_set_addr.3 +share/man/man3/ares_dns_rr_set_addr6.3 +share/man/man3/ares_dns_rr_set_bin.3 +share/man/man3/ares_dns_rr_set_opt.3 +share/man/man3/ares_dns_rr_set_str.3 +share/man/man3/ares_dns_rr_set_u16.3 +share/man/man3/ares_dns_rr_set_u32.3 +share/man/man3/ares_dns_rr_set_u8.3 +share/man/man3/ares_dns_section_t.3 +share/man/man3/ares_dns_section_tostr.3 +share/man/man3/ares_dns_write.3 +share/man/man3/ares_dup.3 +share/man/man3/ares_expand_name.3 +share/man/man3/ares_expand_string.3 +share/man/man3/ares_fds.3 +share/man/man3/ares_free_data.3 +share/man/man3/ares_free_hostent.3 +share/man/man3/ares_free_string.3 +share/man/man3/ares_freeaddrinfo.3 +share/man/man3/ares_get_servers.3 +share/man/man3/ares_get_servers_csv.3 +share/man/man3/ares_get_servers_ports.3 +share/man/man3/ares_getaddrinfo.3 +share/man/man3/ares_gethostbyaddr.3 +share/man/man3/ares_gethostbyname.3 +share/man/man3/ares_gethostbyname_file.3 +share/man/man3/ares_getnameinfo.3 +share/man/man3/ares_getsock.3 +share/man/man3/ares_inet_ntop.3 +share/man/man3/ares_inet_pton.3 +share/man/man3/ares_init.3 +share/man/man3/ares_init_options.3 +share/man/man3/ares_library_cleanup.3 +share/man/man3/ares_library_init.3 +share/man/man3/ares_library_init_android.3 +share/man/man3/ares_library_initialized.3 +share/man/man3/ares_mkquery.3 +share/man/man3/ares_opt_param_t.3 +share/man/man3/ares_parse_a_reply.3 +share/man/man3/ares_parse_aaaa_reply.3 +share/man/man3/ares_parse_caa_reply.3 +share/man/man3/ares_parse_mx_reply.3 +share/man/man3/ares_parse_naptr_reply.3 +share/man/man3/ares_parse_ns_reply.3 +share/man/man3/ares_parse_ptr_reply.3 +share/man/man3/ares_parse_soa_reply.3 +share/man/man3/ares_parse_srv_reply.3 +share/man/man3/ares_parse_txt_reply.3 +share/man/man3/ares_parse_uri_reply.3 +share/man/man3/ares_process.3 +share/man/man3/ares_process_fd.3 +share/man/man3/ares_process_fds.3 +share/man/man3/ares_process_pending_write.3 +share/man/man3/ares_query.3 +share/man/man3/ares_query_dnsrec.3 +share/man/man3/ares_queue.3 +share/man/man3/ares_queue_active_queries.3 +share/man/man3/ares_queue_wait_empty.3 +share/man/man3/ares_reinit.3 +share/man/man3/ares_save_options.3 +share/man/man3/ares_search.3 +share/man/man3/ares_search_dnsrec.3 +share/man/man3/ares_send.3 +share/man/man3/ares_send_dnsrec.3 +share/man/man3/ares_set_local_dev.3 +share/man/man3/ares_set_local_ip4.3 +share/man/man3/ares_set_local_ip6.3 +share/man/man3/ares_set_pending_write_cb.3 +share/man/man3/ares_set_server_state_callback.3 +share/man/man3/ares_set_servers.3 +share/man/man3/ares_set_servers_csv.3 +share/man/man3/ares_set_servers_ports.3 +share/man/man3/ares_set_servers_ports_csv.3 +share/man/man3/ares_set_socket_callback.3 +share/man/man3/ares_set_socket_configure_callback.3 +share/man/man3/ares_set_socket_functions.3 +share/man/man3/ares_set_socket_functions_ex.3 +share/man/man3/ares_set_sortlist.3 +share/man/man3/ares_strerror.3 +share/man/man3/ares_svcb_param_t.3 +share/man/man3/ares_threadsafety.3 +share/man/man3/ares_timeout.3 +share/man/man3/ares_tlsa_match_t.3 +share/man/man3/ares_tlsa_selector_t.3 +share/man/man3/ares_tlsa_usage_t.3 +share/man/man3/ares_version.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/git b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/git new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/has_prefix b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/has_prefix new file mode 100644 index 0000000000000000000000000000000000000000..985a023a05d230ea9224c8853ce9f1f10e3091c5 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/has_prefix @@ -0,0 +1 @@ +/home/task_176907749310659/croot/c-ares-split_1769077612871/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol text lib/pkgconfig/libcares.pc diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/hash_input.json b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/hash_input.json new file mode 100644 index 0000000000000000000000000000000000000000..16d3984d81819baf958c2af8e1e56a4c1aace3c8 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/hash_input.json @@ -0,0 +1,12 @@ +{ + "target_platform": "linux-64", + "cxx_compiler": "gxx", + "c_stdlib": "sysroot", + "gtest": "1.17.0", + "c_stdlib_version": "2.28", + "channel_targets": "defaults", + "c_compiler": "gcc", + "cxx_compiler_version": "14.3.0", + "c_compiler_version": "14.3.0", + "__glibc": "__glibc >=2.28,<3.0.a0" +} \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/index.json b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/index.json new file mode 100644 index 0000000000000000000000000000000000000000..5eccf093b6e1d8e7e400b415b2da363046dcdca1 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/index.json @@ -0,0 +1,17 @@ +{ + "arch": "x86_64", + "build": "hd44998d_0", + "build_number": 0, + "depends": [ + "__glibc >=2.28,<3.0.a0", + "libgcc >=14", + "libstdcxx >=14" + ], + "license": "MIT", + "license_family": "MIT", + "name": "c-ares", + "platform": "linux", + "subdir": "linux-64", + "timestamp": 1769077678178, + "version": "1.34.6" +} \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/licenses/LICENSE.md b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/licenses/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..910ddded5c7a698cbf42c4819d24850aff72d744 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/licenses/LICENSE.md @@ -0,0 +1,24 @@ +MIT License + +Copyright (c) 1998 Massachusetts Institute of Technology +Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS +file. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/paths.json b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/paths.json new file mode 100644 index 0000000000000000000000000000000000000000..ae452878eaa407992798cc43eaa4146ec94ac9a5 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/paths.json @@ -0,0 +1,1021 @@ +{ + "paths": [ + { + "_path": "bin/adig", + "path_type": "hardlink", + "sha256": "e4bb499ccf99c42a7781d2b473b629c2f6bd6a66829edfa24fbc864f17d445a5", + "size_in_bytes": 46360 + }, + { + "_path": "bin/ahost", + "path_type": "hardlink", + "sha256": "1c1f0fad7ebe344f20097bab35b42e2882150698d18ce09ade36332367438473", + "size_in_bytes": 18424 + }, + { + "_path": "include/ares.h", + "path_type": "hardlink", + "sha256": "cb6267f7afd2c23f7d94017110ffd3e14f7d6ddd735a90af6300f38eb9e62f05", + "size_in_bytes": 47978 + }, + { + "_path": "include/ares_build.h", + "path_type": "hardlink", + "sha256": "87b02ffc93afcdbb033d03bafb367e648a5bce6843aca4dad279f9037a7f39a4", + "size_in_bytes": 1091 + }, + { + "_path": "include/ares_dns.h", + "path_type": "hardlink", + "sha256": "608b695de7b23dce0af356ca0cc3ea6f626a2d630de7444ead6e013c9b23aea2", + "size_in_bytes": 5802 + }, + { + "_path": "include/ares_dns_record.h", + "path_type": "hardlink", + "sha256": "5a0f3971b65fdc82e668c2d6cb71ec73c3c83598d1c79164beaf6728abfc1b85", + "size_in_bytes": 47691 + }, + { + "_path": "include/ares_nameser.h", + "path_type": "hardlink", + "sha256": "cbfd9edb0bad63cf7ec9d763f20b72417a266e0c70c00991bf3d975bf187c2c3", + "size_in_bytes": 13359 + }, + { + "_path": "include/ares_version.h", + "path_type": "hardlink", + "sha256": "449e2b9262277290b7f2f26a1fcfcb9412e602eeea12a145afa29e7642302d2c", + "size_in_bytes": 1902 + }, + { + "_path": "lib/cmake/c-ares/c-ares-config-version.cmake", + "path_type": "hardlink", + "sha256": "98aaec79457011d5c7eee14681ddb74f3ef12240615f70610741117ff76e831a", + "size_in_bytes": 2881 + }, + { + "_path": "lib/cmake/c-ares/c-ares-config.cmake", + "path_type": "hardlink", + "sha256": "5e09841a53041bf61a660d2b374b11980e5f75bfebe145cd681edb66c11da045", + "size_in_bytes": 1477 + }, + { + "_path": "lib/cmake/c-ares/c-ares-targets-release.cmake", + "path_type": "hardlink", + "sha256": "e8923d472919b9ce001172210dec4901e22df277104670a088dcf8ae54f753e4", + "size_in_bytes": 844 + }, + { + "_path": "lib/cmake/c-ares/c-ares-targets.cmake", + "path_type": "hardlink", + "sha256": "048c0e61832c4f6525ea1d74ea88a12bc95612b01040569fbe7d5951f0ceb71f", + "size_in_bytes": 4067 + }, + { + "_path": "lib/libcares.so", + "path_type": "softlink", + "sha256": "cd173db3083de9a25e10f7da09ac69d5df7a3f4a0f40be48ce741cf0890c16e8", + "size_in_bytes": 323960 + }, + { + "_path": "lib/libcares.so.2", + "path_type": "softlink", + "sha256": "cd173db3083de9a25e10f7da09ac69d5df7a3f4a0f40be48ce741cf0890c16e8", + "size_in_bytes": 323960 + }, + { + "_path": "lib/libcares.so.2.19.5", + "path_type": "hardlink", + "sha256": "cd173db3083de9a25e10f7da09ac69d5df7a3f4a0f40be48ce741cf0890c16e8", + "size_in_bytes": 323960 + }, + { + "_path": "lib/pkgconfig/libcares.pc", + "file_mode": "text", + "path_type": "hardlink", + "prefix_placeholder": "/home/task_176907749310659/croot/c-ares-split_1769077612871/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol", + "sha256": "9a947d0f7e6ef3447b69248d34dd58d2d473326aeadf07cc73755fc8cdd39568", + "size_in_bytes": 932 + }, + { + "_path": "share/man/man1/adig.1", + "path_type": "hardlink", + "sha256": "0c75b99760a3b4b687d36c224a0d85cba4047e8d29353c728f3e3c20603d20cd", + "size_in_bytes": 4555 + }, + { + "_path": "share/man/man1/ahost.1", + "path_type": "hardlink", + "sha256": "8c3e6294f826b99960c79b28980d563ce895d5230f5d76cba46e802656bb678c", + "size_in_bytes": 1306 + }, + { + "_path": "share/man/man3/ares_cancel.3", + "path_type": "hardlink", + "sha256": "fbdba5ebc6bccc69284e4abed5e2b1fc45d95dba1ff7f169907cfb66b9fa84d9", + "size_in_bytes": 1003 + }, + { + "_path": "share/man/man3/ares_create_query.3", + "path_type": "hardlink", + "sha256": "efd25b08cd0a69a63dd2e49f92a2811d5700b05fdb055df88cbc89ae06e28715", + "size_in_bytes": 2433 + }, + { + "_path": "share/man/man3/ares_destroy.3", + "path_type": "hardlink", + "sha256": "97522a19f90d1d7f256ce4f3eabcdd0513570ca308fe630cb2cc1dbf2dc6b571", + "size_in_bytes": 986 + }, + { + "_path": "share/man/man3/ares_destroy_options.3", + "path_type": "hardlink", + "sha256": "45ace9c71aef2a9a36cb26118ae2519875bce3ae69b1f7282fb2709cdd84f3a3", + "size_in_bytes": 574 + }, + { + "_path": "share/man/man3/ares_dns_class_fromstr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_class_t.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_class_tostr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_datatype_t.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_flags_t.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_mapping.3", + "path_type": "hardlink", + "sha256": "4e5b98c559ee0a178141f9ef8d4fc1e99f4489f824c269d17266cfeba01db713", + "size_in_bytes": 10832 + }, + { + "_path": "share/man/man3/ares_dns_opcode_t.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_opcode_tostr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_opt_datatype_t.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_opt_get_datatype.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_opt_get_name.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_parse.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_rcode_t.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_rcode_tostr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_rec_type_fromstr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_rec_type_t.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_rec_type_tostr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_record.3", + "path_type": "hardlink", + "sha256": "aa5a563c343e26504e9dd0d28df710d23f5fb2a8f8ec1d66f819f99b5978bb31", + "size_in_bytes": 13958 + }, + { + "_path": "share/man/man3/ares_dns_record_create.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_destroy.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_duplicate.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_get_flags.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_get_id.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_get_opcode.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_get_rcode.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_query_add.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_query_cnt.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_query_get.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_query_set_name.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_query_set_type.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_record_rr_add.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_record_rr_cnt.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_record_rr_del.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_record_rr_get.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_record_rr_get_const.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_record_set_id.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dns_rr.3", + "path_type": "hardlink", + "sha256": "482cc045b0dc9905aabd55ead996789a058b1d03bba36d612dd494be0c10a2c3", + "size_in_bytes": 26524 + }, + { + "_path": "share/man/man3/ares_dns_rr_add_abin.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_del_abin.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_del_opt_byid.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_abin.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_abin_cnt.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_addr.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_addr6.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_bin.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_class.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_keys.3", + "path_type": "hardlink", + "sha256": "376a67065ac66121f486f5e59065d67ea8284135fdf4e3b404b968f18ddd6b4f", + "size_in_bytes": 125 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_name.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_opt.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_opt_byid.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_opt_cnt.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_str.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_ttl.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_type.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_u16.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_u32.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_get_u8.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_key_datatype.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_rr_key_t.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_key_to_rec_type.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_rr_key_tostr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_addr.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_addr6.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_bin.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_opt.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_str.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_u16.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_u32.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_rr_set_u8.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_section_t.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_dns_section_tostr.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_dns_write.3", + "path_type": "hardlink", + "sha256": "5e94c4ba5001ca51727307516cf1e03a91e28426a89118c80c3f120d215ad034", + "size_in_bytes": 124 + }, + { + "_path": "share/man/man3/ares_dup.3", + "path_type": "hardlink", + "sha256": "0f447b6802590a792ad3cf61b8d9ca5d5248c395037c15413a19f6e3463efb08", + "size_in_bytes": 794 + }, + { + "_path": "share/man/man3/ares_expand_name.3", + "path_type": "hardlink", + "sha256": "02620e789f0b76a753cdbac615d92c533b19ad482b21b5c6a190685e4604dee6", + "size_in_bytes": 1478 + }, + { + "_path": "share/man/man3/ares_expand_string.3", + "path_type": "hardlink", + "sha256": "d92707bd2dabee47cc401ba046faded9eef1d6085c2faa9895ecfc6eae2aba45", + "size_in_bytes": 1399 + }, + { + "_path": "share/man/man3/ares_fds.3", + "path_type": "hardlink", + "sha256": "842de72177053953c9bc977ceeef522cb073b949b538f650373e71be282fbd6a", + "size_in_bytes": 2496 + }, + { + "_path": "share/man/man3/ares_free_data.3", + "path_type": "hardlink", + "sha256": "a7948a661b6c3aa6ff7f19974ac96af2b33efd50ecf6e92c2316edaba20f1000", + "size_in_bytes": 2359 + }, + { + "_path": "share/man/man3/ares_free_hostent.3", + "path_type": "hardlink", + "sha256": "d1d0430b116951ff09cc478eff4db3d25d7effc8f8698165ff723936046d75c6", + "size_in_bytes": 903 + }, + { + "_path": "share/man/man3/ares_free_string.3", + "path_type": "hardlink", + "sha256": "fad78639f50f62ef6252179013e501d885dc2462b36c49902aa4d25d9ac9bc4f", + "size_in_bytes": 458 + }, + { + "_path": "share/man/man3/ares_freeaddrinfo.3", + "path_type": "hardlink", + "sha256": "2dcb5eb0c86ab3f75c0dc1062d1c068efe42993ee7d4dd893d354437096ab5c6", + "size_in_bytes": 500 + }, + { + "_path": "share/man/man3/ares_get_servers.3", + "path_type": "hardlink", + "sha256": "faaed972b9bb38e735364c1600ce16611b1c814c0693f2e7ad55f72f055976ce", + "size_in_bytes": 2444 + }, + { + "_path": "share/man/man3/ares_get_servers_csv.3", + "path_type": "hardlink", + "sha256": "c0c096e1154561bc1ca071c54d9151397a742b422fa9ad39263e69d1be943e5b", + "size_in_bytes": 103 + }, + { + "_path": "share/man/man3/ares_get_servers_ports.3", + "path_type": "hardlink", + "sha256": "b63009d1813bf637151bf00a05aca08e973141fe1cac4db5a7185783bc097f2f", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_getaddrinfo.3", + "path_type": "hardlink", + "sha256": "972a94493345d7726154cc5b259a4df541adbd4c0e0f8ca715691e8fb55307bb", + "size_in_bytes": 5238 + }, + { + "_path": "share/man/man3/ares_gethostbyaddr.3", + "path_type": "hardlink", + "sha256": "a263fc3b227294c9472a1833008e215d5c0c7eb243ad492089d271643c6e3fda", + "size_in_bytes": 2895 + }, + { + "_path": "share/man/man3/ares_gethostbyname.3", + "path_type": "hardlink", + "sha256": "1d42e5a7009ccad634bbe5c7073ea76e98c9ec63efcb76c0b022f77fc43daf2b", + "size_in_bytes": 3118 + }, + { + "_path": "share/man/man3/ares_gethostbyname_file.3", + "path_type": "hardlink", + "sha256": "981e7bb2bee410746f06539739aac50876610e6d613e10d709e7a54cb6978c34", + "size_in_bytes": 1908 + }, + { + "_path": "share/man/man3/ares_getnameinfo.3", + "path_type": "hardlink", + "sha256": "ab9c710018d6cae00c66f0b42e499b2d303c38d74901e2262f5afee5418d0c26", + "size_in_bytes": 4231 + }, + { + "_path": "share/man/man3/ares_getsock.3", + "path_type": "hardlink", + "sha256": "af6875d8f57519a3dab031a29681d3c0fbe5421f195b4b628615cace634309c6", + "size_in_bytes": 1913 + }, + { + "_path": "share/man/man3/ares_inet_ntop.3", + "path_type": "hardlink", + "sha256": "e62bbd4f2e44ff4ed3d0403029bbacd9aa289f75405f02b1765fee31d084e4ac", + "size_in_bytes": 1346 + }, + { + "_path": "share/man/man3/ares_inet_pton.3", + "path_type": "hardlink", + "sha256": "0a2bb9844122b8f68d21dd3349a35809531ccf5d938a2e6d4b6cd48f3c567bac", + "size_in_bytes": 1303 + }, + { + "_path": "share/man/man3/ares_init.3", + "path_type": "hardlink", + "sha256": "6cfd7938c69c82973a2f026a7c82cd63269fa1d927c498650bfe7ba78bd6b54c", + "size_in_bytes": 126 + }, + { + "_path": "share/man/man3/ares_init_options.3", + "path_type": "hardlink", + "sha256": "d8dddeed1f922fa8f82a26ed68e9950a20d7eff49044fa357c0e210c9de44ce0", + "size_in_bytes": 14976 + }, + { + "_path": "share/man/man3/ares_library_cleanup.3", + "path_type": "hardlink", + "sha256": "646f7e038b355a32e83d9e67aa0cc0c515a34c0bf8cb15e0c099b1f2299b98ca", + "size_in_bytes": 2982 + }, + { + "_path": "share/man/man3/ares_library_init.3", + "path_type": "hardlink", + "sha256": "b3e6369ddfcff1b23b685e7e421f2bbd43daf885b110845b58d96fc637c3ab86", + "size_in_bytes": 4036 + }, + { + "_path": "share/man/man3/ares_library_init_android.3", + "path_type": "hardlink", + "sha256": "ff607997c7203c6f1bbc2c0196e00760c9f8117a88e71b43c59152c5cfb1dc71", + "size_in_bytes": 4549 + }, + { + "_path": "share/man/man3/ares_library_initialized.3", + "path_type": "hardlink", + "sha256": "4f881001aaed83dfa34a83b4f66bde194e39b188640bf15267e6b5cf8f3406d1", + "size_in_bytes": 605 + }, + { + "_path": "share/man/man3/ares_mkquery.3", + "path_type": "hardlink", + "sha256": "de017cfce17afe62b2f60b1a658420f7cf6ea346410fa55d6953d9abf542595d", + "size_in_bytes": 2139 + }, + { + "_path": "share/man/man3/ares_opt_param_t.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_parse_a_reply.3", + "path_type": "hardlink", + "sha256": "25fbe3555a76f8e655e41c9bbbf6d78486677cfcf41eeab85b46a6a55ec632a3", + "size_in_bytes": 1638 + }, + { + "_path": "share/man/man3/ares_parse_aaaa_reply.3", + "path_type": "hardlink", + "sha256": "eea1002355e1caa2b8a34df6dd3a4f65747f0861168bd4c17dc47aacdcfb7a33", + "size_in_bytes": 1649 + }, + { + "_path": "share/man/man3/ares_parse_caa_reply.3", + "path_type": "hardlink", + "sha256": "f6a93985dac017636898ee05dd2ed407c8c34f7152018c858401a209375bd49c", + "size_in_bytes": 3871 + }, + { + "_path": "share/man/man3/ares_parse_mx_reply.3", + "path_type": "hardlink", + "sha256": "6125c20302bea0504bc2e75a99a7eea7ad8b16169e2ed19fb94436004674518f", + "size_in_bytes": 1512 + }, + { + "_path": "share/man/man3/ares_parse_naptr_reply.3", + "path_type": "hardlink", + "sha256": "10258e689bbbd47ee4431989acb5689ee93039be030c003775b130fe9b807991", + "size_in_bytes": 1683 + }, + { + "_path": "share/man/man3/ares_parse_ns_reply.3", + "path_type": "hardlink", + "sha256": "320262e6e4aca8f88b5ce838bba742a2d44e2976c96a1e29612f69a629523fc0", + "size_in_bytes": 1306 + }, + { + "_path": "share/man/man3/ares_parse_ptr_reply.3", + "path_type": "hardlink", + "sha256": "baa124b2901798db999b07a4753bc9b2b16cf2b0c0531692c9a72e520835f1a9", + "size_in_bytes": 1538 + }, + { + "_path": "share/man/man3/ares_parse_soa_reply.3", + "path_type": "hardlink", + "sha256": "80c91d33954dca6453796e48782524f2d8e14f592b0296515dc1c0e0ef0fd575", + "size_in_bytes": 1584 + }, + { + "_path": "share/man/man3/ares_parse_srv_reply.3", + "path_type": "hardlink", + "sha256": "4428692525f286bc7befc1bbaf5cd40d2e20c44a3d6320a85e6b9f40f92848e8", + "size_in_bytes": 1585 + }, + { + "_path": "share/man/man3/ares_parse_txt_reply.3", + "path_type": "hardlink", + "sha256": "1857e8ed4bf95220e94a22e18f02773f917dda94fe8bd59877863d0ded36fc20", + "size_in_bytes": 2619 + }, + { + "_path": "share/man/man3/ares_parse_uri_reply.3", + "path_type": "hardlink", + "sha256": "4ece9d079e8750aa2e652e5871bd08d5ebcf317a528898271121dcaaf16261d2", + "size_in_bytes": 1575 + }, + { + "_path": "share/man/man3/ares_process.3", + "path_type": "hardlink", + "sha256": "fd8ac05c1cb09e189bb14bdff64ee79ea08cd281862a69aaa4731c7f1813a33a", + "size_in_bytes": 4947 + }, + { + "_path": "share/man/man3/ares_process_fd.3", + "path_type": "hardlink", + "sha256": "380dfe14f30aae8abe59b8fc085b7d44db3310628b7c60854ef3dfd92ce57f3c", + "size_in_bytes": 121 + }, + { + "_path": "share/man/man3/ares_process_fds.3", + "path_type": "hardlink", + "sha256": "380dfe14f30aae8abe59b8fc085b7d44db3310628b7c60854ef3dfd92ce57f3c", + "size_in_bytes": 121 + }, + { + "_path": "share/man/man3/ares_process_pending_write.3", + "path_type": "hardlink", + "sha256": "2185f28807a35a222412eaa307daa4fffd22e9c6b9b893bef77dbf19255ebe66", + "size_in_bytes": 134 + }, + { + "_path": "share/man/man3/ares_query.3", + "path_type": "hardlink", + "sha256": "695ede4ce801a28b39dac037b5c2f037431753f21417b94967477dd22dbc6bed", + "size_in_bytes": 5013 + }, + { + "_path": "share/man/man3/ares_query_dnsrec.3", + "path_type": "hardlink", + "sha256": "ac00649873cfe6bc5c50ee32a1459c32d382e20ac0333a2c4ca406bd9e7b84da", + "size_in_bytes": 119 + }, + { + "_path": "share/man/man3/ares_queue.3", + "path_type": "hardlink", + "sha256": "1b99e7a0f3c5158ed667971d7d8b7f2a2251556eef28954d5b0748e871a0d1ca", + "size_in_bytes": 1693 + }, + { + "_path": "share/man/man3/ares_queue_active_queries.3", + "path_type": "hardlink", + "sha256": "8aedad2db6afe9862248ab4d01802c3faeb9edb86c5fc4ad5b27ff1d299d13e7", + "size_in_bytes": 119 + }, + { + "_path": "share/man/man3/ares_queue_wait_empty.3", + "path_type": "hardlink", + "sha256": "8aedad2db6afe9862248ab4d01802c3faeb9edb86c5fc4ad5b27ff1d299d13e7", + "size_in_bytes": 119 + }, + { + "_path": "share/man/man3/ares_reinit.3", + "path_type": "hardlink", + "sha256": "4c756faa5dd539f0b37e35ee6b5a849a1e5a5fc5b33df97d8aa28faccce716d3", + "size_in_bytes": 1774 + }, + { + "_path": "share/man/man3/ares_save_options.3", + "path_type": "hardlink", + "sha256": "e0f7b503516fb1347aef0a40141468edb0126b5d1229f0cc4179b453cdb9407b", + "size_in_bytes": 2026 + }, + { + "_path": "share/man/man3/ares_search.3", + "path_type": "hardlink", + "sha256": "535db478c0339cfc5ddda6894d6478b51ce2e732eabaf6457c8566c026025f8b", + "size_in_bytes": 6052 + }, + { + "_path": "share/man/man3/ares_search_dnsrec.3", + "path_type": "hardlink", + "sha256": "9f155e01d1d14b4a18f315260d1f63fa6df3e60a375415dc6910a9bc5029ed63", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_send.3", + "path_type": "hardlink", + "sha256": "95c50849b4604ae65a709a20d5489ccc769b17b694ffa7bc6a510defabac645d", + "size_in_bytes": 4866 + }, + { + "_path": "share/man/man3/ares_send_dnsrec.3", + "path_type": "hardlink", + "sha256": "53d7951c9adad22f109d2c5a5c7a8eaa63ea7d587ca5a8326a23e3ed8113e5ef", + "size_in_bytes": 118 + }, + { + "_path": "share/man/man3/ares_set_local_dev.3", + "path_type": "hardlink", + "sha256": "781d49503438e98315c8854e9ef9aed203d1d3d9c22664d254b109f2be6e441d", + "size_in_bytes": 1087 + }, + { + "_path": "share/man/man3/ares_set_local_ip4.3", + "path_type": "hardlink", + "sha256": "59356e91420a2b7df6c5cb061712472288ee620c791dd2bcc0d9903a34939044", + "size_in_bytes": 671 + }, + { + "_path": "share/man/man3/ares_set_local_ip6.3", + "path_type": "hardlink", + "sha256": "4f2f7831cca2dca601548e49a028c507b0d0194cf5c5ea72cab6d385e386ba68", + "size_in_bytes": 748 + }, + { + "_path": "share/man/man3/ares_set_pending_write_cb.3", + "path_type": "hardlink", + "sha256": "01d4be5cc829ac70771e61a5af8553ee6ff2a176a9ecf2f5f2cae85ec968b1b9", + "size_in_bytes": 2644 + }, + { + "_path": "share/man/man3/ares_set_server_state_callback.3", + "path_type": "hardlink", + "sha256": "df88304705be3e8255a9a6a70d419ac1baf38114f6f49cc7c3523c2b95d6fe4b", + "size_in_bytes": 2388 + }, + { + "_path": "share/man/man3/ares_set_servers.3", + "path_type": "hardlink", + "sha256": "d77dd54db26671a0f4b40811ed6cfd6e184fc6d046db064058134b16b1888165", + "size_in_bytes": 3041 + }, + { + "_path": "share/man/man3/ares_set_servers_csv.3", + "path_type": "hardlink", + "sha256": "eeac437412d011fe1252e15b8bc9f66ab9dcc4d97b9333e4ab23927e26fec7d3", + "size_in_bytes": 5344 + }, + { + "_path": "share/man/man3/ares_set_servers_ports.3", + "path_type": "hardlink", + "sha256": "d360fe772abba0319c38d114bd638d03d8d6dc282de790049465aedeb9203e37", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_set_servers_ports_csv.3", + "path_type": "hardlink", + "sha256": "c0c096e1154561bc1ca071c54d9151397a742b422fa9ad39263e69d1be943e5b", + "size_in_bytes": 103 + }, + { + "_path": "share/man/man3/ares_set_socket_callback.3", + "path_type": "hardlink", + "sha256": "82133aa9fa84d3cadb4169ff62a8966ef08878cb0d296adb571f415d7608514d", + "size_in_bytes": 1125 + }, + { + "_path": "share/man/man3/ares_set_socket_configure_callback.3", + "path_type": "hardlink", + "sha256": "9753c4b3bdecc797c2b3a6098a99c668e4766de95e66b110923f1b5f0d75b7ca", + "size_in_bytes": 1321 + }, + { + "_path": "share/man/man3/ares_set_socket_functions.3", + "path_type": "hardlink", + "sha256": "dcd07a480a52e10dd76f12f7c8cf7d3a2d5b95f3c7aa824a7dbbfd413f7fa115", + "size_in_bytes": 13268 + }, + { + "_path": "share/man/man3/ares_set_socket_functions_ex.3", + "path_type": "hardlink", + "sha256": "9819dba11388182fe0c083df93459bd6092581397733d53da9ec872a0df9c9e1", + "size_in_bytes": 134 + }, + { + "_path": "share/man/man3/ares_set_sortlist.3", + "path_type": "hardlink", + "sha256": "5763de05a53c94eb4f6f01bee00ad8f6331b764f789a576ce0a15919ae92df7e", + "size_in_bytes": 1436 + }, + { + "_path": "share/man/man3/ares_strerror.3", + "path_type": "hardlink", + "sha256": "297028151d7f049c2e5b9ef70e800fafe9ddef24c98b0a98d7a0ce19052e1e0c", + "size_in_bytes": 551 + }, + { + "_path": "share/man/man3/ares_svcb_param_t.3", + "path_type": "hardlink", + "sha256": "bfdb0282a27006c86439f7794f084bb80ee435e0645433a317e423be74b86689", + "size_in_bytes": 99 + }, + { + "_path": "share/man/man3/ares_threadsafety.3", + "path_type": "hardlink", + "sha256": "1b8e51a7d94c34af049a8476007bcaa297e62990fb5eb0df74e7ab907b90e36c", + "size_in_bytes": 1249 + }, + { + "_path": "share/man/man3/ares_timeout.3", + "path_type": "hardlink", + "sha256": "853e4793e4849b531c92e4775a9e8d1932beec1c4d2a8f5a853de690749bc2ee", + "size_in_bytes": 1219 + }, + { + "_path": "share/man/man3/ares_tlsa_match_t.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_tlsa_selector_t.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_tlsa_usage_t.3", + "path_type": "hardlink", + "sha256": "ddd98490864f92d4d34c3ff88e6a3b560a3563c87c13be1dc42ff41f97b247eb", + "size_in_bytes": 120 + }, + { + "_path": "share/man/man3/ares_version.3", + "path_type": "hardlink", + "sha256": "4a3f55955974054b91cbdb07cbd12a946476e4bf4566adcbd200570303fb4930", + "size_in_bytes": 767 + } + ], + "paths_version": 1 +} \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/build_output.sh b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/build_output.sh new file mode 100644 index 0000000000000000000000000000000000000000..0d4215830096bb4cb36b5b9d49289d80bc8b4649 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/build_output.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -ex + +echo "Building ${PKG_NAME}." + +# Isolate the build. +mkdir build && cd build + +if [[ "$PKG_NAME" == *static ]]; then + CARES_STATIC=ON + CARES_SHARED=OFF +else + CARES_STATIC=OFF + CARES_SHARED=ON +fi + +if [[ "${target_platform}" == linux-* ]]; then + CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_AR=${AR}" +fi + +echo "Generating the build files..." +cmake ${CMAKE_ARGS} -G"$CMAKE_GENERATOR" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCARES_STATIC=${CARES_STATIC} \ + -DCARES_SHARED=${CARES_SHARED} \ + -DCARES_INSTALL=ON \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -GNinja \ + -DCARES_BUILD_TESTS=ON \ + ${SRC_DIR} + +echo "Installing..." +cmake --build . --config Release --target install + +echo "Testing..." +ctest -R aresfuzz --output-on-failure -j${CPU_COUNT} +ctest -R aresfuzzname --output-on-failure -j${CPU_COUNT} +# 1/1 Test #1: arestest .........................Bus error***Exception +# ctest -R arestest --output-on-failure --extra-verbose -j${CPU_COUNT} + +echo "Error free exit!" +exit 0 \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/conda_build_config.yaml b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/conda_build_config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a135e39f0e54f1e384c624a5bbf0ab09f7870a3f --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/conda_build_config.yaml @@ -0,0 +1,33 @@ +c_compiler: gcc +c_compiler_version: 14.3.0 +c_stdlib: sysroot +c_stdlib_version: '2.28' +channel_targets: defaults +cpu_optimization_target: nocona +cran_mirror: https://cran.r-project.org +cxx_compiler: gxx +cxx_compiler_version: 14.3.0 +extend_keys: +- extend_keys +- ignore_version +- pin_run_as_build +- ignore_build_only_deps +fortran_compiler: gfortran +gtest: 1.17.0 +ignore_build_only_deps: +- python +- numpy +lua: '5' +numpy: '1.26' +perl: 5.26.2 +pin_run_as_build: + python: + max_pin: x.x + min_pin: x.x + r-base: + max_pin: x.x + min_pin: x.x +platform: linux-64 +python: '3.11' +r_base: '3.5' +target_platform: linux-64 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/meta.yaml b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..02a13184020ae2f250541c80105abfce880eb99c --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/meta.yaml @@ -0,0 +1,101 @@ +# This file created by conda-build 25.1.2 +# ------------------------------------------------ + +package: + name: c-ares + version: 1.34.6 +source: + sha256: 4358939ff800b13b92f37d5fdda003718101faedfbdee792d6b79ddc1a53d890 + url: https://github.com/c-ares/c-ares/archive/refs/tags/v1.34.6.tar.gz +build: + number: 0 + run_exports: + - c-ares >=1.34.6,<2.0a0 + string: hd44998d_0 +requirements: + build: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - binutils_impl_linux-64 2.44 h4b9a079_2 + - binutils_linux-64 2.44 hc03a8fd_2 + - bzip2 1.0.8 h5eee18b_6 + - ca-certificates 2025.12.2 h06a4308_0 + - cmake-no-system 3.25.3 h6a678d5_0 + - gcc_impl_linux-64 14.3.0 h4943218_4 + - gcc_linux-64 14.3.0 hda73cce_12 + - gtest 1.17.0 h5f83a47_0 + - gxx_impl_linux-64 14.3.0 he634eba_4 + - gxx_linux-64 14.3.0 hca8765c_12 + - kernel-headers_linux-64 4.18.0 h3108a97_1 + - ld_impl_linux-64 2.44 h153f514_2 + - libexpat 2.7.3 h7354ed3_4 + - libffi 3.4.4 h6a678d5_1 + - libgcc 15.2.0 h69a1729_7 + - libgcc-devel_linux-64 14.3.0 he7458c1_104 + - libgcc-ng 15.2.0 h166f726_7 + - libgomp 15.2.0 h4751f2c_7 + - libmpdec 4.0.0 h5eee18b_0 + - libsanitizer 14.3.0 hd4faa28_4 + - libstdcxx 15.2.0 h39759b7_7 + - libstdcxx-devel_linux-64 14.3.0 he7458c1_104 + - libstdcxx-ng 15.2.0 hc03a8fd_7 + - libuuid 1.41.5 h5eee18b_0 + - libxcb 1.17.0 h9b100fa_0 + - libzlib 1.3.1 hb25bd0a_0 + - lz4-c 1.9.4 h6a678d5_1 + - ncurses 6.5 h7934f7d_0 + - ninja 1.13.1 h06a4308_0 + - ninja-base 1.13.1 h0f57076_0 + - openssl 3.0.18 hd6dcaed_0 + - pthread-stubs 0.3 h0ce48e5_1 + - python 3.14.2 h90eec9f_101_cp314 + - python_abi 3.14 2_cp314 + - readline 8.3 hc2a1206_0 + - sqlite 3.51.1 he0a8d7e_0 + - sysroot_linux-64 2.28 h3108a97_1 + - tk 8.6.15 h54e0aa7_0 + - tzdata 2025c he532380_0 + - xorg-libx11 1.8.12 h9b100fa_1 + - xorg-libxau 1.0.12 h9b100fa_0 + - xorg-libxdmcp 1.1.5 h9b100fa_0 + - xorg-xorgproto 2024.1 h5eee18b_1 + - xz 5.6.4 h5eee18b_1 + - zlib 1.3.1 hb25bd0a_0 + - zstd 1.5.7 h11fc155_0 + host: + - _libgcc_mutex 0.1 main + - _openmp_mutex 5.1 1_gnu + - libgcc 15.2.0 h69a1729_7 + - libgomp 15.2.0 h4751f2c_7 + - libstdcxx 15.2.0 h39759b7_7 + run: + - __glibc >=2.28,<3.0.a0 + - libgcc >=14 + - libstdcxx >=14 + run_constraint: + - c-ares-static <0a0 +test: + commands: + - test -f ${PREFIX}/include/ares.h + - test -f ${PREFIX}/lib/libcares${SHLIB_EXT} + - test ! -f ${PREFIX}/lib/libcares.a + - test ! -f ${PREFIX}/lib/libcares_static.a +about: + description: 'c-ares is a C library for asynchronous DNS requests (including name + resolves). + + ' + dev_url: https://github.com/c-ares/c-ares + doc_url: https://c-ares.org/docs.html + home: https://c-ares.org + license: MIT + license_family: MIT + license_file: LICENSE.md + summary: This is c-ares, an asynchronous resolver library +extra: + copy_test_source_files: true + final: true + recipe-maintainers: + - ocefpaf + - wesm + - xhochy diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/bld_output.bat b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/bld_output.bat new file mode 100644 index 0000000000000000000000000000000000000000..36e6e2ed3757f504b42f2271df014cee6352e166 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/bld_output.bat @@ -0,0 +1,44 @@ +:: cmd +@echo on +echo "Building %PKG_NAME%." + +set CMAKE_CONFIG=Release + +:: Isolate the build. +mkdir build_%CMAKE_CONFIG% +pushd build_%CMAKE_CONFIG% + +if "%PKG_NAME:~-6%" == "static" ( + set CARES_STATIC=ON + set CARES_BUILD_TESTS=ON + set CARES_SHARED=OFF +) else ( + set CARES_STATIC=OFF + set CARES_BUILD_TESTS=OFF + set CARES_SHARED=ON +) + +echo "Generating the build files..." +cmake -G"NMake Makefiles" ^ + -DCARES_STATIC:BOOL=%CARES_STATIC% ^ + -DCARES_SHARED:BOOL=%CARES_SHARED% ^ + -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^ + -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^ + -DCARES_BUILD_TESTS="%CARES_BUILD_TESTS%" ^ + "%SRC_DIR%" + +echo "Installing..." +cmake --build . --config Release --target install +if errorlevel 1 exit /b 1 + +@REM https://github.com/c-ares/c-ares/blob/v1.34.5/CMakeLists.txt#L57 +if "%PKG_NAME:~-6%" == "static" ( +echo "Testing..." +ctest --output-on-failure +if errorlevel 1 exit /b 1 +) + +popd + +echo "Error free exit!" +exit 0 \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/build_output.sh b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/build_output.sh new file mode 100644 index 0000000000000000000000000000000000000000..0d4215830096bb4cb36b5b9d49289d80bc8b4649 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/build_output.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -ex + +echo "Building ${PKG_NAME}." + +# Isolate the build. +mkdir build && cd build + +if [[ "$PKG_NAME" == *static ]]; then + CARES_STATIC=ON + CARES_SHARED=OFF +else + CARES_STATIC=OFF + CARES_SHARED=ON +fi + +if [[ "${target_platform}" == linux-* ]]; then + CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_AR=${AR}" +fi + +echo "Generating the build files..." +cmake ${CMAKE_ARGS} -G"$CMAKE_GENERATOR" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$PREFIX" \ + -DCARES_STATIC=${CARES_STATIC} \ + -DCARES_SHARED=${CARES_SHARED} \ + -DCARES_INSTALL=ON \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -GNinja \ + -DCARES_BUILD_TESTS=ON \ + ${SRC_DIR} + +echo "Installing..." +cmake --build . --config Release --target install + +echo "Testing..." +ctest -R aresfuzz --output-on-failure -j${CPU_COUNT} +ctest -R aresfuzzname --output-on-failure -j${CPU_COUNT} +# 1/1 Test #1: arestest .........................Bus error***Exception +# ctest -R arestest --output-on-failure --extra-verbose -j${CPU_COUNT} + +echo "Error free exit!" +exit 0 \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/meta.yaml b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/meta.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b427598ce1370ae8e61ffae988f74cfd0b7d00b3 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/recipe/parent/meta.yaml @@ -0,0 +1,94 @@ +{% set version = "1.34.6" %} +{% set name = "c-ares" %} + +package: + name: {{ name|lower }}-split + version: {{ version }} + +source: + url: https://github.com/{{ name }}/{{ name }}/archive/refs/tags/v{{ version }}.tar.gz + sha256: 4358939ff800b13b92f37d5fdda003718101faedfbdee792d6b79ddc1a53d890 +build: + number: 0 + +requirements: + build: + - {{ stdlib('c') }} + - {{ compiler("c") }} + - cmake # [win] + # cmake on unix depends on c-ares. This breaks the cycle. + - cmake-no-system # [unix] + - ninja # [unix] + +outputs: + - name: c-ares + script: build_output.sh # [unix] + script: bld_output.bat # [win] + build: + run_exports: + - {{ pin_subpackage("c-ares", max_pin="x") }} + requirements: + build: + - {{ compiler("c") }} + - {{ stdlib('c') }} + # C++ required for tests during a build. Toolchain-proper + - {{ compiler("cxx") }} + - cmake # [win] + # cmake on unix depends on c-ares. This breaks the cycle. + - cmake-no-system # [unix] + - ninja # [unix] + - gtest + run_constraint: + - c-ares-static <0a0 + test: + commands: + - test -f ${PREFIX}/include/ares.h # [not win] + - test -f ${PREFIX}/lib/libcares${SHLIB_EXT} # [not win] + - test ! -f ${PREFIX}/lib/libcares.a # [not win] + - test ! -f ${PREFIX}/lib/libcares_static.a # [not win] + - if not exist %PREFIX%\\Library\\include\\ares.h exit 1 # [win] + - if not exist %PREFIX%\\Library\\bin\\cares.dll exit 1 # [win] + - if not exist %PREFIX%\\Library\\lib\\cares.lib exit 1 # [win] + - if exist %PREFIX%\\Library\\lib\\cares_static.lib exit 1 # [win] + + - name: c-ares-static + script: build_output.sh # [unix] + script: bld_output.bat # [win] + requirements: + build: + - {{ compiler("c") }} + - {{ stdlib('c') }} + # C++ required for tests during a build. Toolchain-proper + - {{ compiler("cxx") }} + - cmake # [win] + # cmake on unix depends on c-ares. This breaks the cycle. + - cmake-no-system # [unix] + - ninja # [unix] + - gtest + run_constraint: + - c-ares <0a0 + test: + commands: + - test -f ${PREFIX}/lib/libcares.a # [not win] + - test ! -f ${PREFIX}/lib/libcares${SHLIB_EXT} # [not win] + - test -f ${PREFIX}/include/ares.h # [not win] + - if not exist %PREFIX%\\Library\\include\\ares.h exit 1 # [win] + - if exist %PREFIX%\\Library\\bin\\cares.dll exit 1 # [win] + - if not exist %PREFIX%\\Library\\lib\\cares.lib exit 1 # [win] + +about: + home: https://c-ares.org + license: MIT + license_family: MIT + license_file: LICENSE.md + summary: This is c-ares, an asynchronous resolver library + description: | + c-ares is a C library for asynchronous DNS requests (including name resolves). + dev_url: https://github.com/c-ares/c-ares + doc_url: https://c-ares.org/docs.html + +extra: + recipe-maintainers: + - ocefpaf + - wesm + - xhochy diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/repodata_record.json b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/repodata_record.json new file mode 100644 index 0000000000000000000000000000000000000000..0cc0e351d7a3cbb6296480200b0d95d72f420203 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/repodata_record.json @@ -0,0 +1,24 @@ +{ + "arch": "x86_64", + "build": "hd44998d_0", + "build_number": 0, + "channel": "https://repo.anaconda.com/pkgs/main/linux-64/", + "constrains": [], + "depends": [ + "__glibc >=2.28,<3.0.a0", + "libgcc >=14", + "libstdcxx >=14" + ], + "fn": "c-ares-1.34.6-hd44998d_0.conda", + "license": "MIT", + "license_family": "MIT", + "md5": "e16f3bb02771b2e37ea421a3f8ee1ebb", + "name": "c-ares", + "platform": "linux", + "sha256": "a5bdd98c8c2ef2bbe52b0fb018ddda3e62f91b2f96089e66e903052e1e91498e", + "size": 206586, + "subdir": "linux-64", + "timestamp": 1769077678000, + "url": "https://repo.anaconda.com/pkgs/main/linux-64/c-ares-1.34.6-hd44998d_0.conda", + "version": "1.34.6" +} \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/run_exports.json b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/run_exports.json new file mode 100644 index 0000000000000000000000000000000000000000..51e0c3369644f6df5a0cb9cd173cb3b08ae867e0 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/run_exports.json @@ -0,0 +1 @@ +{"weak": ["c-ares >=1.34.6,<2.0a0"]} \ No newline at end of file diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/test/run_test.sh b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/test/run_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..a5a80e6b064af9311f042ea43f080c0a66c9f192 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/info/test/run_test.sh @@ -0,0 +1,11 @@ + + +set -ex + + + +test -f ${PREFIX}/include/ares.h +test -f ${PREFIX}/lib/libcares${SHLIB_EXT} +test ! -f ${PREFIX}/lib/libcares.a +test ! -f ${PREFIX}/lib/libcares_static.a +exit 0 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-config-version.cmake b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-config-version.cmake new file mode 100644 index 0000000000000000000000000000000000000000..c895a25fc546fc89923578f607defc3a111520cd --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-config-version.cmake @@ -0,0 +1,70 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, +# but only if the requested major version is the same as the current one. +# The variable CVF_VERSION must be set before calling configure_file(). + + +set(PACKAGE_VERSION "1.34.6") + +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + + if("1.34.6" MATCHES "^([0-9]+)\\.") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0) + string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}") + endif() + else() + set(CVF_VERSION_MAJOR "1.34.6") + endif() + + if(PACKAGE_FIND_VERSION_RANGE) + # both endpoints of the range must have the expected major version + math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1") + if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR + OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR) + OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT))) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR + AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX) + OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX))) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + else() + if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() + endif() +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-config.cmake b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..9baf71fbf7e0ddff4008fd37ee8a5bcfdd75ecca --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-config.cmake @@ -0,0 +1,41 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT + + +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was c-ares-config.cmake.in ######## + +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) + +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +#################################################################################### + +set_and_check(c-ares_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include") + +include("${CMAKE_CURRENT_LIST_DIR}/c-ares-config-version.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/c-ares-targets.cmake") + +set(c-ares_LIBRARY c-ares::cares) + +if(ON) + if(NOT TARGET c-ares::cares_shared) + add_library(c-ares::cares_shared INTERFACE IMPORTED) + set_target_properties(c-ares::cares_shared PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares") + endif() + set(c-ares_SHARED_LIBRARY c-ares::cares_shared) +endif() + +if(OFF) + if(NOT TARGET c-ares::cares_static) + add_library(c-ares::cares_static INTERFACE IMPORTED) + set_target_properties(c-ares::cares_static PROPERTIES INTERFACE_LINK_LIBRARIES "c-ares::cares") + endif() + set(c-ares_STATIC_LIBRARY c-ares::cares_static) +endif() diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-targets-release.cmake b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-targets-release.cmake new file mode 100644 index 0000000000000000000000000000000000000000..bfa78cfbe988ba3ab32f0a32175b818eaeeeb84c --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-targets-release.cmake @@ -0,0 +1,19 @@ +#---------------------------------------------------------------- +# Generated CMake target import file for configuration "Release". +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Import target "c-ares::cares" for configuration "Release" +set_property(TARGET c-ares::cares APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(c-ares::cares PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libcares.so.2.19.5" + IMPORTED_SONAME_RELEASE "libcares.so.2" + ) + +list(APPEND _cmake_import_check_targets c-ares::cares ) +list(APPEND _cmake_import_check_files_for_c-ares::cares "${_IMPORT_PREFIX}/lib/libcares.so.2.19.5" ) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-targets.cmake b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-targets.cmake new file mode 100644 index 0000000000000000000000000000000000000000..00042421545636d561846184c89ab3cae2ccc084 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/cmake/c-ares/c-ares-targets.cmake @@ -0,0 +1,107 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8) + message(FATAL_ERROR "CMake >= 2.8.0 required") +endif() +if(CMAKE_VERSION VERSION_LESS "2.8.3") + message(FATAL_ERROR "CMake >= 2.8.3 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.8.3...3.23) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_cmake_targets_defined "") +set(_cmake_targets_not_defined "") +set(_cmake_expected_targets "") +foreach(_cmake_expected_target IN ITEMS c-ares::cares) + list(APPEND _cmake_expected_targets "${_cmake_expected_target}") + if(TARGET "${_cmake_expected_target}") + list(APPEND _cmake_targets_defined "${_cmake_expected_target}") + else() + list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}") + endif() +endforeach() +unset(_cmake_expected_target) +if(_cmake_targets_defined STREQUAL _cmake_expected_targets) + unset(_cmake_targets_defined) + unset(_cmake_targets_not_defined) + unset(_cmake_expected_targets) + unset(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT _cmake_targets_defined STREQUAL "") + string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}") + string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n") +endif() +unset(_cmake_targets_defined) +unset(_cmake_targets_not_defined) +unset(_cmake_expected_targets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target c-ares::cares +add_library(c-ares::cares SHARED IMPORTED) + +set_target_properties(c-ares::cares PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" + INTERFACE_LINK_LIBRARIES "-lpthread" +) + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Load information for each installed configuration. +file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/c-ares-targets-*.cmake") +foreach(_cmake_config_file IN LISTS _cmake_config_files) + include("${_cmake_config_file}") +endforeach() +unset(_cmake_config_file) +unset(_cmake_config_files) + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(_cmake_target IN LISTS _cmake_import_check_targets) + foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}") + if(NOT EXISTS "${_cmake_file}") + message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file + \"${_cmake_file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_cmake_file) + unset("_cmake_import_check_files_for_${_cmake_target}") +endforeach() +unset(_cmake_target) +unset(_cmake_import_check_targets) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/pkgconfig/libcares.pc b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/pkgconfig/libcares.pc new file mode 100644 index 0000000000000000000000000000000000000000..0408eada9020908f01cb650d4059fccfa487e1b4 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/lib/pkgconfig/libcares.pc @@ -0,0 +1,23 @@ +#*************************************************************************** +# Project ___ __ _ _ __ ___ ___ +# / __|____ / _` | '__/ _ \/ __| +# | (_|_____| (_| | | | __/\__ \ +# \___| \__,_|_| \___||___/ +# +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT +prefix=/home/task_176907749310659/croot/c-ares-split_1769077612871/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol +exec_prefix=${prefix}/bin +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: c-ares +URL: https://c-ares.org/ +Description: asynchronous DNS lookup library +Version: 1.34.6 +Requires: +Requires.private: +Cflags: -I${includedir} +Cflags.private: -DCARES_STATICLIB +Libs: -L${libdir} -lcares +Libs.private: -lpthread diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man1/adig.1 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man1/adig.1 new file mode 100644 index 0000000000000000000000000000000000000000..e0b81c91e3f9fae5ebb8d744bb75a696d9a91274 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man1/adig.1 @@ -0,0 +1,179 @@ +.\" +.\" Copyright (C) the Massachusetts Institute of Technology. +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.\" +.TH ADIG "1" "Sept 2024" "c-ares utilities" +.SH NAME +adig \- print information collected from Domain Name System (DNS) servers +.SH SYNOPSIS +\fBadig\fP [\fI@server\fR] [\fI-c class\fR] [\fI-p port#\fR] [\fI-q name\fR] +[\fI-t type\fR] [\fI-x addr\fR] [\fIname\fR] [\fItype\fR] [\fIclass\fR] +[\fIqueryopt\fR...] + +.SH DESCRIPTION +.PP +Send queries to DNS servers about \fUname\fR and print received +information, where \fIname\fR is a valid DNS name (e.g. www.example.com, +1.2.3.10.in-addr.arpa). +.PP +This utility comes with the \fBc\-ares\fR asynchronous resolver library. +.PP +It is possible to specify default arguments for \fBadig\fR via \fB${XDG_CONFIG_HOME}/adigrc\fR. +.SH ARGS +.TP +\fB@server\fR +Server ip address. May specify multiple in comma delimited format. May be +specified in URI format. +.TP +\fBname\fR +Name of the resource record that is to be looked up +.TP +\fBtype\fR +What type of query is required. e.g. - A, AAAA, MX, TXT, etc. If not +specified, A will be used. +.TP +\fBclass\fR +Sets the query class, defaults to IN. May also be HS or CH. + +.SH FLAGS +.TP +\fB\-c\fR class +Sets the query class, defaults to IN. May also be HS or CH. +.TP +\fB\-h\fR +Prints the help. +.TP +\fB\-p\fR port +Sends query to a port other than 53. Often recommended to set the port using +\fI@server\fR instead. +.TP +\fB\-q\fR name +Specifies the domain name to query. Useful to distinguish name from other +arguments +.TP +\fB\-r\fR +Skip adigrc processing +.TP +\fB\-s\fR +Server (alias for @server syntax), compatibility with old cmdline +.TP +\fB\-t\fR type +Indicates resource record type to query. Useful to distinguish type from other +arguments +.TP +\fB\-x\fR addr +Simplified reverse lookups. Sets the type to PTR and forms a valid in-arpa +query string + +.SH QUERY OPTIONS +.TP +\fB+[no]aaonly\fR +Sets the aa flag in the query. Default is off. +.TP +\fB+[no]aaflag\fR +Alias for +[no]aaonly +.TP +\fB+[no]additional\fR +Toggles printing the additional section. On by default. +.TP +\fB+[no]adflag\fR +Sets the ad (authentic data) bit in the query. Default is off. +.TP +\fB+[no]aliases\fR +Whether or not to honor the HOSTALIASES file. Default is on. +.TP +\fB+[no]all\fR +Toggles all of +[no]cmd, +[no]stats, +[no]question, +[no]answer, ++[no]authority, +[no]additional, +[no]comments +.TP +\fB+[no]answer\fR +Toggles printing the answer. On by default. +.TP +\fB+[no]authority\fR +Toggles printing the authority. On by default. +.TP +\fB+bufsize=\fR# +UDP EDNS 0 packet size allowed. Defaults to 1232. +.TP +\fB+[no]cdflag\fR +Sets the CD (checking disabled) bit in the query. Default is off. +.TP +\fB+[no]class\fR +Display the class when printing the record. On by default. +.TP +\fB+[no]cmd\fR +Toggles printing the command requested. On by default. +.TP +\fB+[no]comments\fR +Toggles printing the comments. On by default +.TP +\fB+[no]defname\fR +Alias for +[no]search +.TP +\fB+domain=somename\fR +Sets the search list to a single domain. +.TP +\fB+[no]dns0x20\fR +Whether or not to use DNS 0x20 case randomization when sending queries. +Default is off. +.TP +\fB+[no]edns\fR[=#] +Enable or disable EDNS. Only allows a value of 0 if specified. Default is to +enable EDNS. +.TP +\fB+[no]ignore\fR +Ignore truncation on UDP, by default retried on TCP. +.TP +\fB+[no]keepopen\fR +Whether or not the server connection should be persistent. Default is off. +.TP +\fB+ndots\fR=# +Sets the number of dots that must appear before being considered absolute. +Defaults to 1. +.TP +\fB+[no]primary\fR +Whether or not to only use a single server if more than one server is available. +Defaults to using all servers. +.TP +\fB+[no]qr\fR +Toggles printing the request query. Off by default. +.TP +\fB+[no]question\fR +Toggles printing the question. On by default. +.TP +\fB+[no]recurse\fR +Toggles the RD (Recursion Desired) bit. On by default. +.TP +\fB+retry\fR=# +Same as +tries but does not include the initial attempt. +.TP +\fB+[no]search\fR +To use or not use the search list. Search list is not used by default. +.TP +\fB+[no]stats\fR +Toggles printing the statistics. On by default. +.TP +\fB+[no]tcp\fR +Whether to use TCP when querying name servers. Default is UDP. +.TP +\fB+tries\fR=# +Number of query tries. Defaults to 3. +.TP +\fB+[no]ttlid\fR +Display the TTL when printing the record. On by default. +.TP +\fB+[no]vc\fR +Alias for +[no]tcp + +.SH FILES + +${XDG_CONFIG_HOME}/adigrc + +.SH "REPORTING BUGS" +Report bugs to the c-ares github issues tracker +.br +\fBhttps://github.com/c-ares/c-ares/issues\fR +.SH "SEE ALSO" +.PP +ahost(1). diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man1/ahost.1 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man1/ahost.1 new file mode 100644 index 0000000000000000000000000000000000000000..e17057273f82859cb83271f6ca848bf7d2e87c45 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man1/ahost.1 @@ -0,0 +1,50 @@ +.\" +.\" Copyright (C) the Massachusetts Institute of Technology. +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.\" +.TH AHOST "1" "April 2011" "c-ares utilities" +.SH NAME +ahost \- print the A or AAAA record associated with a hostname or IP address +.SH SYNOPSIS +.B ahost +[\fIOPTION\fR]... \fIHOST\fR... +.SH DESCRIPTION +.PP +.\" Add any additional description here +.PP +Look up the DNS A or AAAA record associated with HOST (a hostname or an +IP address). +.PP +This utility comes with the \fBc\-ares\fR asynchronous resolver library. +.SH OPTIONS +.TP +\fB\-d\fR +Print some extra debugging output. +.TP +\fB\-h\fR, \fB\-?\fR +Display this help and exit. +.TP +\fB\-t\fR type +If type is "a", print the A record. +If type is "aaaa", print the AAAA record. +If type is "u", look for both AAAA and A records (default). +.TP +\fB\-s\fR server +Set the server list to use for DNS lookups. +.TP +\fB\-D\fR \fIdomain\fP +Specify the \fIdomain\fP to search instead of using the default values from +.br +/etc/resolv.conf. This option only has an effect on platforms that use +.br +/etc/resolv.conf +for DNS configuration; it has no effect on other platforms (such as Win32 +or Android). +.SH "REPORTING BUGS" +Report bugs to the c-ares mailing list: +.br +\fBhttps://lists.haxx.se/listinfo/c-ares\fR +.SH "SEE ALSO" +.PP +adig(1) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_cancel.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_cancel.3 new file mode 100644 index 0000000000000000000000000000000000000000..967a946b491cd3f2f5f33075313e268c4e7d5c11 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_cancel.3 @@ -0,0 +1,33 @@ +.\" +.\" Copyright 1998 by the Massachusetts Institute of Technology. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_CANCEL 3 "31 March 2004" +.SH NAME +ares_cancel \- Cancel a resolve +.SH SYNOPSIS +.nf +#include + +void ares_cancel(ares_channel_t *\fIchannel\fP) +.fi +.SH DESCRIPTION +The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the +name service channel identified by \fIchannel\fP. \fBares_cancel(3)\fP +invokes the callbacks for each pending query on the channel, passing a status +of +.BR ARES_ECANCELLED . +These calls give the callbacks a chance to clean up any state which might have +been stored in their arguments. If such a callback invocation adds a new +request to the channel, that request will \fInot\fP be cancelled by the +current invocation of \fBares_cancel(3)\fP. +.SH SEE ALSO +.BR ares_init (3) +.BR ares_destroy (3) +.SH NOTES +This function was added in c-ares 1.2.0 + +c-ares 1.6.0 and earlier pass a status of +.BR ARES_ETIMEOUT +instead of +.BR ARES_ECANCELLED . diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_create_query.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_create_query.3 new file mode 100644 index 0000000000000000000000000000000000000000..3af6ba4cc3dc5b8fd0d3481615b8643e6cc8b8d4 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_create_query.3 @@ -0,0 +1,75 @@ +.\" +.\" Copyright 1998 by the Massachusetts Institute of Technology. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_CREATE_QUERY 3 "17 Aug 2012" +.SH NAME +ares_create_query \- Compose a single-question DNS query buffer +.SH SYNOPSIS +.nf +#include + +int ares_create_query(const char *\fIname\fP, + int \fIdnsclass\fP, + int \fItype\fP, + unsigned short \fIid\fP, + int \fIrd\fP, + unsigned char **\fIbuf\fP, + int *\fIbuflen\fP, + int \fImax_udp_size\fP) +.fi +.SH DESCRIPTION +This function is deprecated as of c-ares 1.22, please use +\fIares_dns_record_create(3)\fP instead. + +The \fIares_create_query(3)\fP function composes a DNS query with a single +question. The parameter \fIname\fP gives the query name as a NUL-terminated C +string of period-separated labels optionally ending with a period; periods and +backslashes within a label must be escaped with a backlash. + +The parameters \fIdnsclass\fP and \fItype\fP give the class and type of the +query using the values defined in \fB\fP. + +The parameter \fIid\fP gives a 16-bit identifier for the query. + +The parameter \fIrd\fP should be nonzero if recursion is desired, zero if not. + +The query will be placed in an allocated buffer, a pointer to which will be +stored in the variable pointed to by \fIbuf\fP, and the length of which will +be stored in the variable pointed to by \fIbuflen\fP. + +It is the caller's responsibility to free this buffer using +\fIares_free_string(3)\fP when it is no longer needed. The parameter +\fImax_udp_size\fP should be nonzero to activate EDNS. Usage of +\fIares_create_query(3)\fP\ with \fImax_udp_size\fP set to zero is equivalent +to using \fIares_mkquery(3)\fP. +.SH RETURN VALUES +.B ares_create_query +can return any of the following values: +.TP 15 +.B ARES_SUCCESS +Construction of the DNS query succeeded. +.TP 15 +.B ARES_ENOTFOUND +The query name +.I name +refers to a +.I .onion +domain name. See RFC 7686. +.TP 15 +.B ARES_EBADNAME +The query name +.I name +could not be encoded as a domain name, either because it contained a +zero-length label or because it contained a label of more than 63 +characters. +.TP 15 +.B ARES_ENOMEM +Memory was exhausted. +.SH AVAILABILITY +Added in c-ares 1.10.0 +.SH SEE ALSO +.BR ares_dns_record (3), +.BR ares_expand_name (3), +.BR ares_free_string (3), +.BR ares_mkquery (3) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_destroy.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_destroy.3 new file mode 100644 index 0000000000000000000000000000000000000000..d1984b7cc98d2665d5db69e3990bec08afcfd75c --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_destroy.3 @@ -0,0 +1,29 @@ +.\" +.\" Copyright 1998 by the Massachusetts Institute of Technology. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_DESTROY 3 "7 December 2004" +.SH NAME +ares_destroy \- Destroy a resolver channel +.SH SYNOPSIS +.nf +#include + +void ares_destroy(ares_channel_t *\fIchannel\fP) +.fi +.SH DESCRIPTION +The \fBares_destroy(3)\fP function destroys the name service channel +identified by \fIchannel\fP, freeing all memory and closing all sockets used +by the channel. + +\fBares_destroy(3)\fP invokes the callbacks for each pending query on the +channel, passing a status of \fIARES_EDESTRUCTION\fP. These calls give the +callbacks a chance to clean up any state which might have been stored in their +arguments. A callback must not add new requests to a channel being destroyed. + +There is no ability to make this function thread-safe. No additional calls +using this channel may be made once this function is called. +.SH SEE ALSO +.BR ares_init (3), +.BR ares_cancel (3), +.BR ares_threadsafety (3) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_destroy_options.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_destroy_options.3 new file mode 100644 index 0000000000000000000000000000000000000000..18340995b2c0fdd08aaf86e6465b4d5164cd75e7 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_destroy_options.3 @@ -0,0 +1,20 @@ +.\" +.\" Copyright 1998 by the Massachusetts Institute of Technology. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_DESTROY_OPTIONS 3 "1 June 2007" +.SH NAME +ares_destroy_options \- Destroy options initialized with ares_save_options +.SH SYNOPSIS +.nf +#include + +void ares_destroy_options(struct ares_options *\fIoptions\fP) +.fi +.SH DESCRIPTION +The \fBares_destroy_options(3)\fP function destroys the options struct +identified by \Ioptions\fP, freeing all memory allocated by +\fBares_save_options(3)\fP. +.SH SEE ALSO +.BR ares_save_options (3), +.BR ares_init_options (3) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_fromstr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_fromstr.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_fromstr.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_t.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_t.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_t.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_tostr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_tostr.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_class_tostr.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_datatype_t.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_datatype_t.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_datatype_t.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_flags_t.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_flags_t.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_flags_t.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_mapping.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_mapping.3 new file mode 100644 index 0000000000000000000000000000000000000000..451839153c5172d962c07258a7087e30ced7be62 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_mapping.3 @@ -0,0 +1,307 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_DNS_MAPPINGS 3 "12 November 2023" +.SH NAME +ares_dns_class_fromstr, ares_dns_class_tostr, ares_dns_datatype_t, ares_dns_opcode_tostr, +ares_dns_opt_datatype_t, ares_dns_opt_get_datatype, ares_dns_opt_get_name, +ares_dns_rcode_tostr, ares_dns_rec_type_fromstr, ares_dns_rr_get_keys, +ares_dns_rr_key_datatype, ares_dns_rr_key_to_rec_type, ares_dns_rr_key_tostr, +ares_dns_section_tostr, ares_opt_param_t, ares_svcb_param_t \- +Helper functions for converting dns record identifiers to and from their +respective types, as well identifying datatypes for various records. +.SH SYNOPSIS +.nf +#include + +const char *ares_dns_rec_type_tostr(ares_dns_rec_type_t type); + +const char *ares_dns_class_tostr(ares_dns_class_t qclass); + +const char *ares_dns_opcode_tostr(ares_dns_opcode_t opcode); + +const char *ares_dns_rr_key_tostr(ares_dns_rr_key_t key); + +const char *ares_dns_section_tostr(ares_dns_section_t section); + +const char *ares_dns_rcode_tostr(ares_dns_rcode_t rcode); + +ares_bool_t ares_dns_class_fromstr(ares_dns_class_t *qclass, const char *str); + +ares_bool_t ares_dns_rec_type_fromstr(ares_dns_rec_type_t *qtype, + const char *str); + +const ares_dns_rr_key_t *ares_dns_rr_get_keys(ares_dns_rec_type_t type, + size_t *cnt); + +ares_dns_datatype_t ares_dns_rr_key_datatype(ares_dns_rr_key_t key); + +ares_dns_rec_type_t ares_dns_rr_key_to_rec_type(ares_dns_rr_key_t key); + +ares_dns_opt_datatype_t ares_dns_opt_get_datatype(ares_dns_rr_key_t key, + unsigned short opt); + +const char *ares_dns_opt_get_name(ares_dns_rr_key_t key, unsigned short opt); + +.fi +.SH ENUMERATIONS +.B ares_dns_datatype_t - +Data types associated with \fIares_dns_rr_key_t\fP: +.RS 4 +.B ARES_DATATYPE_INADDR +- IPv4 address as \fIstruct in_addr *\fP. Use \fIares_dns_rr_set_addr(3)\fP to +set and \fIares_dns_rr_get_addr(3)\fP to get. +.br +.B ARES_DATATYPE_INADDR6 +- IPv6 address as \fIstruct ares_in6_addr *\fP. Use \fIares_dns_rr_set_addr6(3)\fP to +set and \fIares_dns_rr_get_addr6(3)\fP to get. +.br +.B ARES_DATATYPE_U8 +- 8bit unsigned integer. Use \fIares_dns_rr_set_u8(3)\fP to +set and \fIares_dns_rr_get_u8(3)\fP to get. +.br +.B ARES_DATATYPE_U16 +- 16bit unsigned integer. Use \fIares_dns_rr_set_u16(3)\fP to +set and \fIares_dns_rr_get_u16(3)\fP to get. +.br +.B ARES_DATATYPE_U32 +- 32bit unsigned integer. Use \fIares_dns_rr_set_u32(3)\fP to +set and \fIares_dns_rr_get_u32(3)\fP to get. +.br +.B ARES_DATATYPE_NAME +- Null-terminated string of a domain name (series of labels). Use \fIares_dns_rr_set_str(3)\fP to +set and \fIares_dns_rr_get_str(3)\fP to get. +.br +.B ARES_DATATYPE_STR +- Null-terminated string. Use \fIares_dns_rr_set_str(3)\fP to +set and \fIares_dns_rr_get_str(3)\fP to get. +.br +.B ARES_DATATYPE_BIN +- Binary Data. Use \fIares_dns_rr_set_bin(3)\fP to +set and \fIares_dns_rr_get_bin(3)\fP to get. +.br +.B ARES_DATATYPE_BINP +- Officially defined as binary data, but likely printable. Guaranteed to have +a NULL terminator for convenience (not included in length). Use \fIares_dns_rr_set_bin(3)\fP to +set and \fIares_dns_rr_get_bin(3)\fP to get. +.br +.B ARES_DATATYPE_OPT +- Array of options. 16bit identifier, Binary data. Use \fIares_dns_rr_set_opt(3)\fP to +set and \fIares_dns_rr_get_opt(3)\fP to get. +.br +.B ARES_DATATYPE_ABINP +- Array of binary data, but likely printable. Guaranteed to have a NULL terminator +for convenience (not included in length). Use \fIares_dns_rr_add_abin(3)\fP to +set and \fIares_dns_rr_get_abin(3)\fP to get. Can also use +\fIares_dns_rr_set_bin(3)\fP and \fIares_dns_rr_get_bin(3)\fP if only concatenated +strings are desired. +.br +.RE + +.B ares_dns_opt_datatype_t - +Data types associated with \fIARES_DATATYPE_OPT\fP parameters if known as returned +by \fIares_dns_opt_get_datatype(3)\fP: +.RS 4 +.B ARES_OPT_DATATYPE_NONE +- No value allowed for this parameter +.br +.B ARES_OPT_DATATYPE_STR_LIST +- List of strings, each prefixed with a single octet representing the length as +defined by RFC 1035. Can use \fIares_expand_string(3)\fP until buffer is consumed. +.br +.B ARES_OPT_DATATYPE_U8_LIST +- List of 8bit unsigned integers, concatenated +.br +.B ARES_OPT_DATATYPE_U16 +- 16bit unsigned integer in network byte order +.br +.B ARES_OPT_DATATYPE_U16_LIST +- list of 16bit unsigned integers in network byte order, concatenated. +.br +.B ARES_OPT_DATATYPE_U32 +- 32bit unsigned integer in network byte order +.br +.B ARES_OPT_DATATYPE_U32_LIST +- list of 16bit unsigned integers in network byte order, concatenated. +.br +.B ARES_OPT_DATATYPE_INADDR4_LIST +- List of ipv4 addresses in network byte order, concatenated +.br +.B ARES_OPT_DATATYPE_INADDR6_LIST +- List of ipv6 addresses in network byte order, concatenated +.br +.B ARES_OPT_DATATYPE_BIN +- Binary Data +.br +.B ARES_OPT_DATATYPE_NAME +- DNS Domain Name binary format as defined in RFC1035, can use \fIares_expand_name(3)\fP +.br +.RE + +.B ares_svcb_param_t - +SVCB (and HTTPS) RR known parameters as returned by \fIares_dns_opt_get_datatype(3)\fP +with \fIARES_RR_SVCB_PARAMS\fP or \fIARES_RR_HTTPS_PARAMS\fP: +.RS 4 +.B ARES_SVCB_PARAM_MANDATORY +- Mandatory keys in this RR (RFC 9460 Section 8). Datatype: \fIARES_OPT_DATATYPE_U16_LIST\fP +.br +.B ARES_SVCB_PARAM_ALPN +- Additional supported protocols (RFC 9460 Section 7.1). Datatype: \fIARES_OPT_DATATYPE_STR_LIST\fP +.br +.B ARES_SVCB_PARAM_NO_DEFAULT_ALPN +- No support for default protocol (RFC 9460 Section 7.1). Datatype: \fIARES_OPT_DATATYPE_NONE\fP +.br +.B ARES_SVCB_PARAM_PORT +- Port for alternative endpoint (RFC 9460 Section 7.2). Datatype: \fIARES_OPT_DATATYPE_U16\fP +.br +.B ARES_SVCB_PARAM_IPV4HINT +- IPv4 address hints (RFC 9460 Section 7.3). Datatype: \fIARES_OPT_DATATYPE_INADDR4_LIST\fP +.br +.B ARES_SVCB_PARAM_ECH +- RESERVED (held for Encrypted ClientHello) +.br +.B ARES_SVCB_PARAM_IPV6HINT +- IPv6 address hints (RFC 9460 Section 7.3). Datatype: \fIARES_OPT_DATATYPE_INADDR6_LIST\fP +.br + +.RE + +.B ares_opt_param_t - +OPT RR known parameters as returned by \fIares_dns_opt_get_datatype(3)\fP +with \fIARES_RR_OPT_OPTIONS\fB: +.RS 4 +.B ARES_OPT_PARAM_LLQ +- RFC 8764. Apple's DNS Long-Lived Queries Protocol. Datatype: \fIARES_OPT_DATATYPE_BIN\fP +.br +.B ARES_OPT_PARAM_UL +- http://files.dns-sd.org/draft-sekar-dns-ul.txt: Update Lease. Datatype: \fIARES_OPT_DATATYPE_U32\fP +.br +.B ARES_OPT_PARAM_NSID +- RFC 5001. Name Server Identification. Datatype: \fIARES_OPT_DATATYPE_BIN\fP +.br +.B ARES_OPT_PARAM_DAU +- RFC 6975. DNSSEC Algorithm Understood. Datatype: \fIARES_OPT_DATATYPE_U8_LIST\fP +.br +.B ARES_OPT_PARAM_DHU +- RFC 6975. DS Hash Understood. Datatype: \fIARES_OPT_DATATYPE_U8_LIST\fP +.br +.B ARES_OPT_PARAM_N3U +- RFC 6975. NSEC3 Hash Understood. Datatype: \fIARES_OPT_DATATYPE_U8_LIST\fP +.br +.B ARES_OPT_PARAM_EDNS_CLIENT_SUBNET +- RFC 7871. Client Subnet. Datatype: \fIARES_OPT_DATATYPE_BIN\fP +.br +.B ARES_OPT_PARAM_EDNS_EXPIRE +- RFC 7314. Expire Timer. Datatype: \fIARES_OPT_DATATYPE_U32\fP +.br +.B ARES_OPT_PARAM_COOKIE +- RFC 7873. Client and Server Cookies. Datatype: \fIARES_OPT_DATATYPE_BIN\fP +.br +.B ARES_OPT_PARAM_EDNS_TCP_KEEPALIVE +- RFC 7828. TCP Keepalive timeout. Datatype: \fIARES_OPT_DATATYPE_U16\fP +.br +.B ARES_OPT_PARAM_PADDING +- RFC 7830. Padding. Datatype: \fIARES_OPT_DATATYPE_BIN\fP +.br +.B ARES_OPT_PARAM_CHAIN +- RFC 7901. Chain query requests. Datatype: \fIARES_OPT_DATATYPE_NAME\fP +.br +.B ARES_OPT_PARAM_EDNS_KEY_TAG +- RFC 8145. Signaling Trust Anchor Knowledge in DNSSEC. Datatype: \fIARES_OPT_DATATYPE_U16_LIST\fP +.br +.B ARES_OPT_PARAM_EXTENDED_DNS_ERROR +- RFC 8914. Extended ERROR code and message. Datatype: \fIARES_OPT_DATATYPE_BIN\fP +.br +.RE + +.SH DESCRIPTION +The \fIares_dns_rec_type_tostr(3)\fP function outputs a human readable DNS record +type from its numeric form passed in +.IR type . + +The \fIares_dns_class_tostr(3)\fP function outputs a human readable DNS class +from its numeric form passed in +.IR qclass . + +The \fIares_dns_opcode_tostr(3)\fP function outputs a human readable DNS opcode +from its numeric form in +.IR opcode . + +The \fIares_dns_rr_key_tostr(3)\fP function outputs a human readable DNS Resource +Record parameter name from its numeric form in +.IR key . + +The \fIares_dns_section_tostr(3)\fP function outputs a human readable DNS +message section from its numeric form in +.IR section . + +The \fIares_dns_rcode_tostr(3)\fP function outputs a human readable DNS +response code from its numeric form in +.IR rcode . + +The \fIares_dns_class_fromstr(3)\fP function outputs the DNS class in numeric +from from its string representation in +.IR str . +The result is stored into the variable pointed to by +.IR qclass . + +The \fIares_dns_rec_type_fromstr(3)\fP function outputs the DNS record type in +numeric from from its string representation in +.IR str . +The result is stored into the variable pointed to by +.IR qtype . + +The \fIares_dns_rr_get_keys(3)\fP function retrieves a list of parameters that +may be set or retrieved for the provided +.IR type . +The count of returned keys is stored into the variable pointed to by +.IR cnt . + +The \fIares_dns_rr_key_datatype(3)\fP function retrieves the associated datatype +for an RR parameter specified by +.IR key . + +The \fIares_dns_rr_key_to_rec_type(3)\fP function dereferences the provided RR +parameter specified by +.IR key +to the DNS Record Type it belongs. + +The \fIares_dns_opt_get_datatype(3)\fP function is used in association with +\fIares_dns_rr_set_opt(3)\fP and \fIares_dns_rr_get_opt(3)\fP to retrieve the +datatype of an option record contained within an RR as specified in +.IR key +if it is known. The raw option record identifier is provided by +.IR opt . + +The \fIares_dns_opt_get_name(3)\fP function is used in association with +\fIares_dns_rr_set_opt(3)\fP and \fIares_dns_rr_get_opt(3)\fP to retrieve human +readable parameter name of an option record contained within an RR as specified +in +.IR key +if it is known. The raw option record identifier is provided by +.IR opt . + +.SH RETURN VALUES +\fIares_dns_rec_type_tostr(3)\fP, \fIares_dns_class_tostr(3)\fP, +\fIares_dns_opcode_tostr(3)\fP, \fIares_dns_rr_key_tostr(3)\fP, +\fIares_dns_section_tostr(3)\fP, \fIares_dns_rcode_tostr(3)\fP, and +\fIares_dns_opt_get_name(3)\fP all return a human printable ASCII string, or +NULL on error. + +\fIares_dns_class_fromstr(3)\fP and \fIares_dns_rec_type_fromstr(3)\fP return +.B ARES_TRUE +on successful conversion, otherwise +.B ARES_FALSE. + +\fIares_dns_rr_get_keys(3)\fP returns an array of keys or NULL on failure. + +\fIares_dns_rr_key_datatype(3)\fP, \fIares_dns_rr_key_to_rec_type(3)\fP, and +\fIares_dns_opt_get_datatype(3)\fP return their respective integer values, or +0 on failure. + +.SH AVAILABILITY +These functions were first introduced in c-ares version 1.22.0. +.SH SEE ALSO +.BR ares_dns_record (3), +.BR ares_dns_rr (3), +.BR ares_init (3) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opcode_t.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opcode_t.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opcode_t.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opcode_tostr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opcode_tostr.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opcode_tostr.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_datatype_t.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_datatype_t.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_datatype_t.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_get_datatype.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_get_datatype.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_get_datatype.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_get_name.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_get_name.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_opt_get_name.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_parse.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_parse.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_parse.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rcode_t.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rcode_t.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rcode_t.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rcode_tostr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rcode_tostr.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rcode_tostr.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_fromstr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_fromstr.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_fromstr.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_t.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_t.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_t.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_tostr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_tostr.3 new file mode 100644 index 0000000000000000000000000000000000000000..4587b9a586ef8e8d7620d0e202aaa1dde520b5ab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rec_type_tostr.3 @@ -0,0 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_mapping.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record.3 new file mode 100644 index 0000000000000000000000000000000000000000..47ca95b057a2460d4da19d08fe211ca6a4f5dfb4 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record.3 @@ -0,0 +1,455 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_DNS_RECORD 3 "12 November 2023" +.SH NAME +ares_dns_class_t, ares_dns_flags_t, ares_dns_opcode_t, ares_dns_parse, +ares_dns_rcode_t, ares_dns_record_create, ares_dns_record_destroy, +ares_dns_record_get_flags, ares_dns_record_get_id, ares_dns_record_get_opcode, +ares_dns_record_get_rcode, ares_dns_record_query_add, ares_dns_record_query_cnt, +ares_dns_record_query_get, ares_dns_rec_type_t, ares_dns_write \- +DNS Record parsing, writing, creating and destroying functions. +.SH SYNOPSIS +.nf +#include + +void ares_dns_record_destroy(ares_dns_record_t *dnsrec); + +ares_status_t ares_dns_parse(const unsigned char *buf, + size_t buf_len, unsigned int flags, + ares_dns_record_t **dnsrec); + +ares_status_t ares_dns_write(const ares_dns_record_t *dnsrec, + unsigned char **buf, size_t *buf_len); + +ares_status_t ares_dns_record_create(ares_dns_record_t **dnsrec, + unsigned short id, + unsigned short flags, + ares_dns_opcode_t opcode, + ares_dns_rcode_t rcode); + +ares_dns_record_t *ares_dns_record_duplicate(const ares_dns_record_t *dnsrec); + +unsigned short ares_dns_record_get_id(const ares_dns_record_t *dnsrec); + +ares_bool_t ares_dns_record_set_id(ares_dns_record_t *dnsrec, + unsigned short id); + +unsigned short ares_dns_record_get_flags(const ares_dns_record_t *dnsrec); + +ares_dns_opcode_t ares_dns_record_get_opcode(const ares_dns_record_t *dnsrec); + +ares_dns_rcode_t ares_dns_record_get_rcode(const ares_dns_record_t *dnsrec); + +ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec, + const char *name, + ares_dns_rec_type_t qtype, + ares_dns_class_t qclass); + +ares_status_t ares_dns_record_query_set_name(ares_dns_record_t *dnsrec, + size_t idx, + const char *name); + +ares_status_t ares_dns_record_query_set_type(ares_dns_record_t *dnsrec, + size_t idx, + ares_dns_rec_type_t qtype); + +size_t ares_dns_record_query_cnt(const ares_dns_record_t *dnsrec); + +ares_status_t ares_dns_record_query_get(const ares_dns_record_t *dnsrec, + size_t idx, const char **name, + ares_dns_rec_type_t *qtype, + ares_dns_class_t *qclass); + +.fi +.SH ENUMERATIONS + +.B ares_dns_rec_type_t - +DNS Record types handled by c-ares. Some record types may only be valid +on requests, and some may only be valid on responses: +.RS 4 +.B ARES_REC_TYPE_A +- Host address +.br +.B ARES_REC_TYPE_NS +- Authoritative server +.br +.B ARES_REC_TYPE_CNAME +- Canonical name +.br +.B ARES_REC_TYPE_SOA +- Start of authority zone +.br +.B ARES_REC_TYPE_PTR +- Domain name pointer +.br +.B ARES_REC_TYPE_HINFO +- Host information +.br +.B ARES_REC_TYPE_MX +- Mail routing information +.br +.B ARES_REC_TYPE_TXT +- Text strings +.br +.B ARES_REC_TYPE_SIG +- RFC 2535. RFC 2931. SIG Record +.br +.B ARES_REC_TYPE_AAAA +- RFC 3596. Ip6 Address +.br +.B ARES_REC_TYPE_SRV +- RFC 2782. Server Selection +.br +.B ARES_REC_TYPE_NAPTR +- RFC 3403. Naming Authority Pointer +.br +.B ARES_REC_TYPE_OPT +- RFC 6891. EDNS0 option (meta-RR). Pseudo Record. +.br +.B ARES_REC_TYPE_TLSA +- RFC 6698. DNS-Based Authentication of Named Entities (DANE) Transport Layer Security (TLS) Protocol: TLSA +.br +.B ARES_REC_TYPE_SVCB +- RFC 9460. General Purpose Service Binding +.br +.B ARES_REC_TYPE_HTTPS - +- RFC 9460. Service Binding type for use with HTTPS +.br +.B ARES_REC_TYPE_ANY +- Wildcard match. Not response RR +.br +.B ARES_REC_TYPE_URI +- RFC 7553. Uniform Resource Identifier +.br +.B ARES_REC_TYPE_CAA +- RFC 6844. Certification Authority Authorization +.br +.B ARES_REC_TYPE_RAW_RR +- Used as an indicator that the RR record is not parsed, but provided in wire +format +.br +.RE + +.B ares_dns_class_t - +DNS Classes for requests and responses: +.RS 4 +.B ARES_CLASS_IN +- Internet +.br +.B ARES_CLASS_CHAOS +- CHAOS +.br +.B ARES_CLASS_HESOID +- Hesoid [Dyer 87] +.br +.B ARES_CLASS_NONE +- RFC 2136 +.br +.B ARES_CLASS_ANY +- Any class (requests only) +.br +.RE + +.B ares_dns_opcode_t - +DNS Header Opcodes: +.RS 4 +.B ARES_OPCODE_QUERY +- Standard query +.br +.B ARES_OPCODE_IQUERY +- Inverse query. Obsolete +.br +.B ARES_OPCODE_STATUS +- Name server status query +.br +.B ARES_OPCODE_NOTIFY +- Zone change notification (RFC 1996) +.br +.B ARES_OPCODE_UPDATE +- Zone update message (RFC 2136) +.br +.RE + +.B ares_dns_flags_t - +DNS Header Flags: +.RS 4 +.B ARES_FLAG_QR +- QR. If set, is a response +.br +.B ARES_FLAG_AA +- Authoritative Answer. If set, is authoritative +.br +.B ARES_FLAG_TC +- Truncation. If set, is truncated response +.br +.B ARES_FLAG_RD +- Recursion Desired. If set, recursion is desired +.br +.B ARES_FLAG_RA +- Recursion Available. If set, server supports recursion +.br +.B ARES_FLAG_AD +- RFC 2065. Authentic Data bit indicates in a response that the data included +has been verified by the server providing it +.br +.B ARES_FLAG_CD +- RFC 2065. Checking Disabled bit indicates in a query that non-verified data +is acceptable to the resolver sending the query +.br +.RE + +.B ares_dns_rcode_t - +DNS Response codes from server: +.RS 4 +.B ARES_RCODE_NOERROR +- Success +.br +.B ARES_RCODE_FORMERR +- Format error. The name server was unable to interpret the query +.br +.B ARES_RCODE_SERVFAIL +- Server Failure. The name server was unable to process this query due to a +problem with the nameserver +.br +.B ARES_RCODE_NXDOMAIN +- Name Error. Meaningful only for responses from an authoritative name server, +this code signifies that the domain name referenced in the query does not exist. +.br +.B ARES_RCODE_NOTIMP +- Not implemented. The name server does not support the requested kind of query +.br +.B ARES_RCODE_REFUSED +- Refused. The name server refuses to perform the specified operation for policy +reasons. +.br +.B ARES_RCODE_YXDOMAIN +- RFC 2136. Some name that ought not to exist, does exist +.br +.B ARES_RCODE_YXRRSET +- RFC 2136. Some RRset that ought to not exist, does exist +.br +.B ARES_RCODE_NXRRSET +- RFC 2136. Some RRset that ought to exist, does not exist +.br +.B ARES_RCODE_NOTAUTH +- RFC 2136. The server is not authoritative for the zone named in the Zone section. +.br +.B ARES_RCODE_NOTZONE +- RFC 2136. A name used in the Prerequisite or Update Section is not within the +zone denoted by the Zone Section. +.br +.B ARES_RCODE_DSOTYPEI +- RFC 8409. DSO-TYPE Not implemented +.br +.B ARES_RCODE_BADSIG +- RFC 8945. TSIG Signature Failure +.br +.B ARES_RCODE_BADKEY +- RFC 8945. Key not recognized +.br +.B ARES_RCODE_BADTIME +- RFC 8945. Signature out of time window +.br +.B ARES_RCODE_BADMODE +- RFC 2930. Bad TKEY Mode +.br +.B ARES_RCODE_BADNAME +- RFC 2930. Duplicate Key Name +.br +.B ARES_RCODE_BADALG +- RFC 2930. Algorithm not supported +.br +.B ARES_RCODE_BADTRUNC +- RFC 8945. Bad Truncation +.br +.B ARES_RCODE_BADCOOKIE +- RFC 7973. Bad/missing Server Cookie +.br +.RE + +.B ares_dns_parse_flags_t - +Flags for altering \fIares_dns_parse(3)\fP behaviour: +.RS 4 +.B ARES_DNS_PARSE_AN_BASE_RAW +- Parse Answer Section from RFC 1035 that allow name compression as RAW RR type +.br +.B ARES_DNS_PARSE_NS_BASE_RAW +- Parse Authority Section from RFC 1035 that allow name compression as RAW RR type +.br +.B ARES_DNS_PARSE_AR_BASE_RAW +- Parse Additional Section from RFC 1035 that allow name compression as RAW RR type +.br +.B ARES_DNS_PARSE_AN_EXT_RAW +- Parse Answer Section from later RFCs (no name compression) as RAW RR type +.br +.B ARES_DNS_PARSE_NS_EXT_RAW +- Parse Authority Section from later RFCs (no name compression) as RAW RR type +.br +.B ARES_DNS_PARSE_AR_EXT_RAW +- Parse Additional Section from later RFCs (no name compression) as RAW RR type +.br +.RE + +.SH DESCRIPTION + +The \fIares_dns_record_destroy(3)\fP function destroys the memory associated +with the dns record created by either \fIares_dns_record_create(3)\fP or +\fIares_dns_parse(3)\fP passed in via +.IR dnsrec . + +The \fIares_dns_parse(3)\fP function parses the buffer provided in +.IR buf +with length provided in +.IR buf_len. +The +.IR flags +parameter can be one or more \fIares_dns_parse_flags_t\fP, or zero if no +flags are needed. The resulting dns record data structure is stored into the +variable pointed to by +.IR dnsrec +and must be destroyed using \fIares_dns_record_destroy(3)\fP. + +The \fIares_dns_write(3)\fP function takes a populated DNS record structure in +.IR dnsrec +and writes a wire-format DNS message into the variable pointed to by +.IR buf +and writes the length of the buffer into the variable pointed to by +.IR buf_len. +The buffer must be destroyed using \fIares_free_string(3)\fP. + +The \fIares_dns_record_create(3)\fP function creates an empty DNS record structure +in the variable pointed to by +.IR dnsrec. +The +.IR id +parameter is the DNS message id, however if passing to \fIares_send(3)\fP this +identifier will be overwritten, so should typically be 0. The +.IR flags +parameter is one or more \fIares_dns_flags_t\fP. The opcode is passed in the +.IR opcode +parameter and should typically be \fIARES_OPCODE_QUERY\fP. The response code +is meant mostly for responses and is passed in the +.IR rcode +parameter and is typically \fPARES_RCODE_NOERROR\fP. + +The \fIares_dns_record_duplicate(3)\fP function duplicates an existing DNS +record structure. This may be useful if needing to save a result as retrieved +from \fIares_send_dnsrec(3)\fP or \fIares_search_dnsrec(3)\fP. The structure +to be duplicated is passed in the +.IR dnsrec +parameter, and the duplicated copy is returned, or NULL on error such as +out of memory. + +The \fIares_dns_record_get_id(3)\fP function is used to retrieve the DNS +message id from the DNS record provided in the +.IR dnsrec +parameter. + +The \fIares_dns_record_set_id(3)\fP function is used to set the DNS +message id in the +.IR id +parameter from the DNS record provided in the +.IR dnsrec +parameter. This id will be overwritten when passing the record to c-ares, +so mostly exists for external purposes. + +The \fIares_dns_record_get_flags(3)\fP function is used to retrieve the DNS +message flags from the DNS record provided in the +.IR dnsrec +parameter. + +The \fIares_dns_record_get_opcode(3)\fP function is used to retrieve the DNS +message flags from the DNS record provided in the +.IR dnsrec +parameter. + +The \fIares_dns_record_get_rcode(3)\fP function is used to retrieve the DNS +message response code from the DNS record provided in the +.IR dnsrec +parameter. + + +The \fIares_dns_record_query_add(3)\fP function is used to add a question to +the DNS record provided in the +.IR dnsrec +parameter. The domain name specified for the question is provided in the +.IR name +parameter, along with the question type in the +.IR qtype +parameter and the question class (typically \fIARES_CLASS_IN\fP) in the +.IR qclass +parameter. + +The \fIares_dns_record_query_set_name(3)\fP function is used to modify the +question name in the DNS record provided in the +.IR dnsrec +parameter. The index of the query, which must be less than +\fIares_dns_record_query_cnt(3)\fP, is provided in the +.IR idx +parameter. The new domain name is provided in the +.IR name +parameter. Care should be taken as this will cause invalidation of any +\fIname\fP pointer retrieved from \fIares_dns_Record_query_get(3)\fP. This +function is useful if sending multiple similar queries without re-creating +the entire DNS query. + +The \fIares_dns_record_query_set_type(3)\fP function is used to modify the +question type in the DNS record provided in the +.IR dnsrec +parameter. The index of the query, which must be less than +\fIares_dns_record_query_cnt(3)\fP, is provided in the +.IR idx +parameter. The new query type is provided in the +.IR qtype +parameter. + +The \fIares_dns_record_query_cnt(3)\fP function is used to retrieve the number +of DNS questions in the DNS record provided in the +.IR dnsrec +parameter. + +The \fIares_dns_record_query_get(3)\fP function is used to retrieve the details +of a single DNS question in the provided +.IR dnsrec +parameter. The index provided in the +.IR idx +parameter must be less than the value returned from \fIares_dns_record_query_cnt(3)\fP. +The DNS question name will be returned in the variable pointed to by the +.IR name +parameter, this may be provided as NULL if the name is not needed. This pointer +will be invalided by any call to \fIares_dns_record_query_set_name(3)\fP. +The DNS question type will be returned in the variable pointed to by the +.IR qtype +parameter, this may be provided as NULL if the type is not needed. +The DNS question class will be returned in the variable pointed to by the +.IR qclass +parameter, this may be provided as NULL if the class is not needed. + + +.SH RETURN VALUES + +\fIares_dns_parse(3)\fP, \fIares_dns_write(3)\fP, \fIares_dns_record_create(3)\fP, +\fIares_dns_record_query_add(3)\fP, and \fIares_dns_record_query_get(3)\fP all +return an \fIares_status_t\fP error code. +.B ARES_SUCCESS +is returned on success, +.B ARES_ENOMEM +is returned on out of memory, +.B ARES_EFORMERR +is returned on misuse. + +\fIares_dns_record_get_id(3)\fP, \fIares_dns_record_set_id(3)\fP, +\fIares_dns_record_get_flags(3)\fP, \fIares_dns_record_get_opcode(3)\fP, +\fIares_dns_record_get_rcode(3)\fP, and \fIares_dns_record_query_cnt(3)\fP +all returned their prescribed datatype values and in general can't fail except +for misuse cases, in which a 0 may be returned, however 0 can also be a valid +return value for most of these functions. + + +.SH AVAILABILITY +These functions were first introduced in c-ares version 1.22.0. +.SH SEE ALSO +.BR ares_dns_mapping (3), +.BR ares_dns_rr (3), +.BR ares_free_string (3) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_create.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_create.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_create.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_destroy.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_destroy.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_destroy.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_duplicate.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_duplicate.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_duplicate.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_flags.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_flags.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_flags.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_id.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_id.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_id.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_opcode.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_opcode.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_opcode.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_rcode.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_rcode.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_get_rcode.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_add.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_add.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_add.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_cnt.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_cnt.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_cnt.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_get.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_get.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_get.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_set_name.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_set_name.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_set_name.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_set_type.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_set_type.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_query_set_type.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_add.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_add.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_add.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_cnt.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_cnt.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_cnt.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_del.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_del.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_del.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_get.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_get.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_get.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_get_const.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_get_const.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_rr_get_const.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_set_id.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_set_id.3 new file mode 100644 index 0000000000000000000000000000000000000000..4acc581d29789ca955b8ca817020ac938d1a624e --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_record_set_id.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_record.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr.3 new file mode 100644 index 0000000000000000000000000000000000000000..4da768650b5cb876492c29789c7d3c4f2bb1caab --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr.3 @@ -0,0 +1,744 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.\" +.TH ARES_DNS_RR 3 "12 November 2023" +.SH NAME +ares_dns_record_rr_add, ares_dns_record_rr_cnt, ares_dns_record_rr_del, +ares_dns_record_rr_get, ares_dns_record_rr_get_const, ares_dns_rr_get_addr, +ares_dns_rr_get_addr6, ares_dns_rr_get_bin, ares_dns_rr_get_abin_cnt, +ares_dns_rr_get_abin, ares_dns_rr_get_class, +ares_dns_rr_get_name, ares_dns_rr_get_opt, ares_dns_rr_get_opt_byid, +ares_dns_rr_get_opt_cnt, ares_dns_rr_get_str, ares_dns_rr_get_ttl, +ares_dns_rr_get_type, ares_dns_rr_get_u16, ares_dns_rr_get_u32, +ares_dns_rr_get_u8, ares_dns_rr_key_t, ares_dns_rr_set_addr, +ares_dns_rr_set_addr6, ares_dns_rr_set_bin, ares_dns_rr_add_abin, +ares_dns_rr_del_abin, ares_dns_rr_set_opt, +ares_dns_rr_set_str, ares_dns_rr_set_u16, ares_dns_rr_set_u32, +ares_dns_rr_set_u8, ares_dns_section_t, ares_tlsa_match_t, +ares_tlsa_selector_t, ares_tlsa_usage_t \- +DNS Resource Record creating, reading, and writing functions. +.SH SYNOPSIS +.nf +#include + +size_t ares_dns_record_rr_cnt(const ares_dns_record_t *dnsrec, + ares_dns_section_t sect); + +ares_status_t ares_dns_record_rr_add(ares_dns_rr_t **rr_out, + ares_dns_record_t *dnsrec, + ares_dns_section_t sect, + const char *name, + ares_dns_rec_type_t type, + ares_dns_class_t rclass, + unsigned int ttl); + +ares_dns_rr_t *ares_dns_record_rr_get(ares_dns_record_t *dnsrec, + ares_dns_section_t sect, + size_t idx); + +const ares_dns_rr_t *ares_dns_record_rr_get_const(const ares_dns_record_t *dnsrec, + ares_dns_section_t sect, + size_t idx); + +ares_status_t ares_dns_record_rr_del(ares_dns_record_t *dnsrec, + ares_dns_section_t sect, + size_t idx); + +const char *ares_dns_rr_get_name(const ares_dns_rr_t *rr); + +ares_dns_rec_type_t ares_dns_rr_get_type(const ares_dns_rr_t *rr); + +ares_dns_class_t ares_dns_rr_get_class(const ares_dns_rr_t *rr); + +unsigned int ares_dns_rr_get_ttl(const ares_dns_rr_t *rr); + +ares_status_t ares_dns_rr_set_addr(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const struct in_addr *addr); + +ares_status_t ares_dns_rr_set_addr6(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const struct ares_in6_addr *addr); + +ares_status_t ares_dns_rr_set_str(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const char *val); + +ares_status_t ares_dns_rr_set_u8(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned char val); + +ares_status_t ares_dns_rr_set_u16(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short val); + +ares_status_t ares_dns_rr_set_u32(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned int val); + +ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const unsigned char *val, + size_t len); + +ares_status_t ares_dns_rr_add_abin(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + const unsigned char *val, + size_t len); + +ares_status_t ares_dns_rr_del_abin(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + size_t idx); + +ares_status_t ares_dns_rr_set_opt(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short opt, + const unsigned char *val, + size_t val_len); + +ares_status_t ares_dns_rr_del_opt_byid(ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short opt); + +const struct in_addr *ares_dns_rr_get_addr(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +const struct ares_in6_addr *ares_dns_rr_get_addr6(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +const char *ares_dns_rr_get_str(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +unsigned char ares_dns_rr_get_u8(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +unsigned short ares_dns_rr_get_u16(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +unsigned int ares_dns_rr_get_u32(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +const unsigned char *ares_dns_rr_get_bin(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + size_t *len); + +size_t ares_dns_rr_get_abin_cnt(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +const unsigned char *ares_dns_rr_get_abin(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, size_t idx, + size_t *len); + +size_t ares_dns_rr_get_opt_cnt(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key); + +unsigned short ares_dns_rr_get_opt(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + size_t idx, + const unsigned char **val, + size_t *val_len); + +ares_bool_t ares_dns_rr_get_opt_byid(const ares_dns_rr_t *dns_rr, + ares_dns_rr_key_t key, + unsigned short opt, + const unsigned char **val, + size_t *val_len); + +.fi +.SH ENUMERATIONS + +.B ares_dns_section_t - +DNS RR section types: +.RS 4 +.B ARES_SECTION_ANSWER +- Answer section +.br +.B ARES_SECTION_AUTHORITY +- Authority section +.br +.B ARES_SECTION_ADDITIONAL +- Additional Information section +.br +.RE + +.B ares_dns_rr_key_t - +Keys used for handling RR record parameters: +.RS 4 +.B ARES_RR_A_ADDR +- A Record. Address. Datatype: \fIARES_DATATYPE_INADDR\fP +.br +.B ARES_RR_NS_NSDNAME +- NS Record. Name. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_CNAME_CNAME +- CNAME Record. CName. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_SOA_MNAME +- SOA Record. MNAME, Primary Source of Data. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_SOA_RNAME +- SOA Record. RNAME, Mailbox of person responsible. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_SOA_SERIAL +- SOA Record. Serial, version. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_SOA_REFRESH +- SOA Record. Refresh, zone refersh interval. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_SOA_RETRY +- SOA Record. Retry, failed refresh retry interval. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_SOA_EXPIRE +- SOA Record. Expire, upper limit on authority. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_SOA_MINIMUM +- SOA Record. Minimum, RR TTL. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_PTR_DNAME +- PTR Record. DNAME, pointer domain. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_HINFO_CPU +- HINFO Record. CPU. Datatype: \fIARES_DATATYPE_STR\fP +.br +.B ARES_RR_HINFO_OS +- HINFO Record. OS. Datatype: \fIARES_DATATYPE_STR\fP +.br +.B ARES_RR_MX_PREFERENCE +- MX Record. Preference. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_MX_EXCHANGE +- MX Record. Exchange, domain. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_TXT_DATA +- TXT Record. Data. Datatype: \fIARES_DATATYPE_ABINP\fP +.br +.B ARES_RR_SIG_TYPE_COVERED +- SIG Record. Type Covered. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_SIG_ALGORITHM +- SIG Record. Algorithm. Datatype: \fIARES_DATATYPE_U8\fP +.br +.B ARES_RR_SIG_LABELS +- SIG Record. Labels. Datatype: \fIARES_DATATYPE_U8\fP +.br +.B ARES_RR_SIG_ORIGINAL_TTL +- SIG Record. Original TTL. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_SIG_EXPIRATION +- SIG Record. Signature Expiration. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_SIG_INCEPTION +- SIG Record. Signature Inception. Datatype: \fIARES_DATATYPE_U32\fP +.br +.B ARES_RR_SIG_KEY_TAG +- SIG Record. Key Tag. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_SIG_SIGNERS_NAME +- SIG Record. Signer's Name. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_SIG_SIGNATURE +- SIG Record. Signature. Datatype: \fIARES_DATATYPE_BIN\fP +.br +.B ARES_RR_AAAA_ADDR +- AAAA Record. Address. Datatype: \fIARES_DATATYPE_INADDR6\fP +.br +.B ARES_RR_SRV_PRIORITY +- SRV Record. Priority. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_SRV_WEIGHT +- SRV Record. Weight. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_SRV_PORT +- SRV Record. Port. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_SRV_TARGET +- SRV Record. Target domain. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_NAPTR_ORDER +- NAPTR Record. Order. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_NAPTR_PREFERENCE +- NAPTR Record. Preference. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_NAPTR_FLAGS +- NAPTR Record. Flags. Datatype: \fIARES_DATATYPE_STR\fP +.br +.B ARES_RR_NAPTR_SERVICES +- NAPTR Record. Services. Datatype: \fIARES_DATATYPE_STR\fP +.br +.B ARES_RR_NAPTR_REGEXP +- NAPTR Record. Regexp. Datatype: \fIARES_DATATYPE_STR\fP +.br +.B ARES_RR_NAPTR_REPLACEMENT +- NAPTR Record. Replacement. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_OPT_UDP_SIZE +- OPT Record. UDP Size. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_OPT_VERSION +- OPT Record. Version. Datatype: \fIARES_DATATYPE_U8\fP +.br +.B ARES_RR_OPT_FLAGS +- OPT Record. Flags. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_OPT_OPTIONS +- OPT Record. Options. See \fIares_opt_param_t\fP. Datatype: \fIARES_DATATYPE_OPT\fP +.br +.B ARES_RR_TLSA_CERT_USAGE +- TLSA Record. Certificate Usage. See \fIares_tlsa_usage_t\fP. Datatype: \fIARES_DATATYPE_U8\fP +.br +.B ARES_RR_TLSA_SELECTOR +- TLSA Record. Selector. See \fIares_tlsa_selector_t\fP. Datatype: \fIARES_DATATYPE_U8\fP +.br +.B ARES_RR_TLSA_MATCH +- TLSA Record. Matching Type. See \fIares_tlsa_match_t\fP. Datatype: \fIARES_DATATYPE_U8\fP +.br +.B ARES_RR_TLSA_DATA +- TLSA Record. Certificate Association Data. Datatype: \fIARES_DATATYPE_BIN\fP +.br +.B ARES_RR_SVCB_PRIORITY +- SVCB Record. SvcPriority. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_SVCB_TARGET +- SVCB Record. TargetName. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_SVCB_PARAMS +- SVCB Record. SvcParams. See \fIares_svcb_param_t\fP. Datatype: \fIARES_DATATYPE_OPT\fP +.br +.B ARES_RR_HTTPS_PRIORITY +- HTTPS Record. SvcPriority. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_HTTPS_TARGET +- HTTPS Record. TargetName. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_HTTPS_PARAMS +- HTTPS Record. SvcParams. See \fIares_svcb_param_t\fP. Datatype: \fIARES_DATATYPE_OPT\fP +.br +.B ARES_RR_URI_PRIORITY +- URI Record. Priority. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_URI_WEIGHT +- URI Record. Weight. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_URI_TARGET +- URI Record. Target domain. Datatype: \fIARES_DATATYPE_NAME\fP +.br +.B ARES_RR_CAA_CRITICAL +- CAA Record. Critical flag. Datatype: \fIARES_DATATYPE_U8\fP +.br +.B ARES_RR_CAA_TAG +- CAA Record. Tag/Property. Datatype: \fIARES_DATATYPE_STR\fP +.br +.B ARES_RR_CAA_VALUE +- CAA Record. Value. Datatype: \fIARES_DATATYPE_BINP\fP +.br +.B ARES_RR_RAW_RR_TYPE +- RAW Record. RR Type. Datatype: \fIARES_DATATYPE_U16\fP +.br +.B ARES_RR_RAW_RR_DATA +- RAW Record. RR Data. Datatype: \fIARES_DATATYPE_BIN\fP +.br +.RE + +.B ares_tlsa_usage_t - +TLSA Record \fIARES_RR_TLSA_CERT_USAGE\fP known values +.RS 4 +.B ARES_TLSA_USAGE_CA +- Certificate Usage 0. CA Constraint +.br +.B ARES_TLSA_USAGE_SERVICE +- Certificate Usage 1. Service Certificate Constraint +.br +.B ARES_TLSA_USAGE_TRUSTANCHOR +- Certificate Usage 2. Trust Anchor Assertion +.br +.B ARES_TLSA_USAGE_DOMAIN +- Certificate Usage 3. Domain-issued certificate +.br +.RE + +.B ares_tlsa_selector_t - +TLSA Record \fIARES_RR_TLSA_SELECTOR\fP known values: +.RS 4 +.B ARES_TLSA_SELECTOR_FULL +- Full Certificate +.br +.B ARES_TLSA_SELECTOR_SUBJPUBKEYINFO +- DER-encoded SubjectPublicKeyInfo +.br +.RE + +.B ares_tlsa_match_t - +TLSA Record \fIARES_RR_TLSA_MATCH\fP known values: +.RS 4 +.B ARES_TLSA_MATCH_EXACT +- Exact match +.br +.B ARES_TLSA_MATCH_SHA256 +- Sha256 match +.br +.B ARES_TLSA_MATCH_SHA512 +- Sha512 match +.br +.RE + + +.SH DESCRIPTION + +The \fIares_dns_record_rr_cnt(3)\fP function returns the number of resource +records in the DNS record provided by the +.IR dnsrec +parameter for the section provided in the +.IR sect +parameter. + +The \fIares_dns_record_rr_add(3)\fP function adds a new resource record entry +the the DNS record provided by the +.IR dnsrec +parameter. The resulting resource record is stored into the variable pointed to by +.IR rr_out. +The DNS section the resource record belongs to is specified by the +.IR sect +parameter. The domain name associated with the resource record is specified by the +.IR name +parameter, which can not be NULL but may be an empty string, or ".". The resource +record type is specified in the +.IR type +parameter, along with the DNS record class in the +.IR rclass +parameter, and the Time To Live (TTL) in the +.IR ttl +parameter. + + +The \fIares_dns_record_rr_get(3)\fP and \fIares_dns_record_rr_get_const(3)\fP +functions are used to retrieve the resource record pointer from the DNS record +provided in the +.IR dnsrec +parameter, for the resource record section provided in the +.IR sect +parameter, for the specified index in the +.IR idx +parameter. The index must be less than \fIares_dns_record_rr_cnt(3)\fP. The +former returns a writable pointer to the resource record, while the latter +returns a read-only pointer to the resource record. + + +The \fIares_dns_record_rr_del(3)\fP is used to delete a resource record from +the DNS record specified in the +.IR dnsrec +parameter. Its primary use is to remove a \fIARES_REC_TYPE_OPT\fP record when +needing to retry a query without EDNS support. The DNS RR section is specified +via the +.IR sect +parameter, and the index to remove is specified in the +.IR idx +parameter. The index must be less than \fIares_dns_record_rr_cnt(3)\fP. + + +The \fIares_dns_rr_get_name(3)\fP function is used to retrieve the resource +record domain name from the Resource Record pointer provided in the +.IR rr +parameter. + +The \fIares_dns_rr_get_type(3)\fP function is used to retrieve the resource +record type from the Resource Record pointer provided in the +.IR rr +parameter. + +The \fIares_dns_rr_get_class(3)\fP function is used to retrieve the resource +record class from the Resource Record pointer provided in the +.IR rr +parameter. + +The \fIares_dns_rr_get_ttl(3)\fP function is used to retrieve the resource +record class Time to Live (TTL) from the Resource Record pointer provided in the +.IR rr +parameter. + +The \fIares_dns_rr_set_addr(3)\fP function is used to set an IPv4 address for the +associated resource record key/parameter when the datatype is \fIARES_DATATYPE_INADDR\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR addr +parameter. + +The \fIares_dns_rr_set_addr6(3)\fP function is used to set an IPv6 address for the +associated resource record key/parameter when the datatype is \fIARES_DATATYPE_INADDR6\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR addr +parameter. + +The \fIares_dns_rr_set_str(3)\fP function is used to set a string for the +associated resource record key/parameter when the datatype is \fIARES_DATATYPE_STR\fP +or \fIARES_DATATYPE_NAME\fP. Most strings are limited to 255 bytes, +however some records, such as a TXT record may allow longer as they are output +as multiple strings. The resource record to be modified is +provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR val +parameter. + +The \fIares_dns_rr_set_u8(3)\fP function is used to set an 8bit unsigned value for the +associated resource record key/parameter when the datatype is \fIARES_DATATYPE_U8\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR val +parameter. + +The \fIares_dns_rr_set_u16(3)\fP function is used to set an 16bit unsigned value for the +associated resource record key/parameter when the datatype is \fIARES_DATATYPE_U16\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR val +parameter. + +The \fIares_dns_rr_set_u32(3)\fP function is used to set an 32bit unsigned value for the +associated resource record key/parameter when the datatype is \fIARES_DATATYPE_U32\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR val +parameter. + +The \fIares_dns_rr_set_bin(3)\fP function is used to set a binary value for the +associated resource record key/parameter when the datatype is \fIARES_DATATYPE_BIN\fP +or \fIARES_DATATYPE_BINP\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR val +parameter. And the associated value length is provided in the +.IR len +parameter. + +The \fIares_dns_rr_add_abin(3)\fP function is used to append a binary value in +the array for the associated resource record key/parameter when the datatype +is \fIARES_DATATYPE_ABINP\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the value is provided in the +.IR val +parameter. And the associated value length is provided in the +.IR len +parameter. + +The \fIares_dns_rr_del_abin(3)\fP function is used to delete a binary value in +the array for the associated resource record key/parameter when the datatype +is \fIARES_DATATYPE_ABINP\fP. +The resource record to be modified is provided in the +.IR dns_rr +parameter, the key/parameter is provided in the +.IR key +parameter, and the index to remove is provided in the +.IR idx +parameter. + +The \fIares_dns_rr_set_opt(3)\fP function is used to set option/parameter keys and +values for the resource record when the datatype is \fIARES_DATATYPE_OPT\fP. The +resource record to be modified is provided in the +.IR dns_rr +parameter. They key/parameter is provided in the +.IR key +parameter. The option/parameter value specific to the resource record is provided +in the +.IR opt +parameter, and this is left to the user to determine the appropriate value to +use. Some known values may be provided by \fIares_svcb_param_t\fP and \fIares_opt_param_t\fP +enumerations. The value for the option is always provided in binary form in +.IR val +with length provided in +.IR val_len. + +The \fIares_dns_rr_del_opt_byid(3)\fP function is used to delete option/parameter +keys and values for the resource record when the datatype is +\fIARES_DATATYPE_OPT\fP. The resource record to be modified is provided in the +.IR dns_rr +parameter. They key/parameter is provided in the +.IR key +parameter. The option/parameter value specific to the resource record is provided +in the +.IR opt +parameter. This function returns \fIARES_SUCCESS\fP if the record is successfully +removed, or \fIARES_ENOTFOUND\fP if the record could not be found. + +The \fIares_dns_rr_get_addr(3)\fP function is used to retrieve the IPv4 address +from the resource record when the datatype is \fIARES_DATATYPE_INADDR\fP. The +resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter. + +The \fIares_dns_rr_get_addr6(3)\fP function is used to retrieve the IPv6 address +from the resource record when the datatype is \fIARES_DATATYPE_INADDR6\fP. The +resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter. + +The \fIares_dns_rr_get_str(3)\fP function is used to retrieve a string +from the resource record when the datatype is \fIARES_DATATYPE_STR\fP or +\fIARES_DATATYPE_NAME\fP. The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter. + +The \fIares_dns_rr_get_u8(3)\fP function is used to retrieve an 8bit integer +from the resource record when the datatype is \fIARES_DATATYPE_U8\fP. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter. + +The \fIares_dns_rr_get_u16(3)\fP function is used to retrieve a 16bit integer +from the resource record when the datatype is \fIARES_DATATYPE_U16\fP. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter. + +The \fIares_dns_rr_get_u32(3)\fP function is used to retrieve a 32bit integer +from the resource record when the datatype is \fIARES_DATATYPE_U32\fP. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter. + +The \fIares_dns_rr_get_bin(3)\fP function is used to retrieve binary data +from the resource record when the datatype is \fIARES_DATATYPE_BIN\fP or +\fIARES_DATATYPE_BINP\fP. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter, and length is stored into the variable pointed to by +.IR len. + +The \fIares_dns_rr_get_abin_cnt(3)\fP function is used to retrieve the count +of the array of stored binary values from the resource record when the datatype +is \fIARES_DATATYPE_ABINP\fP. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter. + +The \fIares_dns_rr_get_abin(3)\fP function is used to retrieve binary data from +the resource record array when the datatype is \fIARES_DATATYPE_ABINP\fP. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter, and the index to retrieve from the array is provided by the +.IR idx +parameter, and length is stored into the variable pointed to by +.IR len. + +The \fIares_dns_rr_get_opt_cnt(3)\fP function is used to retrieve the count +of options/parameters associated with the resource record when the datatype +is \fIARES_DATATYPE_OPT\fP. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key. + +The \fIares_dns_rr_get_opt(3)\fP function is used to retrieve binary option data +from the resource record when the datatype is \fIARES_DATATYPE_OPT\fP for the +specified index. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter, the index to retrieve the option data from is provided in the +.IR idx +parameter. The value is stored into the variable pointed to by +.IR val +and length is stored into the variable pointed to by +.IR val_len. + +The \fIares_dns_rr_get_opt_byid(3)\fP function is used to retrieve binary option data +from the resource record when the datatype is \fIARES_DATATYPE_OPT\fP for the +specified option identifier, if it exists. +The resource record is provided in the +.IR dns_rr +parameter and the key/parameter to retrieve is provided in the +.IR key +parameter, the identifier to retrieve the option data from is provided in the +.IR opt +parameter. The value is stored into the variable pointed to by +.IR val +and length is stored into the variable pointed to by +.IR val_len. + + +.SH RETURN VALUES + +\fIares_dns_record_rr_cnt(3)\fP and \fIares_dns_rr_get_opt_cnt(3)\fP return the +respective counts. + +\fIares_dns_record_rr_add(3)\fP, \fIares_dns_record_rr_del(3)\fP, +\fIares_dns_rr_set_addr(3)\fP, \fIares_dns_rr_set_addr6(3)\fP, +\fIares_dns_rr_set_str(3)\fP, \fIares_dns_rr_set_u8(3)\fP, +\fIares_dns_rr_set_u16(3)\fP, \fIares_dns_rr_set_u32(3)\fP, +\fIares_dns_rr_set_bin(3)\fP, \fIares_dns_rr_add_abin(3)\fP, +\fIares_dns_rr_del_abin(3)\fP, +and \fIares_dns_rr_set_opt(3)\fP all return an \fIares_status_t\fP error code. +.B ARES_SUCCESS +is returned on success, +.B ARES_ENOMEM +is returned on out of memory, +.B ARES_EFORMERR +is returned on misuse. + + +\fIares_dns_rr_get_name(3)\fP, \fIares_dns_rr_get_type(3)\fP, +\fIares_dns_rr_get_class(3)\fP, \fIares_dns_rr_get_ttl(3)\fP, +\fIares_dns_rr_get_addr(3)\fP, \fIares_dns_rr_get_addr6(3)\fP, +\fIares_dns_rr_get_str(3)\fP, \fIares_dns_rr_get_u8(3)\fP, +\fIares_dns_rr_get_u16(3)\fP, \fIares_dns_rr_get_u32(3)\fP, +\fIares_dns_rr_get_bin(3)\fP, \fIares_dns_rr_get_abin_cnt(3)\fP, +\fIares_dns_rr_get_abin(3)\fP, \fIares_dns_rr_get_opt(3)\fP all return their +prescribed datatype values and in general can't fail except for misuse cases, +in which a 0 (or NULL) may be returned, however 0 can also be a valid return +value for most of these functions. + +\fIares_dns_record_rr_get(3)\fP and \fIares_dns_record_rr_get_const(3)\fP will +return the requested resource record pointer or NULL on failure (misuse). + +\fIares_dns_rr_get_opt_byid(3)\fP will return ARES_TRUE if the option was +found, otherwise ARES_FALSE if not found (or misuse). + +.SH AVAILABILITY +These functions were first introduced in c-ares version 1.22.0. +.SH SEE ALSO +.BR ares_dns_mapping (3), +.BR ares_dns_record (3), +.BR ares_free_string (3) diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_add_abin.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_add_abin.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_add_abin.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_del_abin.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_del_abin.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_del_abin.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_del_opt_byid.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_del_opt_byid.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_del_opt_byid.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_abin.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_abin.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_abin.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_abin_cnt.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_abin_cnt.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_abin_cnt.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_addr.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_addr.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_addr.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_addr6.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_addr6.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_addr6.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_bin.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_bin.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_bin.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_class.3 b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_class.3 new file mode 100644 index 0000000000000000000000000000000000000000..b93e4cd4e37fa8f207561d8c076cada994bc5864 --- /dev/null +++ b/miniconda3/pkgs/c-ares-1.34.6-hd44998d_0/share/man/man3/ares_dns_rr_get_class.3 @@ -0,0 +1,3 @@ +.\" Copyright (C) 2023 The c-ares project and its contributors. +.\" SPDX-License-Identifier: MIT +.so man3/ares_dns_rr.3 diff --git a/miniconda3/pkgs/ca-certificates-2025.12.2-h06a4308_0.conda b/miniconda3/pkgs/ca-certificates-2025.12.2-h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..4fd057d43899c3d0c4c80ab4a90b527dca33055b --- /dev/null +++ b/miniconda3/pkgs/ca-certificates-2025.12.2-h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c11f114b16e3b392f9e23f62ed6e48df81e1faec9bd036459edf7009bd819ac +size 128414 diff --git a/miniconda3/pkgs/certifi-2026.01.04-py313h06a4308_0.conda b/miniconda3/pkgs/certifi-2026.01.04-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..88dcc47458bed6645ca8af7d8193e1c5fdf35914 --- /dev/null +++ b/miniconda3/pkgs/certifi-2026.01.04-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dca4a436b34e5ab1f62a2dbbd0989e03e7ef375288c10f0b3bc95f1614095dba +size 152128 diff --git a/miniconda3/pkgs/cffi-2.0.0-py313h4eded50_1.conda b/miniconda3/pkgs/cffi-2.0.0-py313h4eded50_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..4d384dcd60e1171acbc1c7d26c16fae7cc839f3f --- /dev/null +++ b/miniconda3/pkgs/cffi-2.0.0-py313h4eded50_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a16eafa37a73eb521aef93e9760f44be8f0180f9ff3e5bccbf2de8f6e762e9a0 +size 295376 diff --git a/miniconda3/pkgs/charset-normalizer-3.4.4-py313h06a4308_0.conda b/miniconda3/pkgs/charset-normalizer-3.4.4-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..a08123453d668ef013cf587ad0f931c7a77012ad --- /dev/null +++ b/miniconda3/pkgs/charset-normalizer-3.4.4-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d84312b64791eac1dad798c86110a0ac53e7d980d6d4c5d32f60ebbb82e4eb4b +size 100520 diff --git a/miniconda3/pkgs/click-8.2.1-py313h06a4308_1.conda b/miniconda3/pkgs/click-8.2.1-py313h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..bcf071e8b02153e2a6d5db483ccb67107b7af187 --- /dev/null +++ b/miniconda3/pkgs/click-8.2.1-py313h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c743088f34421989511925c4fd47bd2d1627e0d47a9ce17ac522971456559dbf +size 327716 diff --git a/miniconda3/pkgs/conda-26.1.1-py313h06a4308_0.conda b/miniconda3/pkgs/conda-26.1.1-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..debd968b4da538837a2213f56d793618a4d4b763 --- /dev/null +++ b/miniconda3/pkgs/conda-26.1.1-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7fa70086625233a494e92418fb58591f43e2c6309cb4c082e3fd778a0280c506 +size 1273463 diff --git a/miniconda3/pkgs/conda-package-handling-2.4.0-py313h06a4308_1.conda b/miniconda3/pkgs/conda-package-handling-2.4.0-py313h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..87bb2979f2d8d13251efd1714f6a63a22188e531 --- /dev/null +++ b/miniconda3/pkgs/conda-package-handling-2.4.0-py313h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1e652dbd4390b12bcf938ece3e85636c12ab54d91a25de7dd1ac8ca84b1b8b1 +size 284840 diff --git a/miniconda3/pkgs/cpp-expected-1.1.0-hdb19cb5_0.conda b/miniconda3/pkgs/cpp-expected-1.1.0-hdb19cb5_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..ec87de5d5104d484b1bd0477d4536f29e7eff4e1 --- /dev/null +++ b/miniconda3/pkgs/cpp-expected-1.1.0-hdb19cb5_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8718137ba3afc2eb8eb986e17442968aec45b32bbd746b64bc239c3019ec7216 +size 132687 diff --git a/miniconda3/pkgs/cryptography-46.0.5-py313h04fe016_1.conda b/miniconda3/pkgs/cryptography-46.0.5-py313h04fe016_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..a8523891e1fb0e7165750488e3d5e4209f93ffd1 --- /dev/null +++ b/miniconda3/pkgs/cryptography-46.0.5-py313h04fe016_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c76ea9750feb5fa1c2c93687f3081ce0b846136f67637c242c7919807c5fbc02 +size 1706134 diff --git a/miniconda3/pkgs/dbus-1.16.2-h5bd4931_0.conda b/miniconda3/pkgs/dbus-1.16.2-h5bd4931_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..fcd91694517a6468b20ffc6096609ca78afeb930 --- /dev/null +++ b/miniconda3/pkgs/dbus-1.16.2-h5bd4931_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff936d58ce18451f18cba16a8ade9365199a6321d4eb1c60c1eb1d8e3932c65b +size 1259937 diff --git a/miniconda3/pkgs/fmt-11.2.0-hca5f364_0.conda b/miniconda3/pkgs/fmt-11.2.0-hca5f364_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..f09d1a867294ca3de3dfe9df9d0f8d2d05e841e4 --- /dev/null +++ b/miniconda3/pkgs/fmt-11.2.0-hca5f364_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:851afd6890164c6894572c275a7d3fb87dac4ce8b3760925febb2c3779306275 +size 206513 diff --git a/miniconda3/pkgs/gettext-0.25.1-h92eb808_0.conda b/miniconda3/pkgs/gettext-0.25.1-h92eb808_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..de5f48d0ccce3eb7575cdf3ddec6005123c91ebd --- /dev/null +++ b/miniconda3/pkgs/gettext-0.25.1-h92eb808_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a83e26f502a98bce1348b67f61e8ada17304080be574e743a434ccbefc8c142 +size 535333 diff --git a/miniconda3/pkgs/gettext-tools-0.25.1-h6a67909_0.conda b/miniconda3/pkgs/gettext-tools-0.25.1-h6a67909_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..476c58fb8b4c0e461e63385cd92fe814add79a40 --- /dev/null +++ b/miniconda3/pkgs/gettext-tools-0.25.1-h6a67909_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:040af24b30b7928def70ffc1fb0deb502156796993a26d95aeb3df90b92b755c +size 3777431 diff --git a/miniconda3/pkgs/httpcore-1.0.9-py313h06a4308_0.conda b/miniconda3/pkgs/httpcore-1.0.9-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..df527bd8a0001992fcc4d7c8101bd627c34612ef --- /dev/null +++ b/miniconda3/pkgs/httpcore-1.0.9-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43cf7bc5c9c8a5a7470c5b7c6b1ad0f67319bf4de5b958d7c1e7027e63029cc4 +size 127896 diff --git a/miniconda3/pkgs/httpx-0.28.1-py313h06a4308_1.conda b/miniconda3/pkgs/httpx-0.28.1-py313h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..7aafd374971a81d468ac72165c6b06aba18cd55e --- /dev/null +++ b/miniconda3/pkgs/httpx-0.28.1-py313h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea875a1564f96bd1fdbaf82e6fa51d829f099b7f69a5a9e76c5ea9d5483d9288 +size 217558 diff --git a/miniconda3/pkgs/icu-73.1-h6a678d5_0.conda b/miniconda3/pkgs/icu-73.1-h6a678d5_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..14155f53f844c1c8a2801ff43e6fb20e4ed06714 --- /dev/null +++ b/miniconda3/pkgs/icu-73.1-h6a678d5_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f60e8a4b965ba50214f5a7a24308c060860fa5062d9d69d581287a520006abba +size 27195861 diff --git a/miniconda3/pkgs/idna-3.11-py313h06a4308_0.conda b/miniconda3/pkgs/idna-3.11-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..bbeeb8ba5c2802972f92f2ba2322e641d932136d --- /dev/null +++ b/miniconda3/pkgs/idna-3.11-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cbd75d6f8a108b989d3f580ffc40fbee43349e272794d1227fb11fe31191196 +size 202882 diff --git a/miniconda3/pkgs/ld_impl_linux-64-2.44-h153f514_2.conda b/miniconda3/pkgs/ld_impl_linux-64-2.44-h153f514_2.conda new file mode 100644 index 0000000000000000000000000000000000000000..394d6cf456bc82ec96fb8e47fdfe32a774f5bd6a --- /dev/null +++ b/miniconda3/pkgs/ld_impl_linux-64-2.44-h153f514_2.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89bc181d3d5976e5d7a763329c8877031e36ae5a3e9eabe7475e3cb1f55f5822 +size 688236 diff --git a/miniconda3/pkgs/ld_impl_linux-64-2.44-h9e0c5a2_3.conda b/miniconda3/pkgs/ld_impl_linux-64-2.44-h9e0c5a2_3.conda new file mode 100644 index 0000000000000000000000000000000000000000..f77375ae263f02734a8397edf7b1f109ad8a3fdb --- /dev/null +++ b/miniconda3/pkgs/ld_impl_linux-64-2.44-h9e0c5a2_3.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a4875ab4354d4a1bf1695850efad8787d7063387ed6b5aec5ecb659869e2590 +size 742162 diff --git a/miniconda3/pkgs/libarchive-3.8.2-h3ec8f01_0.conda b/miniconda3/pkgs/libarchive-3.8.2-h3ec8f01_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..161f03dddf4d861349a356232d62fa059697db99 --- /dev/null +++ b/miniconda3/pkgs/libarchive-3.8.2-h3ec8f01_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47b727b2add2529ee9f983fefda5307a728941e95f48b467119865ef17ec417c +size 875632 diff --git a/miniconda3/pkgs/libbrotlienc-1.2.0-h2e96acb_0.conda b/miniconda3/pkgs/libbrotlienc-1.2.0-h2e96acb_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..a0301333536eb8a81a2d73610a0c51a2b40c1c16 --- /dev/null +++ b/miniconda3/pkgs/libbrotlienc-1.2.0-h2e96acb_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31c153a8165bef6673fb460b9dd4cb6ed4904585cc455ab827282044fcfcce95 +size 279951 diff --git a/miniconda3/pkgs/libcurl-8.18.0-h3506a8c_0.conda b/miniconda3/pkgs/libcurl-8.18.0-h3506a8c_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..a7f77d936353d38fd16f9af100ded8d4218fc558 --- /dev/null +++ b/miniconda3/pkgs/libcurl-8.18.0-h3506a8c_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ac765625f1b438fe4b6dce0771d2b9468f44cc370f2646aa1ac1b4215460f1c +size 497677 diff --git a/miniconda3/pkgs/libev-4.33-h7f8727e_1.conda b/miniconda3/pkgs/libev-4.33-h7f8727e_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..81755a13f069d1418a16f055043e733f653dbea9 --- /dev/null +++ b/miniconda3/pkgs/libev-4.33-h7f8727e_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75f04cf201848d58df127caf9f316f71e1103b28e00b5add9b0c8025e52d7569 +size 114011 diff --git a/miniconda3/pkgs/libexpat-2.7.4-h7354ed3_0.conda b/miniconda3/pkgs/libexpat-2.7.4-h7354ed3_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..f9c1cb37d6e18f46f14b32d94901be4051942fb3 --- /dev/null +++ b/miniconda3/pkgs/libexpat-2.7.4-h7354ed3_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aaeb0b0bc0ca292600e19979b38afe692bde0a8bde24031d1e1ddced76b5e46d +size 124967 diff --git a/miniconda3/pkgs/libffi-3.4.4-h6a678d5_1.conda b/miniconda3/pkgs/libffi-3.4.4-h6a678d5_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..e9735c9fcdc0b12aeee719f6e40af85be276dd50 --- /dev/null +++ b/miniconda3/pkgs/libffi-3.4.4-h6a678d5_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0e7fe2e5d498bc5a2c57cf942701bba8f22ec55de55e092ffbffc40b816df88 +size 144691 diff --git a/miniconda3/pkgs/libgcc-15.2.0-h69a1729_7.conda b/miniconda3/pkgs/libgcc-15.2.0-h69a1729_7.conda new file mode 100644 index 0000000000000000000000000000000000000000..0f7d279ba1e95ddb1fad75535c03eedca7d6d6b5 --- /dev/null +++ b/miniconda3/pkgs/libgcc-15.2.0-h69a1729_7.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:baf9d8d16e2a8ae7a4d1b80f2c1a932deaca1a87c677a370f6ab4688482db47b +size 825084 diff --git a/miniconda3/pkgs/libgettextpo-0.25.1-hf2ab22a_0.conda b/miniconda3/pkgs/libgettextpo-0.25.1-hf2ab22a_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..29bd863a8fb98a83bdb7d297b96638ce2aaab9e4 --- /dev/null +++ b/miniconda3/pkgs/libgettextpo-0.25.1-hf2ab22a_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1585ccdee3503c2e055014197f63b99ac47a7493c612beef2162cbdd9f5528c +size 190134 diff --git a/miniconda3/pkgs/libgomp-15.2.0-h4751f2c_7.conda b/miniconda3/pkgs/libgomp-15.2.0-h4751f2c_7.conda new file mode 100644 index 0000000000000000000000000000000000000000..1b834cb3efe365b3f0f157c169314fa32645de3c --- /dev/null +++ b/miniconda3/pkgs/libgomp-15.2.0-h4751f2c_7.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:835e44371812c91563a00dec8bc98c460f8b9f33f50543244bc8774c446a2172 +size 446183 diff --git a/miniconda3/pkgs/libiconv-1.18-h75a1612_0.conda b/miniconda3/pkgs/libiconv-1.18-h75a1612_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..0bd7c6a236f9dc3b8dd6f2d8ab7b807c28200352 --- /dev/null +++ b/miniconda3/pkgs/libiconv-1.18-h75a1612_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8852881ce7522ad4b9eb45ba94cd353f6b381ffd3f9fb5d31426ce2abd8c3ab0 +size 789520 diff --git a/miniconda3/pkgs/libkrb5-1.22.1-h6d2bf13_0.conda b/miniconda3/pkgs/libkrb5-1.22.1-h6d2bf13_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..9d2b1bb8765936043b11cff0219226dc246d2f76 --- /dev/null +++ b/miniconda3/pkgs/libkrb5-1.22.1-h6d2bf13_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1e8f3db4a01a7939d3eda83b632f7f9d3910ff4a03bcd124df099740509be97 +size 808402 diff --git a/miniconda3/pkgs/libmamba-2.3.2-h860b5fb_1.conda b/miniconda3/pkgs/libmamba-2.3.2-h860b5fb_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..069ca379e9543a6c40e5aedf8f81e53a4db67bdc --- /dev/null +++ b/miniconda3/pkgs/libmamba-2.3.2-h860b5fb_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87776624e4882955942a61799db0cafd19e5ab26874ddcb99cca2d66a4ea287d +size 2061828 diff --git a/miniconda3/pkgs/libmambapy-2.3.2-py313h3f77f5b_1.conda b/miniconda3/pkgs/libmambapy-2.3.2-py313h3f77f5b_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..fcd2f145197b59f6d7cd84998f636d92dafa34c2 --- /dev/null +++ b/miniconda3/pkgs/libmambapy-2.3.2-py313h3f77f5b_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:feedf8857d483851cf41a5ff9d625ea9c100194d54a974259072e215a3f86307 +size 663170 diff --git a/miniconda3/pkgs/libnghttp2-1.67.1-h697f920_0.conda b/miniconda3/pkgs/libnghttp2-1.67.1-h697f920_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..8668bacc459b3866ce37524c84fd7399a04e6e5b --- /dev/null +++ b/miniconda3/pkgs/libnghttp2-1.67.1-h697f920_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73b3c00697e9a1a5693e9ff70f7995dc27ac11a72524cb9fd71b60b6da480a1d +size 651583 diff --git a/miniconda3/pkgs/libsolv-0.7.30-h6f1ccf3_2.conda b/miniconda3/pkgs/libsolv-0.7.30-h6f1ccf3_2.conda new file mode 100644 index 0000000000000000000000000000000000000000..fbd797ad4096ca6b2e4490715248dcde7c0fc66a --- /dev/null +++ b/miniconda3/pkgs/libsolv-0.7.30-h6f1ccf3_2.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a04f79942f6d2ab8004fc61fa663a9fbc020bec723a45db19d56b81e4bedcf5 +size 465860 diff --git a/miniconda3/pkgs/libssh2-1.11.1-h251f7ec_0.conda b/miniconda3/pkgs/libssh2-1.11.1-h251f7ec_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..b2777fc77331821dcb2a80408f8bc6b6ac3dba42 --- /dev/null +++ b/miniconda3/pkgs/libssh2-1.11.1-h251f7ec_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57da13c06557d7d6f21a0ac6d1e83a3e990d2217adcc4dc395009eb56ed040a2 +size 315187 diff --git a/miniconda3/pkgs/libstdcxx-15.2.0-h39759b7_7.conda b/miniconda3/pkgs/libstdcxx-15.2.0-h39759b7_7.conda new file mode 100644 index 0000000000000000000000000000000000000000..c4b6e1a16a80fafa39dc333a8cdd2ecd0f03bd15 --- /dev/null +++ b/miniconda3/pkgs/libstdcxx-15.2.0-h39759b7_7.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:747474162ae421d680ab3374d8b11158701206d4a9c4a8f9de557dd6fc13345a +size 3903663 diff --git a/miniconda3/pkgs/libunistring-1.3-hb25bd0a_0.conda b/miniconda3/pkgs/libunistring-1.3-hb25bd0a_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..64412b1a8c28b56b92176a480b75db1215321e23 --- /dev/null +++ b/miniconda3/pkgs/libunistring-1.3-hb25bd0a_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b30c28b4cf48110e983bcee62816c5ac6089379e5aac6f65b8c563430b01754 +size 737806 diff --git a/miniconda3/pkgs/libxcb-1.17.0-h9b100fa_0.conda b/miniconda3/pkgs/libxcb-1.17.0-h9b100fa_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..63f6aef1b0279856c9cd56367c7b640bb430908b --- /dev/null +++ b/miniconda3/pkgs/libxcb-1.17.0-h9b100fa_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9cd1564fc83261ddba7496404f18143d4f8fda52e42c040005c1b1ad3e47f56 +size 440690 diff --git a/miniconda3/pkgs/libxml2-2.13.9-h2c43086_0.conda b/miniconda3/pkgs/libxml2-2.13.9-h2c43086_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..f847f57014b9d72213c081a45fcf27fda2da6acd --- /dev/null +++ b/miniconda3/pkgs/libxml2-2.13.9-h2c43086_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bb90ed726ba5868488184f03aa1c18fe654e00aa36b570a16a66c3d350a868b +size 684847 diff --git a/miniconda3/pkgs/lmdb-0.9.31-hb25bd0a_0.conda b/miniconda3/pkgs/lmdb-0.9.31-hb25bd0a_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..0c08638debfe97a5ea4f87082954795dbd9703ec --- /dev/null +++ b/miniconda3/pkgs/lmdb-0.9.31-hb25bd0a_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:839f0cd7e4a13088dcd9b8ac3213e8992725dd67f8e1a747c54132013b87d4b9 +size 480121 diff --git a/miniconda3/pkgs/lz4-c-1.9.4-h6a678d5_1.conda b/miniconda3/pkgs/lz4-c-1.9.4-h6a678d5_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..f9058cd85a2d9c145d3a8389724508d2f84c0ca9 --- /dev/null +++ b/miniconda3/pkgs/lz4-c-1.9.4-h6a678d5_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc19d62a7f2c0af8e1f0e5bf643cf34475a35d5dc82733d679e575daa7b863aa +size 159495 diff --git a/miniconda3/pkgs/markdown-it-py-4.0.0-py313h06a4308_1.conda b/miniconda3/pkgs/markdown-it-py-4.0.0-py313h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..e65545a1bbea901a9bd892e09d2d192351f1594a --- /dev/null +++ b/miniconda3/pkgs/markdown-it-py-4.0.0-py313h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfed5539652f10a2c344501a4d9928856b50d323fdd390c578fd08e856b7d648 +size 242668 diff --git a/miniconda3/pkgs/menuinst-2.4.2-py313h06a4308_1.conda b/miniconda3/pkgs/menuinst-2.4.2-py313h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..1867c35396205eb4b88db415a713ba5aa263e3ee --- /dev/null +++ b/miniconda3/pkgs/menuinst-2.4.2-py313h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a7cbe8e343d05ea964f6b390b4e8e876423080ddc8efee42da96255a8e45dc8 +size 257750 diff --git a/miniconda3/pkgs/more-itertools-10.8.0-py313h06a4308_0.conda b/miniconda3/pkgs/more-itertools-10.8.0-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..9a12052f89eb61fff1db9e6c984982d04d2ee9c5 --- /dev/null +++ b/miniconda3/pkgs/more-itertools-10.8.0-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6da3706af1a527f98e4db5e9e492836d9315825ee99336230865493ae4ee0a6 +size 167359 diff --git a/miniconda3/pkgs/msgpack-python-1.1.1-py313h6a678d5_0.conda b/miniconda3/pkgs/msgpack-python-1.1.1-py313h6a678d5_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..bd7f3dbc725e17d4620d6fdeb8b32228251c4d11 --- /dev/null +++ b/miniconda3/pkgs/msgpack-python-1.1.1-py313h6a678d5_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9077c988bbab8f4315f9f98657f62d8d0dc87505756d78db808bccb88b32dd5 +size 123032 diff --git a/miniconda3/pkgs/ncurses-6.5-h7934f7d_0.conda b/miniconda3/pkgs/ncurses-6.5-h7934f7d_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..5a3c0b2c66997856606337ea23714199b4ef1287 --- /dev/null +++ b/miniconda3/pkgs/ncurses-6.5-h7934f7d_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ab33c1e90efbb3507116ae00d1f6740ec74104bb7028dc017f5f76796cee154 +size 1137647 diff --git a/miniconda3/pkgs/nlohmann_json-3.11.2-h6a678d5_0.conda b/miniconda3/pkgs/nlohmann_json-3.11.2-h6a678d5_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..5311d9619e21124b0025bb474da5a55b0c9e6df0 --- /dev/null +++ b/miniconda3/pkgs/nlohmann_json-3.11.2-h6a678d5_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd26e0dadf88a0de5851d059eddc2079defdda748a74b32a36393dfe25a8a48a +size 127326 diff --git a/miniconda3/pkgs/openssl-3.5.5-h1b28b03_0.conda b/miniconda3/pkgs/openssl-3.5.5-h1b28b03_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..9fc074ac21a5c1c15b2a14d822379e79d60e2297 --- /dev/null +++ b/miniconda3/pkgs/openssl-3.5.5-h1b28b03_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0dcbe182b4b5270e2c5b35ec90418ae7e2de7a925f8617fdc939dee732a21b8b +size 5818141 diff --git a/miniconda3/pkgs/packaging-25.0-py310h06a4308_1.conda b/miniconda3/pkgs/packaging-25.0-py310h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..ea67fc6988b3d1d92bbd733417eab2c2f7318ae4 --- /dev/null +++ b/miniconda3/pkgs/packaging-25.0-py310h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8840daaccce89d8dfb158869c6fb4b67ea1ee07dd5eb6a8b1f6adafe33443a35 +size 167968 diff --git a/miniconda3/pkgs/packaging-25.0-py313h06a4308_1.conda b/miniconda3/pkgs/packaging-25.0-py313h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..ed4322838e42c99a1c7f3287eb7726775de0ed8e --- /dev/null +++ b/miniconda3/pkgs/packaging-25.0-py313h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d938ecadac1b6468759961d423052784528d5ac5edc001fdcc6486724e8deeaa +size 194549 diff --git a/miniconda3/pkgs/pcre2-10.46-hf426167_0.conda b/miniconda3/pkgs/pcre2-10.46-hf426167_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..1b7c5f1eaec79a368b162108a5046cf846c90685 --- /dev/null +++ b/miniconda3/pkgs/pcre2-10.46-hf426167_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c817569288774a61a8081a9e3aa13de5b24f2fd7c971618c7593c4f1764ad0f8 +size 1289658 diff --git a/miniconda3/pkgs/pip-26.0.1-pyhc872135_0.conda b/miniconda3/pkgs/pip-26.0.1-pyhc872135_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..0f6c11932ddf650e33e73f6308776d0f8fd2c6de --- /dev/null +++ b/miniconda3/pkgs/pip-26.0.1-pyhc872135_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf0b9f989e132d46e3053095c6badf255a91de068e291e723be11da454c8d39f +size 1181205 diff --git a/miniconda3/pkgs/pycparser-2.23-py313h06a4308_0.conda b/miniconda3/pkgs/pycparser-2.23-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..94745043efdd6b268c40b82d641df19b2fde9ac2 --- /dev/null +++ b/miniconda3/pkgs/pycparser-2.23-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:732e3ef6126f3d033e8cc8cd22ba2382118258e81c4be8f34e9dad25bd59f1a5 +size 281676 diff --git a/miniconda3/pkgs/pydantic-2.12.4-py313h06a4308_0.conda b/miniconda3/pkgs/pydantic-2.12.4-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..0c4892ba185deecfbe46a534066ae77df2a9f25e --- /dev/null +++ b/miniconda3/pkgs/pydantic-2.12.4-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9264f0d69ddef9b89435a8fc4260e4ca5efef65ac5337755af5953bc1b10b160 +size 1108479 diff --git a/miniconda3/pkgs/pydantic-core-2.41.5-py313h498d7c9_1.conda b/miniconda3/pkgs/pydantic-core-2.41.5-py313h498d7c9_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..a871c54fdb587482059f6f15693eb08470bfad05 --- /dev/null +++ b/miniconda3/pkgs/pydantic-core-2.41.5-py313h498d7c9_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4964ef04532cce861183176123287df387db41329ad24a7256518b1ec1bb99b9 +size 1932101 diff --git a/miniconda3/pkgs/pydantic-settings-2.12.0-py313h06a4308_0.conda b/miniconda3/pkgs/pydantic-settings-2.12.0-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..352feacc1c96bae5cb1c61af94bf4d260674cdd5 --- /dev/null +++ b/miniconda3/pkgs/pydantic-settings-2.12.0-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb5a99e9367a101fda496ad62cb52e8931772d8bb8f5853b32650d7644afc229 +size 151041 diff --git a/miniconda3/pkgs/pygments-2.19.2-py313h06a4308_0.conda b/miniconda3/pkgs/pygments-2.19.2-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..9920ee347febc228aff711e25701bd436f467ddf --- /dev/null +++ b/miniconda3/pkgs/pygments-2.19.2-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db29f0617602cc1877c699d56780f3c1efa5a26f3f7358b1bf40c5b5ab0bcc9b +size 4938347 diff --git a/miniconda3/pkgs/python-3.10.20-h741d88c_0.conda b/miniconda3/pkgs/python-3.10.20-h741d88c_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..90f1788156dbf582ca2c14a66e85348aebd0c0d9 --- /dev/null +++ b/miniconda3/pkgs/python-3.10.20-h741d88c_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dcee71dc5cd23b1dfa47c10f7fcd1962b51428a24279f04303852cf10c2a2de +size 25274408 diff --git a/miniconda3/pkgs/python-3.13.12-hb7b561f_100_cp313.conda b/miniconda3/pkgs/python-3.13.12-hb7b561f_100_cp313.conda new file mode 100644 index 0000000000000000000000000000000000000000..63a152bea39d54766b561e9866b2198a35be3765 --- /dev/null +++ b/miniconda3/pkgs/python-3.13.12-hb7b561f_100_cp313.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:558a087f71909db8c04f634af023c94d128305f1b313560bf6ed9bb404f731bf +size 33182243 diff --git a/miniconda3/pkgs/readline-8.3-hc2a1206_0.conda b/miniconda3/pkgs/readline-8.3-hc2a1206_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..a5911806af0bdef6941544960e9f6e72d0519be1 --- /dev/null +++ b/miniconda3/pkgs/readline-8.3-hc2a1206_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a438fa74f2776bde137017d6c18214b5da65b557f6a59f877fa4e091582f789 +size 481826 diff --git a/miniconda3/pkgs/requests-2.32.5-py313h06a4308_1.conda b/miniconda3/pkgs/requests-2.32.5-py313h06a4308_1.conda new file mode 100644 index 0000000000000000000000000000000000000000..38e9e0fcc4e6bcd5d4aeb5d914101bb04afc6894 --- /dev/null +++ b/miniconda3/pkgs/requests-2.32.5-py313h06a4308_1.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f29e92b850f997c5b02a819b8d7419e42539ecc6d38279b3ab4cd86f5721e3b +size 170202 diff --git a/miniconda3/pkgs/rich-14.2.0-py313h06a4308_0.conda b/miniconda3/pkgs/rich-14.2.0-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..3810dcd9e64df13582547b8e690b5ed8e93b3c03 --- /dev/null +++ b/miniconda3/pkgs/rich-14.2.0-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4006abedbb05553a7f667566d23afbac4beea2097a96d0508c629b044affde0c +size 604815 diff --git a/miniconda3/pkgs/ruamel.yaml-0.18.16-py313h4aee224_0.conda b/miniconda3/pkgs/ruamel.yaml-0.18.16-py313h4aee224_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..fc8dca02e2f24d61695d3859d4e3c176c1da08b9 --- /dev/null +++ b/miniconda3/pkgs/ruamel.yaml-0.18.16-py313h4aee224_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83d992869476949a782ae72360b1e3b6a224f9238eae988cfad48a968c8b2d8d +size 271868 diff --git a/miniconda3/pkgs/ruamel.yaml.clib-0.2.14-py313h4aee224_0.conda b/miniconda3/pkgs/ruamel.yaml.clib-0.2.14-py313h4aee224_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..7445af496760af62fcb1948682ee544e7964e492 --- /dev/null +++ b/miniconda3/pkgs/ruamel.yaml.clib-0.2.14-py313h4aee224_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df7d182c5909cf1ae37d0ac9878f22ad91e76fdb87f045c0240d4486a7451789 +size 136835 diff --git a/miniconda3/pkgs/setuptools-80.10.2-py310h06a4308_0.conda b/miniconda3/pkgs/setuptools-80.10.2-py310h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..091d525ed84b19563d7f77872105645f9df576f8 --- /dev/null +++ b/miniconda3/pkgs/setuptools-80.10.2-py310h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0d27b7a8156d51453b7ded9cfc26d15479efdaecb35cd74def46dc622faa94b +size 1357731 diff --git a/miniconda3/pkgs/setuptools-80.10.2-py313h06a4308_0.conda b/miniconda3/pkgs/setuptools-80.10.2-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..892e08ae16d4065b7b6d980861f84cb6c634cc3e --- /dev/null +++ b/miniconda3/pkgs/setuptools-80.10.2-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17092619900889441c41b2f20fc068af4d25e0ec4d91b1bf19cbffe6792c7ac8 +size 1776172 diff --git a/miniconda3/pkgs/simdjson-3.10.1-hdb19cb5_0.conda b/miniconda3/pkgs/simdjson-3.10.1-hdb19cb5_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..46ae17cc504ca926147ba52678f121c3a17244c4 --- /dev/null +++ b/miniconda3/pkgs/simdjson-3.10.1-hdb19cb5_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:452430e6b5df349770e48ef41b2a1ecb8e92ec2b3fc31ddea89478f32ea14c16 +size 264262 diff --git a/miniconda3/pkgs/sqlite-3.51.1-he0a8d7e_0.conda b/miniconda3/pkgs/sqlite-3.51.1-he0a8d7e_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..33f849896e8a62d9c79656bcaa0c7413370b328a --- /dev/null +++ b/miniconda3/pkgs/sqlite-3.51.1-he0a8d7e_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f5ed30f1fd5a9affaf7ea4e0c6b173ee1336138d8a9e4d6ac86908dc0577acb +size 1264581 diff --git a/miniconda3/pkgs/sqlite-3.51.2-h3e8d24a_0.conda b/miniconda3/pkgs/sqlite-3.51.2-h3e8d24a_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..b76819c88b98d7b41595393e95fdd589563747c0 --- /dev/null +++ b/miniconda3/pkgs/sqlite-3.51.2-h3e8d24a_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af5dcb4809daf5ab309df062dbdb5df46575743775da9bf1939dae6f61ca36b4 +size 1265119 diff --git a/miniconda3/pkgs/tomlkit-0.13.3-py313h06a4308_0.conda b/miniconda3/pkgs/tomlkit-0.13.3-py313h06a4308_0.conda new file mode 100644 index 0000000000000000000000000000000000000000..3f00b86abe7a558de60980601f1c9dcbec657d3f --- /dev/null +++ b/miniconda3/pkgs/tomlkit-0.13.3-py313h06a4308_0.conda @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:158dd73f8c64c1211ef362a68382c1cd1b1a4814b4c84b4859e5fe066304f22e +size 189342