diff --git a/.gitattributes b/.gitattributes index 0ef08b1615ad5e0c529bfe35881a16738a3c2cae..3014c24505694754654caccfa5c8ce275a3961d4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -663,3 +663,4 @@ evalkit_internvl/lib/python3.10/lib-dynload/_socket.cpython-310-x86_64-linux-gnu evalkit_internvl/lib/python3.10/lib-dynload/_codecs_jp.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text evalkit_internvl/lib/python3.10/site-packages/matplotlib/__pycache__/figure.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text evalkit_internvl/lib/python3.10/__pycache__/turtle.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text +evalkit_internvl/lib/python3.10/__pycache__/_pydecimal.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_bootsubprocess.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_bootsubprocess.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c411cf4d3688acc0159361428b8d5c4303e60b21 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_bootsubprocess.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_collections_abc.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_collections_abc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..753dc4041671536ba049b41ad74b9236fcd0d06b Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_collections_abc.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_compression.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_compression.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..02add74f01e97bae9bfa2fdc3fa2e0706ed01469 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_compression.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_osx_support.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_osx_support.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3638748467c0e7b5d801e22ab73c3ea9c9a3246 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_osx_support.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_pydecimal.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_pydecimal.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ace1192327ddad1685ba30863bb9ec272962cac6 --- /dev/null +++ b/evalkit_internvl/lib/python3.10/__pycache__/_pydecimal.cpython-310.pyc @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:867ec504e3cc49724dd91bb949795ebec4dfbb3ea9fe5873b9907ac81789fba1 +size 157990 diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_sitebuiltins.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_sitebuiltins.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9b41ccaff61727959173c7cd192a4396655b2953 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_sitebuiltins.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_sysconfigdata_x86_64_conda_linux_gnu.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_sysconfigdata_x86_64_conda_linux_gnu.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e510b696b5973a23da2c1ac6d1ac70957da5b950 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_sysconfigdata_x86_64_conda_linux_gnu.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_threading_local.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_threading_local.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6106f9635af5e0cabe9cddeea0172b025b46c7ef Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_threading_local.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/_weakrefset.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/_weakrefset.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..19361327a9f8e9fd7a6bf40b5f4e6dc9dd13b7ae Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/_weakrefset.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/aifc.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/aifc.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e3409b0b7566981217c1559c866d60c64d4117be Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/aifc.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/antigravity.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/antigravity.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cad3fe65c6853d24b19b4c174df8941d9facd9e3 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/antigravity.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/base64.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/base64.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c9408beb971e04b4b038ec67e5a77ee8d417d27c Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/base64.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/binhex.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/binhex.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f35bcb6bf513b760887aaa1058982cd3e674c59d Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/binhex.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/cProfile.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/cProfile.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4233be8a92cb67b0b147cf77b674c3f5e1b7ac27 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/cProfile.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/calendar.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/calendar.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..637a81fe779cc8d59d6e5697a6ece77178324c1e Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/calendar.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/chunk.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/chunk.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aa9f079729be826d2e12618c7d4a3a617122a2c8 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/chunk.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/compileall.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/compileall.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5cfc6beffa7d5e444a56b71b763af9d860172d37 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/compileall.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/contextvars.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/contextvars.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81055646cb28b14e3c849cd7d8e35a2ff759c2b1 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/contextvars.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/copy.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/copy.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..caef1192d0d1033f4a467ad1e5dd037cd0a9b464 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/copy.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/dataclasses.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/dataclasses.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..105b20816f194a4537ef661e9b49469a13e73c0d Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/dataclasses.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/datetime.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/datetime.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13d44246781dfb12e2d367dab6d197f05ed24d5b Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/datetime.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/enum.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/enum.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..daf864eecc329bd49523693c2ac6b1a3ce075144 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/enum.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/ftplib.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/ftplib.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d712099a53bbb47acc6fbb8aff57ab9e0d11d42b Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/ftplib.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/functools.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/functools.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fdedfc746fb13b8d85f626c80be4bc600f606d0f Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/functools.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/getopt.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/getopt.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fc582bf56bc4eb39f3fc9c07d0166b42a41189b2 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/getopt.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/getpass.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/getpass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..91609f6c5fa3994d4f22ac546bc6d5fae0c187a2 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/getpass.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/imp.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/imp.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b61fa662e6a582c81ee5af7fdbbe14e86d12c87b Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/imp.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/inspect.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/inspect.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fca6e8a915a2e3626dd7b97bd106f5802ec87b67 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/inspect.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/io.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/io.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..69cbb56f4a05e78ae92448d9f98837d4fcefe729 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/io.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/keyword.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/keyword.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b93dfb57420d00f193e922b8aa9622072b10cae3 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/keyword.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/locale.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/locale.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..72e7e2cc10997f9eb164dc1bc0bb88593e2cd1b0 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/locale.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/mailbox.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/mailbox.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..20e4a4860b3a91359a7f55592b69e4bd16b80b8f Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/mailbox.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/modulefinder.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/modulefinder.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd297ee4aea1bcb1382fd6dd99a4abd1a080df65 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/modulefinder.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/optparse.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/optparse.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7e98c17a1750e53a36f4148b585942791a678b4d Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/optparse.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/pdb.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/pdb.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca48fa0756e20c8421a9bd0f2ecce46ddf09abad Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/pdb.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/pickle.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/pickle.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d5b48669d1ce933154601942c665f66b24b8791 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/pickle.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/pipes.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/pipes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..20b01828975f7dd41a5ce48f35565ac527de2300 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/pipes.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/platform.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/platform.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93ff2ad6f2f9234c4bf21f14f7812d4787a4fe0a Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/platform.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/py_compile.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/py_compile.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f119946ec8b4ac5c87f66c7f6223e3d11dfc45ce Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/py_compile.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/pyclbr.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/pyclbr.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2f984746862253c8812d1163645501798731a65d Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/pyclbr.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/quopri.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/quopri.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ceffc9d3f3ad390d2ae55be2898c601a5dfc059 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/quopri.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/reprlib.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/reprlib.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9faf1fe2d32312a9b1c5a4f8ffd904270c4e419f Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/reprlib.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/sched.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/sched.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8b28916beea94f0c76160f8e5b556d01da89feb5 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/sched.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/selectors.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/selectors.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6520278fefe2247e9bc8cb0170c496461370b2b8 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/selectors.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/shlex.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/shlex.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..634ea7bbefb26f01ac89832f8fe7719283bbc522 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/shlex.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/shutil.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/shutil.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8637f1e80daca43d5972e23aa82dfa8af9120cb1 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/shutil.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/signal.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/signal.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52e9334a371fbf4f0191f9b72b4e07de30c58930 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/signal.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/socket.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/socket.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2049430a801e49b7fb292b9940a0e4cb78deb56 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/socket.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/socketserver.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/socketserver.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e82158fc0719691551f51ad247f8e07b50d0fae Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/socketserver.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/ssl.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/ssl.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b5b73344e1fd48f3a194a9eaa69c5d88a85f4a0a Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/ssl.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/stat.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/stat.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..880b45a56a80fe6ed92f6769cb51ce94240804bf Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/stat.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/string.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/string.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c6267cdd3ab1899c3bad873e18501707ae37e27 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/string.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/stringprep.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/stringprep.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b137340d414c61a00d883b7ba84dcbff0310f5a1 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/stringprep.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/sunau.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/sunau.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dbce4b0d152f64f6077cdfe8dde058ca7ee42731 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/sunau.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/sysconfig.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/sysconfig.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01ba1ee73097215e70898f86ec6efeb1f7ccd6e3 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/sysconfig.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/tabnanny.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/tabnanny.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d2ead602b0b4d9bfe534224953cc5e61b09ecdbe Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/tabnanny.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/telnetlib.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/telnetlib.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e0b7390b5c23a8726e71ce8ff844d262132a180c Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/telnetlib.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/tempfile.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/tempfile.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dac73a1c502e3cd9bd046e8073deb18e12a57b02 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/tempfile.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/this.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/this.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b57afc5981bd3812470b2988df06a3d1f1a669c8 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/this.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/timeit.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/timeit.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..14b79b985d3cb5c6e159d652e671479d57a92fbc Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/timeit.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/tokenize.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/tokenize.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..07777fe724d7c0db97e85454c3199d75fe92881a Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/tokenize.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/uu.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/uu.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..06d177f31713831586255899e0501d45eeae400f Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/uu.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/weakref.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/weakref.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e3fb0c6795a074b2863c54eb3ab6272b39d020e7 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/weakref.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/__pycache__/zipimport.cpython-310.pyc b/evalkit_internvl/lib/python3.10/__pycache__/zipimport.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21c0b65f8d20802bb36878d36c29f16b0eed4ce9 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/__pycache__/zipimport.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/email/_parseaddr.py b/evalkit_internvl/lib/python3.10/email/_parseaddr.py new file mode 100644 index 0000000000000000000000000000000000000000..febe411355d6be3be8b60bd8c845479451149d6f --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/_parseaddr.py @@ -0,0 +1,557 @@ +# Copyright (C) 2002-2007 Python Software Foundation +# Contact: email-sig@python.org + +"""Email address parsing code. + +Lifted directly from rfc822.py. This should eventually be rewritten. +""" + +__all__ = [ + 'mktime_tz', + 'parsedate', + 'parsedate_tz', + 'quote', + ] + +import time, calendar + +SPACE = ' ' +EMPTYSTRING = '' +COMMASPACE = ', ' + +# Parse a date field +_monthnames = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', + 'aug', 'sep', 'oct', 'nov', 'dec', + 'january', 'february', 'march', 'april', 'may', 'june', 'july', + 'august', 'september', 'october', 'november', 'december'] + +_daynames = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] + +# The timezone table does not include the military time zones defined +# in RFC822, other than Z. According to RFC1123, the description in +# RFC822 gets the signs wrong, so we can't rely on any such time +# zones. RFC1123 recommends that numeric timezone indicators be used +# instead of timezone names. + +_timezones = {'UT':0, 'UTC':0, 'GMT':0, 'Z':0, + 'AST': -400, 'ADT': -300, # Atlantic (used in Canada) + 'EST': -500, 'EDT': -400, # Eastern + 'CST': -600, 'CDT': -500, # Central + 'MST': -700, 'MDT': -600, # Mountain + 'PST': -800, 'PDT': -700 # Pacific + } + + +def parsedate_tz(data): + """Convert a date string to a time tuple. + + Accounts for military timezones. + """ + res = _parsedate_tz(data) + if not res: + return + if res[9] is None: + res[9] = 0 + return tuple(res) + +def _parsedate_tz(data): + """Convert date to extended time tuple. + + The last (additional) element is the time zone offset in seconds, except if + the timezone was specified as -0000. In that case the last element is + None. This indicates a UTC timestamp that explicitly declaims knowledge of + the source timezone, as opposed to a +0000 timestamp that indicates the + source timezone really was UTC. + + """ + if not data: + return None + data = data.split() + if not data: # This happens for whitespace-only input. + return None + # The FWS after the comma after the day-of-week is optional, so search and + # adjust for this. + if data[0].endswith(',') or data[0].lower() in _daynames: + # There's a dayname here. Skip it + del data[0] + else: + i = data[0].rfind(',') + if i >= 0: + data[0] = data[0][i+1:] + if len(data) == 3: # RFC 850 date, deprecated + stuff = data[0].split('-') + if len(stuff) == 3: + data = stuff + data[1:] + if len(data) == 4: + s = data[3] + i = s.find('+') + if i == -1: + i = s.find('-') + if i > 0: + data[3:] = [s[:i], s[i:]] + else: + data.append('') # Dummy tz + if len(data) < 5: + return None + data = data[:5] + [dd, mm, yy, tm, tz] = data + if not (dd and mm and yy): + return None + mm = mm.lower() + if mm not in _monthnames: + dd, mm = mm, dd.lower() + if mm not in _monthnames: + return None + mm = _monthnames.index(mm) + 1 + if mm > 12: + mm -= 12 + if dd[-1] == ',': + dd = dd[:-1] + i = yy.find(':') + if i > 0: + yy, tm = tm, yy + if yy[-1] == ',': + yy = yy[:-1] + if not yy: + return None + if not yy[0].isdigit(): + yy, tz = tz, yy + if tm[-1] == ',': + tm = tm[:-1] + tm = tm.split(':') + if len(tm) == 2: + [thh, tmm] = tm + tss = '0' + elif len(tm) == 3: + [thh, tmm, tss] = tm + elif len(tm) == 1 and '.' in tm[0]: + # Some non-compliant MUAs use '.' to separate time elements. + tm = tm[0].split('.') + if len(tm) == 2: + [thh, tmm] = tm + tss = 0 + elif len(tm) == 3: + [thh, tmm, tss] = tm + else: + return None + else: + return None + try: + yy = int(yy) + dd = int(dd) + thh = int(thh) + tmm = int(tmm) + tss = int(tss) + except ValueError: + return None + # Check for a yy specified in two-digit format, then convert it to the + # appropriate four-digit format, according to the POSIX standard. RFC 822 + # calls for a two-digit yy, but RFC 2822 (which obsoletes RFC 822) + # mandates a 4-digit yy. For more information, see the documentation for + # the time module. + if yy < 100: + # The year is between 1969 and 1999 (inclusive). + if yy > 68: + yy += 1900 + # The year is between 2000 and 2068 (inclusive). + else: + yy += 2000 + tzoffset = None + tz = tz.upper() + if tz in _timezones: + tzoffset = _timezones[tz] + else: + try: + tzoffset = int(tz) + except ValueError: + pass + if tzoffset==0 and tz.startswith('-'): + tzoffset = None + # Convert a timezone offset into seconds ; -0500 -> -18000 + if tzoffset: + if tzoffset < 0: + tzsign = -1 + tzoffset = -tzoffset + else: + tzsign = 1 + tzoffset = tzsign * ( (tzoffset//100)*3600 + (tzoffset % 100)*60) + # Daylight Saving Time flag is set to -1, since DST is unknown. + return [yy, mm, dd, thh, tmm, tss, 0, 1, -1, tzoffset] + + +def parsedate(data): + """Convert a time string to a time tuple.""" + t = parsedate_tz(data) + if isinstance(t, tuple): + return t[:9] + else: + return t + + +def mktime_tz(data): + """Turn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.""" + if data[9] is None: + # No zone info, so localtime is better assumption than GMT + return time.mktime(data[:8] + (-1,)) + else: + t = calendar.timegm(data) + return t - data[9] + + +def quote(str): + """Prepare string to be used in a quoted string. + + Turns backslash and double quote characters into quoted pairs. These + are the only characters that need to be quoted inside a quoted string. + Does not add the surrounding double quotes. + """ + return str.replace('\\', '\\\\').replace('"', '\\"') + + +class AddrlistClass: + """Address parser class by Ben Escoto. + + To understand what this class does, it helps to have a copy of RFC 2822 in + front of you. + + Note: this class interface is deprecated and may be removed in the future. + Use email.utils.AddressList instead. + """ + + def __init__(self, field): + """Initialize a new instance. + + `field' is an unparsed address header field, containing + one or more addresses. + """ + self.specials = '()<>@,:;.\"[]' + self.pos = 0 + self.LWS = ' \t' + self.CR = '\r\n' + self.FWS = self.LWS + self.CR + self.atomends = self.specials + self.LWS + self.CR + # Note that RFC 2822 now specifies `.' as obs-phrase, meaning that it + # is obsolete syntax. RFC 2822 requires that we recognize obsolete + # syntax, so allow dots in phrases. + self.phraseends = self.atomends.replace('.', '') + self.field = field + self.commentlist = [] + + def gotonext(self): + """Skip white space and extract comments.""" + wslist = [] + while self.pos < len(self.field): + if self.field[self.pos] in self.LWS + '\n\r': + if self.field[self.pos] not in '\n\r': + wslist.append(self.field[self.pos]) + self.pos += 1 + elif self.field[self.pos] == '(': + self.commentlist.append(self.getcomment()) + else: + break + return EMPTYSTRING.join(wslist) + + def getaddrlist(self): + """Parse all addresses. + + Returns a list containing all of the addresses. + """ + result = [] + while self.pos < len(self.field): + ad = self.getaddress() + if ad: + result += ad + else: + result.append(('', '')) + return result + + def getaddress(self): + """Parse the next address.""" + self.commentlist = [] + self.gotonext() + + oldpos = self.pos + oldcl = self.commentlist + plist = self.getphraselist() + + self.gotonext() + returnlist = [] + + if self.pos >= len(self.field): + # Bad email address technically, no domain. + if plist: + returnlist = [(SPACE.join(self.commentlist), plist[0])] + + elif self.field[self.pos] in '.@': + # email address is just an addrspec + # this isn't very efficient since we start over + self.pos = oldpos + self.commentlist = oldcl + addrspec = self.getaddrspec() + returnlist = [(SPACE.join(self.commentlist), addrspec)] + + elif self.field[self.pos] == ':': + # address is a group + returnlist = [] + + fieldlen = len(self.field) + self.pos += 1 + while self.pos < len(self.field): + self.gotonext() + if self.pos < fieldlen and self.field[self.pos] == ';': + self.pos += 1 + break + returnlist = returnlist + self.getaddress() + + elif self.field[self.pos] == '<': + # Address is a phrase then a route addr + routeaddr = self.getrouteaddr() + + if self.commentlist: + returnlist = [(SPACE.join(plist) + ' (' + + ' '.join(self.commentlist) + ')', routeaddr)] + else: + returnlist = [(SPACE.join(plist), routeaddr)] + + else: + if plist: + returnlist = [(SPACE.join(self.commentlist), plist[0])] + elif self.field[self.pos] in self.specials: + self.pos += 1 + + self.gotonext() + if self.pos < len(self.field) and self.field[self.pos] == ',': + self.pos += 1 + return returnlist + + def getrouteaddr(self): + """Parse a route address (Return-path value). + + This method just skips all the route stuff and returns the addrspec. + """ + if self.field[self.pos] != '<': + return + + expectroute = False + self.pos += 1 + self.gotonext() + adlist = '' + while self.pos < len(self.field): + if expectroute: + self.getdomain() + expectroute = False + elif self.field[self.pos] == '>': + self.pos += 1 + break + elif self.field[self.pos] == '@': + self.pos += 1 + expectroute = True + elif self.field[self.pos] == ':': + self.pos += 1 + else: + adlist = self.getaddrspec() + self.pos += 1 + break + self.gotonext() + + return adlist + + def getaddrspec(self): + """Parse an RFC 2822 addr-spec.""" + aslist = [] + + self.gotonext() + while self.pos < len(self.field): + preserve_ws = True + if self.field[self.pos] == '.': + if aslist and not aslist[-1].strip(): + aslist.pop() + aslist.append('.') + self.pos += 1 + preserve_ws = False + elif self.field[self.pos] == '"': + aslist.append('"%s"' % quote(self.getquote())) + elif self.field[self.pos] in self.atomends: + if aslist and not aslist[-1].strip(): + aslist.pop() + break + else: + aslist.append(self.getatom()) + ws = self.gotonext() + if preserve_ws and ws: + aslist.append(ws) + + if self.pos >= len(self.field) or self.field[self.pos] != '@': + return EMPTYSTRING.join(aslist) + + aslist.append('@') + self.pos += 1 + self.gotonext() + domain = self.getdomain() + if not domain: + # Invalid domain, return an empty address instead of returning a + # local part to denote failed parsing. + return EMPTYSTRING + return EMPTYSTRING.join(aslist) + domain + + def getdomain(self): + """Get the complete domain name from an address.""" + sdlist = [] + while self.pos < len(self.field): + if self.field[self.pos] in self.LWS: + self.pos += 1 + elif self.field[self.pos] == '(': + self.commentlist.append(self.getcomment()) + elif self.field[self.pos] == '[': + sdlist.append(self.getdomainliteral()) + elif self.field[self.pos] == '.': + self.pos += 1 + sdlist.append('.') + elif self.field[self.pos] == '@': + # bpo-34155: Don't parse domains with two `@` like + # `a@malicious.org@important.com`. + return EMPTYSTRING + elif self.field[self.pos] in self.atomends: + break + else: + sdlist.append(self.getatom()) + return EMPTYSTRING.join(sdlist) + + def getdelimited(self, beginchar, endchars, allowcomments=True): + """Parse a header fragment delimited by special characters. + + `beginchar' is the start character for the fragment. + If self is not looking at an instance of `beginchar' then + getdelimited returns the empty string. + + `endchars' is a sequence of allowable end-delimiting characters. + Parsing stops when one of these is encountered. + + If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed + within the parsed fragment. + """ + if self.field[self.pos] != beginchar: + return '' + + slist = [''] + quote = False + self.pos += 1 + while self.pos < len(self.field): + if quote: + slist.append(self.field[self.pos]) + quote = False + elif self.field[self.pos] in endchars: + self.pos += 1 + break + elif allowcomments and self.field[self.pos] == '(': + slist.append(self.getcomment()) + continue # have already advanced pos from getcomment + elif self.field[self.pos] == '\\': + quote = True + else: + slist.append(self.field[self.pos]) + self.pos += 1 + + return EMPTYSTRING.join(slist) + + def getquote(self): + """Get a quote-delimited fragment from self's field.""" + return self.getdelimited('"', '"\r', False) + + def getcomment(self): + """Get a parenthesis-delimited fragment from self's field.""" + return self.getdelimited('(', ')\r', True) + + def getdomainliteral(self): + """Parse an RFC 2822 domain-literal.""" + return '[%s]' % self.getdelimited('[', ']\r', False) + + def getatom(self, atomends=None): + """Parse an RFC 2822 atom. + + Optional atomends specifies a different set of end token delimiters + (the default is to use self.atomends). This is used e.g. in + getphraselist() since phrase endings must not include the `.' (which + is legal in phrases).""" + atomlist = [''] + if atomends is None: + atomends = self.atomends + + while self.pos < len(self.field): + if self.field[self.pos] in atomends: + break + else: + atomlist.append(self.field[self.pos]) + self.pos += 1 + + return EMPTYSTRING.join(atomlist) + + def getphraselist(self): + """Parse a sequence of RFC 2822 phrases. + + A phrase is a sequence of words, which are in turn either RFC 2822 + atoms or quoted-strings. Phrases are canonicalized by squeezing all + runs of continuous whitespace into one space. + """ + plist = [] + + while self.pos < len(self.field): + if self.field[self.pos] in self.FWS: + self.pos += 1 + elif self.field[self.pos] == '"': + plist.append(self.getquote()) + elif self.field[self.pos] == '(': + self.commentlist.append(self.getcomment()) + elif self.field[self.pos] in self.phraseends: + break + else: + plist.append(self.getatom(self.phraseends)) + + return plist + +class AddressList(AddrlistClass): + """An AddressList encapsulates a list of parsed RFC 2822 addresses.""" + def __init__(self, field): + AddrlistClass.__init__(self, field) + if field: + self.addresslist = self.getaddrlist() + else: + self.addresslist = [] + + def __len__(self): + return len(self.addresslist) + + def __add__(self, other): + # Set union + newaddr = AddressList(None) + newaddr.addresslist = self.addresslist[:] + for x in other.addresslist: + if not x in self.addresslist: + newaddr.addresslist.append(x) + return newaddr + + def __iadd__(self, other): + # Set union, in-place + for x in other.addresslist: + if not x in self.addresslist: + self.addresslist.append(x) + return self + + def __sub__(self, other): + # Set difference + newaddr = AddressList(None) + for x in self.addresslist: + if not x in other.addresslist: + newaddr.addresslist.append(x) + return newaddr + + def __isub__(self, other): + # Set difference, in-place + for x in other.addresslist: + if x in self.addresslist: + self.addresslist.remove(x) + return self + + def __getitem__(self, index): + # Make indexing, slices, and 'in' work + return self.addresslist[index] diff --git a/evalkit_internvl/lib/python3.10/email/errors.py b/evalkit_internvl/lib/python3.10/email/errors.py new file mode 100644 index 0000000000000000000000000000000000000000..02aa5eced6ae461ee52236665e1770be7972dd5c --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/errors.py @@ -0,0 +1,117 @@ +# Copyright (C) 2001-2006 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""email package exception classes.""" + + +class MessageError(Exception): + """Base class for errors in the email package.""" + + +class MessageParseError(MessageError): + """Base class for message parsing errors.""" + + +class HeaderParseError(MessageParseError): + """Error while parsing headers.""" + + +class BoundaryError(MessageParseError): + """Couldn't find terminating boundary.""" + + +class MultipartConversionError(MessageError, TypeError): + """Conversion to a multipart is prohibited.""" + + +class CharsetError(MessageError): + """An illegal charset was given.""" + + +class HeaderWriteError(MessageError): + """Error while writing headers.""" + + +# These are parsing defects which the parser was able to work around. +class MessageDefect(ValueError): + """Base class for a message defect.""" + + def __init__(self, line=None): + if line is not None: + super().__init__(line) + self.line = line + +class NoBoundaryInMultipartDefect(MessageDefect): + """A message claimed to be a multipart but had no boundary parameter.""" + +class StartBoundaryNotFoundDefect(MessageDefect): + """The claimed start boundary was never found.""" + +class CloseBoundaryNotFoundDefect(MessageDefect): + """A start boundary was found, but not the corresponding close boundary.""" + +class FirstHeaderLineIsContinuationDefect(MessageDefect): + """A message had a continuation line as its first header line.""" + +class MisplacedEnvelopeHeaderDefect(MessageDefect): + """A 'Unix-from' header was found in the middle of a header block.""" + +class MissingHeaderBodySeparatorDefect(MessageDefect): + """Found line with no leading whitespace and no colon before blank line.""" +# XXX: backward compatibility, just in case (it was never emitted). +MalformedHeaderDefect = MissingHeaderBodySeparatorDefect + +class MultipartInvariantViolationDefect(MessageDefect): + """A message claimed to be a multipart but no subparts were found.""" + +class InvalidMultipartContentTransferEncodingDefect(MessageDefect): + """An invalid content transfer encoding was set on the multipart itself.""" + +class UndecodableBytesDefect(MessageDefect): + """Header contained bytes that could not be decoded""" + +class InvalidBase64PaddingDefect(MessageDefect): + """base64 encoded sequence had an incorrect length""" + +class InvalidBase64CharactersDefect(MessageDefect): + """base64 encoded sequence had characters not in base64 alphabet""" + +class InvalidBase64LengthDefect(MessageDefect): + """base64 encoded sequence had invalid length (1 mod 4)""" + +# These errors are specific to header parsing. + +class HeaderDefect(MessageDefect): + """Base class for a header defect.""" + + def __init__(self, *args, **kw): + super().__init__(*args, **kw) + +class InvalidHeaderDefect(HeaderDefect): + """Header is not valid, message gives details.""" + +class HeaderMissingRequiredValue(HeaderDefect): + """A header that must have a value had none""" + +class NonPrintableDefect(HeaderDefect): + """ASCII characters outside the ascii-printable range found""" + + def __init__(self, non_printables): + super().__init__(non_printables) + self.non_printables = non_printables + + def __str__(self): + return ("the following ASCII non-printables found in header: " + "{}".format(self.non_printables)) + +class ObsoleteHeaderDefect(HeaderDefect): + """Header uses syntax declared obsolete by RFC 5322""" + +class NonASCIILocalPartDefect(HeaderDefect): + """local_part contains non-ASCII characters""" + # This defect only occurs during unicode parsing, not when + # parsing messages decoded from binary. + +class InvalidDateDefect(HeaderDefect): + """Header has unparsable or invalid date""" diff --git a/evalkit_internvl/lib/python3.10/email/header.py b/evalkit_internvl/lib/python3.10/email/header.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab0032bc661234a2ad212c16568d340e479bba5 --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/header.py @@ -0,0 +1,578 @@ +# Copyright (C) 2002-2007 Python Software Foundation +# Author: Ben Gertzfield, Barry Warsaw +# Contact: email-sig@python.org + +"""Header encoding and decoding functionality.""" + +__all__ = [ + 'Header', + 'decode_header', + 'make_header', + ] + +import re +import binascii + +import email.quoprimime +import email.base64mime + +from email.errors import HeaderParseError +from email import charset as _charset +Charset = _charset.Charset + +NL = '\n' +SPACE = ' ' +BSPACE = b' ' +SPACE8 = ' ' * 8 +EMPTYSTRING = '' +MAXLINELEN = 78 +FWS = ' \t' + +USASCII = Charset('us-ascii') +UTF8 = Charset('utf-8') + +# Match encoded-word strings in the form =?charset?q?Hello_World?= +ecre = re.compile(r''' + =\? # literal =? + (?P[^?]*?) # non-greedy up to the next ? is the charset + \? # literal ? + (?P[qQbB]) # either a "q" or a "b", case insensitive + \? # literal ? + (?P.*?) # non-greedy up to the next ?= is the encoded string + \?= # literal ?= + ''', re.VERBOSE | re.MULTILINE) + +# Field name regexp, including trailing colon, but not separating whitespace, +# according to RFC 2822. Character range is from tilde to exclamation mark. +# For use with .match() +fcre = re.compile(r'[\041-\176]+:$') + +# Find a header embedded in a putative header value. Used to check for +# header injection attack. +_embedded_header = re.compile(r'\n[^ \t]+:') + + + +# Helpers +_max_append = email.quoprimime._max_append + + + +def decode_header(header): + """Decode a message header value without converting charset. + + Returns a list of (string, charset) pairs containing each of the decoded + parts of the header. Charset is None for non-encoded parts of the header, + otherwise a lower-case string containing the name of the character set + specified in the encoded string. + + header may be a string that may or may not contain RFC2047 encoded words, + or it may be a Header object. + + An email.errors.HeaderParseError may be raised when certain decoding error + occurs (e.g. a base64 decoding exception). + """ + # If it is a Header object, we can just return the encoded chunks. + if hasattr(header, '_chunks'): + return [(_charset._encode(string, str(charset)), str(charset)) + for string, charset in header._chunks] + # If no encoding, just return the header with no charset. + if not ecre.search(header): + return [(header, None)] + # First step is to parse all the encoded parts into triplets of the form + # (encoded_string, encoding, charset). For unencoded strings, the last + # two parts will be None. + words = [] + for line in header.splitlines(): + parts = ecre.split(line) + first = True + while parts: + unencoded = parts.pop(0) + if first: + unencoded = unencoded.lstrip() + first = False + if unencoded: + words.append((unencoded, None, None)) + if parts: + charset = parts.pop(0).lower() + encoding = parts.pop(0).lower() + encoded = parts.pop(0) + words.append((encoded, encoding, charset)) + # Now loop over words and remove words that consist of whitespace + # between two encoded strings. + droplist = [] + for n, w in enumerate(words): + if n>1 and w[1] and words[n-2][1] and words[n-1][0].isspace(): + droplist.append(n-1) + for d in reversed(droplist): + del words[d] + + # The next step is to decode each encoded word by applying the reverse + # base64 or quopri transformation. decoded_words is now a list of the + # form (decoded_word, charset). + decoded_words = [] + for encoded_string, encoding, charset in words: + if encoding is None: + # This is an unencoded word. + decoded_words.append((encoded_string, charset)) + elif encoding == 'q': + word = email.quoprimime.header_decode(encoded_string) + decoded_words.append((word, charset)) + elif encoding == 'b': + paderr = len(encoded_string) % 4 # Postel's law: add missing padding + if paderr: + encoded_string += '==='[:4 - paderr] + try: + word = email.base64mime.decode(encoded_string) + except binascii.Error: + raise HeaderParseError('Base64 decoding error') + else: + decoded_words.append((word, charset)) + else: + raise AssertionError('Unexpected encoding: ' + encoding) + # Now convert all words to bytes and collapse consecutive runs of + # similarly encoded words. + collapsed = [] + last_word = last_charset = None + for word, charset in decoded_words: + if isinstance(word, str): + word = bytes(word, 'raw-unicode-escape') + if last_word is None: + last_word = word + last_charset = charset + elif charset != last_charset: + collapsed.append((last_word, last_charset)) + last_word = word + last_charset = charset + elif last_charset is None: + last_word += BSPACE + word + else: + last_word += word + collapsed.append((last_word, last_charset)) + return collapsed + + + +def make_header(decoded_seq, maxlinelen=None, header_name=None, + continuation_ws=' '): + """Create a Header from a sequence of pairs as returned by decode_header() + + decode_header() takes a header value string and returns a sequence of + pairs of the format (decoded_string, charset) where charset is the string + name of the character set. + + This function takes one of those sequence of pairs and returns a Header + instance. Optional maxlinelen, header_name, and continuation_ws are as in + the Header constructor. + """ + h = Header(maxlinelen=maxlinelen, header_name=header_name, + continuation_ws=continuation_ws) + for s, charset in decoded_seq: + # None means us-ascii but we can simply pass it on to h.append() + if charset is not None and not isinstance(charset, Charset): + charset = Charset(charset) + h.append(s, charset) + return h + + + +class Header: + def __init__(self, s=None, charset=None, + maxlinelen=None, header_name=None, + continuation_ws=' ', errors='strict'): + """Create a MIME-compliant header that can contain many character sets. + + Optional s is the initial header value. If None, the initial header + value is not set. You can later append to the header with .append() + method calls. s may be a byte string or a Unicode string, but see the + .append() documentation for semantics. + + Optional charset serves two purposes: it has the same meaning as the + charset argument to the .append() method. It also sets the default + character set for all subsequent .append() calls that omit the charset + argument. If charset is not provided in the constructor, the us-ascii + charset is used both as s's initial charset and as the default for + subsequent .append() calls. + + The maximum line length can be specified explicitly via maxlinelen. For + splitting the first line to a shorter value (to account for the field + header which isn't included in s, e.g. `Subject') pass in the name of + the field in header_name. The default maxlinelen is 78 as recommended + by RFC 2822. + + continuation_ws must be RFC 2822 compliant folding whitespace (usually + either a space or a hard tab) which will be prepended to continuation + lines. + + errors is passed through to the .append() call. + """ + if charset is None: + charset = USASCII + elif not isinstance(charset, Charset): + charset = Charset(charset) + self._charset = charset + self._continuation_ws = continuation_ws + self._chunks = [] + if s is not None: + self.append(s, charset, errors) + if maxlinelen is None: + maxlinelen = MAXLINELEN + self._maxlinelen = maxlinelen + if header_name is None: + self._headerlen = 0 + else: + # Take the separating colon and space into account. + self._headerlen = len(header_name) + 2 + + def __str__(self): + """Return the string value of the header.""" + self._normalize() + uchunks = [] + lastcs = None + lastspace = None + for string, charset in self._chunks: + # We must preserve spaces between encoded and non-encoded word + # boundaries, which means for us we need to add a space when we go + # from a charset to None/us-ascii, or from None/us-ascii to a + # charset. Only do this for the second and subsequent chunks. + # Don't add a space if the None/us-ascii string already has + # a space (trailing or leading depending on transition) + nextcs = charset + if nextcs == _charset.UNKNOWN8BIT: + original_bytes = string.encode('ascii', 'surrogateescape') + string = original_bytes.decode('ascii', 'replace') + if uchunks: + hasspace = string and self._nonctext(string[0]) + if lastcs not in (None, 'us-ascii'): + if nextcs in (None, 'us-ascii') and not hasspace: + uchunks.append(SPACE) + nextcs = None + elif nextcs not in (None, 'us-ascii') and not lastspace: + uchunks.append(SPACE) + lastspace = string and self._nonctext(string[-1]) + lastcs = nextcs + uchunks.append(string) + return EMPTYSTRING.join(uchunks) + + # Rich comparison operators for equality only. BAW: does it make sense to + # have or explicitly disable <, <=, >, >= operators? + def __eq__(self, other): + # other may be a Header or a string. Both are fine so coerce + # ourselves to a unicode (of the unencoded header value), swap the + # args and do another comparison. + return other == str(self) + + def append(self, s, charset=None, errors='strict'): + """Append a string to the MIME header. + + Optional charset, if given, should be a Charset instance or the name + of a character set (which will be converted to a Charset instance). A + value of None (the default) means that the charset given in the + constructor is used. + + s may be a byte string or a Unicode string. If it is a byte string + (i.e. isinstance(s, str) is false), then charset is the encoding of + that byte string, and a UnicodeError will be raised if the string + cannot be decoded with that charset. If s is a Unicode string, then + charset is a hint specifying the character set of the characters in + the string. In either case, when producing an RFC 2822 compliant + header using RFC 2047 rules, the string will be encoded using the + output codec of the charset. If the string cannot be encoded to the + output codec, a UnicodeError will be raised. + + Optional `errors' is passed as the errors argument to the decode + call if s is a byte string. + """ + if charset is None: + charset = self._charset + elif not isinstance(charset, Charset): + charset = Charset(charset) + if not isinstance(s, str): + input_charset = charset.input_codec or 'us-ascii' + if input_charset == _charset.UNKNOWN8BIT: + s = s.decode('us-ascii', 'surrogateescape') + else: + s = s.decode(input_charset, errors) + # Ensure that the bytes we're storing can be decoded to the output + # character set, otherwise an early error is raised. + output_charset = charset.output_codec or 'us-ascii' + if output_charset != _charset.UNKNOWN8BIT: + try: + s.encode(output_charset, errors) + except UnicodeEncodeError: + if output_charset!='us-ascii': + raise + charset = UTF8 + self._chunks.append((s, charset)) + + def _nonctext(self, s): + """True if string s is not a ctext character of RFC822. + """ + return s.isspace() or s in ('(', ')', '\\') + + def encode(self, splitchars=';, \t', maxlinelen=None, linesep='\n'): + r"""Encode a message header into an RFC-compliant format. + + There are many issues involved in converting a given string for use in + an email header. Only certain character sets are readable in most + email clients, and as header strings can only contain a subset of + 7-bit ASCII, care must be taken to properly convert and encode (with + Base64 or quoted-printable) header strings. In addition, there is a + 75-character length limit on any given encoded header field, so + line-wrapping must be performed, even with double-byte character sets. + + Optional maxlinelen specifies the maximum length of each generated + line, exclusive of the linesep string. Individual lines may be longer + than maxlinelen if a folding point cannot be found. The first line + will be shorter by the length of the header name plus ": " if a header + name was specified at Header construction time. The default value for + maxlinelen is determined at header construction time. + + Optional splitchars is a string containing characters which should be + given extra weight by the splitting algorithm during normal header + wrapping. This is in very rough support of RFC 2822's `higher level + syntactic breaks': split points preceded by a splitchar are preferred + during line splitting, with the characters preferred in the order in + which they appear in the string. Space and tab may be included in the + string to indicate whether preference should be given to one over the + other as a split point when other split chars do not appear in the line + being split. Splitchars does not affect RFC 2047 encoded lines. + + Optional linesep is a string to be used to separate the lines of + the value. The default value is the most useful for typical + Python applications, but it can be set to \r\n to produce RFC-compliant + line separators when needed. + """ + self._normalize() + if maxlinelen is None: + maxlinelen = self._maxlinelen + # A maxlinelen of 0 means don't wrap. For all practical purposes, + # choosing a huge number here accomplishes that and makes the + # _ValueFormatter algorithm much simpler. + if maxlinelen == 0: + maxlinelen = 1000000 + formatter = _ValueFormatter(self._headerlen, maxlinelen, + self._continuation_ws, splitchars) + lastcs = None + hasspace = lastspace = None + for string, charset in self._chunks: + if hasspace is not None: + hasspace = string and self._nonctext(string[0]) + if lastcs not in (None, 'us-ascii'): + if not hasspace or charset not in (None, 'us-ascii'): + formatter.add_transition() + elif charset not in (None, 'us-ascii') and not lastspace: + formatter.add_transition() + lastspace = string and self._nonctext(string[-1]) + lastcs = charset + hasspace = False + lines = string.splitlines() + if lines: + formatter.feed('', lines[0], charset) + else: + formatter.feed('', '', charset) + for line in lines[1:]: + formatter.newline() + if charset.header_encoding is not None: + formatter.feed(self._continuation_ws, ' ' + line.lstrip(), + charset) + else: + sline = line.lstrip() + fws = line[:len(line)-len(sline)] + formatter.feed(fws, sline, charset) + if len(lines) > 1: + formatter.newline() + if self._chunks: + formatter.add_transition() + value = formatter._str(linesep) + if _embedded_header.search(value): + raise HeaderParseError("header value appears to contain " + "an embedded header: {!r}".format(value)) + return value + + def _normalize(self): + # Step 1: Normalize the chunks so that all runs of identical charsets + # get collapsed into a single unicode string. + chunks = [] + last_charset = None + last_chunk = [] + for string, charset in self._chunks: + if charset == last_charset: + last_chunk.append(string) + else: + if last_charset is not None: + chunks.append((SPACE.join(last_chunk), last_charset)) + last_chunk = [string] + last_charset = charset + if last_chunk: + chunks.append((SPACE.join(last_chunk), last_charset)) + self._chunks = chunks + + + +class _ValueFormatter: + def __init__(self, headerlen, maxlen, continuation_ws, splitchars): + self._maxlen = maxlen + self._continuation_ws = continuation_ws + self._continuation_ws_len = len(continuation_ws) + self._splitchars = splitchars + self._lines = [] + self._current_line = _Accumulator(headerlen) + + def _str(self, linesep): + self.newline() + return linesep.join(self._lines) + + def __str__(self): + return self._str(NL) + + def newline(self): + end_of_line = self._current_line.pop() + if end_of_line != (' ', ''): + self._current_line.push(*end_of_line) + if len(self._current_line) > 0: + if self._current_line.is_onlyws() and self._lines: + self._lines[-1] += str(self._current_line) + else: + self._lines.append(str(self._current_line)) + self._current_line.reset() + + def add_transition(self): + self._current_line.push(' ', '') + + def feed(self, fws, string, charset): + # If the charset has no header encoding (i.e. it is an ASCII encoding) + # then we must split the header at the "highest level syntactic break" + # possible. Note that we don't have a lot of smarts about field + # syntax; we just try to break on semi-colons, then commas, then + # whitespace. Eventually, this should be pluggable. + if charset.header_encoding is None: + self._ascii_split(fws, string, self._splitchars) + return + # Otherwise, we're doing either a Base64 or a quoted-printable + # encoding which means we don't need to split the line on syntactic + # breaks. We can basically just find enough characters to fit on the + # current line, minus the RFC 2047 chrome. What makes this trickier + # though is that we have to split at octet boundaries, not character + # boundaries but it's only safe to split at character boundaries so at + # best we can only get close. + encoded_lines = charset.header_encode_lines(string, self._maxlengths()) + # The first element extends the current line, but if it's None then + # nothing more fit on the current line so start a new line. + try: + first_line = encoded_lines.pop(0) + except IndexError: + # There are no encoded lines, so we're done. + return + if first_line is not None: + self._append_chunk(fws, first_line) + try: + last_line = encoded_lines.pop() + except IndexError: + # There was only one line. + return + self.newline() + self._current_line.push(self._continuation_ws, last_line) + # Everything else are full lines in themselves. + for line in encoded_lines: + self._lines.append(self._continuation_ws + line) + + def _maxlengths(self): + # The first line's length. + yield self._maxlen - len(self._current_line) + while True: + yield self._maxlen - self._continuation_ws_len + + def _ascii_split(self, fws, string, splitchars): + # The RFC 2822 header folding algorithm is simple in principle but + # complex in practice. Lines may be folded any place where "folding + # white space" appears by inserting a linesep character in front of the + # FWS. The complication is that not all spaces or tabs qualify as FWS, + # and we are also supposed to prefer to break at "higher level + # syntactic breaks". We can't do either of these without intimate + # knowledge of the structure of structured headers, which we don't have + # here. So the best we can do here is prefer to break at the specified + # splitchars, and hope that we don't choose any spaces or tabs that + # aren't legal FWS. (This is at least better than the old algorithm, + # where we would sometimes *introduce* FWS after a splitchar, or the + # algorithm before that, where we would turn all white space runs into + # single spaces or tabs.) + parts = re.split("(["+FWS+"]+)", fws+string) + if parts[0]: + parts[:0] = [''] + else: + parts.pop(0) + for fws, part in zip(*[iter(parts)]*2): + self._append_chunk(fws, part) + + def _append_chunk(self, fws, string): + self._current_line.push(fws, string) + if len(self._current_line) > self._maxlen: + # Find the best split point, working backward from the end. + # There might be none, on a long first line. + for ch in self._splitchars: + for i in range(self._current_line.part_count()-1, 0, -1): + if ch.isspace(): + fws = self._current_line[i][0] + if fws and fws[0]==ch: + break + prevpart = self._current_line[i-1][1] + if prevpart and prevpart[-1]==ch: + break + else: + continue + break + else: + fws, part = self._current_line.pop() + if self._current_line._initial_size > 0: + # There will be a header, so leave it on a line by itself. + self.newline() + if not fws: + # We don't use continuation_ws here because the whitespace + # after a header should always be a space. + fws = ' ' + self._current_line.push(fws, part) + return + remainder = self._current_line.pop_from(i) + self._lines.append(str(self._current_line)) + self._current_line.reset(remainder) + + +class _Accumulator(list): + + def __init__(self, initial_size=0): + self._initial_size = initial_size + super().__init__() + + def push(self, fws, string): + self.append((fws, string)) + + def pop_from(self, i=0): + popped = self[i:] + self[i:] = [] + return popped + + def pop(self): + if self.part_count()==0: + return ('', '') + return super().pop() + + def __len__(self): + return sum((len(fws)+len(part) for fws, part in self), + self._initial_size) + + def __str__(self): + return EMPTYSTRING.join((EMPTYSTRING.join((fws, part)) + for fws, part in self)) + + def reset(self, startval=None): + if startval is None: + startval = [] + self[:] = startval + self._initial_size = 0 + + def is_onlyws(self): + return self._initial_size==0 and (not self or str(self).isspace()) + + def part_count(self): + return super().__len__() diff --git a/evalkit_internvl/lib/python3.10/email/headerregistry.py b/evalkit_internvl/lib/python3.10/email/headerregistry.py new file mode 100644 index 0000000000000000000000000000000000000000..b590d69e8b744129a53c79f550a42e15c83e71e9 --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/headerregistry.py @@ -0,0 +1,604 @@ +"""Representing and manipulating email headers via custom objects. + +This module provides an implementation of the HeaderRegistry API. +The implementation is designed to flexibly follow RFC5322 rules. +""" +from types import MappingProxyType + +from email import utils +from email import errors +from email import _header_value_parser as parser + +class Address: + + def __init__(self, display_name='', username='', domain='', addr_spec=None): + """Create an object representing a full email address. + + An address can have a 'display_name', a 'username', and a 'domain'. In + addition to specifying the username and domain separately, they may be + specified together by using the addr_spec keyword *instead of* the + username and domain keywords. If an addr_spec string is specified it + must be properly quoted according to RFC 5322 rules; an error will be + raised if it is not. + + An Address object has display_name, username, domain, and addr_spec + attributes, all of which are read-only. The addr_spec and the string + value of the object are both quoted according to RFC5322 rules, but + without any Content Transfer Encoding. + + """ + + inputs = ''.join(filter(None, (display_name, username, domain, addr_spec))) + if '\r' in inputs or '\n' in inputs: + raise ValueError("invalid arguments; address parts cannot contain CR or LF") + + # This clause with its potential 'raise' may only happen when an + # application program creates an Address object using an addr_spec + # keyword. The email library code itself must always supply username + # and domain. + if addr_spec is not None: + if username or domain: + raise TypeError("addrspec specified when username and/or " + "domain also specified") + a_s, rest = parser.get_addr_spec(addr_spec) + if rest: + raise ValueError("Invalid addr_spec; only '{}' " + "could be parsed from '{}'".format( + a_s, addr_spec)) + if a_s.all_defects: + raise a_s.all_defects[0] + username = a_s.local_part + domain = a_s.domain + self._display_name = display_name + self._username = username + self._domain = domain + + @property + def display_name(self): + return self._display_name + + @property + def username(self): + return self._username + + @property + def domain(self): + return self._domain + + @property + def addr_spec(self): + """The addr_spec (username@domain) portion of the address, quoted + according to RFC 5322 rules, but with no Content Transfer Encoding. + """ + lp = self.username + if not parser.DOT_ATOM_ENDS.isdisjoint(lp): + lp = parser.quote_string(lp) + if self.domain: + return lp + '@' + self.domain + if not lp: + return '<>' + return lp + + def __repr__(self): + return "{}(display_name={!r}, username={!r}, domain={!r})".format( + self.__class__.__name__, + self.display_name, self.username, self.domain) + + def __str__(self): + disp = self.display_name + if not parser.SPECIALS.isdisjoint(disp): + disp = parser.quote_string(disp) + if disp: + addr_spec = '' if self.addr_spec=='<>' else self.addr_spec + return "{} <{}>".format(disp, addr_spec) + return self.addr_spec + + def __eq__(self, other): + if not isinstance(other, Address): + return NotImplemented + return (self.display_name == other.display_name and + self.username == other.username and + self.domain == other.domain) + + +class Group: + + def __init__(self, display_name=None, addresses=None): + """Create an object representing an address group. + + An address group consists of a display_name followed by colon and a + list of addresses (see Address) terminated by a semi-colon. The Group + is created by specifying a display_name and a possibly empty list of + Address objects. A Group can also be used to represent a single + address that is not in a group, which is convenient when manipulating + lists that are a combination of Groups and individual Addresses. In + this case the display_name should be set to None. In particular, the + string representation of a Group whose display_name is None is the same + as the Address object, if there is one and only one Address object in + the addresses list. + + """ + self._display_name = display_name + self._addresses = tuple(addresses) if addresses else tuple() + + @property + def display_name(self): + return self._display_name + + @property + def addresses(self): + return self._addresses + + def __repr__(self): + return "{}(display_name={!r}, addresses={!r}".format( + self.__class__.__name__, + self.display_name, self.addresses) + + def __str__(self): + if self.display_name is None and len(self.addresses)==1: + return str(self.addresses[0]) + disp = self.display_name + if disp is not None and not parser.SPECIALS.isdisjoint(disp): + disp = parser.quote_string(disp) + adrstr = ", ".join(str(x) for x in self.addresses) + adrstr = ' ' + adrstr if adrstr else adrstr + return "{}:{};".format(disp, adrstr) + + def __eq__(self, other): + if not isinstance(other, Group): + return NotImplemented + return (self.display_name == other.display_name and + self.addresses == other.addresses) + + +# Header Classes # + +class BaseHeader(str): + + """Base class for message headers. + + Implements generic behavior and provides tools for subclasses. + + A subclass must define a classmethod named 'parse' that takes an unfolded + value string and a dictionary as its arguments. The dictionary will + contain one key, 'defects', initialized to an empty list. After the call + the dictionary must contain two additional keys: parse_tree, set to the + parse tree obtained from parsing the header, and 'decoded', set to the + string value of the idealized representation of the data from the value. + (That is, encoded words are decoded, and values that have canonical + representations are so represented.) + + The defects key is intended to collect parsing defects, which the message + parser will subsequently dispose of as appropriate. The parser should not, + insofar as practical, raise any errors. Defects should be added to the + list instead. The standard header parsers register defects for RFC + compliance issues, for obsolete RFC syntax, and for unrecoverable parsing + errors. + + The parse method may add additional keys to the dictionary. In this case + the subclass must define an 'init' method, which will be passed the + dictionary as its keyword arguments. The method should use (usually by + setting them as the value of similarly named attributes) and remove all the + extra keys added by its parse method, and then use super to call its parent + class with the remaining arguments and keywords. + + The subclass should also make sure that a 'max_count' attribute is defined + that is either None or 1. XXX: need to better define this API. + + """ + + def __new__(cls, name, value): + kwds = {'defects': []} + cls.parse(value, kwds) + if utils._has_surrogates(kwds['decoded']): + kwds['decoded'] = utils._sanitize(kwds['decoded']) + self = str.__new__(cls, kwds['decoded']) + del kwds['decoded'] + self.init(name, **kwds) + return self + + def init(self, name, *, parse_tree, defects): + self._name = name + self._parse_tree = parse_tree + self._defects = defects + + @property + def name(self): + return self._name + + @property + def defects(self): + return tuple(self._defects) + + def __reduce__(self): + return ( + _reconstruct_header, + ( + self.__class__.__name__, + self.__class__.__bases__, + str(self), + ), + self.__dict__) + + @classmethod + def _reconstruct(cls, value): + return str.__new__(cls, value) + + def fold(self, *, policy): + """Fold header according to policy. + + The parsed representation of the header is folded according to + RFC5322 rules, as modified by the policy. If the parse tree + contains surrogateescaped bytes, the bytes are CTE encoded using + the charset 'unknown-8bit". + + Any non-ASCII characters in the parse tree are CTE encoded using + charset utf-8. XXX: make this a policy setting. + + The returned value is an ASCII-only string possibly containing linesep + characters, and ending with a linesep character. The string includes + the header name and the ': ' separator. + + """ + # At some point we need to put fws here if it was in the source. + header = parser.Header([ + parser.HeaderLabel([ + parser.ValueTerminal(self.name, 'header-name'), + parser.ValueTerminal(':', 'header-sep')]), + ]) + if self._parse_tree: + header.append( + parser.CFWSList([parser.WhiteSpaceTerminal(' ', 'fws')])) + header.append(self._parse_tree) + return header.fold(policy=policy) + + +def _reconstruct_header(cls_name, bases, value): + return type(cls_name, bases, {})._reconstruct(value) + + +class UnstructuredHeader: + + max_count = None + value_parser = staticmethod(parser.get_unstructured) + + @classmethod + def parse(cls, value, kwds): + kwds['parse_tree'] = cls.value_parser(value) + kwds['decoded'] = str(kwds['parse_tree']) + + +class UniqueUnstructuredHeader(UnstructuredHeader): + + max_count = 1 + + +class DateHeader: + + """Header whose value consists of a single timestamp. + + Provides an additional attribute, datetime, which is either an aware + datetime using a timezone, or a naive datetime if the timezone + in the input string is -0000. Also accepts a datetime as input. + The 'value' attribute is the normalized form of the timestamp, + which means it is the output of format_datetime on the datetime. + """ + + max_count = None + + # This is used only for folding, not for creating 'decoded'. + value_parser = staticmethod(parser.get_unstructured) + + @classmethod + def parse(cls, value, kwds): + if not value: + kwds['defects'].append(errors.HeaderMissingRequiredValue()) + kwds['datetime'] = None + kwds['decoded'] = '' + kwds['parse_tree'] = parser.TokenList() + return + if isinstance(value, str): + kwds['decoded'] = value + try: + value = utils.parsedate_to_datetime(value) + except ValueError: + kwds['defects'].append(errors.InvalidDateDefect('Invalid date value or format')) + kwds['datetime'] = None + kwds['parse_tree'] = parser.TokenList() + return + kwds['datetime'] = value + kwds['decoded'] = utils.format_datetime(kwds['datetime']) + kwds['parse_tree'] = cls.value_parser(kwds['decoded']) + + def init(self, *args, **kw): + self._datetime = kw.pop('datetime') + super().init(*args, **kw) + + @property + def datetime(self): + return self._datetime + + +class UniqueDateHeader(DateHeader): + + max_count = 1 + + +class AddressHeader: + + max_count = None + + @staticmethod + def value_parser(value): + address_list, value = parser.get_address_list(value) + assert not value, 'this should not happen' + return address_list + + @classmethod + def parse(cls, value, kwds): + if isinstance(value, str): + # We are translating here from the RFC language (address/mailbox) + # to our API language (group/address). + kwds['parse_tree'] = address_list = cls.value_parser(value) + groups = [] + for addr in address_list.addresses: + groups.append(Group(addr.display_name, + [Address(mb.display_name or '', + mb.local_part or '', + mb.domain or '') + for mb in addr.all_mailboxes])) + defects = list(address_list.all_defects) + else: + # Assume it is Address/Group stuff + if not hasattr(value, '__iter__'): + value = [value] + groups = [Group(None, [item]) if not hasattr(item, 'addresses') + else item + for item in value] + defects = [] + kwds['groups'] = groups + kwds['defects'] = defects + kwds['decoded'] = ', '.join([str(item) for item in groups]) + if 'parse_tree' not in kwds: + kwds['parse_tree'] = cls.value_parser(kwds['decoded']) + + def init(self, *args, **kw): + self._groups = tuple(kw.pop('groups')) + self._addresses = None + super().init(*args, **kw) + + @property + def groups(self): + return self._groups + + @property + def addresses(self): + if self._addresses is None: + self._addresses = tuple(address for group in self._groups + for address in group.addresses) + return self._addresses + + +class UniqueAddressHeader(AddressHeader): + + max_count = 1 + + +class SingleAddressHeader(AddressHeader): + + @property + def address(self): + if len(self.addresses)!=1: + raise ValueError(("value of single address header {} is not " + "a single address").format(self.name)) + return self.addresses[0] + + +class UniqueSingleAddressHeader(SingleAddressHeader): + + max_count = 1 + + +class MIMEVersionHeader: + + max_count = 1 + + value_parser = staticmethod(parser.parse_mime_version) + + @classmethod + def parse(cls, value, kwds): + kwds['parse_tree'] = parse_tree = cls.value_parser(value) + kwds['decoded'] = str(parse_tree) + kwds['defects'].extend(parse_tree.all_defects) + kwds['major'] = None if parse_tree.minor is None else parse_tree.major + kwds['minor'] = parse_tree.minor + if parse_tree.minor is not None: + kwds['version'] = '{}.{}'.format(kwds['major'], kwds['minor']) + else: + kwds['version'] = None + + def init(self, *args, **kw): + self._version = kw.pop('version') + self._major = kw.pop('major') + self._minor = kw.pop('minor') + super().init(*args, **kw) + + @property + def major(self): + return self._major + + @property + def minor(self): + return self._minor + + @property + def version(self): + return self._version + + +class ParameterizedMIMEHeader: + + # Mixin that handles the params dict. Must be subclassed and + # a property value_parser for the specific header provided. + + max_count = 1 + + @classmethod + def parse(cls, value, kwds): + kwds['parse_tree'] = parse_tree = cls.value_parser(value) + kwds['decoded'] = str(parse_tree) + kwds['defects'].extend(parse_tree.all_defects) + if parse_tree.params is None: + kwds['params'] = {} + else: + # The MIME RFCs specify that parameter ordering is arbitrary. + kwds['params'] = {utils._sanitize(name).lower(): + utils._sanitize(value) + for name, value in parse_tree.params} + + def init(self, *args, **kw): + self._params = kw.pop('params') + super().init(*args, **kw) + + @property + def params(self): + return MappingProxyType(self._params) + + +class ContentTypeHeader(ParameterizedMIMEHeader): + + value_parser = staticmethod(parser.parse_content_type_header) + + def init(self, *args, **kw): + super().init(*args, **kw) + self._maintype = utils._sanitize(self._parse_tree.maintype) + self._subtype = utils._sanitize(self._parse_tree.subtype) + + @property + def maintype(self): + return self._maintype + + @property + def subtype(self): + return self._subtype + + @property + def content_type(self): + return self.maintype + '/' + self.subtype + + +class ContentDispositionHeader(ParameterizedMIMEHeader): + + value_parser = staticmethod(parser.parse_content_disposition_header) + + def init(self, *args, **kw): + super().init(*args, **kw) + cd = self._parse_tree.content_disposition + self._content_disposition = cd if cd is None else utils._sanitize(cd) + + @property + def content_disposition(self): + return self._content_disposition + + +class ContentTransferEncodingHeader: + + max_count = 1 + + value_parser = staticmethod(parser.parse_content_transfer_encoding_header) + + @classmethod + def parse(cls, value, kwds): + kwds['parse_tree'] = parse_tree = cls.value_parser(value) + kwds['decoded'] = str(parse_tree) + kwds['defects'].extend(parse_tree.all_defects) + + def init(self, *args, **kw): + super().init(*args, **kw) + self._cte = utils._sanitize(self._parse_tree.cte) + + @property + def cte(self): + return self._cte + + +class MessageIDHeader: + + max_count = 1 + value_parser = staticmethod(parser.parse_message_id) + + @classmethod + def parse(cls, value, kwds): + kwds['parse_tree'] = parse_tree = cls.value_parser(value) + kwds['decoded'] = str(parse_tree) + kwds['defects'].extend(parse_tree.all_defects) + + +# The header factory # + +_default_header_map = { + 'subject': UniqueUnstructuredHeader, + 'date': UniqueDateHeader, + 'resent-date': DateHeader, + 'orig-date': UniqueDateHeader, + 'sender': UniqueSingleAddressHeader, + 'resent-sender': SingleAddressHeader, + 'to': UniqueAddressHeader, + 'resent-to': AddressHeader, + 'cc': UniqueAddressHeader, + 'resent-cc': AddressHeader, + 'bcc': UniqueAddressHeader, + 'resent-bcc': AddressHeader, + 'from': UniqueAddressHeader, + 'resent-from': AddressHeader, + 'reply-to': UniqueAddressHeader, + 'mime-version': MIMEVersionHeader, + 'content-type': ContentTypeHeader, + 'content-disposition': ContentDispositionHeader, + 'content-transfer-encoding': ContentTransferEncodingHeader, + 'message-id': MessageIDHeader, + } + +class HeaderRegistry: + + """A header_factory and header registry.""" + + def __init__(self, base_class=BaseHeader, default_class=UnstructuredHeader, + use_default_map=True): + """Create a header_factory that works with the Policy API. + + base_class is the class that will be the last class in the created + header class's __bases__ list. default_class is the class that will be + used if "name" (see __call__) does not appear in the registry. + use_default_map controls whether or not the default mapping of names to + specialized classes is copied in to the registry when the factory is + created. The default is True. + + """ + self.registry = {} + self.base_class = base_class + self.default_class = default_class + if use_default_map: + self.registry.update(_default_header_map) + + def map_to_type(self, name, cls): + """Register cls as the specialized class for handling "name" headers. + + """ + self.registry[name.lower()] = cls + + def __getitem__(self, name): + cls = self.registry.get(name.lower(), self.default_class) + return type('_'+cls.__name__, (cls, self.base_class), {}) + + def __call__(self, name, value): + """Create a header instance for header 'name' from 'value'. + + Creates a header instance by creating a specialized class for parsing + and representing the specified header by combining the factory + base_class with a specialized class from the registry or the + default_class, and passing the name and value to the constructed + class's constructor. + + """ + return self[name](name, value) diff --git a/evalkit_internvl/lib/python3.10/email/iterators.py b/evalkit_internvl/lib/python3.10/email/iterators.py new file mode 100644 index 0000000000000000000000000000000000000000..b5502ee975266ba17a3dbff387a82b9f3a8040e6 --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/iterators.py @@ -0,0 +1,71 @@ +# Copyright (C) 2001-2006 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Various types of useful iterators and generators.""" + +__all__ = [ + 'body_line_iterator', + 'typed_subpart_iterator', + 'walk', + # Do not include _structure() since it's part of the debugging API. + ] + +import sys +from io import StringIO + + + +# This function will become a method of the Message class +def walk(self): + """Walk over the message tree, yielding each subpart. + + The walk is performed in depth-first order. This method is a + generator. + """ + yield self + if self.is_multipart(): + for subpart in self.get_payload(): + yield from subpart.walk() + + + +# These two functions are imported into the Iterators.py interface module. +def body_line_iterator(msg, decode=False): + """Iterate over the parts, returning string payloads line-by-line. + + Optional decode (default False) is passed through to .get_payload(). + """ + for subpart in msg.walk(): + payload = subpart.get_payload(decode=decode) + if isinstance(payload, str): + yield from StringIO(payload) + + +def typed_subpart_iterator(msg, maintype='text', subtype=None): + """Iterate over the subparts with a given MIME type. + + Use `maintype' as the main MIME type to match against; this defaults to + "text". Optional `subtype' is the MIME subtype to match against; if + omitted, only the main type is matched. + """ + for subpart in msg.walk(): + if subpart.get_content_maintype() == maintype: + if subtype is None or subpart.get_content_subtype() == subtype: + yield subpart + + + +def _structure(msg, fp=None, level=0, include_default=False): + """A handy debugging aid""" + if fp is None: + fp = sys.stdout + tab = ' ' * (level * 4) + print(tab + msg.get_content_type(), end='', file=fp) + if include_default: + print(' [%s]' % msg.get_default_type(), file=fp) + else: + print(file=fp) + if msg.is_multipart(): + for subpart in msg.get_payload(): + _structure(subpart, fp, level+1, include_default) diff --git a/evalkit_internvl/lib/python3.10/email/mime/__init__.py b/evalkit_internvl/lib/python3.10/email/mime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/evalkit_internvl/lib/python3.10/email/mime/__pycache__/image.cpython-310.pyc b/evalkit_internvl/lib/python3.10/email/mime/__pycache__/image.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..04147e4df36715246bf2768598aa73b2e1dc08f7 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/email/mime/__pycache__/image.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/email/mime/__pycache__/nonmultipart.cpython-310.pyc b/evalkit_internvl/lib/python3.10/email/mime/__pycache__/nonmultipart.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c9879ac02464d7f0b111341adcf13c0ed4cc1cd4 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/email/mime/__pycache__/nonmultipart.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/email/mime/__pycache__/text.cpython-310.pyc b/evalkit_internvl/lib/python3.10/email/mime/__pycache__/text.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9431a5b441d98b46fc524ca8c63bbc59c55edad6 Binary files /dev/null and b/evalkit_internvl/lib/python3.10/email/mime/__pycache__/text.cpython-310.pyc differ diff --git a/evalkit_internvl/lib/python3.10/email/mime/audio.py b/evalkit_internvl/lib/python3.10/email/mime/audio.py new file mode 100644 index 0000000000000000000000000000000000000000..7cca3f99f12861630fd0765ee5ae48a0f0f4bf8c --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/mime/audio.py @@ -0,0 +1,74 @@ +# Copyright (C) 2001-2007 Python Software Foundation +# Author: Anthony Baxter +# Contact: email-sig@python.org + +"""Class representing audio/* type MIME documents.""" + +__all__ = ['MIMEAudio'] + +import sndhdr + +from io import BytesIO +from email import encoders +from email.mime.nonmultipart import MIMENonMultipart + + + +_sndhdr_MIMEmap = {'au' : 'basic', + 'wav' :'x-wav', + 'aiff':'x-aiff', + 'aifc':'x-aiff', + } + +# There are others in sndhdr that don't have MIME types. :( +# Additional ones to be added to sndhdr? midi, mp3, realaudio, wma?? +def _whatsnd(data): + """Try to identify a sound file type. + + sndhdr.what() has a pretty cruddy interface, unfortunately. This is why + we re-do it here. It would be easier to reverse engineer the Unix 'file' + command and use the standard 'magic' file, as shipped with a modern Unix. + """ + hdr = data[:512] + fakefile = BytesIO(hdr) + for testfn in sndhdr.tests: + res = testfn(hdr, fakefile) + if res is not None: + return _sndhdr_MIMEmap.get(res[0]) + return None + + + +class MIMEAudio(MIMENonMultipart): + """Class for generating audio/* MIME documents.""" + + def __init__(self, _audiodata, _subtype=None, + _encoder=encoders.encode_base64, *, policy=None, **_params): + """Create an audio/* type MIME document. + + _audiodata contains the bytes for the raw audio data. If this data + can be decoded by the standard Python `sndhdr' module, then the + subtype will be automatically included in the Content-Type header. + Otherwise, you can specify the specific audio subtype via the + _subtype parameter. If _subtype is not given, and no subtype can be + guessed, a TypeError is raised. + + _encoder is a function which will perform the actual encoding for + transport of the image data. It takes one argument, which is this + Image instance. It should use get_payload() and set_payload() to + change the payload to the encoded form. It should also add any + Content-Transfer-Encoding or other headers to the message as + necessary. The default encoding is Base64. + + Any additional keyword arguments are passed to the base class + constructor, which turns them into parameters on the Content-Type + header. + """ + if _subtype is None: + _subtype = _whatsnd(_audiodata) + if _subtype is None: + raise TypeError('Could not find audio MIME subtype') + MIMENonMultipart.__init__(self, 'audio', _subtype, policy=policy, + **_params) + self.set_payload(_audiodata) + _encoder(self) diff --git a/evalkit_internvl/lib/python3.10/email/mime/base.py b/evalkit_internvl/lib/python3.10/email/mime/base.py new file mode 100644 index 0000000000000000000000000000000000000000..1a3f9b51f6c04567671dbdd24ac1835526ff0aef --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/mime/base.py @@ -0,0 +1,30 @@ +# Copyright (C) 2001-2006 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Base class for MIME specializations.""" + +__all__ = ['MIMEBase'] + +import email.policy + +from email import message + + + +class MIMEBase(message.Message): + """Base class for MIME specializations.""" + + def __init__(self, _maintype, _subtype, *, policy=None, **_params): + """This constructor adds a Content-Type: and a MIME-Version: header. + + The Content-Type: header is taken from the _maintype and _subtype + arguments. Additional parameters for this header are taken from the + keyword arguments. + """ + if policy is None: + policy = email.policy.compat32 + message.Message.__init__(self, policy=policy) + ctype = '%s/%s' % (_maintype, _subtype) + self.add_header('Content-Type', ctype, **_params) + self['MIME-Version'] = '1.0' diff --git a/evalkit_internvl/lib/python3.10/email/mime/multipart.py b/evalkit_internvl/lib/python3.10/email/mime/multipart.py new file mode 100644 index 0000000000000000000000000000000000000000..2d3f288810dd9198ce3cf80edd5cd3e0acc4aec0 --- /dev/null +++ b/evalkit_internvl/lib/python3.10/email/mime/multipart.py @@ -0,0 +1,48 @@ +# Copyright (C) 2002-2006 Python Software Foundation +# Author: Barry Warsaw +# Contact: email-sig@python.org + +"""Base class for MIME multipart/* type messages.""" + +__all__ = ['MIMEMultipart'] + +from email.mime.base import MIMEBase + + + +class MIMEMultipart(MIMEBase): + """Base class for MIME multipart/* type messages.""" + + def __init__(self, _subtype='mixed', boundary=None, _subparts=None, + *, policy=None, + **_params): + """Creates a multipart/* type message. + + By default, creates a multipart/mixed message, with proper + Content-Type and MIME-Version headers. + + _subtype is the subtype of the multipart content type, defaulting to + `mixed'. + + boundary is the multipart boundary string. By default it is + calculated as needed. + + _subparts is a sequence of initial subparts for the payload. It + must be an iterable object, such as a list. You can always + attach new subparts to the message by using the attach() method. + + Additional parameters for the Content-Type header are taken from the + keyword arguments (or passed into the _params argument). + """ + MIMEBase.__init__(self, 'multipart', _subtype, policy=policy, **_params) + + # Initialise _payload to an empty list as the Message superclass's + # implementation of is_multipart assumes that _payload is a list for + # multipart messages. + self._payload = [] + + if _subparts: + for p in _subparts: + self.attach(p) + if boundary: + self.set_boundary(boundary)