From b42197ceb9ac8a0cd95b53092b30c4f51c0c0057 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Sun, 14 May 2023 07:00:04 -0400 Subject: [PATCH 001/151] Port code from CygwinCCompiler to UnixCCompiler https://github.com/python-pillow/Pillow/issues/7158#issuecomment-1546746716 suggests that Cygwin uses UnixCCompiler rather than CygwinCCompiler by default, so UnixCCompiler would need to know how to find shared libraries, import libraries, and static libraries on Cygwin. --- distutils/unixccompiler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py index 6ca2332ae1..b1139cfbd8 100644 --- a/distutils/unixccompiler.py +++ b/distutils/unixccompiler.py @@ -141,6 +141,10 @@ class UnixCCompiler(CCompiler): xcode_stub_lib_format = dylib_lib_format if sys.platform == "cygwin": exe_extension = ".exe" + shared_lib_extension = ".dll.a" + dylib_lib_extension = ".dll" + static_lib_format = shared_lib_format = "lib%s%s" + dylib_lib_format = "cyg%s%s" def preprocess( self, From 38f656064bc7ebb81d5b58b98dd62013ee9cb0f6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Nov 2023 14:25:07 -0500 Subject: [PATCH 002/151] Add warning when SETUPTOOLS_USE_DISTUTILS=stdlib. Ref #4137. --- _distutils_hack/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index b951c2defd..0b47d17435 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -45,6 +45,15 @@ def enabled(): Allow selection of distutils by environment variable. """ which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local') + if which == 'stdlib': + import warnings + + warnings.warn( + "Reliance on distutils from stdlib is deprecated. Users " + "must rely on setuptools to provide the distutils module. " + "Avoid importing distutils or import setuptools first, " + "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib." + ) return which == 'local' From 2832216ada28985a9a972be9c7e8adf93e724a3b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Nov 2023 14:44:38 -0500 Subject: [PATCH 003/151] Announce the deprecation of imported distutils from stdlib. Ref #4137. --- _distutils_hack/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py index 0b47d17435..b8322fc182 100644 --- a/_distutils_hack/__init__.py +++ b/_distutils_hack/__init__.py @@ -30,7 +30,11 @@ def clear_distutils(): return import warnings - warnings.warn("Setuptools is replacing distutils.") + warnings.warn( + "Setuptools is replacing distutils. Support for replacing " + "an already imported distutils is deprecated. In the future, " + "this condition will fail.", + ) mods = [ name for name in sys.modules From 2ad8784dfeb816829995613fb5fd9818f3e88922 Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Tue, 4 Oct 2022 13:49:49 +0530 Subject: [PATCH 004/151] Add support for building extensions using MinGW compilers --- distutils/ccompiler.py | 6 +++++- distutils/command/build_ext.py | 8 ++++---- distutils/cygwinccompiler.py | 4 ++-- distutils/sysconfig.py | 9 ++++++--- distutils/util.py | 9 +++++++++ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py index c1c7d5476e..dba2e61551 100644 --- a/distutils/ccompiler.py +++ b/distutils/ccompiler.py @@ -19,7 +19,7 @@ from .file_util import move_file from .dir_util import mkpath from ._modified import newer_group -from .util import split_quoted, execute +from .util import split_quoted, execute, is_mingw from ._log import log @@ -1076,6 +1076,10 @@ def get_default_compiler(osname=None, platform=None): osname = os.name if platform is None: platform = sys.platform + # Mingw is a special case where sys.platform is 'win32' but we + # want to use the 'mingw32' compiler, so check it first + if is_mingw(): + return 'mingw32' for pattern, compiler in _default_compilers: if ( re.match(pattern, platform) is not None diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py index b48f462626..4a69e9c113 100644 --- a/distutils/command/build_ext.py +++ b/distutils/command/build_ext.py @@ -21,7 +21,7 @@ from ..sysconfig import get_config_h_filename from .._modified import newer_group from ..extension import Extension -from ..util import get_platform +from ..util import get_platform, is_mingw from distutils._log import log from . import py37compat @@ -189,7 +189,7 @@ def finalize_options(self): # noqa: C901 # for extensions under windows use different directories # for Release and Debug builds. # also Python's library directory must be appended to library_dirs - if os.name == 'nt': + if os.name == 'nt' and not is_mingw(): # the 'libs' directory is for binary installs - we assume that # must be the *native* platform. But we don't really support # cross-compiling via a binary install anyway, so we let it go. @@ -742,7 +742,7 @@ def get_libraries(self, ext): # noqa: C901 # pyconfig.h that MSVC groks. The other Windows compilers all seem # to need it mentioned explicitly, though, so that's what we do. # Append '_d' to the python import library on debug builds. - if sys.platform == "win32": + if sys.platform == "win32" and not is_mingw(): from .._msvccompiler import MSVCCompiler if not isinstance(self.compiler, MSVCCompiler): @@ -772,7 +772,7 @@ def get_libraries(self, ext): # noqa: C901 # A native build on an Android device or on Cygwin if hasattr(sys, 'getandroidapilevel'): link_libpython = True - elif sys.platform == 'cygwin': + elif sys.platform == 'cygwin' or is_mingw(): link_libpython = True elif '_PYTHON_HOST_PLATFORM' in os.environ: # We are cross-compiling for one of the relevant platforms diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py index 47efa377c5..7ed169f330 100644 --- a/distutils/cygwinccompiler.py +++ b/distutils/cygwinccompiler.py @@ -57,7 +57,7 @@ def get_msvcr(): try: msc_ver = int(match.group(1)) except AttributeError: - return + return [] try: return _msvcr_lookup[msc_ver] except KeyError: @@ -277,7 +277,7 @@ def __init__(self, verbose=0, dry_run=0, force=0): self.set_executables( compiler='%s -O -Wall' % self.cc, - compiler_so='%s -mdll -O -Wall' % self.cc, + compiler_so='%s -shared -O -Wall' % self.cc, compiler_cxx='%s -O -Wall' % self.cxx, linker_exe='%s' % self.cc, linker_so='{} {}'.format(self.linker_dll, shared_option), diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index a40a7231b3..166d85437a 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -18,6 +18,7 @@ from .errors import DistutilsPlatformError from . import py39compat from ._functools import pass_none +from .util import is_mingw IS_PYPY = '__pypy__' in sys.builtin_module_names @@ -120,8 +121,10 @@ def get_python_inc(plat_specific=0, prefix=None): """ default_prefix = BASE_EXEC_PREFIX if plat_specific else BASE_PREFIX resolved_prefix = prefix if prefix is not None else default_prefix + # MinGW imitates posix like layout, but os.name != posix + os_name = "posix" if is_mingw() else os.name try: - getter = globals()[f'_get_python_inc_{os.name}'] + getter = globals()[f'_get_python_inc_{os_name}'] except KeyError: raise DistutilsPlatformError( "I don't know where Python installs its C header files " @@ -244,7 +247,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): else: prefix = plat_specific and EXEC_PREFIX or PREFIX - if os.name == "posix": + if os.name == "posix" or is_mingw(): if plat_specific or standard_lib: # Platform-specific modules (any module from a non-pure-Python # module distribution) or standard Python library modules. @@ -273,7 +276,7 @@ def customize_compiler(compiler): # noqa: C901 Mainly needed on Unix, so we can plug in the information that varies across Unices and is stored in Python's Makefile. """ - if compiler.compiler_type == "unix": + if compiler.compiler_type in ["unix", "cygwin", "mingw32"]: if sys.platform == "darwin": # Perform first-time customization of compiler-related # config vars on OS X now that we know we need a compiler. diff --git a/distutils/util.py b/distutils/util.py index 5408b16032..bec979d7da 100644 --- a/distutils/util.py +++ b/distutils/util.py @@ -517,3 +517,12 @@ def rfc822_escape(header): suffix = indent if ends_in_newline else "" return indent.join(lines) + suffix + + +def is_mingw(): + """Returns True if the current platform is mingw. + + Python compiled with Mingw-w64 has sys.platform == 'win32' and + get_platform() starts with 'mingw'. + """ + return sys.platform == 'win32' and get_platform().startswith('mingw') From e69a19e59768b08a4a29bb8be09c09974d625ff5 Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Sat, 8 Oct 2022 11:26:48 +0530 Subject: [PATCH 005/151] Fix tests for `get_msvcr` function --- distutils/tests/test_cygwinccompiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distutils/tests/test_cygwinccompiler.py b/distutils/tests/test_cygwinccompiler.py index 6fb449a6c2..3cb95e1231 100644 --- a/distutils/tests/test_cygwinccompiler.py +++ b/distutils/tests/test_cygwinccompiler.py @@ -71,12 +71,12 @@ def test_check_config_h(self): assert check_config_h()[0] == CONFIG_H_OK def test_get_msvcr(self): - # none + # [] sys.version = ( '2.6.1 (r261:67515, Dec 6 2008, 16:42:21) ' '\n[GCC 4.0.1 (Apple Computer, Inc. build 5370)]' ) - assert get_msvcr() is None + assert get_msvcr() == [] # MSVC 7.0 sys.version = ( From 571f761ab313aa0e8171da5956c090cb7d417764 Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Thu, 17 Nov 2022 13:25:32 +0530 Subject: [PATCH 006/151] Make `test_customize_compiler` run on mingw Simply, run it for the subclasses for `UnixCCompiler` --- distutils/tests/test_sysconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distutils/tests/test_sysconfig.py b/distutils/tests/test_sysconfig.py index bfeaf9a6b9..c7af690bcc 100644 --- a/distutils/tests/test_sysconfig.py +++ b/distutils/tests/test_sysconfig.py @@ -12,7 +12,7 @@ import distutils from distutils import sysconfig -from distutils.ccompiler import get_default_compiler # noqa: F401 +from distutils.ccompiler import new_compiler # noqa: F401 from distutils.unixccompiler import UnixCCompiler from test.support import swap_item @@ -109,7 +109,7 @@ def set_executables(self, **kw): return comp - @pytest.mark.skipif("get_default_compiler() != 'unix'") + @pytest.mark.skipif("not isinstance(new_compiler(), UnixCCompiler)") def test_customize_compiler(self): # Make sure that sysconfig._config_vars is initialized sysconfig.get_config_vars() From 9e707f07e9794a209ee49f23c3a8890b57c5e9e7 Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Thu, 17 Nov 2022 13:54:18 +0530 Subject: [PATCH 007/151] CI: add msys2 mingw test --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 45c66794f0..402363d636 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -115,6 +115,45 @@ jobs: shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0} run: tox + test_msys2_mingw: + strategy: + matrix: + include: + - { sys: mingw64, env: x86_64 } + - { sys: mingw32, env: i686 } + - { sys: ucrt64, env: ucrt-x86_64 } + - { sys: clang64, env: clang-x86_64 } + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + install: | + mingw-w64-${{matrix.env}}-toolchain + mingw-w64-${{matrix.env}}-python + mingw-w64-${{matrix.env}}-python-pip + mingw-w64-${{matrix.env}}-python-virtualenv + mingw-w64-${{matrix.env}}-cc + git + - name: Install Dependencies + shell: msys2 {0} + run: | + export VIRTUALENV_NO_SETUPTOOLS=1 + + python -m virtualenv venv + source venv/bin/activate + + # python-ruff doesn't work without rust + sed -i '/pytest-ruff/d' setup.cfg + + pip install -e .[testing] + - name: Run tests + shell: msys2 {0} + run: | + source venv/bin/activate + pytest distutils/tests + ci_setuptools: # Integration testing with setuptools if: ${{ false }} # disabled for deprecation warnings From 36a2941e558126364900a6fd4ad0ab3c0d21a95b Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Wed, 8 Nov 2023 20:30:29 +0530 Subject: [PATCH 008/151] Fix path separator issue in change_root function use `os.sep` instead of hardcoding `\\` also, fix appropriate tests --- distutils/tests/test_util.py | 1 + distutils/util.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/distutils/tests/test_util.py b/distutils/tests/test_util.py index 22a003d8ca..2b340a3b27 100644 --- a/distutils/tests/test_util.py +++ b/distutils/tests/test_util.py @@ -109,6 +109,7 @@ def _join(*path): # windows os.name = 'nt' + os.sep = '\\' def _isabs(path): return path.startswith('c:\\') diff --git a/distutils/util.py b/distutils/util.py index bec979d7da..b291ba3ed7 100644 --- a/distutils/util.py +++ b/distutils/util.py @@ -165,7 +165,7 @@ def change_root(new_root, pathname): elif os.name == 'nt': (drive, path) = os.path.splitdrive(pathname) - if path[0] == '\\': + if path[0] == os.sep: path = path[1:] return os.path.join(new_root, path) From c9770264f7af6f08d98bbd6928a921d6b14eb198 Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Wed, 8 Nov 2023 20:39:37 +0530 Subject: [PATCH 009/151] test_install: fix an issue specific to mingw --- distutils/tests/test_install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distutils/tests/test_install.py b/distutils/tests/test_install.py index 082ee1d349..c74bf8cb21 100644 --- a/distutils/tests/test_install.py +++ b/distutils/tests/test_install.py @@ -16,6 +16,7 @@ from distutils.core import Distribution from distutils.errors import DistutilsOptionError from distutils.extension import Extension +from distutils.util import is_mingw from distutils.tests import support, missing_compiler_executable @@ -120,7 +121,7 @@ def _expanduser(path): assert 'usersite' in cmd.config_vars actual_headers = os.path.relpath(cmd.install_headers, site.USER_BASE) - if os.name == 'nt': + if os.name == 'nt' and not is_mingw(): site_path = os.path.relpath(os.path.dirname(orig_site), orig_base) include = os.path.join(site_path, 'Include') else: From 79830a81664feee1a9ae4d031909d261e363320e Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Wed, 8 Nov 2023 23:23:42 +0530 Subject: [PATCH 010/151] Remove testing dependency on jaraco.text it depends on pydantic-core which requires rust to work also, takes a few minutes to build. --- distutils/tests/test_sysconfig.py | 6 +++++- setup.cfg | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/distutils/tests/test_sysconfig.py b/distutils/tests/test_sysconfig.py index c7af690bcc..c4e1648fab 100644 --- a/distutils/tests/test_sysconfig.py +++ b/distutils/tests/test_sysconfig.py @@ -8,7 +8,7 @@ import pytest import jaraco.envs import path -from jaraco.text import trim +from textwrap import dedent import distutils from distutils import sysconfig @@ -19,6 +19,10 @@ from . import py37compat +def trim(s): + return dedent(s).strip() + + @pytest.mark.usefixtures('save_env') class TestSysconfig: def test_get_config_h_filename(self): diff --git a/setup.cfg b/setup.cfg index 68c38ac901..7a748f49b5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,7 +40,6 @@ testing = pytest >= 7.4.3 #186 jaraco.envs>=2.4 jaraco.path - jaraco.text path docutils pyfakefs From e4e16870510edbe59f834693ff62857ddd14481d Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Thu, 9 Nov 2023 18:48:16 +0530 Subject: [PATCH 011/151] Add test for dll_libraries attribute in CygwinCCompiler class --- distutils/tests/test_cygwinccompiler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/distutils/tests/test_cygwinccompiler.py b/distutils/tests/test_cygwinccompiler.py index 3cb95e1231..ffbaf1ea4d 100644 --- a/distutils/tests/test_cygwinccompiler.py +++ b/distutils/tests/test_cygwinccompiler.py @@ -114,3 +114,10 @@ def test_get_msvcr(self): ) with pytest.raises(ValueError): get_msvcr() + + @pytest.mark.skipif('sys.platform != "cygwin"') + def test_dll_libraries_not_none(self): + from distutils.cygwinccompiler import CygwinCCompiler + + compiler = CygwinCCompiler() + assert compiler.dll_libraries is not None From bbe7b64f4eedbeee9d71e197dd4b5d3175f4d04a Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Thu, 9 Nov 2023 18:48:50 +0530 Subject: [PATCH 012/151] Add some tests for Mingw32CCompiler class --- distutils/tests/test_mingwccompiler.py | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 distutils/tests/test_mingwccompiler.py diff --git a/distutils/tests/test_mingwccompiler.py b/distutils/tests/test_mingwccompiler.py new file mode 100644 index 0000000000..d81360e782 --- /dev/null +++ b/distutils/tests/test_mingwccompiler.py @@ -0,0 +1,45 @@ +import pytest + +from distutils.util import split_quoted, is_mingw +from distutils.errors import DistutilsPlatformError, CCompilerError + + +class TestMingw32CCompiler: + @pytest.mark.skipif(not is_mingw(), reason='not on mingw') + def test_compiler_type(self): + from distutils.cygwinccompiler import Mingw32CCompiler + + compiler = Mingw32CCompiler() + assert compiler.compiler_type == 'mingw32' + + @pytest.mark.skipif(not is_mingw(), reason='not on mingw') + def test_set_executables(self, monkeypatch): + from distutils.cygwinccompiler import Mingw32CCompiler + + monkeypatch.setenv('CC', 'cc') + monkeypatch.setenv('CXX', 'c++') + + compiler = Mingw32CCompiler() + + assert compiler.compiler == split_quoted('cc -O -Wall') + assert compiler.compiler_so == split_quoted('cc -shared -O -Wall') + assert compiler.compiler_cxx == split_quoted('c++ -O -Wall') + assert compiler.linker_exe == split_quoted('cc') + assert compiler.linker_so == split_quoted('cc -shared') + + @pytest.mark.skipif(not is_mingw(), reason='not on mingw') + def test_runtime_library_dir_option(self): + from distutils.cygwinccompiler import Mingw32CCompiler + + compiler = Mingw32CCompiler() + with pytest.raises(DistutilsPlatformError): + compiler.runtime_library_dir_option('/usr/lib') + + @pytest.mark.skipif(not is_mingw(), reason='not on mingw') + def test_cygwincc_error(self, monkeypatch): + import distutils.cygwinccompiler + + monkeypatch.setattr(distutils.cygwinccompiler, 'is_cygwincc', lambda _: True) + + with pytest.raises(CCompilerError): + distutils.cygwinccompiler.Mingw32CCompiler() From 21482ac4b2ef50e41218beafba261061daf23d9b Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Wed, 20 Mar 2024 20:46:50 +0000 Subject: [PATCH 013/151] Support PEP 625 --- distutils/dist.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/distutils/dist.py b/distutils/dist.py index c4d2a45dc2..9f1e23e636 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -23,6 +23,7 @@ DistutilsArgError, DistutilsClassError, ) +from setuptools.extern.packaging.utils import canonicalize_name, canonicalize_version from .fancy_getopt import FancyGetopt, translate_longopt from .util import check_environ, strtobool, rfc822_escape from ._log import log @@ -1189,7 +1190,9 @@ def get_version(self): return self.version or "0.0.0" def get_fullname(self): - return f"{self.get_name()}-{self.get_version()}" + return "{}-{}".format( + canonicalize_name(self.get_name()), canonicalize_version(self.get_version()) + ) def get_author(self): return self.author From 005ba4b6d47d96c3a93e21a8bcae32c10c1f202a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 Apr 2024 19:10:53 -0400 Subject: [PATCH 014/151] Expect to find canonicalize_* functions in packaging. --- distutils/dist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distutils/dist.py b/distutils/dist.py index 9f1e23e636..b0cb87d559 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -12,6 +12,8 @@ import logging from email import message_from_file +from packaging.utils import canonicalize_name, canonicalize_version + try: import warnings except ImportError: @@ -23,7 +25,6 @@ DistutilsArgError, DistutilsClassError, ) -from setuptools.extern.packaging.utils import canonicalize_name, canonicalize_version from .fancy_getopt import FancyGetopt, translate_longopt from .util import check_environ, strtobool, rfc822_escape from ._log import log From be32fecc787c3de8c292638c5004a8bcf92dc540 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 Apr 2024 19:14:18 -0400 Subject: [PATCH 015/151] Update tests to match new expectation. --- distutils/tests/test_sdist.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/distutils/tests/test_sdist.py b/distutils/tests/test_sdist.py index 450f68c993..e708edc4e1 100644 --- a/distutils/tests/test_sdist.py +++ b/distutils/tests/test_sdist.py @@ -118,9 +118,9 @@ def test_prune_file_list(self): # now let's check what we have dist_folder = join(self.tmp_dir, 'dist') files = os.listdir(dist_folder) - assert files == ['fake-1.0.zip'] + assert files == ['fake-1.zip'] - zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip')) + zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.zip')) try: content = zip_file.namelist() finally: @@ -135,7 +135,7 @@ def test_prune_file_list(self): 'somecode/', 'somecode/__init__.py', ] - assert sorted(content) == ['fake-1.0/' + x for x in expected] + assert sorted(content) == ['fake-1/' + x for x in expected] @pytest.mark.usefixtures('needs_zlib') @pytest.mark.skipif("not find_executable('tar')") @@ -153,10 +153,10 @@ def test_make_distribution(self): dist_folder = join(self.tmp_dir, 'dist') result = os.listdir(dist_folder) result.sort() - assert result == ['fake-1.0.tar', 'fake-1.0.tar.gz'] + assert result == ['fake-1.tar', 'fake-1.tar.gz'] - os.remove(join(dist_folder, 'fake-1.0.tar')) - os.remove(join(dist_folder, 'fake-1.0.tar.gz')) + os.remove(join(dist_folder, 'fake-1.tar')) + os.remove(join(dist_folder, 'fake-1.tar.gz')) # now trying a tar then a gztar cmd.formats = ['tar', 'gztar'] @@ -166,7 +166,7 @@ def test_make_distribution(self): result = os.listdir(dist_folder) result.sort() - assert result == ['fake-1.0.tar', 'fake-1.0.tar.gz'] + assert result == ['fake-1.tar', 'fake-1.tar.gz'] @pytest.mark.usefixtures('needs_zlib') def test_add_defaults(self): @@ -219,9 +219,9 @@ def test_add_defaults(self): # now let's check what we have dist_folder = join(self.tmp_dir, 'dist') files = os.listdir(dist_folder) - assert files == ['fake-1.0.zip'] + assert files == ['fake-1.zip'] - zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.0.zip')) + zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.zip')) try: content = zip_file.namelist() finally: @@ -247,7 +247,7 @@ def test_add_defaults(self): 'somecode/doc.dat', 'somecode/doc.txt', ] - assert sorted(content) == ['fake-1.0/' + x for x in expected] + assert sorted(content) == ['fake-1/' + x for x in expected] # checking the MANIFEST manifest = pathlib.Path(self.tmp_dir, 'MANIFEST').read_text(encoding='utf-8') @@ -420,16 +420,16 @@ def test_manual_manifest(self): assert list(clean_lines(cmd.manifest)) == ['README.manual'] - archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz') + archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz') archive = tarfile.open(archive_name) try: filenames = [tarinfo.name for tarinfo in archive] finally: archive.close() assert sorted(filenames) == [ - 'fake-1.0', - 'fake-1.0/PKG-INFO', - 'fake-1.0/README.manual', + 'fake-1', + 'fake-1/PKG-INFO', + 'fake-1/README.manual', ] @pytest.mark.usefixtures('needs_zlib') @@ -449,7 +449,7 @@ def test_make_distribution_owner_group(self): cmd.run() # making sure we have the good rights - archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz') + archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz') archive = tarfile.open(archive_name) try: for member in archive.getmembers(): @@ -467,7 +467,7 @@ def test_make_distribution_owner_group(self): cmd.run() # making sure we have the good rights - archive_name = join(self.tmp_dir, 'dist', 'fake-1.0.tar.gz') + archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz') archive = tarfile.open(archive_name) # note that we are not testing the group ownership here From 2316432d6e62a3db3ae701d7cf839258c02a702d Mon Sep 17 00:00:00 2001 From: Dustin Ingram Date: Thu, 11 Apr 2024 15:43:12 +0000 Subject: [PATCH 016/151] Fix canonicalization --- distutils/dist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distutils/dist.py b/distutils/dist.py index b0cb87d559..4b3824df7e 100644 --- a/distutils/dist.py +++ b/distutils/dist.py @@ -1192,7 +1192,8 @@ def get_version(self): def get_fullname(self): return "{}-{}".format( - canonicalize_name(self.get_name()), canonicalize_version(self.get_version()) + canonicalize_name(self.get_name()).replace('-', '_'), + canonicalize_version(self.get_version()), ) def get_author(self): From d2de2195f48ddc07999cbb173df0adc3185013ce Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 Apr 2024 19:29:06 -0400 Subject: [PATCH 017/151] In test_sdist, provide a more complex name to capture canonicalization behavior. --- distutils/tests/test_sdist.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/distutils/tests/test_sdist.py b/distutils/tests/test_sdist.py index e708edc4e1..359325d5dc 100644 --- a/distutils/tests/test_sdist.py +++ b/distutils/tests/test_sdist.py @@ -74,7 +74,7 @@ def get_cmd(self, metadata=None): """Returns a cmd""" if metadata is None: metadata = { - 'name': 'fake', + 'name': 'ns.fake--pkg', 'version': '1.0', 'url': 'xxx', 'author': 'xxx', @@ -118,9 +118,9 @@ def test_prune_file_list(self): # now let's check what we have dist_folder = join(self.tmp_dir, 'dist') files = os.listdir(dist_folder) - assert files == ['fake-1.zip'] + assert files == ['ns_fake_pkg-1.zip'] - zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.zip')) + zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.zip')) try: content = zip_file.namelist() finally: @@ -135,7 +135,7 @@ def test_prune_file_list(self): 'somecode/', 'somecode/__init__.py', ] - assert sorted(content) == ['fake-1/' + x for x in expected] + assert sorted(content) == ['ns_fake_pkg-1/' + x for x in expected] @pytest.mark.usefixtures('needs_zlib') @pytest.mark.skipif("not find_executable('tar')") @@ -153,10 +153,10 @@ def test_make_distribution(self): dist_folder = join(self.tmp_dir, 'dist') result = os.listdir(dist_folder) result.sort() - assert result == ['fake-1.tar', 'fake-1.tar.gz'] + assert result == ['ns_fake_pkg-1.tar', 'ns_fake_pkg-1.tar.gz'] - os.remove(join(dist_folder, 'fake-1.tar')) - os.remove(join(dist_folder, 'fake-1.tar.gz')) + os.remove(join(dist_folder, 'ns_fake_pkg-1.tar')) + os.remove(join(dist_folder, 'ns_fake_pkg-1.tar.gz')) # now trying a tar then a gztar cmd.formats = ['tar', 'gztar'] @@ -166,7 +166,7 @@ def test_make_distribution(self): result = os.listdir(dist_folder) result.sort() - assert result == ['fake-1.tar', 'fake-1.tar.gz'] + assert result == ['ns_fake_pkg-1.tar', 'ns_fake_pkg-1.tar.gz'] @pytest.mark.usefixtures('needs_zlib') def test_add_defaults(self): @@ -219,9 +219,9 @@ def test_add_defaults(self): # now let's check what we have dist_folder = join(self.tmp_dir, 'dist') files = os.listdir(dist_folder) - assert files == ['fake-1.zip'] + assert files == ['ns_fake_pkg-1.zip'] - zip_file = zipfile.ZipFile(join(dist_folder, 'fake-1.zip')) + zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.zip')) try: content = zip_file.namelist() finally: @@ -247,7 +247,7 @@ def test_add_defaults(self): 'somecode/doc.dat', 'somecode/doc.txt', ] - assert sorted(content) == ['fake-1/' + x for x in expected] + assert sorted(content) == ['ns_fake_pkg-1/' + x for x in expected] # checking the MANIFEST manifest = pathlib.Path(self.tmp_dir, 'MANIFEST').read_text(encoding='utf-8') @@ -420,16 +420,16 @@ def test_manual_manifest(self): assert list(clean_lines(cmd.manifest)) == ['README.manual'] - archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz') + archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.tar.gz') archive = tarfile.open(archive_name) try: filenames = [tarinfo.name for tarinfo in archive] finally: archive.close() assert sorted(filenames) == [ - 'fake-1', - 'fake-1/PKG-INFO', - 'fake-1/README.manual', + 'ns_fake_pkg-1', + 'ns_fake_pkg-1/PKG-INFO', + 'ns_fake_pkg-1/README.manual', ] @pytest.mark.usefixtures('needs_zlib') @@ -449,7 +449,7 @@ def test_make_distribution_owner_group(self): cmd.run() # making sure we have the good rights - archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz') + archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.tar.gz') archive = tarfile.open(archive_name) try: for member in archive.getmembers(): @@ -467,7 +467,7 @@ def test_make_distribution_owner_group(self): cmd.run() # making sure we have the good rights - archive_name = join(self.tmp_dir, 'dist', 'fake-1.tar.gz') + archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.tar.gz') archive = tarfile.open(archive_name) # note that we are not testing the group ownership here From 11e8f76e422a8d21170a6aae65bde409fc8e0901 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 11 Apr 2024 19:06:14 -0400 Subject: [PATCH 018/151] Add packaging as a vendored package. --- .coveragerc | 1 + conftest.py | 5 + distutils/_vendor/__init__.py | 0 .../packaging-24.0.dist-info/INSTALLER | 1 + .../_vendor/packaging-24.0.dist-info/LICENSE | 3 + .../packaging-24.0.dist-info/LICENSE.APACHE | 177 +++ .../packaging-24.0.dist-info/LICENSE.BSD | 23 + .../_vendor/packaging-24.0.dist-info/METADATA | 102 ++ .../_vendor/packaging-24.0.dist-info/RECORD | 37 + .../packaging-24.0.dist-info/REQUESTED | 0 .../_vendor/packaging-24.0.dist-info/WHEEL | 4 + distutils/_vendor/packaging/__init__.py | 15 + distutils/_vendor/packaging/_elffile.py | 108 ++ distutils/_vendor/packaging/_manylinux.py | 260 +++++ distutils/_vendor/packaging/_musllinux.py | 83 ++ distutils/_vendor/packaging/_parser.py | 356 ++++++ distutils/_vendor/packaging/_structures.py | 61 + distutils/_vendor/packaging/_tokenizer.py | 192 ++++ distutils/_vendor/packaging/markers.py | 252 ++++ distutils/_vendor/packaging/metadata.py | 825 +++++++++++++ distutils/_vendor/packaging/py.typed | 0 distutils/_vendor/packaging/requirements.py | 90 ++ distutils/_vendor/packaging/specifiers.py | 1017 +++++++++++++++++ distutils/_vendor/packaging/tags.py | 571 +++++++++ distutils/_vendor/packaging/utils.py | 172 +++ distutils/_vendor/packaging/version.py | 563 +++++++++ distutils/_vendor/ruff.toml | 1 + 27 files changed, 4919 insertions(+) create mode 100644 distutils/_vendor/__init__.py create mode 100644 distutils/_vendor/packaging-24.0.dist-info/INSTALLER create mode 100644 distutils/_vendor/packaging-24.0.dist-info/LICENSE create mode 100644 distutils/_vendor/packaging-24.0.dist-info/LICENSE.APACHE create mode 100644 distutils/_vendor/packaging-24.0.dist-info/LICENSE.BSD create mode 100644 distutils/_vendor/packaging-24.0.dist-info/METADATA create mode 100644 distutils/_vendor/packaging-24.0.dist-info/RECORD create mode 100644 distutils/_vendor/packaging-24.0.dist-info/REQUESTED create mode 100644 distutils/_vendor/packaging-24.0.dist-info/WHEEL create mode 100644 distutils/_vendor/packaging/__init__.py create mode 100644 distutils/_vendor/packaging/_elffile.py create mode 100644 distutils/_vendor/packaging/_manylinux.py create mode 100644 distutils/_vendor/packaging/_musllinux.py create mode 100644 distutils/_vendor/packaging/_parser.py create mode 100644 distutils/_vendor/packaging/_structures.py create mode 100644 distutils/_vendor/packaging/_tokenizer.py create mode 100644 distutils/_vendor/packaging/markers.py create mode 100644 distutils/_vendor/packaging/metadata.py create mode 100644 distutils/_vendor/packaging/py.typed create mode 100644 distutils/_vendor/packaging/requirements.py create mode 100644 distutils/_vendor/packaging/specifiers.py create mode 100644 distutils/_vendor/packaging/tags.py create mode 100644 distutils/_vendor/packaging/utils.py create mode 100644 distutils/_vendor/packaging/version.py create mode 100644 distutils/_vendor/ruff.toml diff --git a/.coveragerc b/.coveragerc index 35b98b1df9..654e4c4ff4 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,6 +2,7 @@ omit = # leading `*/` for pytest-dev/pytest-cov#456 */.tox/* + */distutils/_vendor/* disable_warnings = couldnt-parse diff --git a/conftest.py b/conftest.py index 06ce3bc6c8..8e05649fce 100644 --- a/conftest.py +++ b/conftest.py @@ -17,6 +17,11 @@ ]) +collect_ignore_glob = [ + 'distutils/_vendor/**/*', +] + + @pytest.fixture def save_env(): orig = os.environ.copy() diff --git a/distutils/_vendor/__init__.py b/distutils/_vendor/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/distutils/_vendor/packaging-24.0.dist-info/INSTALLER b/distutils/_vendor/packaging-24.0.dist-info/INSTALLER new file mode 100644 index 0000000000..a1b589e38a --- /dev/null +++ b/distutils/_vendor/packaging-24.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/distutils/_vendor/packaging-24.0.dist-info/LICENSE b/distutils/_vendor/packaging-24.0.dist-info/LICENSE new file mode 100644 index 0000000000..6f62d44e4e --- /dev/null +++ b/distutils/_vendor/packaging-24.0.dist-info/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the licenses +found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made +under the terms of *both* these licenses. diff --git a/distutils/_vendor/packaging-24.0.dist-info/LICENSE.APACHE b/distutils/_vendor/packaging-24.0.dist-info/LICENSE.APACHE new file mode 100644 index 0000000000..f433b1a53f --- /dev/null +++ b/distutils/_vendor/packaging-24.0.dist-info/LICENSE.APACHE @@ -0,0 +1,177 @@ + + 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 diff --git a/distutils/_vendor/packaging-24.0.dist-info/LICENSE.BSD b/distutils/_vendor/packaging-24.0.dist-info/LICENSE.BSD new file mode 100644 index 0000000000..42ce7b75c9 --- /dev/null +++ b/distutils/_vendor/packaging-24.0.dist-info/LICENSE.BSD @@ -0,0 +1,23 @@ +Copyright (c) Donald Stufft and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/distutils/_vendor/packaging-24.0.dist-info/METADATA b/distutils/_vendor/packaging-24.0.dist-info/METADATA new file mode 100644 index 0000000000..10ab4390a9 --- /dev/null +++ b/distutils/_vendor/packaging-24.0.dist-info/METADATA @@ -0,0 +1,102 @@ +Metadata-Version: 2.1 +Name: packaging +Version: 24.0 +Summary: Core utilities for Python packages +Author-email: Donald Stufft +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Typing :: Typed +Project-URL: Documentation, https://packaging.pypa.io/ +Project-URL: Source, https://github.com/pypa/packaging + +packaging +========= + +.. start-intro + +Reusable core utilities for various Python Packaging +`interoperability specifications `_. + +This library provides utilities that implement the interoperability +specifications which have clearly one correct behaviour (eg: :pep:`440`) +or benefit greatly from having a single shared implementation (eg: :pep:`425`). + +.. end-intro + +The ``packaging`` project includes the following: version handling, specifiers, +markers, requirements, tags, utilities. + +Documentation +------------- + +The `documentation`_ provides information and the API for the following: + +- Version Handling +- Specifiers +- Markers +- Requirements +- Tags +- Utilities + +Installation +------------ + +Use ``pip`` to install these utilities:: + + pip install packaging + +The ``packaging`` library uses calendar-based versioning (``YY.N``). + +Discussion +---------- + +If you run into bugs, you can file them in our `issue tracker`_. + +You can also join ``#pypa`` on Freenode to ask questions or get involved. + + +.. _`documentation`: https://packaging.pypa.io/ +.. _`issue tracker`: https://github.com/pypa/packaging/issues + + +Code of Conduct +--------------- + +Everyone interacting in the packaging project's codebases, issue trackers, chat +rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. + +.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + +Contributing +------------ + +The ``CONTRIBUTING.rst`` file outlines how to contribute to this project as +well as how to report a potential security issue. The documentation for this +project also covers information about `project development`_ and `security`_. + +.. _`project development`: https://packaging.pypa.io/en/latest/development/ +.. _`security`: https://packaging.pypa.io/en/latest/security/ + +Project History +--------------- + +Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for +recent changes and project history. + +.. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/ + diff --git a/distutils/_vendor/packaging-24.0.dist-info/RECORD b/distutils/_vendor/packaging-24.0.dist-info/RECORD new file mode 100644 index 0000000000..bcf796c2f4 --- /dev/null +++ b/distutils/_vendor/packaging-24.0.dist-info/RECORD @@ -0,0 +1,37 @@ +packaging-24.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +packaging-24.0.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197 +packaging-24.0.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174 +packaging-24.0.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344 +packaging-24.0.dist-info/METADATA,sha256=0dESdhY_wHValuOrbgdebiEw04EbX4dkujlxPdEsFus,3203 +packaging-24.0.dist-info/RECORD,, +packaging-24.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +packaging-24.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 +packaging/__init__.py,sha256=UzotcV07p8vcJzd80S-W0srhgY8NMVD_XvJcZ7JN-tA,496 +packaging/__pycache__/__init__.cpython-312.pyc,, +packaging/__pycache__/_elffile.cpython-312.pyc,, +packaging/__pycache__/_manylinux.cpython-312.pyc,, +packaging/__pycache__/_musllinux.cpython-312.pyc,, +packaging/__pycache__/_parser.cpython-312.pyc,, +packaging/__pycache__/_structures.cpython-312.pyc,, +packaging/__pycache__/_tokenizer.cpython-312.pyc,, +packaging/__pycache__/markers.cpython-312.pyc,, +packaging/__pycache__/metadata.cpython-312.pyc,, +packaging/__pycache__/requirements.cpython-312.pyc,, +packaging/__pycache__/specifiers.cpython-312.pyc,, +packaging/__pycache__/tags.cpython-312.pyc,, +packaging/__pycache__/utils.cpython-312.pyc,, +packaging/__pycache__/version.cpython-312.pyc,, +packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266 +packaging/_manylinux.py,sha256=1ng_TqyH49hY6s3W_zVHyoJIaogbJqbIF1jJ0fAehc4,9590 +packaging/_musllinux.py,sha256=kgmBGLFybpy8609-KTvzmt2zChCPWYvhp5BWP4JX7dE,2676 +packaging/_parser.py,sha256=zlsFB1FpMRjkUdQb6WLq7xON52ruQadxFpYsDXWhLb4,10347 +packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431 +packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292 +packaging/markers.py,sha256=eH-txS2zq1HdNpTd9LcZUcVIwewAiNU0grmq5wjKnOk,8208 +packaging/metadata.py,sha256=w7jPEg6mDf1FTZMn79aFxFuk4SKtynUJtxr2InTxlV4,33036 +packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +packaging/requirements.py,sha256=dgoBeVprPu2YE6Q8nGfwOPTjATHbRa_ZGLyXhFEln6Q,2933 +packaging/specifiers.py,sha256=dB2DwbmvSbEuVilEyiIQ382YfW5JfwzXTfRRPVtaENY,39784 +packaging/tags.py,sha256=fedHXiOHkBxNZTXotXv8uXPmMFU9ae-TKBujgYHigcA,18950 +packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268 +packaging/version.py,sha256=XjRBLNK17UMDgLeP8UHnqwiY3TdSi03xFQURtec211A,16236 diff --git a/distutils/_vendor/packaging-24.0.dist-info/REQUESTED b/distutils/_vendor/packaging-24.0.dist-info/REQUESTED new file mode 100644 index 0000000000..e69de29bb2 diff --git a/distutils/_vendor/packaging-24.0.dist-info/WHEEL b/distutils/_vendor/packaging-24.0.dist-info/WHEEL new file mode 100644 index 0000000000..3b5e64b5e6 --- /dev/null +++ b/distutils/_vendor/packaging-24.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/distutils/_vendor/packaging/__init__.py b/distutils/_vendor/packaging/__init__.py new file mode 100644 index 0000000000..e7c0aa12ca --- /dev/null +++ b/distutils/_vendor/packaging/__init__.py @@ -0,0 +1,15 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +__title__ = "packaging" +__summary__ = "Core utilities for Python packages" +__uri__ = "https://github.com/pypa/packaging" + +__version__ = "24.0" + +__author__ = "Donald Stufft and individual contributors" +__email__ = "donald@stufft.io" + +__license__ = "BSD-2-Clause or Apache-2.0" +__copyright__ = "2014 %s" % __author__ diff --git a/distutils/_vendor/packaging/_elffile.py b/distutils/_vendor/packaging/_elffile.py new file mode 100644 index 0000000000..6fb19b30bb --- /dev/null +++ b/distutils/_vendor/packaging/_elffile.py @@ -0,0 +1,108 @@ +""" +ELF file parser. + +This provides a class ``ELFFile`` that parses an ELF executable in a similar +interface to ``ZipFile``. Only the read interface is implemented. + +Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca +ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html +""" + +import enum +import os +import struct +from typing import IO, Optional, Tuple + + +class ELFInvalid(ValueError): + pass + + +class EIClass(enum.IntEnum): + C32 = 1 + C64 = 2 + + +class EIData(enum.IntEnum): + Lsb = 1 + Msb = 2 + + +class EMachine(enum.IntEnum): + I386 = 3 + S390 = 22 + Arm = 40 + X8664 = 62 + AArc64 = 183 + + +class ELFFile: + """ + Representation of an ELF executable. + """ + + def __init__(self, f: IO[bytes]) -> None: + self._f = f + + try: + ident = self._read("16B") + except struct.error: + raise ELFInvalid("unable to parse identification") + magic = bytes(ident[:4]) + if magic != b"\x7fELF": + raise ELFInvalid(f"invalid magic: {magic!r}") + + self.capacity = ident[4] # Format for program header (bitness). + self.encoding = ident[5] # Data structure encoding (endianness). + + try: + # e_fmt: Format for program header. + # p_fmt: Format for section header. + # p_idx: Indexes to find p_type, p_offset, and p_filesz. + e_fmt, self._p_fmt, self._p_idx = { + (1, 1): ("HHIIIIIHHH", ">IIIIIIII", (0, 1, 4)), # 32-bit MSB. + (2, 1): ("HHIQQQIHHH", ">IIQQQQQQ", (0, 2, 5)), # 64-bit MSB. + }[(self.capacity, self.encoding)] + except KeyError: + raise ELFInvalid( + f"unrecognized capacity ({self.capacity}) or " + f"encoding ({self.encoding})" + ) + + try: + ( + _, + self.machine, # Architecture type. + _, + _, + self._e_phoff, # Offset of program header. + _, + self.flags, # Processor-specific flags. + _, + self._e_phentsize, # Size of section. + self._e_phnum, # Number of sections. + ) = self._read(e_fmt) + except struct.error as e: + raise ELFInvalid("unable to parse machine and section information") from e + + def _read(self, fmt: str) -> Tuple[int, ...]: + return struct.unpack(fmt, self._f.read(struct.calcsize(fmt))) + + @property + def interpreter(self) -> Optional[str]: + """ + The path recorded in the ``PT_INTERP`` section header. + """ + for index in range(self._e_phnum): + self._f.seek(self._e_phoff + self._e_phentsize * index) + try: + data = self._read(self._p_fmt) + except struct.error: + continue + if data[self._p_idx[0]] != 3: # Not PT_INTERP. + continue + self._f.seek(data[self._p_idx[1]]) + return os.fsdecode(self._f.read(data[self._p_idx[2]])).strip("\0") + return None diff --git a/distutils/_vendor/packaging/_manylinux.py b/distutils/_vendor/packaging/_manylinux.py new file mode 100644 index 0000000000..ad62505f3f --- /dev/null +++ b/distutils/_vendor/packaging/_manylinux.py @@ -0,0 +1,260 @@ +import collections +import contextlib +import functools +import os +import re +import sys +import warnings +from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple + +from ._elffile import EIClass, EIData, ELFFile, EMachine + +EF_ARM_ABIMASK = 0xFF000000 +EF_ARM_ABI_VER5 = 0x05000000 +EF_ARM_ABI_FLOAT_HARD = 0x00000400 + + +# `os.PathLike` not a generic type until Python 3.9, so sticking with `str` +# as the type for `path` until then. +@contextlib.contextmanager +def _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]: + try: + with open(path, "rb") as f: + yield ELFFile(f) + except (OSError, TypeError, ValueError): + yield None + + +def _is_linux_armhf(executable: str) -> bool: + # hard-float ABI can be detected from the ELF header of the running + # process + # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf + with _parse_elf(executable) as f: + return ( + f is not None + and f.capacity == EIClass.C32 + and f.encoding == EIData.Lsb + and f.machine == EMachine.Arm + and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5 + and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD + ) + + +def _is_linux_i686(executable: str) -> bool: + with _parse_elf(executable) as f: + return ( + f is not None + and f.capacity == EIClass.C32 + and f.encoding == EIData.Lsb + and f.machine == EMachine.I386 + ) + + +def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool: + if "armv7l" in archs: + return _is_linux_armhf(executable) + if "i686" in archs: + return _is_linux_i686(executable) + allowed_archs = { + "x86_64", + "aarch64", + "ppc64", + "ppc64le", + "s390x", + "loongarch64", + "riscv64", + } + return any(arch in allowed_archs for arch in archs) + + +# If glibc ever changes its major version, we need to know what the last +# minor version was, so we can build the complete list of all versions. +# For now, guess what the highest minor version might be, assume it will +# be 50 for testing. Once this actually happens, update the dictionary +# with the actual value. +_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50) + + +class _GLibCVersion(NamedTuple): + major: int + minor: int + + +def _glibc_version_string_confstr() -> Optional[str]: + """ + Primary implementation of glibc_version_string using os.confstr. + """ + # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely + # to be broken or missing. This strategy is used in the standard library + # platform module. + # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183 + try: + # Should be a string like "glibc 2.17". + version_string: Optional[str] = os.confstr("CS_GNU_LIBC_VERSION") + assert version_string is not None + _, version = version_string.rsplit() + except (AssertionError, AttributeError, OSError, ValueError): + # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... + return None + return version + + +def _glibc_version_string_ctypes() -> Optional[str]: + """ + Fallback implementation of glibc_version_string using ctypes. + """ + try: + import ctypes + except ImportError: + return None + + # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen + # manpage says, "If filename is NULL, then the returned handle is for the + # main program". This way we can let the linker do the work to figure out + # which libc our process is actually using. + # + # We must also handle the special case where the executable is not a + # dynamically linked executable. This can occur when using musl libc, + # for example. In this situation, dlopen() will error, leading to an + # OSError. Interestingly, at least in the case of musl, there is no + # errno set on the OSError. The single string argument used to construct + # OSError comes from libc itself and is therefore not portable to + # hard code here. In any case, failure to call dlopen() means we + # can proceed, so we bail on our attempt. + try: + process_namespace = ctypes.CDLL(None) + except OSError: + return None + + try: + gnu_get_libc_version = process_namespace.gnu_get_libc_version + except AttributeError: + # Symbol doesn't exist -> therefore, we are not linked to + # glibc. + return None + + # Call gnu_get_libc_version, which returns a string like "2.5" + gnu_get_libc_version.restype = ctypes.c_char_p + version_str: str = gnu_get_libc_version() + # py2 / py3 compatibility: + if not isinstance(version_str, str): + version_str = version_str.decode("ascii") + + return version_str + + +def _glibc_version_string() -> Optional[str]: + """Returns glibc version string, or None if not using glibc.""" + return _glibc_version_string_confstr() or _glibc_version_string_ctypes() + + +def _parse_glibc_version(version_str: str) -> Tuple[int, int]: + """Parse glibc version. + + We use a regexp instead of str.split because we want to discard any + random junk that might come after the minor version -- this might happen + in patched/forked versions of glibc (e.g. Linaro's version of glibc + uses version strings like "2.20-2014.11"). See gh-3588. + """ + m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str) + if not m: + warnings.warn( + f"Expected glibc version with 2 components major.minor," + f" got: {version_str}", + RuntimeWarning, + ) + return -1, -1 + return int(m.group("major")), int(m.group("minor")) + + +@functools.lru_cache() +def _get_glibc_version() -> Tuple[int, int]: + version_str = _glibc_version_string() + if version_str is None: + return (-1, -1) + return _parse_glibc_version(version_str) + + +# From PEP 513, PEP 600 +def _is_compatible(arch: str, version: _GLibCVersion) -> bool: + sys_glibc = _get_glibc_version() + if sys_glibc < version: + return False + # Check for presence of _manylinux module. + try: + import _manylinux + except ImportError: + return True + if hasattr(_manylinux, "manylinux_compatible"): + result = _manylinux.manylinux_compatible(version[0], version[1], arch) + if result is not None: + return bool(result) + return True + if version == _GLibCVersion(2, 5): + if hasattr(_manylinux, "manylinux1_compatible"): + return bool(_manylinux.manylinux1_compatible) + if version == _GLibCVersion(2, 12): + if hasattr(_manylinux, "manylinux2010_compatible"): + return bool(_manylinux.manylinux2010_compatible) + if version == _GLibCVersion(2, 17): + if hasattr(_manylinux, "manylinux2014_compatible"): + return bool(_manylinux.manylinux2014_compatible) + return True + + +_LEGACY_MANYLINUX_MAP = { + # CentOS 7 w/ glibc 2.17 (PEP 599) + (2, 17): "manylinux2014", + # CentOS 6 w/ glibc 2.12 (PEP 571) + (2, 12): "manylinux2010", + # CentOS 5 w/ glibc 2.5 (PEP 513) + (2, 5): "manylinux1", +} + + +def platform_tags(archs: Sequence[str]) -> Iterator[str]: + """Generate manylinux tags compatible to the current platform. + + :param archs: Sequence of compatible architectures. + The first one shall be the closest to the actual architecture and be the part of + platform tag after the ``linux_`` prefix, e.g. ``x86_64``. + The ``linux_`` prefix is assumed as a prerequisite for the current platform to + be manylinux-compatible. + + :returns: An iterator of compatible manylinux tags. + """ + if not _have_compatible_abi(sys.executable, archs): + return + # Oldest glibc to be supported regardless of architecture is (2, 17). + too_old_glibc2 = _GLibCVersion(2, 16) + if set(archs) & {"x86_64", "i686"}: + # On x86/i686 also oldest glibc to be supported is (2, 5). + too_old_glibc2 = _GLibCVersion(2, 4) + current_glibc = _GLibCVersion(*_get_glibc_version()) + glibc_max_list = [current_glibc] + # We can assume compatibility across glibc major versions. + # https://sourceware.org/bugzilla/show_bug.cgi?id=24636 + # + # Build a list of maximum glibc versions so that we can + # output the canonical list of all glibc from current_glibc + # down to too_old_glibc2, including all intermediary versions. + for glibc_major in range(current_glibc.major - 1, 1, -1): + glibc_minor = _LAST_GLIBC_MINOR[glibc_major] + glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor)) + for arch in archs: + for glibc_max in glibc_max_list: + if glibc_max.major == too_old_glibc2.major: + min_minor = too_old_glibc2.minor + else: + # For other glibc major versions oldest supported is (x, 0). + min_minor = -1 + for glibc_minor in range(glibc_max.minor, min_minor, -1): + glibc_version = _GLibCVersion(glibc_max.major, glibc_minor) + tag = "manylinux_{}_{}".format(*glibc_version) + if _is_compatible(arch, glibc_version): + yield f"{tag}_{arch}" + # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags. + if glibc_version in _LEGACY_MANYLINUX_MAP: + legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version] + if _is_compatible(arch, glibc_version): + yield f"{legacy_tag}_{arch}" diff --git a/distutils/_vendor/packaging/_musllinux.py b/distutils/_vendor/packaging/_musllinux.py new file mode 100644 index 0000000000..86419df9d7 --- /dev/null +++ b/distutils/_vendor/packaging/_musllinux.py @@ -0,0 +1,83 @@ +"""PEP 656 support. + +This module implements logic to detect if the currently running Python is +linked against musl, and what musl version is used. +""" + +import functools +import re +import subprocess +import sys +from typing import Iterator, NamedTuple, Optional, Sequence + +from ._elffile import ELFFile + + +class _MuslVersion(NamedTuple): + major: int + minor: int + + +def _parse_musl_version(output: str) -> Optional[_MuslVersion]: + lines = [n for n in (n.strip() for n in output.splitlines()) if n] + if len(lines) < 2 or lines[0][:4] != "musl": + return None + m = re.match(r"Version (\d+)\.(\d+)", lines[1]) + if not m: + return None + return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2))) + + +@functools.lru_cache() +def _get_musl_version(executable: str) -> Optional[_MuslVersion]: + """Detect currently-running musl runtime version. + + This is done by checking the specified executable's dynamic linking + information, and invoking the loader to parse its output for a version + string. If the loader is musl, the output would be something like:: + + musl libc (x86_64) + Version 1.2.2 + Dynamic Program Loader + """ + try: + with open(executable, "rb") as f: + ld = ELFFile(f).interpreter + except (OSError, TypeError, ValueError): + return None + if ld is None or "musl" not in ld: + return None + proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True) + return _parse_musl_version(proc.stderr) + + +def platform_tags(archs: Sequence[str]) -> Iterator[str]: + """Generate musllinux tags compatible to the current platform. + + :param archs: Sequence of compatible architectures. + The first one shall be the closest to the actual architecture and be the part of + platform tag after the ``linux_`` prefix, e.g. ``x86_64``. + The ``linux_`` prefix is assumed as a prerequisite for the current platform to + be musllinux-compatible. + + :returns: An iterator of compatible musllinux tags. + """ + sys_musl = _get_musl_version(sys.executable) + if sys_musl is None: # Python not dynamically linked against musl. + return + for arch in archs: + for minor in range(sys_musl.minor, -1, -1): + yield f"musllinux_{sys_musl.major}_{minor}_{arch}" + + +if __name__ == "__main__": # pragma: no cover + import sysconfig + + plat = sysconfig.get_platform() + assert plat.startswith("linux-"), "not linux" + + print("plat:", plat) + print("musl:", _get_musl_version(sys.executable)) + print("tags:", end=" ") + for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])): + print(t, end="\n ") diff --git a/distutils/_vendor/packaging/_parser.py b/distutils/_vendor/packaging/_parser.py new file mode 100644 index 0000000000..684df75457 --- /dev/null +++ b/distutils/_vendor/packaging/_parser.py @@ -0,0 +1,356 @@ +"""Handwritten parser of dependency specifiers. + +The docstring for each __parse_* function contains ENBF-inspired grammar representing +the implementation. +""" + +import ast +from typing import Any, List, NamedTuple, Optional, Tuple, Union + +from ._tokenizer import DEFAULT_RULES, Tokenizer + + +class Node: + def __init__(self, value: str) -> None: + self.value = value + + def __str__(self) -> str: + return self.value + + def __repr__(self) -> str: + return f"<{self.__class__.__name__}('{self}')>" + + def serialize(self) -> str: + raise NotImplementedError + + +class Variable(Node): + def serialize(self) -> str: + return str(self) + + +class Value(Node): + def serialize(self) -> str: + return f'"{self}"' + + +class Op(Node): + def serialize(self) -> str: + return str(self) + + +MarkerVar = Union[Variable, Value] +MarkerItem = Tuple[MarkerVar, Op, MarkerVar] +# MarkerAtom = Union[MarkerItem, List["MarkerAtom"]] +# MarkerList = List[Union["MarkerList", MarkerAtom, str]] +# mypy does not support recursive type definition +# https://github.com/python/mypy/issues/731 +MarkerAtom = Any +MarkerList = List[Any] + + +class ParsedRequirement(NamedTuple): + name: str + url: str + extras: List[str] + specifier: str + marker: Optional[MarkerList] + + +# -------------------------------------------------------------------------------------- +# Recursive descent parser for dependency specifier +# -------------------------------------------------------------------------------------- +def parse_requirement(source: str) -> ParsedRequirement: + return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES)) + + +def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement: + """ + requirement = WS? IDENTIFIER WS? extras WS? requirement_details + """ + tokenizer.consume("WS") + + name_token = tokenizer.expect( + "IDENTIFIER", expected="package name at the start of dependency specifier" + ) + name = name_token.text + tokenizer.consume("WS") + + extras = _parse_extras(tokenizer) + tokenizer.consume("WS") + + url, specifier, marker = _parse_requirement_details(tokenizer) + tokenizer.expect("END", expected="end of dependency specifier") + + return ParsedRequirement(name, url, extras, specifier, marker) + + +def _parse_requirement_details( + tokenizer: Tokenizer, +) -> Tuple[str, str, Optional[MarkerList]]: + """ + requirement_details = AT URL (WS requirement_marker?)? + | specifier WS? (requirement_marker)? + """ + + specifier = "" + url = "" + marker = None + + if tokenizer.check("AT"): + tokenizer.read() + tokenizer.consume("WS") + + url_start = tokenizer.position + url = tokenizer.expect("URL", expected="URL after @").text + if tokenizer.check("END", peek=True): + return (url, specifier, marker) + + tokenizer.expect("WS", expected="whitespace after URL") + + # The input might end after whitespace. + if tokenizer.check("END", peek=True): + return (url, specifier, marker) + + marker = _parse_requirement_marker( + tokenizer, span_start=url_start, after="URL and whitespace" + ) + else: + specifier_start = tokenizer.position + specifier = _parse_specifier(tokenizer) + tokenizer.consume("WS") + + if tokenizer.check("END", peek=True): + return (url, specifier, marker) + + marker = _parse_requirement_marker( + tokenizer, + span_start=specifier_start, + after=( + "version specifier" + if specifier + else "name and no valid version specifier" + ), + ) + + return (url, specifier, marker) + + +def _parse_requirement_marker( + tokenizer: Tokenizer, *, span_start: int, after: str +) -> MarkerList: + """ + requirement_marker = SEMICOLON marker WS? + """ + + if not tokenizer.check("SEMICOLON"): + tokenizer.raise_syntax_error( + f"Expected end or semicolon (after {after})", + span_start=span_start, + ) + tokenizer.read() + + marker = _parse_marker(tokenizer) + tokenizer.consume("WS") + + return marker + + +def _parse_extras(tokenizer: Tokenizer) -> List[str]: + """ + extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)? + """ + if not tokenizer.check("LEFT_BRACKET", peek=True): + return [] + + with tokenizer.enclosing_tokens( + "LEFT_BRACKET", + "RIGHT_BRACKET", + around="extras", + ): + tokenizer.consume("WS") + extras = _parse_extras_list(tokenizer) + tokenizer.consume("WS") + + return extras + + +def _parse_extras_list(tokenizer: Tokenizer) -> List[str]: + """ + extras_list = identifier (wsp* ',' wsp* identifier)* + """ + extras: List[str] = [] + + if not tokenizer.check("IDENTIFIER"): + return extras + + extras.append(tokenizer.read().text) + + while True: + tokenizer.consume("WS") + if tokenizer.check("IDENTIFIER", peek=True): + tokenizer.raise_syntax_error("Expected comma between extra names") + elif not tokenizer.check("COMMA"): + break + + tokenizer.read() + tokenizer.consume("WS") + + extra_token = tokenizer.expect("IDENTIFIER", expected="extra name after comma") + extras.append(extra_token.text) + + return extras + + +def _parse_specifier(tokenizer: Tokenizer) -> str: + """ + specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS + | WS? version_many WS? + """ + with tokenizer.enclosing_tokens( + "LEFT_PARENTHESIS", + "RIGHT_PARENTHESIS", + around="version specifier", + ): + tokenizer.consume("WS") + parsed_specifiers = _parse_version_many(tokenizer) + tokenizer.consume("WS") + + return parsed_specifiers + + +def _parse_version_many(tokenizer: Tokenizer) -> str: + """ + version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)? + """ + parsed_specifiers = "" + while tokenizer.check("SPECIFIER"): + span_start = tokenizer.position + parsed_specifiers += tokenizer.read().text + if tokenizer.check("VERSION_PREFIX_TRAIL", peek=True): + tokenizer.raise_syntax_error( + ".* suffix can only be used with `==` or `!=` operators", + span_start=span_start, + span_end=tokenizer.position + 1, + ) + if tokenizer.check("VERSION_LOCAL_LABEL_TRAIL", peek=True): + tokenizer.raise_syntax_error( + "Local version label can only be used with `==` or `!=` operators", + span_start=span_start, + span_end=tokenizer.position, + ) + tokenizer.consume("WS") + if not tokenizer.check("COMMA"): + break + parsed_specifiers += tokenizer.read().text + tokenizer.consume("WS") + + return parsed_specifiers + + +# -------------------------------------------------------------------------------------- +# Recursive descent parser for marker expression +# -------------------------------------------------------------------------------------- +def parse_marker(source: str) -> MarkerList: + return _parse_full_marker(Tokenizer(source, rules=DEFAULT_RULES)) + + +def _parse_full_marker(tokenizer: Tokenizer) -> MarkerList: + retval = _parse_marker(tokenizer) + tokenizer.expect("END", expected="end of marker expression") + return retval + + +def _parse_marker(tokenizer: Tokenizer) -> MarkerList: + """ + marker = marker_atom (BOOLOP marker_atom)+ + """ + expression = [_parse_marker_atom(tokenizer)] + while tokenizer.check("BOOLOP"): + token = tokenizer.read() + expr_right = _parse_marker_atom(tokenizer) + expression.extend((token.text, expr_right)) + return expression + + +def _parse_marker_atom(tokenizer: Tokenizer) -> MarkerAtom: + """ + marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS? + | WS? marker_item WS? + """ + + tokenizer.consume("WS") + if tokenizer.check("LEFT_PARENTHESIS", peek=True): + with tokenizer.enclosing_tokens( + "LEFT_PARENTHESIS", + "RIGHT_PARENTHESIS", + around="marker expression", + ): + tokenizer.consume("WS") + marker: MarkerAtom = _parse_marker(tokenizer) + tokenizer.consume("WS") + else: + marker = _parse_marker_item(tokenizer) + tokenizer.consume("WS") + return marker + + +def _parse_marker_item(tokenizer: Tokenizer) -> MarkerItem: + """ + marker_item = WS? marker_var WS? marker_op WS? marker_var WS? + """ + tokenizer.consume("WS") + marker_var_left = _parse_marker_var(tokenizer) + tokenizer.consume("WS") + marker_op = _parse_marker_op(tokenizer) + tokenizer.consume("WS") + marker_var_right = _parse_marker_var(tokenizer) + tokenizer.consume("WS") + return (marker_var_left, marker_op, marker_var_right) + + +def _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar: + """ + marker_var = VARIABLE | QUOTED_STRING + """ + if tokenizer.check("VARIABLE"): + return process_env_var(tokenizer.read().text.replace(".", "_")) + elif tokenizer.check("QUOTED_STRING"): + return process_python_str(tokenizer.read().text) + else: + tokenizer.raise_syntax_error( + message="Expected a marker variable or quoted string" + ) + + +def process_env_var(env_var: str) -> Variable: + if env_var in ("platform_python_implementation", "python_implementation"): + return Variable("platform_python_implementation") + else: + return Variable(env_var) + + +def process_python_str(python_str: str) -> Value: + value = ast.literal_eval(python_str) + return Value(str(value)) + + +def _parse_marker_op(tokenizer: Tokenizer) -> Op: + """ + marker_op = IN | NOT IN | OP + """ + if tokenizer.check("IN"): + tokenizer.read() + return Op("in") + elif tokenizer.check("NOT"): + tokenizer.read() + tokenizer.expect("WS", expected="whitespace after 'not'") + tokenizer.expect("IN", expected="'in' after 'not'") + return Op("not in") + elif tokenizer.check("OP"): + return Op(tokenizer.read().text) + else: + return tokenizer.raise_syntax_error( + "Expected marker operator, one of " + "<=, <, !=, ==, >=, >, ~=, ===, in, not in" + ) diff --git a/distutils/_vendor/packaging/_structures.py b/distutils/_vendor/packaging/_structures.py new file mode 100644 index 0000000000..90a6465f96 --- /dev/null +++ b/distutils/_vendor/packaging/_structures.py @@ -0,0 +1,61 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + + +class InfinityType: + def __repr__(self) -> str: + return "Infinity" + + def __hash__(self) -> int: + return hash(repr(self)) + + def __lt__(self, other: object) -> bool: + return False + + def __le__(self, other: object) -> bool: + return False + + def __eq__(self, other: object) -> bool: + return isinstance(other, self.__class__) + + def __gt__(self, other: object) -> bool: + return True + + def __ge__(self, other: object) -> bool: + return True + + def __neg__(self: object) -> "NegativeInfinityType": + return NegativeInfinity + + +Infinity = InfinityType() + + +class NegativeInfinityType: + def __repr__(self) -> str: + return "-Infinity" + + def __hash__(self) -> int: + return hash(repr(self)) + + def __lt__(self, other: object) -> bool: + return True + + def __le__(self, other: object) -> bool: + return True + + def __eq__(self, other: object) -> bool: + return isinstance(other, self.__class__) + + def __gt__(self, other: object) -> bool: + return False + + def __ge__(self, other: object) -> bool: + return False + + def __neg__(self: object) -> InfinityType: + return Infinity + + +NegativeInfinity = NegativeInfinityType() diff --git a/distutils/_vendor/packaging/_tokenizer.py b/distutils/_vendor/packaging/_tokenizer.py new file mode 100644 index 0000000000..dd0d648d49 --- /dev/null +++ b/distutils/_vendor/packaging/_tokenizer.py @@ -0,0 +1,192 @@ +import contextlib +import re +from dataclasses import dataclass +from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union + +from .specifiers import Specifier + + +@dataclass +class Token: + name: str + text: str + position: int + + +class ParserSyntaxError(Exception): + """The provided source text could not be parsed correctly.""" + + def __init__( + self, + message: str, + *, + source: str, + span: Tuple[int, int], + ) -> None: + self.span = span + self.message = message + self.source = source + + super().__init__() + + def __str__(self) -> str: + marker = " " * self.span[0] + "~" * (self.span[1] - self.span[0]) + "^" + return "\n ".join([self.message, self.source, marker]) + + +DEFAULT_RULES: "Dict[str, Union[str, re.Pattern[str]]]" = { + "LEFT_PARENTHESIS": r"\(", + "RIGHT_PARENTHESIS": r"\)", + "LEFT_BRACKET": r"\[", + "RIGHT_BRACKET": r"\]", + "SEMICOLON": r";", + "COMMA": r",", + "QUOTED_STRING": re.compile( + r""" + ( + ('[^']*') + | + ("[^"]*") + ) + """, + re.VERBOSE, + ), + "OP": r"(===|==|~=|!=|<=|>=|<|>)", + "BOOLOP": r"\b(or|and)\b", + "IN": r"\bin\b", + "NOT": r"\bnot\b", + "VARIABLE": re.compile( + r""" + \b( + python_version + |python_full_version + |os[._]name + |sys[._]platform + |platform_(release|system) + |platform[._](version|machine|python_implementation) + |python_implementation + |implementation_(name|version) + |extra + )\b + """, + re.VERBOSE, + ), + "SPECIFIER": re.compile( + Specifier._operator_regex_str + Specifier._version_regex_str, + re.VERBOSE | re.IGNORECASE, + ), + "AT": r"\@", + "URL": r"[^ \t]+", + "IDENTIFIER": r"\b[a-zA-Z0-9][a-zA-Z0-9._-]*\b", + "VERSION_PREFIX_TRAIL": r"\.\*", + "VERSION_LOCAL_LABEL_TRAIL": r"\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*", + "WS": r"[ \t]+", + "END": r"$", +} + + +class Tokenizer: + """Context-sensitive token parsing. + + Provides methods to examine the input stream to check whether the next token + matches. + """ + + def __init__( + self, + source: str, + *, + rules: "Dict[str, Union[str, re.Pattern[str]]]", + ) -> None: + self.source = source + self.rules: Dict[str, re.Pattern[str]] = { + name: re.compile(pattern) for name, pattern in rules.items() + } + self.next_token: Optional[Token] = None + self.position = 0 + + def consume(self, name: str) -> None: + """Move beyond provided token name, if at current position.""" + if self.check(name): + self.read() + + def check(self, name: str, *, peek: bool = False) -> bool: + """Check whether the next token has the provided name. + + By default, if the check succeeds, the token *must* be read before + another check. If `peek` is set to `True`, the token is not loaded and + would need to be checked again. + """ + assert ( + self.next_token is None + ), f"Cannot check for {name!r}, already have {self.next_token!r}" + assert name in self.rules, f"Unknown token name: {name!r}" + + expression = self.rules[name] + + match = expression.match(self.source, self.position) + if match is None: + return False + if not peek: + self.next_token = Token(name, match[0], self.position) + return True + + def expect(self, name: str, *, expected: str) -> Token: + """Expect a certain token name next, failing with a syntax error otherwise. + + The token is *not* read. + """ + if not self.check(name): + raise self.raise_syntax_error(f"Expected {expected}") + return self.read() + + def read(self) -> Token: + """Consume the next token and return it.""" + token = self.next_token + assert token is not None + + self.position += len(token.text) + self.next_token = None + + return token + + def raise_syntax_error( + self, + message: str, + *, + span_start: Optional[int] = None, + span_end: Optional[int] = None, + ) -> NoReturn: + """Raise ParserSyntaxError at the given position.""" + span = ( + self.position if span_start is None else span_start, + self.position if span_end is None else span_end, + ) + raise ParserSyntaxError( + message, + source=self.source, + span=span, + ) + + @contextlib.contextmanager + def enclosing_tokens( + self, open_token: str, close_token: str, *, around: str + ) -> Iterator[None]: + if self.check(open_token): + open_position = self.position + self.read() + else: + open_position = None + + yield + + if open_position is None: + return + + if not self.check(close_token): + self.raise_syntax_error( + f"Expected matching {close_token} for {open_token}, after {around}", + span_start=open_position, + ) + + self.read() diff --git a/distutils/_vendor/packaging/markers.py b/distutils/_vendor/packaging/markers.py new file mode 100644 index 0000000000..8b98fca723 --- /dev/null +++ b/distutils/_vendor/packaging/markers.py @@ -0,0 +1,252 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import operator +import os +import platform +import sys +from typing import Any, Callable, Dict, List, Optional, Tuple, Union + +from ._parser import ( + MarkerAtom, + MarkerList, + Op, + Value, + Variable, + parse_marker as _parse_marker, +) +from ._tokenizer import ParserSyntaxError +from .specifiers import InvalidSpecifier, Specifier +from .utils import canonicalize_name + +__all__ = [ + "InvalidMarker", + "UndefinedComparison", + "UndefinedEnvironmentName", + "Marker", + "default_environment", +] + +Operator = Callable[[str, str], bool] + + +class InvalidMarker(ValueError): + """ + An invalid marker was found, users should refer to PEP 508. + """ + + +class UndefinedComparison(ValueError): + """ + An invalid operation was attempted on a value that doesn't support it. + """ + + +class UndefinedEnvironmentName(ValueError): + """ + A name was attempted to be used that does not exist inside of the + environment. + """ + + +def _normalize_extra_values(results: Any) -> Any: + """ + Normalize extra values. + """ + if isinstance(results[0], tuple): + lhs, op, rhs = results[0] + if isinstance(lhs, Variable) and lhs.value == "extra": + normalized_extra = canonicalize_name(rhs.value) + rhs = Value(normalized_extra) + elif isinstance(rhs, Variable) and rhs.value == "extra": + normalized_extra = canonicalize_name(lhs.value) + lhs = Value(normalized_extra) + results[0] = lhs, op, rhs + return results + + +def _format_marker( + marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True +) -> str: + + assert isinstance(marker, (list, tuple, str)) + + # Sometimes we have a structure like [[...]] which is a single item list + # where the single item is itself it's own list. In that case we want skip + # the rest of this function so that we don't get extraneous () on the + # outside. + if ( + isinstance(marker, list) + and len(marker) == 1 + and isinstance(marker[0], (list, tuple)) + ): + return _format_marker(marker[0]) + + if isinstance(marker, list): + inner = (_format_marker(m, first=False) for m in marker) + if first: + return " ".join(inner) + else: + return "(" + " ".join(inner) + ")" + elif isinstance(marker, tuple): + return " ".join([m.serialize() for m in marker]) + else: + return marker + + +_operators: Dict[str, Operator] = { + "in": lambda lhs, rhs: lhs in rhs, + "not in": lambda lhs, rhs: lhs not in rhs, + "<": operator.lt, + "<=": operator.le, + "==": operator.eq, + "!=": operator.ne, + ">=": operator.ge, + ">": operator.gt, +} + + +def _eval_op(lhs: str, op: Op, rhs: str) -> bool: + try: + spec = Specifier("".join([op.serialize(), rhs])) + except InvalidSpecifier: + pass + else: + return spec.contains(lhs, prereleases=True) + + oper: Optional[Operator] = _operators.get(op.serialize()) + if oper is None: + raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.") + + return oper(lhs, rhs) + + +def _normalize(*values: str, key: str) -> Tuple[str, ...]: + # PEP 685 – Comparison of extra names for optional distribution dependencies + # https://peps.python.org/pep-0685/ + # > When comparing extra names, tools MUST normalize the names being + # > compared using the semantics outlined in PEP 503 for names + if key == "extra": + return tuple(canonicalize_name(v) for v in values) + + # other environment markers don't have such standards + return values + + +def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool: + groups: List[List[bool]] = [[]] + + for marker in markers: + assert isinstance(marker, (list, tuple, str)) + + if isinstance(marker, list): + groups[-1].append(_evaluate_markers(marker, environment)) + elif isinstance(marker, tuple): + lhs, op, rhs = marker + + if isinstance(lhs, Variable): + environment_key = lhs.value + lhs_value = environment[environment_key] + rhs_value = rhs.value + else: + lhs_value = lhs.value + environment_key = rhs.value + rhs_value = environment[environment_key] + + lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key) + groups[-1].append(_eval_op(lhs_value, op, rhs_value)) + else: + assert marker in ["and", "or"] + if marker == "or": + groups.append([]) + + return any(all(item) for item in groups) + + +def format_full_version(info: "sys._version_info") -> str: + version = "{0.major}.{0.minor}.{0.micro}".format(info) + kind = info.releaselevel + if kind != "final": + version += kind[0] + str(info.serial) + return version + + +def default_environment() -> Dict[str, str]: + iver = format_full_version(sys.implementation.version) + implementation_name = sys.implementation.name + return { + "implementation_name": implementation_name, + "implementation_version": iver, + "os_name": os.name, + "platform_machine": platform.machine(), + "platform_release": platform.release(), + "platform_system": platform.system(), + "platform_version": platform.version(), + "python_full_version": platform.python_version(), + "platform_python_implementation": platform.python_implementation(), + "python_version": ".".join(platform.python_version_tuple()[:2]), + "sys_platform": sys.platform, + } + + +class Marker: + def __init__(self, marker: str) -> None: + # Note: We create a Marker object without calling this constructor in + # packaging.requirements.Requirement. If any additional logic is + # added here, make sure to mirror/adapt Requirement. + try: + self._markers = _normalize_extra_values(_parse_marker(marker)) + # The attribute `_markers` can be described in terms of a recursive type: + # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]] + # + # For example, the following expression: + # python_version > "3.6" or (python_version == "3.6" and os_name == "unix") + # + # is parsed into: + # [ + # (, ')>, ), + # 'and', + # [ + # (, , ), + # 'or', + # (, , ) + # ] + # ] + except ParserSyntaxError as e: + raise InvalidMarker(str(e)) from e + + def __str__(self) -> str: + return _format_marker(self._markers) + + def __repr__(self) -> str: + return f"" + + def __hash__(self) -> int: + return hash((self.__class__.__name__, str(self))) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, Marker): + return NotImplemented + + return str(self) == str(other) + + def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool: + """Evaluate a marker. + + Return the boolean from evaluating the given marker against the + environment. environment is an optional argument to override all or + part of the determined environment. + + The environment is determined from the current Python process. + """ + current_environment = default_environment() + current_environment["extra"] = "" + if environment is not None: + current_environment.update(environment) + # The API used to allow setting extra to None. We need to handle this + # case for backwards compatibility. + if current_environment["extra"] is None: + current_environment["extra"] = "" + + return _evaluate_markers(self._markers, current_environment) diff --git a/distutils/_vendor/packaging/metadata.py b/distutils/_vendor/packaging/metadata.py new file mode 100644 index 0000000000..fb27493079 --- /dev/null +++ b/distutils/_vendor/packaging/metadata.py @@ -0,0 +1,825 @@ +import email.feedparser +import email.header +import email.message +import email.parser +import email.policy +import sys +import typing +from typing import ( + Any, + Callable, + Dict, + Generic, + List, + Optional, + Tuple, + Type, + Union, + cast, +) + +from . import requirements, specifiers, utils, version as version_module + +T = typing.TypeVar("T") +if sys.version_info[:2] >= (3, 8): # pragma: no cover + from typing import Literal, TypedDict +else: # pragma: no cover + if typing.TYPE_CHECKING: + from typing_extensions import Literal, TypedDict + else: + try: + from typing_extensions import Literal, TypedDict + except ImportError: + + class Literal: + def __init_subclass__(*_args, **_kwargs): + pass + + class TypedDict: + def __init_subclass__(*_args, **_kwargs): + pass + + +try: + ExceptionGroup +except NameError: # pragma: no cover + + class ExceptionGroup(Exception): # noqa: N818 + """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11. + + If :external:exc:`ExceptionGroup` is already defined by Python itself, + that version is used instead. + """ + + message: str + exceptions: List[Exception] + + def __init__(self, message: str, exceptions: List[Exception]) -> None: + self.message = message + self.exceptions = exceptions + + def __repr__(self) -> str: + return f"{self.__class__.__name__}({self.message!r}, {self.exceptions!r})" + +else: # pragma: no cover + ExceptionGroup = ExceptionGroup + + +class InvalidMetadata(ValueError): + """A metadata field contains invalid data.""" + + field: str + """The name of the field that contains invalid data.""" + + def __init__(self, field: str, message: str) -> None: + self.field = field + super().__init__(message) + + +# The RawMetadata class attempts to make as few assumptions about the underlying +# serialization formats as possible. The idea is that as long as a serialization +# formats offer some very basic primitives in *some* way then we can support +# serializing to and from that format. +class RawMetadata(TypedDict, total=False): + """A dictionary of raw core metadata. + + Each field in core metadata maps to a key of this dictionary (when data is + provided). The key is lower-case and underscores are used instead of dashes + compared to the equivalent core metadata field. Any core metadata field that + can be specified multiple times or can hold multiple values in a single + field have a key with a plural name. See :class:`Metadata` whose attributes + match the keys of this dictionary. + + Core metadata fields that can be specified multiple times are stored as a + list or dict depending on which is appropriate for the field. Any fields + which hold multiple values in a single field are stored as a list. + + """ + + # Metadata 1.0 - PEP 241 + metadata_version: str + name: str + version: str + platforms: List[str] + summary: str + description: str + keywords: List[str] + home_page: str + author: str + author_email: str + license: str + + # Metadata 1.1 - PEP 314 + supported_platforms: List[str] + download_url: str + classifiers: List[str] + requires: List[str] + provides: List[str] + obsoletes: List[str] + + # Metadata 1.2 - PEP 345 + maintainer: str + maintainer_email: str + requires_dist: List[str] + provides_dist: List[str] + obsoletes_dist: List[str] + requires_python: str + requires_external: List[str] + project_urls: Dict[str, str] + + # Metadata 2.0 + # PEP 426 attempted to completely revamp the metadata format + # but got stuck without ever being able to build consensus on + # it and ultimately ended up withdrawn. + # + # However, a number of tools had started emitting METADATA with + # `2.0` Metadata-Version, so for historical reasons, this version + # was skipped. + + # Metadata 2.1 - PEP 566 + description_content_type: str + provides_extra: List[str] + + # Metadata 2.2 - PEP 643 + dynamic: List[str] + + # Metadata 2.3 - PEP 685 + # No new fields were added in PEP 685, just some edge case were + # tightened up to provide better interoptability. + + +_STRING_FIELDS = { + "author", + "author_email", + "description", + "description_content_type", + "download_url", + "home_page", + "license", + "maintainer", + "maintainer_email", + "metadata_version", + "name", + "requires_python", + "summary", + "version", +} + +_LIST_FIELDS = { + "classifiers", + "dynamic", + "obsoletes", + "obsoletes_dist", + "platforms", + "provides", + "provides_dist", + "provides_extra", + "requires", + "requires_dist", + "requires_external", + "supported_platforms", +} + +_DICT_FIELDS = { + "project_urls", +} + + +def _parse_keywords(data: str) -> List[str]: + """Split a string of comma-separate keyboards into a list of keywords.""" + return [k.strip() for k in data.split(",")] + + +def _parse_project_urls(data: List[str]) -> Dict[str, str]: + """Parse a list of label/URL string pairings separated by a comma.""" + urls = {} + for pair in data: + # Our logic is slightly tricky here as we want to try and do + # *something* reasonable with malformed data. + # + # The main thing that we have to worry about, is data that does + # not have a ',' at all to split the label from the Value. There + # isn't a singular right answer here, and we will fail validation + # later on (if the caller is validating) so it doesn't *really* + # matter, but since the missing value has to be an empty str + # and our return value is dict[str, str], if we let the key + # be the missing value, then they'd have multiple '' values that + # overwrite each other in a accumulating dict. + # + # The other potentional issue is that it's possible to have the + # same label multiple times in the metadata, with no solid "right" + # answer with what to do in that case. As such, we'll do the only + # thing we can, which is treat the field as unparseable and add it + # to our list of unparsed fields. + parts = [p.strip() for p in pair.split(",", 1)] + parts.extend([""] * (max(0, 2 - len(parts)))) # Ensure 2 items + + # TODO: The spec doesn't say anything about if the keys should be + # considered case sensitive or not... logically they should + # be case-preserving and case-insensitive, but doing that + # would open up more cases where we might have duplicate + # entries. + label, url = parts + if label in urls: + # The label already exists in our set of urls, so this field + # is unparseable, and we can just add the whole thing to our + # unparseable data and stop processing it. + raise KeyError("duplicate labels in project urls") + urls[label] = url + + return urls + + +def _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str: + """Get the body of the message.""" + # If our source is a str, then our caller has managed encodings for us, + # and we don't need to deal with it. + if isinstance(source, str): + payload: str = msg.get_payload() + return payload + # If our source is a bytes, then we're managing the encoding and we need + # to deal with it. + else: + bpayload: bytes = msg.get_payload(decode=True) + try: + return bpayload.decode("utf8", "strict") + except UnicodeDecodeError: + raise ValueError("payload in an invalid encoding") + + +# The various parse_FORMAT functions here are intended to be as lenient as +# possible in their parsing, while still returning a correctly typed +# RawMetadata. +# +# To aid in this, we also generally want to do as little touching of the +# data as possible, except where there are possibly some historic holdovers +# that make valid data awkward to work with. +# +# While this is a lower level, intermediate format than our ``Metadata`` +# class, some light touch ups can make a massive difference in usability. + +# Map METADATA fields to RawMetadata. +_EMAIL_TO_RAW_MAPPING = { + "author": "author", + "author-email": "author_email", + "classifier": "classifiers", + "description": "description", + "description-content-type": "description_content_type", + "download-url": "download_url", + "dynamic": "dynamic", + "home-page": "home_page", + "keywords": "keywords", + "license": "license", + "maintainer": "maintainer", + "maintainer-email": "maintainer_email", + "metadata-version": "metadata_version", + "name": "name", + "obsoletes": "obsoletes", + "obsoletes-dist": "obsoletes_dist", + "platform": "platforms", + "project-url": "project_urls", + "provides": "provides", + "provides-dist": "provides_dist", + "provides-extra": "provides_extra", + "requires": "requires", + "requires-dist": "requires_dist", + "requires-external": "requires_external", + "requires-python": "requires_python", + "summary": "summary", + "supported-platform": "supported_platforms", + "version": "version", +} +_RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()} + + +def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[str]]]: + """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``). + + This function returns a two-item tuple of dicts. The first dict is of + recognized fields from the core metadata specification. Fields that can be + parsed and translated into Python's built-in types are converted + appropriately. All other fields are left as-is. Fields that are allowed to + appear multiple times are stored as lists. + + The second dict contains all other fields from the metadata. This includes + any unrecognized fields. It also includes any fields which are expected to + be parsed into a built-in type but were not formatted appropriately. Finally, + any fields that are expected to appear only once but are repeated are + included in this dict. + + """ + raw: Dict[str, Union[str, List[str], Dict[str, str]]] = {} + unparsed: Dict[str, List[str]] = {} + + if isinstance(data, str): + parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data) + else: + parsed = email.parser.BytesParser(policy=email.policy.compat32).parsebytes(data) + + # We have to wrap parsed.keys() in a set, because in the case of multiple + # values for a key (a list), the key will appear multiple times in the + # list of keys, but we're avoiding that by using get_all(). + for name in frozenset(parsed.keys()): + # Header names in RFC are case insensitive, so we'll normalize to all + # lower case to make comparisons easier. + name = name.lower() + + # We use get_all() here, even for fields that aren't multiple use, + # because otherwise someone could have e.g. two Name fields, and we + # would just silently ignore it rather than doing something about it. + headers = parsed.get_all(name) or [] + + # The way the email module works when parsing bytes is that it + # unconditionally decodes the bytes as ascii using the surrogateescape + # handler. When you pull that data back out (such as with get_all() ), + # it looks to see if the str has any surrogate escapes, and if it does + # it wraps it in a Header object instead of returning the string. + # + # As such, we'll look for those Header objects, and fix up the encoding. + value = [] + # Flag if we have run into any issues processing the headers, thus + # signalling that the data belongs in 'unparsed'. + valid_encoding = True + for h in headers: + # It's unclear if this can return more types than just a Header or + # a str, so we'll just assert here to make sure. + assert isinstance(h, (email.header.Header, str)) + + # If it's a header object, we need to do our little dance to get + # the real data out of it. In cases where there is invalid data + # we're going to end up with mojibake, but there's no obvious, good + # way around that without reimplementing parts of the Header object + # ourselves. + # + # That should be fine since, if mojibacked happens, this key is + # going into the unparsed dict anyways. + if isinstance(h, email.header.Header): + # The Header object stores it's data as chunks, and each chunk + # can be independently encoded, so we'll need to check each + # of them. + chunks: List[Tuple[bytes, Optional[str]]] = [] + for bin, encoding in email.header.decode_header(h): + try: + bin.decode("utf8", "strict") + except UnicodeDecodeError: + # Enable mojibake. + encoding = "latin1" + valid_encoding = False + else: + encoding = "utf8" + chunks.append((bin, encoding)) + + # Turn our chunks back into a Header object, then let that + # Header object do the right thing to turn them into a + # string for us. + value.append(str(email.header.make_header(chunks))) + # This is already a string, so just add it. + else: + value.append(h) + + # We've processed all of our values to get them into a list of str, + # but we may have mojibake data, in which case this is an unparsed + # field. + if not valid_encoding: + unparsed[name] = value + continue + + raw_name = _EMAIL_TO_RAW_MAPPING.get(name) + if raw_name is None: + # This is a bit of a weird situation, we've encountered a key that + # we don't know what it means, so we don't know whether it's meant + # to be a list or not. + # + # Since we can't really tell one way or another, we'll just leave it + # as a list, even though it may be a single item list, because that's + # what makes the most sense for email headers. + unparsed[name] = value + continue + + # If this is one of our string fields, then we'll check to see if our + # value is a list of a single item. If it is then we'll assume that + # it was emitted as a single string, and unwrap the str from inside + # the list. + # + # If it's any other kind of data, then we haven't the faintest clue + # what we should parse it as, and we have to just add it to our list + # of unparsed stuff. + if raw_name in _STRING_FIELDS and len(value) == 1: + raw[raw_name] = value[0] + # If this is one of our list of string fields, then we can just assign + # the value, since email *only* has strings, and our get_all() call + # above ensures that this is a list. + elif raw_name in _LIST_FIELDS: + raw[raw_name] = value + # Special Case: Keywords + # The keywords field is implemented in the metadata spec as a str, + # but it conceptually is a list of strings, and is serialized using + # ", ".join(keywords), so we'll do some light data massaging to turn + # this into what it logically is. + elif raw_name == "keywords" and len(value) == 1: + raw[raw_name] = _parse_keywords(value[0]) + # Special Case: Project-URL + # The project urls is implemented in the metadata spec as a list of + # specially-formatted strings that represent a key and a value, which + # is fundamentally a mapping, however the email format doesn't support + # mappings in a sane way, so it was crammed into a list of strings + # instead. + # + # We will do a little light data massaging to turn this into a map as + # it logically should be. + elif raw_name == "project_urls": + try: + raw[raw_name] = _parse_project_urls(value) + except KeyError: + unparsed[name] = value + # Nothing that we've done has managed to parse this, so it'll just + # throw it in our unparseable data and move on. + else: + unparsed[name] = value + + # We need to support getting the Description from the message payload in + # addition to getting it from the the headers. This does mean, though, there + # is the possibility of it being set both ways, in which case we put both + # in 'unparsed' since we don't know which is right. + try: + payload = _get_payload(parsed, data) + except ValueError: + unparsed.setdefault("description", []).append( + parsed.get_payload(decode=isinstance(data, bytes)) + ) + else: + if payload: + # Check to see if we've already got a description, if so then both + # it, and this body move to unparseable. + if "description" in raw: + description_header = cast(str, raw.pop("description")) + unparsed.setdefault("description", []).extend( + [description_header, payload] + ) + elif "description" in unparsed: + unparsed["description"].append(payload) + else: + raw["description"] = payload + + # We need to cast our `raw` to a metadata, because a TypedDict only support + # literal key names, but we're computing our key names on purpose, but the + # way this function is implemented, our `TypedDict` can only have valid key + # names. + return cast(RawMetadata, raw), unparsed + + +_NOT_FOUND = object() + + +# Keep the two values in sync. +_VALID_METADATA_VERSIONS = ["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] +_MetadataVersion = Literal["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] + +_REQUIRED_ATTRS = frozenset(["metadata_version", "name", "version"]) + + +class _Validator(Generic[T]): + """Validate a metadata field. + + All _process_*() methods correspond to a core metadata field. The method is + called with the field's raw value. If the raw value is valid it is returned + in its "enriched" form (e.g. ``version.Version`` for the ``Version`` field). + If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause + as appropriate). + """ + + name: str + raw_name: str + added: _MetadataVersion + + def __init__( + self, + *, + added: _MetadataVersion = "1.0", + ) -> None: + self.added = added + + def __set_name__(self, _owner: "Metadata", name: str) -> None: + self.name = name + self.raw_name = _RAW_TO_EMAIL_MAPPING[name] + + def __get__(self, instance: "Metadata", _owner: Type["Metadata"]) -> T: + # With Python 3.8, the caching can be replaced with functools.cached_property(). + # No need to check the cache as attribute lookup will resolve into the + # instance's __dict__ before __get__ is called. + cache = instance.__dict__ + value = instance._raw.get(self.name) + + # To make the _process_* methods easier, we'll check if the value is None + # and if this field is NOT a required attribute, and if both of those + # things are true, we'll skip the the converter. This will mean that the + # converters never have to deal with the None union. + if self.name in _REQUIRED_ATTRS or value is not None: + try: + converter: Callable[[Any], T] = getattr(self, f"_process_{self.name}") + except AttributeError: + pass + else: + value = converter(value) + + cache[self.name] = value + try: + del instance._raw[self.name] # type: ignore[misc] + except KeyError: + pass + + return cast(T, value) + + def _invalid_metadata( + self, msg: str, cause: Optional[Exception] = None + ) -> InvalidMetadata: + exc = InvalidMetadata( + self.raw_name, msg.format_map({"field": repr(self.raw_name)}) + ) + exc.__cause__ = cause + return exc + + def _process_metadata_version(self, value: str) -> _MetadataVersion: + # Implicitly makes Metadata-Version required. + if value not in _VALID_METADATA_VERSIONS: + raise self._invalid_metadata(f"{value!r} is not a valid metadata version") + return cast(_MetadataVersion, value) + + def _process_name(self, value: str) -> str: + if not value: + raise self._invalid_metadata("{field} is a required field") + # Validate the name as a side-effect. + try: + utils.canonicalize_name(value, validate=True) + except utils.InvalidName as exc: + raise self._invalid_metadata( + f"{value!r} is invalid for {{field}}", cause=exc + ) + else: + return value + + def _process_version(self, value: str) -> version_module.Version: + if not value: + raise self._invalid_metadata("{field} is a required field") + try: + return version_module.parse(value) + except version_module.InvalidVersion as exc: + raise self._invalid_metadata( + f"{value!r} is invalid for {{field}}", cause=exc + ) + + def _process_summary(self, value: str) -> str: + """Check the field contains no newlines.""" + if "\n" in value: + raise self._invalid_metadata("{field} must be a single line") + return value + + def _process_description_content_type(self, value: str) -> str: + content_types = {"text/plain", "text/x-rst", "text/markdown"} + message = email.message.EmailMessage() + message["content-type"] = value + + content_type, parameters = ( + # Defaults to `text/plain` if parsing failed. + message.get_content_type().lower(), + message["content-type"].params, + ) + # Check if content-type is valid or defaulted to `text/plain` and thus was + # not parseable. + if content_type not in content_types or content_type not in value.lower(): + raise self._invalid_metadata( + f"{{field}} must be one of {list(content_types)}, not {value!r}" + ) + + charset = parameters.get("charset", "UTF-8") + if charset != "UTF-8": + raise self._invalid_metadata( + f"{{field}} can only specify the UTF-8 charset, not {list(charset)}" + ) + + markdown_variants = {"GFM", "CommonMark"} + variant = parameters.get("variant", "GFM") # Use an acceptable default. + if content_type == "text/markdown" and variant not in markdown_variants: + raise self._invalid_metadata( + f"valid Markdown variants for {{field}} are {list(markdown_variants)}, " + f"not {variant!r}", + ) + return value + + def _process_dynamic(self, value: List[str]) -> List[str]: + for dynamic_field in map(str.lower, value): + if dynamic_field in {"name", "version", "metadata-version"}: + raise self._invalid_metadata( + f"{value!r} is not allowed as a dynamic field" + ) + elif dynamic_field not in _EMAIL_TO_RAW_MAPPING: + raise self._invalid_metadata(f"{value!r} is not a valid dynamic field") + return list(map(str.lower, value)) + + def _process_provides_extra( + self, + value: List[str], + ) -> List[utils.NormalizedName]: + normalized_names = [] + try: + for name in value: + normalized_names.append(utils.canonicalize_name(name, validate=True)) + except utils.InvalidName as exc: + raise self._invalid_metadata( + f"{name!r} is invalid for {{field}}", cause=exc + ) + else: + return normalized_names + + def _process_requires_python(self, value: str) -> specifiers.SpecifierSet: + try: + return specifiers.SpecifierSet(value) + except specifiers.InvalidSpecifier as exc: + raise self._invalid_metadata( + f"{value!r} is invalid for {{field}}", cause=exc + ) + + def _process_requires_dist( + self, + value: List[str], + ) -> List[requirements.Requirement]: + reqs = [] + try: + for req in value: + reqs.append(requirements.Requirement(req)) + except requirements.InvalidRequirement as exc: + raise self._invalid_metadata(f"{req!r} is invalid for {{field}}", cause=exc) + else: + return reqs + + +class Metadata: + """Representation of distribution metadata. + + Compared to :class:`RawMetadata`, this class provides objects representing + metadata fields instead of only using built-in types. Any invalid metadata + will cause :exc:`InvalidMetadata` to be raised (with a + :py:attr:`~BaseException.__cause__` attribute as appropriate). + """ + + _raw: RawMetadata + + @classmethod + def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata": + """Create an instance from :class:`RawMetadata`. + + If *validate* is true, all metadata will be validated. All exceptions + related to validation will be gathered and raised as an :class:`ExceptionGroup`. + """ + ins = cls() + ins._raw = data.copy() # Mutations occur due to caching enriched values. + + if validate: + exceptions: List[Exception] = [] + try: + metadata_version = ins.metadata_version + metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version) + except InvalidMetadata as metadata_version_exc: + exceptions.append(metadata_version_exc) + metadata_version = None + + # Make sure to check for the fields that are present, the required + # fields (so their absence can be reported). + fields_to_check = frozenset(ins._raw) | _REQUIRED_ATTRS + # Remove fields that have already been checked. + fields_to_check -= {"metadata_version"} + + for key in fields_to_check: + try: + if metadata_version: + # Can't use getattr() as that triggers descriptor protocol which + # will fail due to no value for the instance argument. + try: + field_metadata_version = cls.__dict__[key].added + except KeyError: + exc = InvalidMetadata(key, f"unrecognized field: {key!r}") + exceptions.append(exc) + continue + field_age = _VALID_METADATA_VERSIONS.index( + field_metadata_version + ) + if field_age > metadata_age: + field = _RAW_TO_EMAIL_MAPPING[key] + exc = InvalidMetadata( + field, + "{field} introduced in metadata version " + "{field_metadata_version}, not {metadata_version}", + ) + exceptions.append(exc) + continue + getattr(ins, key) + except InvalidMetadata as exc: + exceptions.append(exc) + + if exceptions: + raise ExceptionGroup("invalid metadata", exceptions) + + return ins + + @classmethod + def from_email( + cls, data: Union[bytes, str], *, validate: bool = True + ) -> "Metadata": + """Parse metadata from email headers. + + If *validate* is true, the metadata will be validated. All exceptions + related to validation will be gathered and raised as an :class:`ExceptionGroup`. + """ + raw, unparsed = parse_email(data) + + if validate: + exceptions: list[Exception] = [] + for unparsed_key in unparsed: + if unparsed_key in _EMAIL_TO_RAW_MAPPING: + message = f"{unparsed_key!r} has invalid data" + else: + message = f"unrecognized field: {unparsed_key!r}" + exceptions.append(InvalidMetadata(unparsed_key, message)) + + if exceptions: + raise ExceptionGroup("unparsed", exceptions) + + try: + return cls.from_raw(raw, validate=validate) + except ExceptionGroup as exc_group: + raise ExceptionGroup( + "invalid or unparsed metadata", exc_group.exceptions + ) from None + + metadata_version: _Validator[_MetadataVersion] = _Validator() + """:external:ref:`core-metadata-metadata-version` + (required; validated to be a valid metadata version)""" + name: _Validator[str] = _Validator() + """:external:ref:`core-metadata-name` + (required; validated using :func:`~packaging.utils.canonicalize_name` and its + *validate* parameter)""" + version: _Validator[version_module.Version] = _Validator() + """:external:ref:`core-metadata-version` (required)""" + dynamic: _Validator[Optional[List[str]]] = _Validator( + added="2.2", + ) + """:external:ref:`core-metadata-dynamic` + (validated against core metadata field names and lowercased)""" + platforms: _Validator[Optional[List[str]]] = _Validator() + """:external:ref:`core-metadata-platform`""" + supported_platforms: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """:external:ref:`core-metadata-supported-platform`""" + summary: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-summary` (validated to contain no newlines)""" + description: _Validator[Optional[str]] = _Validator() # TODO 2.1: can be in body + """:external:ref:`core-metadata-description`""" + description_content_type: _Validator[Optional[str]] = _Validator(added="2.1") + """:external:ref:`core-metadata-description-content-type` (validated)""" + keywords: _Validator[Optional[List[str]]] = _Validator() + """:external:ref:`core-metadata-keywords`""" + home_page: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-home-page`""" + download_url: _Validator[Optional[str]] = _Validator(added="1.1") + """:external:ref:`core-metadata-download-url`""" + author: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-author`""" + author_email: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-author-email`""" + maintainer: _Validator[Optional[str]] = _Validator(added="1.2") + """:external:ref:`core-metadata-maintainer`""" + maintainer_email: _Validator[Optional[str]] = _Validator(added="1.2") + """:external:ref:`core-metadata-maintainer-email`""" + license: _Validator[Optional[str]] = _Validator() + """:external:ref:`core-metadata-license`""" + classifiers: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """:external:ref:`core-metadata-classifier`""" + requires_dist: _Validator[Optional[List[requirements.Requirement]]] = _Validator( + added="1.2" + ) + """:external:ref:`core-metadata-requires-dist`""" + requires_python: _Validator[Optional[specifiers.SpecifierSet]] = _Validator( + added="1.2" + ) + """:external:ref:`core-metadata-requires-python`""" + # Because `Requires-External` allows for non-PEP 440 version specifiers, we + # don't do any processing on the values. + requires_external: _Validator[Optional[List[str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-requires-external`""" + project_urls: _Validator[Optional[Dict[str, str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-project-url`""" + # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation + # regardless of metadata version. + provides_extra: _Validator[Optional[List[utils.NormalizedName]]] = _Validator( + added="2.1", + ) + """:external:ref:`core-metadata-provides-extra`""" + provides_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-provides-dist`""" + obsoletes_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2") + """:external:ref:`core-metadata-obsoletes-dist`""" + requires: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """``Requires`` (deprecated)""" + provides: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """``Provides`` (deprecated)""" + obsoletes: _Validator[Optional[List[str]]] = _Validator(added="1.1") + """``Obsoletes`` (deprecated)""" diff --git a/distutils/_vendor/packaging/py.typed b/distutils/_vendor/packaging/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/distutils/_vendor/packaging/requirements.py b/distutils/_vendor/packaging/requirements.py new file mode 100644 index 0000000000..bdc43a7e98 --- /dev/null +++ b/distutils/_vendor/packaging/requirements.py @@ -0,0 +1,90 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from typing import Any, Iterator, Optional, Set + +from ._parser import parse_requirement as _parse_requirement +from ._tokenizer import ParserSyntaxError +from .markers import Marker, _normalize_extra_values +from .specifiers import SpecifierSet +from .utils import canonicalize_name + + +class InvalidRequirement(ValueError): + """ + An invalid requirement was found, users should refer to PEP 508. + """ + + +class Requirement: + """Parse a requirement. + + Parse a given requirement string into its parts, such as name, specifier, + URL, and extras. Raises InvalidRequirement on a badly-formed requirement + string. + """ + + # TODO: Can we test whether something is contained within a requirement? + # If so how do we do that? Do we need to test against the _name_ of + # the thing as well as the version? What about the markers? + # TODO: Can we normalize the name and extra name? + + def __init__(self, requirement_string: str) -> None: + try: + parsed = _parse_requirement(requirement_string) + except ParserSyntaxError as e: + raise InvalidRequirement(str(e)) from e + + self.name: str = parsed.name + self.url: Optional[str] = parsed.url or None + self.extras: Set[str] = set(parsed.extras or []) + self.specifier: SpecifierSet = SpecifierSet(parsed.specifier) + self.marker: Optional[Marker] = None + if parsed.marker is not None: + self.marker = Marker.__new__(Marker) + self.marker._markers = _normalize_extra_values(parsed.marker) + + def _iter_parts(self, name: str) -> Iterator[str]: + yield name + + if self.extras: + formatted_extras = ",".join(sorted(self.extras)) + yield f"[{formatted_extras}]" + + if self.specifier: + yield str(self.specifier) + + if self.url: + yield f"@ {self.url}" + if self.marker: + yield " " + + if self.marker: + yield f"; {self.marker}" + + def __str__(self) -> str: + return "".join(self._iter_parts(self.name)) + + def __repr__(self) -> str: + return f"" + + def __hash__(self) -> int: + return hash( + ( + self.__class__.__name__, + *self._iter_parts(canonicalize_name(self.name)), + ) + ) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, Requirement): + return NotImplemented + + return ( + canonicalize_name(self.name) == canonicalize_name(other.name) + and self.extras == other.extras + and self.specifier == other.specifier + and self.url == other.url + and self.marker == other.marker + ) diff --git a/distutils/_vendor/packaging/specifiers.py b/distutils/_vendor/packaging/specifiers.py new file mode 100644 index 0000000000..2d015bab59 --- /dev/null +++ b/distutils/_vendor/packaging/specifiers.py @@ -0,0 +1,1017 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. +""" +.. testsetup:: + + from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier + from packaging.version import Version +""" + +import abc +import itertools +import re +from typing import Callable, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union + +from .utils import canonicalize_version +from .version import Version + +UnparsedVersion = Union[Version, str] +UnparsedVersionVar = TypeVar("UnparsedVersionVar", bound=UnparsedVersion) +CallableOperator = Callable[[Version, str], bool] + + +def _coerce_version(version: UnparsedVersion) -> Version: + if not isinstance(version, Version): + version = Version(version) + return version + + +class InvalidSpecifier(ValueError): + """ + Raised when attempting to create a :class:`Specifier` with a specifier + string that is invalid. + + >>> Specifier("lolwat") + Traceback (most recent call last): + ... + packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat' + """ + + +class BaseSpecifier(metaclass=abc.ABCMeta): + @abc.abstractmethod + def __str__(self) -> str: + """ + Returns the str representation of this Specifier-like object. This + should be representative of the Specifier itself. + """ + + @abc.abstractmethod + def __hash__(self) -> int: + """ + Returns a hash value for this Specifier-like object. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Returns a boolean representing whether or not the two Specifier-like + objects are equal. + + :param other: The other object to check against. + """ + + @property + @abc.abstractmethod + def prereleases(self) -> Optional[bool]: + """Whether or not pre-releases as a whole are allowed. + + This can be set to either ``True`` or ``False`` to explicitly enable or disable + prereleases or it can be set to ``None`` (the default) to use default semantics. + """ + + @prereleases.setter + def prereleases(self, value: bool) -> None: + """Setter for :attr:`prereleases`. + + :param value: The value to set. + """ + + @abc.abstractmethod + def contains(self, item: str, prereleases: Optional[bool] = None) -> bool: + """ + Determines if the given item is contained within this specifier. + """ + + @abc.abstractmethod + def filter( + self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None + ) -> Iterator[UnparsedVersionVar]: + """ + Takes an iterable of items and filters them so that only items which + are contained within this specifier are allowed in it. + """ + + +class Specifier(BaseSpecifier): + """This class abstracts handling of version specifiers. + + .. tip:: + + It is generally not required to instantiate this manually. You should instead + prefer to work with :class:`SpecifierSet` instead, which can parse + comma-separated version specifiers (which is what package metadata contains). + """ + + _operator_regex_str = r""" + (?P(~=|==|!=|<=|>=|<|>|===)) + """ + _version_regex_str = r""" + (?P + (?: + # The identity operators allow for an escape hatch that will + # do an exact string match of the version you wish to install. + # This will not be parsed by PEP 440 and we cannot determine + # any semantic meaning from it. This operator is discouraged + # but included entirely as an escape hatch. + (?<====) # Only match for the identity operator + \s* + [^\s;)]* # The arbitrary version can be just about anything, + # we match everything except for whitespace, a + # semi-colon for marker support, and a closing paren + # since versions can be enclosed in them. + ) + | + (?: + # The (non)equality operators allow for wild card and local + # versions to be specified so we have to define these two + # operators separately to enable that. + (?<===|!=) # Only match for equals and not equals + + \s* + v? + (?:[0-9]+!)? # epoch + [0-9]+(?:\.[0-9]+)* # release + + # You cannot use a wild card and a pre-release, post-release, a dev or + # local version together so group them with a | and make them optional. + (?: + \.\* # Wild card syntax of .* + | + (?: # pre release + [-_\.]? + (alpha|beta|preview|pre|a|b|c|rc) + [-_\.]? + [0-9]* + )? + (?: # post release + (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) + )? + (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release + (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local + )? + ) + | + (?: + # The compatible operator requires at least two digits in the + # release segment. + (?<=~=) # Only match for the compatible operator + + \s* + v? + (?:[0-9]+!)? # epoch + [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) + (?: # pre release + [-_\.]? + (alpha|beta|preview|pre|a|b|c|rc) + [-_\.]? + [0-9]* + )? + (?: # post release + (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) + )? + (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release + ) + | + (?: + # All other operators only allow a sub set of what the + # (non)equality operators do. Specifically they do not allow + # local versions to be specified nor do they allow the prefix + # matching wild cards. + (?=": "greater_than_equal", + "<": "less_than", + ">": "greater_than", + "===": "arbitrary", + } + + def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None: + """Initialize a Specifier instance. + + :param spec: + The string representation of a specifier which will be parsed and + normalized before use. + :param prereleases: + This tells the specifier if it should accept prerelease versions if + applicable or not. The default of ``None`` will autodetect it from the + given specifiers. + :raises InvalidSpecifier: + If the given specifier is invalid (i.e. bad syntax). + """ + match = self._regex.search(spec) + if not match: + raise InvalidSpecifier(f"Invalid specifier: '{spec}'") + + self._spec: Tuple[str, str] = ( + match.group("operator").strip(), + match.group("version").strip(), + ) + + # Store whether or not this Specifier should accept prereleases + self._prereleases = prereleases + + # https://github.com/python/mypy/pull/13475#pullrequestreview-1079784515 + @property # type: ignore[override] + def prereleases(self) -> bool: + # If there is an explicit prereleases set for this, then we'll just + # blindly use that. + if self._prereleases is not None: + return self._prereleases + + # Look at all of our specifiers and determine if they are inclusive + # operators, and if they are if they are including an explicit + # prerelease. + operator, version = self._spec + if operator in ["==", ">=", "<=", "~=", "==="]: + # The == specifier can include a trailing .*, if it does we + # want to remove before parsing. + if operator == "==" and version.endswith(".*"): + version = version[:-2] + + # Parse the version, and if it is a pre-release than this + # specifier allows pre-releases. + if Version(version).is_prerelease: + return True + + return False + + @prereleases.setter + def prereleases(self, value: bool) -> None: + self._prereleases = value + + @property + def operator(self) -> str: + """The operator of this specifier. + + >>> Specifier("==1.2.3").operator + '==' + """ + return self._spec[0] + + @property + def version(self) -> str: + """The version of this specifier. + + >>> Specifier("==1.2.3").version + '1.2.3' + """ + return self._spec[1] + + def __repr__(self) -> str: + """A representation of the Specifier that shows all internal state. + + >>> Specifier('>=1.0.0') + =1.0.0')> + >>> Specifier('>=1.0.0', prereleases=False) + =1.0.0', prereleases=False)> + >>> Specifier('>=1.0.0', prereleases=True) + =1.0.0', prereleases=True)> + """ + pre = ( + f", prereleases={self.prereleases!r}" + if self._prereleases is not None + else "" + ) + + return f"<{self.__class__.__name__}({str(self)!r}{pre})>" + + def __str__(self) -> str: + """A string representation of the Specifier that can be round-tripped. + + >>> str(Specifier('>=1.0.0')) + '>=1.0.0' + >>> str(Specifier('>=1.0.0', prereleases=False)) + '>=1.0.0' + """ + return "{}{}".format(*self._spec) + + @property + def _canonical_spec(self) -> Tuple[str, str]: + canonical_version = canonicalize_version( + self._spec[1], + strip_trailing_zero=(self._spec[0] != "~="), + ) + return self._spec[0], canonical_version + + def __hash__(self) -> int: + return hash(self._canonical_spec) + + def __eq__(self, other: object) -> bool: + """Whether or not the two Specifier-like objects are equal. + + :param other: The other object to check against. + + The value of :attr:`prereleases` is ignored. + + >>> Specifier("==1.2.3") == Specifier("== 1.2.3.0") + True + >>> (Specifier("==1.2.3", prereleases=False) == + ... Specifier("==1.2.3", prereleases=True)) + True + >>> Specifier("==1.2.3") == "==1.2.3" + True + >>> Specifier("==1.2.3") == Specifier("==1.2.4") + False + >>> Specifier("==1.2.3") == Specifier("~=1.2.3") + False + """ + if isinstance(other, str): + try: + other = self.__class__(str(other)) + except InvalidSpecifier: + return NotImplemented + elif not isinstance(other, self.__class__): + return NotImplemented + + return self._canonical_spec == other._canonical_spec + + def _get_operator(self, op: str) -> CallableOperator: + operator_callable: CallableOperator = getattr( + self, f"_compare_{self._operators[op]}" + ) + return operator_callable + + def _compare_compatible(self, prospective: Version, spec: str) -> bool: + + # Compatible releases have an equivalent combination of >= and ==. That + # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to + # implement this in terms of the other specifiers instead of + # implementing it ourselves. The only thing we need to do is construct + # the other specifiers. + + # We want everything but the last item in the version, but we want to + # ignore suffix segments. + prefix = _version_join( + list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1] + ) + + # Add the prefix notation to the end of our string + prefix += ".*" + + return self._get_operator(">=")(prospective, spec) and self._get_operator("==")( + prospective, prefix + ) + + def _compare_equal(self, prospective: Version, spec: str) -> bool: + + # We need special logic to handle prefix matching + if spec.endswith(".*"): + # In the case of prefix matching we want to ignore local segment. + normalized_prospective = canonicalize_version( + prospective.public, strip_trailing_zero=False + ) + # Get the normalized version string ignoring the trailing .* + normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False) + # Split the spec out by bangs and dots, and pretend that there is + # an implicit dot in between a release segment and a pre-release segment. + split_spec = _version_split(normalized_spec) + + # Split the prospective version out by bangs and dots, and pretend + # that there is an implicit dot in between a release segment and + # a pre-release segment. + split_prospective = _version_split(normalized_prospective) + + # 0-pad the prospective version before shortening it to get the correct + # shortened version. + padded_prospective, _ = _pad_version(split_prospective, split_spec) + + # Shorten the prospective version to be the same length as the spec + # so that we can determine if the specifier is a prefix of the + # prospective version or not. + shortened_prospective = padded_prospective[: len(split_spec)] + + return shortened_prospective == split_spec + else: + # Convert our spec string into a Version + spec_version = Version(spec) + + # If the specifier does not have a local segment, then we want to + # act as if the prospective version also does not have a local + # segment. + if not spec_version.local: + prospective = Version(prospective.public) + + return prospective == spec_version + + def _compare_not_equal(self, prospective: Version, spec: str) -> bool: + return not self._compare_equal(prospective, spec) + + def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool: + + # NB: Local version identifiers are NOT permitted in the version + # specifier, so local version labels can be universally removed from + # the prospective version. + return Version(prospective.public) <= Version(spec) + + def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool: + + # NB: Local version identifiers are NOT permitted in the version + # specifier, so local version labels can be universally removed from + # the prospective version. + return Version(prospective.public) >= Version(spec) + + def _compare_less_than(self, prospective: Version, spec_str: str) -> bool: + + # Convert our spec to a Version instance, since we'll want to work with + # it as a version. + spec = Version(spec_str) + + # Check to see if the prospective version is less than the spec + # version. If it's not we can short circuit and just return False now + # instead of doing extra unneeded work. + if not prospective < spec: + return False + + # This special case is here so that, unless the specifier itself + # includes is a pre-release version, that we do not accept pre-release + # versions for the version mentioned in the specifier (e.g. <3.1 should + # not match 3.1.dev0, but should match 3.0.dev0). + if not spec.is_prerelease and prospective.is_prerelease: + if Version(prospective.base_version) == Version(spec.base_version): + return False + + # If we've gotten to here, it means that prospective version is both + # less than the spec version *and* it's not a pre-release of the same + # version in the spec. + return True + + def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool: + + # Convert our spec to a Version instance, since we'll want to work with + # it as a version. + spec = Version(spec_str) + + # Check to see if the prospective version is greater than the spec + # version. If it's not we can short circuit and just return False now + # instead of doing extra unneeded work. + if not prospective > spec: + return False + + # This special case is here so that, unless the specifier itself + # includes is a post-release version, that we do not accept + # post-release versions for the version mentioned in the specifier + # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0). + if not spec.is_postrelease and prospective.is_postrelease: + if Version(prospective.base_version) == Version(spec.base_version): + return False + + # Ensure that we do not allow a local version of the version mentioned + # in the specifier, which is technically greater than, to match. + if prospective.local is not None: + if Version(prospective.base_version) == Version(spec.base_version): + return False + + # If we've gotten to here, it means that prospective version is both + # greater than the spec version *and* it's not a pre-release of the + # same version in the spec. + return True + + def _compare_arbitrary(self, prospective: Version, spec: str) -> bool: + return str(prospective).lower() == str(spec).lower() + + def __contains__(self, item: Union[str, Version]) -> bool: + """Return whether or not the item is contained in this specifier. + + :param item: The item to check for. + + This is used for the ``in`` operator and behaves the same as + :meth:`contains` with no ``prereleases`` argument passed. + + >>> "1.2.3" in Specifier(">=1.2.3") + True + >>> Version("1.2.3") in Specifier(">=1.2.3") + True + >>> "1.0.0" in Specifier(">=1.2.3") + False + >>> "1.3.0a1" in Specifier(">=1.2.3") + False + >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True) + True + """ + return self.contains(item) + + def contains( + self, item: UnparsedVersion, prereleases: Optional[bool] = None + ) -> bool: + """Return whether or not the item is contained in this specifier. + + :param item: + The item to check for, which can be a version string or a + :class:`Version` instance. + :param prereleases: + Whether or not to match prereleases with this Specifier. If set to + ``None`` (the default), it uses :attr:`prereleases` to determine + whether or not prereleases are allowed. + + >>> Specifier(">=1.2.3").contains("1.2.3") + True + >>> Specifier(">=1.2.3").contains(Version("1.2.3")) + True + >>> Specifier(">=1.2.3").contains("1.0.0") + False + >>> Specifier(">=1.2.3").contains("1.3.0a1") + False + >>> Specifier(">=1.2.3", prereleases=True).contains("1.3.0a1") + True + >>> Specifier(">=1.2.3").contains("1.3.0a1", prereleases=True) + True + """ + + # Determine if prereleases are to be allowed or not. + if prereleases is None: + prereleases = self.prereleases + + # Normalize item to a Version, this allows us to have a shortcut for + # "2.0" in Specifier(">=2") + normalized_item = _coerce_version(item) + + # Determine if we should be supporting prereleases in this specifier + # or not, if we do not support prereleases than we can short circuit + # logic if this version is a prereleases. + if normalized_item.is_prerelease and not prereleases: + return False + + # Actually do the comparison to determine if this item is contained + # within this Specifier or not. + operator_callable: CallableOperator = self._get_operator(self.operator) + return operator_callable(normalized_item, self.version) + + def filter( + self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None + ) -> Iterator[UnparsedVersionVar]: + """Filter items in the given iterable, that match the specifier. + + :param iterable: + An iterable that can contain version strings and :class:`Version` instances. + The items in the iterable will be filtered according to the specifier. + :param prereleases: + Whether or not to allow prereleases in the returned iterator. If set to + ``None`` (the default), it will be intelligently decide whether to allow + prereleases or not (based on the :attr:`prereleases` attribute, and + whether the only versions matching are prereleases). + + This method is smarter than just ``filter(Specifier().contains, [...])`` + because it implements the rule from :pep:`440` that a prerelease item + SHOULD be accepted if no other versions match the given specifier. + + >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) + ['1.3'] + >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")])) + ['1.2.3', '1.3', ] + >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"])) + ['1.5a1'] + >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) + ['1.3', '1.5a1'] + >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) + ['1.3', '1.5a1'] + """ + + yielded = False + found_prereleases = [] + + kw = {"prereleases": prereleases if prereleases is not None else True} + + # Attempt to iterate over all the values in the iterable and if any of + # them match, yield them. + for version in iterable: + parsed_version = _coerce_version(version) + + if self.contains(parsed_version, **kw): + # If our version is a prerelease, and we were not set to allow + # prereleases, then we'll store it for later in case nothing + # else matches this specifier. + if parsed_version.is_prerelease and not ( + prereleases or self.prereleases + ): + found_prereleases.append(version) + # Either this is not a prerelease, or we should have been + # accepting prereleases from the beginning. + else: + yielded = True + yield version + + # Now that we've iterated over everything, determine if we've yielded + # any values, and if we have not and we have any prereleases stored up + # then we will go ahead and yield the prereleases. + if not yielded and found_prereleases: + for version in found_prereleases: + yield version + + +_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$") + + +def _version_split(version: str) -> List[str]: + """Split version into components. + + The split components are intended for version comparison. The logic does + not attempt to retain the original version string, so joining the + components back with :func:`_version_join` may not produce the original + version string. + """ + result: List[str] = [] + + epoch, _, rest = version.rpartition("!") + result.append(epoch or "0") + + for item in rest.split("."): + match = _prefix_regex.search(item) + if match: + result.extend(match.groups()) + else: + result.append(item) + return result + + +def _version_join(components: List[str]) -> str: + """Join split version components into a version string. + + This function assumes the input came from :func:`_version_split`, where the + first component must be the epoch (either empty or numeric), and all other + components numeric. + """ + epoch, *rest = components + return f"{epoch}!{'.'.join(rest)}" + + +def _is_not_suffix(segment: str) -> bool: + return not any( + segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post") + ) + + +def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]: + left_split, right_split = [], [] + + # Get the release segment of our versions + left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left))) + right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right))) + + # Get the rest of our versions + left_split.append(left[len(left_split[0]) :]) + right_split.append(right[len(right_split[0]) :]) + + # Insert our padding + left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0]))) + right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0]))) + + return ( + list(itertools.chain.from_iterable(left_split)), + list(itertools.chain.from_iterable(right_split)), + ) + + +class SpecifierSet(BaseSpecifier): + """This class abstracts handling of a set of version specifiers. + + It can be passed a single specifier (``>=3.0``), a comma-separated list of + specifiers (``>=3.0,!=3.1``), or no specifier at all. + """ + + def __init__( + self, specifiers: str = "", prereleases: Optional[bool] = None + ) -> None: + """Initialize a SpecifierSet instance. + + :param specifiers: + The string representation of a specifier or a comma-separated list of + specifiers which will be parsed and normalized before use. + :param prereleases: + This tells the SpecifierSet if it should accept prerelease versions if + applicable or not. The default of ``None`` will autodetect it from the + given specifiers. + + :raises InvalidSpecifier: + If the given ``specifiers`` are not parseable than this exception will be + raised. + """ + + # Split on `,` to break each individual specifier into it's own item, and + # strip each item to remove leading/trailing whitespace. + split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()] + + # Make each individual specifier a Specifier and save in a frozen set for later. + self._specs = frozenset(map(Specifier, split_specifiers)) + + # Store our prereleases value so we can use it later to determine if + # we accept prereleases or not. + self._prereleases = prereleases + + @property + def prereleases(self) -> Optional[bool]: + # If we have been given an explicit prerelease modifier, then we'll + # pass that through here. + if self._prereleases is not None: + return self._prereleases + + # If we don't have any specifiers, and we don't have a forced value, + # then we'll just return None since we don't know if this should have + # pre-releases or not. + if not self._specs: + return None + + # Otherwise we'll see if any of the given specifiers accept + # prereleases, if any of them do we'll return True, otherwise False. + return any(s.prereleases for s in self._specs) + + @prereleases.setter + def prereleases(self, value: bool) -> None: + self._prereleases = value + + def __repr__(self) -> str: + """A representation of the specifier set that shows all internal state. + + Note that the ordering of the individual specifiers within the set may not + match the input string. + + >>> SpecifierSet('>=1.0.0,!=2.0.0') + =1.0.0')> + >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False) + =1.0.0', prereleases=False)> + >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True) + =1.0.0', prereleases=True)> + """ + pre = ( + f", prereleases={self.prereleases!r}" + if self._prereleases is not None + else "" + ) + + return f"" + + def __str__(self) -> str: + """A string representation of the specifier set that can be round-tripped. + + Note that the ordering of the individual specifiers within the set may not + match the input string. + + >>> str(SpecifierSet(">=1.0.0,!=1.0.1")) + '!=1.0.1,>=1.0.0' + >>> str(SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False)) + '!=1.0.1,>=1.0.0' + """ + return ",".join(sorted(str(s) for s in self._specs)) + + def __hash__(self) -> int: + return hash(self._specs) + + def __and__(self, other: Union["SpecifierSet", str]) -> "SpecifierSet": + """Return a SpecifierSet which is a combination of the two sets. + + :param other: The other object to combine with. + + >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1' + =1.0.0')> + >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1') + =1.0.0')> + """ + if isinstance(other, str): + other = SpecifierSet(other) + elif not isinstance(other, SpecifierSet): + return NotImplemented + + specifier = SpecifierSet() + specifier._specs = frozenset(self._specs | other._specs) + + if self._prereleases is None and other._prereleases is not None: + specifier._prereleases = other._prereleases + elif self._prereleases is not None and other._prereleases is None: + specifier._prereleases = self._prereleases + elif self._prereleases == other._prereleases: + specifier._prereleases = self._prereleases + else: + raise ValueError( + "Cannot combine SpecifierSets with True and False prerelease " + "overrides." + ) + + return specifier + + def __eq__(self, other: object) -> bool: + """Whether or not the two SpecifierSet-like objects are equal. + + :param other: The other object to check against. + + The value of :attr:`prereleases` is ignored. + + >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1") + True + >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) == + ... SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)) + True + >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1" + True + >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0") + False + >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2") + False + """ + if isinstance(other, (str, Specifier)): + other = SpecifierSet(str(other)) + elif not isinstance(other, SpecifierSet): + return NotImplemented + + return self._specs == other._specs + + def __len__(self) -> int: + """Returns the number of specifiers in this specifier set.""" + return len(self._specs) + + def __iter__(self) -> Iterator[Specifier]: + """ + Returns an iterator over all the underlying :class:`Specifier` instances + in this specifier set. + + >>> sorted(SpecifierSet(">=1.0.0,!=1.0.1"), key=str) + [, =1.0.0')>] + """ + return iter(self._specs) + + def __contains__(self, item: UnparsedVersion) -> bool: + """Return whether or not the item is contained in this specifier. + + :param item: The item to check for. + + This is used for the ``in`` operator and behaves the same as + :meth:`contains` with no ``prereleases`` argument passed. + + >>> "1.2.3" in SpecifierSet(">=1.0.0,!=1.0.1") + True + >>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1") + True + >>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1") + False + >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1") + False + >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True) + True + """ + return self.contains(item) + + def contains( + self, + item: UnparsedVersion, + prereleases: Optional[bool] = None, + installed: Optional[bool] = None, + ) -> bool: + """Return whether or not the item is contained in this SpecifierSet. + + :param item: + The item to check for, which can be a version string or a + :class:`Version` instance. + :param prereleases: + Whether or not to match prereleases with this SpecifierSet. If set to + ``None`` (the default), it uses :attr:`prereleases` to determine + whether or not prereleases are allowed. + + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3") + True + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3")) + True + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1") + False + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1") + False + >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True).contains("1.3.0a1") + True + >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True) + True + """ + # Ensure that our item is a Version instance. + if not isinstance(item, Version): + item = Version(item) + + # Determine if we're forcing a prerelease or not, if we're not forcing + # one for this particular filter call, then we'll use whatever the + # SpecifierSet thinks for whether or not we should support prereleases. + if prereleases is None: + prereleases = self.prereleases + + # We can determine if we're going to allow pre-releases by looking to + # see if any of the underlying items supports them. If none of them do + # and this item is a pre-release then we do not allow it and we can + # short circuit that here. + # Note: This means that 1.0.dev1 would not be contained in something + # like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0 + if not prereleases and item.is_prerelease: + return False + + if installed and item.is_prerelease: + item = Version(item.base_version) + + # We simply dispatch to the underlying specs here to make sure that the + # given version is contained within all of them. + # Note: This use of all() here means that an empty set of specifiers + # will always return True, this is an explicit design decision. + return all(s.contains(item, prereleases=prereleases) for s in self._specs) + + def filter( + self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None + ) -> Iterator[UnparsedVersionVar]: + """Filter items in the given iterable, that match the specifiers in this set. + + :param iterable: + An iterable that can contain version strings and :class:`Version` instances. + The items in the iterable will be filtered according to the specifier. + :param prereleases: + Whether or not to allow prereleases in the returned iterator. If set to + ``None`` (the default), it will be intelligently decide whether to allow + prereleases or not (based on the :attr:`prereleases` attribute, and + whether the only versions matching are prereleases). + + This method is smarter than just ``filter(SpecifierSet(...).contains, [...])`` + because it implements the rule from :pep:`440` that a prerelease item + SHOULD be accepted if no other versions match the given specifier. + + >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) + ['1.3'] + >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", Version("1.4")])) + ['1.3', ] + >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.5a1"])) + [] + >>> list(SpecifierSet(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) + ['1.3', '1.5a1'] + >>> list(SpecifierSet(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) + ['1.3', '1.5a1'] + + An "empty" SpecifierSet will filter items based on the presence of prerelease + versions in the set. + + >>> list(SpecifierSet("").filter(["1.3", "1.5a1"])) + ['1.3'] + >>> list(SpecifierSet("").filter(["1.5a1"])) + ['1.5a1'] + >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"])) + ['1.3', '1.5a1'] + >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True)) + ['1.3', '1.5a1'] + """ + # Determine if we're forcing a prerelease or not, if we're not forcing + # one for this particular filter call, then we'll use whatever the + # SpecifierSet thinks for whether or not we should support prereleases. + if prereleases is None: + prereleases = self.prereleases + + # If we have any specifiers, then we want to wrap our iterable in the + # filter method for each one, this will act as a logical AND amongst + # each specifier. + if self._specs: + for spec in self._specs: + iterable = spec.filter(iterable, prereleases=bool(prereleases)) + return iter(iterable) + # If we do not have any specifiers, then we need to have a rough filter + # which will filter out any pre-releases, unless there are no final + # releases. + else: + filtered: List[UnparsedVersionVar] = [] + found_prereleases: List[UnparsedVersionVar] = [] + + for item in iterable: + parsed_version = _coerce_version(item) + + # Store any item which is a pre-release for later unless we've + # already found a final version or we are accepting prereleases + if parsed_version.is_prerelease and not prereleases: + if not filtered: + found_prereleases.append(item) + else: + filtered.append(item) + + # If we've found no items except for pre-releases, then we'll go + # ahead and use the pre-releases + if not filtered and found_prereleases and prereleases is None: + return iter(found_prereleases) + + return iter(filtered) diff --git a/distutils/_vendor/packaging/tags.py b/distutils/_vendor/packaging/tags.py new file mode 100644 index 0000000000..89f1926137 --- /dev/null +++ b/distutils/_vendor/packaging/tags.py @@ -0,0 +1,571 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import logging +import platform +import re +import struct +import subprocess +import sys +import sysconfig +from importlib.machinery import EXTENSION_SUFFIXES +from typing import ( + Dict, + FrozenSet, + Iterable, + Iterator, + List, + Optional, + Sequence, + Tuple, + Union, + cast, +) + +from . import _manylinux, _musllinux + +logger = logging.getLogger(__name__) + +PythonVersion = Sequence[int] +MacVersion = Tuple[int, int] + +INTERPRETER_SHORT_NAMES: Dict[str, str] = { + "python": "py", # Generic. + "cpython": "cp", + "pypy": "pp", + "ironpython": "ip", + "jython": "jy", +} + + +_32_BIT_INTERPRETER = struct.calcsize("P") == 4 + + +class Tag: + """ + A representation of the tag triple for a wheel. + + Instances are considered immutable and thus are hashable. Equality checking + is also supported. + """ + + __slots__ = ["_interpreter", "_abi", "_platform", "_hash"] + + def __init__(self, interpreter: str, abi: str, platform: str) -> None: + self._interpreter = interpreter.lower() + self._abi = abi.lower() + self._platform = platform.lower() + # The __hash__ of every single element in a Set[Tag] will be evaluated each time + # that a set calls its `.disjoint()` method, which may be called hundreds of + # times when scanning a page of links for packages with tags matching that + # Set[Tag]. Pre-computing the value here produces significant speedups for + # downstream consumers. + self._hash = hash((self._interpreter, self._abi, self._platform)) + + @property + def interpreter(self) -> str: + return self._interpreter + + @property + def abi(self) -> str: + return self._abi + + @property + def platform(self) -> str: + return self._platform + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Tag): + return NotImplemented + + return ( + (self._hash == other._hash) # Short-circuit ASAP for perf reasons. + and (self._platform == other._platform) + and (self._abi == other._abi) + and (self._interpreter == other._interpreter) + ) + + def __hash__(self) -> int: + return self._hash + + def __str__(self) -> str: + return f"{self._interpreter}-{self._abi}-{self._platform}" + + def __repr__(self) -> str: + return f"<{self} @ {id(self)}>" + + +def parse_tag(tag: str) -> FrozenSet[Tag]: + """ + Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances. + + Returning a set is required due to the possibility that the tag is a + compressed tag set. + """ + tags = set() + interpreters, abis, platforms = tag.split("-") + for interpreter in interpreters.split("."): + for abi in abis.split("."): + for platform_ in platforms.split("."): + tags.add(Tag(interpreter, abi, platform_)) + return frozenset(tags) + + +def _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]: + value: Union[int, str, None] = sysconfig.get_config_var(name) + if value is None and warn: + logger.debug( + "Config variable '%s' is unset, Python ABI tag may be incorrect", name + ) + return value + + +def _normalize_string(string: str) -> str: + return string.replace(".", "_").replace("-", "_").replace(" ", "_") + + +def _is_threaded_cpython(abis: List[str]) -> bool: + """ + Determine if the ABI corresponds to a threaded (`--disable-gil`) build. + + The threaded builds are indicated by a "t" in the abiflags. + """ + if len(abis) == 0: + return False + # expect e.g., cp313 + m = re.match(r"cp\d+(.*)", abis[0]) + if not m: + return False + abiflags = m.group(1) + return "t" in abiflags + + +def _abi3_applies(python_version: PythonVersion, threading: bool) -> bool: + """ + Determine if the Python version supports abi3. + + PEP 384 was first implemented in Python 3.2. The threaded (`--disable-gil`) + builds do not support abi3. + """ + return len(python_version) > 1 and tuple(python_version) >= (3, 2) and not threading + + +def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]: + py_version = tuple(py_version) # To allow for version comparison. + abis = [] + version = _version_nodot(py_version[:2]) + threading = debug = pymalloc = ucs4 = "" + with_debug = _get_config_var("Py_DEBUG", warn) + has_refcount = hasattr(sys, "gettotalrefcount") + # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled + # extension modules is the best option. + # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 + has_ext = "_d.pyd" in EXTENSION_SUFFIXES + if with_debug or (with_debug is None and (has_refcount or has_ext)): + debug = "d" + if py_version >= (3, 13) and _get_config_var("Py_GIL_DISABLED", warn): + threading = "t" + if py_version < (3, 8): + with_pymalloc = _get_config_var("WITH_PYMALLOC", warn) + if with_pymalloc or with_pymalloc is None: + pymalloc = "m" + if py_version < (3, 3): + unicode_size = _get_config_var("Py_UNICODE_SIZE", warn) + if unicode_size == 4 or ( + unicode_size is None and sys.maxunicode == 0x10FFFF + ): + ucs4 = "u" + elif debug: + # Debug builds can also load "normal" extension modules. + # We can also assume no UCS-4 or pymalloc requirement. + abis.append(f"cp{version}{threading}") + abis.insert(0, f"cp{version}{threading}{debug}{pymalloc}{ucs4}") + return abis + + +def cpython_tags( + python_version: Optional[PythonVersion] = None, + abis: Optional[Iterable[str]] = None, + platforms: Optional[Iterable[str]] = None, + *, + warn: bool = False, +) -> Iterator[Tag]: + """ + Yields the tags for a CPython interpreter. + + The tags consist of: + - cp-- + - cp-abi3- + - cp-none- + - cp-abi3- # Older Python versions down to 3.2. + + If python_version only specifies a major version then user-provided ABIs and + the 'none' ABItag will be used. + + If 'abi3' or 'none' are specified in 'abis' then they will be yielded at + their normal position and not at the beginning. + """ + if not python_version: + python_version = sys.version_info[:2] + + interpreter = f"cp{_version_nodot(python_version[:2])}" + + if abis is None: + if len(python_version) > 1: + abis = _cpython_abis(python_version, warn) + else: + abis = [] + abis = list(abis) + # 'abi3' and 'none' are explicitly handled later. + for explicit_abi in ("abi3", "none"): + try: + abis.remove(explicit_abi) + except ValueError: + pass + + platforms = list(platforms or platform_tags()) + for abi in abis: + for platform_ in platforms: + yield Tag(interpreter, abi, platform_) + + threading = _is_threaded_cpython(abis) + use_abi3 = _abi3_applies(python_version, threading) + if use_abi3: + yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms) + yield from (Tag(interpreter, "none", platform_) for platform_ in platforms) + + if use_abi3: + for minor_version in range(python_version[1] - 1, 1, -1): + for platform_ in platforms: + interpreter = "cp{version}".format( + version=_version_nodot((python_version[0], minor_version)) + ) + yield Tag(interpreter, "abi3", platform_) + + +def _generic_abi() -> List[str]: + """ + Return the ABI tag based on EXT_SUFFIX. + """ + # The following are examples of `EXT_SUFFIX`. + # We want to keep the parts which are related to the ABI and remove the + # parts which are related to the platform: + # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310 + # - mac: '.cpython-310-darwin.so' => cp310 + # - win: '.cp310-win_amd64.pyd' => cp310 + # - win: '.pyd' => cp37 (uses _cpython_abis()) + # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73 + # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib' + # => graalpy_38_native + + ext_suffix = _get_config_var("EXT_SUFFIX", warn=True) + if not isinstance(ext_suffix, str) or ext_suffix[0] != ".": + raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')") + parts = ext_suffix.split(".") + if len(parts) < 3: + # CPython3.7 and earlier uses ".pyd" on Windows. + return _cpython_abis(sys.version_info[:2]) + soabi = parts[1] + if soabi.startswith("cpython"): + # non-windows + abi = "cp" + soabi.split("-")[1] + elif soabi.startswith("cp"): + # windows + abi = soabi.split("-")[0] + elif soabi.startswith("pypy"): + abi = "-".join(soabi.split("-")[:2]) + elif soabi.startswith("graalpy"): + abi = "-".join(soabi.split("-")[:3]) + elif soabi: + # pyston, ironpython, others? + abi = soabi + else: + return [] + return [_normalize_string(abi)] + + +def generic_tags( + interpreter: Optional[str] = None, + abis: Optional[Iterable[str]] = None, + platforms: Optional[Iterable[str]] = None, + *, + warn: bool = False, +) -> Iterator[Tag]: + """ + Yields the tags for a generic interpreter. + + The tags consist of: + - -- + + The "none" ABI will be added if it was not explicitly provided. + """ + if not interpreter: + interp_name = interpreter_name() + interp_version = interpreter_version(warn=warn) + interpreter = "".join([interp_name, interp_version]) + if abis is None: + abis = _generic_abi() + else: + abis = list(abis) + platforms = list(platforms or platform_tags()) + if "none" not in abis: + abis.append("none") + for abi in abis: + for platform_ in platforms: + yield Tag(interpreter, abi, platform_) + + +def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]: + """ + Yields Python versions in descending order. + + After the latest version, the major-only version will be yielded, and then + all previous versions of that major version. + """ + if len(py_version) > 1: + yield f"py{_version_nodot(py_version[:2])}" + yield f"py{py_version[0]}" + if len(py_version) > 1: + for minor in range(py_version[1] - 1, -1, -1): + yield f"py{_version_nodot((py_version[0], minor))}" + + +def compatible_tags( + python_version: Optional[PythonVersion] = None, + interpreter: Optional[str] = None, + platforms: Optional[Iterable[str]] = None, +) -> Iterator[Tag]: + """ + Yields the sequence of tags that are compatible with a specific version of Python. + + The tags consist of: + - py*-none- + - -none-any # ... if `interpreter` is provided. + - py*-none-any + """ + if not python_version: + python_version = sys.version_info[:2] + platforms = list(platforms or platform_tags()) + for version in _py_interpreter_range(python_version): + for platform_ in platforms: + yield Tag(version, "none", platform_) + if interpreter: + yield Tag(interpreter, "none", "any") + for version in _py_interpreter_range(python_version): + yield Tag(version, "none", "any") + + +def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str: + if not is_32bit: + return arch + + if arch.startswith("ppc"): + return "ppc" + + return "i386" + + +def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]: + formats = [cpu_arch] + if cpu_arch == "x86_64": + if version < (10, 4): + return [] + formats.extend(["intel", "fat64", "fat32"]) + + elif cpu_arch == "i386": + if version < (10, 4): + return [] + formats.extend(["intel", "fat32", "fat"]) + + elif cpu_arch == "ppc64": + # TODO: Need to care about 32-bit PPC for ppc64 through 10.2? + if version > (10, 5) or version < (10, 4): + return [] + formats.append("fat64") + + elif cpu_arch == "ppc": + if version > (10, 6): + return [] + formats.extend(["fat32", "fat"]) + + if cpu_arch in {"arm64", "x86_64"}: + formats.append("universal2") + + if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}: + formats.append("universal") + + return formats + + +def mac_platforms( + version: Optional[MacVersion] = None, arch: Optional[str] = None +) -> Iterator[str]: + """ + Yields the platform tags for a macOS system. + + The `version` parameter is a two-item tuple specifying the macOS version to + generate platform tags for. The `arch` parameter is the CPU architecture to + generate platform tags for. Both parameters default to the appropriate value + for the current system. + """ + version_str, _, cpu_arch = platform.mac_ver() + if version is None: + version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) + if version == (10, 16): + # When built against an older macOS SDK, Python will report macOS 10.16 + # instead of the real version. + version_str = subprocess.run( + [ + sys.executable, + "-sS", + "-c", + "import platform; print(platform.mac_ver()[0])", + ], + check=True, + env={"SYSTEM_VERSION_COMPAT": "0"}, + stdout=subprocess.PIPE, + text=True, + ).stdout + version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) + else: + version = version + if arch is None: + arch = _mac_arch(cpu_arch) + else: + arch = arch + + if (10, 0) <= version and version < (11, 0): + # Prior to Mac OS 11, each yearly release of Mac OS bumped the + # "minor" version number. The major version was always 10. + for minor_version in range(version[1], -1, -1): + compat_version = 10, minor_version + binary_formats = _mac_binary_formats(compat_version, arch) + for binary_format in binary_formats: + yield "macosx_{major}_{minor}_{binary_format}".format( + major=10, minor=minor_version, binary_format=binary_format + ) + + if version >= (11, 0): + # Starting with Mac OS 11, each yearly release bumps the major version + # number. The minor versions are now the midyear updates. + for major_version in range(version[0], 10, -1): + compat_version = major_version, 0 + binary_formats = _mac_binary_formats(compat_version, arch) + for binary_format in binary_formats: + yield "macosx_{major}_{minor}_{binary_format}".format( + major=major_version, minor=0, binary_format=binary_format + ) + + if version >= (11, 0): + # Mac OS 11 on x86_64 is compatible with binaries from previous releases. + # Arm64 support was introduced in 11.0, so no Arm binaries from previous + # releases exist. + # + # However, the "universal2" binary format can have a + # macOS version earlier than 11.0 when the x86_64 part of the binary supports + # that version of macOS. + if arch == "x86_64": + for minor_version in range(16, 3, -1): + compat_version = 10, minor_version + binary_formats = _mac_binary_formats(compat_version, arch) + for binary_format in binary_formats: + yield "macosx_{major}_{minor}_{binary_format}".format( + major=compat_version[0], + minor=compat_version[1], + binary_format=binary_format, + ) + else: + for minor_version in range(16, 3, -1): + compat_version = 10, minor_version + binary_format = "universal2" + yield "macosx_{major}_{minor}_{binary_format}".format( + major=compat_version[0], + minor=compat_version[1], + binary_format=binary_format, + ) + + +def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]: + linux = _normalize_string(sysconfig.get_platform()) + if not linux.startswith("linux_"): + # we should never be here, just yield the sysconfig one and return + yield linux + return + if is_32bit: + if linux == "linux_x86_64": + linux = "linux_i686" + elif linux == "linux_aarch64": + linux = "linux_armv8l" + _, arch = linux.split("_", 1) + archs = {"armv8l": ["armv8l", "armv7l"]}.get(arch, [arch]) + yield from _manylinux.platform_tags(archs) + yield from _musllinux.platform_tags(archs) + for arch in archs: + yield f"linux_{arch}" + + +def _generic_platforms() -> Iterator[str]: + yield _normalize_string(sysconfig.get_platform()) + + +def platform_tags() -> Iterator[str]: + """ + Provides the platform tags for this installation. + """ + if platform.system() == "Darwin": + return mac_platforms() + elif platform.system() == "Linux": + return _linux_platforms() + else: + return _generic_platforms() + + +def interpreter_name() -> str: + """ + Returns the name of the running interpreter. + + Some implementations have a reserved, two-letter abbreviation which will + be returned when appropriate. + """ + name = sys.implementation.name + return INTERPRETER_SHORT_NAMES.get(name) or name + + +def interpreter_version(*, warn: bool = False) -> str: + """ + Returns the version of the running interpreter. + """ + version = _get_config_var("py_version_nodot", warn=warn) + if version: + version = str(version) + else: + version = _version_nodot(sys.version_info[:2]) + return version + + +def _version_nodot(version: PythonVersion) -> str: + return "".join(map(str, version)) + + +def sys_tags(*, warn: bool = False) -> Iterator[Tag]: + """ + Returns the sequence of tag triples for the running interpreter. + + The order of the sequence corresponds to priority order for the + interpreter, from most to least important. + """ + + interp_name = interpreter_name() + if interp_name == "cp": + yield from cpython_tags(warn=warn) + else: + yield from generic_tags() + + if interp_name == "pp": + interp = "pp3" + elif interp_name == "cp": + interp = "cp" + interpreter_version(warn=warn) + else: + interp = None + yield from compatible_tags(interpreter=interp) diff --git a/distutils/_vendor/packaging/utils.py b/distutils/_vendor/packaging/utils.py new file mode 100644 index 0000000000..c2c2f75aa8 --- /dev/null +++ b/distutils/_vendor/packaging/utils.py @@ -0,0 +1,172 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import re +from typing import FrozenSet, NewType, Tuple, Union, cast + +from .tags import Tag, parse_tag +from .version import InvalidVersion, Version + +BuildTag = Union[Tuple[()], Tuple[int, str]] +NormalizedName = NewType("NormalizedName", str) + + +class InvalidName(ValueError): + """ + An invalid distribution name; users should refer to the packaging user guide. + """ + + +class InvalidWheelFilename(ValueError): + """ + An invalid wheel filename was found, users should refer to PEP 427. + """ + + +class InvalidSdistFilename(ValueError): + """ + An invalid sdist filename was found, users should refer to the packaging user guide. + """ + + +# Core metadata spec for `Name` +_validate_regex = re.compile( + r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE +) +_canonicalize_regex = re.compile(r"[-_.]+") +_normalized_regex = re.compile(r"^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$") +# PEP 427: The build number must start with a digit. +_build_tag_regex = re.compile(r"(\d+)(.*)") + + +def canonicalize_name(name: str, *, validate: bool = False) -> NormalizedName: + if validate and not _validate_regex.match(name): + raise InvalidName(f"name is invalid: {name!r}") + # This is taken from PEP 503. + value = _canonicalize_regex.sub("-", name).lower() + return cast(NormalizedName, value) + + +def is_normalized_name(name: str) -> bool: + return _normalized_regex.match(name) is not None + + +def canonicalize_version( + version: Union[Version, str], *, strip_trailing_zero: bool = True +) -> str: + """ + This is very similar to Version.__str__, but has one subtle difference + with the way it handles the release segment. + """ + if isinstance(version, str): + try: + parsed = Version(version) + except InvalidVersion: + # Legacy versions cannot be normalized + return version + else: + parsed = version + + parts = [] + + # Epoch + if parsed.epoch != 0: + parts.append(f"{parsed.epoch}!") + + # Release segment + release_segment = ".".join(str(x) for x in parsed.release) + if strip_trailing_zero: + # NB: This strips trailing '.0's to normalize + release_segment = re.sub(r"(\.0)+$", "", release_segment) + parts.append(release_segment) + + # Pre-release + if parsed.pre is not None: + parts.append("".join(str(x) for x in parsed.pre)) + + # Post-release + if parsed.post is not None: + parts.append(f".post{parsed.post}") + + # Development release + if parsed.dev is not None: + parts.append(f".dev{parsed.dev}") + + # Local version segment + if parsed.local is not None: + parts.append(f"+{parsed.local}") + + return "".join(parts) + + +def parse_wheel_filename( + filename: str, +) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]: + if not filename.endswith(".whl"): + raise InvalidWheelFilename( + f"Invalid wheel filename (extension must be '.whl'): {filename}" + ) + + filename = filename[:-4] + dashes = filename.count("-") + if dashes not in (4, 5): + raise InvalidWheelFilename( + f"Invalid wheel filename (wrong number of parts): {filename}" + ) + + parts = filename.split("-", dashes - 2) + name_part = parts[0] + # See PEP 427 for the rules on escaping the project name. + if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is None: + raise InvalidWheelFilename(f"Invalid project name: {filename}") + name = canonicalize_name(name_part) + + try: + version = Version(parts[1]) + except InvalidVersion as e: + raise InvalidWheelFilename( + f"Invalid wheel filename (invalid version): {filename}" + ) from e + + if dashes == 5: + build_part = parts[2] + build_match = _build_tag_regex.match(build_part) + if build_match is None: + raise InvalidWheelFilename( + f"Invalid build number: {build_part} in '{filename}'" + ) + build = cast(BuildTag, (int(build_match.group(1)), build_match.group(2))) + else: + build = () + tags = parse_tag(parts[-1]) + return (name, version, build, tags) + + +def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]: + if filename.endswith(".tar.gz"): + file_stem = filename[: -len(".tar.gz")] + elif filename.endswith(".zip"): + file_stem = filename[: -len(".zip")] + else: + raise InvalidSdistFilename( + f"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):" + f" {filename}" + ) + + # We are requiring a PEP 440 version, which cannot contain dashes, + # so we split on the last dash. + name_part, sep, version_part = file_stem.rpartition("-") + if not sep: + raise InvalidSdistFilename(f"Invalid sdist filename: {filename}") + + name = canonicalize_name(name_part) + + try: + version = Version(version_part) + except InvalidVersion as e: + raise InvalidSdistFilename( + f"Invalid sdist filename (invalid version): {filename}" + ) from e + + return (name, version) diff --git a/distutils/_vendor/packaging/version.py b/distutils/_vendor/packaging/version.py new file mode 100644 index 0000000000..5faab9bd0d --- /dev/null +++ b/distutils/_vendor/packaging/version.py @@ -0,0 +1,563 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. +""" +.. testsetup:: + + from packaging.version import parse, Version +""" + +import itertools +import re +from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union + +from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType + +__all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"] + +LocalType = Tuple[Union[int, str], ...] + +CmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]] +CmpLocalType = Union[ + NegativeInfinityType, + Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...], +] +CmpKey = Tuple[ + int, + Tuple[int, ...], + CmpPrePostDevType, + CmpPrePostDevType, + CmpPrePostDevType, + CmpLocalType, +] +VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool] + + +class _Version(NamedTuple): + epoch: int + release: Tuple[int, ...] + dev: Optional[Tuple[str, int]] + pre: Optional[Tuple[str, int]] + post: Optional[Tuple[str, int]] + local: Optional[LocalType] + + +def parse(version: str) -> "Version": + """Parse the given version string. + + >>> parse('1.0.dev1') + + + :param version: The version string to parse. + :raises InvalidVersion: When the version string is not a valid version. + """ + return Version(version) + + +class InvalidVersion(ValueError): + """Raised when a version string is not a valid version. + + >>> Version("invalid") + Traceback (most recent call last): + ... + packaging.version.InvalidVersion: Invalid version: 'invalid' + """ + + +class _BaseVersion: + _key: Tuple[Any, ...] + + def __hash__(self) -> int: + return hash(self._key) + + # Please keep the duplicated `isinstance` check + # in the six comparisons hereunder + # unless you find a way to avoid adding overhead function calls. + def __lt__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key < other._key + + def __le__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key <= other._key + + def __eq__(self, other: object) -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key == other._key + + def __ge__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key >= other._key + + def __gt__(self, other: "_BaseVersion") -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key > other._key + + def __ne__(self, other: object) -> bool: + if not isinstance(other, _BaseVersion): + return NotImplemented + + return self._key != other._key + + +# Deliberately not anchored to the start and end of the string, to make it +# easier for 3rd party code to reuse +_VERSION_PATTERN = r""" + v? + (?: + (?:(?P[0-9]+)!)? # epoch + (?P[0-9]+(?:\.[0-9]+)*) # release segment + (?P
                                          # pre-release
+            [-_\.]?
+            (?Palpha|a|beta|b|preview|pre|c|rc)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+        (?P                                         # post release
+            (?:-(?P[0-9]+))
+            |
+            (?:
+                [-_\.]?
+                (?Ppost|rev|r)
+                [-_\.]?
+                (?P[0-9]+)?
+            )
+        )?
+        (?P                                          # dev release
+            [-_\.]?
+            (?Pdev)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+    )
+    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
+"""
+
+VERSION_PATTERN = _VERSION_PATTERN
+"""
+A string containing the regular expression used to match a valid version.
+
+The pattern is not anchored at either end, and is intended for embedding in larger
+expressions (for example, matching a version number as part of a file name). The
+regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
+flags set.
+
+:meta hide-value:
+"""
+
+
+class Version(_BaseVersion):
+    """This class abstracts handling of a project's versions.
+
+    A :class:`Version` instance is comparison aware and can be compared and
+    sorted using the standard Python interfaces.
+
+    >>> v1 = Version("1.0a5")
+    >>> v2 = Version("1.0")
+    >>> v1
+    
+    >>> v2
+    
+    >>> v1 < v2
+    True
+    >>> v1 == v2
+    False
+    >>> v1 > v2
+    False
+    >>> v1 >= v2
+    False
+    >>> v1 <= v2
+    True
+    """
+
+    _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
+    _key: CmpKey
+
+    def __init__(self, version: str) -> None:
+        """Initialize a Version object.
+
+        :param version:
+            The string representation of a version which will be parsed and normalized
+            before use.
+        :raises InvalidVersion:
+            If the ``version`` does not conform to PEP 440 in any way then this
+            exception will be raised.
+        """
+
+        # Validate the version and parse it into pieces
+        match = self._regex.search(version)
+        if not match:
+            raise InvalidVersion(f"Invalid version: '{version}'")
+
+        # Store the parsed out pieces of the version
+        self._version = _Version(
+            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
+            release=tuple(int(i) for i in match.group("release").split(".")),
+            pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
+            post=_parse_letter_version(
+                match.group("post_l"), match.group("post_n1") or match.group("post_n2")
+            ),
+            dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
+            local=_parse_local_version(match.group("local")),
+        )
+
+        # Generate a key which will be used for sorting
+        self._key = _cmpkey(
+            self._version.epoch,
+            self._version.release,
+            self._version.pre,
+            self._version.post,
+            self._version.dev,
+            self._version.local,
+        )
+
+    def __repr__(self) -> str:
+        """A representation of the Version that shows all internal state.
+
+        >>> Version('1.0.0')
+        
+        """
+        return f""
+
+    def __str__(self) -> str:
+        """A string representation of the version that can be rounded-tripped.
+
+        >>> str(Version("1.0a5"))
+        '1.0a5'
+        """
+        parts = []
+
+        # Epoch
+        if self.epoch != 0:
+            parts.append(f"{self.epoch}!")
+
+        # Release segment
+        parts.append(".".join(str(x) for x in self.release))
+
+        # Pre-release
+        if self.pre is not None:
+            parts.append("".join(str(x) for x in self.pre))
+
+        # Post-release
+        if self.post is not None:
+            parts.append(f".post{self.post}")
+
+        # Development release
+        if self.dev is not None:
+            parts.append(f".dev{self.dev}")
+
+        # Local version segment
+        if self.local is not None:
+            parts.append(f"+{self.local}")
+
+        return "".join(parts)
+
+    @property
+    def epoch(self) -> int:
+        """The epoch of the version.
+
+        >>> Version("2.0.0").epoch
+        0
+        >>> Version("1!2.0.0").epoch
+        1
+        """
+        return self._version.epoch
+
+    @property
+    def release(self) -> Tuple[int, ...]:
+        """The components of the "release" segment of the version.
+
+        >>> Version("1.2.3").release
+        (1, 2, 3)
+        >>> Version("2.0.0").release
+        (2, 0, 0)
+        >>> Version("1!2.0.0.post0").release
+        (2, 0, 0)
+
+        Includes trailing zeroes but not the epoch or any pre-release / development /
+        post-release suffixes.
+        """
+        return self._version.release
+
+    @property
+    def pre(self) -> Optional[Tuple[str, int]]:
+        """The pre-release segment of the version.
+
+        >>> print(Version("1.2.3").pre)
+        None
+        >>> Version("1.2.3a1").pre
+        ('a', 1)
+        >>> Version("1.2.3b1").pre
+        ('b', 1)
+        >>> Version("1.2.3rc1").pre
+        ('rc', 1)
+        """
+        return self._version.pre
+
+    @property
+    def post(self) -> Optional[int]:
+        """The post-release number of the version.
+
+        >>> print(Version("1.2.3").post)
+        None
+        >>> Version("1.2.3.post1").post
+        1
+        """
+        return self._version.post[1] if self._version.post else None
+
+    @property
+    def dev(self) -> Optional[int]:
+        """The development number of the version.
+
+        >>> print(Version("1.2.3").dev)
+        None
+        >>> Version("1.2.3.dev1").dev
+        1
+        """
+        return self._version.dev[1] if self._version.dev else None
+
+    @property
+    def local(self) -> Optional[str]:
+        """The local version segment of the version.
+
+        >>> print(Version("1.2.3").local)
+        None
+        >>> Version("1.2.3+abc").local
+        'abc'
+        """
+        if self._version.local:
+            return ".".join(str(x) for x in self._version.local)
+        else:
+            return None
+
+    @property
+    def public(self) -> str:
+        """The public portion of the version.
+
+        >>> Version("1.2.3").public
+        '1.2.3'
+        >>> Version("1.2.3+abc").public
+        '1.2.3'
+        >>> Version("1.2.3+abc.dev1").public
+        '1.2.3'
+        """
+        return str(self).split("+", 1)[0]
+
+    @property
+    def base_version(self) -> str:
+        """The "base version" of the version.
+
+        >>> Version("1.2.3").base_version
+        '1.2.3'
+        >>> Version("1.2.3+abc").base_version
+        '1.2.3'
+        >>> Version("1!1.2.3+abc.dev1").base_version
+        '1!1.2.3'
+
+        The "base version" is the public version of the project without any pre or post
+        release markers.
+        """
+        parts = []
+
+        # Epoch
+        if self.epoch != 0:
+            parts.append(f"{self.epoch}!")
+
+        # Release segment
+        parts.append(".".join(str(x) for x in self.release))
+
+        return "".join(parts)
+
+    @property
+    def is_prerelease(self) -> bool:
+        """Whether this version is a pre-release.
+
+        >>> Version("1.2.3").is_prerelease
+        False
+        >>> Version("1.2.3a1").is_prerelease
+        True
+        >>> Version("1.2.3b1").is_prerelease
+        True
+        >>> Version("1.2.3rc1").is_prerelease
+        True
+        >>> Version("1.2.3dev1").is_prerelease
+        True
+        """
+        return self.dev is not None or self.pre is not None
+
+    @property
+    def is_postrelease(self) -> bool:
+        """Whether this version is a post-release.
+
+        >>> Version("1.2.3").is_postrelease
+        False
+        >>> Version("1.2.3.post1").is_postrelease
+        True
+        """
+        return self.post is not None
+
+    @property
+    def is_devrelease(self) -> bool:
+        """Whether this version is a development release.
+
+        >>> Version("1.2.3").is_devrelease
+        False
+        >>> Version("1.2.3.dev1").is_devrelease
+        True
+        """
+        return self.dev is not None
+
+    @property
+    def major(self) -> int:
+        """The first item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").major
+        1
+        """
+        return self.release[0] if len(self.release) >= 1 else 0
+
+    @property
+    def minor(self) -> int:
+        """The second item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").minor
+        2
+        >>> Version("1").minor
+        0
+        """
+        return self.release[1] if len(self.release) >= 2 else 0
+
+    @property
+    def micro(self) -> int:
+        """The third item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").micro
+        3
+        >>> Version("1").micro
+        0
+        """
+        return self.release[2] if len(self.release) >= 3 else 0
+
+
+def _parse_letter_version(
+    letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
+) -> Optional[Tuple[str, int]]:
+
+    if letter:
+        # We consider there to be an implicit 0 in a pre-release if there is
+        # not a numeral associated with it.
+        if number is None:
+            number = 0
+
+        # We normalize any letters to their lower case form
+        letter = letter.lower()
+
+        # We consider some words to be alternate spellings of other words and
+        # in those cases we want to normalize the spellings to our preferred
+        # spelling.
+        if letter == "alpha":
+            letter = "a"
+        elif letter == "beta":
+            letter = "b"
+        elif letter in ["c", "pre", "preview"]:
+            letter = "rc"
+        elif letter in ["rev", "r"]:
+            letter = "post"
+
+        return letter, int(number)
+    if not letter and number:
+        # We assume if we are given a number, but we are not given a letter
+        # then this is using the implicit post release syntax (e.g. 1.0-1)
+        letter = "post"
+
+        return letter, int(number)
+
+    return None
+
+
+_local_version_separators = re.compile(r"[\._-]")
+
+
+def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
+    """
+    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
+    """
+    if local is not None:
+        return tuple(
+            part.lower() if not part.isdigit() else int(part)
+            for part in _local_version_separators.split(local)
+        )
+    return None
+
+
+def _cmpkey(
+    epoch: int,
+    release: Tuple[int, ...],
+    pre: Optional[Tuple[str, int]],
+    post: Optional[Tuple[str, int]],
+    dev: Optional[Tuple[str, int]],
+    local: Optional[LocalType],
+) -> CmpKey:
+
+    # When we compare a release version, we want to compare it with all of the
+    # trailing zeros removed. So we'll use a reverse the list, drop all the now
+    # leading zeros until we come to something non zero, then take the rest
+    # re-reverse it back into the correct order and make it a tuple and use
+    # that for our sorting key.
+    _release = tuple(
+        reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
+    )
+
+    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
+    # We'll do this by abusing the pre segment, but we _only_ want to do this
+    # if there is not a pre or a post segment. If we have one of those then
+    # the normal sorting rules will handle this case correctly.
+    if pre is None and post is None and dev is not None:
+        _pre: CmpPrePostDevType = NegativeInfinity
+    # Versions without a pre-release (except as noted above) should sort after
+    # those with one.
+    elif pre is None:
+        _pre = Infinity
+    else:
+        _pre = pre
+
+    # Versions without a post segment should sort before those with one.
+    if post is None:
+        _post: CmpPrePostDevType = NegativeInfinity
+
+    else:
+        _post = post
+
+    # Versions without a development segment should sort after those with one.
+    if dev is None:
+        _dev: CmpPrePostDevType = Infinity
+
+    else:
+        _dev = dev
+
+    if local is None:
+        # Versions without a local segment should sort before those with one.
+        _local: CmpLocalType = NegativeInfinity
+    else:
+        # Versions with a local segment need that segment parsed to implement
+        # the sorting rules in PEP440.
+        # - Alpha numeric segments sort before numeric segments
+        # - Alpha numeric segments sort lexicographically
+        # - Numeric segments sort numerically
+        # - Shorter versions sort before longer versions when the prefixes
+        #   match exactly
+        _local = tuple(
+            (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
+        )
+
+    return epoch, _release, _pre, _post, _dev, _local
diff --git a/distutils/_vendor/ruff.toml b/distutils/_vendor/ruff.toml
new file mode 100644
index 0000000000..00fee625a5
--- /dev/null
+++ b/distutils/_vendor/ruff.toml
@@ -0,0 +1 @@
+exclude = ["*"]

From 96ce7aa3f26e60c72dcaa4e3b467bc563b100a17 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 11 Apr 2024 19:31:14 -0400
Subject: [PATCH 019/151] Use vendored packaging.

---
 distutils/dist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/dist.py b/distutils/dist.py
index 4b3824df7e..f4eb6e8958 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -12,7 +12,7 @@
 import logging
 from email import message_from_file
 
-from packaging.utils import canonicalize_name, canonicalize_version
+from ._vendor.packaging.utils import canonicalize_name, canonicalize_version
 
 try:
     import warnings

From b81e1a5c23e6f94631d5ee1c5accf8ab0f0d4a23 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sun, 10 Mar 2024 14:51:21 +0100
Subject: [PATCH 020/151] Remove extra pairs of quotes from litteral strings

Automated formatting runs such as #149 / ab77f7d left over these extra quotes.
---
 distutils/tests/test_cygwinccompiler.py | 10 +++++-----
 distutils/tests/test_sysconfig.py       |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/distutils/tests/test_cygwinccompiler.py b/distutils/tests/test_cygwinccompiler.py
index 0a66193d35..d95654f5a1 100644
--- a/distutils/tests/test_cygwinccompiler.py
+++ b/distutils/tests/test_cygwinccompiler.py
@@ -80,25 +80,25 @@ def test_get_msvcr(self):
 
         # MSVC 7.0
         sys.version = (
-            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' '[MSC v.1300 32 bits (Intel)]'
+            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1300 32 bits (Intel)]'
         )
         assert get_msvcr() == ['msvcr70']
 
         # MSVC 7.1
         sys.version = (
-            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' '[MSC v.1310 32 bits (Intel)]'
+            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bits (Intel)]'
         )
         assert get_msvcr() == ['msvcr71']
 
         # VS2005 / MSVC 8.0
         sys.version = (
-            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' '[MSC v.1400 32 bits (Intel)]'
+            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1400 32 bits (Intel)]'
         )
         assert get_msvcr() == ['msvcr80']
 
         # VS2008 / MSVC 9.0
         sys.version = (
-            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' '[MSC v.1500 32 bits (Intel)]'
+            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1500 32 bits (Intel)]'
         )
         assert get_msvcr() == ['msvcr90']
 
@@ -110,7 +110,7 @@ def test_get_msvcr(self):
 
         # unknown
         sys.version = (
-            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' '[MSC v.2000 32 bits (Intel)]'
+            '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.2000 32 bits (Intel)]'
         )
         with pytest.raises(ValueError):
             get_msvcr()
diff --git a/distutils/tests/test_sysconfig.py b/distutils/tests/test_sysconfig.py
index c55896661f..faa8e31c98 100644
--- a/distutils/tests/test_sysconfig.py
+++ b/distutils/tests/test_sysconfig.py
@@ -132,12 +132,12 @@ def test_customize_compiler(self):
         assert comp.exes['preprocessor'] == 'env_cpp --env-cppflags'
         assert comp.exes['compiler'] == 'env_cc --sc-cflags --env-cflags --env-cppflags'
         assert comp.exes['compiler_so'] == (
-            'env_cc --sc-cflags ' '--env-cflags ' '--env-cppflags --sc-ccshared'
+            'env_cc --sc-cflags --env-cflags --env-cppflags --sc-ccshared'
         )
         assert comp.exes['compiler_cxx'] == 'env_cxx --env-cxx-flags'
         assert comp.exes['linker_exe'] == 'env_cc'
         assert comp.exes['linker_so'] == (
-            'env_ldshared --env-ldflags --env-cflags' ' --env-cppflags'
+            'env_ldshared --env-ldflags --env-cflags --env-cppflags'
         )
         assert comp.shared_lib_extension == 'sc_shutil_suffix'
 

From b26678d5cc10ae3e97a1025a6298d75cd4ec9ab6 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 09:23:53 -0400
Subject: [PATCH 021/151] Revert the canonicalization of the version. Ref
 pypa/setuptools#3593.

---
 distutils/dist.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/distutils/dist.py b/distutils/dist.py
index f4eb6e8958..fb996e4d95 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -12,7 +12,7 @@
 import logging
 from email import message_from_file
 
-from ._vendor.packaging.utils import canonicalize_name, canonicalize_version
+from ._vendor.packaging.utils import canonicalize_name
 
 try:
     import warnings
@@ -1193,7 +1193,7 @@ def get_version(self):
     def get_fullname(self):
         return "{}-{}".format(
             canonicalize_name(self.get_name()).replace('-', '_'),
-            canonicalize_version(self.get_version()),
+            self.get_version(),
         )
 
     def get_author(self):

From c28f347e93b82fb2e81cb40f284bead6ac3ee095 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 09:26:43 -0400
Subject: [PATCH 022/151] Revert "Update tests to match new expectation."

This reverts commit be32fecc787c3de8c292638c5004a8bcf92dc540.
---
 distutils/tests/test_sdist.py | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/distutils/tests/test_sdist.py b/distutils/tests/test_sdist.py
index 359325d5dc..9856193f71 100644
--- a/distutils/tests/test_sdist.py
+++ b/distutils/tests/test_sdist.py
@@ -118,9 +118,9 @@ def test_prune_file_list(self):
         # now let's check what we have
         dist_folder = join(self.tmp_dir, 'dist')
         files = os.listdir(dist_folder)
-        assert files == ['ns_fake_pkg-1.zip']
+        assert files == ['ns_fake_pkg-1.0.zip']
 
-        zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.zip'))
+        zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.0.zip'))
         try:
             content = zip_file.namelist()
         finally:
@@ -135,7 +135,7 @@ def test_prune_file_list(self):
             'somecode/',
             'somecode/__init__.py',
         ]
-        assert sorted(content) == ['ns_fake_pkg-1/' + x for x in expected]
+        assert sorted(content) == ['ns_fake_pkg-1.0/' + x for x in expected]
 
     @pytest.mark.usefixtures('needs_zlib')
     @pytest.mark.skipif("not find_executable('tar')")
@@ -153,10 +153,10 @@ def test_make_distribution(self):
         dist_folder = join(self.tmp_dir, 'dist')
         result = os.listdir(dist_folder)
         result.sort()
-        assert result == ['ns_fake_pkg-1.tar', 'ns_fake_pkg-1.tar.gz']
+        assert result == ['ns_fake_pkg-1.0.tar', 'ns_fake_pkg-1.0.tar.gz']
 
-        os.remove(join(dist_folder, 'ns_fake_pkg-1.tar'))
-        os.remove(join(dist_folder, 'ns_fake_pkg-1.tar.gz'))
+        os.remove(join(dist_folder, 'ns_fake_pkg-1.0.tar'))
+        os.remove(join(dist_folder, 'ns_fake_pkg-1.0.tar.gz'))
 
         # now trying a tar then a gztar
         cmd.formats = ['tar', 'gztar']
@@ -166,7 +166,7 @@ def test_make_distribution(self):
 
         result = os.listdir(dist_folder)
         result.sort()
-        assert result == ['ns_fake_pkg-1.tar', 'ns_fake_pkg-1.tar.gz']
+        assert result == ['ns_fake_pkg-1.0.tar', 'ns_fake_pkg-1.0.tar.gz']
 
     @pytest.mark.usefixtures('needs_zlib')
     def test_add_defaults(self):
@@ -219,9 +219,9 @@ def test_add_defaults(self):
         # now let's check what we have
         dist_folder = join(self.tmp_dir, 'dist')
         files = os.listdir(dist_folder)
-        assert files == ['ns_fake_pkg-1.zip']
+        assert files == ['ns_fake_pkg-1.0.zip']
 
-        zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.zip'))
+        zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.0.zip'))
         try:
             content = zip_file.namelist()
         finally:
@@ -247,7 +247,7 @@ def test_add_defaults(self):
             'somecode/doc.dat',
             'somecode/doc.txt',
         ]
-        assert sorted(content) == ['ns_fake_pkg-1/' + x for x in expected]
+        assert sorted(content) == ['ns_fake_pkg-1.0/' + x for x in expected]
 
         # checking the MANIFEST
         manifest = pathlib.Path(self.tmp_dir, 'MANIFEST').read_text(encoding='utf-8')
@@ -420,16 +420,16 @@ def test_manual_manifest(self):
 
         assert list(clean_lines(cmd.manifest)) == ['README.manual']
 
-        archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.tar.gz')
+        archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.0.tar.gz')
         archive = tarfile.open(archive_name)
         try:
             filenames = [tarinfo.name for tarinfo in archive]
         finally:
             archive.close()
         assert sorted(filenames) == [
-            'ns_fake_pkg-1',
-            'ns_fake_pkg-1/PKG-INFO',
-            'ns_fake_pkg-1/README.manual',
+            'ns_fake_pkg-1.0',
+            'ns_fake_pkg-1.0/PKG-INFO',
+            'ns_fake_pkg-1.0/README.manual',
         ]
 
     @pytest.mark.usefixtures('needs_zlib')
@@ -449,7 +449,7 @@ def test_make_distribution_owner_group(self):
         cmd.run()
 
         # making sure we have the good rights
-        archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.tar.gz')
+        archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.0.tar.gz')
         archive = tarfile.open(archive_name)
         try:
             for member in archive.getmembers():
@@ -467,7 +467,7 @@ def test_make_distribution_owner_group(self):
         cmd.run()
 
         # making sure we have the good rights
-        archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.tar.gz')
+        archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.0.tar.gz')
         archive = tarfile.open(archive_name)
 
         # note that we are not testing the group ownership here

From 7ad4f2fa9fb2b030d3ecc231fc24de181705622d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 16 Apr 2024 10:31:45 -0400
Subject: [PATCH 023/151] Pin against pytest 8.1.x due to
 pytest-dev/pytest#12194.

---
 setup.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.cfg b/setup.cfg
index f46b6cbff4..05ac4c7620 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -20,7 +20,7 @@ install_requires =
 [options.extras_require]
 testing =
 	# upstream
-	pytest >= 6, != 8.1.1
+	pytest >= 6, != 8.1.*
 	pytest-checkdocs >= 2.4
 	pytest-cov
 	pytest-mypy

From f4529af6a66e34d423860566be7882d665e10569 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bartosz=20S=C5=82awecki?= 
Date: Tue, 16 Apr 2024 22:37:50 +0200
Subject: [PATCH 024/151] Move project metadata to `pyproject.toml`
 (jaraco/skeleton#122)

Intentionally omitted specifying `tool.setuptools.include-package-data`: it's true by default in `pyproject.toml` according to https://setuptools.pypa.io/en/latest/userguide/datafiles.html#include-package-data.

Closes jaraco/skeleton#121
---
 pyproject.toml | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 setup.cfg      | 42 ------------------------------------------
 2 files changed, 48 insertions(+), 43 deletions(-)
 delete mode 100644 setup.cfg

diff --git a/pyproject.toml b/pyproject.toml
index a853c5789e..869fe7e5ba 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,5 +1,52 @@
 [build-system]
-requires = ["setuptools>=56", "setuptools_scm[toml]>=3.4.1"]
+requires = ["setuptools>=61.2", "setuptools_scm[toml]>=3.4.1"]
 build-backend = "setuptools.build_meta"
 
+[project]
+name = "PROJECT"
+authors = [
+	{ name = "Jason R. Coombs", email = "jaraco@jaraco.com" },
+]
+description = "PROJECT_DESCRIPTION"
+readme = "README.rst"
+classifiers = [
+	"Development Status :: 5 - Production/Stable",
+	"Intended Audience :: Developers",
+	"License :: OSI Approved :: MIT License",
+	"Programming Language :: Python :: 3",
+	"Programming Language :: Python :: 3 :: Only",
+]
+requires-python = ">=3.8"
+dependencies = [
+]
+dynamic = ["version"]
+
+[project.optional-dependencies]
+testing = [
+	# upstream
+	"pytest >= 6, != 8.1.*",
+	"pytest-checkdocs >= 2.4",
+	"pytest-cov",
+	"pytest-mypy",
+	"pytest-enabler >= 2.2",
+	"pytest-ruff >= 0.2.1",
+
+	# local
+]
+docs = [
+	# upstream
+	"sphinx >= 3.5",
+	"jaraco.packaging >= 9.3",
+	"rst.linker >= 1.9",
+	"furo",
+	"sphinx-lint",
+
+	# local
+]
+
+[project.urls]
+Homepage = "https://github.com/PROJECT_PATH"
+
+[project.scripts]
+
 [tool.setuptools_scm]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 05ac4c7620..0000000000
--- a/setup.cfg
+++ /dev/null
@@ -1,42 +0,0 @@
-[metadata]
-name = PROJECT
-author = Jason R. Coombs
-author_email = jaraco@jaraco.com
-description = PROJECT_DESCRIPTION
-long_description = file:README.rst
-url = https://github.com/PROJECT_PATH
-classifiers =
-	Development Status :: 5 - Production/Stable
-	Intended Audience :: Developers
-	License :: OSI Approved :: MIT License
-	Programming Language :: Python :: 3
-	Programming Language :: Python :: 3 :: Only
-
-[options]
-include_package_data = true
-python_requires = >=3.8
-install_requires =
-
-[options.extras_require]
-testing =
-	# upstream
-	pytest >= 6, != 8.1.*
-	pytest-checkdocs >= 2.4
-	pytest-cov
-	pytest-mypy
-	pytest-enabler >= 2.2
-	pytest-ruff >= 0.2.1
-
-	# local
-
-docs =
-	# upstream
-	sphinx >= 3.5
-	jaraco.packaging >= 9.3
-	rst.linker >= 1.9
-	furo
-	sphinx-lint
-
-	# local
-
-[options.entry_points]

From 744cf2a2befb6a616657c105e5c9be9f3f921224 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 24 Apr 2024 10:48:06 -0400
Subject: [PATCH 025/151] Allow macos on Python 3.8 to fail as GitHub CI has
 dropped support.

Closes jaraco/skeleton#124.
---
 .github/workflows/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ac0ff69e22..5ace4c504f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -50,7 +50,7 @@ jobs:
         - python: pypy3.10
           platform: ubuntu-latest
     runs-on: ${{ matrix.platform }}
-    continue-on-error: ${{ matrix.python == '3.13' }}
+    continue-on-error: ${{ matrix.python == '3.13' || (matrix.python == '3.8' || matrix.python == '3.9') && matrix.platform == 'macos-latest' }}
     steps:
       - uses: actions/checkout@v4
       - name: Setup Python

From bcf8f079eb729e7bcd50c10cf4da522620b00635 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 24 Apr 2024 11:06:12 -0400
Subject: [PATCH 026/151] Move project.urls to appear in the order that
 ini2toml generates it. Remove project.scripts.

---
 pyproject.toml | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 869fe7e5ba..04b14cbc79 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -21,6 +21,9 @@ dependencies = [
 ]
 dynamic = ["version"]
 
+[project.urls]
+Homepage = "https://github.com/PROJECT_PATH"
+
 [project.optional-dependencies]
 testing = [
 	# upstream
@@ -44,9 +47,4 @@ docs = [
 	# local
 ]
 
-[project.urls]
-Homepage = "https://github.com/PROJECT_PATH"
-
-[project.scripts]
-
 [tool.setuptools_scm]

From 67aab1554c7c9cbb19bb546a5b6476267030c5b5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 2 May 2024 15:36:22 -0400
Subject: [PATCH 027/151] Revert "Allow macos on Python 3.8 to fail as GitHub
 CI has dropped support."

This reverts commit 744cf2a2befb6a616657c105e5c9be9f3f921224.
---
 .github/workflows/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5ace4c504f..ac0ff69e22 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -50,7 +50,7 @@ jobs:
         - python: pypy3.10
           platform: ubuntu-latest
     runs-on: ${{ matrix.platform }}
-    continue-on-error: ${{ matrix.python == '3.13' || (matrix.python == '3.8' || matrix.python == '3.9') && matrix.platform == 'macos-latest' }}
+    continue-on-error: ${{ matrix.python == '3.13' }}
     steps:
       - uses: actions/checkout@v4
       - name: Setup Python

From a595a0fad054cd20b69d3e954c99174e3a548938 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 31 May 2024 03:53:48 -0400
Subject: [PATCH 028/151] Rename extras to align with core metadata spec.

Closes jaraco/skeleton#125.
---
 .readthedocs.yaml | 2 +-
 pyproject.toml    | 4 ++--
 tox.ini           | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index 85dfea9d42..dc8516ac20 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -3,7 +3,7 @@ python:
   install:
   - path: .
     extra_requirements:
-      - docs
+      - doc
 
 # required boilerplate readthedocs/readthedocs.org#10401
 build:
diff --git a/pyproject.toml b/pyproject.toml
index 04b14cbc79..50845ee304 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -25,7 +25,7 @@ dynamic = ["version"]
 Homepage = "https://github.com/PROJECT_PATH"
 
 [project.optional-dependencies]
-testing = [
+test = [
 	# upstream
 	"pytest >= 6, != 8.1.*",
 	"pytest-checkdocs >= 2.4",
@@ -36,7 +36,7 @@ testing = [
 
 	# local
 ]
-docs = [
+doc = [
 	# upstream
 	"sphinx >= 3.5",
 	"jaraco.packaging >= 9.3",
diff --git a/tox.ini b/tox.ini
index 4c39a5b139..cc4db36e76 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,7 +7,7 @@ commands =
 	pytest {posargs}
 usedevelop = True
 extras =
-	testing
+	test
 
 [testenv:diffcov]
 description = run tests and check that diff from main is covered
@@ -22,8 +22,8 @@ commands =
 [testenv:docs]
 description = build the documentation
 extras =
-	docs
-	testing
+	doc
+	test
 changedir = docs
 commands =
 	python -m sphinx -W --keep-going . {toxinidir}/build/html

From ac4f52ad8c34613bd82579bd3a3b38d57914bda9 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 1 Jun 2024 05:02:27 -0400
Subject: [PATCH 029/151] Suppress deprecation warning about stdlib distutils
 being deprecated.

---
 pytest.ini | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pytest.ini b/pytest.ini
index 57ab865366..e49b81561a 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -73,6 +73,9 @@ filterwarnings=
 	# suppress warnings in deprecated msvc compilers
 	ignore:(bcpp|msvc9?)compiler is deprecated
 
+	# Ignore warnings about deprecated stdlib distutils pypa/setuptools#4137
+	ignore:Reliance on distutils from stdlib is deprecated
+
 	ignore::setuptools.command.editable_wheel.InformationOnly
 
 	# https://github.com/pypa/setuptools/issues/3655

From dc90abca19072da5807ba57c2077e00f6e47fb8c Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 1 Jun 2024 05:06:52 -0400
Subject: [PATCH 030/151] Add news fragment.

---
 newsfragments/4137.feature.rst | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 newsfragments/4137.feature.rst

diff --git a/newsfragments/4137.feature.rst b/newsfragments/4137.feature.rst
new file mode 100644
index 0000000000..89ca0cb758
--- /dev/null
+++ b/newsfragments/4137.feature.rst
@@ -0,0 +1 @@
+Support for loading distutils from the standard library is now deprecated, including use of SETUPTOOLS_USE_DISTUTILS=stdlib and importing distutils before importing setuptools.
\ No newline at end of file

From d4ffbb1d2ad0da57422a8b35f80b276c570f383b Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Thu, 20 Jun 2024 11:10:08 +0100
Subject: [PATCH 031/151] Remove unecessary WheelFile usage in tests

---
 setuptools/tests/test_bdist_wheel.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/setuptools/tests/test_bdist_wheel.py b/setuptools/tests/test_bdist_wheel.py
index 5d28368c88..d257651ad3 100644
--- a/setuptools/tests/test_bdist_wheel.py
+++ b/setuptools/tests/test_bdist_wheel.py
@@ -25,7 +25,6 @@
     remove_readonly_exc,
 )
 from setuptools.extern.packaging import tags
-from setuptools.extern.wheel.wheelfile import WheelFile
 
 DEFAULT_FILES = {
     "dummy_dist-1.0.dist-info/top_level.txt",
@@ -170,7 +169,7 @@ def test_licenses_default(dummy_dist, monkeypatch, tmp_path):
         str(tmp_path),
         "--universal",
     ])
-    with WheelFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
+    with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         license_files = {
             "dummy_dist-1.0.dist-info/" + fname for fname in DEFAULT_LICENSE_FILES
         }
@@ -190,7 +189,7 @@ def test_licenses_deprecated(dummy_dist, monkeypatch, tmp_path):
         str(tmp_path),
         "--universal",
     ])
-    with WheelFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
+    with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         license_files = {"dummy_dist-1.0.dist-info/DUMMYFILE"}
         assert set(wf.namelist()) == DEFAULT_FILES | license_files
 
@@ -219,7 +218,7 @@ def test_licenses_override(dummy_dist, monkeypatch, tmp_path, config_file, confi
         str(tmp_path),
         "--universal",
     ])
-    with WheelFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
+    with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         license_files = {
             "dummy_dist-1.0.dist-info/" + fname for fname in {"DUMMYFILE", "LICENSE"}
         }
@@ -239,7 +238,7 @@ def test_licenses_disabled(dummy_dist, monkeypatch, tmp_path):
         str(tmp_path),
         "--universal",
     ])
-    with WheelFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
+    with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         assert set(wf.namelist()) == DEFAULT_FILES
 
 
@@ -254,7 +253,7 @@ def test_build_number(dummy_dist, monkeypatch, tmp_path):
         "--universal",
         "--build-number=2",
     ])
-    with WheelFile("dist/dummy_dist-1.0-2-py2.py3-none-any.whl") as wf:
+    with ZipFile("dist/dummy_dist-1.0-2-py2.py3-none-any.whl") as wf:
         filenames = set(wf.namelist())
         assert "dummy_dist-1.0.dist-info/RECORD" in filenames
         assert "dummy_dist-1.0.dist-info/METADATA" in filenames
@@ -307,7 +306,7 @@ def test_compression(dummy_dist, monkeypatch, tmp_path, option, compress_type):
         "--universal",
         f"--compression={option}",
     ])
-    with WheelFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
+    with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         filenames = set(wf.namelist())
         assert "dummy_dist-1.0.dist-info/RECORD" in filenames
         assert "dummy_dist-1.0.dist-info/METADATA" in filenames
@@ -317,7 +316,7 @@ def test_compression(dummy_dist, monkeypatch, tmp_path, option, compress_type):
 
 def test_wheelfile_line_endings(wheel_paths):
     for path in wheel_paths:
-        with WheelFile(path) as wf:
+        with ZipFile(path) as wf:
             wheelfile = next(fn for fn in wf.filelist if fn.filename.endswith("WHEEL"))
             wheelfile_contents = wf.read(wheelfile)
             assert b"\r" not in wheelfile_contents

From beb112ab78a12c659c06b3c7c01836ee6acbe903 Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Thu, 20 Jun 2024 12:01:21 +0100
Subject: [PATCH 032/151] Inline test_bdist_wheel examples and run bdist_wheel
 in process

---
 setuptools/tests/test_bdist_wheel.py | 350 ++++++++++++++++++---------
 1 file changed, 232 insertions(+), 118 deletions(-)

diff --git a/setuptools/tests/test_bdist_wheel.py b/setuptools/tests/test_bdist_wheel.py
index d257651ad3..a20ebd0546 100644
--- a/setuptools/tests/test_bdist_wheel.py
+++ b/setuptools/tests/test_bdist_wheel.py
@@ -7,23 +7,25 @@
 import shutil
 import stat
 import struct
-import subprocess
 import sys
 import sysconfig
 from contextlib import suppress
-from functools import partial
 from inspect import cleandoc
 from unittest.mock import Mock
 from zipfile import ZipFile
 
+import jaraco.path
 import pytest
+
 import setuptools
+from distutils.core import run_setup
 from setuptools.command.bdist_wheel import (
     bdist_wheel,
     get_abi_tag,
     remove_readonly,
     remove_readonly_exc,
 )
+from setuptools.dist import Distribution
 from setuptools.extern.packaging import tags
 
 DEFAULT_FILES = {
@@ -58,51 +60,187 @@
 """
 
 
-@pytest.fixture(scope="module")
-def wheel_paths(request, tmp_path_factory):
-    test_distributions = (
-        "complex-dist",
-        "simple.dist",
-        "headers.dist",
-        "commasinfilenames.dist",
-        "unicode.dist",
+EXAMPLES = {
+    "dummy-dist": {
+        "setup.py": SETUPPY_EXAMPLE,
+        "licenses": {"DUMMYFILE": ""},
+        **dict.fromkeys(DEFAULT_LICENSE_FILES | OTHER_IGNORED_FILES, ""),
+    },
+    "simple-dist": {
+        "setup.py": cleandoc(
+            """
+            from setuptools import setup
+
+            setup(
+                name="simple.dist",
+                version="0.1",
+                description="A testing distribution \N{SNOWMAN}",
+                extras_require={"voting": ["beaglevote"]},
+            )
+            """
+        ),
+        "simpledist": "",
+    },
+    "complex-dist": {
+        "setup.py": cleandoc(
+            """
+            from setuptools import setup
+
+            setup(
+                name="complex-dist",
+                version="0.1",
+                description="Another testing distribution \N{SNOWMAN}",
+                long_description="Another testing distribution \N{SNOWMAN}",
+                author="Illustrious Author",
+                author_email="illustrious@example.org",
+                url="http://example.org/exemplary",
+                packages=["complexdist"],
+                setup_requires=["setuptools"],
+                install_requires=["quux", "splort"],
+                extras_require={"simple": ["simple.dist"]},
+                tests_require=["foo", "bar>=10.0.0"],
+                entry_points={
+                    "console_scripts": [
+                        "complex-dist=complexdist:main",
+                        "complex-dist2=complexdist:main",
+                    ],
+                },
+            )
+            """
+        ),
+        "complexdist": {"__init__.py": "def main(): return"},
+    },
+    "headers-dist": {
+        "setup.py": cleandoc(
+            """
+            from setuptools import setup
+
+            setup(
+                name="headers.dist",
+                version="0.1",
+                description="A distribution with headers",
+                headers=["header.h"],
+            )
+            """
+        ),
+        "setup.cfg": "[bdist_wheel]\nuniversal=1",
+        "headersdist.py": "",
+        "header.h": "",
+    },
+    "commasinfilenames-dist": {
+        "setup.py": cleandoc(
+            """
+            from setuptools import setup
+
+            setup(
+                name="testrepo",
+                version="0.1",
+                packages=["mypackage"],
+                description="A test package with commas in file names",
+                include_package_data=True,
+                package_data={"mypackage.data": ["*"]},
+            )
+            """
+        ),
+        "mypackage": {
+            "__init__.py": "",
+            "data": {"__init__.py": "", "1,2,3.txt": ""},
+        },
+        "testrepo-0.1.0": {
+            "mypackage": {"__init__.py": ""},
+        },
+    },
+    "unicode-dist": {
+        "setup.py": cleandoc(
+            """
+            from setuptools import setup
+
+            setup(
+                name="unicode.dist",
+                version="0.1",
+                description="A testing distribution \N{SNOWMAN}",
+                packages=["unicodedist"],
+            )
+            """
+        ),
+        "unicodedist": {"__init__.py": "", "åäö_日本語.py": ""},
+    },
+    "utf8-metadata-dist": {
+        "setup.cfg": cleandoc(
+            """
+            [metadata]
+            name = utf8-metadata-dist
+            version = 42
+            author_email = "John X. Ãørçeč" , Γαμα קּ 東 
+            long_description = file: README.rst
+            """
+        ),
+        "README.rst": "UTF-8 描述 説明",
+    },
+}
+
+
+if sys.platform != "win32":
+    # ABI3 extensions don't really work on Windows
+    EXAMPLES["abi3extension-dist"] = {
+        "setup.py": cleandoc(
+            """
+            from setuptools import Extension, setup
+
+            setup(
+                name="extension.dist",
+                version="0.1",
+                description="A testing distribution \N{SNOWMAN}",
+                ext_modules=[
+                    Extension(
+                        name="extension", sources=["extension.c"], py_limited_api=True
+                    )
+                ],
+            )
+            """
+        ),
+        "setup.cfg": "[bdist_wheel]\npy_limited_api=cp32",
+        "extension.c": "#define Py_LIMITED_API 0x03020000\n#include ",
+    }
+
+
+def bdist_wheel_cmd(**kwargs):
+    """Run command in the same process so that it is easier to collect coverage"""
+    dist_obj = (
+        run_setup("setup.py", stop_after="init")
+        if os.path.exists("setup.py")
+        else Distribution({"script_name": "%%build_meta%%"})
     )
+    dist_obj.parse_config_files()
+    cmd = bdist_wheel(dist_obj)
+    for attr, value in kwargs.items():
+        setattr(cmd, attr, value)
+    cmd.finalize_options()
+    return cmd
+
+
+def mkexample(tmp_path_factory, name):
+    basedir = tmp_path_factory.mktemp(name)
+    jaraco.path.build(EXAMPLES[name], prefix=str(basedir))
+    return basedir
 
-    if sys.platform != "win32":
-        # ABI3 extensions don't really work on Windows
-        test_distributions += ("abi3extension.dist",)
 
-    pwd = os.path.abspath(os.curdir)
-    request.addfinalizer(partial(os.chdir, pwd))
-    this_dir = os.path.dirname(__file__)
-    build_dir = tmp_path_factory.mktemp("build")
+@pytest.fixture(scope="session")
+def wheel_paths(tmp_path_factory):
+    build_base = tmp_path_factory.mktemp("build")
     dist_dir = tmp_path_factory.mktemp("dist")
-    for dist in test_distributions:
-        os.chdir(os.path.join(this_dir, "bdist_wheel_testdata", dist))
-        subprocess.check_call([
-            sys.executable,
-            "setup.py",
-            "bdist_wheel",
-            "-b",
-            str(build_dir),
-            "-d",
-            str(dist_dir),
-        ])
+    for name in EXAMPLES:
+        example_dir = mkexample(tmp_path_factory, name)
+        build_dir = build_base / name
+        with jaraco.path.DirectoryStack().context(example_dir):
+            bdist_wheel_cmd(bdist_dir=str(build_dir), dist_dir=str(dist_dir)).run()
 
-    return sorted(str(fname) for fname in dist_dir.iterdir() if fname.suffix == ".whl")
+    return sorted(str(fname) for fname in dist_dir.glob("*.whl"))
 
 
 @pytest.fixture
 def dummy_dist(tmp_path_factory):
-    basedir = tmp_path_factory.mktemp("dummy_dist")
-    basedir.joinpath("setup.py").write_text(SETUPPY_EXAMPLE, encoding="utf-8")
-    for fname in DEFAULT_LICENSE_FILES | OTHER_IGNORED_FILES:
-        basedir.joinpath(fname).write_text("", encoding="utf-8")
-
-    licensedir = basedir.joinpath("licenses")
-    licensedir.mkdir()
-    licensedir.joinpath("DUMMYFILE").write_text("", encoding="utf-8")
-    return basedir
+    return mkexample(tmp_path_factory, "dummy-dist")
 
 
 def test_no_scripts(wheel_paths):
@@ -161,14 +299,7 @@ def license_paths(self):
 
 def test_licenses_default(dummy_dist, monkeypatch, tmp_path):
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(tmp_path),
-        "--universal",
-    ])
+    bdist_wheel_cmd(bdist_dir=str(tmp_path), universal=True).run()
     with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         license_files = {
             "dummy_dist-1.0.dist-info/" + fname for fname in DEFAULT_LICENSE_FILES
@@ -181,14 +312,9 @@ def test_licenses_deprecated(dummy_dist, monkeypatch, tmp_path):
         "[metadata]\nlicense_file=licenses/DUMMYFILE", encoding="utf-8"
     )
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(tmp_path),
-        "--universal",
-    ])
+
+    bdist_wheel_cmd(bdist_dir=str(tmp_path), universal=True).run()
+
     with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         license_files = {"dummy_dist-1.0.dist-info/DUMMYFILE"}
         assert set(wf.namelist()) == DEFAULT_FILES | license_files
@@ -210,14 +336,7 @@ def test_licenses_deprecated(dummy_dist, monkeypatch, tmp_path):
 def test_licenses_override(dummy_dist, monkeypatch, tmp_path, config_file, config):
     dummy_dist.joinpath(config_file).write_text(config, encoding="utf-8")
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(tmp_path),
-        "--universal",
-    ])
+    bdist_wheel_cmd(bdist_dir=str(tmp_path), universal=True).run()
     with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         license_files = {
             "dummy_dist-1.0.dist-info/" + fname for fname in {"DUMMYFILE", "LICENSE"}
@@ -230,51 +349,65 @@ def test_licenses_disabled(dummy_dist, monkeypatch, tmp_path):
         "[metadata]\nlicense_files=\n", encoding="utf-8"
     )
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(tmp_path),
-        "--universal",
-    ])
+    bdist_wheel_cmd(bdist_dir=str(tmp_path), universal=True).run()
     with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         assert set(wf.namelist()) == DEFAULT_FILES
 
 
 def test_build_number(dummy_dist, monkeypatch, tmp_path):
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(tmp_path),
-        "--universal",
-        "--build-number=2",
-    ])
+    bdist_wheel_cmd(bdist_dir=str(tmp_path), build_number="2", universal=True).run()
     with ZipFile("dist/dummy_dist-1.0-2-py2.py3-none-any.whl") as wf:
         filenames = set(wf.namelist())
         assert "dummy_dist-1.0.dist-info/RECORD" in filenames
         assert "dummy_dist-1.0.dist-info/METADATA" in filenames
 
 
-def test_limited_abi(monkeypatch, tmp_path):
+EXTENSION_EXAMPLE = """\
+#include 
+
+static PyMethodDef methods[] = {
+  { NULL, NULL, 0, NULL }
+};
+
+static struct PyModuleDef module_def = {
+  PyModuleDef_HEAD_INIT,
+  "extension",
+  "Dummy extension module",
+  -1,
+  methods
+};
+
+PyMODINIT_FUNC PyInit_extension(void) {
+  return PyModule_Create(&module_def);
+}
+"""
+EXTENSION_SETUPPY = """\
+from __future__ import annotations
+
+from setuptools import Extension, setup
+
+setup(
+    name="extension.dist",
+    version="0.1",
+    description="A testing distribution \N{SNOWMAN}",
+    ext_modules=[Extension(name="extension", sources=["extension.c"])],
+)
+"""
+
+
+@pytest.mark.filterwarnings(
+    "once:Config variable '.*' is unset.*, Python ABI tag may be incorrect"
+)
+def test_limited_abi(monkeypatch, tmp_path, tmp_path_factory):
     """Test that building a binary wheel with the limited ABI works."""
-    this_dir = os.path.dirname(__file__)
-    source_dir = os.path.join(this_dir, "bdist_wheel_testdata", "extension.dist")
+    source_dir = tmp_path_factory.mktemp("extension_dist")
+    (source_dir / "setup.py").write_text(EXTENSION_SETUPPY, encoding="utf-8")
+    (source_dir / "extension.c").write_text(EXTENSION_EXAMPLE, encoding="utf-8")
     build_dir = tmp_path.joinpath("build")
     dist_dir = tmp_path.joinpath("dist")
     monkeypatch.chdir(source_dir)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(build_dir),
-        "-d",
-        str(dist_dir),
-    ])
+    bdist_wheel_cmd(bdist_dir=str(build_dir), dist_dir=str(dist_dir)).run()
 
 
 def test_build_from_readonly_tree(dummy_dist, monkeypatch, tmp_path):
@@ -287,7 +420,7 @@ def test_build_from_readonly_tree(dummy_dist, monkeypatch, tmp_path):
         for fname in files:
             os.chmod(os.path.join(root, fname), stat.S_IREAD)
 
-    subprocess.check_call([sys.executable, "setup.py", "bdist_wheel"])
+    bdist_wheel_cmd().run()
 
 
 @pytest.mark.parametrize(
@@ -297,15 +430,7 @@ def test_build_from_readonly_tree(dummy_dist, monkeypatch, tmp_path):
 )
 def test_compression(dummy_dist, monkeypatch, tmp_path, option, compress_type):
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(tmp_path),
-        "--universal",
-        f"--compression={option}",
-    ])
+    bdist_wheel_cmd(bdist_dir=str(tmp_path), universal=True, compression=option).run()
     with ZipFile("dist/dummy_dist-1.0-py2.py3-none-any.whl") as wf:
         filenames = set(wf.namelist())
         assert "dummy_dist-1.0.dist-info/RECORD" in filenames
@@ -325,15 +450,10 @@ def test_wheelfile_line_endings(wheel_paths):
 def test_unix_epoch_timestamps(dummy_dist, monkeypatch, tmp_path):
     monkeypatch.setenv("SOURCE_DATE_EPOCH", "0")
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "-b",
-        str(tmp_path),
-        "--universal",
-        "--build-number=2",
-    ])
+    bdist_wheel_cmd(bdist_dir=str(tmp_path), build_number="2a", universal=True).run()
+    with ZipFile("dist/dummy_dist-1.0-2a-py2.py3-none-any.whl") as wf:
+        for zinfo in wf.filelist:
+            assert zinfo.date_time >= (1980, 1, 1, 0, 0, 0)  # min epoch is used
 
 
 def test_get_abi_tag_windows(monkeypatch):
@@ -371,13 +491,7 @@ def test_get_abi_tag_fallback(monkeypatch):
 def test_platform_with_space(dummy_dist, monkeypatch):
     """Ensure building on platforms with a space in the name succeed."""
     monkeypatch.chdir(dummy_dist)
-    subprocess.check_call([
-        sys.executable,
-        "setup.py",
-        "bdist_wheel",
-        "--plat-name",
-        "isilon onefs",
-    ])
+    bdist_wheel_cmd(plat_name="isilon onefs").run()
 
 
 def test_rmtree_readonly(monkeypatch, tmp_path):
@@ -435,7 +549,7 @@ def test_data_dir_with_tag_build(monkeypatch, tmp_path):
         with open(file, "w", encoding="utf-8") as fh:
             fh.write(cleandoc(content))
 
-    subprocess.check_call([sys.executable, "setup.py", "bdist_wheel"])
+    bdist_wheel_cmd().run()
 
     # Ensure .whl, .dist-info and .data contain the local segment
     wheel_path = "dist/test-1.0+what-py3-none-any.whl"

From 61e18ff75de5e77b2587efaa56f473e3ed78936d Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Thu, 20 Jun 2024 12:07:00 +0100
Subject: [PATCH 033/151] Adopt latest change from wheel test

From https://github.com/pypa/wheel/commit/dedcc19f517c08899cbe730783cb900e0c6111c0
---
 setuptools/tests/test_bdist_wheel.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/setuptools/tests/test_bdist_wheel.py b/setuptools/tests/test_bdist_wheel.py
index a20ebd0546..232b66d368 100644
--- a/setuptools/tests/test_bdist_wheel.py
+++ b/setuptools/tests/test_bdist_wheel.py
@@ -160,6 +160,7 @@
                 version="0.1",
                 description="A testing distribution \N{SNOWMAN}",
                 packages=["unicodedist"],
+                zip_safe=True,
             )
             """
         ),

From ffea3b0abc3425e21c578bcd1460e366f7d0f34f Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Thu, 20 Jun 2024 12:08:19 +0100
Subject: [PATCH 034/151] Remove no longer used bdist_wheel_testdata directory

---
 .../abi3extension.dist/extension.c            |   2 --
 .../abi3extension.dist/setup.cfg              |   2 --
 .../abi3extension.dist/setup.py               |  12 ---------
 .../mypackage/__init__.py                     |   0
 .../mypackage/data/1,2,3.txt                  |   0
 .../mypackage/data/__init__.py                |   0
 .../commasinfilenames.dist/setup.py           |  12 ---------
 .../testrepo-0.1.0/mypackage/__init__.py      |   0
 .../complex-dist/complexdist/__init__.py      |   5 ----
 .../complex-dist/setup.py                     |  24 ------------------
 .../extension.dist/extension.abi3.so          | Bin 23312 -> 0 bytes
 .../extension.dist/extension.c                |  17 -------------
 .../extension.dist/setup.py                   |  10 --------
 .../headers.dist/header.h                     |   0
 .../headers.dist/headersdist.py               |   0
 .../headers.dist/setup.cfg                    |   2 --
 .../headers.dist/setup.py                     |  10 --------
 .../macosx_minimal_system_version/libb.dylib  | Bin 9544 -> 0 bytes
 .../macosx_minimal_system_version/test_lib.c  |  13 ----------
 .../test_lib_10_10.dylib                      | Bin 756 -> 0 bytes
 .../test_lib_10_10_10.dylib                   | Bin 756 -> 0 bytes
 .../test_lib_10_10_386.dylib                  | Bin 668 -> 0 bytes
 .../test_lib_10_10_fat.dylib                  | Bin 8948 -> 0 bytes
 .../test_lib_10_14.dylib                      | Bin 764 -> 0 bytes
 .../test_lib_10_14_386.dylib                  | Bin 676 -> 0 bytes
 .../test_lib_10_14_fat.dylib                  | Bin 8956 -> 0 bytes
 .../test_lib_10_6.dylib                       | Bin 756 -> 0 bytes
 .../test_lib_10_6_386.dylib                   | Bin 668 -> 0 bytes
 .../test_lib_10_6_fat.dylib                   | Bin 8948 -> 0 bytes
 .../test_lib_10_9_universal2.dylib            | Bin 65936 -> 0 bytes
 .../test_lib_11.dylib                         | Bin 16464 -> 0 bytes
 .../test_lib_multiple_fat.dylib               | Bin 8956 -> 0 bytes
 .../bdist_wheel_testdata/simple.dist/setup.py |  11 --------
 .../simple.dist/simpledist/__init__.py        |   0
 .../unicode.dist/setup.py                     |  11 --------
 .../unicode.dist/unicodedist/__init__.py      |   0
 ...6_\346\227\245\346\234\254\350\252\236.py" |   0
 37 files changed, 131 deletions(-)
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/abi3extension.dist/extension.c
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.cfg
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/__init__.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/data/1,2,3.txt
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/data/__init__.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/setup.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/testrepo-0.1.0/mypackage/__init__.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/complex-dist/complexdist/__init__.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/complex-dist/setup.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/extension.dist/extension.abi3.so
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/extension.dist/extension.c
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/extension.dist/setup.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/headers.dist/header.h
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/headers.dist/headersdist.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/headers.dist/setup.cfg
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/headers.dist/setup.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/libb.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib.c
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10_10.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10_386.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10_fat.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_14.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_14_386.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_14_fat.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_6.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_6_386.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_6_fat.dylib
 delete mode 100755 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_9_universal2.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_11.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_multiple_fat.dylib
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/simple.dist/setup.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/simple.dist/simpledist/__init__.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/unicode.dist/setup.py
 delete mode 100644 setuptools/tests/bdist_wheel_testdata/unicode.dist/unicodedist/__init__.py
 delete mode 100644 "setuptools/tests/bdist_wheel_testdata/unicode.dist/unicodedist/\303\245\303\244\303\266_\346\227\245\346\234\254\350\252\236.py"

diff --git a/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/extension.c b/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/extension.c
deleted file mode 100644
index a37c3fa2dc..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/extension.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define Py_LIMITED_API 0x03020000
-#include 
diff --git a/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.cfg b/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.cfg
deleted file mode 100644
index 9f6ff39a0f..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[bdist_wheel]
-py_limited_api=cp32
diff --git a/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.py b/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.py
deleted file mode 100644
index 5962bd1552..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/abi3extension.dist/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from __future__ import annotations
-
-from setuptools import Extension, setup
-
-setup(
-    name="extension.dist",
-    version="0.1",
-    description="A testing distribution \N{SNOWMAN}",
-    ext_modules=[
-        Extension(name="extension", sources=["extension.c"], py_limited_api=True)
-    ],
-)
diff --git a/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/__init__.py b/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/data/1,2,3.txt b/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/data/1,2,3.txt
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/data/__init__.py b/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/mypackage/data/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/setup.py b/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/setup.py
deleted file mode 100644
index a2783a3b62..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from __future__ import annotations
-
-from setuptools import setup
-
-setup(
-    name="testrepo",
-    version="0.1",
-    packages=["mypackage"],
-    description="A test package with commas in file names",
-    include_package_data=True,
-    package_data={"mypackage.data": ["*"]},
-)
diff --git a/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/testrepo-0.1.0/mypackage/__init__.py b/setuptools/tests/bdist_wheel_testdata/commasinfilenames.dist/testrepo-0.1.0/mypackage/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/setuptools/tests/bdist_wheel_testdata/complex-dist/complexdist/__init__.py b/setuptools/tests/bdist_wheel_testdata/complex-dist/complexdist/__init__.py
deleted file mode 100644
index 88aa7b76a4..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/complex-dist/complexdist/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from __future__ import annotations
-
-
-def main():
-    return
diff --git a/setuptools/tests/bdist_wheel_testdata/complex-dist/setup.py b/setuptools/tests/bdist_wheel_testdata/complex-dist/setup.py
deleted file mode 100644
index e0439d9ef4..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/complex-dist/setup.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from __future__ import annotations
-
-from setuptools import setup
-
-setup(
-    name="complex-dist",
-    version="0.1",
-    description="Another testing distribution \N{SNOWMAN}",
-    long_description="Another testing distribution \N{SNOWMAN}",
-    author="Illustrious Author",
-    author_email="illustrious@example.org",
-    url="http://example.org/exemplary",
-    packages=["complexdist"],
-    setup_requires=["wheel", "setuptools"],
-    install_requires=["quux", "splort"],
-    extras_require={"simple": ["simple.dist"]},
-    tests_require=["foo", "bar>=10.0.0"],
-    entry_points={
-        "console_scripts": [
-            "complex-dist=complexdist:main",
-            "complex-dist2=complexdist:main",
-        ],
-    },
-)
diff --git a/setuptools/tests/bdist_wheel_testdata/extension.dist/extension.abi3.so b/setuptools/tests/bdist_wheel_testdata/extension.dist/extension.abi3.so
deleted file mode 100644
index cf9e0b0a491284e40d703523d7fa602a091232ec..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 23312
zcmeHPeQ;dWb$_e1q+Lr|$(C#^+n_bb$ga`K-yawU%d%t%BuiK}4v^&e?e1G?@$P%e
zdv9f}NhfY-`AFiHb~24=LgFNpnwF4E0|^1rnvaI2NjoKNI>0a)6G{pp!w}L?LuPP)
z=bn3a->%j`XZjbjccgdEIrn_sbI<+QeQ)2V21keL0s&2xp!N}su!%ON?34|6PD%jP
zPHn3e#`PlYLcu$))HDZblZ~p@q+YU7Puvo(tUIMks#fhp7Am78j1m>sV%;rKRr}={
z&=!g@L+B&r^;v08tCI?(UxboeRLVuAoT^VsIaP1*cg@RQlKlLjMTLDI7yo0X~n!EgvtW0+El(Vs-2bt
zu%v>n@H1C3BaJEbL6uj0bd{>q_J)s6W1`AgA6?{?YVn<0<{R#B2bG!Edn3D2>hn?qIZUG`BiB6v-Pj`Y1;4~o%ZU^{p;{8PlcWoojted
zYaqXQZspfewRUO5KTR!fzWU<1bLZ|P9IeMi>uxAGzT-a9bG)A9hPR#d7D4r`1VeTB
z+?m#{V@`F6=3Y&EY7wYKpca7-K?LZYAl-_jd+~H17xxrT
z6U~1Q5ooQ{B2bG!EdsR&)FM!eKrI5b2-G4_i$E;`wFrDzA|Rhrt$Z%ES@lmoui7H<
zX35_varNBmGKI@}sjSuWugfdifBWt^n@ES`!>r<&aNuVpuAXT=Ch_@F{(!8TWW7Yz
z>T~O9`FyJs(^NY>vrL7ad!=##SK3)AsOS?CSI<|Ul6+xVD}Ab#WbJq7xIgNd+P5XH
z{8D`XU$uG;y;9#=IbN0YN_@}2z~#|Z_~gGjx-GUYwl2DU?YeDiH?7?eUA50lMu!cL
z>AmY#i)YP+T6Atte|KPmv99<#0rh(UidQ8M6EtnH^r;$;%BK#QSJilwjqrQ$s5Vts
z)1%r{U5!Wiy6ioCR=##he<-&(-$>)!vKz@u->u*&@xTGFH2(>*{ns+1>n0!?c;OCIYrGor!9YWk!0O3N{k;0L|rRrtr~V{p4b)`o|P?FxZx4Id;s
zI|Q;b{AudgPJs-E`!TD7{Q{W?x00P*0{Lk8emEN3y?7f$4~4tPx1o+JflP;AC*OvJ
z*SYZbN!y4(yzs+h=c=XzxM#x&LdF*E1ad5V7lmmDGV4j;xfI35}V!!6zYxg7;eR02hlFpZ!?#oC;-Qxi_1
zNs&*$yKpya`8M(^yq+yR220^B48H)`@OA;$ok9=h@9+E^3|)l9zq9DoRLK#O!C!CSr(
z`3Xpot1vxVPO>*wL3PVl7tmCUtRS9ynP-%E9$+3a-||ht({?GrO9Jdy6C7@f+}Ng5
zx9^5@B-1tv3tD&s+>c~C=@&d9t!W!*4I$#HtA~8V3T^@15V{f9h4+!^j|P@gb6Yz!
zMqUjp{UjmJAP|vXN+e4fUz5m7)Qvw5E+z$S-3WB#1S63_w6tC<Vi;6qz4+t>%;1&5{D`!GxkGK@4GN2Ww>g}Q~!EcQHD+vhXPB
zF9Cn&8ir}f?v!1+9{io$rO0;lqBF)k2LLZ!&+rcs+oc<%ENm^^$nY
z-!XiS^#47>zfby4GkhcY@HoQ}((?qv%SrZGhR+cFIfl0r{bvlnMDU9YucjFOoZ){W
z`b!L7O8)#O!`G6nml^L8L11O1y(t)37HPxhm%7DTFmid*_NHx3BkkDQ
zy0xaJkDwK2iB^Evyd?#lX&?%5HD0Pw6>1LzBTY>#9RMNR;#0O2!t+bou~oLC^$L9E
zYYqfP+KInq1@!cRFS5}mcx5LswXQ(l+a$f7ykq);EyDIfsadpOZC|AIbdpaUivk3Y
z_C@uAQ(J>Esnb^C8VLL@(t@k_$ub5Y(3f|ezDzpaH&>LC
z{A}O0zO4^G4ihG&wvLe6$b1}T*_ylH0h(phT9q>~U#*zp_9gyf7DJkxL-qfkk7{R9|J*h$k*!tY|I
z{CM29Gk!dku?^2pNZ8q2#+>z&9K)I_Q<^oiwo~ScmxqvFh63Zqlj%emZd&=QzuiTg
zeErRu7`S8^#ZKnSO{CK0c&?BzaxR!SxSnGq%(#&_%&415C(1lb3DZiZt*PB+&M^~)m$t2ghGT&u+jkkR
z2|hDNO`z?kaT!5R_5GMCnl5a_^C`(bS-{VyvxBo~4}>u@8#kTZ6b9y=DD1|lU2P)O
zg*4Pb$+#FM@b5xS_ES!l^s|!(I1L9WHkv+B(1(nSYfg%JrBOmg#U*dK=_w0eTTquL
z3Prut&+9QZyVEmi7u{ezm`F*(GilOE=MPwMJ8vaN?Szq$wse|3NAXi|unZWPOr>Z2
zu4_6J8s;zgB3+o&N32}l8@BDkvV*Q)#hA#-vIvp0lLgB&W~B=gg@c?o`aUxy!$wRa
zGq%y?ST&eIR-
zs|YZwok>#aV(KDTL$r{nJfSpX=M`mq67evSSme#2ypo5(r8keQJk+eGI>);
zARV#DT$?tJC<=vf6ho8G$xwPoM|(~>`q_DC%IAo%qM|ry7M&hNX8L6*xER<{x=?Jg
zhI1G`(@tP%dde~J5(1avjBb#BGWV55to`^CgSr=KDdzwwI^v{}%{0L$3Zqyo{dq=;
z_L!FGU}<*b>>S{A+3z4`X52QM7q}Rum}OA-Fi*Ol4ep^>^x-y^#HG9P}aELljco%
z(@K~K5+zV_C~anv<#F3>Qt~M=ii`9RvtqC9jnLkd#i*D`70S|ln{ez|u|h$m9EM`F
zu-hnjk~RW`(3tO|?X47kbJjDlGTBxvA;xWB+DshYXJQ5saWtL9Vu_%pF>N_>MLx+T
zvNWibBef6WBM^gp*sIVxSD#
zXU>#Hms4|}>DqZGVJaz|j&qoA*sf?#kfWf_c=Se*(i#U%rsJAPr5y=f(o75YekZTy
z_(VbEm15P0uL_Z&G!mi@d^`ueA
zq^G7mdO9#Vux`uy-X@6lW;bud#migfjwxDm(g~o3lbGIt^LZ~dPKm$q_0isxsm>NI
z5WI~gakv-TgNJjf?ew}HvJK2B!!1~eX&`pq?af<9Fjsm-C`(caEHTqc7V`>HiIflD
zk;-Q>ARa-M&7htb8Bn>3EnIbYqA*Eg&zZ=f*7cl`+yq{lZYuiMr*jIV;Nrh@LZV~h
zE_6gOAmM$3>O1E{r<^CHb}R&xH4_CaK9~$%S=w`EmW@_Eg*nO;aqQc?QSQ{@xF?q1
z;$qAzi13#uGA(>8YsYok`(#9li<4*^v9LIoZAK!~igS804@XsJk(KBGV|w1oBe~bp
zDsC1}S$nZkvr*)?I$N-M%yMp_bKI1Xl~&JtI8~$8H*IIlJ_DaJ`VzFbV$0||GHsff
zKIF3JiYv}~Mqg8Kc7<@7zM50^PF@X+f~u~VZ(i|
zS-2M&$3vzff-|u=sHq+g}Ii4LQ*mX!7=u~VdzCZ?=s
z$jH&6ue=>IWXkHgceHpk<5Pp&rsal`_3b@$;FGQ7tUTX~gE)`bP~OWszGbCi^TRpL
zv5%To@mPdR!)KrbPU!Dfg7_S*-kas;4dO%fA^KjWq6G2T`dC%^yyE?2zeo_DnALsW
za(YAYesDP*UjfPcf#vj&7OhIhThgl1=NIprmg{NK)P2x$I=%>s`Y8+twH7T}l^!X+
zhsrM%#H|{2AHJO4rm6Q%mD3k!)$T6`wS}6xzh2IduWWYuDGUe2o5HHm7ipnG)#!`o
z5ZycMBfhc0moUGkpMjSZL>}2Tcf9cJnxG%67~d6=
ze!7BAHv$7%DL!P6$`JkoRmLR?I@wk44ditUwKFM&34Lf^|Ja~D
zxOX?b!EX0;d;7<5sL^%2y-pFazuEe)p*H528H0!t%4Iw)CVCVD7<0{p7V{7uEhah`E9%B^QXHhTm^sbC
zWjT&3vn!akPBIj8Y+=~QrlEGqhSs?2YB7v2otfB8;dIPUrvfx5&3Jway6E#?5lveu
zQpQd3xMR*JjJ~^2FhWu#ZU4_Cdj1Nt3v-N%+CNp@E$OPlx58zGUUT^to>@}zha{kC
zdd7tczQq;=_Y}&?R$#arP_%zc%By--a+6(5J@HHtk(ST}Wheegx3Yg$0;(4GF}3fAf#K#tNmTorzCTw|H}S8DZfkdsprB}t@ubDtKJ;{=?*{ngzw$CsC7=(>iIa;
zTp9m^Xz#jk%x#VG(MDjN?x7c)cb2sl5!Lk2j#aK
z$0yL{x3A85r}5?-Dm%rsbW!rErhT7aWxpt}mSq&5(jeVYsPv+uWtxVG(g%at$N&AeFyVpyIe((M7=?r-dD5O@%-Os{Joq
C1PR0d

diff --git a/setuptools/tests/bdist_wheel_testdata/extension.dist/extension.c b/setuptools/tests/bdist_wheel_testdata/extension.dist/extension.c
deleted file mode 100644
index 26403efa82..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/extension.dist/extension.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include 
-
-static PyMethodDef methods[] = {
-	{ NULL, NULL, 0, NULL }
-};
-
-static struct PyModuleDef module_def = {
-	PyModuleDef_HEAD_INIT,
-	"extension",
-	"Dummy extension module",
-	-1,
-	methods
-};
-
-PyMODINIT_FUNC PyInit_extension(void) {
-	return PyModule_Create(&module_def);
-}
diff --git a/setuptools/tests/bdist_wheel_testdata/extension.dist/setup.py b/setuptools/tests/bdist_wheel_testdata/extension.dist/setup.py
deleted file mode 100644
index 9a6eed8cfd..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/extension.dist/setup.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from __future__ import annotations
-
-from setuptools import Extension, setup
-
-setup(
-    name="extension.dist",
-    version="0.1",
-    description="A testing distribution \N{SNOWMAN}",
-    ext_modules=[Extension(name="extension", sources=["extension.c"])],
-)
diff --git a/setuptools/tests/bdist_wheel_testdata/headers.dist/header.h b/setuptools/tests/bdist_wheel_testdata/headers.dist/header.h
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/setuptools/tests/bdist_wheel_testdata/headers.dist/headersdist.py b/setuptools/tests/bdist_wheel_testdata/headers.dist/headersdist.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/setuptools/tests/bdist_wheel_testdata/headers.dist/setup.cfg b/setuptools/tests/bdist_wheel_testdata/headers.dist/setup.cfg
deleted file mode 100644
index 3c6e79cf31..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/headers.dist/setup.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[bdist_wheel]
-universal=1
diff --git a/setuptools/tests/bdist_wheel_testdata/headers.dist/setup.py b/setuptools/tests/bdist_wheel_testdata/headers.dist/setup.py
deleted file mode 100644
index 6cf9b46faf..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/headers.dist/setup.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from __future__ import annotations
-
-from setuptools import setup
-
-setup(
-    name="headers.dist",
-    version="0.1",
-    description="A distribution with headers",
-    headers=["header.h"],
-)
diff --git a/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/libb.dylib b/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/libb.dylib
deleted file mode 100644
index 25c954656b07e8abb28f87fbc296f90214207dd2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 9544
zcmeHNU2IfE6rOD>EVQsKKLJrm3q@-X+J#a|kfi)vyqi|6-4d(B47=Mcd&B;ey?1Nd
zu%yyry4EI*(fB}Oh%u4yL=35Yf(Av3G0_+wc+jK|Xtn_Y8Xu}6>v!hPE!*9K)%bW%
zdglDhnKNh3o!Q~UaK0b`uEDs8PoHM=OC
zEix&?CxaW|lPowlg53sjCgl2?ppF5z9VR6i-9CUK*7rale|k^E9}9EcNci3P@r^Dq
zt?OhXlBH{*aY}zQW&+Lwx)Il+M@%tqytkykB3W+Y-?YkoY0(mWx*R;-*yVl+t2;2nu*;GzDURu}M_
z9oHgDFDd6y%n@^{bQ$5r8QiK(@12&(7_7E$c}PEe#RiL1P!f6y~F%HYKBZeF%pt3J(CjP!@!C5tLCVrHrBYvj|CWz
zFMC{MR}Z9^gxw;u_v(ZmuZA(9ZnOtBZroh=sCLB#NqBIu>~`KB-3UfD@5yclBOB}t
z*cq@hU}wP2z`xGGK{fT0+JCDwmAscqO!p`6ITD-ROipJqj3p}7;a%_G1uOj{{-LVF
zE1kb(G8d@_=s$o;=&yZFE-q4oOVF|OxlATwD!p*rrlyi(YASJFO&vU|4kgc~Pmr_B
zgql(&)gk4)$$qO2CxFSxbdsuv7^<(MdJ=TvOXZG3y{e2;*Ect+Lx~CDXeTUPqouGK
zR|}Of*C?yM?0Ro}P`RUKUYt-fP*c@T<+@(om%PIgS8hHt)A&AonT@Z{)wn-7!Hfl>
z)z|Q1*$j-I*y0*}{SNgnGLasg%g=}7uF>&|>!-$D?^8IgQH0e0McW}WE$Z;Lb7-Xw
z?Ye|Fg!H?_r>?3)+r~&d3NcMDU(z_0oJRWYA_yQ2cAB!Y(GrvdjhpQf5P!D7!`3E6U@dJR!}B$?i~NS08xTE2reKtcGs3k9G7Nbm9`_-d>aEg8diprafwW59y#OPIs_j&qbz
z9|Vrx<`(AYE?sc?0JVM!qf&y$OB|#BYFD-qmpoqF!VtxOSJw2_`
zzfAj8!V46+_C@r<++Rrc1Hi$1ru|;<0&?x8n(QwCPfL4x#})7h`x`L$Q^vDKn&-tM
z_2hpAVm>16H~oXXRb5qv4p{1KIR;e
zaxmH+_5{3!+Z_n`;@pV)G(-0U6r}~at$v@b1$Yc6=Rse@)5=?GxZbI2#`k!!Wzs8quPjh|<#7%Dr3Y51||u2FGg3
z$i(gILW5)VBHROwUcFY=dV`8kHq0osZY4rys;TkD!n)GDzr`E#a)tEGQg762F`Z)&
z!CDVaocFp-M{RRg?~~ObQSCLtx@UfQ3A7?B+jw(hfI9D7PRR*$`?wERA~XX!0tZHi
z)6D|6zl*K+8u^*1DrBFnVTDCE#8wdPr>(X2sKBoPE`@B}qfn%5?eDxIW!g(4=mC=b
zX}Ldh67t$2#;kh?6x7nij9KT;XCS*^k3Bd6p9r~+S^GP*i|SyGnTW2KGKDGNdz7f3
zktcKHUvuPQc*?e~6!L>@#OfURXpa5Irc8T$0zS>LpD^W_dOAN)Zi{wyNmt
znr^}@1JX8SDR4Ou&_Fn!c4S=6aI+!A#mPBth4^UZ4g-F
zav$z`vU;f;qTC6;f>@_DvvD%2Az0QPYt`#;{
ig;-mtuzrC|_P_o3h_?S_an4?rbN_= 'a' && *lett <= 'z'){
-            num += 1;
-        } else if (*lett >= 'A' && *lett <= 'Z'){
-            num += 1;
-        }
-        lett += 1;
-    }
-    return num;
-}
diff --git a/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10.dylib b/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10.dylib
deleted file mode 100644
index eaf1a94e5f8a259da16f00db62453e0c7796c717..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 756
zcmX^A>+L^w1_nlE1|R{%EI_;g#83cYAdm!N3lJX%_yHBa096Cy1I=UrVUW2X5FcNX
zT2TUFL---C5g`aZj5P(y0GS7J3mmX8G{D(FMtpp7er`cxa!Gt?UU_C-N_@PJ3$pwS
zC`SQGXD~tBaso(0oeE?jKzw{^MtoXPVs0u#EIuC9eLJ8^9iVgv)I2Dcft!IL1I7l?
zDnKj%VsLRWFz|6PfGm>$;tNpw9{_0)ARnlYApnSx0myw&HzErY#SZo8eCp9z`{TIl
z7m#|7?%E$f?hB9R+7}G`ExBMJ*BAWzIGTSZ^7qIg^Q-v#`GEXx*DuWn7&~3RywpRM
zb>!~>r3H^}sO~8KeohqCKn_^e1E|}h)Ahy6j{pDv0}YEk43dEXX#8S$4-^(4z*rT;
zz*r%`D8R$cF#)Iw6pk`LtN}C(1fcpE7##To+L)Yq*+8100H~Y|WH3Ln>G64`x$*gF
O@j0m_C8+L^w1_nlE1|R{%EI_;g#83cYAdm!N3lJX%_yHBa096Cy1I=UrVUW2X5FcNX
zT2TUFL---C5g`aZj5P(y0GS7J3mmX8G{D(FMtpp7er`cxa!Gt?UU_C-N_@PJ3$pwS
zC`SQGXD~tBaso(0oeE?jKzw{^MtoXPVs0u#EIuC9eLJ8^9iVgv)I2Dcft!IL1I7l?
zDnKj%#9Ull3=Di+3?R!SfcOH`{s%x>1jq;KV+a6ZWB_s>)Q!l(M6p9XI-h!U*8Vu|
z`URxkqr3J8ko&@;x%LGEe@iY{$n^#PK91&}iTpis$owk)em)?-+x1KH0me?(FE90w
zWgYo@Kxx6F8>%~szn>FDHIM_A^#JPj=yZMYvg7~%|3JfH4})Z202;p--UEdN2ryO!
zF)&sLFbeRnb4&oL0)?Xt5NiMp0|BUh1_nnyfi@;*UN(>>C;%#F0~ySZYNRe
PT6|7wNl9u^F-R!@L6mUR

diff --git a/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10_386.dylib b/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_10_386.dylib
deleted file mode 100644
index 8f543875d6ad19063ba0e006ada538d6bd9d606e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 668
zcma)3ze~eV5WduiG1k5g4h{+qjvXBwt@t(zA{9iCqtuiNww0QqlnO#RG^9`k2mb{B
z3K10C{0m$i3c5K23D&zLucYAMN50&B_v_u`y?%fG%mBa?Q6uWa4m&HcX8#YoQS6R#
zY`I^};8H}}y0F=cfLN6KMWrHpLx%hLyfJjRQa)n2Q9CV_ZEV%gkLyQ>+gmEf_LjIn
z%%uS61Dk&Fsw_hwT2-txOEpXB$vy5VyhhxJXGB#1a{yK4uac8xVVVFLGdydNWG6na
zN0#@X9@rr!!TZEJCBy&n_uO~qBkf7!MF!m96%4oFyYkDq^g(nh9Fo3x0LL$h{&GUL
z#UK;PzpCR!6
z+n0Sc_zTSYA`5NNq9kIU)(6N(#I}(mOZ#;XDwWc$uDG;{Map^m=DhY|`vive(|L(x
z#Us6za$&J?zp~)U<>te?%{x+Fy`pnux1cAW(_k)$ym0ZOu1ansQdaA-wp3|UwLgB3
zX9!<}&Z-`9l@P~;sO$APEQk>ixttJ%Ty)k+xGi;F2bS)EJ>nWPEp#7sr*!zY);Ih;
z?{mIun>+T9HgxAqe=hXxz-x!XTB}jW4y~T>!iu$iCgrYL8->Undan%M9uB5c$+ERh
zx7S;5SsTa3YT-~a+8GWuN25{K9(r%`w_j5RLhlWdJQh7WiLrWJ7%kH%=8tAO$kHjN
zp)+U^?I{<`wald{{k~C>r6!i{B%8|(xmc6;s;*mIdVmxQBftnS0*nA7zz8q`i~u9R
z2rvSSz+Xh*Lp=W*_~SpG_hFyYOjd$IPC;k%j21=4e?sN%sv7P82`50Uwo?7{tQdt-
z+yME9@dMkcPf6K2=5%_-w`y+36009_7+3H@mCh@azST3muiy>Nru~FC2%_;n7+gqa!5q-H;B?jQ
zggVgGNJd!)yB*)|4>}Qh5G2$A73lZ-(-$?yBdip`BTSl`s3IJRM>vmWB>MXhG!^AF&B$2Q}+-Cm=
zhLZ0|jqhnDFnKNm(K4!*r#+w6j?)wGt9ubVk9Qd(4A)~#0x?@OOPQ>NmBQ6|;S6zq
zFL?eSCMmHL@^*QnD65j10MW=}uADIqFNZk2Usp^l30kwI#jhzxmDr@4P!_@Kq{WN4ec&QxJf|e5gx1tr(>aF
PVljsohGiM$OD_EZ=Ie1K

diff --git a/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_14_386.dylib b/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_14_386.dylib
deleted file mode 100644
index c85b71691ee684af0f05edb64c424873d1081ef2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 676
zcma)3y-LGS6h5gDqt;#r2L}Zoz)3o|R=nU~L8O8RatJl0f^DUyD5Zjs42Be1!3S{k
zDMV0k^9fuX3c5K23C45M+>(NWANg{AzjM#!zJ7oHOaZ_IQ6uU^mz|X)X8#YoQSOdv
zY+0{na4Vv1UD)gmfmo9JB^3?r4H?$+c_Zj>rF_J4qjqYRZEV%gkLyQ>+ncJ!_LjIn
z%x3`TgAV;JFmxU@PlkilRIwnsyuFehh~D&AF9lqTmBFANMUgK<=Q(@$#1#U+A7OMYzB@x}
z?}FAbwE66$eoa+AWr?^>BVtVB0w2DA
zJ3&d!pdeeharSvPSKJA7g<(zwG&RE0s85XLi`z4YU
zPt0D*`Ni5&dES>R^~VqD_ocjX-Nb0!hMt5@gSjB`VjUNKR5F!FSy_IR#a{^T&lCh0smN-_-YQW2N(;R@{W9g=+QL((d2d-wyYK
zFS(X$@4Cdlh}Ntf&c>nJ3mUO-npJYSvC|PjTy{3krpz^GE3eFc@Wu+=e)nQ3SaLS$
z^rrN#vvq7F7X}4YW!!BK27{K{58mbOy`>0*-XA1+EP8elYweb>)@`ehJDS}mqBu__-{e7~~%2q6|mfDvE>7y(9r5nu!u0Y-ok
zU<4R}zktBU;rwsm$G;lpXfE5KS*!?!oQBSr*-UvxFR?cFbdItAgcG1v+o^tLMpUj8
zH$e6{e&D(8Q`GAc=5u<+PkLU*7Q3G^jw{&FsaNz$^FH-6lI9G^H;y;h)8~k={uAE7
z3-`US5%0P^I*!+B#4sZ-Xhfh5YRctCPR9cC_psG=UKz0i%i8;U*XCDZ{WnD_k4mo>s8tQNo{OxkT^oktDv2p7+L^w1_nlE1|R{%EI_;g#83cYAdm!N3lJX%_yHBa096Cy1I=UrVUW2X5FcNX
zT2TUFL---C5g`aZj5P(y0GS7J3mmX8G{D(FMtpp7er`cxa!Gt?UU_C-N_@PJ3$pwS
zC`SQGXD~tBaso(0oeE?jKzw{^MtoXPVs0u#EIuC9eLJ8^9iVgv)I2Dcft!IL1I7l?
zDnKj%Vz6;BFz|6PfGm>$;tNpw9{_0)ARnlYApnSx0myw&HzErY#SZo8eCp9z`{TIl
z7m#|7?%E$f?hB9R+7}G`ExBMJ*BAWzIGTSZ^7qIg^Q-v#`GEXx*DuWn7&~3RywpRM
zb>!~>r3H^}sO~8KeohqCKn_^e1E|}h)Ahy6j{pDv0}YEk43dEXX#8S$4-^(4z*rT;
zz*r%`D8R$cF#)Iw6pk`LtN}C(1fcpE7##To+L)Yq*+8100H~Y|WH3Ln>G64`x$*gF
O@j0m_C8+L^w1_lOZAZ7$&79g$xF%+PD5E~1)0~DJ9lmpQq{V+2?O5@{8QY%V8EC`5?
z4{?nMf$<>pL?8vy53&yqSQr{$?D+WP{M>@XW
zzyL%HB|rk|R1g;o;^R{@;?s%}b5mh_RClZZ3Y!421Jn$NDh38_28Ik6TLs7v0CCv3
z7#R4tz;;OhxiwJxI)F6D9Y8${0YHolK<w4fxjgUB;@*oe;-5hk3{|+StM>1e?K3X`=|K;W2ft%mpVw2j{H3!*Tb|%
z@%MA0s0DIBl3<-bUQYP`|9`jZpXMVxv4=r2Kmdw2Ab@)dpCR!6
z+n0Sc_zTSYA`5NNq9kIU)(6N(#I}(mOZ#;XDwWc$uDG;{Map^m=DhY|`vive(|L(x
z#Us6za$&J?zp~)U<>te?%{x+Fy`pnux1cAW(_k)$ym0ZOu1ansQdaA-wp3|UwLgB3
zX9!<}&Z-`9l@P~;sO$APEQk>ixk(`klhIix;kMLy9ay>t_K0iHw9tLjozmgoTHo;Z
zywCZrZSL4Z+R&Xd{khP$1FszlYpq5hJG6Sj3oF+8nUuR~Z4@GR=)E$0dpMX*CCk=2
z-Cl3KWo;ZAtA#_!XlFRs9F0a@d+5E%-+oOQ2)#E*@>uljB*yA>VYE!6m_M5BAWNs5
zhR&cxw5MD!*D{x;^!r9hmYP_)lWZbwKi~u9R2rvSS03*N%FanGK
zBftnS0)G*K5ApnO;E(@!-iLioGg%1=IR%~3Gg=fG{|S}5t7^3WC!7Ga+Di4)vtkrV
zaRcNZ#t&?(J|$)AnA7PQ->SJCORRp#VO+rrRXVFI&HdC*OPVvF*spklU3LB^*nh$s
zIR2jFx5FJfpldkYb_locc{(g40#I
z6Y4-$BN=5K>~?&+Kj=j4L6A@fRG{DQPhZp+kFZh%k1%0wqKa@N9^pKik?8M3lncej
Wnafi-YN`a~Icl763KTzpSNIMHtKS0v

diff --git a/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_9_universal2.dylib b/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_10_9_universal2.dylib
deleted file mode 100755
index 26ab109c9957ee2453ddd94a14a7db02bd3e8689..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 65936
zcmeI*Z)jCz9KiAC?vHM6?k+W)XmL>!wcMsHb8qx0UbsV1%Voomhh26@qixsip6fr{
zTFr$+!ATPJCW->zD4C3Ok}?PsBM=KrjKmlH*#e_L!mV)qerM;*y9;SVZ=&zR{hjB}
zdCqgr`EcLA97<%YSZXPQ5^MY9P$EG=009ILKmY**
z5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~0R#|0
z009ILKmY**5I_I{1Q0*~fqz-x%INKTlK3Bz#D6nILKFV`a*XLQrQV(9$Z<%*+S+Jc
ztv59J;7sm%+Xu){z8|ubSFCjtdtARGRrY$3HRI>r@~3D&@BVb{bY*s}O}FlDYHhGh
zt&K@Jk-gqof4!K0k@kaU$y_IB>wD^4Yd6+x+7Mk|6TGYA&&aBEg9I(IM}ik#M-I~^
zR!Nje=((V{iIi)bo8oqPrLC4{Z`ze;Pt`ZCC~w#+qsGiPrmHfT{Gi$yUt8Zr?-7x{
zwjHS#OI;+fMIy5V&zSiCVW6M
z&t+&Re4(Iwq&|H3@y!0d@R1VfABx`T9t`zH?+lk`o?RP0?B$#XS8op=DV#K0I^No`
ze9ha|n-0G*HZ~^9?f9&(Psirz6e*dt=2~m+e3jH1XZ$>PZEKEyvE*QvO86yYLbf&C
zVv~)wIpMmJlWu0_n)f>O=M`NqEYpMh{29`h?!*ESlYPA;v^Ut4n~vMKG$hTNz#AM_}ATy
z?olu#VQp=+u2ve^#mO4*`|`1OqoMl;XtCB!>~Y82Qe8=~uLf_HWNiCML`
z0fU@UxQWdWq^*9zckeUD-9*Z@^38j@ywX<7vp4OMy%y@5SCq?k2~BZh<{Q&hDc3%<
zIL4I8Bz+gHBhuHlBlTjbizK#4WR~C=GoL5({Daza<)q$c_~ZwpooAk2KG61(x#aZ!
zu|mco660&?U5mW7?lEDe*5@phs#M#4k^k6)i$1UHL?M5Vkf}(g+ABmrW9#0On`kLt
z7nta*MH0GBnPW_W)Jy!nzPFagB=r1FN1o@Oyr5i5K>z^+5I_I{1Q0*~0R#|0009IL
zKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~0R#|0009ILKmY**5I_I{1Q0*~
zf&Y%cShu-)D{Mx_W}AVburo3=)krua2Xjro)`g+L>NP!~wkJcTcA`HVYCB=1Kie57
z$TyD+$+eOLJ!|58eyFV|bAD5(?Qqt7oh#QK)%$%nHa7c~tR>HKbTHRm(^ThqK4E69
zxz(CGUnRB1fS(7iZOzRtmYnNS39m#Xbv$HS(=9gHXqywRD>>os+Hx*v}=;dvN^|pINhIj{@l*I;sa-E
zlcz4P`R2y;s@GTl6o2&hvXif#I9->#INUgx_x07QujFj5%OBg{zkgrPjq`_My-yu~
z*!gYGefjCNj%)8Mn{xA8=h$octDb%4#dqIcy1Ap|moMtK&At5VkAt5S-i;TQJu$uQ
a=fp<`e(Q`ad4AfJZ8Zat?HBV_Fa8rZUx$7G

diff --git a/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_11.dylib b/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_11.dylib
deleted file mode 100644
index 80202c11ba026146f7596191a1043216590fa9f2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 16464
zcmeI4y-EW?6ov2l4=PEcC|Zb!s6`@Tk@+b@&bZ|
z&mfk958wk>ieTdlh=}Lz&gv2bOPe!ra(`y#?(DbI-aNj)eRhjD?IO|z^+C-xk#mW|
z6B&kHA!9bP+nbtc8R_5SPNY>RwD^2V^){fRzjnPDKk5aH&OV5i8u7e}VdaarS
z0@cP*%`5IF7Qdlj)g+{K;%Si{*l8Q7@56xy%`>;pt!J<}st+jW49#(a0
z`{32rUhO{gV8?A2H$q1ov*)_f(=OL1i0yCCvmL`j!oGa`M}Y1M+P~qCiN6o+>;+Tv
M>Uon#Gk&ouU-!LLLjV8(

diff --git a/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_multiple_fat.dylib b/setuptools/tests/bdist_wheel_testdata/macosx_minimal_system_version/test_lib_multiple_fat.dylib
deleted file mode 100644
index 5f7fd5091ea98cf4db80642362748f384c61200a..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 8956
zcmeHM&ubGw6rPQ-U2B@n!9xX=96Wd^9>hbBjk>T03nCRnkRjBB3MMUei=`wWY>_M}
zG(rzO_y_nW6c0gAD0onhJ$Nl7ptl@W360;I%&Z$MR74Mj_u%Et`!R23zun9G^5O7J
zTL_VYjzdogkt6pNelk`Z%TugRF(?Zozz8q`i~u9R2rvSS03*N%FanGKBftopFa$pS
z_;#oVe}Q>lq@guhLV#{-!eI}+t72+X)qT=UikRYS0z`8l%+*kUMW^e#vi@M
zYlN>uXLXNZl@MozSTyU)SP&y3#wLWwPN=h{;MVkc4OqGd_J}*sq|klzos!`{THgx~
zg0GpTYwx+lyNKqT9nM9e+Y9QEa5l;mawDfLf~e?hUQD>_&Q?~r{ot(?y8Z5SB3W=Y
z>Go#p183{ZNG%*ns-01{H5d$q+D`N{v!V(m
zxB>Ey;|F$hpS-rqnA7PQKkK<2ORRp$aa_T!E}hl3rTduS#Cdvsv`3xD8+2VPi@_S_yF>ow~U+>RI2JD?9LD&%&YwjF#2e{d=3#{@!8(Ez>f
z)npb70(}!+Q}2!`1XGQq%6i!Cg>I+YP%J_(rVyyWyyxG(tPwt8EeAef+-{+Yco^an
huAmu-`A$S3n|qPEIXOm6wV-^A8pqrM#gE_@egaI<-)aB=

diff --git a/setuptools/tests/bdist_wheel_testdata/simple.dist/setup.py b/setuptools/tests/bdist_wheel_testdata/simple.dist/setup.py
deleted file mode 100644
index 1e7a78a224..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/simple.dist/setup.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from __future__ import annotations
-
-from setuptools import setup
-
-setup(
-    name="simple.dist",
-    version="0.1",
-    description="A testing distribution \N{SNOWMAN}",
-    packages=["simpledist"],
-    extras_require={"voting": ["beaglevote"]},
-)
diff --git a/setuptools/tests/bdist_wheel_testdata/simple.dist/simpledist/__init__.py b/setuptools/tests/bdist_wheel_testdata/simple.dist/simpledist/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/setuptools/tests/bdist_wheel_testdata/unicode.dist/setup.py b/setuptools/tests/bdist_wheel_testdata/unicode.dist/setup.py
deleted file mode 100644
index ec66d1e6af..0000000000
--- a/setuptools/tests/bdist_wheel_testdata/unicode.dist/setup.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from __future__ import annotations
-
-from setuptools import setup
-
-setup(
-    name="unicode.dist",
-    version="0.1",
-    description="A testing distribution \N{SNOWMAN}",
-    packages=["unicodedist"],
-    zip_safe=True,
-)
diff --git a/setuptools/tests/bdist_wheel_testdata/unicode.dist/unicodedist/__init__.py b/setuptools/tests/bdist_wheel_testdata/unicode.dist/unicodedist/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git "a/setuptools/tests/bdist_wheel_testdata/unicode.dist/unicodedist/\303\245\303\244\303\266_\346\227\245\346\234\254\350\252\236.py" "b/setuptools/tests/bdist_wheel_testdata/unicode.dist/unicodedist/\303\245\303\244\303\266_\346\227\245\346\234\254\350\252\236.py"
deleted file mode 100644
index e69de29bb2..0000000000

From b4f5a07734dc8c2bfc6456b3ceb0538095bbc8aa Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Thu, 20 Jun 2024 12:35:26 +0100
Subject: [PATCH 035/151] Add news fragment

---
 newsfragments/4429.misc.rst | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 newsfragments/4429.misc.rst

diff --git a/newsfragments/4429.misc.rst b/newsfragments/4429.misc.rst
new file mode 100644
index 0000000000..9c4c11ef89
--- /dev/null
+++ b/newsfragments/4429.misc.rst
@@ -0,0 +1,2 @@
+Refactored ``test_bdist_wheel`` such that it creates examples in temporary
+folders and run the ``bdist_wheel`` command programmatically without subprocesses.

From c9729e1a0f66b7adad70c629518b7dab82ccd8c6 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 21 Jun 2024 13:09:07 -0400
Subject: [PATCH 036/151] Prefer "Source" to "Homepage" for the repository
 label.

Closes jaraco/skeleton#129
---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 50845ee304..ad67d3b12d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -22,7 +22,7 @@ dependencies = [
 dynamic = ["version"]
 
 [project.urls]
-Homepage = "https://github.com/PROJECT_PATH"
+Source = "https://github.com/PROJECT_PATH"
 
 [project.optional-dependencies]
 test = [

From 222ebf921a4a1cca69d6a5193121f3090580e502 Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Tue, 25 Jun 2024 10:40:11 +0100
Subject: [PATCH 037/151] =?UTF-8?q?Bump=20version:=2070.1.0=20=E2=86=92=20?=
 =?UTF-8?q?70.1.1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .bumpversion.cfg            | 2 +-
 NEWS.rst                    | 9 +++++++++
 newsfragments/4429.misc.rst | 2 --
 pyproject.toml              | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)
 delete mode 100644 newsfragments/4429.misc.rst

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 4856098dff..a11458c8dd 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 70.1.0
+current_version = 70.1.1
 commit = True
 tag = True
 
diff --git a/NEWS.rst b/NEWS.rst
index 5c3f5b4319..a33251ec82 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,12 @@
+v70.1.1
+=======
+
+Misc
+----
+
+- #4429
+
+
 v70.1.0
 =======
 
diff --git a/newsfragments/4429.misc.rst b/newsfragments/4429.misc.rst
deleted file mode 100644
index 9c4c11ef89..0000000000
--- a/newsfragments/4429.misc.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Refactored ``test_bdist_wheel`` such that it creates examples in temporary
-folders and run the ``bdist_wheel`` command programmatically without subprocesses.
diff --git a/pyproject.toml b/pyproject.toml
index 712b4ee31f..2e1f5110e1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,7 +5,7 @@ backend-path = ["."]
 
 [project]
 name = "setuptools"
-version = "70.1.0"
+version = "70.1.1"
 authors = [
 	{ name = "Python Packaging Authority", email = "distutils-sig@python.org" },
 ]

From c1ff48b553076dca8bcf955f7d7a0860aa2c04bf Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Tue, 25 Jun 2024 10:18:42 +0100
Subject: [PATCH 038/151] Add doctest to capture edge cases of PEP 625

---
 setuptools/_core_metadata.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py
index f1de9c9ba6..514280cf06 100644
--- a/setuptools/_core_metadata.py
+++ b/setuptools/_core_metadata.py
@@ -263,7 +263,21 @@ def _write_provides_extra(file, processed_extras, safe, unsafe):
 
 # from pypa/distutils#244; needed only until that logic is always available
 def get_fullname(self):
+    return _distribution_fullname(self.get_name(), self.get_version())
+
+
+def _distribution_fullname(name: str, version: str) -> str:
+    """
+    >>> _distribution_fullname('setup.tools', '1.0-2')
+    'setup_tools-1.0.post2'
+    >>> _distribution_fullname('setup-tools', '1.2post2')
+    'setup_tools-1.2.post2'
+    >>> _distribution_fullname('setup-tools', '1.0-r2')
+    'setup_tools-1.0.post2'
+    >>> _distribution_fullname('setup.tools', '1.0.post')
+    'setup_tools-1.0.post0'
+    """
     return "{}-{}".format(
-        canonicalize_name(self.get_name()).replace('-', '_'),
-        self.get_version(),
+        canonicalize_name(name).replace('-', '_'),
+        version,
     )

From 555f7db16aad8eaf121c464eae76df871c825fd1 Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Tue, 25 Jun 2024 10:26:24 +0100
Subject: [PATCH 039/151] Use canonicalize_version to produce fullname

---
 setuptools/_core_metadata.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py
index 514280cf06..0fe59c36e5 100644
--- a/setuptools/_core_metadata.py
+++ b/setuptools/_core_metadata.py
@@ -18,7 +18,7 @@
 from . import _normalization, _reqs
 from .extern.packaging.markers import Marker
 from .extern.packaging.requirements import Requirement
-from .extern.packaging.utils import canonicalize_name
+from .extern.packaging.utils import canonicalize_name, canonicalize_version
 from .extern.packaging.version import Version
 from .warnings import SetuptoolsDeprecationWarning
 
@@ -279,5 +279,5 @@ def _distribution_fullname(name: str, version: str) -> str:
     """
     return "{}-{}".format(
         canonicalize_name(name).replace('-', '_'),
-        version,
+        canonicalize_version(version, strip_trailing_zero=False),
     )

From 0b2119a6c415ef9c0b433b7a9cfe7650a84d1236 Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Tue, 25 Jun 2024 10:30:12 +0100
Subject: [PATCH 040/151] Add news fragment

---
 newsfragments/4434.bugfix.rst | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 newsfragments/4434.bugfix.rst

diff --git a/newsfragments/4434.bugfix.rst b/newsfragments/4434.bugfix.rst
new file mode 100644
index 0000000000..5eeb674297
--- /dev/null
+++ b/newsfragments/4434.bugfix.rst
@@ -0,0 +1,2 @@
+Fix distribution name normalisation (:pep:`625`) for valid versions that are
+not canonical (e.g. ``1.0-2``).

From 63985e62cc07e52c2566a7c3a89fdccccd74f24f Mon Sep 17 00:00:00 2001
From: Anderson Bravalheri 
Date: Tue, 25 Jun 2024 10:32:55 +0100
Subject: [PATCH 041/151] Add another test case for version

---
 setuptools/_core_metadata.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py
index 0fe59c36e5..45aae7d70b 100644
--- a/setuptools/_core_metadata.py
+++ b/setuptools/_core_metadata.py
@@ -276,6 +276,8 @@ def _distribution_fullname(name: str, version: str) -> str:
     'setup_tools-1.0.post2'
     >>> _distribution_fullname('setup.tools', '1.0.post')
     'setup_tools-1.0.post0'
+    >>> _distribution_fullname('setup.tools', '1.0+ubuntu-1')
+    'setup_tools-1.0+ubuntu.1'
     """
     return "{}-{}".format(
         canonicalize_name(name).replace('-', '_'),

From 74c20b6f3af53280d240f2f1c676178d16dd4cab Mon Sep 17 00:00:00 2001
From: Sviatoslav Sydorenko 
Date: Wed, 25 Oct 2023 23:46:01 +0200
Subject: [PATCH 042/151] Let codecov-action autodetect the coverage report

Ref: https://github.com/codecov/feedback/issues/84.
---
 .github/workflows/main.yml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ec2e567a1e..b8bbc750cc 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -206,8 +206,6 @@ jobs:
         if: hashFiles('coverage.xml') != ''  # Rudimentary `file.exists()`
         uses: codecov/codecov-action@v4
         with:
-          files: >-
-            ${{ github.workspace }}\coverage.xml
           flags: >-  # Mark which lines are covered by which envs
             CI-GHA,
             ${{ github.job }},

From c45346633178a4e2b342bc2ef4efd316c801bdf4 Mon Sep 17 00:00:00 2001
From: Sviatoslav Sydorenko 
Date: Wed, 26 Jun 2024 20:07:10 +0200
Subject: [PATCH 043/151] =?UTF-8?q?=F0=9F=A7=AA=20Unignore=20errors=20in?=
 =?UTF-8?q?=20`coverage=20xml`=20@=20Cygwin?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .github/workflows/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b8bbc750cc..a1b1d23727 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -200,7 +200,7 @@ jobs:
         if: hashFiles('.coverage') != ''  # Rudimentary `file.exists()`
         run: |
           python -m pip install coverage
-          python -m coverage xml --ignore-errors
+          python -m coverage xml
         shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
       - name: Publish coverage
         if: hashFiles('coverage.xml') != ''  # Rudimentary `file.exists()`

From f0e8bb1309158bd40d1af8e27280c2686e59a8e9 Mon Sep 17 00:00:00 2001
From: Sviatoslav Sydorenko 
Date: Wed, 26 Jun 2024 20:23:36 +0200
Subject: [PATCH 044/151] =?UTF-8?q?Revert=20"=F0=9F=A7=AA=20Unignore=20err?=
 =?UTF-8?q?ors=20in=20`coverage=20xml`=20@=20Cygwin"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit c45346633178a4e2b342bc2ef4efd316c801bdf4.
---
 .github/workflows/main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a1b1d23727..b8bbc750cc 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -200,7 +200,7 @@ jobs:
         if: hashFiles('.coverage') != ''  # Rudimentary `file.exists()`
         run: |
           python -m pip install coverage
-          python -m coverage xml
+          python -m coverage xml --ignore-errors
         shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
       - name: Publish coverage
         if: hashFiles('coverage.xml') != ''  # Rudimentary `file.exists()`

From d02b6b19375065e1875af5f874583df0343b8484 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 16:55:52 +0200
Subject: [PATCH 045/151] Use brackets for the default value of option
 arguments

The goal is to standardize the format of the help text printed
by commands. It is not easy to choose between brackets `[]` and
parentheses `()`. I went for the docopt style, which is the
closest to a standard I could find:
	http://docopt.org/

	[...] and whether that argument has a default value ([default: 10]).

This change has already been applied to distutils:
	https://github.com/pypa/distutils/pull/262
---
 setuptools/command/bdist_wheel.py | 12 ++++++------
 setuptools/command/dist_info.py   |  2 +-
 setuptools/command/egg_info.py    |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/setuptools/command/bdist_wheel.py b/setuptools/command/bdist_wheel.py
index a81187598a..d8cdd4e406 100644
--- a/setuptools/command/bdist_wheel.py
+++ b/setuptools/command/bdist_wheel.py
@@ -176,7 +176,7 @@ class bdist_wheel(Command):
             "plat-name=",
             "p",
             "platform name to embed in generated filenames "
-            f"(default: {get_platform(None)})",
+            f"[default: {get_platform(None)}]",
         ),
         (
             "keep-temp",
@@ -189,7 +189,7 @@ class bdist_wheel(Command):
         (
             "relative",
             None,
-            "build the archive using relative paths (default: false)",
+            "build the archive using relative paths [default: false]",
         ),
         (
             "owner=",
@@ -201,18 +201,18 @@ class bdist_wheel(Command):
             "g",
             "Group name used when creating a tar file [default: current group]",
         ),
-        ("universal", None, "make a universal wheel (default: false)"),
+        ("universal", None, "make a universal wheel [default: false]"),
         (
             "compression=",
             None,
-            "zipfile compression (one of: {}) (default: 'deflated')".format(
+            "zipfile compression (one of: {}) [default: 'deflated']".format(
                 ", ".join(supported_compressions)
             ),
         ),
         (
             "python-tag=",
             None,
-            f"Python implementation compatibility tag (default: '{python_tag()}')",
+            f"Python implementation compatibility tag [default: '{python_tag()}']",
         ),
         (
             "build-number=",
@@ -224,7 +224,7 @@ class bdist_wheel(Command):
         (
             "py-limited-api=",
             None,
-            "Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)",
+            "Python tag (cp32|cp33|cpNN) for abi3 wheel tag [default: false]",
         ),
     ]
 
diff --git a/setuptools/command/dist_info.py b/setuptools/command/dist_info.py
index 52c0721903..2adc1c46f3 100644
--- a/setuptools/command/dist_info.py
+++ b/setuptools/command/dist_info.py
@@ -28,7 +28,7 @@ class dist_info(Command):
             'output-dir=',
             'o',
             "directory inside of which the .dist-info will be"
-            "created (default: top of the source tree)",
+            "created [default: top of the source tree]",
         ),
         ('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"),
         ('tag-build=', 'b', "Specify explicit tag to add to version number"),
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index ccc2db8972..8f2d642794 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -172,7 +172,7 @@ class egg_info(InfoCommon, Command):
             'egg-base=',
             'e',
             "directory containing .egg-info directories"
-            " (default: top of the source tree)",
+            " [default: top of the source tree]",
         ),
         ('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"),
         ('tag-build=', 'b', "Specify explicit tag to add to version number"),

From ea3807beacf1d81a397d783be1d24ec3d1c3c1ed Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 18:46:24 +0200
Subject: [PATCH 046/151] Enforce ruff/flake8-implicit-str-concat rule ISC001

ISC001 Implicitly concatenated string literals on one line
---
 pkg_resources/__init__.py                 |  2 +-
 pkg_resources/tests/test_pkg_resources.py |  4 +-
 pkg_resources/tests/test_resources.py     |  2 +-
 setuptools/command/egg_info.py            |  6 +--
 setuptools/command/sdist.py               |  2 +-
 setuptools/dist.py                        |  2 +-
 setuptools/namespaces.py                  |  2 +-
 setuptools/package_index.py               |  2 +-
 setuptools/tests/config/test_expand.py    |  2 +-
 setuptools/tests/config/test_setupcfg.py  | 54 +++++++++++------------
 setuptools/tests/test_egg_info.py         |  2 +-
 setuptools/tests/test_integration.py      |  2 +-
 12 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index c4ace5aa77..b722af2c2f 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2041,7 +2041,7 @@ def _extract_resource(self, manager: ResourceManager, zip_path) -> str:  # noqa:
 
         if not WRITE_SUPPORT:
             raise OSError(
-                '"os.rename" and "os.unlink" are not supported ' 'on this platform'
+                '"os.rename" and "os.unlink" are not supported on this platform'
             )
         try:
             if not self.egg_name:
diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py
index 17e1ff0c2f..4c4c68dfff 100644
--- a/pkg_resources/tests/test_pkg_resources.py
+++ b/pkg_resources/tests/test_pkg_resources.py
@@ -171,7 +171,7 @@ def test_setuptools_not_imported(self):
         lines = (
             'import pkg_resources',
             'import sys',
-            ('assert "setuptools" not in sys.modules, ' '"setuptools was imported"'),
+            ('assert "setuptools" not in sys.modules, "setuptools was imported"'),
         )
         cmd = [sys.executable, '-c', '; '.join(lines)]
         subprocess.check_call(cmd)
@@ -299,7 +299,7 @@ def test_distribution_version_missing_undetected_path():
 
     msg, dist = excinfo.value.args
     expected = (
-        "Missing 'Version:' header and/or PKG-INFO file at path: " '[could not detect]'
+        "Missing 'Version:' header and/or PKG-INFO file at path: [could not detect]"
     )
     assert msg == expected
 
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 83199af7b8..826d691b83 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -257,7 +257,7 @@ def test_marker_evaluation_with_extras(self):
             "/foo_dir/Foo-1.2.dist-info",
             metadata=Metadata((
                 "METADATA",
-                "Provides-Extra: baz\n" "Requires-Dist: quux; extra=='baz'",
+                "Provides-Extra: baz\nRequires-Dist: quux; extra=='baz'",
             )),
         )
         ad.add(Foo)
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index ccc2db8972..26e8e5220d 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -363,16 +363,16 @@ def process_template_line(self, line):
         }
         log_map = {
             'include': "warning: no files found matching '%s'",
-            'exclude': ("warning: no previously-included files found " "matching '%s'"),
+            'exclude': ("warning: no previously-included files found matching '%s'"),
             'global-include': (
-                "warning: no files found matching '%s' " "anywhere in distribution"
+                "warning: no files found matching '%s' anywhere in distribution"
             ),
             'global-exclude': (
                 "warning: no previously-included files matching "
                 "'%s' found anywhere in distribution"
             ),
             'recursive-include': (
-                "warning: no files found matching '%s' " "under directory '%s'"
+                "warning: no files found matching '%s' under directory '%s'"
             ),
             'recursive-exclude': (
                 "warning: no previously-included files matching "
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index d455f44c5e..a834ba4a78 100644
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -29,7 +29,7 @@ class sdist(orig.sdist):
         (
             'dist-dir=',
             'd',
-            "directory to put the source distribution archive(s) in " "[default: dist]",
+            "directory to put the source distribution archive(s) in [default: dist]",
         ),
         (
             'owner=',
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 43762960ba..a60bd44445 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -159,7 +159,7 @@ def check_specifier(dist, attr, value):
         SpecifierSet(value)
     except (InvalidSpecifier, AttributeError) as error:
         tmpl = (
-            "{attr!r} must be a string " "containing valid version specifiers; {error}"
+            "{attr!r} must be a string containing valid version specifiers; {error}"
         )
         raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) from error
 
diff --git a/setuptools/namespaces.py b/setuptools/namespaces.py
index 0185d55f94..2f2c1cfbe1 100644
--- a/setuptools/namespaces.py
+++ b/setuptools/namespaces.py
@@ -55,7 +55,7 @@ def _get_target(self):
             "importlib.machinery.PathFinder.find_spec(%(pkg)r, "
             "[os.path.dirname(p)])))"
         ),
-        ("m = m or " "sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))"),
+        ("m = m or sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))"),
         "mp = (m or []) and m.__dict__.setdefault('__path__',[])",
         "(p not in mp) and mp.append(p)",
     )
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index c91e419923..7a1190df99 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -1137,7 +1137,7 @@ def local_open(url):
             files.append('{name}'.format(name=f))
         else:
             tmpl = (
-                "{url}" "{files}"
+                "{url}{files}"
             )
             body = tmpl.format(url=url, files='\n'.join(files))
         status, message = 200, "OK"
diff --git a/setuptools/tests/config/test_expand.py b/setuptools/tests/config/test_expand.py
index f15d8fa7c2..b309a1ce7c 100644
--- a/setuptools/tests/config/test_expand.py
+++ b/setuptools/tests/config/test_expand.py
@@ -84,7 +84,7 @@ def test_read_attr(self, tmp_path, monkeypatch):
             "pkg/__init__.py": "",
             "pkg/sub/__init__.py": "VERSION = '0.1.1'",
             "pkg/sub/mod.py": (
-                "VALUES = {'a': 0, 'b': {42}, 'c': (0, 1, 1)}\n" "raise SystemExit(1)"
+                "VALUES = {'a': 0, 'b': {42}, 'c': (0, 1, 1)}\nraise SystemExit(1)"
             ),
         }
         write_files(files, tmp_path)
diff --git a/setuptools/tests/config/test_setupcfg.py b/setuptools/tests/config/test_setupcfg.py
index 706e2d0ebe..6bb40c32e1 100644
--- a/setuptools/tests/config/test_setupcfg.py
+++ b/setuptools/tests/config/test_setupcfg.py
@@ -35,7 +35,7 @@ def fake_env(
     tmpdir, setup_cfg, setup_py=None, encoding='ascii', package_path='fake_package'
 ):
     if setup_py is None:
-        setup_py = 'from setuptools import setup\n' 'setup()\n'
+        setup_py = 'from setuptools import setup\nsetup()\n'
 
     tmpdir.join('setup.py').write(setup_py)
     config = tmpdir.join('setup.cfg')
@@ -97,7 +97,7 @@ def test_no_config(self, tmpdir):
     def test_ignore_errors(self, tmpdir):
         _, config = fake_env(
             tmpdir,
-            '[metadata]\n' 'version = attr: none.VERSION\n' 'keywords = one, two\n',
+            '[metadata]\nversion = attr: none.VERSION\nkeywords = one, two\n',
         )
         with pytest.raises(ImportError):
             read_configuration('%s' % config)
@@ -171,7 +171,7 @@ def test_license_cfg(self, tmpdir):
     def test_file_mixed(self, tmpdir):
         fake_env(
             tmpdir,
-            '[metadata]\n' 'long_description = file: README.rst, CHANGES.rst\n' '\n',
+            '[metadata]\nlong_description = file: README.rst, CHANGES.rst\n\n',
         )
 
         tmpdir.join('README.rst').write('readme contents\nline2')
@@ -179,14 +179,14 @@ def test_file_mixed(self, tmpdir):
 
         with get_dist(tmpdir) as dist:
             assert dist.metadata.long_description == (
-                'readme contents\nline2\n' 'changelog contents\nand stuff'
+                'readme contents\nline2\nchangelog contents\nand stuff'
             )
 
     def test_file_sandboxed(self, tmpdir):
         tmpdir.ensure("README")
         project = tmpdir.join('depth1', 'depth2')
         project.ensure(dir=True)
-        fake_env(project, '[metadata]\n' 'long_description = file: ../../README\n')
+        fake_env(project, '[metadata]\nlong_description = file: ../../README\n')
 
         with get_dist(project, parse=False) as dist:
             with pytest.raises(DistutilsOptionError):
@@ -253,7 +253,7 @@ def test_dict(self, tmpdir):
 
     def test_version(self, tmpdir):
         package_dir, config = fake_env(
-            tmpdir, '[metadata]\n' 'version = attr: fake_package.VERSION\n'
+            tmpdir, '[metadata]\nversion = attr: fake_package.VERSION\n'
         )
 
         sub_a = package_dir.mkdir('subpkg_a')
@@ -263,35 +263,35 @@ def test_version(self, tmpdir):
         sub_b = package_dir.mkdir('subpkg_b')
         sub_b.join('__init__.py').write('')
         sub_b.join('mod.py').write(
-            'import third_party_module\n' 'VERSION = (2016, 11, 26)'
+            'import third_party_module\nVERSION = (2016, 11, 26)'
         )
 
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '1.2.3'
 
-        config.write('[metadata]\n' 'version = attr: fake_package.get_version\n')
+        config.write('[metadata]\nversion = attr: fake_package.get_version\n')
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '3.4.5.dev'
 
-        config.write('[metadata]\n' 'version = attr: fake_package.VERSION_MAJOR\n')
+        config.write('[metadata]\nversion = attr: fake_package.VERSION_MAJOR\n')
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '1'
 
         config.write(
-            '[metadata]\n' 'version = attr: fake_package.subpkg_a.mod.VERSION\n'
+            '[metadata]\nversion = attr: fake_package.subpkg_a.mod.VERSION\n'
         )
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '2016.11.26'
 
         config.write(
-            '[metadata]\n' 'version = attr: fake_package.subpkg_b.mod.VERSION\n'
+            '[metadata]\nversion = attr: fake_package.subpkg_b.mod.VERSION\n'
         )
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '2016.11.26'
 
     def test_version_file(self, tmpdir):
         _, config = fake_env(
-            tmpdir, '[metadata]\n' 'version = file: fake_package/version.txt\n'
+            tmpdir, '[metadata]\nversion = file: fake_package/version.txt\n'
         )
         tmpdir.join('fake_package', 'version.txt').write('1.2.3\n')
 
@@ -346,12 +346,12 @@ def test_version_with_package_dir_complex(self, tmpdir):
             assert dist.metadata.version == '1.2.3'
 
     def test_unknown_meta_item(self, tmpdir):
-        fake_env(tmpdir, '[metadata]\n' 'name = fake_name\n' 'unknown = some\n')
+        fake_env(tmpdir, '[metadata]\nname = fake_name\nunknown = some\n')
         with get_dist(tmpdir, parse=False) as dist:
             dist.parse_config_files()  # Skip unknown.
 
     def test_usupported_section(self, tmpdir):
-        fake_env(tmpdir, '[metadata.some]\n' 'key = val\n')
+        fake_env(tmpdir, '[metadata.some]\nkey = val\n')
         with get_dist(tmpdir, parse=False) as dist:
             with pytest.raises(DistutilsOptionError):
                 dist.parse_config_files()
@@ -364,7 +364,7 @@ def test_classifiers(self, tmpdir):
         ])
 
         # From file.
-        _, config = fake_env(tmpdir, '[metadata]\n' 'classifiers = file: classifiers\n')
+        _, config = fake_env(tmpdir, '[metadata]\nclassifiers = file: classifiers\n')
 
         tmpdir.join('classifiers').write(
             'Framework :: Django\n'
@@ -387,25 +387,25 @@ def test_classifiers(self, tmpdir):
             assert set(dist.metadata.classifiers) == expected
 
     def test_interpolation(self, tmpdir):
-        fake_env(tmpdir, '[metadata]\n' 'description = %(message)s\n')
+        fake_env(tmpdir, '[metadata]\ndescription = %(message)s\n')
         with pytest.raises(configparser.InterpolationMissingOptionError):
             with get_dist(tmpdir):
                 pass
 
     def test_non_ascii_1(self, tmpdir):
-        fake_env(tmpdir, '[metadata]\n' 'description = éàïôñ\n', encoding='utf-8')
+        fake_env(tmpdir, '[metadata]\ndescription = éàïôñ\n', encoding='utf-8')
         with get_dist(tmpdir):
             pass
 
     def test_non_ascii_3(self, tmpdir):
-        fake_env(tmpdir, '\n' '# -*- coding: invalid\n')
+        fake_env(tmpdir, '\n# -*- coding: invalid\n')
         with get_dist(tmpdir):
             pass
 
     def test_non_ascii_4(self, tmpdir):
         fake_env(
             tmpdir,
-            '# -*- coding: utf-8\n' '[metadata]\n' 'description = éàïôñ\n',
+            '# -*- coding: utf-8\n[metadata]\ndescription = éàïôñ\n',
             encoding='utf-8',
         )
         with get_dist(tmpdir) as dist:
@@ -447,7 +447,7 @@ def test_make_option_lowercase(self, tmpdir):
         # remove this test and the method make_option_lowercase() in setuptools.dist
         # when no longer needed
         fake_env(
-            tmpdir, '[metadata]\n' 'Name = foo\n' 'description = Some description\n'
+            tmpdir, '[metadata]\nName = foo\ndescription = Some description\n'
         )
         msg = "Usage of uppercase key 'Name' in 'metadata' will not be supported"
         with pytest.warns(SetuptoolsDeprecationWarning, match=msg):
@@ -561,7 +561,7 @@ def test_multiline(self, tmpdir):
             assert dist.tests_require == ['mock==0.7.2', 'pytest']
 
     def test_package_dir_fail(self, tmpdir):
-        fake_env(tmpdir, '[options]\n' 'package_dir = a b\n')
+        fake_env(tmpdir, '[options]\npackage_dir = a b\n')
         with get_dist(tmpdir, parse=False) as dist:
             with pytest.raises(DistutilsOptionError):
                 dist.parse_config_files()
@@ -589,13 +589,13 @@ def test_package_data(self, tmpdir):
             }
 
     def test_packages(self, tmpdir):
-        fake_env(tmpdir, '[options]\n' 'packages = find:\n')
+        fake_env(tmpdir, '[options]\npackages = find:\n')
 
         with get_dist(tmpdir) as dist:
             assert dist.packages == ['fake_package']
 
     def test_find_directive(self, tmpdir):
-        dir_package, config = fake_env(tmpdir, '[options]\n' 'packages = find:\n')
+        dir_package, config = fake_env(tmpdir, '[options]\npackages = find:\n')
 
         dir_sub_one, _ = make_package_dir('sub_one', dir_package)
         dir_sub_two, _ = make_package_dir('sub_two', dir_package)
@@ -633,7 +633,7 @@ def test_find_directive(self, tmpdir):
 
     def test_find_namespace_directive(self, tmpdir):
         dir_package, config = fake_env(
-            tmpdir, '[options]\n' 'packages = find_namespace:\n'
+            tmpdir, '[options]\npackages = find_namespace:\n'
         )
 
         dir_sub_one, _ = make_package_dir('sub_one', dir_package)
@@ -754,7 +754,7 @@ def test_nowarn_accidental_env_marker_misconfig(self, config, tmpdir, recwarn):
         assert len(recwarn) == num_warnings
 
     def test_dash_preserved_extras_require(self, tmpdir):
-        fake_env(tmpdir, '[options.extras_require]\n' 'foo-a = foo\n' 'foo_b = test\n')
+        fake_env(tmpdir, '[options.extras_require]\nfoo-a = foo\nfoo_b = test\n')
 
         with get_dist(tmpdir) as dist:
             assert dist.extras_require == {'foo-a': ['foo'], 'foo_b': ['test']}
@@ -785,7 +785,7 @@ def test_entry_points(self, tmpdir):
         tmpdir.join('entry_points').write(expected)
 
         # From file.
-        config.write('[options]\n' 'entry_points = file: entry_points\n')
+        config.write('[options]\nentry_points = file: entry_points\n')
 
         with get_dist(tmpdir) as dist:
             assert dist.entry_points == expected
@@ -904,7 +904,7 @@ def test_cmdclass(self, tmpdir):
         module_path = Path(tmpdir, "src/custom_build.py")  # auto discovery for src
         module_path.parent.mkdir(parents=True, exist_ok=True)
         module_path.write_text(
-            "from distutils.core import Command\n" "class CustomCmd(Command): pass\n",
+            "from distutils.core import Command\nclass CustomCmd(Command): pass\n",
             encoding="utf-8",
         )
 
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index f2489896b3..8616f813c1 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -310,7 +310,7 @@ def parametrize(*test_list, **format_dict):
                         )
                     )
             return pytest.mark.parametrize(
-                'requires,use_setup_cfg,' 'expected_requires,install_cmd_kwargs',
+                'requires,use_setup_cfg,expected_requires,install_cmd_kwargs',
                 argvalues,
                 ids=idlist,
             )
diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py
index 71f10d9a6e..78f459d018 100644
--- a/setuptools/tests/test_integration.py
+++ b/setuptools/tests/test_integration.py
@@ -16,7 +16,7 @@
 
 
 pytestmark = pytest.mark.skipif(
-    'platform.python_implementation() == "PyPy" and ' 'platform.system() == "Windows"',
+    'platform.python_implementation() == "PyPy" and platform.system() == "Windows"',
     reason="pypa/setuptools#2496",
 )
 

From c908af325c23559ef1e1201c75d0a774b192170a Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 18:50:24 +0200
Subject: [PATCH 047/151] A round of `ruff format` after  `ruff check --fix`

---
 setuptools/dist.py                       |  4 +---
 setuptools/package_index.py              |  4 +---
 setuptools/tests/config/test_setupcfg.py | 12 +++---------
 3 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/setuptools/dist.py b/setuptools/dist.py
index a60bd44445..32e8d43c64 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -158,9 +158,7 @@ def check_specifier(dist, attr, value):
     try:
         SpecifierSet(value)
     except (InvalidSpecifier, AttributeError) as error:
-        tmpl = (
-            "{attr!r} must be a string containing valid version specifiers; {error}"
-        )
+        tmpl = "{attr!r} must be a string containing valid version specifiers; {error}"
         raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) from error
 
 
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 7a1190df99..950059cab9 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -1136,9 +1136,7 @@ def local_open(url):
                 f += '/'
             files.append('{name}'.format(name=f))
         else:
-            tmpl = (
-                "{url}{files}"
-            )
+            tmpl = "{url}{files}"
             body = tmpl.format(url=url, files='\n'.join(files))
         status, message = 200, "OK"
     else:
diff --git a/setuptools/tests/config/test_setupcfg.py b/setuptools/tests/config/test_setupcfg.py
index 6bb40c32e1..bf9777c668 100644
--- a/setuptools/tests/config/test_setupcfg.py
+++ b/setuptools/tests/config/test_setupcfg.py
@@ -277,15 +277,11 @@ def test_version(self, tmpdir):
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '1'
 
-        config.write(
-            '[metadata]\nversion = attr: fake_package.subpkg_a.mod.VERSION\n'
-        )
+        config.write('[metadata]\nversion = attr: fake_package.subpkg_a.mod.VERSION\n')
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '2016.11.26'
 
-        config.write(
-            '[metadata]\nversion = attr: fake_package.subpkg_b.mod.VERSION\n'
-        )
+        config.write('[metadata]\nversion = attr: fake_package.subpkg_b.mod.VERSION\n')
         with get_dist(tmpdir) as dist:
             assert dist.metadata.version == '2016.11.26'
 
@@ -446,9 +442,7 @@ def test_warn_dash_deprecation(self, tmpdir):
     def test_make_option_lowercase(self, tmpdir):
         # remove this test and the method make_option_lowercase() in setuptools.dist
         # when no longer needed
-        fake_env(
-            tmpdir, '[metadata]\nName = foo\ndescription = Some description\n'
-        )
+        fake_env(tmpdir, '[metadata]\nName = foo\ndescription = Some description\n')
         msg = "Usage of uppercase key 'Name' in 'metadata' will not be supported"
         with pytest.warns(SetuptoolsDeprecationWarning, match=msg):
             with get_dist(tmpdir) as dist:

From e14a73a8e8c1dc225ca2a87ed72fa7157c4afb0d Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 17:49:08 +0200
Subject: [PATCH 048/151] Enforce ruff/flake8-implicit-str-concat rule ISC003

ISC003 Explicitly concatenated string should be implicitly concatenated
---
 setuptools/command/bdist_egg.py | 2 +-
 setuptools/command/register.py  | 2 +-
 setuptools/command/upload.py    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index 73476e0cec..6a2dac1115 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -74,7 +74,7 @@ class bdist_egg(Command):
             'keep-temp',
             'k',
             "keep the pseudo-installation tree around after "
-            + "creating the distribution archive",
+            "creating the distribution archive",
         ),
         ('dist-dir=', 'd', "directory to put final built distributions in"),
         ('skip-build', None, "skip rebuilding everything (for testing/debugging)"),
diff --git a/setuptools/command/register.py b/setuptools/command/register.py
index b8266b9a60..beee9782e7 100644
--- a/setuptools/command/register.py
+++ b/setuptools/command/register.py
@@ -10,7 +10,7 @@ class register(orig.register):
     def run(self):
         msg = (
             "The register command has been removed, use twine to upload "
-            + "instead (https://pypi.org/p/twine)"
+            "instead (https://pypi.org/p/twine)"
         )
 
         self.announce("ERROR: " + msg, log.ERROR)
diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py
index ec7f81e227..1cca47cea9 100644
--- a/setuptools/command/upload.py
+++ b/setuptools/command/upload.py
@@ -10,7 +10,7 @@ class upload(orig.upload):
     def run(self):
         msg = (
             "The upload command has been removed, use twine to upload "
-            + "instead (https://pypi.org/p/twine)"
+            "instead (https://pypi.org/p/twine)"
         )
 
         self.announce("ERROR: " + msg, log.ERROR)

From 713ad96cec0ca9c83eb6095f689ad90b35364c7b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 13:47:03 -0400
Subject: [PATCH 049/151] Add 'consolidate_linker_args' wrapper to protect the
 old behavior for now.

Closes pypa/distutils#246.
---
 distutils/compat/__init__.py          | 15 +++++++++++++++
 distutils/compat/py38.py              | 23 +++++++++++++++++++++++
 distutils/tests/test_unixccompiler.py | 17 +++++++++--------
 distutils/unixccompiler.py            |  5 +++--
 4 files changed, 50 insertions(+), 10 deletions(-)
 create mode 100644 distutils/compat/__init__.py
 create mode 100644 distutils/compat/py38.py

diff --git a/distutils/compat/__init__.py b/distutils/compat/__init__.py
new file mode 100644
index 0000000000..b7be72678f
--- /dev/null
+++ b/distutils/compat/__init__.py
@@ -0,0 +1,15 @@
+from __future__ import annotations
+
+from .py38 import removeprefix
+
+
+def consolidate_linker_args(args: list[str]) -> str:
+    """
+    Ensure the return value is a string for backward compatibility.
+
+    Retain until at least 2024-10-31.
+    """
+
+    if not all(arg.startswith('-Wl,') for arg in args):
+        return args
+    return '-Wl,' + ','.join(removeprefix(arg, '-Wl,') for arg in args)
diff --git a/distutils/compat/py38.py b/distutils/compat/py38.py
new file mode 100644
index 0000000000..0af3814017
--- /dev/null
+++ b/distutils/compat/py38.py
@@ -0,0 +1,23 @@
+import sys
+
+if sys.version_info < (3, 9):
+
+    def removesuffix(self, suffix):
+        # suffix='' should not call self[:-0].
+        if suffix and self.endswith(suffix):
+            return self[: -len(suffix)]
+        else:
+            return self[:]
+
+    def removeprefix(self, prefix):
+        if self.startswith(prefix):
+            return self[len(prefix) :]
+        else:
+            return self[:]
+else:
+
+    def removesuffix(self, suffix):
+        return self.removesuffix(suffix)
+
+    def removeprefix(self, prefix):
+        return self.removeprefix(prefix)
diff --git a/distutils/tests/test_unixccompiler.py b/distutils/tests/test_unixccompiler.py
index f17edf2f6b..6f05fa6989 100644
--- a/distutils/tests/test_unixccompiler.py
+++ b/distutils/tests/test_unixccompiler.py
@@ -4,6 +4,7 @@
 import sys
 import unittest.mock as mock
 from distutils import sysconfig
+from distutils.compat import consolidate_linker_args
 from distutils.errors import DistutilsPlatformError
 from distutils.unixccompiler import UnixCCompiler
 from distutils.util import _clear_cached_macosx_ver
@@ -149,10 +150,10 @@ def gcv(v):
                 return 'yes'
 
         sysconfig.get_config_var = gcv
-        assert self.cc.rpath_foo() == [
+        assert self.cc.rpath_foo() == consolidate_linker_args([
             '-Wl,--enable-new-dtags',
             '-Wl,-rpath,/foo',
-        ]
+        ])
 
         def gcv(v):
             if v == 'CC':
@@ -161,10 +162,10 @@ def gcv(v):
                 return 'yes'
 
         sysconfig.get_config_var = gcv
-        assert self.cc.rpath_foo() == [
+        assert self.cc.rpath_foo() == consolidate_linker_args([
             '-Wl,--enable-new-dtags',
             '-Wl,-rpath,/foo',
-        ]
+        ])
 
         # GCC non-GNULD
         sys.platform = 'bar'
@@ -189,10 +190,10 @@ def gcv(v):
                 return 'yes'
 
         sysconfig.get_config_var = gcv
-        assert self.cc.rpath_foo() == [
+        assert self.cc.rpath_foo() == consolidate_linker_args([
             '-Wl,--enable-new-dtags',
             '-Wl,-rpath,/foo',
-        ]
+        ])
 
         # non-GCC GNULD
         sys.platform = 'bar'
@@ -204,10 +205,10 @@ def gcv(v):
                 return 'yes'
 
         sysconfig.get_config_var = gcv
-        assert self.cc.rpath_foo() == [
+        assert self.cc.rpath_foo() == consolidate_linker_args([
             '-Wl,--enable-new-dtags',
             '-Wl,-rpath,/foo',
-        ]
+        ])
 
         # non-GCC non-GNULD
         sys.platform = 'bar'
diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py
index a54481c01b..0248bde87b 100644
--- a/distutils/unixccompiler.py
+++ b/distutils/unixccompiler.py
@@ -22,6 +22,7 @@
 import sys
 
 from . import sysconfig
+from .compat import consolidate_linker_args
 from ._log import log
 from ._macos_compat import compiler_fixup
 from ._modified import newer
@@ -315,11 +316,11 @@ def runtime_library_dir_option(self, dir: str) -> str | list[str]:
         # For all compilers, `-Wl` is the presumed way to pass a
         # compiler option to the linker
         if sysconfig.get_config_var("GNULD") == "yes":
-            return [
+            return consolidate_linker_args([
                 # Force RUNPATH instead of RPATH
                 "-Wl,--enable-new-dtags",
                 "-Wl,-rpath," + dir,
-            ]
+            ])
         else:
             return "-Wl,-R" + dir
 

From 71fb698b720073e697dc8d8ad3e7095fd7588042 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 14:03:03 -0400
Subject: [PATCH 050/151] Exclude compat package from coverage.

---
 .coveragerc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.coveragerc b/.coveragerc
index 35b98b1df9..bcef31d957 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -2,6 +2,9 @@
 omit =
 	# leading `*/` for pytest-dev/pytest-cov#456
 	*/.tox/*
+
+	# local
+	*/compat/*
 disable_warnings =
 	couldnt-parse
 

From 9eaea6a12c2b6aeee0fd0a11a4a4da0e1eb89f3e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 13:33:48 -0400
Subject: [PATCH 051/151] Add type declaration for runtime_library_dir_option,
 making explicit the different return types one might expect.

---
 distutils/unixccompiler.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py
index caf4cd338e..a54481c01b 100644
--- a/distutils/unixccompiler.py
+++ b/distutils/unixccompiler.py
@@ -13,6 +13,8 @@
   * link shared library handled by 'cc -shared'
 """
 
+from __future__ import annotations
+
 import itertools
 import os
 import re
@@ -281,7 +283,7 @@ def _is_gcc(self):
         compiler = os.path.basename(shlex.split(cc_var)[0])
         return "gcc" in compiler or "g++" in compiler
 
-    def runtime_library_dir_option(self, dir):
+    def runtime_library_dir_option(self, dir: str) -> str | list[str]:
         # XXX Hackish, at the very least.  See Python bug #445902:
         # https://bugs.python.org/issue445902
         # Linkers on different platforms need different options to

From e74608b03526415568e4ba035166b66167a90df3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 16:40:21 -0400
Subject: [PATCH 052/151] Extend the retention of the compatibility.

---
 distutils/compat/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/compat/__init__.py b/distutils/compat/__init__.py
index b7be72678f..b1ee3fe8b0 100644
--- a/distutils/compat/__init__.py
+++ b/distutils/compat/__init__.py
@@ -7,7 +7,7 @@ def consolidate_linker_args(args: list[str]) -> str:
     """
     Ensure the return value is a string for backward compatibility.
 
-    Retain until at least 2024-10-31.
+    Retain until at least 2024-04-31. See pypa/distutils#246
     """
 
     if not all(arg.startswith('-Wl,') for arg in args):

From d3165d04ec215e3e9dc2cf414ed02d3468a25f79 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 20:37:49 -0400
Subject: [PATCH 053/151] =?UTF-8?q?=F0=9F=91=B9=20Feed=20the=20hobgoblins?=
 =?UTF-8?q?=20(delint).?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 distutils/unixccompiler.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py
index 0248bde87b..da97688cbd 100644
--- a/distutils/unixccompiler.py
+++ b/distutils/unixccompiler.py
@@ -22,11 +22,11 @@
 import sys
 
 from . import sysconfig
-from .compat import consolidate_linker_args
 from ._log import log
 from ._macos_compat import compiler_fixup
 from ._modified import newer
 from .ccompiler import CCompiler, gen_lib_options, gen_preprocess_options
+from .compat import consolidate_linker_args
 from .errors import CompileError, DistutilsExecError, LibError, LinkError
 
 # XXX Things not currently handled:

From 1bf363bb3a8f17d99e6ae67d20e8dec801e3b984 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 20:41:52 -0400
Subject: [PATCH 054/151] Move compatibility modules into compat package.

---
 distutils/_modified.py                      |  2 +-
 distutils/compat/py38.py                    | 10 ++++++++++
 distutils/{py39compat.py => compat/py39.py} |  0
 distutils/py38compat.py                     |  8 --------
 distutils/sysconfig.py                      |  4 ++--
 distutils/util.py                           |  2 +-
 6 files changed, 14 insertions(+), 12 deletions(-)
 rename distutils/{py39compat.py => compat/py39.py} (100%)
 delete mode 100644 distutils/py38compat.py

diff --git a/distutils/_modified.py b/distutils/_modified.py
index 78485dc25e..9b375181e8 100644
--- a/distutils/_modified.py
+++ b/distutils/_modified.py
@@ -5,7 +5,7 @@
 
 from ._functools import splat
 from .errors import DistutilsFileError
-from .py39compat import zip_strict
+from .compat.py39 import zip_strict
 
 
 def _newer(source, target):
diff --git a/distutils/compat/py38.py b/distutils/compat/py38.py
index 0af3814017..79afc3b295 100644
--- a/distutils/compat/py38.py
+++ b/distutils/compat/py38.py
@@ -21,3 +21,13 @@ def removesuffix(self, suffix):
 
     def removeprefix(self, prefix):
         return self.removeprefix(prefix)
+
+
+def aix_platform(osname, version, release):
+    try:
+        import _aix_support
+
+        return _aix_support.aix_platform()
+    except ImportError:
+        pass
+    return f"{osname}-{version}.{release}"
diff --git a/distutils/py39compat.py b/distutils/compat/py39.py
similarity index 100%
rename from distutils/py39compat.py
rename to distutils/compat/py39.py
diff --git a/distutils/py38compat.py b/distutils/py38compat.py
deleted file mode 100644
index ab12119fa5..0000000000
--- a/distutils/py38compat.py
+++ /dev/null
@@ -1,8 +0,0 @@
-def aix_platform(osname, version, release):
-    try:
-        import _aix_support
-
-        return _aix_support.aix_platform()
-    except ImportError:
-        pass
-    return f"{osname}-{version}.{release}"
diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py
index 1a38e9fa79..514e06e34b 100644
--- a/distutils/sysconfig.py
+++ b/distutils/sysconfig.py
@@ -16,7 +16,7 @@
 import sys
 import sysconfig
 
-from . import py39compat
+from .compat import py39
 from ._functools import pass_none
 from .errors import DistutilsPlatformError
 
@@ -538,7 +538,7 @@ def get_config_vars(*args):
     global _config_vars
     if _config_vars is None:
         _config_vars = sysconfig.get_config_vars().copy()
-        py39compat.add_ext_suffix(_config_vars)
+        py39.add_ext_suffix(_config_vars)
 
     return [_config_vars.get(name) for name in args] if args else _config_vars
 
diff --git a/distutils/util.py b/distutils/util.py
index 9ee77721b3..2cdea14381 100644
--- a/distutils/util.py
+++ b/distutils/util.py
@@ -34,7 +34,7 @@ def get_host_platform():
         if os.name == "posix" and hasattr(os, 'uname'):
             osname, host, release, version, machine = os.uname()
             if osname[:3] == "aix":
-                from .py38compat import aix_platform
+                from .compat.py38 import aix_platform
 
                 return aix_platform(osname, version, release)
 

From 6baafbc13bab7f7ee2fa671f40d31d0d58a3e78d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 20:45:42 -0400
Subject: [PATCH 055/151] Move compatibility module into compat package.

---
 conftest.py                                       | 2 +-
 distutils/tests/compat/__init__.py                | 0
 distutils/tests/{py38compat.py => compat/py38.py} | 0
 distutils/tests/test_archive_util.py              | 2 +-
 distutils/tests/test_bdist_rpm.py                 | 2 +-
 distutils/tests/test_build_ext.py                 | 2 +-
 distutils/tests/test_extension.py                 | 2 +-
 distutils/tests/test_filelist.py                  | 2 +-
 distutils/tests/test_sdist.py                     | 2 +-
 distutils/tests/test_spawn.py                     | 2 +-
 distutils/tests/test_unixccompiler.py             | 2 +-
 11 files changed, 9 insertions(+), 9 deletions(-)
 create mode 100644 distutils/tests/compat/__init__.py
 rename distutils/tests/{py38compat.py => compat/py38.py} (100%)

diff --git a/conftest.py b/conftest.py
index 3ce3411535..4a3bbd3436 100644
--- a/conftest.py
+++ b/conftest.py
@@ -56,7 +56,7 @@ def _save_cwd():
 
 @pytest.fixture
 def distutils_managed_tempdir(request):
-    from distutils.tests import py38compat as os_helper
+    from distutils.tests.compat import py38 as os_helper
 
     self = request.instance
     self.tempdirs = []
diff --git a/distutils/tests/compat/__init__.py b/distutils/tests/compat/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/distutils/tests/py38compat.py b/distutils/tests/compat/py38.py
similarity index 100%
rename from distutils/tests/py38compat.py
rename to distutils/tests/compat/py38.py
diff --git a/distutils/tests/test_archive_util.py b/distutils/tests/test_archive_util.py
index 145cce915d..02af2aa0fd 100644
--- a/distutils/tests/test_archive_util.py
+++ b/distutils/tests/test_archive_util.py
@@ -23,7 +23,7 @@
 import path
 import pytest
 
-from .py38compat import check_warnings
+from .compat.py38 import check_warnings
 from .unix_compat import UID_0_SUPPORT, grp, pwd, require_uid_0, require_unix_id
 
 
diff --git a/distutils/tests/test_bdist_rpm.py b/distutils/tests/test_bdist_rpm.py
index 769623cbb8..a5cb42c334 100644
--- a/distutils/tests/test_bdist_rpm.py
+++ b/distutils/tests/test_bdist_rpm.py
@@ -9,7 +9,7 @@
 
 import pytest
 
-from .py38compat import requires_zlib
+from .compat.py38 import requires_zlib
 
 SETUP_PY = """\
 from distutils.core import setup
diff --git a/distutils/tests/test_build_ext.py b/distutils/tests/test_build_ext.py
index ca5d9d57cd..cc83e7fbc8 100644
--- a/distutils/tests/test_build_ext.py
+++ b/distutils/tests/test_build_ext.py
@@ -31,7 +31,7 @@
 import path
 import pytest
 
-from . import py38compat as import_helper
+from .compat import py38 as import_helper
 
 
 @pytest.fixture()
diff --git a/distutils/tests/test_extension.py b/distutils/tests/test_extension.py
index 77bb147bfd..527a135506 100644
--- a/distutils/tests/test_extension.py
+++ b/distutils/tests/test_extension.py
@@ -6,7 +6,7 @@
 
 import pytest
 
-from .py38compat import check_warnings
+from .compat.py38 import check_warnings
 
 
 class TestExtension:
diff --git a/distutils/tests/test_filelist.py b/distutils/tests/test_filelist.py
index 6a379a6323..ec7e5cf363 100644
--- a/distutils/tests/test_filelist.py
+++ b/distutils/tests/test_filelist.py
@@ -10,7 +10,7 @@
 import jaraco.path
 import pytest
 
-from . import py38compat as os_helper
+from .compat import py38 as os_helper
 
 MANIFEST_IN = """\
 include ok
diff --git a/distutils/tests/test_sdist.py b/distutils/tests/test_sdist.py
index 66a4194706..a85997f1d5 100644
--- a/distutils/tests/test_sdist.py
+++ b/distutils/tests/test_sdist.py
@@ -20,7 +20,7 @@
 import pytest
 from more_itertools import ilen
 
-from .py38compat import check_warnings
+from .compat.py38 import check_warnings
 from .unix_compat import grp, pwd, require_uid_0, require_unix_id
 
 SETUP_PY = """
diff --git a/distutils/tests/test_spawn.py b/distutils/tests/test_spawn.py
index abbac4c23f..7ec5862666 100644
--- a/distutils/tests/test_spawn.py
+++ b/distutils/tests/test_spawn.py
@@ -12,7 +12,7 @@
 import path
 import pytest
 
-from . import py38compat as os_helper
+from .compat import py38 as os_helper
 
 
 class TestSpawn(support.TempdirManager):
diff --git a/distutils/tests/test_unixccompiler.py b/distutils/tests/test_unixccompiler.py
index 6f05fa6989..543aa20da9 100644
--- a/distutils/tests/test_unixccompiler.py
+++ b/distutils/tests/test_unixccompiler.py
@@ -12,7 +12,7 @@
 import pytest
 
 from . import support
-from .py38compat import EnvironmentVarGuard
+from .compat.py38 import EnvironmentVarGuard
 
 
 @pytest.fixture(autouse=True)

From 28d4a09ace8761e7ab6b9cc880f341844c350360 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 21:24:11 -0400
Subject: [PATCH 056/151] Fix return type to match implementation.

---
 distutils/compat/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/compat/__init__.py b/distutils/compat/__init__.py
index b1ee3fe8b0..4a7321fe70 100644
--- a/distutils/compat/__init__.py
+++ b/distutils/compat/__init__.py
@@ -3,7 +3,7 @@
 from .py38 import removeprefix
 
 
-def consolidate_linker_args(args: list[str]) -> str:
+def consolidate_linker_args(args: list[str]) -> list[str] | str:
     """
     Ensure the return value is a string for backward compatibility.
 

From 8a49e92fc332ee104eb38d8ac5466aac9a2f14aa Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 21:31:40 -0400
Subject: [PATCH 057/151] =?UTF-8?q?=F0=9F=A7=8E=E2=80=8D=E2=99=80=EF=B8=8F?=
 =?UTF-8?q?=20Genuflect=20to=20the=20types.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 distutils/compat/py38.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/compat/py38.py b/distutils/compat/py38.py
index 79afc3b295..2d44211147 100644
--- a/distutils/compat/py38.py
+++ b/distutils/compat/py38.py
@@ -25,7 +25,7 @@ def removeprefix(self, prefix):
 
 def aix_platform(osname, version, release):
     try:
-        import _aix_support
+        import _aix_support  # type: ignore
 
         return _aix_support.aix_platform()
     except ImportError:

From d746fff01063e8aa67efae8edbd388f62ff49554 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 13 Apr 2024 21:59:38 -0400
Subject: [PATCH 058/151] Oops. Meant 2025.

---
 distutils/compat/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/compat/__init__.py b/distutils/compat/__init__.py
index 4a7321fe70..e12534a32c 100644
--- a/distutils/compat/__init__.py
+++ b/distutils/compat/__init__.py
@@ -7,7 +7,7 @@ def consolidate_linker_args(args: list[str]) -> list[str] | str:
     """
     Ensure the return value is a string for backward compatibility.
 
-    Retain until at least 2024-04-31. See pypa/distutils#246
+    Retain until at least 2025-04-31. See pypa/distutils#246
     """
 
     if not all(arg.startswith('-Wl,') for arg in args):

From d8ccaf18f4eee7094afa1fd10aa0a702a327bc9e Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 18 Apr 2024 16:38:01 -0400
Subject: [PATCH 059/151] Migrated config to pyproject.toml using
 jaraco.develop.migrate-config and ini2toml.

---
 pyproject.toml | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-
 setup.cfg      | 50 ----------------------------------------------
 2 files changed, 53 insertions(+), 51 deletions(-)
 delete mode 100644 setup.cfg

diff --git a/pyproject.toml b/pyproject.toml
index 1faf0ec259..738546e400 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,59 @@
 [build-system]
-requires = ["setuptools>=56", "setuptools_scm[toml]>=3.4.1"]
+requires = ["setuptools>=61.2", "setuptools_scm[toml]>=3.4.1"]
 build-backend = "setuptools.build_meta"
 
+[project]
+name = "distutils"
+authors = [
+	{ name = "Jason R. Coombs", email = "jaraco@jaraco.com" },
+]
+description = "Distribution utilities formerly from standard library"
+readme = "README.rst"
+classifiers = [
+	"Development Status :: 5 - Production/Stable",
+	"Intended Audience :: Developers",
+	"License :: OSI Approved :: MIT License",
+	"Programming Language :: Python :: 3",
+	"Programming Language :: Python :: 3 :: Only",
+]
+requires-python = ">=3.8"
+dependencies = []
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "https://github.com/pypa/distutils"
+
+[project.optional-dependencies]
+testing = [
+	# upstream
+	"pytest >= 6, != 8.1.1",
+	"pytest-checkdocs >= 2.4",
+	"pytest-cov",
+	"pytest-mypy",
+	"pytest-enabler >= 2.2",
+	"pytest-ruff >= 0.2.1",
+
+	# local
+	"pytest >= 7.4.3", # 186
+	"jaraco.envs>=2.4",
+	"jaraco.path",
+	"jaraco.text",
+	"path >= 10.6",
+	"docutils",
+	"pyfakefs",
+	"more_itertools",
+]
+docs = [
+	# upstream
+	"sphinx >= 3.5",
+	"jaraco.packaging >= 9.3",
+	"rst.linker >= 1.9",
+	"furo",
+	"sphinx-lint",
+
+	# local
+]
+
 [tool.setuptools_scm]
 
 [tool.pytest-enabler.mypy]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index fc6d67ea46..0000000000
--- a/setup.cfg
+++ /dev/null
@@ -1,50 +0,0 @@
-[metadata]
-name = distutils
-author = Jason R. Coombs
-author_email = jaraco@jaraco.com
-description = Distribution utilities formerly from standard library
-long_description = file:README.rst
-url = https://github.com/pypa/distutils
-classifiers =
-	Development Status :: 5 - Production/Stable
-	Intended Audience :: Developers
-	License :: OSI Approved :: MIT License
-	Programming Language :: Python :: 3
-	Programming Language :: Python :: 3 :: Only
-
-[options]
-include_package_data = true
-python_requires = >=3.8
-install_requires =
-
-[options.extras_require]
-testing =
-	# upstream
-	pytest >= 6, != 8.1.1
-	pytest-checkdocs >= 2.4
-	pytest-cov
-	pytest-mypy
-	pytest-enabler >= 2.2
-	pytest-ruff >= 0.2.1
-
-	# local
-	pytest >= 7.4.3  #186
-	jaraco.envs>=2.4
-	jaraco.path
-	jaraco.text
-	path >= 10.6
-	docutils
-	pyfakefs
-	more_itertools
-
-docs =
-	# upstream
-	sphinx >= 3.5
-	jaraco.packaging >= 9.3
-	rst.linker >= 1.9
-	furo
-	sphinx-lint
-
-	# local
-
-[options.entry_points]

From bce1a225175b57528cc788eba78e5c07b03d970a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 15:44:11 -0400
Subject: [PATCH 060/151] Extract _make_executable for TestSpawn.

---
 distutils/tests/test_spawn.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/distutils/tests/test_spawn.py b/distutils/tests/test_spawn.py
index 7ec5862666..1f623837db 100644
--- a/distutils/tests/test_spawn.py
+++ b/distutils/tests/test_spawn.py
@@ -45,14 +45,9 @@ def test_spawn(self):
         spawn([exe])  # should work without any error
 
     def test_find_executable(self, tmp_path):
-        program_noeext = 'program'
-        # Give the temporary program an ".exe" suffix for all.
-        # It's needed on Windows and not harmful on other platforms.
-        program = program_noeext + ".exe"
-
-        program_path = tmp_path / program
-        program_path.write_text("", encoding='utf-8')
-        program_path.chmod(stat.S_IXUSR)
+        program_path = self._make_executable(tmp_path, '.exe')
+        program = program_path.name
+        program_noeext = program_path.with_suffix('').name
         filename = str(program_path)
         tmp_dir = path.Path(tmp_path)
 
@@ -121,6 +116,15 @@ def test_find_executable(self, tmp_path):
                 rv = find_executable(program)
                 assert rv == filename
 
+    @staticmethod
+    def _make_executable(tmp_path, ext):
+        # Give the temporary program a suffix regardless of platform.
+        # It's needed on Windows and not harmful on others.
+        program = tmp_path.joinpath('program').with_suffix(ext)
+        program.write_text("", encoding='utf-8')
+        program.chmod(stat.S_IXUSR)
+        return program
+
     def test_spawn_missing_exe(self):
         with pytest.raises(DistutilsExecError) as ctx:
             spawn(['does-not-exist'])

From 5d2a97eae704496195d5a87f9fb5e913a3fa32f5 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 18:10:02 -0400
Subject: [PATCH 061/151] Move and reword comment for brevity and clarity.

---
 distutils/spawn.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index 046b5bbb82..76a2dc3f42 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -83,14 +83,13 @@ def find_executable(executable, path=None):
 
     if path is None:
         path = os.environ.get('PATH', None)
+        # bpo-35755: Don't fall through if PATH is the empty string
         if path is None:
             try:
                 path = os.confstr("CS_PATH")
             except (AttributeError, ValueError):
                 # os.confstr() or CS_PATH is not available
                 path = os.defpath
-        # bpo-35755: Don't use os.defpath if the PATH environment variable is
-        # set to an empty string
 
     # PATH='' doesn't match, whereas PATH=':' looks in the current directory
     if not path:

From 7babb5d5bfd477500f41ac5eecbee44591aed3e3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 21:52:29 -0400
Subject: [PATCH 062/151] Remove C901 exclusion; code is now compliant.

---
 distutils/spawn.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index 76a2dc3f42..3927c1fe9a 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -15,7 +15,7 @@
 from .errors import DistutilsExecError
 
 
-def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):  # noqa: C901
+def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
     """Run another program, specified as a command list 'cmd', in a new process.
 
     'cmd' is just the argument list for the new process, ie.

From 2db55275fff5512961a2c40e6f211c418096d4ef Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 21:54:38 -0400
Subject: [PATCH 063/151] Remove apparently unnecessary cast to list.

---
 distutils/spawn.py | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index 3927c1fe9a..a321c5f04c 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -31,10 +31,6 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
     Raise DistutilsExecError if running the program fails in any way; just
     return on success.
     """
-    # cmd is documented as a list, but just in case some code passes a tuple
-    # in, protect our %-formatting code against horrible death
-    cmd = list(cmd)
-
     log.info(subprocess.list2cmdline(cmd))
     if dry_run:
         return

From 671f913695aa82f6729e3ba1482b395123db393d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 21:56:20 -0400
Subject: [PATCH 064/151] Use proper boolean literals.

---
 distutils/spawn.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index a321c5f04c..a7e21d2e88 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -15,7 +15,7 @@
 from .errors import DistutilsExecError
 
 
-def spawn(cmd, search_path=1, verbose=0, dry_run=0, env=None):
+def spawn(cmd, search_path=True, verbose=False, dry_run=False, env=None):
     """Run another program, specified as a command list 'cmd', in a new process.
 
     'cmd' is just the argument list for the new process, ie.

From ffdb32da4165cf8a0628212e547b1c3eb2e613f3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 22:00:36 -0400
Subject: [PATCH 065/151] Replace Popen with check_call.

---
 distutils/spawn.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index a7e21d2e88..0d86552eed 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -50,18 +50,17 @@ def spawn(cmd, search_path=True, verbose=False, dry_run=False, env=None):
             env[MACOSX_VERSION_VAR] = macosx_target_ver
 
     try:
-        proc = subprocess.Popen(cmd, env=env)
-        proc.wait()
-        exitcode = proc.returncode
+        subprocess.check_call(cmd, env=env)
     except OSError as exc:
         if not DEBUG:
             cmd = cmd[0]
         raise DistutilsExecError(f"command {cmd!r} failed: {exc.args[-1]}") from exc
-
-    if exitcode:
+    except subprocess.CalledProcessError as err:
         if not DEBUG:
             cmd = cmd[0]
-        raise DistutilsExecError(f"command {cmd!r} failed with exit code {exitcode}")
+        raise DistutilsExecError(
+            f"command {cmd!r} failed with exit code {err.returncode}"
+        ) from err
 
 
 def find_executable(executable, path=None):

From a4a1f23e91e7e0bdab0772fb191bd91924032fe3 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 22:03:14 -0400
Subject: [PATCH 066/151] Extract function for _debug wrapper.

---
 distutils/spawn.py | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index 0d86552eed..760506550d 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -15,6 +15,13 @@
 from .errors import DistutilsExecError
 
 
+def _debug(cmd):
+    """
+    Render a subprocess command differently depending on DEBUG.
+    """
+    return cmd if DEBUG else cmd[0]
+
+
 def spawn(cmd, search_path=True, verbose=False, dry_run=False, env=None):
     """Run another program, specified as a command list 'cmd', in a new process.
 
@@ -52,14 +59,12 @@ def spawn(cmd, search_path=True, verbose=False, dry_run=False, env=None):
     try:
         subprocess.check_call(cmd, env=env)
     except OSError as exc:
-        if not DEBUG:
-            cmd = cmd[0]
-        raise DistutilsExecError(f"command {cmd!r} failed: {exc.args[-1]}") from exc
+        raise DistutilsExecError(
+            f"command {_debug(cmd)!r} failed: {exc.args[-1]}"
+        ) from exc
     except subprocess.CalledProcessError as err:
-        if not DEBUG:
-            cmd = cmd[0]
         raise DistutilsExecError(
-            f"command {cmd!r} failed with exit code {err.returncode}"
+            f"command {_debug(cmd)!r} failed with exit code {err.returncode}"
         ) from err
 
 

From 0bb80360811ce814d14bc8edd9073f0da27b5353 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 22:23:19 -0400
Subject: [PATCH 067/151] Extract function to inject macos version.

---
 distutils/spawn.py | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index 760506550d..081e254910 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -6,10 +6,15 @@
 executable name.
 """
 
+from __future__ import annotations
+
 import os
+import platform
 import subprocess
 import sys
 
+from typing import Mapping
+
 from ._log import log
 from .debug import DEBUG
 from .errors import DistutilsExecError
@@ -22,6 +27,21 @@ def _debug(cmd):
     return cmd if DEBUG else cmd[0]
 
 
+def _inject_macos_ver(env: Mapping[str:str] | None) -> Mapping[str:str] | None:
+    if platform.system() != 'Darwin':
+        return env
+
+    from distutils.util import MACOSX_VERSION_VAR, get_macosx_target_ver
+
+    target_ver = get_macosx_target_ver()
+    update = {MACOSX_VERSION_VAR: target_ver} if target_ver else {}
+    return {**_resolve(env), **update}
+
+
+def _resolve(env: Mapping[str:str] | None) -> Mapping[str:str]:
+    return os.environ if env is None else env
+
+
 def spawn(cmd, search_path=True, verbose=False, dry_run=False, env=None):
     """Run another program, specified as a command list 'cmd', in a new process.
 
@@ -47,17 +67,8 @@ def spawn(cmd, search_path=True, verbose=False, dry_run=False, env=None):
         if executable is not None:
             cmd[0] = executable
 
-    env = env if env is not None else dict(os.environ)
-
-    if sys.platform == 'darwin':
-        from distutils.util import MACOSX_VERSION_VAR, get_macosx_target_ver
-
-        macosx_target_ver = get_macosx_target_ver()
-        if macosx_target_ver:
-            env[MACOSX_VERSION_VAR] = macosx_target_ver
-
     try:
-        subprocess.check_call(cmd, env=env)
+        subprocess.check_call(cmd, env=_inject_macos_ver(env))
     except OSError as exc:
         raise DistutilsExecError(
             f"command {_debug(cmd)!r} failed: {exc.args[-1]}"

From de48bf21fd3029e75b3ab59163ace3b231565644 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sun, 21 Apr 2024 02:42:25 -0400
Subject: [PATCH 068/151] =?UTF-8?q?=F0=9F=91=B9=20Feed=20the=20hobgoblins?=
 =?UTF-8?q?=20(delint).?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 distutils/_modified.py | 2 +-
 distutils/spawn.py     | 1 -
 distutils/sysconfig.py | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/distutils/_modified.py b/distutils/_modified.py
index 9b375181e8..07b2ead0ed 100644
--- a/distutils/_modified.py
+++ b/distutils/_modified.py
@@ -4,8 +4,8 @@
 import os.path
 
 from ._functools import splat
-from .errors import DistutilsFileError
 from .compat.py39 import zip_strict
+from .errors import DistutilsFileError
 
 
 def _newer(source, target):
diff --git a/distutils/spawn.py b/distutils/spawn.py
index 081e254910..234d5cd11f 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -12,7 +12,6 @@
 import platform
 import subprocess
 import sys
-
 from typing import Mapping
 
 from ._log import log
diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py
index 514e06e34b..4ed51c1f03 100644
--- a/distutils/sysconfig.py
+++ b/distutils/sysconfig.py
@@ -16,8 +16,8 @@
 import sys
 import sysconfig
 
-from .compat import py39
 from ._functools import pass_none
+from .compat import py39
 from .errors import DistutilsPlatformError
 
 IS_PYPY = '__pypy__' in sys.builtin_module_names

From 213fae9b0d7b63b00338d5b5ac8f25a220ca04ed Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 29 May 2024 12:24:29 -0400
Subject: [PATCH 069/151] Use mkstemp unconditionally. mktemp has been
 deprecated since Python 2.3.

---
 distutils/util.py | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/distutils/util.py b/distutils/util.py
index 2cdea14381..0a8b3d690c 100644
--- a/distutils/util.py
+++ b/distutils/util.py
@@ -12,6 +12,7 @@
 import subprocess
 import sys
 import sysconfig
+import tempfile
 
 from ._log import log
 from ._modified import newer
@@ -405,20 +406,10 @@ def byte_compile(  # noqa: C901
     # "Indirect" byte-compilation: write a temporary script and then
     # run it with the appropriate flags.
     if not direct:
-        try:
-            from tempfile import mkstemp
-
-            (script_fd, script_name) = mkstemp(".py")
-        except ImportError:
-            from tempfile import mktemp
-
-            (script_fd, script_name) = None, mktemp(".py")
+        (script_fd, script_name) = tempfile.mkstemp(".py")
         log.info("writing byte-compilation script '%s'", script_name)
         if not dry_run:
-            if script_fd is not None:
-                script = os.fdopen(script_fd, "w", encoding='utf-8')
-            else:  # pragma: no cover
-                script = open(script_name, "w", encoding='utf-8')
+            script = os.fdopen(script_fd, "w", encoding='utf-8')
 
             with script:
                 script.write(

From b93a0ba42053bf8fe5f19941cbe4987160e584c8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 19 Jun 2024 13:46:47 -0400
Subject: [PATCH 070/151] Pin to pytest<8.1.

Closes pypa/distutils#259
Ref pytest-dev/pytest#12490
---
 pyproject.toml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pyproject.toml b/pyproject.toml
index cda381abb7..30bfd7d730 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -42,6 +42,9 @@ test = [
 	"docutils",
 	"pyfakefs",
 	"more_itertools",
+
+	# workaround for pytest-dev/pytest#12490
+	"pytest < 8.1; python_version < '3.12'",
 ]
 doc = [
 	# upstream

From 01e5f2d3647658e428462063010fc366bfd57dcc Mon Sep 17 00:00:00 2001
From: Stephen Brennan 
Date: Tue, 25 Jun 2024 10:27:30 -0700
Subject: [PATCH 071/151] Use a separate build directory for free-threading

Signed-off-by: Stephen Brennan 
---
 distutils/command/build.py    | 5 +++++
 distutils/tests/test_build.py | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/distutils/command/build.py b/distutils/command/build.py
index d18ed503e3..766a2ab191 100644
--- a/distutils/command/build.py
+++ b/distutils/command/build.py
@@ -4,6 +4,7 @@
 
 import os
 import sys
+import sysconfig
 
 from ..core import Command
 from ..errors import DistutilsOptionError
@@ -81,6 +82,10 @@ def finalize_options(self):  # noqa: C901
 
         plat_specifier = f".{self.plat_name}-{sys.implementation.cache_tag}"
 
+        # Python 3.13+ with --disable-gil shouldn't share build directories
+        if sysconfig.get_config_var('Py_GIL_DISABLED'):
+            plat_specifier += 't'
+
         # Make it so Python 2.x and Python 2.x with --with-pydebug don't
         # share the same build directories. Doing so confuses the build
         # process for C modules
diff --git a/distutils/tests/test_build.py b/distutils/tests/test_build.py
index 25483ad76b..8fb1bc1b77 100644
--- a/distutils/tests/test_build.py
+++ b/distutils/tests/test_build.py
@@ -4,6 +4,7 @@
 import sys
 from distutils.command.build import build
 from distutils.tests import support
+from sysconfig import get_config_var
 from sysconfig import get_platform
 
 
@@ -24,6 +25,8 @@ def test_finalize_options(self):
         # examples:
         #   build/lib.macosx-10.3-i386-cpython39
         plat_spec = f'.{cmd.plat_name}-{sys.implementation.cache_tag}'
+        if get_config_var('Py_GIL_DISABLED'):
+            plat_spec += 't'
         if hasattr(sys, 'gettotalrefcount'):
             assert cmd.build_platlib.endswith('-pydebug')
             plat_spec += '-pydebug'

From 314e3f187014000efc321cc1cec239620538426a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Sat, 20 Apr 2024 22:58:10 -0400
Subject: [PATCH 072/151] Deprecate find_executable.

---
 distutils/spawn.py                   | 10 +++++++---
 distutils/tests/__init__.py          |  5 +++--
 distutils/tests/test_archive_util.py |  4 ++--
 distutils/tests/test_bdist_rpm.py    | 10 +++++-----
 distutils/tests/test_sdist.py        | 10 +++++-----
 pytest.ini                           |  5 ++++-
 6 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index 234d5cd11f..429d1ccb2e 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -2,16 +2,17 @@
 
 Provides the 'spawn()' function, a front-end to various platform-
 specific functions for launching another program in a sub-process.
-Also provides the 'find_executable()' to search the path for a given
-executable name.
 """
 
 from __future__ import annotations
 
 import os
 import platform
+import shutil
 import subprocess
 import sys
+import warnings
+
 from typing import Mapping
 
 from ._log import log
@@ -62,7 +63,7 @@ def spawn(cmd, search_path=True, verbose=False, dry_run=False, env=None):
         return
 
     if search_path:
-        executable = find_executable(cmd[0])
+        executable = shutil.which(cmd[0])
         if executable is not None:
             cmd[0] = executable
 
@@ -84,6 +85,9 @@ def find_executable(executable, path=None):
     A string listing directories separated by 'os.pathsep'; defaults to
     os.environ['PATH'].  Returns the complete filename or None if not found.
     """
+    warnings.warn(
+        'Use shutil.which instead of find_executable', DeprecationWarning, stacklevel=2
+    )
     _, ext = os.path.splitext(executable)
     if (sys.platform == 'win32') and (ext != '.exe'):
         executable = executable + '.exe'
diff --git a/distutils/tests/__init__.py b/distutils/tests/__init__.py
index 20dfe8f19b..16b68b4e24 100644
--- a/distutils/tests/__init__.py
+++ b/distutils/tests/__init__.py
@@ -7,6 +7,7 @@
 by import rather than matching pre-defined names.
 """
 
+import shutil
 from typing import Sequence
 
 
@@ -19,7 +20,7 @@ def missing_compiler_executable(cmd_names: Sequence[str] = []):  # pragma: no co
     missing.
 
     """
-    from distutils import ccompiler, errors, spawn, sysconfig
+    from distutils import ccompiler, errors, sysconfig
 
     compiler = ccompiler.new_compiler()
     sysconfig.customize_compiler(compiler)
@@ -37,5 +38,5 @@ def missing_compiler_executable(cmd_names: Sequence[str] = []):  # pragma: no co
             assert cmd is not None, "the '%s' executable is not configured" % name
         elif not cmd:
             continue
-        if spawn.find_executable(cmd[0]) is None:
+        if shutil.which(cmd[0]) is None:
             return cmd[0]
diff --git a/distutils/tests/test_archive_util.py b/distutils/tests/test_archive_util.py
index 02af2aa0fd..abbcd36cb0 100644
--- a/distutils/tests/test_archive_util.py
+++ b/distutils/tests/test_archive_util.py
@@ -135,7 +135,7 @@ def _create_files(self):
         return tmpdir
 
     @pytest.mark.usefixtures('needs_zlib')
-    @pytest.mark.skipif("not (find_executable('tar') and find_executable('gzip'))")
+    @pytest.mark.skipif("not (shutil.which('tar') and shutil.which('gzip'))")
     def test_tarfile_vs_tar(self):
         tmpdir = self._create_files()
         tmpdir2 = self.mkdtemp()
@@ -190,7 +190,7 @@ def test_tarfile_vs_tar(self):
         tarball = base_name + '.tar'
         assert os.path.exists(tarball)
 
-    @pytest.mark.skipif("not find_executable('compress')")
+    @pytest.mark.skipif("not shutil.which('compress')")
     def test_compress_deprecated(self):
         tmpdir = self._create_files()
         base_name = os.path.join(self.mkdtemp(), 'archive')
diff --git a/distutils/tests/test_bdist_rpm.py b/distutils/tests/test_bdist_rpm.py
index a5cb42c334..28edda4dd0 100644
--- a/distutils/tests/test_bdist_rpm.py
+++ b/distutils/tests/test_bdist_rpm.py
@@ -1,10 +1,10 @@
 """Tests for distutils.command.bdist_rpm."""
 
 import os
+import shutil  # noqa: F401
 import sys
 from distutils.command.bdist_rpm import bdist_rpm
 from distutils.core import Distribution
-from distutils.spawn import find_executable  # noqa: F401
 from distutils.tests import support
 
 import pytest
@@ -43,8 +43,8 @@ class TestBuildRpm(
 ):
     @mac_woes
     @requires_zlib()
-    @pytest.mark.skipif("not find_executable('rpm')")
-    @pytest.mark.skipif("not find_executable('rpmbuild')")
+    @pytest.mark.skipif("not shutil.which('rpm')")
+    @pytest.mark.skipif("not shutil.which('rpmbuild')")
     def test_quiet(self):
         # let's create a package
         tmp_dir = self.mkdtemp()
@@ -86,8 +86,8 @@ def test_quiet(self):
     @mac_woes
     @requires_zlib()
     # https://bugs.python.org/issue1533164
-    @pytest.mark.skipif("not find_executable('rpm')")
-    @pytest.mark.skipif("not find_executable('rpmbuild')")
+    @pytest.mark.skipif("not shutil.which('rpm')")
+    @pytest.mark.skipif("not shutil.which('rpmbuild')")
     def test_no_optimize_flag(self):
         # let's create a package that breaks bdist_rpm
         tmp_dir = self.mkdtemp()
diff --git a/distutils/tests/test_sdist.py b/distutils/tests/test_sdist.py
index a85997f1d5..6a1aa51862 100644
--- a/distutils/tests/test_sdist.py
+++ b/distutils/tests/test_sdist.py
@@ -2,6 +2,7 @@
 
 import os
 import pathlib
+import shutil  # noqa: F401
 import tarfile
 import warnings
 import zipfile
@@ -10,7 +11,6 @@
 from distutils.core import Distribution
 from distutils.errors import DistutilsOptionError
 from distutils.filelist import FileList
-from distutils.spawn import find_executable  # noqa: F401
 from distutils.tests.test_config import BasePyPIRCCommandTestCase
 from os.path import join
 from textwrap import dedent
@@ -137,8 +137,8 @@ def test_prune_file_list(self):
         assert sorted(content) == ['fake-1.0/' + x for x in expected]
 
     @pytest.mark.usefixtures('needs_zlib')
-    @pytest.mark.skipif("not find_executable('tar')")
-    @pytest.mark.skipif("not find_executable('gzip')")
+    @pytest.mark.skipif("not shutil.which('tar')")
+    @pytest.mark.skipif("not shutil.which('gzip')")
     def test_make_distribution(self):
         # now building a sdist
         dist, cmd = self.get_cmd()
@@ -434,8 +434,8 @@ def test_manual_manifest(self):
     @pytest.mark.usefixtures('needs_zlib')
     @require_unix_id
     @require_uid_0
-    @pytest.mark.skipif("not find_executable('tar')")
-    @pytest.mark.skipif("not find_executable('gzip')")
+    @pytest.mark.skipif("not shutil.which('tar')")
+    @pytest.mark.skipif("not shutil.which('gzip')")
     def test_make_distribution_owner_group(self):
         # now building a sdist
         dist, cmd = self.get_cmd()
diff --git a/pytest.ini b/pytest.ini
index f9b1d1fcd2..b53e0d93a1 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -35,5 +35,8 @@ filterwarnings=
 	# suppress warnings in deprecated compilers
 	ignore:(bcpp|msvc9?)compiler is deprecated
 
-	# suppress well know deprecation warning
+	# suppress well known deprecation warning
 	ignore:distutils.log.Log is deprecated
+
+	# suppress known deprecation
+	ignore:Use shutil.which instead of find_executable:DeprecationWarning

From 8ecebe23ff278b702e6e9298849e68c48f6ddfaa Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 27 Jun 2024 04:33:57 -0400
Subject: [PATCH 073/151] Apply canonicalize_version with
 strip_trailing_zero=False.

---
 distutils/dist.py | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/distutils/dist.py b/distutils/dist.py
index 9f570593e0..d3a3f23a45 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -13,7 +13,7 @@
 from collections.abc import Iterable
 from email import message_from_file
 
-from ._vendor.packaging.utils import canonicalize_name
+from ._vendor.packaging.utils import canonicalize_name, canonicalize_version
 
 try:
     import warnings
@@ -1191,9 +1191,25 @@ def get_version(self):
         return self.version or "0.0.0"
 
     def get_fullname(self):
+        return self._fullname(self.get_name(), self.get_version())
+
+    @staticmethod
+    def _fullname(name: str, version: str) -> str:
+        """
+        >>> DistributionMetadata._fullname('setup.tools', '1.0-2')
+        'setup_tools-1.0.post2'
+        >>> DistributionMetadata._fullname('setup-tools', '1.2post2')
+        'setup_tools-1.2.post2'
+        >>> DistributionMetadata._fullname('setup-tools', '1.0-r2')
+        'setup_tools-1.0.post2'
+        >>> DistributionMetadata._fullname('setup.tools', '1.0.post')
+        'setup_tools-1.0.post0'
+        >>> DistributionMetadata._fullname('setup.tools', '1.0+ubuntu-1')
+        'setup_tools-1.0+ubuntu.1'
+        """
         return "{}-{}".format(
-            canonicalize_name(self.get_name()).replace('-', '_'),
-            self.get_version(),
+            canonicalize_name(name).replace('-', '_'),
+            canonicalize_version(version, strip_trailing_zero=False),
         )
 
     def get_author(self):

From a68cac3c7e847138ed0b80e669faf0025117511a Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 18:57:12 +0200
Subject: [PATCH 074/151] Apply ruff rule RUF100

RUF100 Unused `noqa` directive
---
 distutils/bcppcompiler.py             | 2 +-
 distutils/command/__init__.py         | 2 +-
 distutils/msvccompiler.py             | 2 +-
 distutils/tests/test_unixccompiler.py | 2 +-
 ruff.toml                             | 1 +
 5 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/distutils/bcppcompiler.py b/distutils/bcppcompiler.py
index c1341e43cb..d1af267d29 100644
--- a/distutils/bcppcompiler.py
+++ b/distutils/bcppcompiler.py
@@ -84,7 +84,7 @@ def __init__(self, verbose=0, dry_run=0, force=0):
 
     # -- Worker methods ------------------------------------------------
 
-    def compile(  # noqa: C901
+    def compile(
         self,
         sources,
         output_dir=None,
diff --git a/distutils/command/__init__.py b/distutils/command/__init__.py
index 028dcfa0fc..1e8fbe60c2 100644
--- a/distutils/command/__init__.py
+++ b/distutils/command/__init__.py
@@ -3,7 +3,7 @@
 Package containing implementation of all the standard Distutils
 commands."""
 
-__all__ = [  # noqa: F822
+__all__ = [
     'build',
     'build_py',
     'build_ext',
diff --git a/distutils/msvccompiler.py b/distutils/msvccompiler.py
index ac8b68c08c..05ef01facf 100644
--- a/distutils/msvccompiler.py
+++ b/distutils/msvccompiler.py
@@ -684,6 +684,6 @@ def set_path_env_var(self, name):
     OldMSVCCompiler = MSVCCompiler
     # get_build_architecture not really relevant now we support cross-compile
     from distutils.msvc9compiler import (
-        MacroExpander,  # noqa: F811
+        MacroExpander,
         MSVCCompiler,
     )
diff --git a/distutils/tests/test_unixccompiler.py b/distutils/tests/test_unixccompiler.py
index 543aa20da9..d2c88e9116 100644
--- a/distutils/tests/test_unixccompiler.py
+++ b/distutils/tests/test_unixccompiler.py
@@ -32,7 +32,7 @@ def rpath_foo(self):
 
 
 class TestUnixCCompiler(support.TempdirManager):
-    @pytest.mark.skipif('platform.system == "Windows"')  # noqa: C901
+    @pytest.mark.skipif('platform.system == "Windows"')
     def test_runtime_libdir_option(self):  # noqa: C901
         # Issue #5900; GitHub Issue #37
         #
diff --git a/ruff.toml b/ruff.toml
index 70612985a7..f2c67aeb86 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -1,6 +1,7 @@
 [lint]
 extend-select = [
 	"C901",
+	"RUF100",
 	"W",
 ]
 ignore = [

From df0502f7837f682e6157b597e0e5526dda128850 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 27 Jun 2024 04:46:29 -0400
Subject: [PATCH 075/151] Move local ruff rules into a local section.

---
 ruff.toml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ruff.toml b/ruff.toml
index f2c67aeb86..3550acad03 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -1,8 +1,10 @@
 [lint]
 extend-select = [
 	"C901",
-	"RUF100",
 	"W",
+
+	# local
+	"RUF100",
 ]
 ignore = [
 	# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules

From 54858be557f1abbe2dda156197f169db7649bb8b Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 19:29:44 +0200
Subject: [PATCH 076/151] Apply ruff rule RUF010

RUF010 Use explicit conversion flag
---
 distutils/command/bdist_dumb.py | 2 +-
 distutils/command/bdist_rpm.py  | 2 +-
 distutils/dist.py               | 2 +-
 distutils/version.py            | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/distutils/command/bdist_dumb.py b/distutils/command/bdist_dumb.py
index 06502d201e..b103516de6 100644
--- a/distutils/command/bdist_dumb.py
+++ b/distutils/command/bdist_dumb.py
@@ -116,7 +116,7 @@ def run(self):
             ):
                 raise DistutilsPlatformError(
                     "can't make a dumb built distribution where "
-                    f"base and platbase are different ({repr(install.install_base)}, {repr(install.install_platbase)})"
+                    f"base and platbase are different ({install.install_base!r}, {install.install_platbase!r})"
                 )
             else:
                 archive_root = os.path.join(
diff --git a/distutils/command/bdist_rpm.py b/distutils/command/bdist_rpm.py
index 649968a5eb..64a29a2401 100644
--- a/distutils/command/bdist_rpm.py
+++ b/distutils/command/bdist_rpm.py
@@ -370,7 +370,7 @@ def run(self):  # noqa: C901
 
             status = out.close()
             if status:
-                raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))
+                raise DistutilsExecError("Failed to execute: %r" % q_cmd)
 
         finally:
             out.close()
diff --git a/distutils/dist.py b/distutils/dist.py
index 668ce7eb0a..f1f8db9a73 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -262,7 +262,7 @@ def __init__(self, attrs=None):  # noqa: C901
                 elif hasattr(self, key):
                     setattr(self, key, val)
                 else:
-                    msg = "Unknown distribution option: %s" % repr(key)
+                    msg = "Unknown distribution option: %r" % key
                     warnings.warn(msg)
 
         # no-user-cfg is handled before other command line args
diff --git a/distutils/version.py b/distutils/version.py
index 806d233ca5..942b56bf94 100644
--- a/distutils/version.py
+++ b/distutils/version.py
@@ -60,7 +60,7 @@ def __init__(self, vstring=None):
         )
 
     def __repr__(self):
-        return f"{self.__class__.__name__} ('{str(self)}')"
+        return f"{self.__class__.__name__} ('{self}')"
 
     def __eq__(self, other):
         c = self._cmp(other)
@@ -153,7 +153,7 @@ class StrictVersion(Version):
     def parse(self, vstring):
         match = self.version_re.match(vstring)
         if not match:
-            raise ValueError("invalid version number '%s'" % vstring)
+            raise ValueError(f"invalid version number '{vstring}'")
 
         (major, minor, patch, prerelease, prerelease_num) = match.group(1, 2, 4, 5, 6)
 
@@ -330,7 +330,7 @@ def __str__(self):
         return self.vstring
 
     def __repr__(self):
-        return "LooseVersion ('%s')" % str(self)
+        return f"LooseVersion ('{self}')"
 
     def _cmp(self, other):
         if isinstance(other, str):

From 3701d1341a5c8641dee595734c2c9a57b519e205 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 19:30:28 +0200
Subject: [PATCH 077/151] Enable ruff rule RUF010

---
 ruff.toml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ruff.toml b/ruff.toml
index 70612985a7..49934c7da8 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -1,6 +1,7 @@
 [lint]
 extend-select = [
 	"C901",
+	"RUF010",
 	"W",
 ]
 ignore = [

From 4cbdaffb3651f888b6c8648e8796becfe5b15a8d Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 19:18:45 +0200
Subject: [PATCH 078/151] Apply ruff/pyupgrade rule UP031

UP031 Use format specifiers instead of percent format
---
 distutils/_modified.py             |  2 +-
 distutils/archive_util.py          | 11 ++++-----
 distutils/bcppcompiler.py          |  6 ++---
 distutils/ccompiler.py             | 38 ++++++++++++++----------------
 distutils/cmd.py                   | 10 ++++----
 distutils/command/bdist.py         |  6 ++---
 distutils/command/bdist_dumb.py    |  4 ++--
 distutils/command/bdist_rpm.py     | 24 +++++++++----------
 distutils/command/build.py         |  2 +-
 distutils/command/build_clib.py    | 12 +++++-----
 distutils/command/build_ext.py     | 12 +++++-----
 distutils/command/build_py.py      |  8 +++----
 distutils/command/build_scripts.py |  2 +-
 distutils/command/check.py         |  4 ++--
 distutils/command/config.py        | 10 ++++----
 distutils/command/install.py       | 12 +++++-----
 distutils/command/install_lib.py   |  2 +-
 distutils/command/register.py      |  9 ++++---
 distutils/command/sdist.py         | 12 +++++-----
 distutils/command/upload.py        |  8 +++----
 distutils/config.py                |  4 ++--
 distutils/core.py                  | 11 ++++-----
 distutils/cygwinccompiler.py       | 26 ++++++++++----------
 distutils/dir_util.py              |  2 +-
 distutils/dist.py                  | 28 +++++++++++-----------
 distutils/extension.py             |  6 ++---
 distutils/fancy_getopt.py          | 14 +++++------
 distutils/file_util.py             |  6 ++---
 distutils/filelist.py              | 16 ++++++-------
 distutils/msvc9compiler.py         | 18 +++++++-------
 distutils/msvccompiler.py          | 14 +++++------
 distutils/sysconfig.py             |  4 ++--
 distutils/tests/__init__.py        |  2 +-
 distutils/tests/test_bdist.py      |  2 +-
 distutils/tests/test_bdist_dumb.py |  2 +-
 distutils/tests/test_build_clib.py |  2 +-
 distutils/tests/test_build_ext.py  |  4 ++--
 distutils/tests/test_build_py.py   |  4 ++--
 distutils/tests/test_clean.py      |  2 +-
 distutils/tests/test_config_cmd.py |  6 ++---
 distutils/tests/test_dir_util.py   |  6 ++---
 distutils/tests/test_file_util.py  |  2 +-
 distutils/tests/test_install.py    |  4 ++--
 distutils/tests/test_spawn.py      |  4 ++--
 distutils/text_file.py             |  2 +-
 distutils/util.py                  | 10 ++++----
 distutils/version.py               |  4 ++--
 distutils/versionpredicate.py      | 10 ++++----
 48 files changed, 202 insertions(+), 207 deletions(-)

diff --git a/distutils/_modified.py b/distutils/_modified.py
index 07b2ead0ed..6532aa1073 100644
--- a/distutils/_modified.py
+++ b/distutils/_modified.py
@@ -24,7 +24,7 @@ def newer(source, target):
     Raises DistutilsFileError if 'source' does not exist.
     """
     if not os.path.exists(source):
-        raise DistutilsFileError("file '%s' does not exist" % os.path.abspath(source))
+        raise DistutilsFileError(f"file '{os.path.abspath(source)}' does not exist")
 
     return _newer(source, target)
 
diff --git a/distutils/archive_util.py b/distutils/archive_util.py
index 052f6e4646..27b497f36c 100644
--- a/distutils/archive_util.py
+++ b/distutils/archive_util.py
@@ -113,7 +113,7 @@ def _set_uid_gid(tarinfo):
         return tarinfo
 
     if not dry_run:
-        tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])
+        tar = tarfile.open(archive_name, f'w|{tar_compression[compress]}')
         try:
             tar.add(base_dir, filter=_set_uid_gid)
         finally:
@@ -160,12 +160,11 @@ def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):  # noqa: C901
             # XXX really should distinguish between "couldn't find
             # external 'zip' command" and "zip failed".
             raise DistutilsExecError(
-                (
-                    "unable to create zip file '%s': "
+
+                    f"unable to create zip file '{zip_filename}': "
                     "could neither import the 'zipfile' module nor "
                     "find a standalone zip utility"
-                )
-                % zip_filename
+
             )
 
     else:
@@ -260,7 +259,7 @@ def make_archive(
     try:
         format_info = ARCHIVE_FORMATS[format]
     except KeyError:
-        raise ValueError("unknown archive format '%s'" % format)
+        raise ValueError(f"unknown archive format '{format}'")
 
     func = format_info[0]
     for arg, val in format_info[1]:
diff --git a/distutils/bcppcompiler.py b/distutils/bcppcompiler.py
index c1341e43cb..d6f518bb48 100644
--- a/distutils/bcppcompiler.py
+++ b/distutils/bcppcompiler.py
@@ -234,11 +234,11 @@ def link(  # noqa: C901
                 head, tail = os.path.split(output_filename)
                 modname, ext = os.path.splitext(tail)
                 temp_dir = os.path.dirname(objects[0])  # preserve tree structure
-                def_file = os.path.join(temp_dir, '%s.def' % modname)
+                def_file = os.path.join(temp_dir, f'{modname}.def')
                 contents = ['EXPORTS']
                 for sym in export_symbols or []:
                     contents.append(f'  {sym}=_{sym}')
-                self.execute(write_file, (def_file, contents), "writing %s" % def_file)
+                self.execute(write_file, (def_file, contents), f"writing {def_file}")
 
             # Borland C++ has problems with '/' in paths
             objects2 = map(os.path.normpath, objects)
@@ -254,7 +254,7 @@ def link(  # noqa: C901
                     objects.append(file)
 
             for ell in library_dirs:
-                ld_args.append("/L%s" % os.path.normpath(ell))
+                ld_args.append(f"/L{os.path.normpath(ell)}")
             ld_args.append("/L.")  # we sometimes use relative paths
 
             # list of object files
diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py
index 8876d73098..0671bd3fda 100644
--- a/distutils/ccompiler.py
+++ b/distutils/ccompiler.py
@@ -202,7 +202,7 @@ def _check_macro_definitions(self, definitions):
                 and isinstance(defn[0], str)
             ):
                 raise TypeError(
-                    ("invalid macro definition '%s': " % defn)
+                    (f"invalid macro definition '{defn}': ")
                     + "must be tuple (string,), (string, string), or "
                     + "(string, None)"
                 )
@@ -859,7 +859,7 @@ def has_function(  # noqa: C901
         fd, fname = tempfile.mkstemp(".c", funcname, text=True)
         with os.fdopen(fd, "w", encoding='utf-8') as f:
             for incl in includes:
-                f.write("""#include "%s"\n""" % incl)
+                f.write(f"""#include "{incl}"\n""")
             if not includes:
                 # Use "char func(void);" as the prototype to follow
                 # what autoconf does.  This prototype does not match
@@ -869,22 +869,20 @@ def has_function(  # noqa: C901
                 # know the exact argument types, and the has_function
                 # interface does not provide that level of information.
                 f.write(
-                    """\
+                    f"""\
 #ifdef __cplusplus
 extern "C"
 #endif
-char %s(void);
+char {funcname}(void);
 """
-                    % funcname
                 )
             f.write(
-                """\
-int main (int argc, char **argv) {
-    %s();
+                f"""\
+int main (int argc, char **argv) {{
+    {funcname}();
     return 0;
-}
+}}
 """
-                % funcname
             )
 
         try:
@@ -1032,7 +1030,7 @@ def debug_print(self, msg):
             print(msg)
 
     def warn(self, msg):
-        sys.stderr.write("warning: %s\n" % msg)
+        sys.stderr.write(f"warning: {msg}\n")
 
     def execute(self, func, args, msg=None, level=1):
         execute(func, args, msg, self.dry_run)
@@ -1145,9 +1143,9 @@ def new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0):
 
         (module_name, class_name, long_description) = compiler_class[compiler]
     except KeyError:
-        msg = "don't know how to compile C/C++ code on platform '%s'" % plat
+        msg = f"don't know how to compile C/C++ code on platform '{plat}'"
         if compiler is not None:
-            msg = msg + " with '%s' compiler" % compiler
+            msg = msg + f" with '{compiler}' compiler"
         raise DistutilsPlatformError(msg)
 
     try:
@@ -1157,7 +1155,7 @@ def new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0):
         klass = vars(module)[class_name]
     except ImportError:
         raise DistutilsModuleError(
-            "can't compile C/C++ code: unable to load module '%s'" % module_name
+            f"can't compile C/C++ code: unable to load module '{module_name}'"
         )
     except KeyError:
         raise DistutilsModuleError(
@@ -1196,15 +1194,15 @@ def gen_preprocess_options(macros, include_dirs):
     for macro in macros:
         if not (isinstance(macro, tuple) and 1 <= len(macro) <= 2):
             raise TypeError(
-                "bad macro definition '%s': "
-                "each element of 'macros' list must be a 1- or 2-tuple" % macro
+                f"bad macro definition '{macro}': "
+                "each element of 'macros' list must be a 1- or 2-tuple"
             )
 
         if len(macro) == 1:  # undefine this macro
-            pp_opts.append("-U%s" % macro[0])
+            pp_opts.append(f"-U{macro[0]}")
         elif len(macro) == 2:
             if macro[1] is None:  # define with no explicit value
-                pp_opts.append("-D%s" % macro[0])
+                pp_opts.append(f"-D{macro[0]}")
             else:
                 # XXX *don't* need to be clever about quoting the
                 # macro value here, because we're going to avoid the
@@ -1212,7 +1210,7 @@ def gen_preprocess_options(macros, include_dirs):
                 pp_opts.append("-D{}={}".format(*macro))
 
     for dir in include_dirs:
-        pp_opts.append("-I%s" % dir)
+        pp_opts.append(f"-I{dir}")
     return pp_opts
 
 
@@ -1245,7 +1243,7 @@ def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries):
                 lib_opts.append(lib_file)
             else:
                 compiler.warn(
-                    "no library file corresponding to '%s' found (skipping)" % lib
+                    f"no library file corresponding to '{lib}' found (skipping)"
                 )
         else:
             lib_opts.append(compiler.library_option(lib))
diff --git a/distutils/cmd.py b/distutils/cmd.py
index 02dbf165f5..0daf6406f3 100644
--- a/distutils/cmd.py
+++ b/distutils/cmd.py
@@ -135,7 +135,7 @@ def initialize_options(self):
         This method must be implemented by all command classes.
         """
         raise RuntimeError(
-            "abstract method -- subclass %s must override" % self.__class__
+            f"abstract method -- subclass {self.__class__} must override"
         )
 
     def finalize_options(self):
@@ -150,14 +150,14 @@ def finalize_options(self):
         This method must be implemented by all command classes.
         """
         raise RuntimeError(
-            "abstract method -- subclass %s must override" % self.__class__
+            f"abstract method -- subclass {self.__class__} must override"
         )
 
     def dump_options(self, header=None, indent=""):
         from distutils.fancy_getopt import longopt_xlate
 
         if header is None:
-            header = "command options for '%s':" % self.get_command_name()
+            header = f"command options for '{self.get_command_name()}':"
         self.announce(indent + header, level=logging.INFO)
         indent = indent + "  "
         for option, _, _ in self.user_options:
@@ -178,7 +178,7 @@ def run(self):
         This method must be implemented by all command classes.
         """
         raise RuntimeError(
-            "abstract method -- subclass %s must override" % self.__class__
+            f"abstract method -- subclass {self.__class__} must override"
         )
 
     def announce(self, msg, level=logging.DEBUG):
@@ -412,7 +412,7 @@ def make_file(
         timestamp checks.
         """
         if skip_msg is None:
-            skip_msg = "skipping %s (inputs unchanged)" % outfile
+            skip_msg = f"skipping {outfile} (inputs unchanged)"
 
         # Allow 'infiles' to be a single string
         if isinstance(infiles, str):
diff --git a/distutils/command/bdist.py b/distutils/command/bdist.py
index ade98445ba..d7f8b2483c 100644
--- a/distutils/command/bdist.py
+++ b/distutils/command/bdist.py
@@ -41,7 +41,7 @@ class bdist(Command):
             'plat-name=',
             'p',
             "platform name to embed in generated filenames "
-            "(default: %s)" % get_platform(),
+            f"(default: {get_platform()})",
         ),
         ('formats=', None, "formats for distribution (comma-separated list)"),
         (
@@ -120,7 +120,7 @@ def finalize_options(self):
             except KeyError:
                 raise DistutilsPlatformError(
                     "don't know how to create built distributions "
-                    "on platform %s" % os.name
+                    f"on platform {os.name}"
                 )
 
         if self.dist_dir is None:
@@ -133,7 +133,7 @@ def run(self):
             try:
                 commands.append(self.format_commands[format][0])
             except KeyError:
-                raise DistutilsOptionError("invalid format '%s'" % format)
+                raise DistutilsOptionError(f"invalid format '{format}'")
 
         # Reinitialize and run each command.
         for i in range(len(self.formats)):
diff --git a/distutils/command/bdist_dumb.py b/distutils/command/bdist_dumb.py
index 06502d201e..0cec1978f6 100644
--- a/distutils/command/bdist_dumb.py
+++ b/distutils/command/bdist_dumb.py
@@ -23,7 +23,7 @@ class bdist_dumb(Command):
             'plat-name=',
             'p',
             "platform name to embed in generated filenames "
-            "(default: %s)" % get_platform(),
+            f"(default: {get_platform()})",
         ),
         (
             'format=',
@@ -81,7 +81,7 @@ def finalize_options(self):
             except KeyError:
                 raise DistutilsPlatformError(
                     "don't know how to create dumb built distributions "
-                    "on platform %s" % os.name
+                    f"on platform {os.name}"
                 )
 
         self.set_undefined_options(
diff --git a/distutils/command/bdist_rpm.py b/distutils/command/bdist_rpm.py
index 649968a5eb..f08981f798 100644
--- a/distutils/command/bdist_rpm.py
+++ b/distutils/command/bdist_rpm.py
@@ -214,7 +214,7 @@ def finalize_options(self):
 
         if os.name != 'posix':
             raise DistutilsPlatformError(
-                "don't know how to create RPM distributions on platform %s" % os.name
+                f"don't know how to create RPM distributions on platform {os.name}"
             )
         if self.binary_only and self.source_only:
             raise DistutilsOptionError(
@@ -295,9 +295,9 @@ def run(self):  # noqa: C901
 
         # Spec file goes into 'dist_dir' if '--spec-only specified',
         # build/rpm. otherwise.
-        spec_path = os.path.join(spec_dir, "%s.spec" % self.distribution.get_name())
+        spec_path = os.path.join(spec_dir, f"{self.distribution.get_name()}.spec")
         self.execute(
-            write_file, (spec_path, self._make_spec_file()), "writing '%s'" % spec_path
+            write_file, (spec_path, self._make_spec_file()), f"writing '{spec_path}'"
         )
 
         if self.spec_only:  # stop if requested
@@ -322,7 +322,7 @@ def run(self):  # noqa: C901
             if os.path.exists(self.icon):
                 self.copy_file(self.icon, source_dir)
             else:
-                raise DistutilsFileError("icon file '%s' does not exist" % self.icon)
+                raise DistutilsFileError(f"icon file '{self.icon}' does not exist")
 
         # build package
         log.info("building RPMs")
@@ -334,9 +334,9 @@ def run(self):  # noqa: C901
             rpm_cmd.append('-bb')
         else:
             rpm_cmd.append('-ba')
-        rpm_cmd.extend(['--define', '__python %s' % self.python])
+        rpm_cmd.extend(['--define', f'__python {self.python}'])
         if self.rpm3_mode:
-            rpm_cmd.extend(['--define', '_topdir %s' % os.path.abspath(self.rpm_base)])
+            rpm_cmd.extend(['--define', f'_topdir {os.path.abspath(self.rpm_base)}'])
         if not self.keep_temp:
             rpm_cmd.append('--clean')
 
@@ -370,7 +370,7 @@ def run(self):  # noqa: C901
 
             status = out.close()
             if status:
-                raise DistutilsExecError("Failed to execute: %s" % repr(q_cmd))
+                raise DistutilsExecError(f"Failed to execute: {repr(q_cmd)}")
 
         finally:
             out.close()
@@ -426,7 +426,7 @@ def _make_spec_file(self):  # noqa: C901
         # normalizing the whitespace to simplify the test for whether the
         # invocation of brp-python-bytecompile passes in __python):
         vendor_hook = '\n'.join([
-            '  %s \\' % line.strip() for line in vendor_hook.splitlines()
+            f'  {line.strip()} \\' for line in vendor_hook.splitlines()
         ])
         problem = "brp-python-bytecompile \\\n"
         fixed = "brp-python-bytecompile %{__python} \\\n"
@@ -468,7 +468,7 @@ def _make_spec_file(self):  # noqa: C901
             if not self.distribution.has_ext_modules():
                 spec_file.append('BuildArch: noarch')
         else:
-            spec_file.append('BuildArch: %s' % self.force_arch)
+            spec_file.append(f'BuildArch: {self.force_arch}')
 
         for field in (
             'Vendor',
@@ -518,7 +518,7 @@ def _make_spec_file(self):  # noqa: C901
         # rpm scripts
         # figure out default build script
         def_setup_call = f"{self.python} {os.path.basename(sys.argv[0])}"
-        def_build = "%s build" % def_setup_call
+        def_build = f"{def_setup_call} build"
         if self.use_rpm_opt_flags:
             def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build
 
@@ -529,8 +529,8 @@ def _make_spec_file(self):  # noqa: C901
         # are just text that we drop in as-is.  Hmmm.
 
         install_cmd = (
-            '%s install -O1 --root=$RPM_BUILD_ROOT ' '--record=INSTALLED_FILES'
-        ) % def_setup_call
+            f'{def_setup_call} install -O1 --root=$RPM_BUILD_ROOT ' '--record=INSTALLED_FILES'
+        )
 
         script_options = [
             ('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"),
diff --git a/distutils/command/build.py b/distutils/command/build.py
index d18ed503e3..7abc431897 100644
--- a/distutils/command/build.py
+++ b/distutils/command/build.py
@@ -35,7 +35,7 @@ class build(Command):
             'plat-name=',
             'p',
             "platform name to build for, if supported "
-            "(default: %s)" % get_platform(),
+            f"(default: {get_platform()})",
         ),
         ('compiler=', 'c', "specify the compiler type"),
         ('parallel=', 'j', "number of parallel build jobs"),
diff --git a/distutils/command/build_clib.py b/distutils/command/build_clib.py
index 360575d0cb..f5e91042a7 100644
--- a/distutils/command/build_clib.py
+++ b/distutils/command/build_clib.py
@@ -138,8 +138,8 @@ def check_library_list(self, libraries):
 
             if '/' in name or (os.sep != '/' and os.sep in name):
                 raise DistutilsSetupError(
-                    "bad library name '%s': "
-                    "may not contain directory separators" % lib[0]
+                    f"bad library name '{lib[0]}': "
+                    "may not contain directory separators"
                 )
 
             if not isinstance(build_info, dict):
@@ -166,9 +166,9 @@ def get_source_files(self):
             sources = build_info.get('sources')
             if sources is None or not isinstance(sources, (list, tuple)):
                 raise DistutilsSetupError(
-                    "in 'libraries' option (library '%s'), "
+                    f"in 'libraries' option (library '{lib_name}'), "
                     "'sources' must be present and must be "
-                    "a list of source filenames" % lib_name
+                    "a list of source filenames"
                 )
 
             filenames.extend(sources)
@@ -179,9 +179,9 @@ def build_libraries(self, libraries):
             sources = build_info.get('sources')
             if sources is None or not isinstance(sources, (list, tuple)):
                 raise DistutilsSetupError(
-                    "in 'libraries' option (library '%s'), "
+                    f"in 'libraries' option (library '{lib_name}'), "
                     "'sources' must be present and must be "
-                    "a list of source filenames" % lib_name
+                    "a list of source filenames"
                 )
             sources = list(sources)
 
diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py
index 06d949aff1..fe06eed04e 100644
--- a/distutils/command/build_ext.py
+++ b/distutils/command/build_ext.py
@@ -57,7 +57,7 @@ class build_ext(Command):
     #     takes care of both command-line and client options
     #     in between initialize_options() and finalize_options())
 
-    sep_by = " (separated by '%s')" % os.pathsep
+    sep_by = f" (separated by '{os.pathsep}')"
     user_options = [
         ('build-lib=', 'b', "directory for compiled extension modules"),
         ('build-temp=', 't', "directory for temporary files (build by-products)"),
@@ -65,7 +65,7 @@ class build_ext(Command):
             'plat-name=',
             'p',
             "platform name to cross-compile for, if supported "
-            "(default: %s)" % get_platform(),
+            f"(default: {get_platform()})",
         ),
         (
             'inplace',
@@ -517,9 +517,9 @@ def build_extension(self, ext):
         sources = ext.sources
         if sources is None or not isinstance(sources, (list, tuple)):
             raise DistutilsSetupError(
-                "in 'ext_modules' option (extension '%s'), "
+                f"in 'ext_modules' option (extension '{ext.name}'), "
                 "'sources' must be present and must be "
-                "a list of source filenames" % ext.name
+                "a list of source filenames"
             )
         # sort to make the resulting .so file build reproducible
         sources = sorted(sources)
@@ -663,7 +663,7 @@ def find_swig(self):
             # Windows (or so I presume!).  If we find it there, great;
             # if not, act like Unix and assume it's in the PATH.
             for vers in ("1.3", "1.2", "1.1"):
-                fn = os.path.join("c:\\swig%s" % vers, "swig.exe")
+                fn = os.path.join(f"c:\\swig{vers}", "swig.exe")
                 if os.path.isfile(fn):
                     return fn
             else:
@@ -671,7 +671,7 @@ def find_swig(self):
         else:
             raise DistutilsPlatformError(
                 "I don't know how to find (much less run) SWIG "
-                "on platform '%s'" % os.name
+                f"on platform '{os.name}'"
             )
 
     # -- Name generators -----------------------------------------------
diff --git a/distutils/command/build_py.py b/distutils/command/build_py.py
index 56e6fa2e66..ede4ff0da4 100644
--- a/distutils/command/build_py.py
+++ b/distutils/command/build_py.py
@@ -191,12 +191,12 @@ def check_package(self, package, package_dir):
         if package_dir != "":
             if not os.path.exists(package_dir):
                 raise DistutilsFileError(
-                    "package directory '%s' does not exist" % package_dir
+                    f"package directory '{package_dir}' does not exist"
                 )
             if not os.path.isdir(package_dir):
                 raise DistutilsFileError(
-                    "supposed package directory '%s' exists, "
-                    "but is not a directory" % package_dir
+                    f"supposed package directory '{package_dir}' exists, "
+                    "but is not a directory"
                 )
 
         # Directories without __init__.py are namespace packages (PEP 420).
@@ -228,7 +228,7 @@ def find_package_modules(self, package, package_dir):
                 module = os.path.splitext(os.path.basename(f))[0]
                 modules.append((package, module, f))
             else:
-                self.debug_print("excluding %s" % setup_script)
+                self.debug_print(f"excluding {setup_script}")
         return modules
 
     def find_modules(self):
diff --git a/distutils/command/build_scripts.py b/distutils/command/build_scripts.py
index 5f3902a027..9e5963c243 100644
--- a/distutils/command/build_scripts.py
+++ b/distutils/command/build_scripts.py
@@ -96,7 +96,7 @@ def _copy_script(self, script, outfiles, updated_files):  # noqa: C901
         else:
             first_line = f.readline()
             if not first_line:
-                self.warn("%s is an empty file (skipping)" % script)
+                self.warn(f"{script} is an empty file (skipping)")
                 return
 
             shebang_match = shebang_pattern.match(first_line)
diff --git a/distutils/command/check.py b/distutils/command/check.py
index 28599e109c..295927a90b 100644
--- a/distutils/command/check.py
+++ b/distutils/command/check.py
@@ -106,7 +106,7 @@ def check_metadata(self):
                 missing.append(attr)
 
         if missing:
-            self.warn("missing required meta-data: %s" % ', '.join(missing))
+            self.warn("missing required meta-data: {}".format(', '.join(missing)))
 
     def check_restructuredtext(self):
         """Checks if the long string fields are reST-compliant."""
@@ -147,7 +147,7 @@ def _check_rst_data(self, data):
         except AttributeError as e:
             reporter.messages.append((
                 -1,
-                'Could not finish the parsing: %s.' % e,
+                f'Could not finish the parsing: {e}.',
                 '',
                 {},
             ))
diff --git a/distutils/command/config.py b/distutils/command/config.py
index d4b2b0a362..a45ea70177 100644
--- a/distutils/command/config.py
+++ b/distutils/command/config.py
@@ -109,7 +109,7 @@ def _gen_temp_sourcefile(self, body, headers, lang):
         with open(filename, "w", encoding='utf-8') as file:
             if headers:
                 for header in headers:
-                    file.write("#include <%s>\n" % header)
+                    file.write(f"#include <{header}>\n")
                 file.write("\n")
             file.write(body)
             if body[-1] != "\n":
@@ -126,7 +126,7 @@ def _preprocess(self, body, headers, include_dirs, lang):
     def _compile(self, body, headers, include_dirs, lang):
         src = self._gen_temp_sourcefile(body, headers, lang)
         if self.dump_source:
-            dump_file(src, "compiling '%s':" % src)
+            dump_file(src, f"compiling '{src}':")
         (obj,) = self.compiler.object_filenames([src])
         self.temp_files.extend([src, obj])
         self.compiler.compile([src], include_dirs=include_dirs)
@@ -311,12 +311,12 @@ def check_func(
         self._check_compiler()
         body = []
         if decl:
-            body.append("int %s ();" % func)
+            body.append(f"int {func} ();")
         body.append("int main () {")
         if call:
-            body.append("  %s();" % func)
+            body.append(f"  {func}();")
         else:
-            body.append("  %s;" % func)
+            body.append(f"  {func};")
         body.append("}")
         body = "\n".join(body) + "\n"
 
diff --git a/distutils/command/install.py b/distutils/command/install.py
index 8e920be4de..960ff64b16 100644
--- a/distutils/command/install.py
+++ b/distutils/command/install.py
@@ -245,7 +245,7 @@ class install(Command):
         user_options.append((
             'user',
             None,
-            "install in user site-package '%s'" % USER_SITE,
+            f"install in user site-package '{USER_SITE}'",
         ))
         boolean_options.append('user')
 
@@ -600,7 +600,7 @@ def finalize_other(self):
                 self.select_scheme(os.name)
             except KeyError:
                 raise DistutilsPlatformError(
-                    "I don't know how to install stuff on '%s'" % os.name
+                    f"I don't know how to install stuff on '{os.name}'"
                 )
 
     def select_scheme(self, name):
@@ -685,7 +685,7 @@ def create_home_path(self):
         home = convert_path(os.path.expanduser("~"))
         for _name, path in self.config_vars.items():
             if str(path).startswith(home) and not os.path.isdir(path):
-                self.debug_print("os.makedirs('%s', 0o700)" % path)
+                self.debug_print(f"os.makedirs('{path}', 0o700)")
                 os.makedirs(path, 0o700)
 
     # -- Command execution methods -------------------------------------
@@ -720,7 +720,7 @@ def run(self):
             self.execute(
                 write_file,
                 (self.record, outputs),
-                "writing list of installed files to '%s'" % self.record,
+                f"writing list of installed files to '{self.record}'",
             )
 
         sys_path = map(os.path.normpath, sys.path)
@@ -745,10 +745,10 @@ def create_path_file(self):
         filename = os.path.join(self.install_libbase, self.path_file + ".pth")
         if self.install_path_file:
             self.execute(
-                write_file, (filename, [self.extra_dirs]), "creating %s" % filename
+                write_file, (filename, [self.extra_dirs]), f"creating {filename}"
             )
         else:
-            self.warn("path file '%s' not created" % filename)
+            self.warn(f"path file '{filename}' not created")
 
     # -- Reporting methods ---------------------------------------------
 
diff --git a/distutils/command/install_lib.py b/distutils/command/install_lib.py
index b1f346f018..76993b1e6b 100644
--- a/distutils/command/install_lib.py
+++ b/distutils/command/install_lib.py
@@ -114,7 +114,7 @@ def install(self):
             outfiles = self.copy_tree(self.build_dir, self.install_dir)
         else:
             self.warn(
-                "'%s' does not exist -- no Python modules to install" % self.build_dir
+                f"'{self.build_dir}' does not exist -- no Python modules to install"
             )
             return
         return outfiles
diff --git a/distutils/command/register.py b/distutils/command/register.py
index ee6c54daba..6b837275fa 100644
--- a/distutils/command/register.py
+++ b/distutils/command/register.py
@@ -88,7 +88,7 @@ def _set_config(self):
             self.has_config = True
         else:
             if self.repository not in ('pypi', self.DEFAULT_REPOSITORY):
-                raise ValueError('%s not found in .pypirc' % self.repository)
+                raise ValueError(f'{self.repository} not found in .pypirc')
             if self.repository == 'pypi':
                 self.repository = self.DEFAULT_REPOSITORY
             self.has_config = False
@@ -192,7 +192,7 @@ def send_metadata(self):  # noqa: C901
                         logging.INFO,
                     )
                     self.announce(
-                        '(the login will be stored in %s)' % self._get_rc_file(),
+                        f'(the login will be stored in {self._get_rc_file()})',
                         logging.INFO,
                     )
                     choice = 'X'
@@ -277,7 +277,7 @@ def post_to_server(self, data, auth=None):  # noqa: C901
         for key, values in data.items():
             for value in map(str, make_iterable(values)):
                 body.write(sep_boundary)
-                body.write('\nContent-Disposition: form-data; name="%s"' % key)
+                body.write(f'\nContent-Disposition: form-data; name="{key}"')
                 body.write("\n\n")
                 body.write(value)
                 if value and value[-1] == '\r':
@@ -288,8 +288,7 @@ def post_to_server(self, data, auth=None):  # noqa: C901
 
         # build the Request
         headers = {
-            'Content-type': 'multipart/form-data; boundary=%s; charset=utf-8'
-            % boundary,
+            'Content-type': f'multipart/form-data; boundary={boundary}; charset=utf-8',
             'Content-length': str(len(body)),
         }
         req = urllib.request.Request(self.repository, body, headers)
diff --git a/distutils/command/sdist.py b/distutils/command/sdist.py
index 387d27c90b..b483b8bd52 100644
--- a/distutils/command/sdist.py
+++ b/distutils/command/sdist.py
@@ -150,7 +150,7 @@ def finalize_options(self):
 
         bad_format = archive_util.check_archive_formats(self.formats)
         if bad_format:
-            raise DistutilsOptionError("unknown archive format '%s'" % bad_format)
+            raise DistutilsOptionError(f"unknown archive format '{bad_format}'")
 
         if self.dist_dir is None:
             self.dist_dir = "dist"
@@ -288,7 +288,7 @@ def _add_defaults_standards(self):
                 if self._cs_path_exists(fn):
                     self.filelist.append(fn)
                 else:
-                    self.warn("standard file '%s' not found" % fn)
+                    self.warn(f"standard file '{fn}' not found")
 
     def _add_defaults_optional(self):
         optional = ['tests/test*.py', 'test/test*.py', 'setup.cfg']
@@ -411,7 +411,7 @@ def write_manifest(self):
         if self._manifest_is_not_generated():
             log.info(
                 "not writing to manually maintained "
-                "manifest file '%s'" % self.manifest
+                f"manifest file '{self.manifest}'"
             )
             return
 
@@ -420,7 +420,7 @@ def write_manifest(self):
         self.execute(
             file_util.write_file,
             (self.manifest, content),
-            "writing manifest file '%s'" % self.manifest,
+            f"writing manifest file '{self.manifest}'",
         )
 
     def _manifest_is_not_generated(self):
@@ -468,10 +468,10 @@ def make_release_tree(self, base_dir, files):
 
         if hasattr(os, 'link'):  # can make hard links on this system
             link = 'hard'
-            msg = "making hard links in %s..." % base_dir
+            msg = f"making hard links in {base_dir}..."
         else:  # nope, have to copy
             link = None
-            msg = "copying files to %s..." % base_dir
+            msg = f"copying files to {base_dir}..."
 
         if not files:
             log.warning("no files to distribute -- empty manifest?")
diff --git a/distutils/command/upload.py b/distutils/command/upload.py
index cf541f8a82..773e222c9c 100644
--- a/distutils/command/upload.py
+++ b/distutils/command/upload.py
@@ -75,7 +75,7 @@ def upload_file(self, command, pyversion, filename):  # noqa: C901
         # Makes sure the repository URL is compliant
         schema, netloc, url, params, query, fragments = urlparse(self.repository)
         if params or query or fragments:
-            raise AssertionError("Incompatible url %s" % self.repository)
+            raise AssertionError(f"Incompatible url {self.repository}")
 
         if schema not in ('http', 'https'):
             raise AssertionError("unsupported schema " + schema)
@@ -153,10 +153,10 @@ def upload_file(self, command, pyversion, filename):  # noqa: C901
         end_boundary = sep_boundary + b'--\r\n'
         body = io.BytesIO()
         for key, values in data.items():
-            title = '\r\nContent-Disposition: form-data; name="%s"' % key
+            title = f'\r\nContent-Disposition: form-data; name="{key}"'
             for value in make_iterable(values):
                 if type(value) is tuple:
-                    title += '; filename="%s"' % value[0]
+                    title += f'; filename="{value[0]}"'
                     value = value[1]
                 else:
                     value = str(value).encode('utf-8')
@@ -172,7 +172,7 @@ def upload_file(self, command, pyversion, filename):  # noqa: C901
 
         # build the Request
         headers = {
-            'Content-type': 'multipart/form-data; boundary=%s' % boundary,
+            'Content-type': f'multipart/form-data; boundary={boundary}',
             'Content-length': str(len(body)),
             'Authorization': auth,
         }
diff --git a/distutils/config.py b/distutils/config.py
index 83f96a9eec..8ab27f34c2 100644
--- a/distutils/config.py
+++ b/distutils/config.py
@@ -30,7 +30,7 @@ class PyPIRCCommand(Command):
     realm = None
 
     user_options = [
-        ('repository=', 'r', "url of repository [default: %s]" % DEFAULT_REPOSITORY),
+        ('repository=', 'r', f"url of repository [default: {DEFAULT_REPOSITORY}]"),
         ('show-response', None, 'display full response text from server'),
     ]
 
@@ -51,7 +51,7 @@ def _read_pypirc(self):  # noqa: C901
         """Reads the .pypirc file."""
         rc = self._get_rc_file()
         if os.path.exists(rc):
-            self.announce('Using PyPI login from %s' % rc)
+            self.announce(f'Using PyPI login from {rc}')
             repository = self.repository or self.DEFAULT_REPOSITORY
 
             config = RawConfigParser()
diff --git a/distutils/core.py b/distutils/core.py
index 309ce696fa..7238b618f6 100644
--- a/distutils/core.py
+++ b/distutils/core.py
@@ -146,7 +146,7 @@ class found in 'cmdclass' is used in place of the default, which is
         _setup_distribution = dist = klass(attrs)
     except DistutilsSetupError as msg:
         if 'name' not in attrs:
-            raise SystemExit("error in setup command: %s" % msg)
+            raise SystemExit(f"error in setup command: {msg}")
         else:
             raise SystemExit("error in {} setup command: {}".format(attrs['name'], msg))
 
@@ -170,7 +170,7 @@ class found in 'cmdclass' is used in place of the default, which is
     try:
         ok = dist.parse_command_line()
     except DistutilsArgError as msg:
-        raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
+        raise SystemExit(gen_usage(dist.script_name) + f"\nerror: {msg}")
 
     if DEBUG:
         print("options (after parsing command line):")
@@ -274,11 +274,10 @@ def run_setup(script_name, script_args=None, stop_after="run"):
 
     if _setup_distribution is None:
         raise RuntimeError(
-            (
+
                 "'distutils.core.setup()' was never called -- "
-                "perhaps '%s' is not a Distutils setup script?"
-            )
-            % script_name
+                f"perhaps '{script_name}' is not a Distutils setup script?"
+
         )
 
     # I wonder if the setup script's namespace -- g and l -- would be of
diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py
index 539f09d8f3..506b88c9c6 100644
--- a/distutils/cygwinccompiler.py
+++ b/distutils/cygwinccompiler.py
@@ -61,7 +61,7 @@ def get_msvcr():
     try:
         return _msvcr_lookup[msc_ver]
     except KeyError:
-        raise ValueError("Unknown MS Compiler version %s " % msc_ver)
+        raise ValueError(f"Unknown MS Compiler version {msc_ver} ")
 
 
 _runtime_library_dirs_msg = (
@@ -91,8 +91,8 @@ def __init__(self, verbose=0, dry_run=0, force=0):
         if status is not CONFIG_H_OK:
             self.warn(
                 "Python's pyconfig.h doesn't seem to support your compiler. "
-                "Reason: %s. "
-                "Compiling may fail because of undefined preprocessor macros." % details
+                f"Reason: {details}. "
+                "Compiling may fail because of undefined preprocessor macros."
             )
 
         self.cc = os.environ.get('CC', 'gcc')
@@ -102,10 +102,10 @@ def __init__(self, verbose=0, dry_run=0, force=0):
         shared_option = "-shared"
 
         self.set_executables(
-            compiler='%s -mcygwin -O -Wall' % self.cc,
-            compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc,
-            compiler_cxx='%s -mcygwin -O -Wall' % self.cxx,
-            linker_exe='%s -mcygwin' % self.cc,
+            compiler=f'{self.cc} -mcygwin -O -Wall',
+            compiler_so=f'{self.cc} -mcygwin -mdll -O -Wall',
+            compiler_cxx=f'{self.cxx} -mcygwin -O -Wall',
+            linker_exe=f'{self.cc} -mcygwin',
             linker_so=(f'{self.linker_dll} -mcygwin {shared_option}'),
         )
 
@@ -195,10 +195,10 @@ def link(
             def_file = os.path.join(temp_dir, dll_name + ".def")
 
             # Generate .def file
-            contents = ["LIBRARY %s" % os.path.basename(output_filename), "EXPORTS"]
+            contents = [f"LIBRARY {os.path.basename(output_filename)}", "EXPORTS"]
             for sym in export_symbols:
                 contents.append(sym)
-            self.execute(write_file, (def_file, contents), "writing %s" % def_file)
+            self.execute(write_file, (def_file, contents), f"writing {def_file}")
 
             # next add options for def-file
 
@@ -274,10 +274,10 @@ def __init__(self, verbose=0, dry_run=0, force=0):
             raise CCompilerError('Cygwin gcc cannot be used with --compiler=mingw32')
 
         self.set_executables(
-            compiler='%s -O -Wall' % self.cc,
-            compiler_so='%s -mdll -O -Wall' % self.cc,
-            compiler_cxx='%s -O -Wall' % self.cxx,
-            linker_exe='%s' % self.cc,
+            compiler=f'{self.cc} -O -Wall',
+            compiler_so=f'{self.cc} -mdll -O -Wall',
+            compiler_cxx=f'{self.cxx} -O -Wall',
+            linker_exe=f'{self.cc}',
             linker_so=f'{self.linker_dll} {shared_option}',
         )
 
diff --git a/distutils/dir_util.py b/distutils/dir_util.py
index 370c6ffd49..1d5573efc4 100644
--- a/distutils/dir_util.py
+++ b/distutils/dir_util.py
@@ -133,7 +133,7 @@ def copy_tree(  # noqa: C901
     from distutils.file_util import copy_file
 
     if not dry_run and not os.path.isdir(src):
-        raise DistutilsFileError("cannot copy tree '%s': not a directory" % src)
+        raise DistutilsFileError(f"cannot copy tree '{src}': not a directory")
     try:
         names = os.listdir(src)
     except OSError as e:
diff --git a/distutils/dist.py b/distutils/dist.py
index 668ce7eb0a..2eb5e1a1e2 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -262,7 +262,7 @@ def __init__(self, attrs=None):  # noqa: C901
                 elif hasattr(self, key):
                     setattr(self, key, val)
                 else:
-                    msg = "Unknown distribution option: %s" % repr(key)
+                    msg = f"Unknown distribution option: {repr(key)}"
                     warnings.warn(msg)
 
         # no-user-cfg is handled before other command line args
@@ -311,9 +311,9 @@ def dump_option_dicts(self, header=None, commands=None, indent=""):
         for cmd_name in commands:
             opt_dict = self.command_options.get(cmd_name)
             if opt_dict is None:
-                self.announce(indent + "no option dict for '%s' command" % cmd_name)
+                self.announce(indent + f"no option dict for '{cmd_name}' command")
             else:
-                self.announce(indent + "option dict for '%s' command:" % cmd_name)
+                self.announce(indent + f"option dict for '{cmd_name}' command:")
                 out = pformat(opt_dict)
                 for line in out.split('\n'):
                     self.announce(indent + "  " + line)
@@ -339,7 +339,7 @@ def find_config_files(self):
         files = [str(path) for path in self._gen_paths() if os.path.isfile(path)]
 
         if DEBUG:
-            self.announce("using config files: %s" % ', '.join(files))
+            self.announce("using config files: {}".format(', '.join(files)))
 
         return files
 
@@ -395,7 +395,7 @@ def parse_config_files(self, filenames=None):  # noqa: C901
         parser = ConfigParser()
         for filename in filenames:
             if DEBUG:
-                self.announce("  reading %s" % filename)
+                self.announce(f"  reading {filename}")
             parser.read(filename, encoding='utf-8')
             for section in parser.sections():
                 options = parser.options(section)
@@ -525,7 +525,7 @@ def _parse_command_opts(self, parser, args):  # noqa: C901
         # Pull the current command from the head of the command line
         command = args[0]
         if not command_re.match(command):
-            raise SystemExit("invalid command name '%s'" % command)
+            raise SystemExit(f"invalid command name '{command}'")
         self.commands.append(command)
 
         # Dig up the command class that implements this command, so we
@@ -540,7 +540,7 @@ def _parse_command_opts(self, parser, args):  # noqa: C901
         # to be sure that the basic "command" interface is implemented.
         if not issubclass(cmd_class, Command):
             raise DistutilsClassError(
-                "command class %s must subclass Command" % cmd_class
+                f"command class {cmd_class} must subclass Command"
             )
 
         # Also make sure that the command object provides a list of its
@@ -668,7 +668,7 @@ def _show_help(
                 )
             else:
                 parser.set_option_table(klass.user_options)
-            parser.print_help("Options for '%s' command:" % klass.__name__)
+            parser.print_help(f"Options for '{klass.__name__}' command:")
             print()
 
         print(gen_usage(self.script_name))
@@ -842,7 +842,7 @@ def get_command_class(self, command):
             self.cmdclass[command] = klass
             return klass
 
-        raise DistutilsModuleError("invalid command '%s'" % command)
+        raise DistutilsModuleError(f"invalid command '{command}'")
 
     def get_command_obj(self, command, create=1):
         """Return the command object for 'command'.  Normally this object
@@ -855,7 +855,7 @@ def get_command_obj(self, command, create=1):
             if DEBUG:
                 self.announce(
                     "Distribution.get_command_obj(): "
-                    "creating '%s' command object" % command
+                    f"creating '{command}' command object"
                 )
 
             klass = self.get_command_class(command)
@@ -887,7 +887,7 @@ def _set_command_options(self, command_obj, option_dict=None):  # noqa: C901
             option_dict = self.get_option_dict(command_name)
 
         if DEBUG:
-            self.announce("  setting options for '%s' command:" % command_name)
+            self.announce(f"  setting options for '{command_name}' command:")
         for option, (source, value) in option_dict.items():
             if DEBUG:
                 self.announce(f"    {option} = {value} (from {source})")
@@ -1149,9 +1149,9 @@ def write_pkg_file(self, file):
             version = '1.1'
 
         # required fields
-        file.write('Metadata-Version: %s\n' % version)
-        file.write('Name: %s\n' % self.get_name())
-        file.write('Version: %s\n' % self.get_version())
+        file.write(f'Metadata-Version: {version}\n')
+        file.write(f'Name: {self.get_name()}\n')
+        file.write(f'Version: {self.get_version()}\n')
 
         def maybe_write(header, val):
             if val:
diff --git a/distutils/extension.py b/distutils/extension.py
index 94e71635d9..914d176d78 100644
--- a/distutils/extension.py
+++ b/distutils/extension.py
@@ -130,7 +130,7 @@ def __init__(
         if len(kw) > 0:
             options = [repr(option) for option in kw]
             options = ', '.join(sorted(options))
-            msg = "Unknown Extension options: %s" % options
+            msg = f"Unknown Extension options: {options}"
             warnings.warn(msg)
 
     def __repr__(self):
@@ -167,7 +167,7 @@ def read_setup_file(filename):  # noqa: C901
                 continue
 
             if line[0] == line[-1] == "*":
-                file.warn("'%s' lines not handled yet" % line)
+                file.warn(f"'{line}' lines not handled yet")
                 continue
 
             line = expand_makefile_vars(line, vars)
@@ -233,7 +233,7 @@ def read_setup_file(filename):  # noqa: C901
                     # and append it to sources.  Hmmmm.
                     ext.extra_objects.append(word)
                 else:
-                    file.warn("unrecognized argument '%s'" % word)
+                    file.warn(f"unrecognized argument '{word}'")
 
             extensions.append(ext)
     finally:
diff --git a/distutils/fancy_getopt.py b/distutils/fancy_getopt.py
index e905aede4d..691430295f 100644
--- a/distutils/fancy_getopt.py
+++ b/distutils/fancy_getopt.py
@@ -21,7 +21,7 @@
 # utilities, we use '-' in place of '_'.  (The spirit of LISP lives on!)
 # The similarities to NAME are again not a coincidence...
 longopt_pat = r'[a-zA-Z](?:[a-zA-Z0-9-]*)'
-longopt_re = re.compile(r'^%s$' % longopt_pat)
+longopt_re = re.compile(rf'^{longopt_pat}$')
 
 # For recognizing "negative alias" options, eg. "quiet=!verbose"
 neg_alias_re = re.compile(f"^({longopt_pat})=!({longopt_pat})$")
@@ -95,7 +95,7 @@ def set_option_table(self, option_table):
     def add_option(self, long_option, short_option=None, help_string=None):
         if long_option in self.option_index:
             raise DistutilsGetoptError(
-                "option conflict: already an option '%s'" % long_option
+                f"option conflict: already an option '{long_option}'"
             )
         else:
             option = (long_option, short_option, help_string)
@@ -162,13 +162,13 @@ def _grok_option_table(self):  # noqa: C901
             # Type- and value-check the option names
             if not isinstance(long, str) or len(long) < 2:
                 raise DistutilsGetoptError(
-                    ("invalid long option '%s': must be a string of length >= 2") % long
+                    f"invalid long option '{long}': must be a string of length >= 2"
                 )
 
             if not ((short is None) or (isinstance(short, str) and len(short) == 1)):
                 raise DistutilsGetoptError(
-                    "invalid short option '%s': "
-                    "must a single character or None" % short
+                    f"invalid short option '{short}': "
+                    "must a single character or None"
                 )
 
             self.repeat[long] = repeat
@@ -210,8 +210,8 @@ def _grok_option_table(self):  # noqa: C901
             # '='.
             if not longopt_re.match(long):
                 raise DistutilsGetoptError(
-                    "invalid long option name '%s' "
-                    "(must be letters, numbers, hyphens only" % long
+                    f"invalid long option name '{long}' "
+                    "(must be letters, numbers, hyphens only"
                 )
 
             self.attr_name[long] = self.get_attr_name(long)
diff --git a/distutils/file_util.py b/distutils/file_util.py
index 960def9cf9..afa7b0f697 100644
--- a/distutils/file_util.py
+++ b/distutils/file_util.py
@@ -106,7 +106,7 @@ def copy_file(  # noqa: C901
 
     if not os.path.isfile(src):
         raise DistutilsFileError(
-            "can't copy '%s': doesn't exist or not a regular file" % src
+            f"can't copy '{src}': doesn't exist or not a regular file"
         )
 
     if os.path.isdir(dst):
@@ -123,7 +123,7 @@ def copy_file(  # noqa: C901
     try:
         action = _copy_action[link]
     except KeyError:
-        raise ValueError("invalid value '%s' for 'link' argument" % link)
+        raise ValueError(f"invalid value '{link}' for 'link' argument")
 
     if verbose >= 1:
         if os.path.basename(dst) == os.path.basename(src):
@@ -186,7 +186,7 @@ def move_file(src, dst, verbose=1, dry_run=0):  # noqa: C901
         return dst
 
     if not isfile(src):
-        raise DistutilsFileError("can't move '%s': not a regular file" % src)
+        raise DistutilsFileError(f"can't move '{src}': not a regular file")
 
     if isdir(dst):
         dst = os.path.join(dst, basename(src))
diff --git a/distutils/filelist.py b/distutils/filelist.py
index 71ffb2abe7..af1958334d 100644
--- a/distutils/filelist.py
+++ b/distutils/filelist.py
@@ -84,24 +84,24 @@ def _parse_template_line(self, line):
         if action in ('include', 'exclude', 'global-include', 'global-exclude'):
             if len(words) < 2:
                 raise DistutilsTemplateError(
-                    "'%s' expects   ..." % action
+                    f"'{action}' expects   ..."
                 )
             patterns = [convert_path(w) for w in words[1:]]
         elif action in ('recursive-include', 'recursive-exclude'):
             if len(words) < 3:
                 raise DistutilsTemplateError(
-                    "'%s' expects    ..." % action
+                    f"'{action}' expects    ..."
                 )
             dir = convert_path(words[1])
             patterns = [convert_path(w) for w in words[2:]]
         elif action in ('graft', 'prune'):
             if len(words) != 2:
                 raise DistutilsTemplateError(
-                    "'%s' expects a single " % action
+                    f"'{action}' expects a single "
                 )
             dir_pattern = convert_path(words[1])
         else:
-            raise DistutilsTemplateError("unknown action '%s'" % action)
+            raise DistutilsTemplateError(f"unknown action '{action}'")
 
         return (action, patterns, dir, dir_pattern)
 
@@ -192,7 +192,7 @@ def process_template_line(self, line):  # noqa: C901
                 )
         else:
             raise DistutilsInternalError(
-                "this cannot happen: invalid action '%s'" % action
+                f"this cannot happen: invalid action '{action}'"
             )
 
     # Filtering/selection methods
@@ -225,7 +225,7 @@ def include_pattern(self, pattern, anchor=1, prefix=None, is_regex=0):
         # XXX docstring lying about what the special chars are?
         files_found = False
         pattern_re = translate_pattern(pattern, anchor, prefix, is_regex)
-        self.debug_print("include_pattern: applying regex r'%s'" % pattern_re.pattern)
+        self.debug_print(f"include_pattern: applying regex r'{pattern_re.pattern}'")
 
         # delayed loading of allfiles list
         if self.allfiles is None:
@@ -247,7 +247,7 @@ def exclude_pattern(self, pattern, anchor=1, prefix=None, is_regex=0):
         """
         files_found = False
         pattern_re = translate_pattern(pattern, anchor, prefix, is_regex)
-        self.debug_print("exclude_pattern: applying regex r'%s'" % pattern_re.pattern)
+        self.debug_print(f"exclude_pattern: applying regex r'{pattern_re.pattern}'")
         for i in range(len(self.files) - 1, -1, -1):
             if pattern_re.search(self.files[i]):
                 self.debug_print(" removing " + self.files[i])
@@ -327,7 +327,7 @@ def glob_to_re(pattern):
         # we're using a regex to manipulate a regex, so we need
         # to escape the backslash twice
         sep = r'\\\\'
-    escaped = r'\1[^%s]' % sep
+    escaped = rf'\1[^{sep}]'
     pattern_re = re.sub(r'((?
Date: Sat, 18 May 2024 19:37:57 +0200
Subject: [PATCH 079/151] Round of `ruff format` after `ruff check`

---
 distutils/archive_util.py      | 8 +++-----
 distutils/command/bdist_rpm.py | 3 ++-
 distutils/command/build.py     | 3 +--
 distutils/command/sdist.py     | 3 +--
 distutils/core.py              | 6 ++----
 distutils/sysconfig.py         | 3 +--
 6 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/distutils/archive_util.py b/distutils/archive_util.py
index 27b497f36c..9361bf9543 100644
--- a/distutils/archive_util.py
+++ b/distutils/archive_util.py
@@ -160,11 +160,9 @@ def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):  # noqa: C901
             # XXX really should distinguish between "couldn't find
             # external 'zip' command" and "zip failed".
             raise DistutilsExecError(
-
-                    f"unable to create zip file '{zip_filename}': "
-                    "could neither import the 'zipfile' module nor "
-                    "find a standalone zip utility"
-
+                f"unable to create zip file '{zip_filename}': "
+                "could neither import the 'zipfile' module nor "
+                "find a standalone zip utility"
             )
 
     else:
diff --git a/distutils/command/bdist_rpm.py b/distutils/command/bdist_rpm.py
index f08981f798..d6c461161b 100644
--- a/distutils/command/bdist_rpm.py
+++ b/distutils/command/bdist_rpm.py
@@ -529,7 +529,8 @@ def _make_spec_file(self):  # noqa: C901
         # are just text that we drop in as-is.  Hmmm.
 
         install_cmd = (
-            f'{def_setup_call} install -O1 --root=$RPM_BUILD_ROOT ' '--record=INSTALLED_FILES'
+            f'{def_setup_call} install -O1 --root=$RPM_BUILD_ROOT '
+            '--record=INSTALLED_FILES'
         )
 
         script_options = [
diff --git a/distutils/command/build.py b/distutils/command/build.py
index 7abc431897..74695941e8 100644
--- a/distutils/command/build.py
+++ b/distutils/command/build.py
@@ -34,8 +34,7 @@ class build(Command):
         (
             'plat-name=',
             'p',
-            "platform name to build for, if supported "
-            f"(default: {get_platform()})",
+            f"platform name to build for, if supported (default: {get_platform()})",
         ),
         ('compiler=', 'c', "specify the compiler type"),
         ('parallel=', 'j', "number of parallel build jobs"),
diff --git a/distutils/command/sdist.py b/distutils/command/sdist.py
index b483b8bd52..878e575df1 100644
--- a/distutils/command/sdist.py
+++ b/distutils/command/sdist.py
@@ -410,8 +410,7 @@ def write_manifest(self):
         """
         if self._manifest_is_not_generated():
             log.info(
-                "not writing to manually maintained "
-                f"manifest file '{self.manifest}'"
+                f"not writing to manually maintained manifest file '{self.manifest}'"
             )
             return
 
diff --git a/distutils/core.py b/distutils/core.py
index 7238b618f6..82113c47c1 100644
--- a/distutils/core.py
+++ b/distutils/core.py
@@ -274,10 +274,8 @@ def run_setup(script_name, script_args=None, stop_after="run"):
 
     if _setup_distribution is None:
         raise RuntimeError(
-
-                "'distutils.core.setup()' was never called -- "
-                f"perhaps '{script_name}' is not a Distutils setup script?"
-
+            "'distutils.core.setup()' was never called -- "
+            f"perhaps '{script_name}' is not a Distutils setup script?"
         )
 
     # I wonder if the setup script's namespace -- g and l -- would be of
diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py
index 1325178699..9d85cdfd99 100644
--- a/distutils/sysconfig.py
+++ b/distutils/sysconfig.py
@@ -262,8 +262,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
             return os.path.join(prefix, "Lib", "site-packages")
     else:
         raise DistutilsPlatformError(
-            "I don't know where Python installs its library "
-            f"on platform '{os.name}'"
+            f"I don't know where Python installs its library on platform '{os.name}'"
         )
 
 

From 8765761488ab297c4df187cafe4b6a111c38f9f9 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 19:21:07 +0200
Subject: [PATCH 080/151] Enable ruff/pyupgrade rules (UP)

---
 ruff.toml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ruff.toml b/ruff.toml
index 70612985a7..b65c055950 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -1,6 +1,7 @@
 [lint]
 extend-select = [
 	"C901",
+	"UP",
 	"W",
 ]
 ignore = [

From b26d5e480ce0b88f190cbce2a3fa5cb74a29556c Mon Sep 17 00:00:00 2001
From: Avasam 
Date: Fri, 17 May 2024 17:39:19 -0400
Subject: [PATCH 081/151] Use `set` instead of `True`-only `dict`

---
 distutils/dir_util.py | 10 +++++-----
 distutils/dist.py     | 18 +++++++++---------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/distutils/dir_util.py b/distutils/dir_util.py
index 370c6ffd49..175f5c26d1 100644
--- a/distutils/dir_util.py
+++ b/distutils/dir_util.py
@@ -10,7 +10,7 @@
 
 # cache for by mkpath() -- in addition to cheapening redundant calls,
 # eliminates redundant "creating /foo/bar/baz" messages in dry-run mode
-_path_created = {}
+_path_created = set()
 
 
 def mkpath(name, mode=0o777, verbose=1, dry_run=0):  # noqa: C901
@@ -45,7 +45,7 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0):  # noqa: C901
     created_dirs = []
     if os.path.isdir(name) or name == '':
         return created_dirs
-    if _path_created.get(os.path.abspath(name)):
+    if os.path.abspath(name) in _path_created:
         return created_dirs
 
     (head, tail) = os.path.split(name)
@@ -63,7 +63,7 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0):  # noqa: C901
         head = os.path.join(head, d)
         abs_head = os.path.abspath(head)
 
-        if _path_created.get(abs_head):
+        if abs_head in _path_created:
             continue
 
         if verbose >= 1:
@@ -79,7 +79,7 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0):  # noqa: C901
                     )
             created_dirs.append(head)
 
-        _path_created[abs_head] = 1
+        _path_created.add(abs_head)
     return created_dirs
 
 
@@ -222,7 +222,7 @@ def remove_tree(directory, verbose=1, dry_run=0):
             # remove dir from cache if it's already there
             abspath = os.path.abspath(cmd[1])
             if abspath in _path_created:
-                _path_created.pop(abspath)
+                _path_created.remove(abspath)
         except OSError as exc:
             log.warning("error removing %s: %s", directory, exc)
 
diff --git a/distutils/dist.py b/distutils/dist.py
index 668ce7eb0a..b62db8cbb1 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -694,12 +694,12 @@ def handle_display_options(self, option_order):
         # display that metadata in the order in which the user supplied the
         # metadata options.
         any_display_options = 0
-        is_display_option = {}
+        is_display_option = set()
         for option in self.display_options:
-            is_display_option[option[0]] = 1
+            is_display_option.add(option[0])
 
         for opt, val in option_order:
-            if val and is_display_option.get(opt):
+            if val and opt in is_display_option:
                 opt = translate_longopt(opt)
                 value = getattr(self.metadata, "get_" + opt)()
                 if opt in ('keywords', 'platforms'):
@@ -740,13 +740,13 @@ def print_commands(self):
         import distutils.command
 
         std_commands = distutils.command.__all__
-        is_std = {}
+        is_std = set()
         for cmd in std_commands:
-            is_std[cmd] = 1
+            is_std.add(cmd)
 
         extra_commands = []
         for cmd in self.cmdclass.keys():
-            if not is_std.get(cmd):
+            if cmd not in is_std:
                 extra_commands.append(cmd)
 
         max_length = 0
@@ -771,13 +771,13 @@ def get_command_list(self):
         import distutils.command
 
         std_commands = distutils.command.__all__
-        is_std = {}
+        is_std = set()
         for cmd in std_commands:
-            is_std[cmd] = 1
+            is_std.add(cmd)
 
         extra_commands = []
         for cmd in self.cmdclass.keys():
-            if not is_std.get(cmd):
+            if cmd not in is_std:
                 extra_commands.append(cmd)
 
         rv = []

From 33b5afa4d8cab3f8d6b365af5bc684c8d5407350 Mon Sep 17 00:00:00 2001
From: Avasam 
Date: Fri, 17 May 2024 18:06:18 -0400
Subject: [PATCH 082/151] Use actual boolean parameters and variables

---
 distutils/_msvccompiler.py              | 10 +++---
 distutils/archive_util.py               | 14 +++++---
 distutils/bcppcompiler.py               | 12 +++----
 distutils/ccompiler.py                  | 28 +++++++--------
 distutils/cmd.py                        | 26 ++++++++------
 distutils/command/bdist.py              |  4 +--
 distutils/command/bdist_dumb.py         |  8 ++---
 distutils/command/bdist_rpm.py          | 12 +++----
 distutils/command/build.py              |  2 +-
 distutils/command/build_clib.py         |  2 +-
 distutils/command/build_ext.py          |  4 +--
 distutils/command/build_py.py           | 10 +++---
 distutils/command/check.py              |  6 ++--
 distutils/command/config.py             |  6 ++--
 distutils/command/install.py            | 10 +++---
 distutils/command/install_data.py       |  4 +--
 distutils/command/install_headers.py    |  2 +-
 distutils/command/install_lib.py        |  2 +-
 distutils/command/install_scripts.py    |  2 +-
 distutils/command/register.py           |  6 ++--
 distutils/command/sdist.py              | 24 ++++++-------
 distutils/command/upload.py             |  2 +-
 distutils/config.py                     |  2 +-
 distutils/cygwinccompiler.py            |  6 ++--
 distutils/dir_util.py                   | 20 +++++------
 distutils/dist.py                       | 28 +++++++--------
 distutils/extension.py                  | 10 +++---
 distutils/fancy_getopt.py               |  6 ++--
 distutils/file_util.py                  | 12 +++----
 distutils/filelist.py                   | 14 ++++----
 distutils/msvc9compiler.py              | 12 +++----
 distutils/msvccompiler.py               | 12 +++----
 distutils/sysconfig.py                  | 10 ++++--
 distutils/tests/test_bdist.py           |  2 +-
 distutils/tests/test_bdist_rpm.py       |  4 +--
 distutils/tests/test_build_ext.py       | 22 ++++++------
 distutils/tests/test_build_py.py        | 12 ++++---
 distutils/tests/test_build_scripts.py   |  2 +-
 distutils/tests/test_check.py           |  8 ++---
 distutils/tests/test_cmd.py             |  2 +-
 distutils/tests/test_dir_util.py        | 36 +++++++++----------
 distutils/tests/test_dist.py            |  2 +-
 distutils/tests/test_file_util.py       | 14 ++++----
 distutils/tests/test_install.py         |  2 +-
 distutils/tests/test_install_data.py    |  2 +-
 distutils/tests/test_install_lib.py     |  2 +-
 distutils/tests/test_install_scripts.py |  8 ++---
 distutils/tests/test_register.py        | 14 ++++----
 distutils/tests/test_text_file.py       | 34 +++++++++++++-----
 distutils/tests/test_upload.py          |  4 +--
 distutils/unixccompiler.py              |  6 ++--
 distutils/util.py                       | 12 +++----
 distutils/zosccompiler.py               |  4 +--
 docs/distutils/apiref.rst               | 46 ++++++++++++-------------
 docs/distutils/configfile.rst           |  2 +-
 docs/distutils/setupscript.rst          |  2 +-
 56 files changed, 302 insertions(+), 268 deletions(-)

diff --git a/distutils/_msvccompiler.py b/distutils/_msvccompiler.py
index a2159fef83..b0322410c5 100644
--- a/distutils/_msvccompiler.py
+++ b/distutils/_msvccompiler.py
@@ -218,7 +218,7 @@ class MSVCCompiler(CCompiler):
     static_lib_format = shared_lib_format = '%s%s'
     exe_extension = '.exe'
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         super().__init__(verbose, dry_run, force)
         # target platform (.plat_name is consistent with 'bdist')
         self.plat_name = None
@@ -334,7 +334,7 @@ def compile(  # noqa: C901
         output_dir=None,
         macros=None,
         include_dirs=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         depends=None,
@@ -423,7 +423,7 @@ def compile(  # noqa: C901
         return objects
 
     def create_static_lib(
-        self, objects, output_libname, output_dir=None, debug=0, target_lang=None
+        self, objects, output_libname, output_dir=None, debug=False, target_lang=None
     ):
         if not self.initialized:
             self.initialize()
@@ -452,7 +452,7 @@ def link(
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -551,7 +551,7 @@ def runtime_library_dir_option(self, dir):
     def library_option(self, lib):
         return self.library_filename(lib)
 
-    def find_library_file(self, dirs, lib, debug=0):
+    def find_library_file(self, dirs, lib, debug=False):
         # Prefer a debugging library if found (and requested), but deal
         # with it if we don't have one.
         if debug:
diff --git a/distutils/archive_util.py b/distutils/archive_util.py
index 052f6e4646..7b2d177107 100644
--- a/distutils/archive_util.py
+++ b/distutils/archive_util.py
@@ -56,7 +56,13 @@ def _get_uid(name):
 
 
 def make_tarball(
-    base_name, base_dir, compress="gzip", verbose=0, dry_run=0, owner=None, group=None
+    base_name,
+    base_dir,
+    compress="gzip",
+    verbose=False,
+    dry_run=False,
+    owner=None,
+    group=None,
 ):
     """Create a (possibly compressed) tar file from all the files under
     'base_dir'.
@@ -134,7 +140,7 @@ def _set_uid_gid(tarinfo):
     return archive_name
 
 
-def make_zipfile(base_name, base_dir, verbose=0, dry_run=0):  # noqa: C901
+def make_zipfile(base_name, base_dir, verbose=False, dry_run=False):  # noqa: C901
     """Create a zip file from all the files under 'base_dir'.
 
     The output zip file will be named 'base_name' + ".zip".  Uses either the
@@ -224,8 +230,8 @@ def make_archive(
     format,
     root_dir=None,
     base_dir=None,
-    verbose=0,
-    dry_run=0,
+    verbose=False,
+    dry_run=False,
     owner=None,
     group=None,
 ):
diff --git a/distutils/bcppcompiler.py b/distutils/bcppcompiler.py
index c1341e43cb..4f47058cb3 100644
--- a/distutils/bcppcompiler.py
+++ b/distutils/bcppcompiler.py
@@ -61,7 +61,7 @@ class BCPPCompiler(CCompiler):
     static_lib_format = shared_lib_format = '%s%s'
     exe_extension = '.exe'
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         super().__init__(verbose, dry_run, force)
 
         # These executables are assumed to all be in the path.
@@ -90,7 +90,7 @@ def compile(  # noqa: C901
         output_dir=None,
         macros=None,
         include_dirs=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         depends=None,
@@ -161,7 +161,7 @@ def compile(  # noqa: C901
     # compile ()
 
     def create_static_lib(
-        self, objects, output_libname, output_dir=None, debug=0, target_lang=None
+        self, objects, output_libname, output_dir=None, debug=False, target_lang=None
     ):
         (objects, output_dir) = self._fix_object_args(objects, output_dir)
         output_filename = self.library_filename(output_libname, output_dir=output_dir)
@@ -189,7 +189,7 @@ def link(  # noqa: C901
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -313,7 +313,7 @@ def link(  # noqa: C901
 
     # -- Miscellaneous methods -----------------------------------------
 
-    def find_library_file(self, dirs, lib, debug=0):
+    def find_library_file(self, dirs, lib, debug=False):
         # List of effective library names to try, in order of preference:
         # xxx_bcpp.lib is better than xxx.lib
         # and xxx_d.lib is better than xxx.lib if debug is set
@@ -339,7 +339,7 @@ def find_library_file(self, dirs, lib, debug=0):
             return None
 
     # overwrite the one from CCompiler to support rc and res-files
-    def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
+    def object_filenames(self, source_filenames, strip_dir=False, output_dir=''):
         if output_dir is None:
             output_dir = ''
         obj_names = []
diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py
index 8876d73098..c4dced3868 100644
--- a/distutils/ccompiler.py
+++ b/distutils/ccompiler.py
@@ -104,7 +104,7 @@ class CCompiler:
     library dirs specific to this compiler class
     """
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         self.dry_run = dry_run
         self.force = force
         self.verbose = verbose
@@ -342,7 +342,7 @@ def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra):
             extra = []
 
         # Get the list of expected output (object) files
-        objects = self.object_filenames(sources, strip_dir=0, output_dir=outdir)
+        objects = self.object_filenames(sources, strip_dir=False, output_dir=outdir)
         assert len(objects) == len(sources)
 
         pp_opts = gen_preprocess_options(macros, incdirs)
@@ -532,7 +532,7 @@ def compile(
         output_dir=None,
         macros=None,
         include_dirs=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         depends=None,
@@ -609,7 +609,7 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
         pass
 
     def create_static_lib(
-        self, objects, output_libname, output_dir=None, debug=0, target_lang=None
+        self, objects, output_libname, output_dir=None, debug=False, target_lang=None
     ):
         """Link a bunch of stuff together to create a static library file.
         The "bunch of stuff" consists of the list of object files supplied
@@ -650,7 +650,7 @@ def link(
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -712,7 +712,7 @@ def link_shared_lib(
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -743,7 +743,7 @@ def link_shared_object(
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -773,7 +773,7 @@ def link_executable(
         libraries=None,
         library_dirs=None,
         runtime_library_dirs=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         target_lang=None,
@@ -909,7 +909,7 @@ def has_function(  # noqa: C901
                 os.remove(fn)
         return True
 
-    def find_library_file(self, dirs, lib, debug=0):
+    def find_library_file(self, dirs, lib, debug=False):
         """Search the specified list of directories for a static or shared
         library file 'lib' and return the full path to that file.  If
         'debug' true, look for a debugging version (if that makes sense on
@@ -952,7 +952,7 @@ def find_library_file(self, dirs, lib, debug=0):
     #   * exe_extension -
     #     extension for executable files, eg. '' or '.exe'
 
-    def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
+    def object_filenames(self, source_filenames, strip_dir=False, output_dir=''):
         if output_dir is None:
             output_dir = ''
         return list(
@@ -987,13 +987,13 @@ def _make_relative(base):
         # If abs, chop off leading /
         return no_drive[os.path.isabs(no_drive) :]
 
-    def shared_object_filename(self, basename, strip_dir=0, output_dir=''):
+    def shared_object_filename(self, basename, strip_dir=False, output_dir=''):
         assert output_dir is not None
         if strip_dir:
             basename = os.path.basename(basename)
         return os.path.join(output_dir, basename + self.shared_lib_extension)
 
-    def executable_filename(self, basename, strip_dir=0, output_dir=''):
+    def executable_filename(self, basename, strip_dir=False, output_dir=''):
         assert output_dir is not None
         if strip_dir:
             basename = os.path.basename(basename)
@@ -1003,7 +1003,7 @@ def library_filename(
         self,
         libname,
         lib_type='static',
-        strip_dir=0,
+        strip_dir=False,
         output_dir='',  # or 'shared'
     ):
         assert output_dir is not None
@@ -1125,7 +1125,7 @@ def show_compilers():
     pretty_printer.print_help("List of available compilers:")
 
 
-def new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0):
+def new_compiler(plat=None, compiler=None, verbose=False, dry_run=False, force=False):
     """Generate an instance of some CCompiler subclass for the supplied
     platform/compiler combination.  'plat' defaults to 'os.name'
     (eg. 'posix', 'nt'), and 'compiler' defaults to the default compiler
diff --git a/distutils/cmd.py b/distutils/cmd.py
index 02dbf165f5..fc35bd977d 100644
--- a/distutils/cmd.py
+++ b/distutils/cmd.py
@@ -87,13 +87,13 @@ def __init__(self, dist):
 
         # The 'help' flag is just used for command-line parsing, so
         # none of that complicated bureaucracy is needed.
-        self.help = 0
+        self.help = False
 
         # 'finalized' records whether or not 'finalize_options()' has been
         # called.  'finalize_options()' itself should not pay attention to
         # this flag: it is the business of 'ensure_finalized()', which
         # always calls 'finalize_options()', to respect/update it.
-        self.finalized = 0
+        self.finalized = False
 
     # XXX A more explicit way to customize dry_run would be better.
     def __getattr__(self, attr):
@@ -109,7 +109,7 @@ def __getattr__(self, attr):
     def ensure_finalized(self):
         if not self.finalized:
             self.finalize_options()
-        self.finalized = 1
+        self.finalized = True
 
     # Subclasses must define:
     #   initialize_options()
@@ -293,7 +293,7 @@ def set_undefined_options(self, src_cmd, *option_pairs):
             if getattr(self, dst_option) is None:
                 setattr(self, dst_option, getattr(src_cmd_obj, src_option))
 
-    def get_finalized_command(self, command, create=1):
+    def get_finalized_command(self, command, create=True):
         """Wrapper around Distribution's 'get_command_obj()' method: find
         (create if necessary and 'create' is true) the command object for
         'command', call its 'ensure_finalized()' method, and return the
@@ -305,7 +305,7 @@ def get_finalized_command(self, command, create=1):
 
     # XXX rename to 'get_reinitialized_command()'? (should do the
     # same in dist.py, if so)
-    def reinitialize_command(self, command, reinit_subcommands=0):
+    def reinitialize_command(self, command, reinit_subcommands=False):
         return self.distribution.reinitialize_command(command, reinit_subcommands)
 
     def run_command(self, command):
@@ -340,7 +340,13 @@ def mkpath(self, name, mode=0o777):
         dir_util.mkpath(name, mode, dry_run=self.dry_run)
 
     def copy_file(
-        self, infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1
+        self,
+        infile,
+        outfile,
+        preserve_mode=True,
+        preserve_times=True,
+        link=None,
+        level=1,
     ):
         """Copy a file respecting verbose, dry-run and force flags.  (The
         former two default to whatever is in the Distribution object, and
@@ -359,9 +365,9 @@ def copy_tree(
         self,
         infile,
         outfile,
-        preserve_mode=1,
-        preserve_times=1,
-        preserve_symlinks=0,
+        preserve_mode=True,
+        preserve_times=True,
+        preserve_symlinks=False,
         level=1,
     ):
         """Copy an entire directory tree respecting verbose, dry-run,
@@ -381,7 +387,7 @@ def move_file(self, src, dst, level=1):
         """Move a file respecting dry-run flag."""
         return file_util.move_file(src, dst, dry_run=self.dry_run)
 
-    def spawn(self, cmd, search_path=1, level=1):
+    def spawn(self, cmd, search_path=True, level=1):
         """Spawn an external command respecting dry-run flag."""
         from distutils.spawn import spawn
 
diff --git a/distutils/command/bdist.py b/distutils/command/bdist.py
index ade98445ba..21bc7c5d80 100644
--- a/distutils/command/bdist.py
+++ b/distutils/command/bdist.py
@@ -94,7 +94,7 @@ def initialize_options(self):
         self.plat_name = None
         self.formats = None
         self.dist_dir = None
-        self.skip_build = 0
+        self.skip_build = False
         self.group = None
         self.owner = None
 
@@ -150,5 +150,5 @@ def run(self):
             # If we're going to need to run this command again, tell it to
             # keep its temporary files around so subsequent runs go faster.
             if cmd_name in commands[i + 1 :]:
-                sub_cmd.keep_temp = 1
+                sub_cmd.keep_temp = True
             self.run_command(cmd_name)
diff --git a/distutils/command/bdist_dumb.py b/distutils/command/bdist_dumb.py
index 06502d201e..0f15b9fa67 100644
--- a/distutils/command/bdist_dumb.py
+++ b/distutils/command/bdist_dumb.py
@@ -63,10 +63,10 @@ def initialize_options(self):
         self.bdist_dir = None
         self.plat_name = None
         self.format = None
-        self.keep_temp = 0
+        self.keep_temp = False
         self.dist_dir = None
         self.skip_build = None
-        self.relative = 0
+        self.relative = False
         self.owner = None
         self.group = None
 
@@ -95,10 +95,10 @@ def run(self):
         if not self.skip_build:
             self.run_command('build')
 
-        install = self.reinitialize_command('install', reinit_subcommands=1)
+        install = self.reinitialize_command('install', reinit_subcommands=True)
         install.root = self.bdist_dir
         install.skip_build = self.skip_build
-        install.warn_dir = 0
+        install.warn_dir = False
 
         log.info("installing to %s", self.bdist_dir)
         self.run_command('install')
diff --git a/distutils/command/bdist_rpm.py b/distutils/command/bdist_rpm.py
index 649968a5eb..769dfa6d74 100644
--- a/distutils/command/bdist_rpm.py
+++ b/distutils/command/bdist_rpm.py
@@ -187,13 +187,13 @@ def initialize_options(self):
         self.build_requires = None
         self.obsoletes = None
 
-        self.keep_temp = 0
-        self.use_rpm_opt_flags = 1
-        self.rpm3_mode = 1
-        self.no_autoreq = 0
+        self.keep_temp = False
+        self.use_rpm_opt_flags = True
+        self.rpm3_mode = True
+        self.no_autoreq = False
 
         self.force_arch = None
-        self.quiet = 0
+        self.quiet = False
 
     def finalize_options(self):
         self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
@@ -223,7 +223,7 @@ def finalize_options(self):
 
         # don't pass CFLAGS to pure python distributions
         if not self.distribution.has_ext_modules():
-            self.use_rpm_opt_flags = 0
+            self.use_rpm_opt_flags = False
 
         self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))
         self.finalize_package_data()
diff --git a/distutils/command/build.py b/distutils/command/build.py
index d18ed503e3..0128500b0f 100644
--- a/distutils/command/build.py
+++ b/distutils/command/build.py
@@ -62,7 +62,7 @@ def initialize_options(self):
         self.compiler = None
         self.plat_name = None
         self.debug = None
-        self.force = 0
+        self.force = False
         self.executable = None
         self.parallel = None
 
diff --git a/distutils/command/build_clib.py b/distutils/command/build_clib.py
index 360575d0cb..85148d4b2e 100644
--- a/distutils/command/build_clib.py
+++ b/distutils/command/build_clib.py
@@ -57,7 +57,7 @@ def initialize_options(self):
         self.define = None
         self.undef = None
         self.debug = None
-        self.force = 0
+        self.force = False
         self.compiler = None
 
     def finalize_options(self):
diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py
index 06d949aff1..bfe6860035 100644
--- a/distutils/command/build_ext.py
+++ b/distutils/command/build_ext.py
@@ -109,7 +109,7 @@ def initialize_options(self):
         self.build_lib = None
         self.plat_name = None
         self.build_temp = None
-        self.inplace = 0
+        self.inplace = False
         self.package = None
 
         self.include_dirs = None
@@ -175,7 +175,7 @@ def finalize_options(self):  # noqa: C901
         # Make sure Python's include directories (for Python.h, pyconfig.h,
         # etc.) are in the include search path.
         py_include = sysconfig.get_python_inc()
-        plat_py_include = sysconfig.get_python_inc(plat_specific=1)
+        plat_py_include = sysconfig.get_python_inc(plat_specific=True)
         if self.include_dirs is None:
             self.include_dirs = self.distribution.include_dirs or []
         if isinstance(self.include_dirs, str):
diff --git a/distutils/command/build_py.py b/distutils/command/build_py.py
index 56e6fa2e66..40a99b90d4 100644
--- a/distutils/command/build_py.py
+++ b/distutils/command/build_py.py
@@ -38,7 +38,7 @@ def initialize_options(self):
         self.package = None
         self.package_data = None
         self.package_dir = None
-        self.compile = 0
+        self.compile = False
         self.optimize = 0
         self.force = None
 
@@ -95,7 +95,7 @@ def run(self):
             self.build_packages()
             self.build_package_data()
 
-        self.byte_compile(self.get_outputs(include_bytecode=0))
+        self.byte_compile(self.get_outputs(include_bytecode=False))
 
     def get_data_files(self):
         """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
@@ -264,7 +264,7 @@ def find_modules(self):
                 (package_dir, checked) = packages[package]
             except KeyError:
                 package_dir = self.get_package_dir(package)
-                checked = 0
+                checked = False
 
             if not checked:
                 init_py = self.check_package(package, package_dir)
@@ -306,7 +306,7 @@ def get_module_outfile(self, build_dir, package, module):
         outfile_path = [build_dir] + list(package) + [module + ".py"]
         return os.path.join(*outfile_path)
 
-    def get_outputs(self, include_bytecode=1):
+    def get_outputs(self, include_bytecode=True):
         modules = self.find_all_modules()
         outputs = []
         for package, module, _module_file in modules:
@@ -347,7 +347,7 @@ def build_module(self, module, module_file, package):
         outfile = self.get_module_outfile(self.build_lib, package, module)
         dir = os.path.dirname(outfile)
         self.mkpath(dir)
-        return self.copy_file(module_file, outfile, preserve_mode=0)
+        return self.copy_file(module_file, outfile, preserve_mode=False)
 
     def build_modules(self):
         modules = self.find_modules()
diff --git a/distutils/command/check.py b/distutils/command/check.py
index 28599e109c..11d40a966b 100644
--- a/distutils/command/check.py
+++ b/distutils/command/check.py
@@ -21,7 +21,7 @@ def __init__(
             report_level,
             halt_level,
             stream=None,
-            debug=0,
+            debug=False,
             encoding='ascii',
             error_handler='replace',
         ):
@@ -58,9 +58,9 @@ class check(Command):
 
     def initialize_options(self):
         """Sets default values for options."""
-        self.restructuredtext = 0
+        self.restructuredtext = False
         self.metadata = 1
-        self.strict = 0
+        self.strict = False
         self._warnings = 0
 
     def finalize_options(self):
diff --git a/distutils/command/config.py b/distutils/command/config.py
index d4b2b0a362..e82f0fd043 100644
--- a/distutils/command/config.py
+++ b/distutils/command/config.py
@@ -94,7 +94,7 @@ def _check_compiler(self):
 
         if not isinstance(self.compiler, CCompiler):
             self.compiler = new_compiler(
-                compiler=self.compiler, dry_run=self.dry_run, force=1
+                compiler=self.compiler, dry_run=self.dry_run, force=True
             )
             customize_compiler(self.compiler)
             if self.include_dirs:
@@ -292,8 +292,8 @@ def check_func(
         include_dirs=None,
         libraries=None,
         library_dirs=None,
-        decl=0,
-        call=0,
+        decl=False,
+        call=False,
     ):
         """Determine if function 'func' is available by constructing a
         source file that refers to 'func', and compiles and links it.
diff --git a/distutils/command/install.py b/distutils/command/install.py
index 8e920be4de..9b82cf1e42 100644
--- a/distutils/command/install.py
+++ b/distutils/command/install.py
@@ -258,7 +258,7 @@ def initialize_options(self):
         self.prefix = None
         self.exec_prefix = None
         self.home = None
-        self.user = 0
+        self.user = False
 
         # These select only the installation base; it's up to the user to
         # specify the installation scheme (currently, that means supplying
@@ -293,7 +293,7 @@ def initialize_options(self):
         # 'install_path_file' is always true unless some outsider meddles
         # with it.
         self.extra_path = None
-        self.install_path_file = 1
+        self.install_path_file = True
 
         # 'force' forces installation, even if target files are not
         # out-of-date.  'skip_build' skips running the "build" command,
@@ -301,9 +301,9 @@ def initialize_options(self):
         # a user option, it's just there so the bdist_* commands can turn
         # it off) determines whether we warn about installing to a
         # directory not in sys.path.
-        self.force = 0
-        self.skip_build = 0
-        self.warn_dir = 1
+        self.force = False
+        self.skip_build = False
+        self.warn_dir = True
 
         # These are only here as a conduit from the 'build' command to the
         # 'install_*' commands that do the real work.  ('build_base' isn't
diff --git a/distutils/command/install_data.py b/distutils/command/install_data.py
index b63a1af25e..a4da892480 100644
--- a/distutils/command/install_data.py
+++ b/distutils/command/install_data.py
@@ -31,9 +31,9 @@ def initialize_options(self):
         self.install_dir = None
         self.outfiles = []
         self.root = None
-        self.force = 0
+        self.force = False
         self.data_files = self.distribution.data_files
-        self.warn_dir = 1
+        self.warn_dir = True
 
     def finalize_options(self):
         self.set_undefined_options(
diff --git a/distutils/command/install_headers.py b/distutils/command/install_headers.py
index 085272c1a2..fbb3b242ea 100644
--- a/distutils/command/install_headers.py
+++ b/distutils/command/install_headers.py
@@ -19,7 +19,7 @@ class install_headers(Command):
 
     def initialize_options(self):
         self.install_dir = None
-        self.force = 0
+        self.force = False
         self.outfiles = []
 
     def finalize_options(self):
diff --git a/distutils/command/install_lib.py b/distutils/command/install_lib.py
index b1f346f018..efa6058598 100644
--- a/distutils/command/install_lib.py
+++ b/distutils/command/install_lib.py
@@ -54,7 +54,7 @@ def initialize_options(self):
         # let the 'install' command dictate our installation directory
         self.install_dir = None
         self.build_dir = None
-        self.force = 0
+        self.force = False
         self.compile = None
         self.optimize = None
         self.skip_build = None
diff --git a/distutils/command/install_scripts.py b/distutils/command/install_scripts.py
index e66b13a16d..bb43387fb8 100644
--- a/distutils/command/install_scripts.py
+++ b/distutils/command/install_scripts.py
@@ -26,7 +26,7 @@ class install_scripts(Command):
 
     def initialize_options(self):
         self.install_dir = None
-        self.force = 0
+        self.force = False
         self.build_dir = None
         self.skip_build = None
 
diff --git a/distutils/command/register.py b/distutils/command/register.py
index ee6c54daba..0311d45a36 100644
--- a/distutils/command/register.py
+++ b/distutils/command/register.py
@@ -37,8 +37,8 @@ class register(PyPIRCCommand):
 
     def initialize_options(self):
         PyPIRCCommand.initialize_options(self)
-        self.list_classifiers = 0
-        self.strict = 0
+        self.list_classifiers = False
+        self.strict = False
 
     def finalize_options(self):
         PyPIRCCommand.finalize_options(self)
@@ -74,7 +74,7 @@ def check_metadata(self):
         check = self.distribution.get_command_obj('check')
         check.ensure_finalized()
         check.strict = self.strict
-        check.restructuredtext = 1
+        check.restructuredtext = True
         check.run()
 
     def _set_config(self):
diff --git a/distutils/command/sdist.py b/distutils/command/sdist.py
index 387d27c90b..e737cf2acc 100644
--- a/distutils/command/sdist.py
+++ b/distutils/command/sdist.py
@@ -125,14 +125,14 @@ def initialize_options(self):
 
         # 'use_defaults': if true, we will include the default file set
         # in the manifest
-        self.use_defaults = 1
-        self.prune = 1
+        self.use_defaults = True
+        self.prune = True
 
-        self.manifest_only = 0
-        self.force_manifest = 0
+        self.manifest_only = False
+        self.force_manifest = False
 
         self.formats = ['gztar']
-        self.keep_temp = 0
+        self.keep_temp = False
         self.dist_dir = None
 
         self.archive_files = None
@@ -353,12 +353,12 @@ def read_template(self):
         log.info("reading manifest template '%s'", self.template)
         template = TextFile(
             self.template,
-            strip_comments=1,
-            skip_blanks=1,
-            join_lines=1,
-            lstrip_ws=1,
-            rstrip_ws=1,
-            collapse_join=1,
+            strip_comments=True,
+            skip_blanks=True,
+            join_lines=True,
+            lstrip_ws=True,
+            rstrip_ws=True,
+            collapse_join=True,
         )
 
         try:
@@ -401,7 +401,7 @@ def prune_file_list(self):
 
         vcs_dirs = ['RCS', 'CVS', r'\.svn', r'\.hg', r'\.git', r'\.bzr', '_darcs']
         vcs_ptrn = r'(^|{})({})({}).*'.format(seps, '|'.join(vcs_dirs), seps)
-        self.filelist.exclude_pattern(vcs_ptrn, is_regex=1)
+        self.filelist.exclude_pattern(vcs_ptrn, is_regex=True)
 
     def write_manifest(self):
         """Write the file list in 'self.filelist' (presumably as filled in
diff --git a/distutils/command/upload.py b/distutils/command/upload.py
index cf541f8a82..63751e7268 100644
--- a/distutils/command/upload.py
+++ b/distutils/command/upload.py
@@ -41,7 +41,7 @@ def initialize_options(self):
         PyPIRCCommand.initialize_options(self)
         self.username = ''
         self.password = ''
-        self.show_response = 0
+        self.show_response = False
         self.sign = False
         self.identity = None
 
diff --git a/distutils/config.py b/distutils/config.py
index 83f96a9eec..7b273e168d 100644
--- a/distutils/config.py
+++ b/distutils/config.py
@@ -129,7 +129,7 @@ def initialize_options(self):
         """Initialize options."""
         self.repository = None
         self.realm = None
-        self.show_response = 0
+        self.show_response = False
 
     def finalize_options(self):
         """Finalizes options."""
diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py
index 539f09d8f3..f2e62bd7ac 100644
--- a/distutils/cygwinccompiler.py
+++ b/distutils/cygwinccompiler.py
@@ -83,7 +83,7 @@ class CygwinCCompiler(UnixCCompiler):
     dylib_lib_format = "cyg%s%s"
     exe_extension = ".exe"
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         super().__init__(verbose, dry_run, force)
 
         status, details = check_config_h()
@@ -154,7 +154,7 @@ def link(
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -265,7 +265,7 @@ class Mingw32CCompiler(CygwinCCompiler):
 
     compiler_type = 'mingw32'
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         super().__init__(verbose, dry_run, force)
 
         shared_option = "-shared"
diff --git a/distutils/dir_util.py b/distutils/dir_util.py
index 370c6ffd49..4108c6c514 100644
--- a/distutils/dir_util.py
+++ b/distutils/dir_util.py
@@ -13,7 +13,7 @@
 _path_created = {}
 
 
-def mkpath(name, mode=0o777, verbose=1, dry_run=0):  # noqa: C901
+def mkpath(name, mode=0o777, verbose=True, dry_run=False):  # noqa: C901
     """Create a directory and any missing ancestor directories.
 
     If the directory already exists (or if 'name' is the empty string, which
@@ -79,11 +79,11 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0):  # noqa: C901
                     )
             created_dirs.append(head)
 
-        _path_created[abs_head] = 1
+        _path_created[abs_head] = True
     return created_dirs
 
 
-def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0):
+def create_tree(base_dir, files, mode=0o777, verbose=True, dry_run=False):
     """Create all the empty directories under 'base_dir' needed to put 'files'
     there.
 
@@ -104,12 +104,12 @@ def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0):
 def copy_tree(  # noqa: C901
     src,
     dst,
-    preserve_mode=1,
-    preserve_times=1,
-    preserve_symlinks=0,
-    update=0,
-    verbose=1,
-    dry_run=0,
+    preserve_mode=True,
+    preserve_times=True,
+    preserve_symlinks=False,
+    update=False,
+    verbose=True,
+    dry_run=False,
 ):
     """Copy an entire directory tree 'src' to a new location 'dst'.
 
@@ -202,7 +202,7 @@ def _build_cmdtuple(path, cmdtuples):
     cmdtuples.append((os.rmdir, path))
 
 
-def remove_tree(directory, verbose=1, dry_run=0):
+def remove_tree(directory, verbose=True, dry_run=False):
     """Recursively remove an entire directory tree.
 
     Any errors are ignored (apart from being reported to stdout if 'verbose'
diff --git a/distutils/dist.py b/distutils/dist.py
index 668ce7eb0a..13b939ae42 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -137,9 +137,9 @@ def __init__(self, attrs=None):  # noqa: C901
         """
 
         # Default values for our command-line options
-        self.verbose = 1
-        self.dry_run = 0
-        self.help = 0
+        self.verbose = True
+        self.dry_run = False
+        self.help = False
         for attr in self.display_option_names:
             setattr(self, attr, 0)
 
@@ -579,7 +579,7 @@ def _parse_command_opts(self, parser, args):  # noqa: C901
         parser.set_negative_aliases(negative_opt)
         (args, opts) = parser.getopt(args[1:])
         if hasattr(opts, 'help') and opts.help:
-            self._show_help(parser, display_options=0, commands=[cmd_class])
+            self._show_help(parser, display_options=False, commands=[cmd_class])
             return
 
         if hasattr(cmd_class, 'help_options') and isinstance(
@@ -622,7 +622,7 @@ def finalize_options(self):
                 setattr(self.metadata, attr, value)
 
     def _show_help(
-        self, parser, global_options=1, display_options=1, commands: Iterable = ()
+        self, parser, global_options=True, display_options=True, commands: Iterable = ()
     ):
         """Show help for the setup script command-line in the form of
         several lists of command-line options.  'parser' should be a
@@ -696,7 +696,7 @@ def handle_display_options(self, option_order):
         any_display_options = 0
         is_display_option = {}
         for option in self.display_options:
-            is_display_option[option[0]] = 1
+            is_display_option[option[0]] = True
 
         for opt, val in option_order:
             if val and is_display_option.get(opt):
@@ -742,7 +742,7 @@ def print_commands(self):
         std_commands = distutils.command.__all__
         is_std = {}
         for cmd in std_commands:
-            is_std[cmd] = 1
+            is_std[cmd] = True
 
         extra_commands = []
         for cmd in self.cmdclass.keys():
@@ -773,7 +773,7 @@ def get_command_list(self):
         std_commands = distutils.command.__all__
         is_std = {}
         for cmd in std_commands:
-            is_std[cmd] = 1
+            is_std[cmd] = True
 
         extra_commands = []
         for cmd in self.cmdclass.keys():
@@ -844,7 +844,7 @@ def get_command_class(self, command):
 
         raise DistutilsModuleError("invalid command '%s'" % command)
 
-    def get_command_obj(self, command, create=1):
+    def get_command_obj(self, command, create=True):
         """Return the command object for 'command'.  Normally this object
         is cached on a previous call to 'get_command_obj()'; if no command
         object for 'command' is in the cache, then we either create and
@@ -860,7 +860,7 @@ def get_command_obj(self, command, create=1):
 
             klass = self.get_command_class(command)
             cmd_obj = self.command_obj[command] = klass(self)
-            self.have_run[command] = 0
+            self.have_run[command] = False
 
             # Set any options that were supplied in config files
             # or on the command line.  (NB. support for error
@@ -915,7 +915,7 @@ def _set_command_options(self, command_obj, option_dict=None):  # noqa: C901
             except ValueError as msg:
                 raise DistutilsOptionError(msg)
 
-    def reinitialize_command(self, command, reinit_subcommands=0):
+    def reinitialize_command(self, command, reinit_subcommands=False):
         """Reinitializes a command to the state it was in when first
         returned by 'get_command_obj()': ie., initialized but not yet
         finalized.  This provides the opportunity to sneak option
@@ -945,8 +945,8 @@ def reinitialize_command(self, command, reinit_subcommands=0):
         if not command.finalized:
             return command
         command.initialize_options()
-        command.finalized = 0
-        self.have_run[command_name] = 0
+        command.finalized = False
+        self.have_run[command_name] = False
         self._set_command_options(command)
 
         if reinit_subcommands:
@@ -986,7 +986,7 @@ def run_command(self, command):
         cmd_obj = self.get_command_obj(command)
         cmd_obj.ensure_finalized()
         cmd_obj.run()
-        self.have_run[command] = 1
+        self.have_run[command] = True
 
     # -- Distribution query methods ------------------------------------
 
diff --git a/distutils/extension.py b/distutils/extension.py
index 94e71635d9..793f8972d1 100644
--- a/distutils/extension.py
+++ b/distutils/extension.py
@@ -150,11 +150,11 @@ def read_setup_file(filename):  # noqa: C901
     #    ... [ ...] [ ...] [ ...]
     file = TextFile(
         filename,
-        strip_comments=1,
-        skip_blanks=1,
-        join_lines=1,
-        lstrip_ws=1,
-        rstrip_ws=1,
+        strip_comments=True,
+        skip_blanks=True,
+        join_lines=True,
+        lstrip_ws=True,
+        rstrip_ws=True,
     )
     try:
         extensions = []
diff --git a/distutils/fancy_getopt.py b/distutils/fancy_getopt.py
index e905aede4d..abbbe26777 100644
--- a/distutils/fancy_getopt.py
+++ b/distutils/fancy_getopt.py
@@ -178,7 +178,7 @@ def _grok_option_table(self):  # noqa: C901
                 if short:
                     short = short + ':'
                 long = long[0:-1]
-                self.takes_arg[long] = 1
+                self.takes_arg[long] = True
             else:
                 # Is option is a "negative alias" for some other option (eg.
                 # "quiet" == "!verbose")?
@@ -191,7 +191,7 @@ def _grok_option_table(self):  # noqa: C901
                         )
 
                     self.long_opts[-1] = long  # XXX redundant?!
-                self.takes_arg[long] = 0
+                self.takes_arg[long] = False
 
             # If this is an alias option, make sure its "takes arg" flag is
             # the same as the option it's aliased to.
@@ -268,7 +268,7 @@ def getopt(self, args=None, object=None):  # noqa: C901
 
             attr = self.attr_name[opt]
             # The only repeating option at the moment is 'verbose'.
-            # It has a negative option -q quiet, which should set verbose = 0.
+            # It has a negative option -q quiet, which should set verbose = False.
             if val and self.repeat.get(attr) is not None:
                 val = getattr(object, attr, 0) + 1
             setattr(object, attr, val)
diff --git a/distutils/file_util.py b/distutils/file_util.py
index 960def9cf9..0f20091edc 100644
--- a/distutils/file_util.py
+++ b/distutils/file_util.py
@@ -63,12 +63,12 @@ def _copy_file_contents(src, dst, buffer_size=16 * 1024):  # noqa: C901
 def copy_file(  # noqa: C901
     src,
     dst,
-    preserve_mode=1,
-    preserve_times=1,
-    update=0,
+    preserve_mode=True,
+    preserve_times=True,
+    update=False,
     link=None,
-    verbose=1,
-    dry_run=0,
+    verbose=True,
+    dry_run=False,
 ):
     """Copy a file 'src' to 'dst'.  If 'dst' is a directory, then 'src' is
     copied there with the same name; otherwise, it must be a filename.  (If
@@ -168,7 +168,7 @@ def copy_file(  # noqa: C901
 
 
 # XXX I suspect this is Unix-specific -- need porting help!
-def move_file(src, dst, verbose=1, dry_run=0):  # noqa: C901
+def move_file(src, dst, verbose=True, dry_run=False):  # noqa: C901
     """Move a file 'src' to 'dst'.  If 'dst' is a directory, the file will
     be moved into it with the same name; otherwise, 'src' is just renamed
     to 'dst'.  Return the new full name of the file.
diff --git a/distutils/filelist.py b/distutils/filelist.py
index 71ffb2abe7..78276a4d41 100644
--- a/distutils/filelist.py
+++ b/distutils/filelist.py
@@ -119,13 +119,13 @@ def process_template_line(self, line):  # noqa: C901
         if action == 'include':
             self.debug_print("include " + ' '.join(patterns))
             for pattern in patterns:
-                if not self.include_pattern(pattern, anchor=1):
+                if not self.include_pattern(pattern, anchor=True):
                     log.warning("warning: no files found matching '%s'", pattern)
 
         elif action == 'exclude':
             self.debug_print("exclude " + ' '.join(patterns))
             for pattern in patterns:
-                if not self.exclude_pattern(pattern, anchor=1):
+                if not self.exclude_pattern(pattern, anchor=True):
                     log.warning(
                         (
                             "warning: no previously-included files "
@@ -137,7 +137,7 @@ def process_template_line(self, line):  # noqa: C901
         elif action == 'global-include':
             self.debug_print("global-include " + ' '.join(patterns))
             for pattern in patterns:
-                if not self.include_pattern(pattern, anchor=0):
+                if not self.include_pattern(pattern, anchor=False):
                     log.warning(
                         (
                             "warning: no files found matching '%s' "
@@ -149,7 +149,7 @@ def process_template_line(self, line):  # noqa: C901
         elif action == 'global-exclude':
             self.debug_print("global-exclude " + ' '.join(patterns))
             for pattern in patterns:
-                if not self.exclude_pattern(pattern, anchor=0):
+                if not self.exclude_pattern(pattern, anchor=False):
                     log.warning(
                         (
                             "warning: no previously-included files matching "
@@ -197,7 +197,7 @@ def process_template_line(self, line):  # noqa: C901
 
     # Filtering/selection methods
 
-    def include_pattern(self, pattern, anchor=1, prefix=None, is_regex=0):
+    def include_pattern(self, pattern, anchor=True, prefix=None, is_regex=False):
         """Select strings (presumably filenames) from 'self.files' that
         match 'pattern', a Unix-style wildcard (glob) pattern.  Patterns
         are not quite the same as implemented by the 'fnmatch' module: '*'
@@ -238,7 +238,7 @@ def include_pattern(self, pattern, anchor=1, prefix=None, is_regex=0):
                 files_found = True
         return files_found
 
-    def exclude_pattern(self, pattern, anchor=1, prefix=None, is_regex=0):
+    def exclude_pattern(self, pattern, anchor=True, prefix=None, is_regex=False):
         """Remove strings (presumably filenames) from 'files' that match
         'pattern'.  Other parameters are the same as for
         'include_pattern()', above.
@@ -332,7 +332,7 @@ def glob_to_re(pattern):
     return pattern_re
 
 
-def translate_pattern(pattern, anchor=1, prefix=None, is_regex=0):
+def translate_pattern(pattern, anchor=True, prefix=None, is_regex=False):
     """Translate a shell-like wildcard pattern to a compiled regular
     expression.  Return the compiled regex.  If 'is_regex' true,
     then 'pattern' is directly compiled to a regex (if it's a string)
diff --git a/distutils/msvc9compiler.py b/distutils/msvc9compiler.py
index 6a0105e484..2bde3f4e2f 100644
--- a/distutils/msvc9compiler.py
+++ b/distutils/msvc9compiler.py
@@ -346,7 +346,7 @@ class MSVCCompiler(CCompiler):
     static_lib_format = shared_lib_format = '%s%s'
     exe_extension = '.exe'
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         super().__init__(verbose, dry_run, force)
         self.__version = VERSION
         self.__root = r"Software\Microsoft\VisualStudio"
@@ -460,7 +460,7 @@ def initialize(self, plat_name=None):  # noqa: C901
 
     # -- Worker methods ------------------------------------------------
 
-    def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
+    def object_filenames(self, source_filenames, strip_dir=False, output_dir=''):
         # Copied from ccompiler.py, extended to return .res as 'object'-file
         # for .rc input file
         if output_dir is None:
@@ -491,7 +491,7 @@ def compile(  # noqa: C901
         output_dir=None,
         macros=None,
         include_dirs=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         depends=None,
@@ -578,7 +578,7 @@ def compile(  # noqa: C901
         return objects
 
     def create_static_lib(
-        self, objects, output_libname, output_dir=None, debug=0, target_lang=None
+        self, objects, output_libname, output_dir=None, debug=False, target_lang=None
     ):
         if not self.initialized:
             self.initialize()
@@ -606,7 +606,7 @@ def link(  # noqa: C901
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -783,7 +783,7 @@ def runtime_library_dir_option(self, dir):
     def library_option(self, lib):
         return self.library_filename(lib)
 
-    def find_library_file(self, dirs, lib, debug=0):
+    def find_library_file(self, dirs, lib, debug=False):
         # Prefer a debugging library if found (and requested), but deal
         # with it if we don't have one.
         if debug:
diff --git a/distutils/msvccompiler.py b/distutils/msvccompiler.py
index ac8b68c08c..223e627afb 100644
--- a/distutils/msvccompiler.py
+++ b/distutils/msvccompiler.py
@@ -253,7 +253,7 @@ class MSVCCompiler(CCompiler):
     static_lib_format = shared_lib_format = '%s%s'
     exe_extension = '.exe'
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         super().__init__(verbose, dry_run, force)
         self.__version = get_build_version()
         self.__arch = get_build_architecture()
@@ -354,7 +354,7 @@ def initialize(self):
 
     # -- Worker methods ------------------------------------------------
 
-    def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
+    def object_filenames(self, source_filenames, strip_dir=False, output_dir=''):
         # Copied from ccompiler.py, extended to return .res as 'object'-file
         # for .rc input file
         if output_dir is None:
@@ -385,7 +385,7 @@ def compile(  # noqa: C901
         output_dir=None,
         macros=None,
         include_dirs=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         depends=None,
@@ -472,7 +472,7 @@ def compile(  # noqa: C901
         return objects
 
     def create_static_lib(
-        self, objects, output_libname, output_dir=None, debug=0, target_lang=None
+        self, objects, output_libname, output_dir=None, debug=False, target_lang=None
     ):
         if not self.initialized:
             self.initialize()
@@ -500,7 +500,7 @@ def link(  # noqa: C901
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -585,7 +585,7 @@ def runtime_library_dir_option(self, dir):
     def library_option(self, lib):
         return self.library_filename(lib)
 
-    def find_library_file(self, dirs, lib, debug=0):
+    def find_library_file(self, dirs, lib, debug=False):
         # Prefer a debugging library if found (and requested), but deal
         # with it if we don't have one.
         if debug:
diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py
index 4ed51c1f03..4ef57a89ab 100644
--- a/distutils/sysconfig.py
+++ b/distutils/sysconfig.py
@@ -108,7 +108,7 @@ def get_python_version():
     return '%d.%d' % sys.version_info[:2]
 
 
-def get_python_inc(plat_specific=0, prefix=None):
+def get_python_inc(plat_specific=False, prefix=None):
     """Return the directory containing installed Python header files.
 
     If 'plat_specific' is false (the default), this is the path to the
@@ -213,7 +213,7 @@ def _posix_lib(standard_lib, libpython, early_prefix, prefix):
         return os.path.join(libpython, "site-packages")
 
 
-def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
+def get_python_lib(plat_specific=False, standard_lib=False, prefix=None):
     """Return the directory containing the Python library (standard or
     site additions).
 
@@ -399,7 +399,11 @@ def parse_makefile(fn, g=None):  # noqa: C901
     from distutils.text_file import TextFile
 
     fp = TextFile(
-        fn, strip_comments=1, skip_blanks=1, join_lines=1, errors="surrogateescape"
+        fn,
+        strip_comments=True,
+        skip_blanks=True,
+        join_lines=True,
+        errors="surrogateescape",
     )
 
     if g is None:
diff --git a/distutils/tests/test_bdist.py b/distutils/tests/test_bdist.py
index 1804807752..a06ac0e794 100644
--- a/distutils/tests/test_bdist.py
+++ b/distutils/tests/test_bdist.py
@@ -31,7 +31,7 @@ def test_skip_build(self):
         # bug #10946: bdist --skip-build should trickle down to subcommands
         dist = self.create_dist()[1]
         cmd = bdist(dist)
-        cmd.skip_build = 1
+        cmd.skip_build = True
         cmd.ensure_finalized()
         dist.command_obj['bdist'] = cmd
 
diff --git a/distutils/tests/test_bdist_rpm.py b/distutils/tests/test_bdist_rpm.py
index a5cb42c334..0d3138ba40 100644
--- a/distutils/tests/test_bdist_rpm.py
+++ b/distutils/tests/test_bdist_rpm.py
@@ -72,7 +72,7 @@ def test_quiet(self):
         cmd.fix_python = True
 
         # running in quiet mode
-        cmd.quiet = 1
+        cmd.quiet = True
         cmd.ensure_finalized()
         cmd.run()
 
@@ -114,7 +114,7 @@ def test_no_optimize_flag(self):
         cmd = bdist_rpm(dist)
         cmd.fix_python = True
 
-        cmd.quiet = 1
+        cmd.quiet = True
         cmd.ensure_finalized()
         cmd.run()
 
diff --git a/distutils/tests/test_build_ext.py b/distutils/tests/test_build_ext.py
index cc83e7fbc8..0b8ff2d5f9 100644
--- a/distutils/tests/test_build_ext.py
+++ b/distutils/tests/test_build_ext.py
@@ -140,7 +140,7 @@ def test_solaris_enable_shared(self):
         from distutils.sysconfig import _config_vars
 
         old_var = _config_vars.get('Py_ENABLE_SHARED')
-        _config_vars['Py_ENABLE_SHARED'] = 1
+        _config_vars['Py_ENABLE_SHARED'] = True
         try:
             cmd.ensure_finalized()
         finally:
@@ -164,7 +164,7 @@ def test_user_site(self):
         assert 'user' in options
 
         # setting a value
-        cmd.user = 1
+        cmd.user = True
 
         # setting user based lib and include
         lib = os.path.join(site.USER_BASE, 'lib')
@@ -209,7 +209,7 @@ def test_finalize_options(self):
         for p in py_include.split(os.path.pathsep):
             assert p in cmd.include_dirs
 
-        plat_py_include = sysconfig.get_python_inc(plat_specific=1)
+        plat_py_include = sysconfig.get_python_inc(plat_specific=True)
         for p in plat_py_include.split(os.path.pathsep):
             assert p in cmd.include_dirs
 
@@ -381,7 +381,7 @@ def test_get_outputs(self):
         old_wd = os.getcwd()
         os.chdir(other_tmp_dir)
         try:
-            cmd.inplace = 1
+            cmd.inplace = True
             cmd.run()
             so_file = cmd.get_outputs()[0]
         finally:
@@ -392,7 +392,7 @@ def test_get_outputs(self):
         so_dir = os.path.dirname(so_file)
         assert so_dir == other_tmp_dir
 
-        cmd.inplace = 0
+        cmd.inplace = False
         cmd.compiler = None
         cmd.run()
         so_file = cmd.get_outputs()[0]
@@ -401,7 +401,7 @@ def test_get_outputs(self):
         so_dir = os.path.dirname(so_file)
         assert so_dir == cmd.build_lib
 
-        # inplace = 0, cmd.package = 'bar'
+        # inplace = False, cmd.package = 'bar'
         build_py = cmd.get_finalized_command('build_py')
         build_py.package_dir = {'': 'bar'}
         path = cmd.get_ext_fullpath('foo')
@@ -409,8 +409,8 @@ def test_get_outputs(self):
         path = os.path.split(path)[0]
         assert path == cmd.build_lib
 
-        # inplace = 1, cmd.package = 'bar'
-        cmd.inplace = 1
+        # inplace = True, cmd.package = 'bar'
+        cmd.inplace = True
         other_tmp_dir = os.path.realpath(self.mkdtemp())
         old_wd = os.getcwd()
         os.chdir(other_tmp_dir)
@@ -431,7 +431,7 @@ def test_ext_fullpath(self):
         # dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]})
         dist = Distribution()
         cmd = self.build_ext(dist)
-        cmd.inplace = 1
+        cmd.inplace = True
         cmd.distribution.package_dir = {'': 'src'}
         cmd.distribution.packages = ['lxml', 'lxml.html']
         curdir = os.getcwd()
@@ -440,7 +440,7 @@ def test_ext_fullpath(self):
         assert wanted == path
 
         # building lxml.etree not inplace
-        cmd.inplace = 0
+        cmd.inplace = False
         cmd.build_lib = os.path.join(curdir, 'tmpdir')
         wanted = os.path.join(curdir, 'tmpdir', 'lxml', 'etree' + ext)
         path = cmd.get_ext_fullpath('lxml.etree')
@@ -455,7 +455,7 @@ def test_ext_fullpath(self):
         assert wanted == path
 
         # building twisted.runner.portmap inplace
-        cmd.inplace = 1
+        cmd.inplace = True
         path = cmd.get_ext_fullpath('twisted.runner.portmap')
         wanted = os.path.join(curdir, 'twisted', 'runner', 'portmap' + ext)
         assert wanted == path
diff --git a/distutils/tests/test_build_py.py b/distutils/tests/test_build_py.py
index 8bc0e98a4f..739c903622 100644
--- a/distutils/tests/test_build_py.py
+++ b/distutils/tests/test_build_py.py
@@ -28,13 +28,15 @@ def test_package_data(self):
         dist = Distribution({"packages": ["pkg"], "package_dir": {"pkg": sources}})
         # script_name need not exist, it just need to be initialized
         dist.script_name = os.path.join(sources, "setup.py")
-        dist.command_obj["build"] = support.DummyCommand(force=0, build_lib=destination)
+        dist.command_obj["build"] = support.DummyCommand(
+            force=False, build_lib=destination
+        )
         dist.packages = ["pkg"]
         dist.package_data = {"pkg": ["README.txt"]}
         dist.package_dir = {"pkg": sources}
 
         cmd = build_py(dist)
-        cmd.compile = 1
+        cmd.compile = True
         cmd.ensure_finalized()
         assert cmd.package_data == dist.package_data
 
@@ -82,7 +84,7 @@ def test_byte_compile(self):
         os.chdir(project_dir)
         self.write_file('boiledeggs.py', 'import antigravity')
         cmd = build_py(dist)
-        cmd.compile = 1
+        cmd.compile = True
         cmd.build_lib = 'here'
         cmd.finalize_options()
         cmd.run()
@@ -98,7 +100,7 @@ def test_byte_compile_optimized(self):
         os.chdir(project_dir)
         self.write_file('boiledeggs.py', 'import antigravity')
         cmd = build_py(dist)
-        cmd.compile = 0
+        cmd.compile = False
         cmd.optimize = 1
         cmd.build_lib = 'here'
         cmd.finalize_options()
@@ -146,7 +148,7 @@ def test_dont_write_bytecode(self, caplog):
         # makes sure byte_compile is not used
         dist = self.create_dist()[1]
         cmd = build_py(dist)
-        cmd.compile = 1
+        cmd.compile = True
         cmd.optimize = 1
 
         old_dont_write_bytecode = sys.dont_write_bytecode
diff --git a/distutils/tests/test_build_scripts.py b/distutils/tests/test_build_scripts.py
index 208b1f6e65..3582f691ef 100644
--- a/distutils/tests/test_build_scripts.py
+++ b/distutils/tests/test_build_scripts.py
@@ -42,7 +42,7 @@ def get_build_scripts_cmd(self, target, scripts):
         dist = Distribution()
         dist.scripts = scripts
         dist.command_obj["build"] = support.DummyCommand(
-            build_scripts=target, force=1, executable=sys.executable
+            build_scripts=target, force=True, executable=sys.executable
         )
         return build_scripts(dist)
 
diff --git a/distutils/tests/test_check.py b/distutils/tests/test_check.py
index 580cb2a267..b672b1f972 100644
--- a/distutils/tests/test_check.py
+++ b/distutils/tests/test_check.py
@@ -62,7 +62,7 @@ def test_check_metadata(self):
             self._run({}, **{'strict': 1})
 
         # and of course, no error when all metadata are present
-        cmd = self._run(metadata, strict=1)
+        cmd = self._run(metadata, strict=True)
         assert cmd._warnings == 0
 
         # now a test with non-ASCII characters
@@ -126,7 +126,7 @@ def test_check_restructuredtext(self):
         cmd.check_restructuredtext()
         assert cmd._warnings == 1
 
-        # let's see if we have an error with strict=1
+        # let's see if we have an error with strict=True
         metadata = {
             'url': 'xxx',
             'author': 'xxx',
@@ -140,12 +140,12 @@ def test_check_restructuredtext(self):
 
         # and non-broken rest, including a non-ASCII character to test #12114
         metadata['long_description'] = 'title\n=====\n\ntest \u00df'
-        cmd = self._run(metadata, strict=1, restructuredtext=1)
+        cmd = self._run(metadata, strict=True, restructuredtext=True)
         assert cmd._warnings == 0
 
         # check that includes work to test #31292
         metadata['long_description'] = 'title\n=====\n\n.. include:: includetest.rst'
-        cmd = self._run(metadata, cwd=HERE, strict=1, restructuredtext=1)
+        cmd = self._run(metadata, cwd=HERE, strict=True, restructuredtext=True)
         assert cmd._warnings == 0
 
     def test_check_restructuredtext_with_syntax_highlight(self):
diff --git a/distutils/tests/test_cmd.py b/distutils/tests/test_cmd.py
index f366aa6522..76e8f5989b 100644
--- a/distutils/tests/test_cmd.py
+++ b/distutils/tests/test_cmd.py
@@ -48,7 +48,7 @@ def test_ensure_string_list(self, cmd):
     def test_make_file(self, cmd):
         # making sure it raises when infiles is not a string or a list/tuple
         with pytest.raises(TypeError):
-            cmd.make_file(infiles=1, outfile='', func='func', args=())
+            cmd.make_file(infiles=True, outfile='', func='func', args=())
 
         # making sure execute gets called properly
         def _execute(func, args, exec_msg, level):
diff --git a/distutils/tests/test_dir_util.py b/distutils/tests/test_dir_util.py
index 84cda619ba..c8064cd014 100644
--- a/distutils/tests/test_dir_util.py
+++ b/distutils/tests/test_dir_util.py
@@ -29,16 +29,16 @@ def stuff(request, monkeypatch, distutils_managed_tempdir):
 
 class TestDirUtil(support.TempdirManager):
     def test_mkpath_remove_tree_verbosity(self, caplog):
-        mkpath(self.target, verbose=0)
+        mkpath(self.target, verbose=False)
         assert not caplog.records
-        remove_tree(self.root_target, verbose=0)
+        remove_tree(self.root_target, verbose=False)
 
-        mkpath(self.target, verbose=1)
+        mkpath(self.target, verbose=True)
         wanted = ['creating %s' % self.root_target, 'creating %s' % self.target]
         assert caplog.messages == wanted
         caplog.clear()
 
-        remove_tree(self.root_target, verbose=1)
+        remove_tree(self.root_target, verbose=True)
         wanted = ["removing '%s' (and everything under it)" % self.root_target]
         assert caplog.messages == wanted
 
@@ -53,45 +53,45 @@ def test_mkpath_with_custom_mode(self):
         assert stat.S_IMODE(os.stat(self.target2).st_mode) == 0o555 & ~umask
 
     def test_create_tree_verbosity(self, caplog):
-        create_tree(self.root_target, ['one', 'two', 'three'], verbose=0)
+        create_tree(self.root_target, ['one', 'two', 'three'], verbose=False)
         assert caplog.messages == []
-        remove_tree(self.root_target, verbose=0)
+        remove_tree(self.root_target, verbose=False)
 
         wanted = ['creating %s' % self.root_target]
-        create_tree(self.root_target, ['one', 'two', 'three'], verbose=1)
+        create_tree(self.root_target, ['one', 'two', 'three'], verbose=True)
         assert caplog.messages == wanted
 
-        remove_tree(self.root_target, verbose=0)
+        remove_tree(self.root_target, verbose=False)
 
     def test_copy_tree_verbosity(self, caplog):
-        mkpath(self.target, verbose=0)
+        mkpath(self.target, verbose=False)
 
-        copy_tree(self.target, self.target2, verbose=0)
+        copy_tree(self.target, self.target2, verbose=False)
         assert caplog.messages == []
 
-        remove_tree(self.root_target, verbose=0)
+        remove_tree(self.root_target, verbose=False)
 
-        mkpath(self.target, verbose=0)
+        mkpath(self.target, verbose=False)
         a_file = path.Path(self.target) / 'ok.txt'
         jaraco.path.build({'ok.txt': 'some content'}, self.target)
 
         wanted = [f'copying {a_file} -> {self.target2}']
-        copy_tree(self.target, self.target2, verbose=1)
+        copy_tree(self.target, self.target2, verbose=True)
         assert caplog.messages == wanted
 
-        remove_tree(self.root_target, verbose=0)
-        remove_tree(self.target2, verbose=0)
+        remove_tree(self.root_target, verbose=False)
+        remove_tree(self.target2, verbose=False)
 
     def test_copy_tree_skips_nfs_temp_files(self):
-        mkpath(self.target, verbose=0)
+        mkpath(self.target, verbose=False)
 
         jaraco.path.build({'ok.txt': 'some content', '.nfs123abc': ''}, self.target)
 
         copy_tree(self.target, self.target2)
         assert os.listdir(self.target2) == ['ok.txt']
 
-        remove_tree(self.root_target, verbose=0)
-        remove_tree(self.target2, verbose=0)
+        remove_tree(self.root_target, verbose=False)
+        remove_tree(self.target2, verbose=False)
 
     def test_ensure_relative(self):
         if os.sep == '/':
diff --git a/distutils/tests/test_dist.py b/distutils/tests/test_dist.py
index 9ed4d16dd8..5bd206fec1 100644
--- a/distutils/tests/test_dist.py
+++ b/distutils/tests/test_dist.py
@@ -468,7 +468,7 @@ def test_show_help(self, request, capsys):
         # smoke test, just makes sure some help is displayed
         dist = Distribution()
         sys.argv = []
-        dist.help = 1
+        dist.help = True
         dist.script_name = 'setup.py'
         dist.parse_command_line()
 
diff --git a/distutils/tests/test_file_util.py b/distutils/tests/test_file_util.py
index 4c2abd2453..420dc348eb 100644
--- a/distutils/tests/test_file_util.py
+++ b/distutils/tests/test_file_util.py
@@ -22,23 +22,23 @@ class TestFileUtil:
     def test_move_file_verbosity(self, caplog):
         jaraco.path.build({self.source: 'some content'})
 
-        move_file(self.source, self.target, verbose=0)
+        move_file(self.source, self.target, verbose=False)
         assert not caplog.messages
 
         # back to original state
-        move_file(self.target, self.source, verbose=0)
+        move_file(self.target, self.source, verbose=False)
 
-        move_file(self.source, self.target, verbose=1)
+        move_file(self.source, self.target, verbose=True)
         wanted = [f'moving {self.source} -> {self.target}']
         assert caplog.messages == wanted
 
         # back to original state
-        move_file(self.target, self.source, verbose=0)
+        move_file(self.target, self.source, verbose=False)
 
         caplog.clear()
         # now the target is a dir
         os.mkdir(self.target_dir)
-        move_file(self.source, self.target_dir, verbose=1)
+        move_file(self.source, self.target_dir, verbose=True)
         wanted = [f'moving {self.source} -> {self.target_dir}']
         assert caplog.messages == wanted
 
@@ -48,7 +48,7 @@ def test_move_file_exception_unpacking_rename(self):
             DistutilsFileError
         ):
             jaraco.path.build({self.source: 'spam eggs'})
-            move_file(self.source, self.target, verbose=0)
+            move_file(self.source, self.target, verbose=False)
 
     def test_move_file_exception_unpacking_unlink(self):
         # see issue 22182
@@ -58,7 +58,7 @@ def test_move_file_exception_unpacking_unlink(self):
             DistutilsFileError
         ):
             jaraco.path.build({self.source: 'spam eggs'})
-            move_file(self.source, self.target, verbose=0)
+            move_file(self.source, self.target, verbose=False)
 
     def test_copy_file_hard_link(self):
         jaraco.path.build({self.source: 'some content'})
diff --git a/distutils/tests/test_install.py b/distutils/tests/test_install.py
index 08f0f83993..8a0c56473e 100644
--- a/distutils/tests/test_install.py
+++ b/distutils/tests/test_install.py
@@ -100,7 +100,7 @@ def _expanduser(path):
         assert 'user' in options
 
         # setting a value
-        cmd.user = 1
+        cmd.user = True
 
         # user base and site shouldn't be created yet
         assert not os.path.exists(site.USER_BASE)
diff --git a/distutils/tests/test_install_data.py b/distutils/tests/test_install_data.py
index e453d01f1a..f34070b10b 100644
--- a/distutils/tests/test_install_data.py
+++ b/distutils/tests/test_install_data.py
@@ -41,7 +41,7 @@ def test_simple_run(self):
         cmd.outfiles = []
 
         # let's try with warn_dir one
-        cmd.warn_dir = 1
+        cmd.warn_dir = True
         cmd.ensure_finalized()
         cmd.run()
 
diff --git a/distutils/tests/test_install_lib.py b/distutils/tests/test_install_lib.py
index 964106fa00..f685a57956 100644
--- a/distutils/tests/test_install_lib.py
+++ b/distutils/tests/test_install_lib.py
@@ -97,7 +97,7 @@ def test_dont_write_bytecode(self, caplog):
         # makes sure byte_compile is not used
         dist = self.create_dist()[1]
         cmd = install_lib(dist)
-        cmd.compile = 1
+        cmd.compile = True
         cmd.optimize = 1
 
         old_dont_write_bytecode = sys.dont_write_bytecode
diff --git a/distutils/tests/test_install_scripts.py b/distutils/tests/test_install_scripts.py
index 5d9f13a426..868b1c2252 100644
--- a/distutils/tests/test_install_scripts.py
+++ b/distutils/tests/test_install_scripts.py
@@ -14,8 +14,8 @@ def test_default_settings(self):
         dist.command_obj["build"] = support.DummyCommand(build_scripts="/foo/bar")
         dist.command_obj["install"] = support.DummyCommand(
             install_scripts="/splat/funk",
-            force=1,
-            skip_build=1,
+            force=True,
+            skip_build=True,
         )
         cmd = install_scripts(dist)
         assert not cmd.force
@@ -40,8 +40,8 @@ def test_installation(self):
         dist.command_obj["build"] = support.DummyCommand(build_scripts=source)
         dist.command_obj["install"] = support.DummyCommand(
             install_scripts=target,
-            force=1,
-            skip_build=1,
+            force=True,
+            skip_build=True,
         )
         cmd = install_scripts(dist)
         cmd.finalize_options()
diff --git a/distutils/tests/test_register.py b/distutils/tests/test_register.py
index d071bbe951..14dfb832c7 100644
--- a/distutils/tests/test_register.py
+++ b/distutils/tests/test_register.py
@@ -137,7 +137,7 @@ def _no_way(prompt=''):
 
         register_module.input = _no_way
 
-        cmd.show_response = 1
+        cmd.show_response = True
         cmd.run()
 
         # let's see what the server received : we should
@@ -208,7 +208,7 @@ def test_strict(self):
         # empty metadata
         cmd = self._get_cmd({})
         cmd.ensure_finalized()
-        cmd.strict = 1
+        cmd.strict = True
         with pytest.raises(DistutilsSetupError):
             cmd.run()
 
@@ -224,7 +224,7 @@ def test_strict(self):
 
         cmd = self._get_cmd(metadata)
         cmd.ensure_finalized()
-        cmd.strict = 1
+        cmd.strict = True
         with pytest.raises(DistutilsSetupError):
             cmd.run()
 
@@ -232,7 +232,7 @@ def test_strict(self):
         metadata['long_description'] = 'title\n=====\n\ntext'
         cmd = self._get_cmd(metadata)
         cmd.ensure_finalized()
-        cmd.strict = 1
+        cmd.strict = True
         inputs = Inputs('1', 'tarek', 'y')
         register_module.input = inputs.__call__
         # let's run the command
@@ -265,7 +265,7 @@ def test_strict(self):
 
         cmd = self._get_cmd(metadata)
         cmd.ensure_finalized()
-        cmd.strict = 1
+        cmd.strict = True
         inputs = Inputs('1', 'tarek', 'y')
         register_module.input = inputs.__call__
         # let's run the command
@@ -296,7 +296,7 @@ def test_register_invalid_long_description(self, monkeypatch):
 
     def test_list_classifiers(self, caplog):
         cmd = self._get_cmd()
-        cmd.list_classifiers = 1
+        cmd.list_classifiers = True
         cmd.run()
         assert caplog.messages == ['running check', 'xxx']
 
@@ -305,7 +305,7 @@ def test_show_response(self, caplog):
         cmd = self._get_cmd()
         inputs = Inputs('1', 'tarek', 'y')
         register_module.input = inputs.__call__
-        cmd.show_response = 1
+        cmd.show_response = True
         try:
             cmd.run()
         finally:
diff --git a/distutils/tests/test_text_file.py b/distutils/tests/test_text_file.py
index c5c910a820..f511156561 100644
--- a/distutils/tests/test_text_file.py
+++ b/distutils/tests/test_text_file.py
@@ -60,7 +60,11 @@ def test_input(count, description, file, expected_result):
         jaraco.path.build({filename.name: TEST_DATA}, tmp_path)
 
         in_file = TextFile(
-            filename, strip_comments=0, skip_blanks=0, lstrip_ws=0, rstrip_ws=0
+            filename,
+            strip_comments=False,
+            skip_blanks=False,
+            lstrip_ws=False,
+            rstrip_ws=False,
         )
         try:
             test_input(1, "no processing", in_file, result1)
@@ -68,7 +72,11 @@ def test_input(count, description, file, expected_result):
             in_file.close()
 
         in_file = TextFile(
-            filename, strip_comments=1, skip_blanks=0, lstrip_ws=0, rstrip_ws=0
+            filename,
+            strip_comments=True,
+            skip_blanks=False,
+            lstrip_ws=False,
+            rstrip_ws=False,
         )
         try:
             test_input(2, "strip comments", in_file, result2)
@@ -76,7 +84,11 @@ def test_input(count, description, file, expected_result):
             in_file.close()
 
         in_file = TextFile(
-            filename, strip_comments=0, skip_blanks=1, lstrip_ws=0, rstrip_ws=0
+            filename,
+            strip_comments=False,
+            skip_blanks=True,
+            lstrip_ws=False,
+            rstrip_ws=False,
         )
         try:
             test_input(3, "strip blanks", in_file, result3)
@@ -90,7 +102,11 @@ def test_input(count, description, file, expected_result):
             in_file.close()
 
         in_file = TextFile(
-            filename, strip_comments=1, skip_blanks=1, join_lines=1, rstrip_ws=1
+            filename,
+            strip_comments=True,
+            skip_blanks=True,
+            join_lines=True,
+            rstrip_ws=True,
         )
         try:
             test_input(5, "join lines without collapsing", in_file, result5)
@@ -99,11 +115,11 @@ def test_input(count, description, file, expected_result):
 
         in_file = TextFile(
             filename,
-            strip_comments=1,
-            skip_blanks=1,
-            join_lines=1,
-            rstrip_ws=1,
-            collapse_join=1,
+            strip_comments=True,
+            skip_blanks=True,
+            join_lines=True,
+            rstrip_ws=True,
+            collapse_join=True,
         )
         try:
             test_input(6, "join lines with collapsing", in_file, result6)
diff --git a/distutils/tests/test_upload.py b/distutils/tests/test_upload.py
index 0692f00160..56df209c73 100644
--- a/distutils/tests/test_upload.py
+++ b/distutils/tests/test_upload.py
@@ -117,7 +117,7 @@ def test_upload(self, caplog):
         # lets run it
         pkg_dir, dist = self.create_dist(dist_files=dist_files)
         cmd = upload(dist)
-        cmd.show_response = 1
+        cmd.show_response = True
         cmd.ensure_finalized()
         cmd.run()
 
@@ -167,7 +167,7 @@ def test_upload_correct_cr(self):
             dist_files=dist_files, description='long description\r'
         )
         cmd = upload(dist)
-        cmd.show_response = 1
+        cmd.show_response = True
         cmd.ensure_finalized()
         cmd.run()
 
diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py
index da97688cbd..df622cd469 100644
--- a/distutils/unixccompiler.py
+++ b/distutils/unixccompiler.py
@@ -190,7 +190,7 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
             raise CompileError(msg)
 
     def create_static_lib(
-        self, objects, output_libname, output_dir=None, debug=0, target_lang=None
+        self, objects, output_libname, output_dir=None, debug=False, target_lang=None
     ):
         objects, output_dir = self._fix_object_args(objects, output_dir)
 
@@ -223,7 +223,7 @@ def link(
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
@@ -362,7 +362,7 @@ def _library_root(dir):
 
         return os.path.join(match.group(1), dir[1:]) if apply_root else dir
 
-    def find_library_file(self, dirs, lib, debug=0):
+    def find_library_file(self, dirs, lib, debug=False):
         r"""
         Second-guess the linker with not much hard
         data to go on: GCC seems to prefer the shared library, so
diff --git a/distutils/util.py b/distutils/util.py
index 2cdea14381..ef332ba94d 100644
--- a/distutils/util.py
+++ b/distutils/util.py
@@ -311,7 +311,7 @@ def split_quoted(s):
 # split_quoted ()
 
 
-def execute(func, args, msg=None, verbose=0, dry_run=0):
+def execute(func, args, msg=None, verbose=False, dry_run=False):
     """Perform some action that affects the outside world (eg.  by
     writing to the filesystem).  Such actions are special because they
     are disabled by the 'dry_run' flag.  This method takes care of all
@@ -349,11 +349,11 @@ def strtobool(val):
 def byte_compile(  # noqa: C901
     py_files,
     optimize=0,
-    force=0,
+    force=False,
     prefix=None,
     base_dir=None,
-    verbose=1,
-    dry_run=0,
+    verbose=True,
+    dry_run=False,
     direct=None,
 ):
     """Byte-compile a collection of Python source files to .pyc
@@ -443,8 +443,8 @@ def byte_compile(  # noqa: C901
                     f"""
 byte_compile(files, optimize={optimize!r}, force={force!r},
              prefix={prefix!r}, base_dir={base_dir!r},
-             verbose={verbose!r}, dry_run=0,
-             direct=1)
+             verbose={verbose!r}, dry_run=False,
+             direct=True)
 """
                 )
 
diff --git a/distutils/zosccompiler.py b/distutils/zosccompiler.py
index c7a7ca61cf..af1e7fa5cc 100644
--- a/distutils/zosccompiler.py
+++ b/distutils/zosccompiler.py
@@ -135,7 +135,7 @@ def _get_zos_compiler_name(self):
 
         return zos_compilers.get(zos_compiler_names[0], 'ibm-openxl')
 
-    def __init__(self, verbose=0, dry_run=0, force=0):
+    def __init__(self, verbose=False, dry_run=False, force=False):
         super().__init__(verbose, dry_run, force)
         self.zos_compiler = self._get_zos_compiler_name()
         sysconfig.customize_compiler(self)
@@ -172,7 +172,7 @@ def link(
         library_dirs=None,
         runtime_library_dirs=None,
         export_symbols=None,
-        debug=0,
+        debug=False,
         extra_preargs=None,
         extra_postargs=None,
         build_temp=None,
diff --git a/docs/distutils/apiref.rst b/docs/distutils/apiref.rst
index beb17bc3fc..709186ad0d 100644
--- a/docs/distutils/apiref.rst
+++ b/docs/distutils/apiref.rst
@@ -361,7 +361,7 @@ This module provides the following functions.
    are not given.
 
 
-.. function:: new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0)
+.. function:: new_compiler(plat=None, compiler=None, verbose=False, dry_run=False, force=False)
 
    Factory function to generate an instance of some CCompiler subclass for the
    supplied platform/compiler combination. *plat* defaults to ``os.name`` (eg.
@@ -383,7 +383,7 @@ This module provides the following functions.
    to :command:`build`, :command:`build_ext`, :command:`build_clib`).
 
 
-.. class:: CCompiler([verbose=0, dry_run=0, force=0])
+.. class:: CCompiler([verbose=False, dry_run=False, force=False])
 
    The abstract base class :class:`CCompiler` defines the interface that  must be
    implemented by real compiler classes.  The class also has  some utility methods
@@ -517,7 +517,7 @@ This module provides the following functions.
       list) to do the job.
 
 
-   .. method:: CCompiler.find_library_file(dirs, lib[, debug=0])
+   .. method:: CCompiler.find_library_file(dirs, lib[, debug=False])
 
       Search the specified list of directories for a static or shared library file
       *lib* and return the full path to that file.  If *debug* is true, look for a
@@ -580,7 +580,7 @@ This module provides the following functions.
    The following methods invoke stages in the build process.
 
 
-   .. method:: CCompiler.compile(sources[, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None])
+   .. method:: CCompiler.compile(sources[, output_dir=None, macros=None, include_dirs=None, debug=False, extra_preargs=None, extra_postargs=None, depends=None])
 
       Compile one or more source files. Generates object files (e.g.  transforms a
       :file:`.c` file to a :file:`.o` file.)
@@ -624,7 +624,7 @@ This module provides the following functions.
       Raises :exc:`CompileError` on failure.
 
 
-   .. method:: CCompiler.create_static_lib(objects, output_libname[, output_dir=None, debug=0, target_lang=None])
+   .. method:: CCompiler.create_static_lib(objects, output_libname[, output_dir=None, debug=False, target_lang=None])
 
       Link a bunch of stuff together to create a static library file. The "bunch of
       stuff" consists of the list of object files supplied as *objects*, the extra
@@ -648,7 +648,7 @@ This module provides the following functions.
       Raises :exc:`LibError` on failure.
 
 
-   .. method:: CCompiler.link(target_desc, objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
+   .. method:: CCompiler.link(target_desc, objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=False, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
 
       Link a bunch of stuff together to create an executable or shared library file.
 
@@ -690,21 +690,21 @@ This module provides the following functions.
       Raises :exc:`LinkError` on failure.
 
 
-   .. method:: CCompiler.link_executable(objects, output_progname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, target_lang=None])
+   .. method:: CCompiler.link_executable(objects, output_progname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=False, extra_preargs=None, extra_postargs=None, target_lang=None])
 
       Link an executable.  *output_progname* is the name of the file executable, while
       *objects* are a list of object filenames to link in. Other arguments  are as for
       the :meth:`link` method.
 
 
-   .. method:: CCompiler.link_shared_lib(objects, output_libname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
+   .. method:: CCompiler.link_shared_lib(objects, output_libname[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=False, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
 
       Link a shared library. *output_libname* is the name of the output  library,
       while *objects* is a list of object filenames to link in.  Other arguments are
       as for the :meth:`link` method.
 
 
-   .. method:: CCompiler.link_shared_object(objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
+   .. method:: CCompiler.link_shared_object(objects, output_filename[, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=False, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None])
 
       Link a shared object. *output_filename* is the name of the shared object that
       will be created, while *objects* is a list of object filenames  to link in.
@@ -726,14 +726,14 @@ This module provides the following functions.
    use by the various concrete subclasses.
 
 
-   .. method:: CCompiler.executable_filename(basename[, strip_dir=0, output_dir=''])
+   .. method:: CCompiler.executable_filename(basename[, strip_dir=False, output_dir=''])
 
       Returns the filename of the executable for the given *basename*.  Typically for
       non-Windows platforms this is the same as the basename,  while Windows will get
       a :file:`.exe` added.
 
 
-   .. method:: CCompiler.library_filename(libname[, lib_type='static', strip_dir=0, output_dir=''])
+   .. method:: CCompiler.library_filename(libname[, lib_type='static', strip_dir=False, output_dir=''])
 
       Returns the filename for the given library name on the current platform. On Unix
       a library with *lib_type* of ``'static'`` will typically  be of the form
@@ -741,13 +741,13 @@ This module provides the following functions.
       :file:`liblibname.so`.
 
 
-   .. method:: CCompiler.object_filenames(source_filenames[, strip_dir=0, output_dir=''])
+   .. method:: CCompiler.object_filenames(source_filenames[, strip_dir=False, output_dir=''])
 
       Returns the name of the object files for the given source files.
       *source_filenames* should be a list of filenames.
 
 
-   .. method:: CCompiler.shared_object_filename(basename[, strip_dir=0, output_dir=''])
+   .. method:: CCompiler.shared_object_filename(basename[, strip_dir=False, output_dir=''])
 
       Returns the name of a shared object file for the given file name *basename*.
 
@@ -884,7 +884,7 @@ This module provides a few functions for creating archive files, such as
 tarballs or zipfiles.
 
 
-.. function:: make_archive(base_name, format[, root_dir=None, base_dir=None, verbose=0, dry_run=0])
+.. function:: make_archive(base_name, format[, root_dir=None, base_dir=None, verbose=False, dry_run=False])
 
    Create an archive file (eg. ``zip`` or ``tar``).  *base_name*  is the name of
    the file to create, minus any format-specific extension;  *format* is the
@@ -900,7 +900,7 @@ tarballs or zipfiles.
       Added support for the ``xztar`` format.
 
 
-.. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=0, dry_run=0])
+.. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=False, dry_run=False])
 
    'Create an (optional compressed) archive as a tar file from all files in and
    under *base_dir*. *compress* must be ``'gzip'`` (the default),
@@ -915,7 +915,7 @@ tarballs or zipfiles.
       Added support for the ``xz`` compression.
 
 
-.. function:: make_zipfile(base_name, base_dir[, verbose=0, dry_run=0])
+.. function:: make_zipfile(base_name, base_dir[, verbose=False, dry_run=False])
 
    Create a zip file from all files in and under *base_dir*.  The output zip file
    will be named *base_name* + :file:`.zip`.  Uses either the  :mod:`zipfile` Python
@@ -978,7 +978,7 @@ This module provides functions for operating on directories and trees of
 directories.
 
 
-.. function:: mkpath(name[, mode=0o777, verbose=0, dry_run=0])
+.. function:: mkpath(name[, mode=0o777, verbose=False, dry_run=False])
 
    Create a directory and any missing ancestor directories.  If the directory
    already exists (or if *name* is the empty string, which means the current
@@ -989,7 +989,7 @@ directories.
    directories actually created.
 
 
-.. function:: create_tree(base_dir, files[, mode=0o777, verbose=0, dry_run=0])
+.. function:: create_tree(base_dir, files[, mode=0o777, verbose=False, dry_run=False])
 
    Create all the empty directories under *base_dir* needed to put *files* there.
    *base_dir* is just the name of a directory which doesn't necessarily exist
@@ -999,7 +999,7 @@ directories.
    :func:`mkpath`.
 
 
-.. function:: copy_tree(src, dst[, preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0])
+.. function:: copy_tree(src, dst[, preserve_mode=True, preserve_times=True, preserve_symlinks=False, update=False, verbose=False, dry_run=False])
 
    Copy an entire directory tree *src* to a new location *dst*.  Both *src* and
    *dst* must be directory names.  If *src* is not a directory, raise
@@ -1026,7 +1026,7 @@ directories.
    .. versionchanged:: 3.3.1
       NFS files are ignored.
 
-.. function:: remove_tree(directory[, verbose=0, dry_run=0])
+.. function:: remove_tree(directory[, verbose=False, dry_run=False])
 
    Recursively remove *directory* and all files and directories underneath it. Any
    errors are ignored (apart from being reported to ``sys.stdout`` if *verbose* is
@@ -1043,7 +1043,7 @@ directories.
 This module contains some utility functions for operating on individual files.
 
 
-.. function:: copy_file(src, dst[, preserve_mode=1, preserve_times=1, update=0, link=None, verbose=0, dry_run=0])
+.. function:: copy_file(src, dst[, preserve_mode=True, preserve_times=True, update=False, link=None, verbose=False, dry_run=False])
 
    Copy file *src* to *dst*. If *dst* is a directory, then *src* is copied there
    with the same name; otherwise, it must be a filename. (If the file exists, it
@@ -1216,7 +1216,7 @@ other utility module.
    .. % Should probably be moved into the standard library.
 
 
-.. function:: execute(func, args[, msg=None, verbose=0, dry_run=0])
+.. function:: execute(func, args[, msg=None, verbose=False, dry_run=False])
 
    Perform some action that affects the outside world (for instance, writing to the
    filesystem).  Such actions are special because they are disabled by the
@@ -1234,7 +1234,7 @@ other utility module.
    :exc:`ValueError` if *val*  is anything else.
 
 
-.. function:: byte_compile(py_files[, optimize=0, force=0, prefix=None, base_dir=None, verbose=1, dry_run=0, direct=None])
+.. function:: byte_compile(py_files[, optimize=0, force=False, prefix=None, base_dir=None, verbose=True, dry_run=False, direct=None])
 
    Byte-compile a collection of Python source files to :file:`.pyc` files in a
    :file:`__pycache__` subdirectory (see :pep:`3147` and :pep:`488`).
diff --git a/docs/distutils/configfile.rst b/docs/distutils/configfile.rst
index 30cccd71c0..f6cb184089 100644
--- a/docs/distutils/configfile.rst
+++ b/docs/distutils/configfile.rst
@@ -96,7 +96,7 @@ configuration file for this distribution:
 .. code-block:: ini
 
    [build_ext]
-   inplace=1
+   inplace=true
 
 This will affect all builds of this module distribution, whether or not you
 explicitly specify :command:`build_ext`.  If you include :file:`setup.cfg` in
diff --git a/docs/distutils/setupscript.rst b/docs/distutils/setupscript.rst
index 71d2439f7e..825a6aa9a3 100644
--- a/docs/distutils/setupscript.rst
+++ b/docs/distutils/setupscript.rst
@@ -273,7 +273,7 @@ search path, though, you can find that directory using the Distutils
 :mod:`distutils.sysconfig` module::
 
     from distutils.sysconfig import get_python_inc
-    incdir = os.path.join(get_python_inc(plat_specific=1), 'Numerical')
+    incdir = os.path.join(get_python_inc(plat_specific=True), 'Numerical')
     setup(...,
           Extension(..., include_dirs=[incdir]),
           )

From affcf39ac09a482ae1aaa36142394002c4bb7bf0 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 19:03:41 +0200
Subject: [PATCH 083/151] Apply ruff/flake8-implicit-str-concat rule ISC001

ISC001 Implicitly concatenated string literals on one line
---
 distutils/command/bdist_rpm.py | 2 +-
 distutils/command/register.py  | 2 +-
 distutils/fancy_getopt.py      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/distutils/command/bdist_rpm.py b/distutils/command/bdist_rpm.py
index 649968a5eb..df96507e5c 100644
--- a/distutils/command/bdist_rpm.py
+++ b/distutils/command/bdist_rpm.py
@@ -529,7 +529,7 @@ def _make_spec_file(self):  # noqa: C901
         # are just text that we drop in as-is.  Hmmm.
 
         install_cmd = (
-            '%s install -O1 --root=$RPM_BUILD_ROOT ' '--record=INSTALLED_FILES'
+            '%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES'
         ) % def_setup_call
 
         script_options = [
diff --git a/distutils/command/register.py b/distutils/command/register.py
index ee6c54daba..1ae0e25eb3 100644
--- a/distutils/command/register.py
+++ b/distutils/command/register.py
@@ -225,7 +225,7 @@ def send_metadata(self):  # noqa: C901
                 log.info('Server response (%s): %s', code, result)
             else:
                 log.info('You will receive an email shortly.')
-                log.info('Follow the instructions in it to ' 'complete registration.')
+                log.info('Follow the instructions in it to complete registration.')
         elif choice == '3':
             data = {':action': 'password_reset'}
             data['email'] = ''
diff --git a/distutils/fancy_getopt.py b/distutils/fancy_getopt.py
index e905aede4d..94a63217c5 100644
--- a/distutils/fancy_getopt.py
+++ b/distutils/fancy_getopt.py
@@ -118,11 +118,11 @@ def _check_alias_dict(self, aliases, what):
         for alias, opt in aliases.items():
             if alias not in self.option_index:
                 raise DistutilsGetoptError(
-                    f"invalid {what} '{alias}': " f"option '{alias}' not defined"
+                    f"invalid {what} '{alias}': option '{alias}' not defined"
                 )
             if opt not in self.option_index:
                 raise DistutilsGetoptError(
-                    f"invalid {what} '{alias}': " f"aliased option '{opt}' not defined"
+                    f"invalid {what} '{alias}': aliased option '{opt}' not defined"
                 )
 
     def set_aliases(self, alias):

From 7d12ab75b18e6830b3f483696dd5c91ee047e9b8 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 19:06:09 +0200
Subject: [PATCH 084/151] Apply ruff/flake8-implicit-str-concat rule ISC003

ISC003 Explicitly concatenated string should be implicitly concatenated
---
 distutils/command/bdist_dumb.py | 3 +--
 distutils/command/build.py      | 3 +--
 distutils/command/build_ext.py  | 2 +-
 distutils/command/install.py    | 9 +++------
 distutils/dist.py               | 3 +--
 5 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/distutils/command/bdist_dumb.py b/distutils/command/bdist_dumb.py
index 06502d201e..5966e17ef1 100644
--- a/distutils/command/bdist_dumb.py
+++ b/distutils/command/bdist_dumb.py
@@ -33,8 +33,7 @@ class bdist_dumb(Command):
         (
             'keep-temp',
             'k',
-            "keep the pseudo-installation tree around after "
-            + "creating the distribution archive",
+            "keep the pseudo-installation tree around after creating the distribution archive",
         ),
         ('dist-dir=', 'd', "directory to put final built distributions in"),
         ('skip-build', None, "skip rebuilding everything (for testing/debugging)"),
diff --git a/distutils/command/build.py b/distutils/command/build.py
index d18ed503e3..3d896d4d34 100644
--- a/distutils/command/build.py
+++ b/distutils/command/build.py
@@ -26,8 +26,7 @@ class build(Command):
         (
             'build-lib=',
             None,
-            "build directory for all distribution (defaults to either "
-            + "build-purelib or build-platlib",
+            "build directory for all distribution (defaults to either build-purelib or build-platlib",
         ),
         ('build-scripts=', None, "build directory for scripts"),
         ('build-temp=', 't', "temporary build directory"),
diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py
index 06d949aff1..b80cfdf735 100644
--- a/distutils/command/build_ext.py
+++ b/distutils/command/build_ext.py
@@ -71,7 +71,7 @@ class build_ext(Command):
             'inplace',
             'i',
             "ignore build-lib and put compiled extensions into the source "
-            + "directory alongside your pure Python modules",
+            "directory alongside your pure Python modules",
         ),
         (
             'include-dirs=',
diff --git a/distutils/command/install.py b/distutils/command/install.py
index 8e920be4de..e73d388d78 100644
--- a/distutils/command/install.py
+++ b/distutils/command/install.py
@@ -193,8 +193,7 @@ class install(Command):
         (
             'install-platbase=',
             None,
-            "base installation directory for platform-specific files "
-            + "(instead of --exec-prefix or --home)",
+            "base installation directory for platform-specific files (instead of --exec-prefix or --home)",
         ),
         ('root=', None, "install everything relative to this alternate root directory"),
         # Or, explicitly set the installation scheme
@@ -211,8 +210,7 @@ class install(Command):
         (
             'install-lib=',
             None,
-            "installation directory for all module distributions "
-            + "(overrides --install-purelib and --install-platlib)",
+            "installation directory for all module distributions (overrides --install-purelib and --install-platlib)",
         ),
         ('install-headers=', None, "installation directory for C/C++ headers"),
         ('install-scripts=', None, "installation directory for Python scripts"),
@@ -348,8 +346,7 @@ def finalize_options(self):  # noqa: C901
             self.install_base or self.install_platbase
         ):
             raise DistutilsOptionError(
-                "must supply either prefix/exec-prefix/home or "
-                + "install-base/install-platbase -- not both"
+                "must supply either prefix/exec-prefix/home or install-base/install-platbase -- not both"
             )
 
         if self.home and (self.prefix or self.exec_prefix):
diff --git a/distutils/dist.py b/distutils/dist.py
index 668ce7eb0a..1fd20d8c64 100644
--- a/distutils/dist.py
+++ b/distutils/dist.py
@@ -652,8 +652,7 @@ def _show_help(
         if display_options:
             parser.set_option_table(self.display_options)
             parser.print_help(
-                "Information display options (just display "
-                + "information, ignore any commands)"
+                "Information display options (just display information, ignore any commands)"
             )
             print()
 

From 5a590b8566cdfd3998c3d66aea5beefed340d774 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 18 May 2024 19:06:54 +0200
Subject: [PATCH 085/151] Enable ruff/flake8-implicit-str-concat rules (ISC)

---
 ruff.toml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ruff.toml b/ruff.toml
index 70612985a7..e70a65b941 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -1,6 +1,7 @@
 [lint]
 extend-select = [
 	"C901",
+	"ISC",
 	"W",
 ]
 ignore = [

From 4208e32486161f55e7391c2e0c4d9a6a7a22b809 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 27 Jun 2024 05:55:07 -0400
Subject: [PATCH 086/151] Combine strings for clarity.

---
 distutils/ccompiler.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py
index ca71e18a44..4585512fe3 100644
--- a/distutils/ccompiler.py
+++ b/distutils/ccompiler.py
@@ -203,8 +203,7 @@ def _check_macro_definitions(self, definitions):
             ):
                 raise TypeError(
                     f"invalid macro definition '{defn}': "
-                    "must be tuple (string,), (string, string), or "
-                    "(string, None)"
+                    "must be tuple (string,), (string, string), or (string, None)"
                 )
 
     # -- Bookkeeping methods -------------------------------------------

From 1c196feba725b15f7a14d2de6cdc3ab7070a1f57 Mon Sep 17 00:00:00 2001
From: Christoph Reiter 
Date: Fri, 28 Jun 2024 06:46:33 +0200
Subject: [PATCH 087/151] CI: run pytest without arguments to avoid stdlib
 distutils being imported

distutils currently doesn't support pytest collection that doesn't
start at least at the distutils dir or above (and not distutils/tests)
since it requires the local distutils being imported before the tests are run,
otherwise the stdlib distutils takes precedence.

Adjust the pytest call to not pass a path to work around this.

Since pytest currently fails to skip collecting venvs with mingw python
(see https://github.com/pytest-dev/pytest/issues/12544) move the venv
to /tmp instead.
---
 .github/workflows/main.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d4c7a392e6..9e4bf5bb40 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -146,8 +146,8 @@ jobs:
         run: |
           export VIRTUALENV_NO_SETUPTOOLS=1
 
-          python -m virtualenv venv
-          source venv/bin/activate
+          python -m virtualenv /tmp/venv
+          source /tmp/venv/bin/activate
 
           # python-ruff doesn't work without rust
           sed -i '/pytest-ruff/d' pyproject.toml
@@ -156,8 +156,8 @@ jobs:
       - name: Run tests
         shell: msys2 {0}
         run: |
-          source venv/bin/activate
-          pytest distutils/tests
+          source /tmp/venv/bin/activate
+          pytest
 
   ci_setuptools:
     # Integration testing with setuptools

From 23174730a61af359f1c45da42d5f2f66df0c6086 Mon Sep 17 00:00:00 2001
From: Christoph Reiter 
Date: Fri, 28 Jun 2024 07:22:15 +0200
Subject: [PATCH 088/151] CI: explicitely CC/CXX for clang only mingw
 environments

MSYS2 has stopped installing gcc compatibility binaries in clang environments
by default some time ago, and distutils is currently hardcoded to look for "gcc",
while only cc/c++ and clang/clang++ are in PATH.

Work around for now by explicitely setting CC/CXX to override the defaults.

Idealy distutils would try to look harder for a valid compiler before giving up,
but this can be improved in the future.
---
 .github/workflows/main.yml | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9e4bf5bb40..b6b757dbf5 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -124,10 +124,10 @@ jobs:
     strategy:
       matrix:
         include:
-          - { sys: mingw64, env: x86_64 }
-          - { sys: mingw32, env: i686 }
-          - { sys: ucrt64,  env: ucrt-x86_64 }
-          - { sys: clang64, env: clang-x86_64 }
+          - { sys: mingw64, env: x86_64, cc: gcc, cxx: g++ }
+          - { sys: mingw32, env: i686, cc: gcc, cxx: g++ }
+          - { sys: ucrt64,  env: ucrt-x86_64, cc: gcc, cxx: g++ }
+          - { sys: clang64, env: clang-x86_64, cc: clang, cxx: clang++}
     runs-on: windows-latest
     steps:
       - uses: actions/checkout@v4
@@ -155,6 +155,9 @@ jobs:
           pip install -e .[test]
       - name: Run tests
         shell: msys2 {0}
+        env:
+          CC: ${{ matrix.cc }}
+          CXX: ${{ matrix.cxx }}
         run: |
           source /tmp/venv/bin/activate
           pytest

From 2c86616a044f17621723e4875d76fdbe44070191 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 27 Jun 2024 06:01:43 -0400
Subject: [PATCH 089/151] Extract method for checking macro definition.

---
 distutils/ccompiler.py | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py
index b860acb779..9974e520cc 100644
--- a/distutils/ccompiler.py
+++ b/distutils/ccompiler.py
@@ -188,23 +188,26 @@ def _find_macro(self, name):
         return None
 
     def _check_macro_definitions(self, definitions):
-        """Ensures that every element of 'definitions' is a valid macro
-        definition, ie. either (name,value) 2-tuple or a (name,) tuple.  Do
-        nothing if all definitions are OK, raise TypeError otherwise.
-        """
+        """Ensure that every element of 'definitions' is valid."""
         for defn in definitions:
-            if not (
-                isinstance(defn, tuple)
-                and (
-                    len(defn) in (1, 2)
-                    and (isinstance(defn[1], str) or defn[1] is None)
-                )
-                and isinstance(defn[0], str)
-            ):
-                raise TypeError(
-                    f"invalid macro definition '{defn}': "
-                    "must be tuple (string,), (string, string), or (string, None)"
-                )
+            self._check_macro_definition(defn)
+
+    def _check_macro_definition(self, defn):
+        """
+        Raise a TypeError if defn is not valid.
+
+        A valid definition is either a (name, value) 2-tuple or a (name,) tuple.
+        """
+        valid = (
+            isinstance(defn, tuple)
+            and (len(defn) in (1, 2) and (isinstance(defn[1], str) or defn[1] is None))
+            and isinstance(defn[0], str)
+        )
+        if not valid:
+            raise TypeError(
+                f"invalid macro definition '{defn}': "
+                "must be tuple (string,), (string, string), or (string, None)"
+            )
 
     # -- Bookkeeping methods -------------------------------------------
 

From 62135e668e07facf8ebff3f6cf1456f3b8c59e4d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Thu, 27 Jun 2024 06:14:54 -0400
Subject: [PATCH 090/151] Extract method for _is_valid_macro.

---
 distutils/ccompiler.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py
index 9974e520cc..87ca89e197 100644
--- a/distutils/ccompiler.py
+++ b/distutils/ccompiler.py
@@ -6,6 +6,7 @@
 import os
 import re
 import sys
+import types
 import warnings
 
 from ._itertools import always_iterable
@@ -190,7 +191,7 @@ def _find_macro(self, name):
     def _check_macro_definitions(self, definitions):
         """Ensure that every element of 'definitions' is valid."""
         for defn in definitions:
-            self._check_macro_definition(defn)
+            self._check_macro_definition(*defn)
 
     def _check_macro_definition(self, defn):
         """
@@ -198,17 +199,19 @@ def _check_macro_definition(self, defn):
 
         A valid definition is either a (name, value) 2-tuple or a (name,) tuple.
         """
-        valid = (
-            isinstance(defn, tuple)
-            and (len(defn) in (1, 2) and (isinstance(defn[1], str) or defn[1] is None))
-            and isinstance(defn[0], str)
-        )
-        if not valid:
+        if not isinstance(defn, tuple) or not self._is_valid_macro(*defn):
             raise TypeError(
                 f"invalid macro definition '{defn}': "
                 "must be tuple (string,), (string, string), or (string, None)"
             )
 
+    @staticmethod
+    def _is_valid_macro(name, value=None):
+        """
+        A valid macro is a ``name : str`` and a ``value : str | None``.
+        """
+        return isinstance(name, str) and isinstance(value, (str, types.NoneType))
+
     # -- Bookkeeping methods -------------------------------------------
 
     def define_macro(self, name, value=None):

From dc7bfe4c47f5debdfff68c87f0e8b897713eda0a Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Thu, 27 Jun 2024 21:12:19 +0200
Subject: [PATCH 091/151] Use brackets for the default value of option
 arguments

The goal is to standardize the format of the help text printed
by commands. It is not easy to choose between brackets `[]` and
parentheses `()`. I went for the docopt style, which is the
closest to a standard I could find:

	http://docopt.org/

	[...] and whether that argument has a default value ([default: 10]).
---
 distutils/command/bdist.py        | 2 +-
 distutils/command/bdist_dumb.py   | 4 ++--
 distutils/command/bdist_rpm.py    | 2 +-
 distutils/command/build.py        | 2 +-
 distutils/command/build_ext.py    | 2 +-
 distutils/command/clean.py        | 8 ++++----
 distutils/command/install_data.py | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/distutils/command/bdist.py b/distutils/command/bdist.py
index 833f7616ce..1738f4e56b 100644
--- a/distutils/command/bdist.py
+++ b/distutils/command/bdist.py
@@ -41,7 +41,7 @@ class bdist(Command):
             'plat-name=',
             'p',
             "platform name to embed in generated filenames "
-            f"(default: {get_platform()})",
+            f"[default: {get_platform()}]",
         ),
         ('formats=', None, "formats for distribution (comma-separated list)"),
         (
diff --git a/distutils/command/bdist_dumb.py b/distutils/command/bdist_dumb.py
index bf9b6ad6ef..67b0c8cce9 100644
--- a/distutils/command/bdist_dumb.py
+++ b/distutils/command/bdist_dumb.py
@@ -23,7 +23,7 @@ class bdist_dumb(Command):
             'plat-name=',
             'p',
             "platform name to embed in generated filenames "
-            f"(default: {get_platform()})",
+            f"[default: {get_platform()}]",
         ),
         (
             'format=',
@@ -40,7 +40,7 @@ class bdist_dumb(Command):
         (
             'relative',
             None,
-            "build the archive using relative paths (default: false)",
+            "build the archive using relative paths [default: false]",
         ),
         (
             'owner=',
diff --git a/distutils/command/bdist_rpm.py b/distutils/command/bdist_rpm.py
index cb98cd50ce..d443eb09b5 100644
--- a/distutils/command/bdist_rpm.py
+++ b/distutils/command/bdist_rpm.py
@@ -40,7 +40,7 @@ class bdist_rpm(Command):
             'python=',
             None,
             "path to Python interpreter to hard-code in the .spec file "
-            "(default: \"python\")",
+            "[default: \"python\"]",
         ),
         (
             'fix-python',
diff --git a/distutils/command/build.py b/distutils/command/build.py
index 84dc43c9fa..caf55073af 100644
--- a/distutils/command/build.py
+++ b/distutils/command/build.py
@@ -34,7 +34,7 @@ class build(Command):
         (
             'plat-name=',
             'p',
-            f"platform name to build for, if supported (default: {get_platform()})",
+            f"platform name to build for, if supported [default: {get_platform()}]",
         ),
         ('compiler=', 'c', "specify the compiler type"),
         ('parallel=', 'j', "number of parallel build jobs"),
diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py
index f1ebc040ea..a1d1753dc5 100644
--- a/distutils/command/build_ext.py
+++ b/distutils/command/build_ext.py
@@ -65,7 +65,7 @@ class build_ext(Command):
             'plat-name=',
             'p',
             "platform name to cross-compile for, if supported "
-            f"(default: {get_platform()})",
+            f"[default: {get_platform()}]",
         ),
         (
             'inplace',
diff --git a/distutils/command/clean.py b/distutils/command/clean.py
index 4167a83fb3..fb54a60ed4 100644
--- a/distutils/command/clean.py
+++ b/distutils/command/clean.py
@@ -14,17 +14,17 @@
 class clean(Command):
     description = "clean up temporary files from 'build' command"
     user_options = [
-        ('build-base=', 'b', "base build directory (default: 'build.build-base')"),
+        ('build-base=', 'b', "base build directory [default: 'build.build-base']"),
         (
             'build-lib=',
             None,
-            "build directory for all modules (default: 'build.build-lib')",
+            "build directory for all modules [default: 'build.build-lib']",
         ),
-        ('build-temp=', 't', "temporary build directory (default: 'build.build-temp')"),
+        ('build-temp=', 't', "temporary build directory [default: 'build.build-temp']"),
         (
             'build-scripts=',
             None,
-            "build directory for scripts (default: 'build.build-scripts')",
+            "build directory for scripts [default: 'build.build-scripts']",
         ),
         ('bdist-base=', None, "temporary directory for built distributions"),
         ('all', 'a', "remove all build output, not just temporary by-products"),
diff --git a/distutils/command/install_data.py b/distutils/command/install_data.py
index a4da892480..624c0b901b 100644
--- a/distutils/command/install_data.py
+++ b/distutils/command/install_data.py
@@ -19,7 +19,7 @@ class install_data(Command):
             'install-dir=',
             'd',
             "base directory for installing data files "
-            "(default: installation base dir)",
+            "[default: installation base dir]",
         ),
         ('root=', None, "install everything relative to this alternate root directory"),
         ('force', 'f', "force installation (overwrite existing files)"),

From afc54f822b52df1499d3379c2d05f96bd86433a8 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 28 Jun 2024 11:55:50 -0400
Subject: [PATCH 092/151] Remove unnecessary override to the same value.

Co-authored-by: DWesl <22566757+DWesl@users.noreply.github.com>
---
 distutils/unixccompiler.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py
index e547d4893c..7e68596b26 100644
--- a/distutils/unixccompiler.py
+++ b/distutils/unixccompiler.py
@@ -146,7 +146,6 @@ class UnixCCompiler(CCompiler):
         exe_extension = ".exe"
         shared_lib_extension = ".dll.a"
         dylib_lib_extension = ".dll"
-        static_lib_format = shared_lib_format = "lib%s%s"
         dylib_lib_format = "cyg%s%s"
 
     def preprocess(

From 131fae7f7fa7cd3107ccc20f6c1fb6fbe1ab569a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 28 Jun 2024 11:38:01 -0400
Subject: [PATCH 093/151] Suppress EncodingWarnings in docutils.

---
 pytest.ini | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pytest.ini b/pytest.ini
index b53e0d93a1..dd57c6ef4e 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -40,3 +40,7 @@ filterwarnings=
 
 	# suppress known deprecation
 	ignore:Use shutil.which instead of find_executable:DeprecationWarning
+
+	# https://sourceforge.net/p/docutils/bugs/490/
+	ignore:'encoding' argument not specified::docutils.io
+	ignore:UTF-8 Mode affects locale.getpreferredencoding()::docutils.io

From 1dde9bcbf35c97f3463cb1fe54c288df4d71b468 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 21:09:44 +0200
Subject: [PATCH 094/151] Apply ruff rule RUF100

RUF100 Unused blanket `noqa` directive
---
 docs/conf.py                              |  6 +++---
 setuptools/_importlib.py                  |  2 +-
 setuptools/command/easy_install.py        | 16 ++++++++--------
 setuptools/config/_apply_pyprojecttoml.py |  4 ++--
 setuptools/config/expand.py               |  2 +-
 setuptools/config/pyprojecttoml.py        |  2 +-
 setuptools/config/setupcfg.py             |  4 ++--
 setuptools/discovery.py                   |  2 +-
 setuptools/msvc.py                        |  2 +-
 setuptools/tests/test_warnings.py         |  8 ++++----
 10 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 534da15a37..a0e3398d54 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -124,9 +124,9 @@
 github_repo_url = f'{github_url}/{github_repo_slug}'
 github_sponsors_url = f'{github_url}/sponsors'
 extlinks = {
-    'user': (f'{github_sponsors_url}/%s', '@%s'),  # noqa: WPS323
-    'pypi': ('https://pypi.org/project/%s', '%s'),  # noqa: WPS323
-    'wiki': ('https://wikipedia.org/wiki/%s', '%s'),  # noqa: WPS323
+    'user': (f'{github_sponsors_url}/%s', '@%s'),
+    'pypi': ('https://pypi.org/project/%s', '%s'),
+    'wiki': ('https://wikipedia.org/wiki/%s', '%s'),
 }
 extensions += ['sphinx.ext.extlinks']
 
diff --git a/setuptools/_importlib.py b/setuptools/_importlib.py
index bd2b01e2b5..8e52888d6f 100644
--- a/setuptools/_importlib.py
+++ b/setuptools/_importlib.py
@@ -42,7 +42,7 @@ def disable_importlib_metadata_finder(metadata):
 
     disable_importlib_metadata_finder(metadata)
 else:
-    import importlib.metadata as metadata  # noqa: F401
+    import importlib.metadata as metadata
 
 
 if sys.version_info < (3, 9):
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 5ec5080131..c2bb8bd199 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -467,7 +467,7 @@ def pseudo_tempname(self):
     def warn_deprecated_options(self):
         pass
 
-    def check_site_dir(self):  # noqa: C901  # is too complex (12)  # FIXME
+    def check_site_dir(self):  # is too complex (12)  # FIXME
         """Verify that self.install_dir is .pth-capable dir, if needed"""
 
         instdir = normalize_path(self.install_dir)
@@ -526,7 +526,7 @@ def check_site_dir(self):  # noqa: C901  # is too complex (12)  # FIXME
 
             %s
         """
-    ).lstrip()  # noqa
+    ).lstrip()
 
     __not_exists_id = textwrap.dedent(
         """
@@ -534,7 +534,7 @@ def check_site_dir(self):  # noqa: C901  # is too complex (12)  # FIXME
         choose a different installation directory (using the -d or --install-dir
         option).
         """
-    ).lstrip()  # noqa
+    ).lstrip()
 
     __access_msg = textwrap.dedent(
         """
@@ -552,7 +552,7 @@ def check_site_dir(self):  # noqa: C901  # is too complex (12)  # FIXME
 
         Please make the appropriate changes for your system and try again.
         """
-    ).lstrip()  # noqa
+    ).lstrip()
 
     def cant_write_to_target(self):
         msg = self.__cant_write_msg % (
@@ -939,7 +939,7 @@ def egg_distribution(self, egg_path):
         return Distribution.from_filename(egg_path, metadata=metadata)
 
     # FIXME: 'easy_install.install_egg' is too complex (11)
-    def install_egg(self, egg_path, tmpdir):  # noqa: C901
+    def install_egg(self, egg_path, tmpdir):
         destination = os.path.join(
             self.install_dir,
             os.path.basename(egg_path),
@@ -1131,7 +1131,7 @@ def install_wheel(self, wheel_path, tmpdir):
             pkg_resources.require("%(name)s==%(version)s")  # this exact version
             pkg_resources.require("%(name)s>=%(version)s")  # this version or higher
         """
-    ).lstrip()  # noqa
+    ).lstrip()
 
     __id_warning = textwrap.dedent(
         """
@@ -1139,7 +1139,7 @@ def install_wheel(self, wheel_path, tmpdir):
         this to work.  (e.g. by being the application's script directory, by being on
         PYTHONPATH, or by being added to sys.path by your code.)
         """
-    )  # noqa
+    )
 
     def installation_report(self, req, dist, what="Installed"):
         """Helpful installation message for display to package users"""
@@ -1166,7 +1166,7 @@ def installation_report(self, req, dist, what="Installed"):
 
         See the setuptools documentation for the "develop" command for more info.
         """
-    ).lstrip()  # noqa
+    ).lstrip()
 
     def report_editable(self, spec, setup_script):
         dirname = os.path.dirname(setup_script)
diff --git a/setuptools/config/_apply_pyprojecttoml.py b/setuptools/config/_apply_pyprojecttoml.py
index 5a8700051e..f44271c5dd 100644
--- a/setuptools/config/_apply_pyprojecttoml.py
+++ b/setuptools/config/_apply_pyprojecttoml.py
@@ -31,8 +31,8 @@
 
 if TYPE_CHECKING:
     from distutils.dist import _OptionsList
-    from setuptools._importlib import metadata  # noqa
-    from setuptools.dist import Distribution  # noqa
+    from setuptools._importlib import metadata
+    from setuptools.dist import Distribution
 
 EMPTY: Mapping = MappingProxyType({})  # Immutable dict-like
 _ProjectReadmeValue = Union[str, Dict[str, str]]
diff --git a/setuptools/config/expand.py b/setuptools/config/expand.py
index 6ea6cf6d0e..e5f5dc586e 100644
--- a/setuptools/config/expand.py
+++ b/setuptools/config/expand.py
@@ -47,7 +47,7 @@
 from ..warnings import SetuptoolsWarning
 
 if TYPE_CHECKING:
-    from setuptools.dist import Distribution  # noqa
+    from setuptools.dist import Distribution
 
 _K = TypeVar("_K")
 _V = TypeVar("_V", covariant=True)
diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py
index c8dae5f751..d41c956cbd 100644
--- a/setuptools/config/pyprojecttoml.py
+++ b/setuptools/config/pyprojecttoml.py
@@ -25,7 +25,7 @@
 from ._apply_pyprojecttoml import apply as _apply
 
 if TYPE_CHECKING:
-    from setuptools.dist import Distribution  # noqa
+    from setuptools.dist import Distribution
     from typing_extensions import Self
 
 _logger = logging.getLogger(__name__)
diff --git a/setuptools/config/setupcfg.py b/setuptools/config/setupcfg.py
index 0a7a42eb09..80ebe3d9bd 100644
--- a/setuptools/config/setupcfg.py
+++ b/setuptools/config/setupcfg.py
@@ -39,9 +39,9 @@
 from . import expand
 
 if TYPE_CHECKING:
-    from distutils.dist import DistributionMetadata  # noqa
+    from distutils.dist import DistributionMetadata
 
-    from setuptools.dist import Distribution  # noqa
+    from setuptools.dist import Distribution
 
 SingleCommandOptions = Dict["str", Tuple["str", Any]]
 """Dict that associate the name of the options of a particular command to a
diff --git a/setuptools/discovery.py b/setuptools/discovery.py
index 880d414033..3179852c69 100644
--- a/setuptools/discovery.py
+++ b/setuptools/discovery.py
@@ -62,7 +62,7 @@
 chain_iter = itertools.chain.from_iterable
 
 if TYPE_CHECKING:
-    from setuptools import Distribution  # noqa
+    from setuptools import Distribution
 
 
 def _valid_name(path: StrPath) -> bool:
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index f86c480d18..1e3df05ee6 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -842,7 +842,7 @@ def WindowsSdkLastVersion(self):
         """
         return self._use_last_dir_name(join(self.WindowsSdkDir, 'lib'))
 
-    @property  # noqa: C901
+    @property
     def WindowsSdkDir(self):  # noqa: C901  # is too complex (12)  # FIXME
         """
         Microsoft Windows SDK directory.
diff --git a/setuptools/tests/test_warnings.py b/setuptools/tests/test_warnings.py
index b5da66b9d6..ac6d07795e 100644
--- a/setuptools/tests/test_warnings.py
+++ b/setuptools/tests/test_warnings.py
@@ -18,7 +18,7 @@
             ********************************************************************************
 
     !!
-    """,  # noqa,
+    """,
     ),
     "futue_due_date": dict(
         args=("Summary", "Lorem ipsum"),
@@ -35,7 +35,7 @@
             ********************************************************************************
 
     !!
-    """,  # noqa
+    """,
     ),
     "past_due_date_with_docs": dict(
         args=("Summary", "Lorem ipsum"),
@@ -54,7 +54,7 @@
             ********************************************************************************
 
     !!
-    """,  # noqa
+    """,
     ),
 }
 
@@ -99,7 +99,7 @@ class _MyDeprecation(SetuptoolsDeprecationWarning):
             ********************************************************************************
 
     !!
-    """  # noqa
+    """
     assert str(exc_info.value) == cleandoc(expected)
 
 

From 42fd45872aa4d52f4b15e5f922bb2302be0e0b63 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 21:29:16 +0200
Subject: [PATCH 095/151] Apply ruff/flake8-raise rule RSE102

RSE102 Unnecessary parentheses on raised exception
---
 pkg_resources/__init__.py          | 2 +-
 setuptools/command/easy_install.py | 2 +-
 setuptools/tests/test_sandbox.py   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index c4ace5aa77..a0f1c692e8 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2808,7 +2808,7 @@ def _parse_extras(cls, extras_spec):
             return ()
         req = Requirement.parse('x' + extras_spec)
         if req.specs:
-            raise ValueError()
+            raise ValueError
         return req.extras
 
     @classmethod
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 5ec5080131..8425ee80de 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -237,7 +237,7 @@ def _render_version():
         dist = get_distribution('setuptools')
         tmpl = 'setuptools {dist.version} from {dist.location} (Python {ver})'
         print(tmpl.format(**locals()))
-        raise SystemExit()
+        raise SystemExit
 
     def finalize_options(self):  # noqa: C901  # is too complex (25)  # FIXME
         self.version and self._render_version()
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py
index f666615d99..75dfcba2f1 100644
--- a/setuptools/tests/test_sandbox.py
+++ b/setuptools/tests/test_sandbox.py
@@ -100,7 +100,7 @@ class ExceptionUnderTest(Exception):
         with pytest.raises(setuptools.sandbox.UnpickleableException) as caught:
             with setuptools.sandbox.save_modules():
                 setuptools.sandbox.hide_setuptools()
-                raise ExceptionUnderTest()
+                raise ExceptionUnderTest
 
         (msg,) = caught.value.args
         assert msg == 'ExceptionUnderTest()'

From 55e4e1aa217f5d83d8ec80bc3b956bf2c5c79041 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 21:36:32 +0200
Subject: [PATCH 096/151] Apply ruff/flake8-return rule RET502

RET502 Do not implicitly `return None` in function able to return non-`None` value
---
 setuptools/package_index.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index c91e419923..a91bb4584b 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -856,7 +856,7 @@ def _resolve_vcs(url):
     def _download_vcs(self, url, spec_filename):
         vcs = self._resolve_vcs(url)
         if not vcs:
-            return
+            return None
         if vcs == 'svn':
             raise DistutilsError(
                 f"Invalid config, SVN download is not supported: {url}"

From fc7577b1dbae9ffbfbdd5b7a597914c8b4099b4c Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 21:37:55 +0200
Subject: [PATCH 097/151] Apply ruff/flake8-return rule RET503

RET503 Missing explicit `return` at the end of function able to return non-`None` value
---
 setuptools/msvc.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index f86c480d18..649279a806 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -1087,6 +1087,7 @@ def _find_dot_net_versions(self, bits):
             return 'v3.5', 'v2.0.50727'
         elif self.vs_ver == 8.0:
             return 'v3.0', 'v2.0.50727'
+        return None
 
     @staticmethod
     def _use_last_dir_name(path, prefix=''):
@@ -1648,6 +1649,7 @@ def VCRuntimeRedist(self):
             path = join(prefix, arch_subdir, crt_dir, vcruntime)
             if isfile(path):
                 return path
+        return None
 
     def return_env(self, exists=True):
         """

From ae472b47dacfe0884eeabe123b7cb014f9b6af5e Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Fri, 28 Jun 2024 21:55:41 +0200
Subject: [PATCH 098/151] Apply ruff/Perflint rule PERF401

PERF401 Use a list comprehension to create a transformed list
---
 setuptools/command/bdist_egg.py    | 8 +++++---
 setuptools/command/easy_install.py | 9 +++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index 73476e0cec..6cfd2ce86f 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -290,9 +290,11 @@ def get_ext_outputs(self):
 
         paths = {self.bdist_dir: ''}
         for base, dirs, files in sorted_walk(self.bdist_dir):
-            for filename in files:
-                if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS:
-                    all_outputs.append(paths[base] + filename)
+            all_outputs.extend(
+                paths[base] + filename
+                for filename in files
+                if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS
+            )
             for filename in dirs:
                 paths[os.path.join(base, filename)] = paths[base] + filename + '/'
 
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 5ec5080131..801a7df768 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1203,10 +1203,11 @@ def build_and_install(self, setup_script, setup_base):
 
             self.run_setup(setup_script, setup_base, args)
             all_eggs = Environment([dist_dir])
-            eggs = []
-            for key in all_eggs:
-                for dist in all_eggs[key]:
-                    eggs.append(self.install_egg(dist.location, setup_base))
+            eggs = [
+                self.install_egg(dist.location, setup_base)
+                for key in all_eggs
+                for dist in all_eggs[key]
+            ]
             if not eggs and not self.dry_run:
                 log.warn("No eggs found in %s (setup script problem?)", dist_dir)
             return eggs

From d5f60da4cbc5f42903f117edbcd142749163b685 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 28 Jun 2024 16:13:01 -0400
Subject: [PATCH 099/151] Replace use of deprecated find_executable with
 shutil.which.

---
 setuptools/command/easy_install.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index eb6ba1025f..cda9fc6cfc 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -23,7 +23,6 @@
 )
 from distutils import log, dir_util
 from distutils.command.build_scripts import first_line_re
-from distutils.spawn import find_executable
 from distutils.command import install
 import sys
 import os
@@ -2275,7 +2274,7 @@ def _use_header(new_header):
         to an executable on the system.
         """
         clean_header = new_header[2:-1].strip('"')
-        return sys.platform != 'win32' or find_executable(clean_header)
+        return sys.platform != 'win32' or shutil.which(clean_header)
 
 
 class WindowsExecutableLauncherWriter(WindowsScriptWriter):

From 259bfdb515cd2674468a5fff33b2ac6aef9b2261 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Fri, 28 Jun 2024 16:19:30 -0400
Subject: [PATCH 100/151] Add news fragment

---
 newsfragments/4444.feature.rst | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 newsfragments/4444.feature.rst

diff --git a/newsfragments/4444.feature.rst b/newsfragments/4444.feature.rst
new file mode 100644
index 0000000000..20b30f8ca4
--- /dev/null
+++ b/newsfragments/4444.feature.rst
@@ -0,0 +1 @@
+Updated distutils including significant changes to support Cygwin and mingw compilers.

From 92989c2b836ded82c5d0e1b24971f1b73efdaf48 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat, 29 Jun 2024 14:21:38 +0200
Subject: [PATCH 101/151] Enforce ruff/tryceratops rule TRY300

TRY300 Consider moving this statement to an `else` block
---
 pkg_resources/extern/__init__.py                 | 10 +++++-----
 ruff.toml                                        |  2 ++
 setuptools/__init__.py                           |  2 +-
 setuptools/command/easy_install.py               |  2 +-
 setuptools/config/_validate_pyproject/formats.py |  2 +-
 setuptools/depends.py                            |  6 +++---
 setuptools/extension.py                          |  5 ++---
 setuptools/extern/__init__.py                    | 10 +++++-----
 setuptools/tests/test_sdist.py                   |  2 +-
 9 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py
index 9b9ac10aa9..daa978ff72 100644
--- a/pkg_resources/extern/__init__.py
+++ b/pkg_resources/extern/__init__.py
@@ -41,14 +41,14 @@ def load_module(self, fullname: str):
         """
         root, base, target = fullname.partition(self.root_name + '.')
         for prefix in self.search_path:
+            extant = prefix + target
             try:
-                extant = prefix + target
                 __import__(extant)
-                mod = sys.modules[extant]
-                sys.modules[fullname] = mod
-                return mod
             except ImportError:
-                pass
+                continue
+            mod = sys.modules[extant]
+            sys.modules[fullname] = mod
+            return mod
         else:
             raise ImportError(
                 "The '{target}' package is required; "
diff --git a/ruff.toml b/ruff.toml
index 8828fe61a5..2effe696ea 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -14,9 +14,11 @@ extend-select = [
 	"F404", # late-future-import
 	"PYI", # flake8-pyi
 	"UP", # pyupgrade
+	"TRY",
 	"YTT", # flake8-2020
 ]
 ignore = [
+	"TRY301", # raise-within-try, it's handy
 	"UP015", # redundant-open-modes, explicit is preferred
 	"UP030", # temporarily disabled
 	"UP031", # temporarily disabled
diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index 5ef0f7dbd8..bf03f37b77 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -57,9 +57,9 @@ def _get_project_config_files(self, filenames=None):
             """Ignore ``pyproject.toml``, they are not related to setup_requires"""
             try:
                 cfg, toml = super()._split_standard_project_metadata(filenames)
-                return cfg, ()
             except Exception:
                 return filenames, ()
+            return cfg, ()
 
         def finalize_options(self):
             """
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 5ec5080131..7b00801ca6 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -102,9 +102,9 @@ def _to_bytes(s):
 def isascii(s):
     try:
         s.encode('ascii')
-        return True
     except UnicodeError:
         return False
+    return True
 
 
 def _one_liner(text):
diff --git a/setuptools/config/_validate_pyproject/formats.py b/setuptools/config/_validate_pyproject/formats.py
index 5a0599cbb5..aacf4092b0 100644
--- a/setuptools/config/_validate_pyproject/formats.py
+++ b/setuptools/config/_validate_pyproject/formats.py
@@ -91,9 +91,9 @@ def pep508(value: str) -> bool:
         """
         try:
             _req.Requirement(value)
-            return True
         except _req.InvalidRequirement:
             return False
+        return True
 
 except ImportError:  # pragma: no cover
     _logger.warning(
diff --git a/setuptools/depends.py b/setuptools/depends.py
index b6af51c410..2226b6784a 100644
--- a/setuptools/depends.py
+++ b/setuptools/depends.py
@@ -58,11 +58,11 @@ def get_version(self, paths=None, default="unknown"):
         if self.attribute is None:
             try:
                 f, p, i = find_module(self.module, paths)
-                if f:
-                    f.close()
-                return default
             except ImportError:
                 return None
+            if f:
+                f.close()
+            return default
 
         v = get_module_constant(self.module, self.attribute, default, paths)
 
diff --git a/setuptools/extension.py b/setuptools/extension.py
index 8caad78d4b..25420f42de 100644
--- a/setuptools/extension.py
+++ b/setuptools/extension.py
@@ -16,10 +16,9 @@ def _have_cython():
     try:
         # from (cython_impl) import build_ext
         __import__(cython_impl, fromlist=['build_ext']).build_ext
-        return True
     except Exception:
-        pass
-    return False
+        return False
+    return True
 
 
 # for compatibility
diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py
index 5ad7169e3b..f9b6eea70d 100644
--- a/setuptools/extern/__init__.py
+++ b/setuptools/extern/__init__.py
@@ -32,14 +32,14 @@ def load_module(self, fullname):
         """
         root, base, target = fullname.partition(self.root_name + '.')
         for prefix in self.search_path:
+            extant = prefix + target
             try:
-                extant = prefix + target
                 __import__(extant)
-                mod = sys.modules[extant]
-                sys.modules[fullname] = mod
-                return mod
             except ImportError:
-                pass
+                continue
+            mod = sys.modules[extant]
+            sys.modules[fullname] = mod
+            return mod
         else:
             raise ImportError(
                 "The '{target}' package is required; "
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 387ec3bebf..1be568d3fa 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -122,9 +122,9 @@ def touch(path):
 def symlink_or_skip_test(src, dst):
     try:
         os.symlink(src, dst)
-        return dst
     except (OSError, NotImplementedError):
         pytest.skip("symlink not supported in OS")
+    return dst
 
 
 class TestSdistTest:

From 31c859945f696b243027638558e68b269ef68889 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 1 Jul 2024 09:48:07 -0400
Subject: [PATCH 102/151] Remove 'normally supplied to setup()'. Declarative
 styles are normalized.

---
 docs/userguide/declarative_config.rst | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/docs/userguide/declarative_config.rst b/docs/userguide/declarative_config.rst
index 1d5bf6ae42..342f18460e 100644
--- a/docs/userguide/declarative_config.rst
+++ b/docs/userguide/declarative_config.rst
@@ -12,11 +12,9 @@ Configuring setuptools using ``setup.cfg`` files
     call is still required even if your configuration resides in ``setup.cfg``.
 
 ``Setuptools`` allows using configuration files (for example, :file:`setup.cfg`)
-to define a package’s metadata and other options that are normally supplied
-to the ``setup()`` function (declarative config).
+to define a package’s metadata and other options (declarative config).
 
-This approach not only allows automation scenarios but also reduces
-boilerplate code in some cases.
+This approach allows automation scenarios and can reduce boilerplate code.
 
 .. _example-setup-config:
 

From a9a5400313089a48c9e8eebdbdde62d79682e982 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 1 Jul 2024 10:05:17 -0400
Subject: [PATCH 103/151] Add a section on interpolation.

Closes #1648
---
 docs/userguide/declarative_config.rst | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/docs/userguide/declarative_config.rst b/docs/userguide/declarative_config.rst
index 342f18460e..2f650e1746 100644
--- a/docs/userguide/declarative_config.rst
+++ b/docs/userguide/declarative_config.rst
@@ -133,6 +133,24 @@ value associated with ``""`` in the ``package_dir`` dictionary.
    Please see :doc:`package discovery ` for more
    details.
 
+Interpolation
+=============
+
+Config files are parsed using :mod:`configparser` with
+`interpolation `_
+enabled. As a result, one config value may reference another. This
+feature may be used, for example, in defining extras:
+
+.. code-block:: ini
+
+    [options.extras_require]
+    tester =
+        pytest==3.3.2
+        pytest-sugar
+    dev =
+        pytest-xdist
+        %(tester)s
+
 Specifying values
 =================
 

From 4e6d97db1b4364cb184960f477c3e78435332646 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 1 Jul 2024 11:36:55 -0400
Subject: [PATCH 104/151] Prefer relative imports for better portability.

---
 distutils/spawn.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/distutils/spawn.py b/distutils/spawn.py
index 429d1ccb2e..50d30a2761 100644
--- a/distutils/spawn.py
+++ b/distutils/spawn.py
@@ -31,7 +31,7 @@ def _inject_macos_ver(env: Mapping[str:str] | None) -> Mapping[str:str] | None:
     if platform.system() != 'Darwin':
         return env
 
-    from distutils.util import MACOSX_VERSION_VAR, get_macosx_target_ver
+    from .util import MACOSX_VERSION_VAR, get_macosx_target_ver
 
     target_ver = get_macosx_target_ver()
     update = {MACOSX_VERSION_VAR: target_ver} if target_ver else {}

From 3accd5ca04ec23c34b345eef8d0e5d3af072e7a4 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 1 Jul 2024 12:13:55 -0400
Subject: [PATCH 105/151] =?UTF-8?q?Bump=20version:=2070.1.1=20=E2=86=92=20?=
 =?UTF-8?q?70.2.0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .bumpversion.cfg               |  2 +-
 NEWS.rst                       | 16 ++++++++++++++++
 newsfragments/4434.bugfix.rst  |  2 --
 newsfragments/4444.feature.rst |  1 -
 pyproject.toml                 |  2 +-
 5 files changed, 18 insertions(+), 5 deletions(-)
 delete mode 100644 newsfragments/4434.bugfix.rst
 delete mode 100644 newsfragments/4444.feature.rst

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index a11458c8dd..96806f9494 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 70.1.1
+current_version = 70.2.0
 commit = True
 tag = True
 
diff --git a/NEWS.rst b/NEWS.rst
index a33251ec82..df3c50f6a2 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,19 @@
+v70.2.0
+=======
+
+Features
+--------
+
+- Updated distutils including significant changes to support Cygwin and mingw compilers. (#4444)
+
+
+Bugfixes
+--------
+
+- Fix distribution name normalisation (:pep:`625`) for valid versions that are
+  not canonical (e.g. ``1.0-2``). (#4434)
+
+
 v70.1.1
 =======
 
diff --git a/newsfragments/4434.bugfix.rst b/newsfragments/4434.bugfix.rst
deleted file mode 100644
index 5eeb674297..0000000000
--- a/newsfragments/4434.bugfix.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fix distribution name normalisation (:pep:`625`) for valid versions that are
-not canonical (e.g. ``1.0-2``).
diff --git a/newsfragments/4444.feature.rst b/newsfragments/4444.feature.rst
deleted file mode 100644
index 20b30f8ca4..0000000000
--- a/newsfragments/4444.feature.rst
+++ /dev/null
@@ -1 +0,0 @@
-Updated distutils including significant changes to support Cygwin and mingw compilers.
diff --git a/pyproject.toml b/pyproject.toml
index 75a3fbdd89..00e7ee169f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,7 +5,7 @@ backend-path = ["."]
 
 [project]
 name = "setuptools"
-version = "70.1.1"
+version = "70.2.0"
 authors = [
 	{ name = "Python Packaging Authority", email = "distutils-sig@python.org" },
 ]

From 2484a26b4d9aaa07ac2d929d9044e17ba9d55716 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 1 Jul 2024 13:26:28 -0400
Subject: [PATCH 106/151] Remove .gitignore per
 https://blog.jaraco.com/skeleton/#ignoring-artifacts.

---
 .gitignore | 23 -----------------------
 1 file changed, 23 deletions(-)
 delete mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 9ad7e2dd67..0000000000
--- a/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# syntax: glob
-# See https://blog.jaraco.com/skeleton/#ignoring-artifacts before modifying.
-bin
-build
-dist
-docs/build
-include
-lib
-distribute.egg-info
-setuptools.egg-info
-setuptools/tests/bdist_wheel_testdata/*/*.egg-info/
-.coverage
-.eggs
-.tox
-.venv
-*.egg
-*.py[cod]
-*.swp
-*~
-.hg*
-.cache
-.pytest_cache/
-.mypy_cache/

From 8d958f539addcc2a400777a74dc566778140ae3a Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Tue, 2 Jul 2024 09:12:59 +0200
Subject: [PATCH 107/151] Ignore ruff/tryceratops rule TRY003

TRY003 Avoid specifying long messages outside the exception class

Applying this rule would mean creating lots of specialised exception
classes. Not sure this would improve readability and maintainability
in this context.
---
 ruff.toml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ruff.toml b/ruff.toml
index 2effe696ea..be78969cdb 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -18,6 +18,7 @@ extend-select = [
 	"YTT", # flake8-2020
 ]
 ignore = [
+	"TRY003", # raise-vanilla-args, avoid multitude of exception classes
 	"TRY301", # raise-within-try, it's handy
 	"UP015", # redundant-open-modes, explicit is preferred
 	"UP030", # temporarily disabled

From bd1d338614fa1ab7e424fb4ceb6d41927dfaeb33 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 12:26:26 -0400
Subject: [PATCH 108/151] Add issue template for distutils deprecation reports.

---
 .../ISSUE_TEMPLATE/distutils-deprecation.yaml | 103 ++++++++++++++++++
 1 file changed, 103 insertions(+)
 create mode 100644 .github/ISSUE_TEMPLATE/distutils-deprecation.yaml

diff --git a/.github/ISSUE_TEMPLATE/distutils-deprecation.yaml b/.github/ISSUE_TEMPLATE/distutils-deprecation.yaml
new file mode 100644
index 0000000000..7ac1f8bbb9
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/distutils-deprecation.yaml
@@ -0,0 +1,103 @@
+---
+name: 📇 Distutils Deprecation Report
+description: >-
+  Report a use-case affected by the deprecation of distutils
+labels:
+- distutils deprecation
+- Needs Triage
+projects:
+- pypa/6
+body:
+- type: markdown
+  attributes:
+    value: >
+      So you've encountered an issue with the deprecation of distutils.
+
+      First, sorry for the inconvenience while we work to untangle the
+      legacy which is setuptools/distutils. Our goal is to ensure that
+      the vast majority of use cases are satisfied prior to removing
+      the legacy support.
+
+      Please check the
+      [existing reports](https://github.com/pypa/setuptools/issues?q=label%3A%22distutils+deprecation%22+)
+      to see if the affecting condition has been reported previously.
+
+- type: markdown
+  attributes:
+    value: >-
+      **Environment**
+- type: input
+  attributes:
+    label: setuptools version
+    placeholder: For example, setuptools==69.1.0
+    description: >-
+      Please also test with the **latest version** of `setuptools`.
+
+      Typically, this involves modifying `requires` in `[build-system]` of
+      [`pyproject.toml`](https://setuptools.pypa.io/en/latest/userguide/quickstart.html#basic-use),
+      not just updating `setuptools` using `pip`.
+  validations:
+    required: true
+- type: input
+  attributes:
+    label: Python version
+    placeholder: For example, Python 3.10
+    description: >-
+      Please ensure you are using a [supported version of Python](https://devguide.python.org/versions/#supported-versions).
+
+      Setuptools does not support versions that have reached [`end-of-life`](https://devguide.python.org/versions/#unsupported-versions).
+
+      Support for versions of Python under development (i.e. without a stable release) is experimental.
+  validations:
+    required: true
+- type: input
+  attributes:
+    label: OS
+    placeholder: For example, Gentoo Linux, RHEL 8, Arch Linux, macOS etc.
+  validations:
+    required: true
+- type: textarea
+  attributes:
+    label: Additional environment information
+    description: >-
+      Feel free to add more information about your environment here.
+    placeholder: >-
+      This is only happening when I run setuptools on my fridge's patched firmware 🤯
+
+- type: textarea
+  attributes:
+    label: Description
+    description: >-
+      A clear and concise description of the circumstances leading to the warning.
+  validations:
+    required: true
+
+- type: textarea
+  attributes:
+    label: How to Reproduce
+    description: >-
+      Describe the steps to reproduce the warning.
+
+      Please try to create a [minimal reproducer](https://stackoverflow.com/help/minimal-reproducible-example),
+      and avoid things like "see the steps in the CI logs".
+    placeholder: |
+      1. Clone a simplified example: `git clone ...`
+      2. Create a virtual environment for isolation with `...`
+      2. Build the project with setuptools via '...'
+      2. Then run '...'
+      3. An error occurs.
+  validations:
+    required: true
+
+- type: textarea
+  attributes:
+    label: Other detail
+    description: >-
+      Paste the output of the steps above, including the commands
+      themselves and setuptools' output/traceback etc.
+    value: |
+      ```console
+
+      ```
+
+...

From ef37d17fa7de624cc6e89491827e14ed5db9d023 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 12:32:34 -0400
Subject: [PATCH 109/151] In the warnings, provide link to issue template.

---
 _distutils_hack/__init__.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py
index 881090d590..1e688f1738 100644
--- a/_distutils_hack/__init__.py
+++ b/_distutils_hack/__init__.py
@@ -3,6 +3,12 @@
 import os
 
 
+report_url = (
+    "https://github.com/pypa/setuptools/issues/new?"
+    "template=distutils-deprecation.yaml"
+)
+
+
 def warn_distutils_present():
     if 'distutils' not in sys.modules:
         return
@@ -26,7 +32,8 @@ def clear_distutils():
     warnings.warn(
         "Setuptools is replacing distutils. Support for replacing "
         "an already imported distutils is deprecated. In the future, "
-        "this condition will fail.",
+        "this condition will fail. "
+        f"Register concerns at {report_url}"
     )
     mods = [
         name
@@ -49,7 +56,8 @@ def enabled():
             "Reliance on distutils from stdlib is deprecated. Users "
             "must rely on setuptools to provide the distutils module. "
             "Avoid importing distutils or import setuptools first, "
-            "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib."
+            "and avoid setting SETUPTOOLS_USE_DISTUTILS=stdlib. "
+            f"Register concerns at {report_url}"
         )
     return which == 'local'
 

From 70cda3d1e8bb8a9602256f235c9a023934dd6065 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 12:33:18 -0400
Subject: [PATCH 110/151] Use '.yml' for consistency.

---
 .../{distutils-deprecation.yaml => distutils-deprecation.yml}   | 0
 _distutils_hack/__init__.py                                     | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename .github/ISSUE_TEMPLATE/{distutils-deprecation.yaml => distutils-deprecation.yml} (100%)

diff --git a/.github/ISSUE_TEMPLATE/distutils-deprecation.yaml b/.github/ISSUE_TEMPLATE/distutils-deprecation.yml
similarity index 100%
rename from .github/ISSUE_TEMPLATE/distutils-deprecation.yaml
rename to .github/ISSUE_TEMPLATE/distutils-deprecation.yml
diff --git a/_distutils_hack/__init__.py b/_distutils_hack/__init__.py
index 1e688f1738..35ab5cad49 100644
--- a/_distutils_hack/__init__.py
+++ b/_distutils_hack/__init__.py
@@ -5,7 +5,7 @@
 
 report_url = (
     "https://github.com/pypa/setuptools/issues/new?"
-    "template=distutils-deprecation.yaml"
+    "template=distutils-deprecation.yml"
 )
 
 

From 62bd80fb82c984e5601ce9ebb56aa8237fae7233 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 13:31:06 -0400
Subject: [PATCH 111/151] Declare the dependencies and update vendoring routine
 for setuptools (only) to simply install the dependencies to the _vendor
 folder.

---
 pyproject.toml                  | 11 ++++++++-
 setuptools/_vendor/vendored.txt | 12 ---------
 setuptools/extern/__init__.py   |  5 +++-
 tools/vendored.py               | 43 ++++++++++++++++++++++++---------
 tox.ini                         |  3 +++
 5 files changed, 48 insertions(+), 26 deletions(-)
 delete mode 100644 setuptools/_vendor/vendored.txt

diff --git a/pyproject.toml b/pyproject.toml
index 00e7ee169f..0709c0b143 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -24,7 +24,16 @@ classifiers = [
 ]
 keywords = ["CPAN PyPI distutils eggs package management"]
 requires-python = ">=3.8"
-dependencies = []
+dependencies = [
+	"packaging>=24",
+	"ordered-set>=3.1.1",
+	"more_itertools>=8.8",
+	"jaraco.text>=3.7",
+	"importlib_resources>=5.10.2",
+	"importlib_metadata>=6",
+	"tomli>=2.0.1",
+	"wheel>=0.43.0",
+]
 
 [project.urls]
 Source = "https://github.com/pypa/setuptools"
diff --git a/setuptools/_vendor/vendored.txt b/setuptools/_vendor/vendored.txt
deleted file mode 100644
index c981dde807..0000000000
--- a/setuptools/_vendor/vendored.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-packaging==24
-ordered-set==3.1.1
-more_itertools==8.8.0
-jaraco.text==3.7.0
-importlib_resources==5.10.2
-importlib_metadata==6.0.0
-# required for importlib_resources and _metadata on older Pythons
-zipp==3.7.0
-tomli==2.0.1
-# required for jaraco.context on older Pythons
-backports.tarfile
-wheel==0.43.0
diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py
index f9b6eea70d..18ca1e2428 100644
--- a/setuptools/extern/__init__.py
+++ b/setuptools/extern/__init__.py
@@ -77,14 +77,17 @@ def install(self):
 # cog.outl(f"names = (\n{names}\n)")
 # ]]]
 names = (
-    'backports',
+    'autocommand',
     'importlib_metadata',
     'importlib_resources',
+    'inflect',
     'jaraco',
     'more_itertools',
     'ordered_set',
     'packaging',
     'tomli',
+    'typeguard',
+    'typing_extensions',
     'wheel',
     'zipp',
 )
diff --git a/tools/vendored.py b/tools/vendored.py
index edc9195f3c..29457720b6 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -4,6 +4,7 @@
 import subprocess
 from textwrap import dedent
 
+from jaraco.packaging import metadata
 from path import Path
 
 
@@ -13,7 +14,7 @@ def remove_all(paths):
 
 
 def update_vendored():
-    update_pkg_resources()
+    # update_pkg_resources()
     update_setuptools()
 
 
@@ -207,19 +208,37 @@ def update_pkg_resources():
     rewrite_platformdirs(vendor / "platformdirs")
 
 
+def load_deps():
+    """
+    Read the dependencies from `.`.
+    """
+    return metadata.load('.').get_all('Requires-Dist')
+
+
+def install_deps(deps, vendor):
+    """
+    Install the deps to vendor.
+    """
+    install_args = [
+        sys.executable,
+        '-m',
+        'pip',
+        'install',
+        '--target',
+        str(vendor),
+        '--python-version',
+        '3.8',
+        '--only-binary',
+        ':all:',
+    ] + list(deps)
+    subprocess.check_call(install_args)
+
+
 def update_setuptools():
     vendor = Path('setuptools/_vendor')
-    install(vendor)
-    rewrite_packaging(vendor / 'packaging', 'setuptools.extern')
-    repair_namespace(vendor / 'jaraco')
-    repair_namespace(vendor / 'backports')
-    rewrite_jaraco_text(vendor / 'jaraco/text', 'setuptools.extern')
-    rewrite_jaraco_functools(vendor / 'jaraco/functools', 'setuptools.extern')
-    rewrite_jaraco_context(vendor / 'jaraco', 'setuptools.extern')
-    rewrite_importlib_resources(vendor / 'importlib_resources', 'setuptools.extern')
-    rewrite_importlib_metadata(vendor / 'importlib_metadata', 'setuptools.extern')
-    rewrite_more_itertools(vendor / "more_itertools")
-    rewrite_wheel(vendor / "wheel")
+    deps = load_deps()
+    clean(vendor)
+    install_deps(deps, vendor)
 
 
 def yield_top_level(name):
diff --git a/tox.ini b/tox.ini
index 6b04ddb1cd..9ff4488cd3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -75,6 +75,9 @@ allowlist_externals = git, sh
 deps =
 	path
 	cogapp
+	jaraco.packaging
+	# workaround for pypa/pyproject-hooks#192
+	pyproject-hooks<1.1
 commands =
 	vendor: python -m tools.vendored
 	sh -c "git grep -l -F '\[\[\[cog' | xargs -t cog -I {toxinidir} -r"  # update `*.extern`

From e9bb6879e29d67b3999de4119c65b63c5e22b67b Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 14:41:43 -0400
Subject: [PATCH 112/151] Specify environment-conditional transitive deps.

Workaround for pypa/pip#12770.
---
 tools/vendored.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/vendored.py b/tools/vendored.py
index 29457720b6..63d8c577cf 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -219,6 +219,11 @@ def install_deps(deps, vendor):
     """
     Install the deps to vendor.
     """
+    # workaround for https://github.com/pypa/pip/issues/12770
+    deps += [
+        'zipp >= 3.7',
+        'backports.tarfile',
+    ]
     install_args = [
         sys.executable,
         '-m',

From d4352b5d6653d44a6604532436c37fe1f62e7b02 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 14:17:05 -0400
Subject: [PATCH 113/151] Import dependencies naturally and ensure they're
 available by appending the vendor dir to sys.path.

---
 setuptools/__init__.py                    |  3 +++
 setuptools/_core_metadata.py              |  8 ++++----
 setuptools/_entry_points.py               |  6 +++---
 setuptools/_importlib.py                  |  4 ++--
 setuptools/_itertools.py                  |  2 +-
 setuptools/_normalization.py              |  4 ++--
 setuptools/_reqs.py                       |  4 ++--
 setuptools/command/_requirestxt.py        |  4 ++--
 setuptools/command/bdist_wheel.py         | 10 +++++-----
 setuptools/command/build_py.py            |  2 +-
 setuptools/command/easy_install.py        |  2 +-
 setuptools/command/editable_wheel.py      |  2 +-
 setuptools/command/egg_info.py            |  2 +-
 setuptools/command/test.py                |  4 ++--
 setuptools/compat/py310.py                |  2 +-
 setuptools/config/_apply_pyprojecttoml.py |  2 +-
 setuptools/config/expand.py               |  4 ++--
 setuptools/config/pyprojecttoml.py        |  2 +-
 setuptools/config/setupcfg.py             |  8 ++++----
 setuptools/depends.py                     |  2 +-
 setuptools/dist.py                        | 10 +++++-----
 setuptools/msvc.py                        |  3 ++-
 setuptools/package_index.py               |  3 ++-
 setuptools/tests/config/test_setupcfg.py  |  2 +-
 setuptools/tests/test_bdist_wheel.py      |  6 +++---
 setuptools/tests/test_extern.py           |  2 +-
 setuptools/tests/test_setuptools.py       |  2 +-
 setuptools/tests/test_wheel.py            |  4 ++--
 setuptools/wheel.py                       |  7 ++++---
 29 files changed, 61 insertions(+), 55 deletions(-)

diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index bf03f37b77..2917c6a811 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -3,8 +3,11 @@
 import functools
 import os
 import re
+import sys
 from typing import TYPE_CHECKING
 
+sys.path.append(os.path.dirname(__file__) + '/_vendor')
+
 import _distutils_hack.override  # noqa: F401
 import distutils.core
 from distutils.errors import DistutilsOptionError
diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py
index 45aae7d70b..82ec19fc75 100644
--- a/setuptools/_core_metadata.py
+++ b/setuptools/_core_metadata.py
@@ -16,10 +16,10 @@
 from distutils.util import rfc822_escape
 
 from . import _normalization, _reqs
-from .extern.packaging.markers import Marker
-from .extern.packaging.requirements import Requirement
-from .extern.packaging.utils import canonicalize_name, canonicalize_version
-from .extern.packaging.version import Version
+from packaging.markers import Marker
+from packaging.requirements import Requirement
+from packaging.utils import canonicalize_name, canonicalize_version
+from packaging.version import Version
 from .warnings import SetuptoolsDeprecationWarning
 
 
diff --git a/setuptools/_entry_points.py b/setuptools/_entry_points.py
index b244e78387..5de12582be 100644
--- a/setuptools/_entry_points.py
+++ b/setuptools/_entry_points.py
@@ -3,11 +3,11 @@
 import itertools
 
 from .errors import OptionError
-from .extern.jaraco.text import yield_lines
-from .extern.jaraco.functools import pass_none
+from jaraco.text import yield_lines
+from jaraco.functools import pass_none
 from ._importlib import metadata
 from ._itertools import ensure_unique
-from .extern.more_itertools import consume
+from more_itertools import consume
 
 
 def ensure_valid(ep):
diff --git a/setuptools/_importlib.py b/setuptools/_importlib.py
index 8e52888d6f..ff3288102a 100644
--- a/setuptools/_importlib.py
+++ b/setuptools/_importlib.py
@@ -38,7 +38,7 @@ def disable_importlib_metadata_finder(metadata):
 
 
 if sys.version_info < (3, 10):
-    from setuptools.extern import importlib_metadata as metadata
+    import importlib_metadata as metadata
 
     disable_importlib_metadata_finder(metadata)
 else:
@@ -46,6 +46,6 @@ def disable_importlib_metadata_finder(metadata):
 
 
 if sys.version_info < (3, 9):
-    from setuptools.extern import importlib_resources as resources
+    import importlib_resources as resources
 else:
     import importlib.resources as resources  # noqa: F401
diff --git a/setuptools/_itertools.py b/setuptools/_itertools.py
index b8bf6d210a..d6ca841353 100644
--- a/setuptools/_itertools.py
+++ b/setuptools/_itertools.py
@@ -1,4 +1,4 @@
-from setuptools.extern.more_itertools import consume  # noqa: F401
+from more_itertools import consume  # noqa: F401
 
 
 # copied from jaraco.itertools 6.1
diff --git a/setuptools/_normalization.py b/setuptools/_normalization.py
index e858052ccd..467b643d46 100644
--- a/setuptools/_normalization.py
+++ b/setuptools/_normalization.py
@@ -5,7 +5,7 @@
 
 import re
 
-from .extern import packaging
+import packaging
 
 # https://packaging.python.org/en/latest/specifications/core-metadata/#name
 _VALID_NAME = re.compile(r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.I)
@@ -54,7 +54,7 @@ def safe_version(version: str) -> str:
     >>> safe_version("ubuntu lts")
     Traceback (most recent call last):
     ...
-    setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'ubuntu.lts'
+    packaging.version.InvalidVersion: Invalid version: 'ubuntu.lts'
     """
     v = version.replace(' ', '.')
     try:
diff --git a/setuptools/_reqs.py b/setuptools/_reqs.py
index 9f83437033..1b64d9df79 100644
--- a/setuptools/_reqs.py
+++ b/setuptools/_reqs.py
@@ -1,8 +1,8 @@
 from functools import lru_cache
 from typing import Callable, Iterable, Iterator, TypeVar, Union, overload
 
-import setuptools.extern.jaraco.text as text
-from setuptools.extern.packaging.requirements import Requirement
+import jaraco.text as text
+from packaging.requirements import Requirement
 
 _T = TypeVar("_T")
 _StrOrIter = Union[str, Iterable[str]]
diff --git a/setuptools/command/_requirestxt.py b/setuptools/command/_requirestxt.py
index 1f1967e7aa..ef35d183e8 100644
--- a/setuptools/command/_requirestxt.py
+++ b/setuptools/command/_requirestxt.py
@@ -15,8 +15,8 @@
 from typing import Dict, Mapping, TypeVar
 
 from .. import _reqs
-from ..extern.jaraco.text import yield_lines
-from ..extern.packaging.requirements import Requirement
+from jaraco.text import yield_lines
+from packaging.requirements import Requirement
 
 
 # dict can work as an ordered set
diff --git a/setuptools/command/bdist_wheel.py b/setuptools/command/bdist_wheel.py
index d8cdd4e406..50248cdc25 100644
--- a/setuptools/command/bdist_wheel.py
+++ b/setuptools/command/bdist_wheel.py
@@ -23,10 +23,10 @@
 from zipfile import ZIP_DEFLATED, ZIP_STORED
 
 from .. import Command, __version__
-from ..extern.wheel.metadata import pkginfo_to_metadata
-from ..extern.packaging import tags
-from ..extern.packaging import version as _packaging_version
-from ..extern.wheel.wheelfile import WheelFile
+from wheel.metadata import pkginfo_to_metadata
+from packaging import tags
+from packaging import version as _packaging_version
+from wheel.wheelfile import WheelFile
 
 if TYPE_CHECKING:
     import types
@@ -68,7 +68,7 @@ def get_platform(archive_root: str | None) -> str:
     """Return our platform name 'win32', 'linux_x86_64'"""
     result = sysconfig.get_platform()
     if result.startswith("macosx") and archive_root is not None:
-        from ..extern.wheel.macosx_libfile import calculate_macosx_platform_tag
+        from wheel.macosx_libfile import calculate_macosx_platform_tag
 
         result = calculate_macosx_platform_tag(archive_root, result)
     elif _is_32bit_interpreter():
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index ab49874635..15a4f63fdd 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -13,7 +13,7 @@
 from pathlib import Path
 from typing import Iterable, Iterator
 
-from ..extern.more_itertools import unique_everseen
+from more_itertools import unique_everseen
 from ..warnings import SetuptoolsDeprecationWarning
 
 
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index e6ce3fcc05..36114d40ed 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -76,7 +76,7 @@
 import pkg_resources
 from ..compat import py39, py311
 from .._path import ensure_directory
-from ..extern.jaraco.text import yield_lines
+from jaraco.text import yield_lines
 
 
 # Turn on PEP440Warnings
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py
index ae31bb4c79..65058c2cd6 100644
--- a/setuptools/command/editable_wheel.py
+++ b/setuptools/command/editable_wheel.py
@@ -333,7 +333,7 @@ def _safely_run(self, cmd_name: str):
             )
 
     def _create_wheel_file(self, bdist_wheel):
-        from ..extern.wheel.wheelfile import WheelFile
+        from wheel.wheelfile import WheelFile
 
         dist_info = self.get_finalized_command("dist_info")
         dist_name = dist_info.name
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 2f20303341..9e63a934e6 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -27,7 +27,7 @@
 import setuptools.unicode_utils as unicode_utils
 from setuptools.glob import glob
 
-from setuptools.extern import packaging
+import packaging
 from ..warnings import SetuptoolsDeprecationWarning
 
 
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index af1349e1c6..fbdf9fb942 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -19,8 +19,8 @@
 )
 from .._importlib import metadata
 from setuptools import Command
-from setuptools.extern.more_itertools import unique_everseen
-from setuptools.extern.jaraco.functools import pass_none
+from more_itertools import unique_everseen
+from jaraco.functools import pass_none
 
 
 class ScanningLoader(TestLoader):
diff --git a/setuptools/compat/py310.py b/setuptools/compat/py310.py
index f7d53d6de9..cc875c004b 100644
--- a/setuptools/compat/py310.py
+++ b/setuptools/compat/py310.py
@@ -7,4 +7,4 @@
 if sys.version_info >= (3, 11):
     import tomllib
 else:  # pragma: no cover
-    from setuptools.extern import tomli as tomllib
+    import tomli as tomllib
diff --git a/setuptools/config/_apply_pyprojecttoml.py b/setuptools/config/_apply_pyprojecttoml.py
index f44271c5dd..8c1a81dda5 100644
--- a/setuptools/config/_apply_pyprojecttoml.py
+++ b/setuptools/config/_apply_pyprojecttoml.py
@@ -204,7 +204,7 @@ def _project_urls(dist: Distribution, val: dict, _root_dir):
 
 
 def _python_requires(dist: Distribution, val: dict, _root_dir):
-    from setuptools.extern.packaging.specifiers import SpecifierSet
+    from packaging.specifiers import SpecifierSet
 
     _set_config(dist, "python_requires", SpecifierSet(val))
 
diff --git a/setuptools/config/expand.py b/setuptools/config/expand.py
index e5f5dc586e..f5d94a380c 100644
--- a/setuptools/config/expand.py
+++ b/setuptools/config/expand.py
@@ -122,7 +122,7 @@ def read_files(
 
     (By default ``root_dir`` is the current directory).
     """
-    from setuptools.extern.more_itertools import always_iterable
+    from more_itertools import always_iterable
 
     root_dir = os.path.abspath(root_dir or os.getcwd())
     _filepaths = (os.path.join(root_dir, path) for path in always_iterable(filepaths))
@@ -287,7 +287,7 @@ def find_packages(
     :rtype: list
     """
     from setuptools.discovery import construct_package_dir
-    from setuptools.extern.more_itertools import unique_everseen, always_iterable
+    from more_itertools import unique_everseen, always_iterable
 
     if namespaces:
         from setuptools.discovery import PEP420PackageFinder as PackageFinder
diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py
index d41c956cbd..c315d71535 100644
--- a/setuptools/config/pyprojecttoml.py
+++ b/setuptools/config/pyprojecttoml.py
@@ -278,7 +278,7 @@ def _ensure_previously_set(self, dist: Distribution, field: str):
     def _expand_directive(
         self, specifier: str, directive, package_dir: Mapping[str, str]
     ):
-        from setuptools.extern.more_itertools import always_iterable
+        from more_itertools import always_iterable
 
         with _ignore_errors(self.ignore_option_errors):
             root_dir = self.root_dir
diff --git a/setuptools/config/setupcfg.py b/setuptools/config/setupcfg.py
index 80ebe3d9bd..2ca0856ab4 100644
--- a/setuptools/config/setupcfg.py
+++ b/setuptools/config/setupcfg.py
@@ -31,10 +31,10 @@
 
 from .._path import StrPath
 from ..errors import FileError, OptionError
-from ..extern.packaging.markers import default_environment as marker_env
-from ..extern.packaging.requirements import InvalidRequirement, Requirement
-from ..extern.packaging.specifiers import SpecifierSet
-from ..extern.packaging.version import InvalidVersion, Version
+from packaging.markers import default_environment as marker_env
+from packaging.requirements import InvalidRequirement, Requirement
+from packaging.specifiers import SpecifierSet
+from packaging.version import InvalidVersion, Version
 from ..warnings import SetuptoolsDeprecationWarning
 from . import expand
 
diff --git a/setuptools/depends.py b/setuptools/depends.py
index 2226b6784a..871a0925ef 100644
--- a/setuptools/depends.py
+++ b/setuptools/depends.py
@@ -6,7 +6,7 @@
 
 from . import _imp
 from ._imp import find_module, PY_COMPILED, PY_FROZEN, PY_SOURCE
-from .extern.packaging.version import Version
+from packaging.version import Version
 
 
 __all__ = ['Require', 'find_module']
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 32e8d43c64..bcab50ba65 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -21,11 +21,11 @@
 from distutils.fancy_getopt import translate_longopt
 from distutils.util import strtobool
 
-from .extern.more_itertools import partition, unique_everseen
-from .extern.ordered_set import OrderedSet
-from .extern.packaging.markers import InvalidMarker, Marker
-from .extern.packaging.specifiers import InvalidSpecifier, SpecifierSet
-from .extern.packaging.version import Version
+from more_itertools import partition, unique_everseen
+from ordered_set import OrderedSet
+from packaging.markers import InvalidMarker, Marker
+from packaging.specifiers import InvalidSpecifier, SpecifierSet
+from packaging.version import Version
 
 from . import _entry_points
 from . import _normalization
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index a3d350fe50..2768059213 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -23,7 +23,8 @@
 import subprocess
 import distutils.errors
 from typing import TYPE_CHECKING
-from setuptools.extern.more_itertools import unique_everseen
+
+from more_itertools import unique_everseen
 
 # https://github.com/python/mypy/issues/8166
 if not TYPE_CHECKING and platform.system() == 'Windows':
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 2c807f6b4e..c24c783762 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -39,7 +39,8 @@
 from distutils.errors import DistutilsError
 from fnmatch import translate
 from setuptools.wheel import Wheel
-from setuptools.extern.more_itertools import unique_everseen
+
+from more_itertools import unique_everseen
 
 from .unicode_utils import _read_utf8_with_fallback, _cfg_read_utf8_with_fallback
 
diff --git a/setuptools/tests/config/test_setupcfg.py b/setuptools/tests/config/test_setupcfg.py
index bf9777c668..dc8a4f7f88 100644
--- a/setuptools/tests/config/test_setupcfg.py
+++ b/setuptools/tests/config/test_setupcfg.py
@@ -9,7 +9,7 @@
 from distutils.errors import DistutilsOptionError, DistutilsFileError
 from setuptools.dist import Distribution, _Distribution
 from setuptools.config.setupcfg import ConfigHandler, read_configuration
-from setuptools.extern.packaging.requirements import InvalidRequirement
+from packaging.requirements import InvalidRequirement
 from setuptools.warnings import SetuptoolsDeprecationWarning
 from ..textwrap import DALS
 
diff --git a/setuptools/tests/test_bdist_wheel.py b/setuptools/tests/test_bdist_wheel.py
index 232b66d368..7043d857d7 100644
--- a/setuptools/tests/test_bdist_wheel.py
+++ b/setuptools/tests/test_bdist_wheel.py
@@ -26,7 +26,7 @@
     remove_readonly_exc,
 )
 from setuptools.dist import Distribution
-from setuptools.extern.packaging import tags
+from packaging import tags
 
 DEFAULT_FILES = {
     "dummy_dist-1.0.dist-info/top_level.txt",
@@ -598,12 +598,12 @@ def _fake_import(name: str, *args, **kwargs):
         return importlib.__import__(name, *args, **kwargs)
 
     with suppress(KeyError):
-        monkeypatch.delitem(sys.modules, "setuptools.extern.wheel.macosx_libfile")
+        monkeypatch.delitem(sys.modules, "wheel.macosx_libfile")
 
     # Install an importer shim that refuses to load ctypes
     monkeypatch.setattr(builtins, "__import__", _fake_import)
     with pytest.raises(ModuleNotFoundError, match="No module named ctypes"):
-        import setuptools.extern.wheel.macosx_libfile
+        import wheel.macosx_libfile  # noqa: F401
 
     # Unload and reimport the bdist_wheel command module to make sure it won't try to
     # import ctypes
diff --git a/setuptools/tests/test_extern.py b/setuptools/tests/test_extern.py
index 0d6b164f53..da01b25b98 100644
--- a/setuptools/tests/test_extern.py
+++ b/setuptools/tests/test_extern.py
@@ -2,7 +2,7 @@
 import pickle
 
 from setuptools import Distribution
-from setuptools.extern import ordered_set
+import ordered_set
 
 
 def test_reimport_extern():
diff --git a/setuptools/tests/test_setuptools.py b/setuptools/tests/test_setuptools.py
index b1ca2396bd..0c5b1f18fa 100644
--- a/setuptools/tests/test_setuptools.py
+++ b/setuptools/tests/test_setuptools.py
@@ -16,7 +16,7 @@
 import setuptools.depends as dep
 from setuptools.depends import Require
 
-from setuptools.extern.packaging.version import Version
+from packaging.version import Version
 
 
 @pytest.fixture(autouse=True)
diff --git a/setuptools/tests/test_wheel.py b/setuptools/tests/test_wheel.py
index cdfd9d1a5f..e58ccd8d18 100644
--- a/setuptools/tests/test_wheel.py
+++ b/setuptools/tests/test_wheel.py
@@ -17,8 +17,8 @@
 from jaraco import path
 
 from pkg_resources import Distribution, PathMetadata, PY_MAJOR
-from setuptools.extern.packaging.utils import canonicalize_name
-from setuptools.extern.packaging.tags import parse_tag
+from packaging.utils import canonicalize_name
+from packaging.tags import parse_tag
 from setuptools.wheel import Wheel
 
 from .contexts import tempdir
diff --git a/setuptools/wheel.py b/setuptools/wheel.py
index e06daec4d0..a05cd98d1f 100644
--- a/setuptools/wheel.py
+++ b/setuptools/wheel.py
@@ -9,12 +9,13 @@
 import zipfile
 import contextlib
 
+from packaging.version import Version as parse_version
+from packaging.tags import sys_tags
+from packaging.utils import canonicalize_name
+
 from distutils.util import get_platform
 
 import setuptools
-from setuptools.extern.packaging.version import Version as parse_version
-from setuptools.extern.packaging.tags import sys_tags
-from setuptools.extern.packaging.utils import canonicalize_name
 from setuptools.command.egg_info import write_requirements, _egg_basename
 from setuptools.archive_util import _unpack_zipfile_obj
 

From 00384a5f4fd22c653172b99feefe13b0009eb870 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 14:22:06 -0400
Subject: [PATCH 114/151] Re-vendor setuptools packages.

---
 .../INSTALLER                                 |    0
 .../autocommand-2.2.2.dist-info/LICENSE       |  166 +
 .../autocommand-2.2.2.dist-info/METADATA      |  420 ++
 .../autocommand-2.2.2.dist-info/RECORD        |   18 +
 .../WHEEL                                     |    0
 .../autocommand-2.2.2.dist-info/top_level.txt |    1 +
 setuptools/_vendor/autocommand/__init__.py    |   27 +
 setuptools/_vendor/autocommand/autoasync.py   |  142 +
 setuptools/_vendor/autocommand/autocommand.py |   70 +
 setuptools/_vendor/autocommand/automain.py    |   59 +
 setuptools/_vendor/autocommand/autoparse.py   |  333 ++
 setuptools/_vendor/autocommand/errors.py      |   23 +
 .../backports.tarfile-1.0.0.dist-info/RECORD  |    9 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../METADATA                                  |   12 +-
 .../backports.tarfile-1.2.0.dist-info/RECORD  |   17 +
 .../REQUESTED                                 |    0
 .../WHEEL                                     |    0
 .../top_level.txt                             |    0
 setuptools/_vendor/backports/__init__.py      |    1 +
 .../{tarfile.py => tarfile/__init__.py}       |  129 +-
 .../_vendor/backports/tarfile/__main__.py     |    5 +
 .../tarfile/compat}/__init__.py               |    0
 .../_vendor/backports/tarfile/compat/py38.py  |   24 +
 .../importlib_metadata-6.0.0.dist-info/RECORD |   26 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../METADATA                                  |   82 +-
 .../importlib_metadata-8.0.0.dist-info/RECORD |   32 +
 .../REQUESTED                                 |    0
 .../WHEEL                                     |    2 +-
 .../top_level.txt                             |    0
 .../_vendor/importlib_metadata/__init__.py    |  405 +-
 .../_vendor/importlib_metadata/_adapters.py   |   23 +-
 .../_vendor/importlib_metadata/_compat.py     |   19 +-
 .../_vendor/importlib_metadata/_meta.py       |   60 +-
 .../compat}/__init__.py                       |    0
 .../importlib_metadata/compat/py311.py        |   22 +
 .../{_py39compat.py => compat/py39.py}        |    7 +-
 .../_vendor/importlib_metadata/diagnose.py    |   21 +
 .../RECORD                                    |   77 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../METADATA                                  |   52 +-
 .../RECORD                                    |   89 +
 .../REQUESTED                                 |    0
 .../WHEEL                                     |    1 -
 .../top_level.txt                             |    0
 .../_vendor/importlib_resources/__init__.py   |   14 +-
 .../_vendor/importlib_resources/_adapters.py  |    4 +-
 .../_vendor/importlib_resources/_common.py    |    7 +-
 .../_vendor/importlib_resources/_compat.py    |  108 -
 .../_vendor/importlib_resources/_itertools.py |   69 +-
 .../_vendor/importlib_resources/_legacy.py    |  120 -
 setuptools/_vendor/importlib_resources/abc.py |    3 +-
 .../{tests/zipdata02 => compat}/__init__.py   |    0
 .../importlib_resources/compat/py38.py        |   11 +
 .../importlib_resources/compat/py39.py        |   10 +
 .../_vendor/importlib_resources/functional.py |   81 +
 .../future}/__init__.py                       |    0
 .../importlib_resources/future/adapters.py    |   95 +
 .../_vendor/importlib_resources/readers.py    |   90 +-
 .../_vendor/importlib_resources/simple.py     |    2 +-
 .../importlib_resources/tests/_compat.py      |   32 -
 .../importlib_resources/tests/_path.py        |   18 +-
 .../tests/compat/__init__.py}                 |    0
 .../importlib_resources/tests/compat/py312.py |   18 +
 .../importlib_resources/tests/compat/py39.py  |   10 +
 .../tests/data01/subdirectory/binary.file     |  Bin 4 -> 4 bytes
 .../subdirectory/subsubdir/resource.txt       |    1 +
 .../namespacedata01/subdirectory/binary.file  |    1 +
 .../tests/test_compatibilty_files.py          |    6 +-
 .../tests/test_contents.py                    |    2 +-
 .../importlib_resources/tests/test_custom.py  |   47 +
 .../importlib_resources/tests/test_files.py   |   23 +-
 .../tests/test_functional.py                  |  242 +
 .../importlib_resources/tests/test_open.py    |   20 +-
 .../importlib_resources/tests/test_path.py    |   19 +-
 .../importlib_resources/tests/test_read.py    |   41 +-
 .../importlib_resources/tests/test_reader.py  |   34 +-
 .../tests/test_resource.py                    |  155 +-
 .../importlib_resources/tests/update-zips.py  |   53 -
 .../_vendor/importlib_resources/tests/util.py |   79 +-
 .../_vendor/importlib_resources/tests/zip.py  |   32 +
 .../tests/zipdata01/ziptestdata.zip           |  Bin 876 -> 0 bytes
 .../tests/zipdata02/ziptestdata.zip           |  Bin 698 -> 0 bytes
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../_vendor/inflect-7.3.1.dist-info/METADATA  |  591 +++
 .../_vendor/inflect-7.3.1.dist-info/RECORD    |   13 +
 .../WHEEL                                     |    2 +-
 .../inflect-7.3.1.dist-info/top_level.txt     |    1 +
 setuptools/_vendor/inflect/__init__.py        | 3986 +++++++++++++++++
 .../REQUESTED => inflect/compat/__init__.py}  |    0
 setuptools/_vendor/inflect/compat/py38.py     |    7 +
 .../REQUESTED => inflect/py.typed}            |    0
 .../jaraco.functools-4.0.0.dist-info/RECORD   |   10 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    2 -
 .../METADATA                                  |   21 +-
 .../jaraco.functools-4.0.1.dist-info/RECORD   |   10 +
 .../WHEEL                                     |    2 +-
 .../top_level.txt                             |    0
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    2 -
 .../jaraco.text-3.12.1.dist-info/METADATA     |   95 +
 .../jaraco.text-3.12.1.dist-info/RECORD       |   20 +
 .../REQUESTED                                 |    0
 .../WHEEL                                     |    2 +-
 .../top_level.txt                             |    0
 .../jaraco.text-3.7.0.dist-info/METADATA      |   55 -
 .../jaraco.text-3.7.0.dist-info/RECORD        |   10 -
 setuptools/_vendor/jaraco/context.py          |    2 +-
 .../_vendor/jaraco/functools/__init__.py      |    6 +-
 .../_vendor/jaraco/functools/__init__.pyi     |    3 -
 setuptools/_vendor/jaraco/text/__init__.py    |   61 +-
 setuptools/_vendor/jaraco/text/layouts.py     |   25 +
 .../_vendor/jaraco/text/show-newlines.py      |   33 +
 .../_vendor/jaraco/text/strip-prefix.py       |   21 +
 setuptools/_vendor/jaraco/text/to-dvorak.py   |    6 +
 setuptools/_vendor/jaraco/text/to-qwerty.py   |    6 +
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../METADATA                                  |  544 +--
 .../more_itertools-10.3.0.dist-info/RECORD    |   16 +
 .../more_itertools-10.3.0.dist-info/REQUESTED |    0
 .../more_itertools-10.3.0.dist-info/WHEEL     |    4 +
 .../more_itertools-8.8.0.dist-info/RECORD     |   17 -
 .../top_level.txt                             |    1 -
 setuptools/_vendor/more_itertools/__init__.py |    4 +-
 setuptools/_vendor/more_itertools/more.py     | 1352 +++++-
 setuptools/_vendor/more_itertools/more.pyi    |  479 +-
 setuptools/_vendor/more_itertools/recipes.py  |  506 ++-
 setuptools/_vendor/more_itertools/recipes.pyi |  131 +-
 .../ordered_set-3.1.1.dist-info/RECORD        |    9 -
 .../ordered_set-3.1.1.dist-info/top_level.txt |    1 -
 .../INSTALLER                                 |    0
 .../METADATA                                  |   67 +-
 .../ordered_set-4.1.0.dist-info/RECORD        |    8 +
 .../ordered_set-4.1.0.dist-info/REQUESTED     |    0
 .../_vendor/ordered_set-4.1.0.dist-info/WHEEL |    4 +
 .../__init__.py}                              |  194 +-
 setuptools/_vendor/ordered_set/py.typed       |    0
 .../_vendor/packaging-24.0.dist-info/RECORD   |   37 -
 .../packaging-24.1.dist-info/INSTALLER        |    1 +
 .../LICENSE                                   |    0
 .../LICENSE.APACHE                            |    0
 .../LICENSE.BSD                               |    0
 .../METADATA                                  |    6 +-
 .../_vendor/packaging-24.1.dist-info/RECORD   |   37 +
 .../packaging-24.1.dist-info/REQUESTED        |    0
 .../WHEEL                                     |    0
 setuptools/_vendor/packaging/__init__.py      |    2 +-
 setuptools/_vendor/packaging/_elffile.py      |    8 +-
 setuptools/_vendor/packaging/_manylinux.py    |   22 +-
 setuptools/_vendor/packaging/_musllinux.py    |   10 +-
 setuptools/_vendor/packaging/_parser.py       |   26 +-
 setuptools/_vendor/packaging/_tokenizer.py    |   18 +-
 setuptools/_vendor/packaging/markers.py       |  115 +-
 setuptools/_vendor/packaging/metadata.py      |  153 +-
 setuptools/_vendor/packaging/requirements.py  |    9 +-
 setuptools/_vendor/packaging/specifiers.py    |   56 +-
 setuptools/_vendor/packaging/tags.py          |   43 +-
 setuptools/_vendor/packaging/utils.py         |   10 +-
 setuptools/_vendor/packaging/version.py       |   54 +-
 .../typeguard-4.3.0.dist-info/INSTALLER       |    1 +
 .../_vendor/typeguard-4.3.0.dist-info/LICENSE |   19 +
 .../typeguard-4.3.0.dist-info/METADATA        |   81 +
 .../_vendor/typeguard-4.3.0.dist-info/RECORD  |   34 +
 .../_vendor/typeguard-4.3.0.dist-info/WHEEL   |    5 +
 .../entry_points.txt                          |    2 +
 .../typeguard-4.3.0.dist-info/top_level.txt   |    1 +
 setuptools/_vendor/typeguard/__init__.py      |   48 +
 setuptools/_vendor/typeguard/_checkers.py     |  993 ++++
 setuptools/_vendor/typeguard/_config.py       |  108 +
 setuptools/_vendor/typeguard/_decorators.py   |  235 +
 setuptools/_vendor/typeguard/_exceptions.py   |   42 +
 setuptools/_vendor/typeguard/_functions.py    |  308 ++
 setuptools/_vendor/typeguard/_importhook.py   |  213 +
 setuptools/_vendor/typeguard/_memo.py         |   48 +
 .../_vendor/typeguard/_pytest_plugin.py       |  127 +
 setuptools/_vendor/typeguard/_suppression.py  |   86 +
 setuptools/_vendor/typeguard/_transformer.py  | 1229 +++++
 .../_vendor/typeguard/_union_transformer.py   |   55 +
 setuptools/_vendor/typeguard/_utils.py        |  173 +
 setuptools/_vendor/typeguard/py.typed         |    0
 .../INSTALLER                                 |    1 +
 .../LICENSE                                   |  279 ++
 .../METADATA                                  |   67 +
 .../typing_extensions-4.12.2.dist-info/RECORD |    7 +
 .../typing_extensions-4.12.2.dist-info/WHEEL  |    4 +
 setuptools/_vendor/typing_extensions.py       | 3641 +++++++++++++++
 .../_vendor/wheel-0.43.0.dist-info/RECORD     |  126 +-
 setuptools/_vendor/wheel/__main__.py          |   23 +
 .../_vendor/wheel/_setuptools_logging.py      |   26 +
 setuptools/_vendor/wheel/bdist_wheel.py       |  595 +++
 setuptools/_vendor/wheel/cli/__init__.py      |  155 +
 setuptools/_vendor/wheel/cli/convert.py       |  273 ++
 setuptools/_vendor/wheel/cli/pack.py          |   85 +
 setuptools/_vendor/wheel/cli/tags.py          |  139 +
 setuptools/_vendor/wheel/cli/unpack.py        |   30 +
 setuptools/_vendor/wheel/metadata.py          |    2 +-
 setuptools/_vendor/wheel/vendored/__init__.py |    0
 .../wheel/vendored/packaging/__init__.py      |    0
 .../wheel/vendored/packaging/_elffile.py      |  108 +
 .../wheel/vendored/packaging/_manylinux.py    |  260 ++
 .../wheel/vendored/packaging/_musllinux.py    |   83 +
 .../wheel/vendored/packaging/_parser.py       |  356 ++
 .../wheel/vendored/packaging/_structures.py   |   61 +
 .../wheel/vendored/packaging/_tokenizer.py    |  192 +
 .../wheel/vendored/packaging/markers.py       |  253 ++
 .../wheel/vendored/packaging/requirements.py  |   90 +
 .../wheel/vendored/packaging/specifiers.py    | 1011 +++++
 .../_vendor/wheel/vendored/packaging/tags.py  |  571 +++
 .../_vendor/wheel/vendored/packaging/utils.py |  172 +
 .../wheel/vendored/packaging/version.py       |  561 +++
 setuptools/_vendor/wheel/vendored/vendor.txt  |    1 +
 setuptools/_vendor/wheel/wheelfile.py         |    7 +-
 .../_vendor/zipp-3.19.2.dist-info/INSTALLER   |    1 +
 .../LICENSE}                                  |   18 +-
 .../_vendor/zipp-3.19.2.dist-info/METADATA    |  102 +
 .../_vendor/zipp-3.19.2.dist-info/RECORD      |   15 +
 .../_vendor/zipp-3.19.2.dist-info/REQUESTED   |    0
 .../_vendor/zipp-3.19.2.dist-info/WHEEL       |    5 +
 .../top_level.txt                             |    0
 .../_vendor/zipp-3.7.0.dist-info/METADATA     |   58 -
 .../_vendor/zipp-3.7.0.dist-info/RECORD       |    9 -
 setuptools/_vendor/zipp-3.7.0.dist-info/WHEEL |    5 -
 .../_vendor/{zipp.py => zipp/__init__.py}     |  248 +-
 setuptools/_vendor/zipp/compat/__init__.py    |    0
 setuptools/_vendor/zipp/compat/py310.py       |   11 +
 setuptools/_vendor/zipp/glob.py               |  106 +
 setuptools/extern/__init__.py                 |    1 +
 234 files changed, 23877 insertions(+), 2446 deletions(-)
 rename setuptools/_vendor/{backports.tarfile-1.0.0.dist-info => autocommand-2.2.2.dist-info}/INSTALLER (100%)
 create mode 100644 setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
 create mode 100644 setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA
 create mode 100644 setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD
 rename setuptools/_vendor/{importlib_metadata-6.0.0.dist-info => autocommand-2.2.2.dist-info}/WHEEL (100%)
 create mode 100644 setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt
 create mode 100644 setuptools/_vendor/autocommand/__init__.py
 create mode 100644 setuptools/_vendor/autocommand/autoasync.py
 create mode 100644 setuptools/_vendor/autocommand/autocommand.py
 create mode 100644 setuptools/_vendor/autocommand/automain.py
 create mode 100644 setuptools/_vendor/autocommand/autoparse.py
 create mode 100644 setuptools/_vendor/autocommand/errors.py
 delete mode 100644 setuptools/_vendor/backports.tarfile-1.0.0.dist-info/RECORD
 rename setuptools/_vendor/{importlib_metadata-6.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/LICENSE (100%)
 rename setuptools/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/METADATA (83%)
 create mode 100644 setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
 rename setuptools/_vendor/{importlib_metadata-6.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/REQUESTED (100%)
 rename setuptools/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/WHEEL (100%)
 rename setuptools/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/top_level.txt (100%)
 rename setuptools/_vendor/backports/{tarfile.py => tarfile/__init__.py} (96%)
 create mode 100644 setuptools/_vendor/backports/tarfile/__main__.py
 rename setuptools/_vendor/{ => backports/tarfile/compat}/__init__.py (100%)
 create mode 100644 setuptools/_vendor/backports/tarfile/compat/py38.py
 delete mode 100644 setuptools/_vendor/importlib_metadata-6.0.0.dist-info/RECORD
 rename setuptools/_vendor/{importlib_resources-5.10.2.dist-info => importlib_metadata-8.0.0.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{importlib_metadata-6.0.0.dist-info => importlib_metadata-8.0.0.dist-info}/LICENSE (100%)
 rename setuptools/_vendor/{importlib_metadata-6.0.0.dist-info => importlib_metadata-8.0.0.dist-info}/METADATA (58%)
 create mode 100644 setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD
 rename setuptools/_vendor/{importlib_resources-5.10.2.dist-info => importlib_metadata-8.0.0.dist-info}/REQUESTED (100%)
 rename setuptools/_vendor/{importlib_resources-5.10.2.dist-info => importlib_metadata-8.0.0.dist-info}/WHEEL (65%)
 rename setuptools/_vendor/{importlib_metadata-6.0.0.dist-info => importlib_metadata-8.0.0.dist-info}/top_level.txt (100%)
 rename setuptools/_vendor/{importlib_resources/tests/zipdata01 => importlib_metadata/compat}/__init__.py (100%)
 create mode 100644 setuptools/_vendor/importlib_metadata/compat/py311.py
 rename setuptools/_vendor/importlib_metadata/{_py39compat.py => compat/py39.py} (82%)
 create mode 100644 setuptools/_vendor/importlib_metadata/diagnose.py
 delete mode 100644 setuptools/_vendor/importlib_resources-5.10.2.dist-info/RECORD
 rename setuptools/_vendor/{jaraco.functools-4.0.0.dist-info => importlib_resources-6.4.0.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{importlib_resources-5.10.2.dist-info => importlib_resources-6.4.0.dist-info}/LICENSE (100%)
 rename setuptools/_vendor/{importlib_resources-5.10.2.dist-info => importlib_resources-6.4.0.dist-info}/METADATA (67%)
 create mode 100644 setuptools/_vendor/importlib_resources-6.4.0.dist-info/RECORD
 rename setuptools/_vendor/{jaraco.text-3.7.0.dist-info => importlib_resources-6.4.0.dist-info}/REQUESTED (100%)
 rename setuptools/_vendor/{ordered_set-3.1.1.dist-info => importlib_resources-6.4.0.dist-info}/WHEEL (83%)
 rename setuptools/_vendor/{importlib_resources-5.10.2.dist-info => importlib_resources-6.4.0.dist-info}/top_level.txt (100%)
 delete mode 100644 setuptools/_vendor/importlib_resources/_compat.py
 delete mode 100644 setuptools/_vendor/importlib_resources/_legacy.py
 rename setuptools/_vendor/importlib_resources/{tests/zipdata02 => compat}/__init__.py (100%)
 create mode 100644 setuptools/_vendor/importlib_resources/compat/py38.py
 create mode 100644 setuptools/_vendor/importlib_resources/compat/py39.py
 create mode 100644 setuptools/_vendor/importlib_resources/functional.py
 rename setuptools/_vendor/{jaraco => importlib_resources/future}/__init__.py (100%)
 create mode 100644 setuptools/_vendor/importlib_resources/future/adapters.py
 delete mode 100644 setuptools/_vendor/importlib_resources/tests/_compat.py
 rename setuptools/_vendor/{more_itertools-8.8.0.dist-info/REQUESTED => importlib_resources/tests/compat/__init__.py} (100%)
 create mode 100644 setuptools/_vendor/importlib_resources/tests/compat/py312.py
 create mode 100644 setuptools/_vendor/importlib_resources/tests/compat/py39.py
 create mode 100644 setuptools/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
 create mode 100644 setuptools/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
 create mode 100644 setuptools/_vendor/importlib_resources/tests/test_custom.py
 create mode 100644 setuptools/_vendor/importlib_resources/tests/test_functional.py
 delete mode 100644 setuptools/_vendor/importlib_resources/tests/update-zips.py
 create mode 100644 setuptools/_vendor/importlib_resources/tests/zip.py
 delete mode 100644 setuptools/_vendor/importlib_resources/tests/zipdata01/ziptestdata.zip
 delete mode 100644 setuptools/_vendor/importlib_resources/tests/zipdata02/ziptestdata.zip
 rename setuptools/_vendor/{jaraco.text-3.7.0.dist-info => inflect-7.3.1.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{jaraco.functools-4.0.0.dist-info => inflect-7.3.1.dist-info}/LICENSE (100%)
 create mode 100644 setuptools/_vendor/inflect-7.3.1.dist-info/METADATA
 create mode 100644 setuptools/_vendor/inflect-7.3.1.dist-info/RECORD
 rename setuptools/_vendor/{jaraco.functools-4.0.0.dist-info => inflect-7.3.1.dist-info}/WHEEL (65%)
 create mode 100644 setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt
 create mode 100644 setuptools/_vendor/inflect/__init__.py
 rename setuptools/_vendor/{ordered_set-3.1.1.dist-info/REQUESTED => inflect/compat/__init__.py} (100%)
 create mode 100644 setuptools/_vendor/inflect/compat/py38.py
 rename setuptools/_vendor/{packaging-24.0.dist-info/REQUESTED => inflect/py.typed} (100%)
 delete mode 100644 setuptools/_vendor/jaraco.functools-4.0.0.dist-info/RECORD
 rename setuptools/_vendor/{more_itertools-8.8.0.dist-info => jaraco.functools-4.0.1.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{jaraco.text-3.7.0.dist-info => jaraco.functools-4.0.1.dist-info}/LICENSE (97%)
 rename setuptools/_vendor/{jaraco.functools-4.0.0.dist-info => jaraco.functools-4.0.1.dist-info}/METADATA (78%)
 create mode 100644 setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
 rename setuptools/_vendor/{jaraco.text-3.7.0.dist-info => jaraco.functools-4.0.1.dist-info}/WHEEL (65%)
 rename setuptools/_vendor/{jaraco.functools-4.0.0.dist-info => jaraco.functools-4.0.1.dist-info}/top_level.txt (100%)
 rename setuptools/_vendor/{ordered_set-3.1.1.dist-info => jaraco.text-3.12.1.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{zipp-3.7.0.dist-info => jaraco.text-3.12.1.dist-info}/LICENSE (97%)
 create mode 100644 setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA
 create mode 100644 setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD
 rename setuptools/_vendor/{zipp-3.7.0.dist-info => jaraco.text-3.12.1.dist-info}/REQUESTED (100%)
 rename setuptools/_vendor/{more_itertools-8.8.0.dist-info => jaraco.text-3.12.1.dist-info}/WHEEL (65%)
 rename setuptools/_vendor/{jaraco.text-3.7.0.dist-info => jaraco.text-3.12.1.dist-info}/top_level.txt (100%)
 delete mode 100644 setuptools/_vendor/jaraco.text-3.7.0.dist-info/METADATA
 delete mode 100644 setuptools/_vendor/jaraco.text-3.7.0.dist-info/RECORD
 create mode 100644 setuptools/_vendor/jaraco/text/layouts.py
 create mode 100644 setuptools/_vendor/jaraco/text/show-newlines.py
 create mode 100644 setuptools/_vendor/jaraco/text/strip-prefix.py
 create mode 100644 setuptools/_vendor/jaraco/text/to-dvorak.py
 create mode 100644 setuptools/_vendor/jaraco/text/to-qwerty.py
 rename setuptools/_vendor/{packaging-24.0.dist-info => more_itertools-10.3.0.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{more_itertools-8.8.0.dist-info => more_itertools-10.3.0.dist-info}/LICENSE (100%)
 rename setuptools/_vendor/{more_itertools-8.8.0.dist-info => more_itertools-10.3.0.dist-info}/METADATA (60%)
 create mode 100644 setuptools/_vendor/more_itertools-10.3.0.dist-info/RECORD
 create mode 100644 setuptools/_vendor/more_itertools-10.3.0.dist-info/REQUESTED
 create mode 100644 setuptools/_vendor/more_itertools-10.3.0.dist-info/WHEEL
 delete mode 100644 setuptools/_vendor/more_itertools-8.8.0.dist-info/RECORD
 delete mode 100644 setuptools/_vendor/more_itertools-8.8.0.dist-info/top_level.txt
 mode change 100644 => 100755 setuptools/_vendor/more_itertools/more.py
 delete mode 100644 setuptools/_vendor/ordered_set-3.1.1.dist-info/RECORD
 delete mode 100644 setuptools/_vendor/ordered_set-3.1.1.dist-info/top_level.txt
 rename setuptools/_vendor/{zipp-3.7.0.dist-info => ordered_set-4.1.0.dist-info}/INSTALLER (100%)
 rename setuptools/_vendor/{ordered_set-3.1.1.dist-info => ordered_set-4.1.0.dist-info}/METADATA (74%)
 create mode 100644 setuptools/_vendor/ordered_set-4.1.0.dist-info/RECORD
 create mode 100644 setuptools/_vendor/ordered_set-4.1.0.dist-info/REQUESTED
 create mode 100644 setuptools/_vendor/ordered_set-4.1.0.dist-info/WHEEL
 rename setuptools/_vendor/{ordered_set.py => ordered_set/__init__.py} (72%)
 create mode 100644 setuptools/_vendor/ordered_set/py.typed
 delete mode 100644 setuptools/_vendor/packaging-24.0.dist-info/RECORD
 create mode 100644 setuptools/_vendor/packaging-24.1.dist-info/INSTALLER
 rename setuptools/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/LICENSE (100%)
 rename setuptools/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/LICENSE.APACHE (100%)
 rename setuptools/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/LICENSE.BSD (100%)
 rename setuptools/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/METADATA (97%)
 create mode 100644 setuptools/_vendor/packaging-24.1.dist-info/RECORD
 create mode 100644 setuptools/_vendor/packaging-24.1.dist-info/REQUESTED
 rename setuptools/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/WHEEL (100%)
 create mode 100644 setuptools/_vendor/typeguard-4.3.0.dist-info/INSTALLER
 create mode 100644 setuptools/_vendor/typeguard-4.3.0.dist-info/LICENSE
 create mode 100644 setuptools/_vendor/typeguard-4.3.0.dist-info/METADATA
 create mode 100644 setuptools/_vendor/typeguard-4.3.0.dist-info/RECORD
 create mode 100644 setuptools/_vendor/typeguard-4.3.0.dist-info/WHEEL
 create mode 100644 setuptools/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
 create mode 100644 setuptools/_vendor/typeguard-4.3.0.dist-info/top_level.txt
 create mode 100644 setuptools/_vendor/typeguard/__init__.py
 create mode 100644 setuptools/_vendor/typeguard/_checkers.py
 create mode 100644 setuptools/_vendor/typeguard/_config.py
 create mode 100644 setuptools/_vendor/typeguard/_decorators.py
 create mode 100644 setuptools/_vendor/typeguard/_exceptions.py
 create mode 100644 setuptools/_vendor/typeguard/_functions.py
 create mode 100644 setuptools/_vendor/typeguard/_importhook.py
 create mode 100644 setuptools/_vendor/typeguard/_memo.py
 create mode 100644 setuptools/_vendor/typeguard/_pytest_plugin.py
 create mode 100644 setuptools/_vendor/typeguard/_suppression.py
 create mode 100644 setuptools/_vendor/typeguard/_transformer.py
 create mode 100644 setuptools/_vendor/typeguard/_union_transformer.py
 create mode 100644 setuptools/_vendor/typeguard/_utils.py
 create mode 100644 setuptools/_vendor/typeguard/py.typed
 create mode 100644 setuptools/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
 create mode 100644 setuptools/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
 create mode 100644 setuptools/_vendor/typing_extensions-4.12.2.dist-info/METADATA
 create mode 100644 setuptools/_vendor/typing_extensions-4.12.2.dist-info/RECORD
 create mode 100644 setuptools/_vendor/typing_extensions-4.12.2.dist-info/WHEEL
 create mode 100644 setuptools/_vendor/typing_extensions.py
 create mode 100644 setuptools/_vendor/wheel/__main__.py
 create mode 100644 setuptools/_vendor/wheel/_setuptools_logging.py
 create mode 100644 setuptools/_vendor/wheel/bdist_wheel.py
 create mode 100644 setuptools/_vendor/wheel/cli/__init__.py
 create mode 100644 setuptools/_vendor/wheel/cli/convert.py
 create mode 100644 setuptools/_vendor/wheel/cli/pack.py
 create mode 100644 setuptools/_vendor/wheel/cli/tags.py
 create mode 100644 setuptools/_vendor/wheel/cli/unpack.py
 create mode 100644 setuptools/_vendor/wheel/vendored/__init__.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/__init__.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/_elffile.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/_manylinux.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/_musllinux.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/_parser.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/_structures.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/markers.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/requirements.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/specifiers.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/tags.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/utils.py
 create mode 100644 setuptools/_vendor/wheel/vendored/packaging/version.py
 create mode 100644 setuptools/_vendor/wheel/vendored/vendor.txt
 create mode 100644 setuptools/_vendor/zipp-3.19.2.dist-info/INSTALLER
 rename setuptools/_vendor/{ordered_set-3.1.1.dist-info/MIT-LICENSE => zipp-3.19.2.dist-info/LICENSE} (58%)
 create mode 100644 setuptools/_vendor/zipp-3.19.2.dist-info/METADATA
 create mode 100644 setuptools/_vendor/zipp-3.19.2.dist-info/RECORD
 create mode 100644 setuptools/_vendor/zipp-3.19.2.dist-info/REQUESTED
 create mode 100644 setuptools/_vendor/zipp-3.19.2.dist-info/WHEEL
 rename setuptools/_vendor/{zipp-3.7.0.dist-info => zipp-3.19.2.dist-info}/top_level.txt (100%)
 delete mode 100644 setuptools/_vendor/zipp-3.7.0.dist-info/METADATA
 delete mode 100644 setuptools/_vendor/zipp-3.7.0.dist-info/RECORD
 delete mode 100644 setuptools/_vendor/zipp-3.7.0.dist-info/WHEEL
 rename setuptools/_vendor/{zipp.py => zipp/__init__.py} (52%)
 create mode 100644 setuptools/_vendor/zipp/compat/__init__.py
 create mode 100644 setuptools/_vendor/zipp/compat/py310.py
 create mode 100644 setuptools/_vendor/zipp/glob.py

diff --git a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/INSTALLER b/setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/backports.tarfile-1.0.0.dist-info/INSTALLER
rename to setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER
diff --git a/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE b/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
new file mode 100644
index 0000000000..b49c3af060
--- /dev/null
+++ b/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
@@ -0,0 +1,166 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. 
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA b/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA
new file mode 100644
index 0000000000..32214fb440
--- /dev/null
+++ b/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA
@@ -0,0 +1,420 @@
+Metadata-Version: 2.1
+Name: autocommand
+Version: 2.2.2
+Summary: A library to create a command-line program from a function
+Home-page: https://github.com/Lucretiel/autocommand
+Author: Nathan West
+License: LGPLv3
+Project-URL: Homepage, https://github.com/Lucretiel/autocommand
+Project-URL: Bug Tracker, https://github.com/Lucretiel/autocommand/issues
+Platform: any
+Classifier: Development Status :: 6 - Mature
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >=3.7
+Description-Content-Type: text/markdown
+License-File: LICENSE
+
+[![PyPI version](https://badge.fury.io/py/autocommand.svg)](https://badge.fury.io/py/autocommand)
+
+# autocommand
+
+A library to automatically generate and run simple argparse parsers from function signatures.
+
+## Installation
+
+Autocommand is installed via pip:
+
+```
+$ pip install autocommand
+```
+
+## Usage
+
+Autocommand turns a function into a command-line program. It converts the function's parameter signature into command-line arguments, and automatically runs the function if the module was called as `__main__`. In effect, it lets your create a smart main function.
+
+```python
+from autocommand import autocommand
+
+# This program takes exactly one argument and echos it.
+@autocommand(__name__)
+def echo(thing):
+    print(thing)
+```
+
+```
+$ python echo.py hello
+hello
+$ python echo.py -h
+usage: echo [-h] thing
+
+positional arguments:
+  thing
+
+optional arguments:
+  -h, --help  show this help message and exit
+$ python echo.py hello world  # too many arguments
+usage: echo.py [-h] thing
+echo.py: error: unrecognized arguments: world
+```
+
+As you can see, autocommand converts the signature of the function into an argument spec. When you run the file as a program, autocommand collects the command-line arguments and turns them into function arguments. The function is executed with these arguments, and then the program exits with the return value of the function, via `sys.exit`. Autocommand also automatically creates a usage message, which can be invoked with `-h` or `--help`, and automatically prints an error message when provided with invalid arguments.
+
+### Types
+
+You can use a type annotation to give an argument a type. Any type (or in fact any callable) that returns an object when given a string argument can be used, though there are a few special cases that are described later.
+
+```python
+@autocommand(__name__)
+def net_client(host, port: int):
+    ...
+```
+
+Autocommand will catch `TypeErrors` raised by the type during argument parsing, so you can supply a callable and do some basic argument validation as well.
+
+### Trailing Arguments
+
+You can add a `*args` parameter to your function to give it trailing arguments. The command will collect 0 or more trailing arguments and supply them to `args` as a tuple. If a type annotation is supplied, the type is applied to each argument.
+
+```python
+# Write the contents of each file, one by one
+@autocommand(__name__)
+def cat(*files):
+    for filename in files:
+        with open(filename) as file:
+            for line in file:
+                print(line.rstrip())
+```
+
+```
+$ python cat.py -h
+usage: ipython [-h] [file [file ...]]
+
+positional arguments:
+  file
+
+optional arguments:
+  -h, --help  show this help message and exit
+```
+
+### Options
+
+To create `--option` switches, just assign a default. Autocommand will automatically create `--long` and `-s`hort switches.
+
+```python
+@autocommand(__name__)
+def do_with_config(argument, config='~/foo.conf'):
+    pass
+```
+
+```
+$ python example.py -h
+usage: example.py [-h] [-c CONFIG] argument
+
+positional arguments:
+  argument
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -c CONFIG, --config CONFIG
+```
+
+The option's type is automatically deduced from the default, unless one is explicitly given in an annotation:
+
+```python
+@autocommand(__name__)
+def http_connect(host, port=80):
+    print('{}:{}'.format(host, port))
+```
+
+```
+$ python http.py -h
+usage: http.py [-h] [-p PORT] host
+
+positional arguments:
+  host
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -p PORT, --port PORT
+$ python http.py localhost
+localhost:80
+$ python http.py localhost -p 8080
+localhost:8080
+$ python http.py localhost -p blah
+usage: http.py [-h] [-p PORT] host
+http.py: error: argument -p/--port: invalid int value: 'blah'
+```
+
+#### None
+
+If an option is given a default value of `None`, it reads in a value as normal, but supplies `None` if the option isn't provided.
+
+#### Switches
+
+If an argument is given a default value of `True` or `False`, or
+given an explicit `bool` type, it becomes an option switch.
+
+```python
+    @autocommand(__name__)
+    def example(verbose=False, quiet=False):
+        pass
+```
+
+```
+$ python example.py -h
+usage: example.py [-h] [-v] [-q]
+
+optional arguments:
+  -h, --help     show this help message and exit
+  -v, --verbose
+  -q, --quiet
+```
+
+Autocommand attempts to do the "correct thing" in these cases- if the default is `True`, then supplying the switch makes the argument `False`; if the type is `bool` and the default is some other `True` value, then supplying the switch makes the argument `False`, while not supplying the switch makes the argument the default value.
+
+Autocommand also supports the creation of switch inverters. Pass `add_nos=True` to `autocommand` to enable this.
+
+```
+    @autocommand(__name__, add_nos=True)
+    def example(verbose=False):
+        pass
+```
+
+```
+$ python example.py -h
+usage: ipython [-h] [-v] [--no-verbose]
+
+optional arguments:
+  -h, --help     show this help message and exit
+  -v, --verbose
+  --no-verbose
+```
+
+Using the `--no-` version of a switch will pass the opposite value in as a function argument. If multiple switches are present, the last one takes precedence.
+
+#### Files
+
+If the default value is a file object, such as `sys.stdout`, then autocommand just looks for a string, for a file path. It doesn't do any special checking on the string, though (such as checking if the file exists); it's better to let the client decide how to handle errors in this case. Instead, it provides a special context manager called `smart_open`, which behaves exactly like `open` if a filename or other openable type is provided, but also lets you use already open files:
+
+```python
+from autocommand import autocommand, smart_open
+import sys
+
+# Write the contents of stdin, or a file, to stdout
+@autocommand(__name__)
+def write_out(infile=sys.stdin):
+    with smart_open(infile) as f:
+        for line in f:
+            print(line.rstrip())
+    # If a file was opened, it is closed here. If it was just stdin, it is untouched.
+```
+
+```
+$ echo "Hello World!" | python write_out.py | tee hello.txt
+Hello World!
+$ python write_out.py --infile hello.txt
+Hello World!
+```
+
+### Descriptions and docstrings
+
+The `autocommand` decorator accepts `description` and `epilog` kwargs, corresponding to the `description `_ and `epilog `_ of the `ArgumentParser`. If no description is given, but the decorated function has a docstring, then it is taken as the `description` for the `ArgumentParser`. You can also provide both the description and epilog in the docstring by splitting it into two sections with 4 or more - characters.
+
+```python
+@autocommand(__name__)
+def copy(infile=sys.stdin, outfile=sys.stdout):
+    '''
+    Copy an the contents of a file (or stdin) to another file (or stdout)
+    ----------
+    Some extra documentation in the epilog
+    '''
+    with smart_open(infile) as istr:
+        with smart_open(outfile, 'w') as ostr:
+            for line in istr:
+                ostr.write(line)
+```
+
+```
+$ python copy.py -h
+usage: copy.py [-h] [-i INFILE] [-o OUTFILE]
+
+Copy an the contents of a file (or stdin) to another file (or stdout)
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -i INFILE, --infile INFILE
+  -o OUTFILE, --outfile OUTFILE
+
+Some extra documentation in the epilog
+$ echo "Hello World" | python copy.py --outfile hello.txt
+$ python copy.py --infile hello.txt --outfile hello2.txt
+$ python copy.py --infile hello2.txt
+Hello World
+```
+
+### Parameter descriptions
+
+You can also attach description text to individual parameters in the annotation. To attach both a type and a description, supply them both in any order in a tuple
+
+```python
+@autocommand(__name__)
+def copy_net(
+    infile: 'The name of the file to send',
+    host: 'The host to send the file to',
+    port: (int, 'The port to connect to')):
+
+    '''
+    Copy a file over raw TCP to a remote destination.
+    '''
+    # Left as an exercise to the reader
+```
+
+### Decorators and wrappers
+
+Autocommand automatically follows wrapper chains created by `@functools.wraps`. This means that you can apply other wrapping decorators to your main function, and autocommand will still correctly detect the signature.
+
+```python
+from functools import wraps
+from autocommand import autocommand
+
+def print_yielded(func):
+    '''
+    Convert a generator into a function that prints all yielded elements
+    '''
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        for thing in func(*args, **kwargs):
+            print(thing)
+    return wrapper
+
+@autocommand(__name__,
+    description= 'Print all the values from START to STOP, inclusive, in steps of STEP',
+    epilog=      'STOP and STEP default to 1')
+@print_yielded
+def seq(stop, start=1, step=1):
+    for i in range(start, stop + 1, step):
+        yield i
+```
+
+```
+$ seq.py -h
+usage: seq.py [-h] [-s START] [-S STEP] stop
+
+Print all the values from START to STOP, inclusive, in steps of STEP
+
+positional arguments:
+  stop
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -s START, --start START
+  -S STEP, --step STEP
+
+STOP and STEP default to 1
+```
+
+Even though autocommand is being applied to the `wrapper` returned by `print_yielded`, it still retreives the signature of the underlying `seq` function to create the argument parsing.
+
+### Custom Parser
+
+While autocommand's automatic parser generator is a powerful convenience, it doesn't cover all of the different features that argparse provides. If you need these features, you can provide your own parser as a kwarg to `autocommand`:
+
+```python
+from argparse import ArgumentParser
+from autocommand import autocommand
+
+parser = ArgumentParser()
+# autocommand can't do optional positonal parameters
+parser.add_argument('arg', nargs='?')
+# or mutually exclusive options
+group = parser.add_mutually_exclusive_group()
+group.add_argument('-v', '--verbose', action='store_true')
+group.add_argument('-q', '--quiet', action='store_true')
+
+@autocommand(__name__, parser=parser)
+def main(arg, verbose, quiet):
+    print(arg, verbose, quiet)
+```
+
+```
+$ python parser.py -h
+usage: write_file.py [-h] [-v | -q] [arg]
+
+positional arguments:
+  arg
+
+optional arguments:
+  -h, --help     show this help message and exit
+  -v, --verbose
+  -q, --quiet
+$ python parser.py
+None False False
+$ python parser.py hello
+hello False False
+$ python parser.py -v
+None True False
+$ python parser.py -q
+None False True
+$ python parser.py -vq
+usage: parser.py [-h] [-v | -q] [arg]
+parser.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
+```
+
+Any parser should work fine, so long as each of the parser's arguments has a corresponding parameter in the decorated main function. The order of parameters doesn't matter, as long as they are all present. Note that when using a custom parser, autocommand doesn't modify the parser or the retrieved arguments. This means that no description/epilog will be added, and the function's type annotations and defaults (if present) will be ignored.
+
+## Testing and Library use
+
+The decorated function is only called and exited from if the first argument to `autocommand` is `'__main__'` or `True`. If it is neither of these values, or no argument is given, then a new main function is created by the decorator. This function has the signature `main(argv=None)`, and is intended to be called with arguments as if via `main(sys.argv[1:])`. The function has the attributes `parser` and `main`, which are the generated `ArgumentParser` and the original main function that was decorated. This is to facilitate testing and library use of your main. Calling the function triggers a `parse_args()` with the supplied arguments, and returns the result of the main function. Note that, while it returns instead of calling `sys.exit`, the `parse_args()` function will raise a `SystemExit` in the event of a parsing error or `-h/--help` argument.
+
+```python
+    @autocommand()
+    def test_prog(arg1, arg2: int, quiet=False, verbose=False):
+        if not quiet:
+            print(arg1, arg2)
+            if verbose:
+                print("LOUD NOISES")
+
+        return 0
+
+    print(test_prog(['-v', 'hello', '80']))
+```
+
+```
+$ python test_prog.py
+hello 80
+LOUD NOISES
+0
+```
+
+If the function is called with no arguments, `sys.argv[1:]` is used. This is to allow the autocommand function to be used as a setuptools entry point.
+
+## Exceptions and limitations
+
+- There are a few possible exceptions that `autocommand` can raise. All of them derive from `autocommand.AutocommandError`.
+
+  - If an invalid annotation is given (that is, it isn't a `type`, `str`, `(type, str)`, or `(str, type)`, an `AnnotationError` is raised. The `type` may be any callable, as described in the `Types`_ section.
+  - If the function has a `**kwargs` parameter, a `KWargError` is raised.
+  - If, somehow, the function has a positional-only parameter, a `PositionalArgError` is raised. This means that the argument doesn't have a name, which is currently not possible with a plain `def` or `lambda`, though many built-in functions have this kind of parameter.
+
+- There are a few argparse features that are not supported by autocommand.
+
+  - It isn't possible to have an optional positional argument (as opposed to a `--option`). POSIX thinks this is bad form anyway.
+  - It isn't possible to have mutually exclusive arguments or options
+  - It isn't possible to have subcommands or subparsers, though I'm working on a few solutions involving classes or nested function definitions to allow this.
+
+## Development
+
+Autocommand cannot be important from the project root; this is to enforce separation of concerns and prevent accidental importing of `setup.py` or tests. To develop, install the project in editable mode:
+
+```
+$ python setup.py develop
+```
+
+This will create a link to the source files in the deployment directory, so that any source changes are reflected when it is imported.
diff --git a/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD b/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD
new file mode 100644
index 0000000000..e6e12ea51e
--- /dev/null
+++ b/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD
@@ -0,0 +1,18 @@
+autocommand-2.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634
+autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006
+autocommand-2.2.2.dist-info/RECORD,,
+autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
+autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12
+autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037
+autocommand/__pycache__/__init__.cpython-312.pyc,,
+autocommand/__pycache__/autoasync.cpython-312.pyc,,
+autocommand/__pycache__/autocommand.cpython-312.pyc,,
+autocommand/__pycache__/automain.cpython-312.pyc,,
+autocommand/__pycache__/autoparse.cpython-312.pyc,,
+autocommand/__pycache__/errors.cpython-312.pyc,,
+autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680
+autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505
+autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076
+autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642
+autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886
diff --git a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/WHEEL b/setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL
similarity index 100%
rename from setuptools/_vendor/importlib_metadata-6.0.0.dist-info/WHEEL
rename to setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL
diff --git a/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt b/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt
new file mode 100644
index 0000000000..dda5158ff6
--- /dev/null
+++ b/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt
@@ -0,0 +1 @@
+autocommand
diff --git a/setuptools/_vendor/autocommand/__init__.py b/setuptools/_vendor/autocommand/__init__.py
new file mode 100644
index 0000000000..73fbfca6b3
--- /dev/null
+++ b/setuptools/_vendor/autocommand/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2014-2016 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+# flake8 flags all these imports as unused, hence the NOQAs everywhere.
+
+from .automain import automain  # NOQA
+from .autoparse import autoparse, smart_open  # NOQA
+from .autocommand import autocommand  # NOQA
+
+try:
+    from .autoasync import autoasync  # NOQA
+except ImportError:  # pragma: no cover
+    pass
diff --git a/setuptools/_vendor/autocommand/autoasync.py b/setuptools/_vendor/autocommand/autoasync.py
new file mode 100644
index 0000000000..688f7e0554
--- /dev/null
+++ b/setuptools/_vendor/autocommand/autoasync.py
@@ -0,0 +1,142 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+from asyncio import get_event_loop, iscoroutine
+from functools import wraps
+from inspect import signature
+
+
+async def _run_forever_coro(coro, args, kwargs, loop):
+    '''
+    This helper function launches an async main function that was tagged with
+    forever=True. There are two possibilities:
+
+    - The function is a normal function, which handles initializing the event
+      loop, which is then run forever
+    - The function is a coroutine, which needs to be scheduled in the event
+      loop, which is then run forever
+      - There is also the possibility that the function is a normal function
+        wrapping a coroutine function
+
+    The function is therefore called unconditionally and scheduled in the event
+    loop if the return value is a coroutine object.
+
+    The reason this is a separate function is to make absolutely sure that all
+    the objects created are garbage collected after all is said and done; we
+    do this to ensure that any exceptions raised in the tasks are collected
+    ASAP.
+    '''
+
+    # Personal note: I consider this an antipattern, as it relies on the use of
+    # unowned resources. The setup function dumps some stuff into the event
+    # loop where it just whirls in the ether without a well defined owner or
+    # lifetime. For this reason, there's a good chance I'll remove the
+    # forever=True feature from autoasync at some point in the future.
+    thing = coro(*args, **kwargs)
+    if iscoroutine(thing):
+        await thing
+
+
+def autoasync(coro=None, *, loop=None, forever=False, pass_loop=False):
+    '''
+    Convert an asyncio coroutine into a function which, when called, is
+    evaluted in an event loop, and the return value returned. This is intented
+    to make it easy to write entry points into asyncio coroutines, which
+    otherwise need to be explictly evaluted with an event loop's
+    run_until_complete.
+
+    If `loop` is given, it is used as the event loop to run the coro in. If it
+    is None (the default), the loop is retreived using asyncio.get_event_loop.
+    This call is defered until the decorated function is called, so that
+    callers can install custom event loops or event loop policies after
+    @autoasync is applied.
+
+    If `forever` is True, the loop is run forever after the decorated coroutine
+    is finished. Use this for servers created with asyncio.start_server and the
+    like.
+
+    If `pass_loop` is True, the event loop object is passed into the coroutine
+    as the `loop` kwarg when the wrapper function is called. In this case, the
+    wrapper function's __signature__ is updated to remove this parameter, so
+    that autoparse can still be used on it without generating a parameter for
+    `loop`.
+
+    This coroutine can be called with ( @autoasync(...) ) or without
+    ( @autoasync ) arguments.
+
+    Examples:
+
+    @autoasync
+    def get_file(host, port):
+        reader, writer = yield from asyncio.open_connection(host, port)
+        data = reader.read()
+        sys.stdout.write(data.decode())
+
+    get_file(host, port)
+
+    @autoasync(forever=True, pass_loop=True)
+    def server(host, port, loop):
+        yield_from loop.create_server(Proto, host, port)
+
+    server('localhost', 8899)
+
+    '''
+    if coro is None:
+        return lambda c: autoasync(
+            c, loop=loop,
+            forever=forever,
+            pass_loop=pass_loop)
+
+    # The old and new signatures are required to correctly bind the loop
+    # parameter in 100% of cases, even if it's a positional parameter.
+    # NOTE: A future release will probably require the loop parameter to be
+    # a kwonly parameter.
+    if pass_loop:
+        old_sig = signature(coro)
+        new_sig = old_sig.replace(parameters=(
+            param for name, param in old_sig.parameters.items()
+            if name != "loop"))
+
+    @wraps(coro)
+    def autoasync_wrapper(*args, **kwargs):
+        # Defer the call to get_event_loop so that, if a custom policy is
+        # installed after the autoasync decorator, it is respected at call time
+        local_loop = get_event_loop() if loop is None else loop
+
+        # Inject the 'loop' argument. We have to use this signature binding to
+        # ensure it's injected in the correct place (positional, keyword, etc)
+        if pass_loop:
+            bound_args = old_sig.bind_partial()
+            bound_args.arguments.update(
+                loop=local_loop,
+                **new_sig.bind(*args, **kwargs).arguments)
+            args, kwargs = bound_args.args, bound_args.kwargs
+
+        if forever:
+            local_loop.create_task(_run_forever_coro(
+                coro, args, kwargs, local_loop
+            ))
+            local_loop.run_forever()
+        else:
+            return local_loop.run_until_complete(coro(*args, **kwargs))
+
+    # Attach the updated signature. This allows 'pass_loop' to be used with
+    # autoparse
+    if pass_loop:
+        autoasync_wrapper.__signature__ = new_sig
+
+    return autoasync_wrapper
diff --git a/setuptools/_vendor/autocommand/autocommand.py b/setuptools/_vendor/autocommand/autocommand.py
new file mode 100644
index 0000000000..097e86de07
--- /dev/null
+++ b/setuptools/_vendor/autocommand/autocommand.py
@@ -0,0 +1,70 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+from .autoparse import autoparse
+from .automain import automain
+try:
+    from .autoasync import autoasync
+except ImportError:  # pragma: no cover
+    pass
+
+
+def autocommand(
+        module, *,
+        description=None,
+        epilog=None,
+        add_nos=False,
+        parser=None,
+        loop=None,
+        forever=False,
+        pass_loop=False):
+
+    if callable(module):
+        raise TypeError('autocommand requires a module name argument')
+
+    def autocommand_decorator(func):
+        # Step 1: if requested, run it all in an asyncio event loop. autoasync
+        # patches the __signature__ of the decorated function, so that in the
+        # event that pass_loop is True, the `loop` parameter of the original
+        # function will *not* be interpreted as a command-line argument by
+        # autoparse
+        if loop is not None or forever or pass_loop:
+            func = autoasync(
+                func,
+                loop=None if loop is True else loop,
+                pass_loop=pass_loop,
+                forever=forever)
+
+        # Step 2: create parser. We do this second so that the arguments are
+        # parsed and passed *before* entering the asyncio event loop, if it
+        # exists. This simplifies the stack trace and ensures errors are
+        # reported earlier. It also ensures that errors raised during parsing &
+        # passing are still raised if `forever` is True.
+        func = autoparse(
+            func,
+            description=description,
+            epilog=epilog,
+            add_nos=add_nos,
+            parser=parser)
+
+        # Step 3: call the function automatically if __name__ == '__main__' (or
+        # if True was provided)
+        func = automain(module)(func)
+
+        return func
+
+    return autocommand_decorator
diff --git a/setuptools/_vendor/autocommand/automain.py b/setuptools/_vendor/autocommand/automain.py
new file mode 100644
index 0000000000..6cc45db66a
--- /dev/null
+++ b/setuptools/_vendor/autocommand/automain.py
@@ -0,0 +1,59 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+import sys
+from .errors import AutocommandError
+
+
+class AutomainRequiresModuleError(AutocommandError, TypeError):
+    pass
+
+
+def automain(module, *, args=(), kwargs=None):
+    '''
+    This decorator automatically invokes a function if the module is being run
+    as the "__main__" module. Optionally, provide args or kwargs with which to
+    call the function. If `module` is "__main__", the function is called, and
+    the program is `sys.exit`ed with the return value. You can also pass `True`
+    to cause the function to be called unconditionally. If the function is not
+    called, it is returned unchanged by the decorator.
+
+    Usage:
+
+    @automain(__name__)  # Pass __name__ to check __name__=="__main__"
+    def main():
+        ...
+
+    If __name__ is "__main__" here, the main function is called, and then
+    sys.exit called with the return value.
+    '''
+
+    # Check that @automain(...) was called, rather than @automain
+    if callable(module):
+        raise AutomainRequiresModuleError(module)
+
+    if module == '__main__' or module is True:
+        if kwargs is None:
+            kwargs = {}
+
+        # Use a function definition instead of a lambda for a neater traceback
+        def automain_decorator(main):
+            sys.exit(main(*args, **kwargs))
+
+        return automain_decorator
+    else:
+        return lambda main: main
diff --git a/setuptools/_vendor/autocommand/autoparse.py b/setuptools/_vendor/autocommand/autoparse.py
new file mode 100644
index 0000000000..0276a3fae1
--- /dev/null
+++ b/setuptools/_vendor/autocommand/autoparse.py
@@ -0,0 +1,333 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+import sys
+from re import compile as compile_regex
+from inspect import signature, getdoc, Parameter
+from argparse import ArgumentParser
+from contextlib import contextmanager
+from functools import wraps
+from io import IOBase
+from autocommand.errors import AutocommandError
+
+
+_empty = Parameter.empty
+
+
+class AnnotationError(AutocommandError):
+    '''Annotation error: annotation must be a string, type, or tuple of both'''
+
+
+class PositionalArgError(AutocommandError):
+    '''
+    Postional Arg Error: autocommand can't handle postional-only parameters
+    '''
+
+
+class KWArgError(AutocommandError):
+    '''kwarg Error: autocommand can't handle a **kwargs parameter'''
+
+
+class DocstringError(AutocommandError):
+    '''Docstring error'''
+
+
+class TooManySplitsError(DocstringError):
+    '''
+    The docstring had too many ---- section splits. Currently we only support
+    using up to a single split, to split the docstring into description and
+    epilog parts.
+    '''
+
+
+def _get_type_description(annotation):
+    '''
+    Given an annotation, return the (type, description) for the parameter.
+    If you provide an annotation that is somehow both a string and a callable,
+    the behavior is undefined.
+    '''
+    if annotation is _empty:
+        return None, None
+    elif callable(annotation):
+        return annotation, None
+    elif isinstance(annotation, str):
+        return None, annotation
+    elif isinstance(annotation, tuple):
+        try:
+            arg1, arg2 = annotation
+        except ValueError as e:
+            raise AnnotationError(annotation) from e
+        else:
+            if callable(arg1) and isinstance(arg2, str):
+                return arg1, arg2
+            elif isinstance(arg1, str) and callable(arg2):
+                return arg2, arg1
+
+    raise AnnotationError(annotation)
+
+
+def _add_arguments(param, parser, used_char_args, add_nos):
+    '''
+    Add the argument(s) to an ArgumentParser (using add_argument) for a given
+    parameter. used_char_args is the set of -short options currently already in
+    use, and is updated (if necessary) by this function. If add_nos is True,
+    this will also add an inverse switch for all boolean options. For
+    instance, for the boolean parameter "verbose", this will create --verbose
+    and --no-verbose.
+    '''
+
+    # Impl note: This function is kept separate from make_parser because it's
+    # already very long and I wanted to separate out as much as possible into
+    # its own call scope, to prevent even the possibility of suble mutation
+    # bugs.
+    if param.kind is param.POSITIONAL_ONLY:
+        raise PositionalArgError(param)
+    elif param.kind is param.VAR_KEYWORD:
+        raise KWArgError(param)
+
+    # These are the kwargs for the add_argument function.
+    arg_spec = {}
+    is_option = False
+
+    # Get the type and default from the annotation.
+    arg_type, description = _get_type_description(param.annotation)
+
+    # Get the default value
+    default = param.default
+
+    # If there is no explicit type, and the default is present and not None,
+    # infer the type from the default.
+    if arg_type is None and default not in {_empty, None}:
+        arg_type = type(default)
+
+    # Add default. The presence of a default means this is an option, not an
+    # argument.
+    if default is not _empty:
+        arg_spec['default'] = default
+        is_option = True
+
+    # Add the type
+    if arg_type is not None:
+        # Special case for bool: make it just a --switch
+        if arg_type is bool:
+            if not default or default is _empty:
+                arg_spec['action'] = 'store_true'
+            else:
+                arg_spec['action'] = 'store_false'
+
+            # Switches are always options
+            is_option = True
+
+        # Special case for file types: make it a string type, for filename
+        elif isinstance(default, IOBase):
+            arg_spec['type'] = str
+
+        # TODO: special case for list type.
+        #   - How to specificy type of list members?
+        #       - param: [int]
+        #       - param: int =[]
+        #   - action='append' vs nargs='*'
+
+        else:
+            arg_spec['type'] = arg_type
+
+    # nargs: if the signature includes *args, collect them as trailing CLI
+    # arguments in a list. *args can't have a default value, so it can never be
+    # an option.
+    if param.kind is param.VAR_POSITIONAL:
+        # TODO: consider depluralizing metavar/name here.
+        arg_spec['nargs'] = '*'
+
+    # Add description.
+    if description is not None:
+        arg_spec['help'] = description
+
+    # Get the --flags
+    flags = []
+    name = param.name
+
+    if is_option:
+        # Add the first letter as a -short option.
+        for letter in name[0], name[0].swapcase():
+            if letter not in used_char_args:
+                used_char_args.add(letter)
+                flags.append('-{}'.format(letter))
+                break
+
+        # If the parameter is a --long option, or is a -short option that
+        # somehow failed to get a flag, add it.
+        if len(name) > 1 or not flags:
+            flags.append('--{}'.format(name))
+
+        arg_spec['dest'] = name
+    else:
+        flags.append(name)
+
+    parser.add_argument(*flags, **arg_spec)
+
+    # Create the --no- version for boolean switches
+    if add_nos and arg_type is bool:
+        parser.add_argument(
+            '--no-{}'.format(name),
+            action='store_const',
+            dest=name,
+            const=default if default is not _empty else False)
+
+
+def make_parser(func_sig, description, epilog, add_nos):
+    '''
+    Given the signature of a function, create an ArgumentParser
+    '''
+    parser = ArgumentParser(description=description, epilog=epilog)
+
+    used_char_args = {'h'}
+
+    # Arange the params so that single-character arguments are first. This
+    # esnures they don't have to get --long versions. sorted is stable, so the
+    # parameters will otherwise still be in relative order.
+    params = sorted(
+        func_sig.parameters.values(),
+        key=lambda param: len(param.name) > 1)
+
+    for param in params:
+        _add_arguments(param, parser, used_char_args, add_nos)
+
+    return parser
+
+
+_DOCSTRING_SPLIT = compile_regex(r'\n\s*-{4,}\s*\n')
+
+
+def parse_docstring(docstring):
+    '''
+    Given a docstring, parse it into a description and epilog part
+    '''
+    if docstring is None:
+        return '', ''
+
+    parts = _DOCSTRING_SPLIT.split(docstring)
+
+    if len(parts) == 1:
+        return docstring, ''
+    elif len(parts) == 2:
+        return parts[0], parts[1]
+    else:
+        raise TooManySplitsError()
+
+
+def autoparse(
+        func=None, *,
+        description=None,
+        epilog=None,
+        add_nos=False,
+        parser=None):
+    '''
+    This decorator converts a function that takes normal arguments into a
+    function which takes a single optional argument, argv, parses it using an
+    argparse.ArgumentParser, and calls the underlying function with the parsed
+    arguments. If it is not given, sys.argv[1:] is used. This is so that the
+    function can be used as a setuptools entry point, as well as a normal main
+    function. sys.argv[1:] is not evaluated until the function is called, to
+    allow injecting different arguments for testing.
+
+    It uses the argument signature of the function to create an
+    ArgumentParser. Parameters without defaults become positional parameters,
+    while parameters *with* defaults become --options. Use annotations to set
+    the type of the parameter.
+
+    The `desctiption` and `epilog` parameters corrospond to the same respective
+    argparse parameters. If no description is given, it defaults to the
+    decorated functions's docstring, if present.
+
+    If add_nos is True, every boolean option (that is, every parameter with a
+    default of True/False or a type of bool) will have a --no- version created
+    as well, which inverts the option. For instance, the --verbose option will
+    have a --no-verbose counterpart. These are not mutually exclusive-
+    whichever one appears last in the argument list will have precedence.
+
+    If a parser is given, it is used instead of one generated from the function
+    signature. In this case, no parser is created; instead, the given parser is
+    used to parse the argv argument. The parser's results' argument names must
+    match up with the parameter names of the decorated function.
+
+    The decorated function is attached to the result as the `func` attribute,
+    and the parser is attached as the `parser` attribute.
+    '''
+
+    # If @autoparse(...) is used instead of @autoparse
+    if func is None:
+        return lambda f: autoparse(
+            f, description=description,
+            epilog=epilog,
+            add_nos=add_nos,
+            parser=parser)
+
+    func_sig = signature(func)
+
+    docstr_description, docstr_epilog = parse_docstring(getdoc(func))
+
+    if parser is None:
+        parser = make_parser(
+            func_sig,
+            description or docstr_description,
+            epilog or docstr_epilog,
+            add_nos)
+
+    @wraps(func)
+    def autoparse_wrapper(argv=None):
+        if argv is None:
+            argv = sys.argv[1:]
+
+        # Get empty argument binding, to fill with parsed arguments. This
+        # object does all the heavy lifting of turning named arguments into
+        # into correctly bound *args and **kwargs.
+        parsed_args = func_sig.bind_partial()
+        parsed_args.arguments.update(vars(parser.parse_args(argv)))
+
+        return func(*parsed_args.args, **parsed_args.kwargs)
+
+    # TODO: attach an updated __signature__ to autoparse_wrapper, just in case.
+
+    # Attach the wrapped function and parser, and return the wrapper.
+    autoparse_wrapper.func = func
+    autoparse_wrapper.parser = parser
+    return autoparse_wrapper
+
+
+@contextmanager
+def smart_open(filename_or_file, *args, **kwargs):
+    '''
+    This context manager allows you to open a filename, if you want to default
+    some already-existing file object, like sys.stdout, which shouldn't be
+    closed at the end of the context. If the filename argument is a str, bytes,
+    or int, the file object is created via a call to open with the given *args
+    and **kwargs, sent to the context, and closed at the end of the context,
+    just like "with open(filename) as f:". If it isn't one of the openable
+    types, the object simply sent to the context unchanged, and left unclosed
+    at the end of the context. Example:
+
+        def work_with_file(name=sys.stdout):
+            with smart_open(name) as f:
+                # Works correctly if name is a str filename or sys.stdout
+                print("Some stuff", file=f)
+                # If it was a filename, f is closed at the end here.
+    '''
+    if isinstance(filename_or_file, (str, bytes, int)):
+        with open(filename_or_file, *args, **kwargs) as file:
+            yield file
+    else:
+        yield filename_or_file
diff --git a/setuptools/_vendor/autocommand/errors.py b/setuptools/_vendor/autocommand/errors.py
new file mode 100644
index 0000000000..2570607399
--- /dev/null
+++ b/setuptools/_vendor/autocommand/errors.py
@@ -0,0 +1,23 @@
+# Copyright 2014-2016 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+
+class AutocommandError(Exception):
+    '''Base class for autocommand exceptions'''
+    pass
+
+# Individual modules will define errors specific to that module.
diff --git a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/RECORD b/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/RECORD
deleted file mode 100644
index a6a44d8fcc..0000000000
--- a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/RECORD
+++ /dev/null
@@ -1,9 +0,0 @@
-backports.tarfile-1.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-backports.tarfile-1.0.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-backports.tarfile-1.0.0.dist-info/METADATA,sha256=XlT7JAFR04zDMIjs-EFhqc0CkkVyeh-SiVUoKXONXJ0,1876
-backports.tarfile-1.0.0.dist-info/RECORD,,
-backports.tarfile-1.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-backports.tarfile-1.0.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-backports.tarfile-1.0.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
-backports/__pycache__/tarfile.cpython-312.pyc,,
-backports/tarfile.py,sha256=IO3YX_ZYqn13VOi-3QLM0lnktn102U4d9wUrHc230LY,106920
diff --git a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/INSTALLER b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/importlib_metadata-6.0.0.dist-info/INSTALLER
rename to setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
diff --git a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/LICENSE b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
similarity index 100%
rename from setuptools/_vendor/backports.tarfile-1.0.0.dist-info/LICENSE
rename to setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
diff --git a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/METADATA b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
similarity index 83%
rename from setuptools/_vendor/backports.tarfile-1.0.0.dist-info/METADATA
rename to setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
index e7b64c87f8..db0a2dcdbe 100644
--- a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/METADATA
+++ b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
@@ -1,16 +1,16 @@
 Metadata-Version: 2.1
 Name: backports.tarfile
-Version: 1.0.0
+Version: 1.2.0
 Summary: Backport of CPython tarfile module
-Home-page: https://github.com/jaraco/backports.tarfile
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/backports.tarfile
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
 Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
 License-File: LICENSE
 Provides-Extra: docs
 Requires-Dist: sphinx >=3.5 ; extra == 'docs'
@@ -19,10 +19,12 @@ Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
 Requires-Dist: furo ; extra == 'docs'
 Requires-Dist: sphinx-lint ; extra == 'docs'
 Provides-Extra: testing
-Requires-Dist: pytest !=8.1.1,>=6 ; extra == 'testing'
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'testing'
 Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
 Requires-Dist: pytest-cov ; extra == 'testing'
 Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
+Requires-Dist: jaraco.test ; extra == 'testing'
+Requires-Dist: pytest !=8.0.* ; extra == 'testing'
 
 .. image:: https://img.shields.io/pypi/v/backports.tarfile.svg
    :target: https://pypi.org/project/backports.tarfile
diff --git a/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
new file mode 100644
index 0000000000..536dc2f09e
--- /dev/null
+++ b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
@@ -0,0 +1,17 @@
+backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020
+backports.tarfile-1.2.0.dist-info/RECORD,,
+backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
+backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81
+backports/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491
+backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59
+backports/tarfile/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/__pycache__/__main__.cpython-312.pyc,,
+backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+backports/tarfile/compat/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/compat/__pycache__/py38.cpython-312.pyc,,
+backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568
diff --git a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/REQUESTED b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
similarity index 100%
rename from setuptools/_vendor/importlib_metadata-6.0.0.dist-info/REQUESTED
rename to setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
diff --git a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/WHEEL b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
similarity index 100%
rename from setuptools/_vendor/backports.tarfile-1.0.0.dist-info/WHEEL
rename to setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
diff --git a/setuptools/_vendor/backports.tarfile-1.0.0.dist-info/top_level.txt b/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
similarity index 100%
rename from setuptools/_vendor/backports.tarfile-1.0.0.dist-info/top_level.txt
rename to setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
diff --git a/setuptools/_vendor/backports/__init__.py b/setuptools/_vendor/backports/__init__.py
index e69de29bb2..0d1f7edf5d 100644
--- a/setuptools/_vendor/backports/__init__.py
+++ b/setuptools/_vendor/backports/__init__.py
@@ -0,0 +1 @@
+__path__ = __import__('pkgutil').extend_path(__path__, __name__)  # type: ignore
diff --git a/setuptools/_vendor/backports/tarfile.py b/setuptools/_vendor/backports/tarfile/__init__.py
similarity index 96%
rename from setuptools/_vendor/backports/tarfile.py
rename to setuptools/_vendor/backports/tarfile/__init__.py
index a7a9a6e7b9..8c16881cb3 100644
--- a/setuptools/_vendor/backports/tarfile.py
+++ b/setuptools/_vendor/backports/tarfile/__init__.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3
 #-------------------------------------------------------------------
 # tarfile.py
 #-------------------------------------------------------------------
@@ -46,7 +45,8 @@
 import struct
 import copy
 import re
-import warnings
+
+from .compat.py38 import removesuffix
 
 try:
     import pwd
@@ -637,6 +637,10 @@ def __init__(self, fileobj, offset, size, name, blockinfo=None):
     def flush(self):
         pass
 
+    @property
+    def mode(self):
+        return 'rb'
+
     def readable(self):
         return True
 
@@ -873,7 +877,7 @@ class TarInfo(object):
         pax_headers = ('A dictionary containing key-value pairs of an '
                        'associated pax extended header.'),
         sparse = 'Sparse member information.',
-        tarfile = None,
+        _tarfile = None,
         _sparse_structs = None,
         _link_target = None,
         )
@@ -902,6 +906,24 @@ def __init__(self, name=""):
         self.sparse = None      # sparse member information
         self.pax_headers = {}   # pax header information
 
+    @property
+    def tarfile(self):
+        import warnings
+        warnings.warn(
+            'The undocumented "tarfile" attribute of TarInfo objects '
+            + 'is deprecated and will be removed in Python 3.16',
+            DeprecationWarning, stacklevel=2)
+        return self._tarfile
+
+    @tarfile.setter
+    def tarfile(self, tarfile):
+        import warnings
+        warnings.warn(
+            'The undocumented "tarfile" attribute of TarInfo objects '
+            + 'is deprecated and will be removed in Python 3.16',
+            DeprecationWarning, stacklevel=2)
+        self._tarfile = tarfile
+
     @property
     def path(self):
         'In pax headers, "name" is called "path".'
@@ -1196,7 +1218,7 @@ def _create_pax_generic_header(cls, pax_headers, type, encoding):
         for keyword, value in pax_headers.items():
             keyword = keyword.encode("utf-8")
             if binary:
-                # Try to restore the original byte representation of `value'.
+                # Try to restore the original byte representation of 'value'.
                 # Needless to say, that the encoding must match the string.
                 value = value.encode(encoding, "surrogateescape")
             else:
@@ -1365,7 +1387,7 @@ def _proc_gnulong(self, tarfile):
         # Remove redundant slashes from directories. This is to be consistent
         # with frombuf().
         if next.isdir():
-            next.name = next.name.removesuffix("/")
+            next.name = removesuffix(next.name, "/")
 
         return next
 
@@ -1641,14 +1663,14 @@ class TarFile(object):
     def __init__(self, name=None, mode="r", fileobj=None, format=None,
             tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
             errors="surrogateescape", pax_headers=None, debug=None,
-            errorlevel=None, copybufsize=None):
-        """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
+            errorlevel=None, copybufsize=None, stream=False):
+        """Open an (uncompressed) tar archive 'name'. 'mode' is either 'r' to
            read from an existing archive, 'a' to append data to an existing
-           file or 'w' to create a new file overwriting an existing one. `mode'
+           file or 'w' to create a new file overwriting an existing one. 'mode'
            defaults to 'r'.
-           If `fileobj' is given, it is used for reading or writing data. If it
-           can be determined, `mode' is overridden by `fileobj's mode.
-           `fileobj' is not closed, when TarFile is closed.
+           If 'fileobj' is given, it is used for reading or writing data. If it
+           can be determined, 'mode' is overridden by 'fileobj's mode.
+           'fileobj' is not closed, when TarFile is closed.
         """
         modes = {"r": "rb", "a": "r+b", "w": "wb", "x": "xb"}
         if mode not in modes:
@@ -1673,6 +1695,8 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None,
         self.name = os.path.abspath(name) if name else None
         self.fileobj = fileobj
 
+        self.stream = stream
+
         # Init attributes.
         if format is not None:
             self.format = format
@@ -1975,7 +1999,7 @@ def close(self):
                 self.fileobj.close()
 
     def getmember(self, name):
-        """Return a TarInfo object for member ``name``. If ``name`` can not be
+        """Return a TarInfo object for member 'name'. If 'name' can not be
            found in the archive, KeyError is raised. If a member occurs more
            than once in the archive, its last occurrence is assumed to be the
            most up-to-date version.
@@ -2003,9 +2027,9 @@ def getnames(self):
 
     def gettarinfo(self, name=None, arcname=None, fileobj=None):
         """Create a TarInfo object from the result of os.stat or equivalent
-           on an existing file. The file is either named by ``name``, or
-           specified as a file object ``fileobj`` with a file descriptor. If
-           given, ``arcname`` specifies an alternative name for the file in the
+           on an existing file. The file is either named by 'name', or
+           specified as a file object 'fileobj' with a file descriptor. If
+           given, 'arcname' specifies an alternative name for the file in the
            archive, otherwise, the name is taken from the 'name' attribute of
            'fileobj', or the 'name' argument. The name should be a text
            string.
@@ -2029,7 +2053,7 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
         # Now, fill the TarInfo object with
         # information specific for the file.
         tarinfo = self.tarinfo()
-        tarinfo.tarfile = self  # Not needed
+        tarinfo._tarfile = self  # To be removed in 3.16.
 
         # Use os.stat or os.lstat, depending on if symlinks shall be resolved.
         if fileobj is None:
@@ -2101,11 +2125,15 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
         return tarinfo
 
     def list(self, verbose=True, *, members=None):
-        """Print a table of contents to sys.stdout. If ``verbose`` is False, only
-           the names of the members are printed. If it is True, an `ls -l'-like
-           output is produced. ``members`` is optional and must be a subset of the
+        """Print a table of contents to sys.stdout. If 'verbose' is False, only
+           the names of the members are printed. If it is True, an 'ls -l'-like
+           output is produced. 'members' is optional and must be a subset of the
            list returned by getmembers().
         """
+        # Convert tarinfo type to stat type.
+        type2mode = {REGTYPE: stat.S_IFREG, SYMTYPE: stat.S_IFLNK,
+                     FIFOTYPE: stat.S_IFIFO, CHRTYPE: stat.S_IFCHR,
+                     DIRTYPE: stat.S_IFDIR, BLKTYPE: stat.S_IFBLK}
         self._check()
 
         if members is None:
@@ -2115,7 +2143,8 @@ def list(self, verbose=True, *, members=None):
                 if tarinfo.mode is None:
                     _safe_print("??????????")
                 else:
-                    _safe_print(stat.filemode(tarinfo.mode))
+                    modetype = type2mode.get(tarinfo.type, 0)
+                    _safe_print(stat.filemode(modetype | tarinfo.mode))
                 _safe_print("%s/%s" % (tarinfo.uname or tarinfo.uid,
                                        tarinfo.gname or tarinfo.gid))
                 if tarinfo.ischr() or tarinfo.isblk():
@@ -2139,11 +2168,11 @@ def list(self, verbose=True, *, members=None):
             print()
 
     def add(self, name, arcname=None, recursive=True, *, filter=None):
-        """Add the file ``name`` to the archive. ``name`` may be any type of file
-           (directory, fifo, symbolic link, etc.). If given, ``arcname``
+        """Add the file 'name' to the archive. 'name' may be any type of file
+           (directory, fifo, symbolic link, etc.). If given, 'arcname'
            specifies an alternative name for the file in the archive.
            Directories are added recursively by default. This can be avoided by
-           setting ``recursive`` to False. ``filter`` is a function
+           setting 'recursive' to False. 'filter' is a function
            that expects a TarInfo object argument and returns the changed
            TarInfo object, if it returns None the TarInfo object will be
            excluded from the archive.
@@ -2190,13 +2219,16 @@ def add(self, name, arcname=None, recursive=True, *, filter=None):
             self.addfile(tarinfo)
 
     def addfile(self, tarinfo, fileobj=None):
-        """Add the TarInfo object ``tarinfo`` to the archive. If ``fileobj`` is
-           given, it should be a binary file, and tarinfo.size bytes are read
-           from it and added to the archive. You can create TarInfo objects
-           directly, or by using gettarinfo().
+        """Add the TarInfo object 'tarinfo' to the archive. If 'tarinfo' represents
+           a non zero-size regular file, the 'fileobj' argument should be a binary file,
+           and tarinfo.size bytes are read from it and added to the archive.
+           You can create TarInfo objects directly, or by using gettarinfo().
         """
         self._check("awx")
 
+        if fileobj is None and tarinfo.isreg() and tarinfo.size != 0:
+            raise ValueError("fileobj not provided for non zero-size regular file")
+
         tarinfo = copy.copy(tarinfo)
 
         buf = tarinfo.tobuf(self.format, self.encoding, self.errors)
@@ -2218,11 +2250,12 @@ def _get_filter_function(self, filter):
         if filter is None:
             filter = self.extraction_filter
             if filter is None:
+                import warnings
                 warnings.warn(
                     'Python 3.14 will, by default, filter extracted tar '
                     + 'archives and reject files or modify their metadata. '
                     + 'Use the filter argument to control this behavior.',
-                    DeprecationWarning)
+                    DeprecationWarning, stacklevel=3)
                 return fully_trusted_filter
             if isinstance(filter, str):
                 raise TypeError(
@@ -2241,12 +2274,12 @@ def extractall(self, path=".", members=None, *, numeric_owner=False,
                    filter=None):
         """Extract all members from the archive to the current working
            directory and set owner, modification time and permissions on
-           directories afterwards. `path' specifies a different directory
-           to extract to. `members' is optional and must be a subset of the
-           list returned by getmembers(). If `numeric_owner` is True, only
+           directories afterwards. 'path' specifies a different directory
+           to extract to. 'members' is optional and must be a subset of the
+           list returned by getmembers(). If 'numeric_owner' is True, only
            the numbers for user/group names are used and not the names.
 
-           The `filter` function will be called on each member just
+           The 'filter' function will be called on each member just
            before extraction.
            It can return a changed TarInfo or None to skip the member.
            String names of common filters are accepted.
@@ -2286,13 +2319,13 @@ def extract(self, member, path="", set_attrs=True, *, numeric_owner=False,
                 filter=None):
         """Extract a member from the archive to the current working directory,
            using its full name. Its file information is extracted as accurately
-           as possible. `member' may be a filename or a TarInfo object. You can
-           specify a different directory using `path'. File attributes (owner,
-           mtime, mode) are set unless `set_attrs' is False. If `numeric_owner`
+           as possible. 'member' may be a filename or a TarInfo object. You can
+           specify a different directory using 'path'. File attributes (owner,
+           mtime, mode) are set unless 'set_attrs' is False. If 'numeric_owner'
            is True, only the numbers for user/group names are used and not
            the names.
 
-           The `filter` function will be called before extraction.
+           The 'filter' function will be called before extraction.
            It can return a changed TarInfo or None to skip the member.
            String names of common filters are accepted.
         """
@@ -2357,10 +2390,10 @@ def _handle_fatal_error(self, e):
             self._dbg(1, "tarfile: %s %s" % (type(e).__name__, e))
 
     def extractfile(self, member):
-        """Extract a member from the archive as a file object. ``member`` may be
-           a filename or a TarInfo object. If ``member`` is a regular file or
+        """Extract a member from the archive as a file object. 'member' may be
+           a filename or a TarInfo object. If 'member' is a regular file or
            a link, an io.BufferedReader object is returned. For all other
-           existing members, None is returned. If ``member`` does not appear
+           existing members, None is returned. If 'member' does not appear
            in the archive, KeyError is raised.
         """
         self._check("r")
@@ -2404,7 +2437,7 @@ def _extract_member(self, tarinfo, targetpath, set_attrs=True,
         if upperdirs and not os.path.exists(upperdirs):
             # Create directories that are not part of the archive with
             # default permissions.
-            os.makedirs(upperdirs)
+            os.makedirs(upperdirs, exist_ok=True)
 
         if tarinfo.islnk() or tarinfo.issym():
             self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname))
@@ -2557,7 +2590,8 @@ def chown(self, tarinfo, targetpath, numeric_owner):
                     os.lchown(targetpath, u, g)
                 else:
                     os.chown(targetpath, u, g)
-            except OSError as e:
+            except (OSError, OverflowError) as e:
+                # OverflowError can be raised if an ID doesn't fit in 'id_t'
                 raise ExtractError("could not change owner") from e
 
     def chmod(self, tarinfo, targetpath):
@@ -2640,7 +2674,9 @@ def next(self):
             break
 
         if tarinfo is not None:
-            self.members.append(tarinfo)
+            # if streaming the file we do not want to cache the tarinfo
+            if not self.stream:
+                self.members.append(tarinfo)
         else:
             self._loaded = True
 
@@ -2691,11 +2727,12 @@ def _getmember(self, name, tarinfo=None, normalize=False):
 
     def _load(self):
         """Read through the entire archive file and look for readable
-           members.
+           members. This should not run if the file is set to stream.
         """
-        while self.next() is not None:
-            pass
-        self._loaded = True
+        if not self.stream:
+            while self.next() is not None:
+                pass
+            self._loaded = True
 
     def _check(self, mode=None):
         """Check if TarFile is still open, and if the operation's mode
diff --git a/setuptools/_vendor/backports/tarfile/__main__.py b/setuptools/_vendor/backports/tarfile/__main__.py
new file mode 100644
index 0000000000..daf5509086
--- /dev/null
+++ b/setuptools/_vendor/backports/tarfile/__main__.py
@@ -0,0 +1,5 @@
+from . import main
+
+
+if __name__ == '__main__':
+    main()
diff --git a/setuptools/_vendor/__init__.py b/setuptools/_vendor/backports/tarfile/compat/__init__.py
similarity index 100%
rename from setuptools/_vendor/__init__.py
rename to setuptools/_vendor/backports/tarfile/compat/__init__.py
diff --git a/setuptools/_vendor/backports/tarfile/compat/py38.py b/setuptools/_vendor/backports/tarfile/compat/py38.py
new file mode 100644
index 0000000000..20fbbfc1c0
--- /dev/null
+++ b/setuptools/_vendor/backports/tarfile/compat/py38.py
@@ -0,0 +1,24 @@
+import sys
+
+
+if sys.version_info < (3, 9):
+
+    def removesuffix(self, suffix):
+        # suffix='' should not call self[:-0].
+        if suffix and self.endswith(suffix):
+            return self[: -len(suffix)]
+        else:
+            return self[:]
+
+    def removeprefix(self, prefix):
+        if self.startswith(prefix):
+            return self[len(prefix) :]
+        else:
+            return self[:]
+else:
+
+    def removesuffix(self, suffix):
+        return self.removesuffix(suffix)
+
+    def removeprefix(self, prefix):
+        return self.removeprefix(prefix)
diff --git a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/RECORD b/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/RECORD
deleted file mode 100644
index c5ed31bf55..0000000000
--- a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/RECORD
+++ /dev/null
@@ -1,26 +0,0 @@
-importlib_metadata-6.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-importlib_metadata-6.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
-importlib_metadata-6.0.0.dist-info/METADATA,sha256=tZIEx9HdEXD34SWuitkNXaYBqSnyNukx2l4FKQAz9hY,4958
-importlib_metadata-6.0.0.dist-info/RECORD,,
-importlib_metadata-6.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_metadata-6.0.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
-importlib_metadata-6.0.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
-importlib_metadata/__init__.py,sha256=wiMJxNXXhPtRRHSX2N9gGLnTh0YszmE1rn3uKYRrNcs,26490
-importlib_metadata/__pycache__/__init__.cpython-312.pyc,,
-importlib_metadata/__pycache__/_adapters.cpython-312.pyc,,
-importlib_metadata/__pycache__/_collections.cpython-312.pyc,,
-importlib_metadata/__pycache__/_compat.cpython-312.pyc,,
-importlib_metadata/__pycache__/_functools.cpython-312.pyc,,
-importlib_metadata/__pycache__/_itertools.cpython-312.pyc,,
-importlib_metadata/__pycache__/_meta.cpython-312.pyc,,
-importlib_metadata/__pycache__/_py39compat.cpython-312.pyc,,
-importlib_metadata/__pycache__/_text.cpython-312.pyc,,
-importlib_metadata/_adapters.py,sha256=i8S6Ib1OQjcILA-l4gkzktMZe18TaeUNI49PLRp6OBU,2454
-importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743
-importlib_metadata/_compat.py,sha256=9zOKf0eDgkCMnnaEhU5kQVxHd1P8BIYV7Stso7av5h8,1857
-importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895
-importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068
-importlib_metadata/_meta.py,sha256=v5e1ZDG7yZTH3h7TjbS5bM5p8AGzMPVOu8skDMv4h6k,1165
-importlib_metadata/_py39compat.py,sha256=2Tk5twb_VgLCY-1NEAQjdZp_S9OFMC-pUzP2isuaPsQ,1098
-importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
-importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/INSTALLER b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/importlib_resources-5.10.2.dist-info/INSTALLER
rename to setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER
diff --git a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/LICENSE b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE
similarity index 100%
rename from setuptools/_vendor/importlib_metadata-6.0.0.dist-info/LICENSE
rename to setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE
diff --git a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/METADATA b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA
similarity index 58%
rename from setuptools/_vendor/importlib_metadata-6.0.0.dist-info/METADATA
rename to setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA
index 663c0c8720..85513e8a9f 100644
--- a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/METADATA
+++ b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA
@@ -1,60 +1,59 @@
 Metadata-Version: 2.1
-Name: importlib-metadata
-Version: 6.0.0
+Name: importlib_metadata
+Version: 8.0.0
 Summary: Read metadata from Python packages
-Home-page: https://github.com/python/importlib_metadata
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
+Author-email: "Jason R. Coombs" 
+Project-URL: Source, https://github.com/python/importlib_metadata
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.7
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
 License-File: LICENSE
-Requires-Dist: zipp (>=0.5)
-Requires-Dist: typing-extensions (>=3.6.4) ; python_version < "3.8"
-Provides-Extra: docs
-Requires-Dist: sphinx (>=3.5) ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=9) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
-Requires-Dist: furo ; extra == 'docs'
-Requires-Dist: sphinx-lint ; extra == 'docs'
-Requires-Dist: jaraco.tidelift (>=1.4) ; extra == 'docs'
+Requires-Dist: zipp >=0.5
+Requires-Dist: typing-extensions >=3.6.4 ; python_version < "3.8"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
 Provides-Extra: perf
 Requires-Dist: ipython ; extra == 'perf'
-Provides-Extra: testing
-Requires-Dist: pytest (>=6) ; extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
-Requires-Dist: flake8 (<5) ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler (>=1.3) ; extra == 'testing'
-Requires-Dist: packaging ; extra == 'testing'
-Requires-Dist: pyfakefs ; extra == 'testing'
-Requires-Dist: flufl.flake8 ; extra == 'testing'
-Requires-Dist: pytest-perf (>=0.9.2) ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy (>=0.9.1) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-flake8 ; (python_version < "3.12") and extra == 'testing'
-Requires-Dist: importlib-resources (>=1.3) ; (python_version < "3.9") and extra == 'testing'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: packaging ; extra == 'test'
+Requires-Dist: pyfakefs ; extra == 'test'
+Requires-Dist: flufl.flake8 ; extra == 'test'
+Requires-Dist: pytest-perf >=0.9.2 ; extra == 'test'
+Requires-Dist: jaraco.test >=5.4 ; extra == 'test'
+Requires-Dist: importlib-resources >=1.3 ; (python_version < "3.9") and extra == 'test'
 
 .. image:: https://img.shields.io/pypi/v/importlib_metadata.svg
    :target: https://pypi.org/project/importlib_metadata
 
 .. image:: https://img.shields.io/pypi/pyversions/importlib_metadata.svg
 
-.. image:: https://github.com/python/importlib_metadata/workflows/tests/badge.svg
+.. image:: https://github.com/python/importlib_metadata/actions/workflows/main.yml/badge.svg
    :target: https://github.com/python/importlib_metadata/actions?query=workflow%3A%22tests%22
    :alt: tests
 
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
 
 .. image:: https://readthedocs.org/projects/importlib-metadata/badge/?version=latest
    :target: https://importlib-metadata.readthedocs.io/en/latest/?badge=latest
 
-.. image:: https://img.shields.io/badge/skeleton-2022-informational
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
    :target: https://blog.jaraco.com/skeleton
 
 .. image:: https://tidelift.com/badges/package/pypi/importlib-metadata
@@ -79,7 +78,9 @@ were contributed to different versions in the standard library:
 
    * - importlib_metadata
      - stdlib
-   * - 5.0
+   * - 7.0
+     - 3.13
+   * - 6.5
      - 3.12
    * - 4.13
      - 3.11
@@ -92,7 +93,7 @@ were contributed to different versions in the standard library:
 Usage
 =====
 
-See the `online documentation `_
+See the `online documentation `_
 for usage details.
 
 `Finder authors
@@ -116,7 +117,7 @@ Project details
  * Project home: https://github.com/python/importlib_metadata
  * Report bugs at: https://github.com/python/importlib_metadata/issues
  * Code hosting: https://github.com/python/importlib_metadata
- * Documentation: https://importlib_metadata.readthedocs.io/
+ * Documentation: https://importlib-metadata.readthedocs.io/
 
 For Enterprise
 ==============
@@ -126,10 +127,3 @@ Available as part of the Tidelift Subscription.
 This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
 
 `Learn more `_.
-
-Security Contact
-================
-
-To report a security vulnerability, please use the
-`Tidelift security contact `_.
-Tidelift will coordinate the fix and disclosure.
diff --git a/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD
new file mode 100644
index 0000000000..07b7dc51db
--- /dev/null
+++ b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD
@@ -0,0 +1,32 @@
+importlib_metadata-8.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+importlib_metadata-8.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
+importlib_metadata-8.0.0.dist-info/METADATA,sha256=anuQ7_7h4J1bSEzfcjIBakPi2cyVQ7y7jklLHsBeH1k,4648
+importlib_metadata-8.0.0.dist-info/RECORD,,
+importlib_metadata-8.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_metadata-8.0.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
+importlib_metadata-8.0.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
+importlib_metadata/__init__.py,sha256=tZNB-23h8Bixi9uCrQqj9Yf0aeC--Josdy3IZRIQeB0,33798
+importlib_metadata/__pycache__/__init__.cpython-312.pyc,,
+importlib_metadata/__pycache__/_adapters.cpython-312.pyc,,
+importlib_metadata/__pycache__/_collections.cpython-312.pyc,,
+importlib_metadata/__pycache__/_compat.cpython-312.pyc,,
+importlib_metadata/__pycache__/_functools.cpython-312.pyc,,
+importlib_metadata/__pycache__/_itertools.cpython-312.pyc,,
+importlib_metadata/__pycache__/_meta.cpython-312.pyc,,
+importlib_metadata/__pycache__/_text.cpython-312.pyc,,
+importlib_metadata/__pycache__/diagnose.cpython-312.pyc,,
+importlib_metadata/_adapters.py,sha256=rIhWTwBvYA1bV7i-5FfVX38qEXDTXFeS5cb5xJtP3ks,2317
+importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743
+importlib_metadata/_compat.py,sha256=73QKrN9KNoaZzhbX5yPCCZa-FaALwXe8TPlDR72JgBU,1314
+importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895
+importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068
+importlib_metadata/_meta.py,sha256=nxZ7C8GVlcBFAKWyVOn_dn7ot_twBcbm1NmvjIetBHI,1801
+importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
+importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_metadata/compat/__pycache__/__init__.cpython-312.pyc,,
+importlib_metadata/compat/__pycache__/py311.cpython-312.pyc,,
+importlib_metadata/compat/__pycache__/py39.cpython-312.pyc,,
+importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608
+importlib_metadata/compat/py39.py,sha256=cPkMv6-0ilK-0Jw_Tkn0xYbOKJZc4WJKQHow0c2T44w,1102
+importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379
+importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/REQUESTED b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED
similarity index 100%
rename from setuptools/_vendor/importlib_resources-5.10.2.dist-info/REQUESTED
rename to setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED
diff --git a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/WHEEL b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL
similarity index 65%
rename from setuptools/_vendor/importlib_resources-5.10.2.dist-info/WHEEL
rename to setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL
index 57e3d840d5..edf4ec7c70 100644
--- a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/WHEEL
+++ b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL
@@ -1,5 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.38.4)
+Generator: setuptools (70.1.1)
 Root-Is-Purelib: true
 Tag: py3-none-any
 
diff --git a/setuptools/_vendor/importlib_metadata-6.0.0.dist-info/top_level.txt b/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt
similarity index 100%
rename from setuptools/_vendor/importlib_metadata-6.0.0.dist-info/top_level.txt
rename to setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt
diff --git a/setuptools/_vendor/importlib_metadata/__init__.py b/setuptools/_vendor/importlib_metadata/__init__.py
index 8864214375..ed4813551a 100644
--- a/setuptools/_vendor/importlib_metadata/__init__.py
+++ b/setuptools/_vendor/importlib_metadata/__init__.py
@@ -1,25 +1,28 @@
+from __future__ import annotations
+
 import os
 import re
 import abc
-import csv
 import sys
-from .. import zipp
+import json
+import zipp
 import email
+import types
+import inspect
 import pathlib
 import operator
 import textwrap
-import warnings
 import functools
 import itertools
 import posixpath
 import collections
 
-from . import _adapters, _meta, _py39compat
+from . import _meta
+from .compat import py39, py311
 from ._collections import FreezableDefaultDict, Pair
 from ._compat import (
     NullFinder,
     install,
-    pypy_partial,
 )
 from ._functools import method_cache, pass_none
 from ._itertools import always_iterable, unique_everseen
@@ -29,8 +32,7 @@
 from importlib import import_module
 from importlib.abc import MetaPathFinder
 from itertools import starmap
-from typing import List, Mapping, Optional
-
+from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast
 
 __all__ = [
     'Distribution',
@@ -51,11 +53,11 @@
 class PackageNotFoundError(ModuleNotFoundError):
     """The package was not found."""
 
-    def __str__(self):
+    def __str__(self) -> str:
         return f"No package metadata was found for {self.name}"
 
     @property
-    def name(self):
+    def name(self) -> str:  # type: ignore[override]
         (name,) = self.args
         return name
 
@@ -121,38 +123,11 @@ def read(text, filter_=None):
             yield Pair(name, value)
 
     @staticmethod
-    def valid(line):
+    def valid(line: str):
         return line and not line.startswith('#')
 
 
-class DeprecatedTuple:
-    """
-    Provide subscript item access for backward compatibility.
-
-    >>> recwarn = getfixture('recwarn')
-    >>> ep = EntryPoint(name='name', value='value', group='group')
-    >>> ep[:]
-    ('name', 'value', 'group')
-    >>> ep[0]
-    'name'
-    >>> len(recwarn)
-    1
-    """
-
-    # Do not remove prior to 2023-05-01 or Python 3.13
-    _warn = functools.partial(
-        warnings.warn,
-        "EntryPoint tuple interface is deprecated. Access members by name.",
-        DeprecationWarning,
-        stacklevel=pypy_partial(2),
-    )
-
-    def __getitem__(self, item):
-        self._warn()
-        return self._key()[item]
-
-
-class EntryPoint(DeprecatedTuple):
+class EntryPoint:
     """An entry point as defined by Python packaging conventions.
 
     See `the packaging docs on entry points
@@ -194,34 +169,37 @@ class EntryPoint(DeprecatedTuple):
     value: str
     group: str
 
-    dist: Optional['Distribution'] = None
+    dist: Optional[Distribution] = None
 
-    def __init__(self, name, value, group):
+    def __init__(self, name: str, value: str, group: str) -> None:
         vars(self).update(name=name, value=value, group=group)
 
-    def load(self):
+    def load(self) -> Any:
         """Load the entry point from its definition. If only a module
         is indicated by the value, return that module. Otherwise,
         return the named object.
         """
-        match = self.pattern.match(self.value)
+        match = cast(Match, self.pattern.match(self.value))
         module = import_module(match.group('module'))
         attrs = filter(None, (match.group('attr') or '').split('.'))
         return functools.reduce(getattr, attrs, module)
 
     @property
-    def module(self):
+    def module(self) -> str:
         match = self.pattern.match(self.value)
+        assert match is not None
         return match.group('module')
 
     @property
-    def attr(self):
+    def attr(self) -> str:
         match = self.pattern.match(self.value)
+        assert match is not None
         return match.group('attr')
 
     @property
-    def extras(self):
+    def extras(self) -> List[str]:
         match = self.pattern.match(self.value)
+        assert match is not None
         return re.findall(r'\w+', match.group('extras') or '')
 
     def _for(self, dist):
@@ -269,7 +247,7 @@ def __repr__(self):
             f'group={self.group!r})'
         )
 
-    def __hash__(self):
+    def __hash__(self) -> int:
         return hash(self._key())
 
 
@@ -280,7 +258,7 @@ class EntryPoints(tuple):
 
     __slots__ = ()
 
-    def __getitem__(self, name):  # -> EntryPoint:
+    def __getitem__(self, name: str) -> EntryPoint:  # type: ignore[override]
         """
         Get the EntryPoint in self matching name.
         """
@@ -289,22 +267,29 @@ def __getitem__(self, name):  # -> EntryPoint:
         except StopIteration:
             raise KeyError(name)
 
-    def select(self, **params):
+    def __repr__(self):
+        """
+        Repr with classname and tuple constructor to
+        signal that we deviate from regular tuple behavior.
+        """
+        return '%s(%r)' % (self.__class__.__name__, tuple(self))
+
+    def select(self, **params) -> EntryPoints:
         """
         Select entry points from self that match the
         given parameters (typically group and/or name).
         """
-        return EntryPoints(ep for ep in self if _py39compat.ep_matches(ep, **params))
+        return EntryPoints(ep for ep in self if py39.ep_matches(ep, **params))
 
     @property
-    def names(self):
+    def names(self) -> Set[str]:
         """
         Return the set of all names of all entry points.
         """
         return {ep.name for ep in self}
 
     @property
-    def groups(self):
+    def groups(self) -> Set[str]:
         """
         Return the set of all groups of all entry points.
         """
@@ -325,47 +310,72 @@ def _from_text(text):
 class PackagePath(pathlib.PurePosixPath):
     """A reference to a path in a package"""
 
-    def read_text(self, encoding='utf-8'):
-        with self.locate().open(encoding=encoding) as stream:
-            return stream.read()
+    hash: Optional[FileHash]
+    size: int
+    dist: Distribution
+
+    def read_text(self, encoding: str = 'utf-8') -> str:  # type: ignore[override]
+        return self.locate().read_text(encoding=encoding)
 
-    def read_binary(self):
-        with self.locate().open('rb') as stream:
-            return stream.read()
+    def read_binary(self) -> bytes:
+        return self.locate().read_bytes()
 
-    def locate(self):
+    def locate(self) -> SimplePath:
         """Return a path-like object for this path"""
         return self.dist.locate_file(self)
 
 
 class FileHash:
-    def __init__(self, spec):
+    def __init__(self, spec: str) -> None:
         self.mode, _, self.value = spec.partition('=')
 
-    def __repr__(self):
+    def __repr__(self) -> str:
         return f''
 
 
 class Distribution(metaclass=abc.ABCMeta):
-    """A Python distribution package."""
+    """
+    An abstract Python distribution package.
+
+    Custom providers may derive from this class and define
+    the abstract methods to provide a concrete implementation
+    for their environment. Some providers may opt to override
+    the default implementation of some properties to bypass
+    the file-reading mechanism.
+    """
 
     @abc.abstractmethod
-    def read_text(self, filename):
+    def read_text(self, filename) -> Optional[str]:
         """Attempt to load metadata file given by the name.
 
+        Python distribution metadata is organized by blobs of text
+        typically represented as "files" in the metadata directory
+        (e.g. package-1.0.dist-info). These files include things
+        like:
+
+        - METADATA: The distribution metadata including fields
+          like Name and Version and Description.
+        - entry_points.txt: A series of entry points as defined in
+          `the entry points spec `_.
+        - RECORD: A record of files according to
+          `this recording spec `_.
+
+        A package may provide any set of files, including those
+        not listed here or none at all.
+
         :param filename: The name of the file in the distribution info.
         :return: The text if found, otherwise None.
         """
 
     @abc.abstractmethod
-    def locate_file(self, path):
+    def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
         """
-        Given a path to a file in this distribution, return a path
+        Given a path to a file in this distribution, return a SimplePath
         to it.
         """
 
     @classmethod
-    def from_name(cls, name: str):
+    def from_name(cls, name: str) -> Distribution:
         """Return the Distribution for the given package name.
 
         :param name: The name of the distribution package to search for.
@@ -378,21 +388,23 @@ def from_name(cls, name: str):
         if not name:
             raise ValueError("A distribution name is required.")
         try:
-            return next(cls.discover(name=name))
+            return next(iter(cls.discover(name=name)))
         except StopIteration:
             raise PackageNotFoundError(name)
 
     @classmethod
-    def discover(cls, **kwargs):
+    def discover(
+        cls, *, context: Optional[DistributionFinder.Context] = None, **kwargs
+    ) -> Iterable[Distribution]:
         """Return an iterable of Distribution objects for all packages.
 
         Pass a ``context`` or pass keyword arguments for constructing
         a context.
 
         :context: A ``DistributionFinder.Context`` object.
-        :return: Iterable of Distribution objects for all packages.
+        :return: Iterable of Distribution objects for packages matching
+          the context.
         """
-        context = kwargs.pop('context', None)
         if context and kwargs:
             raise ValueError("cannot accept context and kwargs")
         context = context or DistributionFinder.Context(**kwargs)
@@ -401,8 +413,8 @@ def discover(cls, **kwargs):
         )
 
     @staticmethod
-    def at(path):
-        """Return a Distribution for the indicated metadata path
+    def at(path: str | os.PathLike[str]) -> Distribution:
+        """Return a Distribution for the indicated metadata path.
 
         :param path: a string or path-like object
         :return: a concrete Distribution instance for the path
@@ -411,7 +423,7 @@ def at(path):
 
     @staticmethod
     def _discover_resolvers():
-        """Search the meta_path for resolvers."""
+        """Search the meta_path for resolvers (MetadataPathFinders)."""
         declared = (
             getattr(finder, 'find_distributions', None) for finder in sys.meta_path
         )
@@ -422,9 +434,16 @@ def metadata(self) -> _meta.PackageMetadata:
         """Return the parsed metadata for this Distribution.
 
         The returned object will have keys that name the various bits of
-        metadata.  See PEP 566 for details.
+        metadata per the
+        `Core metadata specifications `_.
+
+        Custom providers may provide the METADATA file or override this
+        property.
         """
-        text = (
+        # deferred for performance (python/cpython#109829)
+        from . import _adapters
+
+        opt_text = (
             self.read_text('METADATA')
             or self.read_text('PKG-INFO')
             # This last clause is here to support old egg-info files.  Its
@@ -432,10 +451,11 @@ def metadata(self) -> _meta.PackageMetadata:
             # (which points to the egg-info file) attribute unchanged.
             or self.read_text('')
         )
+        text = cast(str, opt_text)
         return _adapters.Message(email.message_from_string(text))
 
     @property
-    def name(self):
+    def name(self) -> str:
         """Return the 'Name' metadata for the distribution package."""
         return self.metadata['Name']
 
@@ -445,24 +465,34 @@ def _normalized_name(self):
         return Prepared.normalize(self.name)
 
     @property
-    def version(self):
+    def version(self) -> str:
         """Return the 'Version' metadata for the distribution package."""
         return self.metadata['Version']
 
     @property
-    def entry_points(self):
+    def entry_points(self) -> EntryPoints:
+        """
+        Return EntryPoints for this distribution.
+
+        Custom providers may provide the ``entry_points.txt`` file
+        or override this property.
+        """
         return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
 
     @property
-    def files(self):
+    def files(self) -> Optional[List[PackagePath]]:
         """Files in this distribution.
 
         :return: List of PackagePath for this distribution or None
 
         Result is `None` if the metadata file that enumerates files
-        (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
-        missing.
+        (i.e. RECORD for dist-info, or installed-files.txt or
+        SOURCES.txt for egg-info) is missing.
         Result may be empty if the metadata exists but is empty.
+
+        Custom providers are recommended to provide a "RECORD" file (in
+        ``read_text``) or override this property to allow for callers to be
+        able to resolve filenames provided by the package.
         """
 
         def make_file(name, hash=None, size_str=None):
@@ -474,27 +504,75 @@ def make_file(name, hash=None, size_str=None):
 
         @pass_none
         def make_files(lines):
-            return list(starmap(make_file, csv.reader(lines)))
+            # Delay csv import, since Distribution.files is not as widely used
+            # as other parts of importlib.metadata
+            import csv
+
+            return starmap(make_file, csv.reader(lines))
 
-        return make_files(self._read_files_distinfo() or self._read_files_egginfo())
+        @pass_none
+        def skip_missing_files(package_paths):
+            return list(filter(lambda path: path.locate().exists(), package_paths))
+
+        return skip_missing_files(
+            make_files(
+                self._read_files_distinfo()
+                or self._read_files_egginfo_installed()
+                or self._read_files_egginfo_sources()
+            )
+        )
 
     def _read_files_distinfo(self):
         """
-        Read the lines of RECORD
+        Read the lines of RECORD.
         """
         text = self.read_text('RECORD')
         return text and text.splitlines()
 
-    def _read_files_egginfo(self):
+    def _read_files_egginfo_installed(self):
+        """
+        Read installed-files.txt and return lines in a similar
+        CSV-parsable format as RECORD: each file must be placed
+        relative to the site-packages directory and must also be
+        quoted (since file names can contain literal commas).
+
+        This file is written when the package is installed by pip,
+        but it might not be written for other installation methods.
+        Assume the file is accurate if it exists.
+        """
+        text = self.read_text('installed-files.txt')
+        # Prepend the .egg-info/ subdir to the lines in this file.
+        # But this subdir is only available from PathDistribution's
+        # self._path.
+        subdir = getattr(self, '_path', None)
+        if not text or not subdir:
+            return
+
+        paths = (
+            py311.relative_fix((subdir / name).resolve())
+            .relative_to(self.locate_file('').resolve(), walk_up=True)
+            .as_posix()
+            for name in text.splitlines()
+        )
+        return map('"{}"'.format, paths)
+
+    def _read_files_egginfo_sources(self):
         """
-        SOURCES.txt might contain literal commas, so wrap each line
-        in quotes.
+        Read SOURCES.txt and return lines in a similar CSV-parsable
+        format as RECORD: each file name must be quoted (since it
+        might contain literal commas).
+
+        Note that SOURCES.txt is not a reliable source for what
+        files are installed by a package. This file is generated
+        for a source archive, and the files that are present
+        there (e.g. setup.py) may not correctly reflect the files
+        that are present after the package has been installed.
         """
         text = self.read_text('SOURCES.txt')
         return text and map('"{}"'.format, text.splitlines())
 
     @property
-    def requires(self):
+    def requires(self) -> Optional[List[str]]:
         """Generated requirements specified for this Distribution"""
         reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
         return reqs and list(reqs)
@@ -545,10 +623,23 @@ def url_req_space(req):
             space = url_req_space(section.value)
             yield section.value + space + quoted_marker(section.name)
 
+    @property
+    def origin(self):
+        return self._load_json('direct_url.json')
+
+    def _load_json(self, filename):
+        return pass_none(json.loads)(
+            self.read_text(filename),
+            object_hook=lambda data: types.SimpleNamespace(**data),
+        )
+
 
 class DistributionFinder(MetaPathFinder):
     """
     A MetaPathFinder capable of discovering installed distributions.
+
+    Custom providers should implement this interface in order to
+    supply metadata.
     """
 
     class Context:
@@ -561,6 +652,17 @@ class Context:
         Each DistributionFinder may expect any parameters
         and should attempt to honor the canonical
         parameters defined below when appropriate.
+
+        This mechanism gives a custom provider a means to
+        solicit additional details from the caller beyond
+        "name" and "path" when searching distributions.
+        For example, imagine a provider that exposes suites
+        of packages in either a "public" or "private" ``realm``.
+        A caller may wish to query only for distributions in
+        a particular realm and could call
+        ``distributions(realm="private")`` to signal to the
+        custom provider to only include distributions from that
+        realm.
         """
 
         name = None
@@ -573,7 +675,7 @@ def __init__(self, **kwargs):
             vars(self).update(kwargs)
 
         @property
-        def path(self):
+        def path(self) -> List[str]:
             """
             The sequence of directory path that a distribution finder
             should search.
@@ -584,7 +686,7 @@ def path(self):
             return vars(self).get('path', sys.path)
 
     @abc.abstractmethod
-    def find_distributions(self, context=Context()):
+    def find_distributions(self, context=Context()) -> Iterable[Distribution]:
         """
         Find distributions.
 
@@ -596,11 +698,18 @@ def find_distributions(self, context=Context()):
 
 class FastPath:
     """
-    Micro-optimized class for searching a path for
-    children.
+    Micro-optimized class for searching a root for children.
+
+    Root is a path on the file system that may contain metadata
+    directories either as natural directories or within a zip file.
 
     >>> FastPath('').children()
     ['...']
+
+    FastPath objects are cached and recycled for any given root.
+
+    >>> FastPath('foobar') is FastPath('foobar')
+    True
     """
 
     @functools.lru_cache()  # type: ignore
@@ -642,7 +751,19 @@ def lookup(self, mtime):
 
 
 class Lookup:
+    """
+    A micro-optimized class for searching a (fast) path for metadata.
+    """
+
     def __init__(self, path: FastPath):
+        """
+        Calculate all of the children representing metadata.
+
+        From the children in the path, calculate early all of the
+        children that appear to represent metadata (infos) or legacy
+        metadata (eggs).
+        """
+
         base = os.path.basename(path.root).lower()
         base_is_egg = base.endswith(".egg")
         self.infos = FreezableDefaultDict(list)
@@ -663,7 +784,10 @@ def __init__(self, path: FastPath):
         self.infos.freeze()
         self.eggs.freeze()
 
-    def search(self, prepared):
+    def search(self, prepared: Prepared):
+        """
+        Yield all infos and eggs matching the Prepared query.
+        """
         infos = (
             self.infos[prepared.normalized]
             if prepared
@@ -679,13 +803,28 @@ def search(self, prepared):
 
 class Prepared:
     """
-    A prepared search for metadata on a possibly-named package.
+    A prepared search query for metadata on a possibly-named package.
+
+    Pre-calculates the normalization to prevent repeated operations.
+
+    >>> none = Prepared(None)
+    >>> none.normalized
+    >>> none.legacy_normalized
+    >>> bool(none)
+    False
+    >>> sample = Prepared('Sample__Pkg-name.foo')
+    >>> sample.normalized
+    'sample_pkg_name_foo'
+    >>> sample.legacy_normalized
+    'sample__pkg_name.foo'
+    >>> bool(sample)
+    True
     """
 
     normalized = None
     legacy_normalized = None
 
-    def __init__(self, name):
+    def __init__(self, name: Optional[str]):
         self.name = name
         if name is None:
             return
@@ -719,7 +858,10 @@ class MetadataPathFinder(NullFinder, DistributionFinder):
     of Python that do not have a PathFinder find_distributions().
     """
 
-    def find_distributions(self, context=DistributionFinder.Context()):
+    @classmethod
+    def find_distributions(
+        cls, context=DistributionFinder.Context()
+    ) -> Iterable[PathDistribution]:
         """
         Find distributions.
 
@@ -728,7 +870,7 @@ def find_distributions(self, context=DistributionFinder.Context()):
         (or all names if ``None`` indicated) along the paths in the list
         of directories ``context.path``.
         """
-        found = self._search_paths(context.name, context.path)
+        found = cls._search_paths(context.name, context.path)
         return map(PathDistribution, found)
 
     @classmethod
@@ -739,19 +881,20 @@ def _search_paths(cls, name, paths):
             path.search(prepared) for path in map(FastPath, paths)
         )
 
-    def invalidate_caches(cls):
+    @classmethod
+    def invalidate_caches(cls) -> None:
         FastPath.__new__.cache_clear()
 
 
 class PathDistribution(Distribution):
-    def __init__(self, path: SimplePath):
+    def __init__(self, path: SimplePath) -> None:
         """Construct a distribution.
 
         :param path: SimplePath indicating the metadata directory.
         """
         self._path = path
 
-    def read_text(self, filename):
+    def read_text(self, filename: str | os.PathLike[str]) -> Optional[str]:
         with suppress(
             FileNotFoundError,
             IsADirectoryError,
@@ -761,9 +904,11 @@ def read_text(self, filename):
         ):
             return self._path.joinpath(filename).read_text(encoding='utf-8')
 
+        return None
+
     read_text.__doc__ = Distribution.read_text.__doc__
 
-    def locate_file(self, path):
+    def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
         return self._path.parent / path
 
     @property
@@ -796,7 +941,7 @@ def _name_from_stem(stem):
         return name
 
 
-def distribution(distribution_name):
+def distribution(distribution_name: str) -> Distribution:
     """Get the ``Distribution`` instance for the named package.
 
     :param distribution_name: The name of the distribution package as a string.
@@ -805,7 +950,7 @@ def distribution(distribution_name):
     return Distribution.from_name(distribution_name)
 
 
-def distributions(**kwargs):
+def distributions(**kwargs) -> Iterable[Distribution]:
     """Get all ``Distribution`` instances in the current environment.
 
     :return: An iterable of ``Distribution`` instances.
@@ -813,7 +958,7 @@ def distributions(**kwargs):
     return Distribution.discover(**kwargs)
 
 
-def metadata(distribution_name) -> _meta.PackageMetadata:
+def metadata(distribution_name: str) -> _meta.PackageMetadata:
     """Get the metadata for the named package.
 
     :param distribution_name: The name of the distribution package to query.
@@ -822,7 +967,7 @@ def metadata(distribution_name) -> _meta.PackageMetadata:
     return Distribution.from_name(distribution_name).metadata
 
 
-def version(distribution_name):
+def version(distribution_name: str) -> str:
     """Get the version string for the named package.
 
     :param distribution_name: The name of the distribution package to query.
@@ -834,7 +979,7 @@ def version(distribution_name):
 
 _unique = functools.partial(
     unique_everseen,
-    key=_py39compat.normalized_name,
+    key=py39.normalized_name,
 )
 """
 Wrapper for ``distributions`` to return unique distributions by name.
@@ -856,7 +1001,7 @@ def entry_points(**params) -> EntryPoints:
     return EntryPoints(eps).select(**params)
 
 
-def files(distribution_name):
+def files(distribution_name: str) -> Optional[List[PackagePath]]:
     """Return a list of files for the named package.
 
     :param distribution_name: The name of the distribution package to query.
@@ -865,11 +1010,11 @@ def files(distribution_name):
     return distribution(distribution_name).files
 
 
-def requires(distribution_name):
+def requires(distribution_name: str) -> Optional[List[str]]:
     """
     Return a list of requirements for the named package.
 
-    :return: An iterator of requirements, suitable for
+    :return: An iterable of requirements, suitable for
         packaging.requirement.Requirement.
     """
     return distribution(distribution_name).requires
@@ -896,9 +1041,43 @@ def _top_level_declared(dist):
     return (dist.read_text('top_level.txt') or '').split()
 
 
+def _topmost(name: PackagePath) -> Optional[str]:
+    """
+    Return the top-most parent as long as there is a parent.
+    """
+    top, *rest = name.parts
+    return top if rest else None
+
+
+def _get_toplevel_name(name: PackagePath) -> str:
+    """
+    Infer a possibly importable module name from a name presumed on
+    sys.path.
+
+    >>> _get_toplevel_name(PackagePath('foo.py'))
+    'foo'
+    >>> _get_toplevel_name(PackagePath('foo'))
+    'foo'
+    >>> _get_toplevel_name(PackagePath('foo.pyc'))
+    'foo'
+    >>> _get_toplevel_name(PackagePath('foo/__init__.py'))
+    'foo'
+    >>> _get_toplevel_name(PackagePath('foo.pth'))
+    'foo.pth'
+    >>> _get_toplevel_name(PackagePath('foo.dist-info'))
+    'foo.dist-info'
+    """
+    return _topmost(name) or (
+        # python/typeshed#10328
+        inspect.getmodulename(name)  # type: ignore
+        or str(name)
+    )
+
+
 def _top_level_inferred(dist):
-    return {
-        f.parts[0] if len(f.parts) > 1 else f.with_suffix('').name
-        for f in always_iterable(dist.files)
-        if f.suffix == ".py"
-    }
+    opt_names = set(map(_get_toplevel_name, always_iterable(dist.files)))
+
+    def importable_name(name):
+        return '.' not in name
+
+    return filter(importable_name, opt_names)
diff --git a/setuptools/_vendor/importlib_metadata/_adapters.py b/setuptools/_vendor/importlib_metadata/_adapters.py
index e33cba5e44..6223263ed5 100644
--- a/setuptools/_vendor/importlib_metadata/_adapters.py
+++ b/setuptools/_vendor/importlib_metadata/_adapters.py
@@ -1,20 +1,8 @@
-import functools
-import warnings
 import re
 import textwrap
 import email.message
 
 from ._text import FoldedCase
-from ._compat import pypy_partial
-
-
-# Do not remove prior to 2024-01-01 or Python 3.14
-_warn = functools.partial(
-    warnings.warn,
-    "Implicit None on return values is deprecated and will raise KeyErrors.",
-    DeprecationWarning,
-    stacklevel=pypy_partial(2),
-)
 
 
 class Message(email.message.Message):
@@ -53,12 +41,17 @@ def __iter__(self):
 
     def __getitem__(self, item):
         """
-        Warn users that a ``KeyError`` can be expected when a
-        mising key is supplied. Ref python/importlib_metadata#371.
+        Override parent behavior to typical dict behavior.
+
+        ``email.message.Message`` will emit None values for missing
+        keys. Typical mappings, including this ``Message``, will raise
+        a key error for missing keys.
+
+        Ref python/importlib_metadata#371.
         """
         res = super().__getitem__(item)
         if res is None:
-            _warn()
+            raise KeyError(item)
         return res
 
     def _repair_headers(self):
diff --git a/setuptools/_vendor/importlib_metadata/_compat.py b/setuptools/_vendor/importlib_metadata/_compat.py
index 84f9eea4f3..df312b1cbb 100644
--- a/setuptools/_vendor/importlib_metadata/_compat.py
+++ b/setuptools/_vendor/importlib_metadata/_compat.py
@@ -2,14 +2,7 @@
 import platform
 
 
-__all__ = ['install', 'NullFinder', 'Protocol']
-
-
-try:
-    from typing import Protocol
-except ImportError:  # pragma: no cover
-    # Python 3.7 compatibility
-    from ..typing_extensions import Protocol  # type: ignore
+__all__ = ['install', 'NullFinder']
 
 
 def install(cls):
@@ -45,7 +38,7 @@ def matches(finder):
 
 class NullFinder:
     """
-    A "Finder" (aka "MetaClassFinder") that never finds any modules,
+    A "Finder" (aka "MetaPathFinder") that never finds any modules,
     but may find distributions.
     """
 
@@ -53,14 +46,6 @@ class NullFinder:
     def find_spec(*args, **kwargs):
         return None
 
-    # In Python 2, the import system requires finders
-    # to have a find_module() method, but this usage
-    # is deprecated in Python 3 in favor of find_spec().
-    # For the purposes of this finder (i.e. being present
-    # on sys.meta_path but having no other import
-    # system functionality), the two methods are identical.
-    find_module = find_spec
-
 
 def pypy_partial(val):
     """
diff --git a/setuptools/_vendor/importlib_metadata/_meta.py b/setuptools/_vendor/importlib_metadata/_meta.py
index 259b15ba19..1927d0f624 100644
--- a/setuptools/_vendor/importlib_metadata/_meta.py
+++ b/setuptools/_vendor/importlib_metadata/_meta.py
@@ -1,24 +1,38 @@
-from ._compat import Protocol
-from typing import Any, Dict, Iterator, List, TypeVar, Union
+from __future__ import annotations
+
+import os
+from typing import Protocol
+from typing import Any, Dict, Iterator, List, Optional, TypeVar, Union, overload
 
 
 _T = TypeVar("_T")
 
 
 class PackageMetadata(Protocol):
-    def __len__(self) -> int:
-        ...  # pragma: no cover
+    def __len__(self) -> int: ...  # pragma: no cover
+
+    def __contains__(self, item: str) -> bool: ...  # pragma: no cover
+
+    def __getitem__(self, key: str) -> str: ...  # pragma: no cover
 
-    def __contains__(self, item: str) -> bool:
-        ...  # pragma: no cover
+    def __iter__(self) -> Iterator[str]: ...  # pragma: no cover
 
-    def __getitem__(self, key: str) -> str:
-        ...  # pragma: no cover
+    @overload
+    def get(
+        self, name: str, failobj: None = None
+    ) -> Optional[str]: ...  # pragma: no cover
 
-    def __iter__(self) -> Iterator[str]:
-        ...  # pragma: no cover
+    @overload
+    def get(self, name: str, failobj: _T) -> Union[str, _T]: ...  # pragma: no cover
 
-    def get_all(self, name: str, failobj: _T = ...) -> Union[List[Any], _T]:
+    # overload per python/importlib_metadata#435
+    @overload
+    def get_all(
+        self, name: str, failobj: None = None
+    ) -> Optional[List[Any]]: ...  # pragma: no cover
+
+    @overload
+    def get_all(self, name: str, failobj: _T) -> Union[List[Any], _T]:
         """
         Return all values associated with a possibly multi-valued key.
         """
@@ -30,20 +44,24 @@ def json(self) -> Dict[str, Union[str, List[str]]]:
         """
 
 
-class SimplePath(Protocol[_T]):
+class SimplePath(Protocol):
     """
-    A minimal subset of pathlib.Path required by PathDistribution.
+    A minimal subset of pathlib.Path required by Distribution.
     """
 
-    def joinpath(self) -> _T:
-        ...  # pragma: no cover
+    def joinpath(
+        self, other: Union[str, os.PathLike[str]]
+    ) -> SimplePath: ...  # pragma: no cover
 
-    def __truediv__(self, other: Union[str, _T]) -> _T:
-        ...  # pragma: no cover
+    def __truediv__(
+        self, other: Union[str, os.PathLike[str]]
+    ) -> SimplePath: ...  # pragma: no cover
 
     @property
-    def parent(self) -> _T:
-        ...  # pragma: no cover
+    def parent(self) -> SimplePath: ...  # pragma: no cover
+
+    def read_text(self, encoding=None) -> str: ...  # pragma: no cover
+
+    def read_bytes(self) -> bytes: ...  # pragma: no cover
 
-    def read_text(self) -> str:
-        ...  # pragma: no cover
+    def exists(self) -> bool: ...  # pragma: no cover
diff --git a/setuptools/_vendor/importlib_resources/tests/zipdata01/__init__.py b/setuptools/_vendor/importlib_metadata/compat/__init__.py
similarity index 100%
rename from setuptools/_vendor/importlib_resources/tests/zipdata01/__init__.py
rename to setuptools/_vendor/importlib_metadata/compat/__init__.py
diff --git a/setuptools/_vendor/importlib_metadata/compat/py311.py b/setuptools/_vendor/importlib_metadata/compat/py311.py
new file mode 100644
index 0000000000..3a5327436f
--- /dev/null
+++ b/setuptools/_vendor/importlib_metadata/compat/py311.py
@@ -0,0 +1,22 @@
+import os
+import pathlib
+import sys
+import types
+
+
+def wrap(path):  # pragma: no cover
+    """
+    Workaround for https://github.com/python/cpython/issues/84538
+    to add backward compatibility for walk_up=True.
+    An example affected package is dask-labextension, which uses
+    jupyter-packaging to install JupyterLab javascript files outside
+    of site-packages.
+    """
+
+    def relative_to(root, *, walk_up=False):
+        return pathlib.Path(os.path.relpath(path, root))
+
+    return types.SimpleNamespace(relative_to=relative_to)
+
+
+relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x
diff --git a/setuptools/_vendor/importlib_metadata/_py39compat.py b/setuptools/_vendor/importlib_metadata/compat/py39.py
similarity index 82%
rename from setuptools/_vendor/importlib_metadata/_py39compat.py
rename to setuptools/_vendor/importlib_metadata/compat/py39.py
index cde4558fbb..1f15bd97e6 100644
--- a/setuptools/_vendor/importlib_metadata/_py39compat.py
+++ b/setuptools/_vendor/importlib_metadata/compat/py39.py
@@ -1,11 +1,12 @@
 """
 Compatibility layer with Python 3.8/3.9
 """
+
 from typing import TYPE_CHECKING, Any, Optional
 
 if TYPE_CHECKING:  # pragma: no cover
     # Prevent circular imports on runtime.
-    from . import Distribution, EntryPoint
+    from .. import Distribution, EntryPoint
 else:
     Distribution = EntryPoint = Any
 
@@ -17,7 +18,7 @@ def normalized_name(dist: Distribution) -> Optional[str]:
     try:
         return dist._normalized_name
     except AttributeError:
-        from . import Prepared  # -> delay to prevent circular imports.
+        from .. import Prepared  # -> delay to prevent circular imports.
 
         return Prepared.normalize(getattr(dist, "name", None) or dist.metadata['Name'])
 
@@ -29,7 +30,7 @@ def ep_matches(ep: EntryPoint, **params) -> bool:
     try:
         return ep.matches(**params)
     except AttributeError:
-        from . import EntryPoint  # -> delay to prevent circular imports.
+        from .. import EntryPoint  # -> delay to prevent circular imports.
 
         # Reconstruct the EntryPoint object to make sure it is compatible.
         return EntryPoint(ep.name, ep.value, ep.group).matches(**params)
diff --git a/setuptools/_vendor/importlib_metadata/diagnose.py b/setuptools/_vendor/importlib_metadata/diagnose.py
new file mode 100644
index 0000000000..e405471ac4
--- /dev/null
+++ b/setuptools/_vendor/importlib_metadata/diagnose.py
@@ -0,0 +1,21 @@
+import sys
+
+from . import Distribution
+
+
+def inspect(path):
+    print("Inspecting", path)
+    dists = list(Distribution.discover(path=[path]))
+    if not dists:
+        return
+    print("Found", len(dists), "packages:", end=' ')
+    print(', '.join(dist.name for dist in dists))
+
+
+def run():
+    for path in sys.path:
+        inspect(path)
+
+
+if __name__ == '__main__':
+    run()
diff --git a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/RECORD b/setuptools/_vendor/importlib_resources-5.10.2.dist-info/RECORD
deleted file mode 100644
index ba764991ee..0000000000
--- a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/RECORD
+++ /dev/null
@@ -1,77 +0,0 @@
-importlib_resources-5.10.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-importlib_resources-5.10.2.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
-importlib_resources-5.10.2.dist-info/METADATA,sha256=Xo5ntATvDYUxdmW8tr8kxtfdiOC9889mOk-LE1LtZfI,4111
-importlib_resources-5.10.2.dist-info/RECORD,,
-importlib_resources-5.10.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources-5.10.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
-importlib_resources-5.10.2.dist-info/top_level.txt,sha256=fHIjHU1GZwAjvcydpmUnUrTnbvdiWjG4OEVZK8by0TQ,20
-importlib_resources/__init__.py,sha256=evPm12kLgYqTm-pbzm60bOuumumT8IpBNWFp0uMyrzE,506
-importlib_resources/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/__pycache__/_adapters.cpython-312.pyc,,
-importlib_resources/__pycache__/_common.cpython-312.pyc,,
-importlib_resources/__pycache__/_compat.cpython-312.pyc,,
-importlib_resources/__pycache__/_itertools.cpython-312.pyc,,
-importlib_resources/__pycache__/_legacy.cpython-312.pyc,,
-importlib_resources/__pycache__/abc.cpython-312.pyc,,
-importlib_resources/__pycache__/readers.cpython-312.pyc,,
-importlib_resources/__pycache__/simple.cpython-312.pyc,,
-importlib_resources/_adapters.py,sha256=o51tP2hpVtohP33gSYyAkGNpLfYDBqxxYsadyiRZi1E,4504
-importlib_resources/_common.py,sha256=jSC4xfLdcMNbtbWHtpzbFkNa0W7kvf__nsYn14C_AEU,5457
-importlib_resources/_compat.py,sha256=dSadF6WPt8MwOqSm_NIOQPhw4x0iaMYTWxi-XS93p7M,2923
-importlib_resources/_itertools.py,sha256=WCdJ1Gs_kNFwKENyIG7TO0Y434IWCu0zjVVSsSbZwU8,884
-importlib_resources/_legacy.py,sha256=0TKdZixxLWA-xwtAZw4HcpqJmj4Xprx1Zkcty0gTRZY,3481
-importlib_resources/abc.py,sha256=Icr2IJ2QtH7vvAB9vC5WRJ9KBoaDyJa7KUs8McuROzo,5140
-importlib_resources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/readers.py,sha256=PZsi5qacr2Qn3KHw4qw3Gm1MzrBblPHoTdjqjH7EKWw,3581
-importlib_resources/simple.py,sha256=0__2TQBTQoqkajYmNPt1HxERcReAT6boVKJA328pr04,2576
-importlib_resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/_compat.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/_path.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_compatibilty_files.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_contents.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_files.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_open.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_path.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_read.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_reader.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_resource.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/update-zips.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/util.cpython-312.pyc,,
-importlib_resources/tests/_compat.py,sha256=YTSB0U1R9oADnh6GrQcOCgojxcF_N6H1LklymEWf9SQ,708
-importlib_resources/tests/_path.py,sha256=yZyWsQzJZQ1Z8ARAxWkjAdaVVsjlzyqxO0qjBUofJ8M,1039
-importlib_resources/tests/data01/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data01/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/data01/subdirectory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data01/subdirectory/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data01/subdirectory/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/data01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
-importlib_resources/tests/data01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
-importlib_resources/tests/data02/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/one/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/one/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/one/resource1.txt,sha256=10flKac7c-XXFzJ3t-AB5MJjlBy__dSZvPE_dOm2q6U,13
-importlib_resources/tests/data02/two/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/two/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/two/resource2.txt,sha256=lt2jbN3TMn9QiFKM832X39bU_62UptDdUkoYzkvEbl0,13
-importlib_resources/tests/namespacedata01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/namespacedata01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
-importlib_resources/tests/namespacedata01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
-importlib_resources/tests/test_compatibilty_files.py,sha256=NWkbIsylI8Wz3Dwsxo1quT4ZI6ToXFA2mojCG6Dzuxw,3260
-importlib_resources/tests/test_contents.py,sha256=V1Xfk3lqTDdvUsZuV18Kndf0CT_tkM2oEIwk9Vv0rhg,968
-importlib_resources/tests/test_files.py,sha256=1Y8da-g0xOQLzuREDYUiRc_qhWlvFNeydW_mUH7l15w,3251
-importlib_resources/tests/test_open.py,sha256=pmEgdrSFdM83L6FxtR8U_RT9BfI3JZ4snGmM_ZZIegY,2565
-importlib_resources/tests/test_path.py,sha256=xvPteNA-UKavDhKgLgrQuXSxKWYH7Q4nSNDVfBX95Gs,2103
-importlib_resources/tests/test_read.py,sha256=EyYvpHJ_7F4LuX2EU_c5EerIBQfRhOFmiIR7LOc5Y5E,2408
-importlib_resources/tests/test_reader.py,sha256=nPhldbYPq3fXoQs0ZAub4atjhp2lgNyLNv2G1pg6Agw,4480
-importlib_resources/tests/test_resource.py,sha256=EMoarxTEHcrq8R41LQDsndIG8Idtm4I_LpN8DYpHtT0,8478
-importlib_resources/tests/update-zips.py,sha256=x-SrO5v87iLLUMXyefxDwAd3imAs_slI94sLWvJ6N40,1417
-importlib_resources/tests/util.py,sha256=ARAlxZ47wC-lgR7PGlmgBoi4HnhzcykD5Is2-TAwY0I,4873
-importlib_resources/tests/zipdata01/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/zipdata01/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/zipdata01/ziptestdata.zip,sha256=z5Of4dsv3T0t-46B0MsVhxlhsPGMz28aUhJDWpj3_oY,876
-importlib_resources/tests/zipdata02/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/zipdata02/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/zipdata02/ziptestdata.zip,sha256=ydI-_j-xgQ7tDxqBp9cjOqXBGxUp6ZBbwVJu6Xj-nrY,698
diff --git a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/INSTALLER b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/jaraco.functools-4.0.0.dist-info/INSTALLER
rename to setuptools/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER
diff --git a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/LICENSE b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/LICENSE
similarity index 100%
rename from setuptools/_vendor/importlib_resources-5.10.2.dist-info/LICENSE
rename to setuptools/_vendor/importlib_resources-6.4.0.dist-info/LICENSE
diff --git a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/METADATA b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/METADATA
similarity index 67%
rename from setuptools/_vendor/importlib_resources-5.10.2.dist-info/METADATA
rename to setuptools/_vendor/importlib_resources-6.4.0.dist-info/METADATA
index a9995f09a3..b088e721d2 100644
--- a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/METADATA
+++ b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/METADATA
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
-Name: importlib-resources
-Version: 5.10.2
+Name: importlib_resources
+Version: 6.4.0
 Summary: Read resources from Python packages
 Home-page: https://github.com/python/importlib_resources
 Author: Barry Warsaw
@@ -11,43 +11,44 @@ Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.7
+Requires-Python: >=3.8
 License-File: LICENSE
-Requires-Dist: zipp (>=3.1.0) ; python_version < "3.10"
+Requires-Dist: zipp >=3.1.0 ; python_version < "3.10"
 Provides-Extra: docs
-Requires-Dist: sphinx (>=3.5) ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=9) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
+Requires-Dist: sphinx >=3.5 ; extra == 'docs'
+Requires-Dist: sphinx <7.2.5 ; extra == 'docs'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
+Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
 Requires-Dist: furo ; extra == 'docs'
 Requires-Dist: sphinx-lint ; extra == 'docs'
-Requires-Dist: jaraco.tidelift (>=1.4) ; extra == 'docs'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'docs'
 Provides-Extra: testing
-Requires-Dist: pytest (>=6) ; extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
-Requires-Dist: flake8 (<5) ; extra == 'testing'
+Requires-Dist: pytest >=6 ; extra == 'testing'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
 Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler (>=1.3) ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy (>=0.9.1) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-flake8 ; (python_version < "3.12") and extra == 'testing'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
+Requires-Dist: zipp >=3.17 ; extra == 'testing'
+Requires-Dist: jaraco.test >=5.4 ; extra == 'testing'
+Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
 
 .. image:: https://img.shields.io/pypi/v/importlib_resources.svg
    :target: https://pypi.org/project/importlib_resources
 
 .. image:: https://img.shields.io/pypi/pyversions/importlib_resources.svg
 
-.. image:: https://github.com/python/importlib_resources/workflows/tests/badge.svg
+.. image:: https://github.com/python/importlib_resources/actions/workflows/main.yml/badge.svg
    :target: https://github.com/python/importlib_resources/actions?query=workflow%3A%22tests%22
    :alt: tests
 
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
 
 .. image:: https://readthedocs.org/projects/importlib-resources/badge/?version=latest
    :target: https://importlib-resources.readthedocs.io/en/latest/?badge=latest
 
-.. image:: https://img.shields.io/badge/skeleton-2022-informational
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
    :target: https://blog.jaraco.com/skeleton
 
 .. image:: https://tidelift.com/badges/package/pypi/importlib-resources
@@ -76,7 +77,9 @@ were contributed to different versions in the standard library:
 
    * - importlib_resources
      - stdlib
-   * - 5.9
+   * - 6.0
+     - 3.13
+   * - 5.12
      - 3.12
    * - 5.7
      - 3.11
@@ -95,10 +98,3 @@ Available as part of the Tidelift Subscription.
 This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
 
 `Learn more `_.
-
-Security Contact
-================
-
-To report a security vulnerability, please use the
-`Tidelift security contact `_.
-Tidelift will coordinate the fix and disclosure.
diff --git a/setuptools/_vendor/importlib_resources-6.4.0.dist-info/RECORD b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/RECORD
new file mode 100644
index 0000000000..18888dea71
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/RECORD
@@ -0,0 +1,89 @@
+importlib_resources-6.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+importlib_resources-6.4.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
+importlib_resources-6.4.0.dist-info/METADATA,sha256=g4eM2LuL0OiZcUVND0qwDJUpE29gOvtO3BSPXTbO9Fk,3944
+importlib_resources-6.4.0.dist-info/RECORD,,
+importlib_resources-6.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources-6.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+importlib_resources-6.4.0.dist-info/top_level.txt,sha256=fHIjHU1GZwAjvcydpmUnUrTnbvdiWjG4OEVZK8by0TQ,20
+importlib_resources/__init__.py,sha256=uyp1kzYR6SawQBsqlyaXXfIxJx4Z2mM8MjmZn8qq2Gk,505
+importlib_resources/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/__pycache__/_adapters.cpython-312.pyc,,
+importlib_resources/__pycache__/_common.cpython-312.pyc,,
+importlib_resources/__pycache__/_itertools.cpython-312.pyc,,
+importlib_resources/__pycache__/abc.cpython-312.pyc,,
+importlib_resources/__pycache__/functional.cpython-312.pyc,,
+importlib_resources/__pycache__/readers.cpython-312.pyc,,
+importlib_resources/__pycache__/simple.cpython-312.pyc,,
+importlib_resources/_adapters.py,sha256=vprJGbUeHbajX6XCuMP6J3lMrqCi-P_MTlziJUR7jfk,4482
+importlib_resources/_common.py,sha256=blt4-ZtHnbUPzQQyPP7jLGgl_86btIW5ZhIsEhclhoA,5571
+importlib_resources/_itertools.py,sha256=eDisV6RqiNZOogLSXf6LOGHOYc79FGgPrKNLzFLmCrU,1277
+importlib_resources/abc.py,sha256=UKNU9ncEDkZRB3txcGb3WLxsL2iju9JbaLTI-dfLE_4,5162
+importlib_resources/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/compat/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/compat/__pycache__/py38.cpython-312.pyc,,
+importlib_resources/compat/__pycache__/py39.cpython-312.pyc,,
+importlib_resources/compat/py38.py,sha256=MWhut3XsAJwBYUaa5Qb2AoCrZNqcQjVThP-P1uBoE_4,230
+importlib_resources/compat/py39.py,sha256=Wfln4uQUShNz1XdCG-toG6_Y0WrlUmO9JzpvtcfQ-Cw,184
+importlib_resources/functional.py,sha256=mLU4DwSlh8_2IXWqwKOfPVxyRqAEpB3B4XTfRxr3X3M,2651
+importlib_resources/future/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/future/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/future/__pycache__/adapters.cpython-312.pyc,,
+importlib_resources/future/adapters.py,sha256=1-MF2VRcCButhcC1OMfZILU9o3kwZ4nXB2lurXpaIAw,2940
+importlib_resources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/readers.py,sha256=WNKurBHHVu9EVtUhWkOj2fxH50HP7uanNFuupAqH2S8,5863
+importlib_resources/simple.py,sha256=CQ3TiIMFiJs_80o-7xJL1EpbUUVna4-NGDrSTQ3HW2Y,2584
+importlib_resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/_path.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_compatibilty_files.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_contents.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_custom.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_files.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_functional.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_open.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_path.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_read.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_reader.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_resource.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/util.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/zip.cpython-312.pyc,,
+importlib_resources/tests/_path.py,sha256=nkv3ek7D1U898v921rYbldDCtKri2oyYOi3EJqGjEGU,1289
+importlib_resources/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/compat/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/compat/__pycache__/py312.cpython-312.pyc,,
+importlib_resources/tests/compat/__pycache__/py39.cpython-312.pyc,,
+importlib_resources/tests/compat/py312.py,sha256=qcWjpZhQo2oEsdwIlRRQHrsMGDltkFTnETeG7fLdUS8,364
+importlib_resources/tests/compat/py39.py,sha256=lRTk0RWAOEb9RzAgvdRnqJUGCBLc3qoFQwzuJSa_zP4,329
+importlib_resources/tests/data01/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data01/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
+importlib_resources/tests/data01/subdirectory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data01/subdirectory/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data01/subdirectory/binary.file,sha256=xtRM9Bj2EOP-nh2SlP9D3vgcbNytbLsYIM_0jTqkNV0,4
+importlib_resources/tests/data01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
+importlib_resources/tests/data01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
+importlib_resources/tests/data02/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data02/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data02/one/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data02/one/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data02/one/resource1.txt,sha256=10flKac7c-XXFzJ3t-AB5MJjlBy__dSZvPE_dOm2q6U,13
+importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt,sha256=jnrBBztxYrtQck7cmVnc4xQVO4-agzAZDGSFkAWtlFw,10
+importlib_resources/tests/data02/two/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data02/two/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data02/two/resource2.txt,sha256=lt2jbN3TMn9QiFKM832X39bU_62UptDdUkoYzkvEbl0,13
+importlib_resources/tests/namespacedata01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
+importlib_resources/tests/namespacedata01/subdirectory/binary.file,sha256=cbkhEL8TXIVYHIoSj2oZwPasp1KwxskeNXGJnPCbFF0,4
+importlib_resources/tests/namespacedata01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
+importlib_resources/tests/namespacedata01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
+importlib_resources/tests/test_compatibilty_files.py,sha256=95N_R7aik8cvnE6sBJpsxmP0K5plOWRIJDgbalD-Hpw,3314
+importlib_resources/tests/test_contents.py,sha256=70HW3mL_hv05Emv-OgdmwoLhXxjtuVxiWVaUpgRaRWA,930
+importlib_resources/tests/test_custom.py,sha256=QrHZqIWl0e-fsQRfm0ych8stOlKJOsAIU3rK6QOcyN0,1221
+importlib_resources/tests/test_files.py,sha256=OcShYu33kCcyXlDyZSVPkJNE08h-N_4bQOLV2QaSqX0,3472
+importlib_resources/tests/test_functional.py,sha256=ByCVViAwb2PIlKvDNJEqTZ0aLZGpFl5qa7CMCX-7HKM,8591
+importlib_resources/tests/test_open.py,sha256=ccmzbOeEa6zTd4ymZZ8yISrecfuYV0jhon-Vddqysu4,2778
+importlib_resources/tests/test_path.py,sha256=x8r2gJxG3hFM9xCOFNkgmHYXxsMldMLTSW_AZYf1l-A,2009
+importlib_resources/tests/test_read.py,sha256=7tsILQ2NoqVGFQxhHqxBwc5hWcN8b_3idojCsszTNfQ,3112
+importlib_resources/tests/test_reader.py,sha256=IcIUXaiPAtuahGV4_ZT4YXFLMMsJmcM1iOxqdIH2Aa4,5001
+importlib_resources/tests/test_resource.py,sha256=fcF8WgZ6rDCTRFnxtAUbdiaNe4G23yGovT1nb2dc7ls,7823
+importlib_resources/tests/util.py,sha256=vjVzEyX0X2RkTN-wGiQiplayp9sZom4JDjJinTNewos,4745
+importlib_resources/tests/zip.py,sha256=2MKmF8-osXBJSnqcUTuAUek_-tSB3iKmIT9qPhcsOsM,783
diff --git a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/REQUESTED b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/REQUESTED
similarity index 100%
rename from setuptools/_vendor/jaraco.text-3.7.0.dist-info/REQUESTED
rename to setuptools/_vendor/importlib_resources-6.4.0.dist-info/REQUESTED
diff --git a/setuptools/_vendor/ordered_set-3.1.1.dist-info/WHEEL b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
similarity index 83%
rename from setuptools/_vendor/ordered_set-3.1.1.dist-info/WHEEL
rename to setuptools/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
index 832be11132..bab98d6758 100644
--- a/setuptools/_vendor/ordered_set-3.1.1.dist-info/WHEEL
+++ b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
@@ -1,6 +1,5 @@
 Wheel-Version: 1.0
 Generator: bdist_wheel (0.43.0)
 Root-Is-Purelib: true
-Tag: py2-none-any
 Tag: py3-none-any
 
diff --git a/setuptools/_vendor/importlib_resources-5.10.2.dist-info/top_level.txt b/setuptools/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt
similarity index 100%
rename from setuptools/_vendor/importlib_resources-5.10.2.dist-info/top_level.txt
rename to setuptools/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt
diff --git a/setuptools/_vendor/importlib_resources/__init__.py b/setuptools/_vendor/importlib_resources/__init__.py
index 34e3a9950c..0d029abd63 100644
--- a/setuptools/_vendor/importlib_resources/__init__.py
+++ b/setuptools/_vendor/importlib_resources/__init__.py
@@ -4,17 +4,17 @@
     as_file,
     files,
     Package,
+    Anchor,
 )
 
-from ._legacy import (
+from .functional import (
     contents,
+    is_resource,
     open_binary,
-    read_binary,
     open_text,
-    read_text,
-    is_resource,
     path,
-    Resource,
+    read_binary,
+    read_text,
 )
 
 from .abc import ResourceReader
@@ -22,11 +22,11 @@
 
 __all__ = [
     'Package',
-    'Resource',
+    'Anchor',
     'ResourceReader',
     'as_file',
-    'contents',
     'files',
+    'contents',
     'is_resource',
     'open_binary',
     'open_text',
diff --git a/setuptools/_vendor/importlib_resources/_adapters.py b/setuptools/_vendor/importlib_resources/_adapters.py
index ea363d86a5..50688fbb66 100644
--- a/setuptools/_vendor/importlib_resources/_adapters.py
+++ b/setuptools/_vendor/importlib_resources/_adapters.py
@@ -34,9 +34,7 @@ def _io_wrapper(file, mode='r', *args, **kwargs):
         return TextIOWrapper(file, *args, **kwargs)
     elif mode == 'rb':
         return file
-    raise ValueError(
-        "Invalid mode value '{}', only 'r' and 'rb' are supported".format(mode)
-    )
+    raise ValueError(f"Invalid mode value '{mode}', only 'r' and 'rb' are supported")
 
 
 class CompatibilityFiles:
diff --git a/setuptools/_vendor/importlib_resources/_common.py b/setuptools/_vendor/importlib_resources/_common.py
index 3c6de1cfb2..8df6b39e41 100644
--- a/setuptools/_vendor/importlib_resources/_common.py
+++ b/setuptools/_vendor/importlib_resources/_common.py
@@ -12,8 +12,6 @@
 from typing import Union, Optional, cast
 from .abc import ResourceReader, Traversable
 
-from ._compat import wrap_spec
-
 Package = Union[types.ModuleType, str]
 Anchor = Package
 
@@ -27,6 +25,8 @@ def package_to_anchor(func):
     >>> files('a', 'b')
     Traceback (most recent call last):
     TypeError: files() takes from 0 to 1 positional arguments but 2 were given
+
+    Remove this compatibility in Python 3.14.
     """
     undefined = object()
 
@@ -109,6 +109,9 @@ def from_package(package: types.ModuleType):
     Return a Traversable object for the given package.
 
     """
+    # deferred for performance (python/cpython#109829)
+    from .future.adapters import wrap_spec
+
     spec = wrap_spec(package)
     reader = spec.loader.get_resource_reader(spec.name)
     return reader.files()
diff --git a/setuptools/_vendor/importlib_resources/_compat.py b/setuptools/_vendor/importlib_resources/_compat.py
deleted file mode 100644
index 8b5b1d280f..0000000000
--- a/setuptools/_vendor/importlib_resources/_compat.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# flake8: noqa
-
-import abc
-import os
-import sys
-import pathlib
-from contextlib import suppress
-from typing import Union
-
-
-if sys.version_info >= (3, 10):
-    from zipfile import Path as ZipPath  # type: ignore
-else:
-    from ..zipp import Path as ZipPath  # type: ignore
-
-
-try:
-    from typing import runtime_checkable  # type: ignore
-except ImportError:
-
-    def runtime_checkable(cls):  # type: ignore
-        return cls
-
-
-try:
-    from typing import Protocol  # type: ignore
-except ImportError:
-    Protocol = abc.ABC  # type: ignore
-
-
-class TraversableResourcesLoader:
-    """
-    Adapt loaders to provide TraversableResources and other
-    compatibility.
-
-    Used primarily for Python 3.9 and earlier where the native
-    loaders do not yet implement TraversableResources.
-    """
-
-    def __init__(self, spec):
-        self.spec = spec
-
-    @property
-    def path(self):
-        return self.spec.origin
-
-    def get_resource_reader(self, name):
-        from . import readers, _adapters
-
-        def _zip_reader(spec):
-            with suppress(AttributeError):
-                return readers.ZipReader(spec.loader, spec.name)
-
-        def _namespace_reader(spec):
-            with suppress(AttributeError, ValueError):
-                return readers.NamespaceReader(spec.submodule_search_locations)
-
-        def _available_reader(spec):
-            with suppress(AttributeError):
-                return spec.loader.get_resource_reader(spec.name)
-
-        def _native_reader(spec):
-            reader = _available_reader(spec)
-            return reader if hasattr(reader, 'files') else None
-
-        def _file_reader(spec):
-            try:
-                path = pathlib.Path(self.path)
-            except TypeError:
-                return None
-            if path.exists():
-                return readers.FileReader(self)
-
-        return (
-            # native reader if it supplies 'files'
-            _native_reader(self.spec)
-            or
-            # local ZipReader if a zip module
-            _zip_reader(self.spec)
-            or
-            # local NamespaceReader if a namespace module
-            _namespace_reader(self.spec)
-            or
-            # local FileReader
-            _file_reader(self.spec)
-            # fallback - adapt the spec ResourceReader to TraversableReader
-            or _adapters.CompatibilityFiles(self.spec)
-        )
-
-
-def wrap_spec(package):
-    """
-    Construct a package spec with traversable compatibility
-    on the spec/loader/reader.
-
-    Supersedes _adapters.wrap_spec to use TraversableResourcesLoader
-    from above for older Python compatibility (<3.10).
-    """
-    from . import _adapters
-
-    return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
-
-
-if sys.version_info >= (3, 9):
-    StrPath = Union[str, os.PathLike[str]]
-else:
-    # PathLike is only subscriptable at runtime in 3.9+
-    StrPath = Union[str, "os.PathLike[str]"]
diff --git a/setuptools/_vendor/importlib_resources/_itertools.py b/setuptools/_vendor/importlib_resources/_itertools.py
index cce05582ff..7b775ef5ae 100644
--- a/setuptools/_vendor/importlib_resources/_itertools.py
+++ b/setuptools/_vendor/importlib_resources/_itertools.py
@@ -1,35 +1,38 @@
-from itertools import filterfalse
+# from more_itertools 9.0
+def only(iterable, default=None, too_long=None):
+    """If *iterable* has only one item, return it.
+    If it has zero items, return *default*.
+    If it has more than one item, raise the exception given by *too_long*,
+    which is ``ValueError`` by default.
+    >>> only([], default='missing')
+    'missing'
+    >>> only([1])
+    1
+    >>> only([1, 2])  # doctest: +IGNORE_EXCEPTION_DETAIL
+    Traceback (most recent call last):
+    ...
+    ValueError: Expected exactly one item in iterable, but got 1, 2,
+     and perhaps more.'
+    >>> only([1, 2], too_long=TypeError)  # doctest: +IGNORE_EXCEPTION_DETAIL
+    Traceback (most recent call last):
+    ...
+    TypeError
+    Note that :func:`only` attempts to advance *iterable* twice to ensure there
+    is only one item.  See :func:`spy` or :func:`peekable` to check
+    iterable contents less destructively.
+    """
+    it = iter(iterable)
+    first_value = next(it, default)
 
-from typing import (
-    Callable,
-    Iterable,
-    Iterator,
-    Optional,
-    Set,
-    TypeVar,
-    Union,
-)
-
-# Type and type variable definitions
-_T = TypeVar('_T')
-_U = TypeVar('_U')
-
-
-def unique_everseen(
-    iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = None
-) -> Iterator[_T]:
-    "List unique elements, preserving order. Remember all elements ever seen."
-    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
-    # unique_everseen('ABBCcAD', str.lower) --> A B C D
-    seen: Set[Union[_T, _U]] = set()
-    seen_add = seen.add
-    if key is None:
-        for element in filterfalse(seen.__contains__, iterable):
-            seen_add(element)
-            yield element
+    try:
+        second_value = next(it)
+    except StopIteration:
+        pass
     else:
-        for element in iterable:
-            k = key(element)
-            if k not in seen:
-                seen_add(k)
-                yield element
+        msg = (
+            'Expected exactly one item in iterable, but got {!r}, {!r}, '
+            'and perhaps more.'.format(first_value, second_value)
+        )
+        raise too_long or ValueError(msg)
+
+    return first_value
diff --git a/setuptools/_vendor/importlib_resources/_legacy.py b/setuptools/_vendor/importlib_resources/_legacy.py
deleted file mode 100644
index b1ea8105da..0000000000
--- a/setuptools/_vendor/importlib_resources/_legacy.py
+++ /dev/null
@@ -1,120 +0,0 @@
-import functools
-import os
-import pathlib
-import types
-import warnings
-
-from typing import Union, Iterable, ContextManager, BinaryIO, TextIO, Any
-
-from . import _common
-
-Package = Union[types.ModuleType, str]
-Resource = str
-
-
-def deprecated(func):
-    @functools.wraps(func)
-    def wrapper(*args, **kwargs):
-        warnings.warn(
-            f"{func.__name__} is deprecated. Use files() instead. "
-            "Refer to https://importlib-resources.readthedocs.io"
-            "/en/latest/using.html#migrating-from-legacy for migration advice.",
-            DeprecationWarning,
-            stacklevel=2,
-        )
-        return func(*args, **kwargs)
-
-    return wrapper
-
-
-def normalize_path(path: Any) -> str:
-    """Normalize a path by ensuring it is a string.
-
-    If the resulting string contains path separators, an exception is raised.
-    """
-    str_path = str(path)
-    parent, file_name = os.path.split(str_path)
-    if parent:
-        raise ValueError(f'{path!r} must be only a file name')
-    return file_name
-
-
-@deprecated
-def open_binary(package: Package, resource: Resource) -> BinaryIO:
-    """Return a file-like object opened for binary reading of the resource."""
-    return (_common.files(package) / normalize_path(resource)).open('rb')
-
-
-@deprecated
-def read_binary(package: Package, resource: Resource) -> bytes:
-    """Return the binary contents of the resource."""
-    return (_common.files(package) / normalize_path(resource)).read_bytes()
-
-
-@deprecated
-def open_text(
-    package: Package,
-    resource: Resource,
-    encoding: str = 'utf-8',
-    errors: str = 'strict',
-) -> TextIO:
-    """Return a file-like object opened for text reading of the resource."""
-    return (_common.files(package) / normalize_path(resource)).open(
-        'r', encoding=encoding, errors=errors
-    )
-
-
-@deprecated
-def read_text(
-    package: Package,
-    resource: Resource,
-    encoding: str = 'utf-8',
-    errors: str = 'strict',
-) -> str:
-    """Return the decoded string of the resource.
-
-    The decoding-related arguments have the same semantics as those of
-    bytes.decode().
-    """
-    with open_text(package, resource, encoding, errors) as fp:
-        return fp.read()
-
-
-@deprecated
-def contents(package: Package) -> Iterable[str]:
-    """Return an iterable of entries in `package`.
-
-    Note that not all entries are resources.  Specifically, directories are
-    not considered resources.  Use `is_resource()` on each entry returned here
-    to check if it is a resource or not.
-    """
-    return [path.name for path in _common.files(package).iterdir()]
-
-
-@deprecated
-def is_resource(package: Package, name: str) -> bool:
-    """True if `name` is a resource inside `package`.
-
-    Directories are *not* resources.
-    """
-    resource = normalize_path(name)
-    return any(
-        traversable.name == resource and traversable.is_file()
-        for traversable in _common.files(package).iterdir()
-    )
-
-
-@deprecated
-def path(
-    package: Package,
-    resource: Resource,
-) -> ContextManager[pathlib.Path]:
-    """A context manager providing a file path object to the resource.
-
-    If the resource does not already exist on its own on the file system,
-    a temporary file will be created. If the file was created, the file
-    will be deleted upon exiting the context manager (no exception is
-    raised if the file was deleted prior to the context manager
-    exiting).
-    """
-    return _common.as_file(_common.files(package) / normalize_path(resource))
diff --git a/setuptools/_vendor/importlib_resources/abc.py b/setuptools/_vendor/importlib_resources/abc.py
index 23b6aeafe4..7a58dd2f96 100644
--- a/setuptools/_vendor/importlib_resources/abc.py
+++ b/setuptools/_vendor/importlib_resources/abc.py
@@ -3,8 +3,9 @@
 import itertools
 import pathlib
 from typing import Any, BinaryIO, Iterable, Iterator, NoReturn, Text, Optional
+from typing import runtime_checkable, Protocol
 
-from ._compat import runtime_checkable, Protocol, StrPath
+from .compat.py38 import StrPath
 
 
 __all__ = ["ResourceReader", "Traversable", "TraversableResources"]
diff --git a/setuptools/_vendor/importlib_resources/tests/zipdata02/__init__.py b/setuptools/_vendor/importlib_resources/compat/__init__.py
similarity index 100%
rename from setuptools/_vendor/importlib_resources/tests/zipdata02/__init__.py
rename to setuptools/_vendor/importlib_resources/compat/__init__.py
diff --git a/setuptools/_vendor/importlib_resources/compat/py38.py b/setuptools/_vendor/importlib_resources/compat/py38.py
new file mode 100644
index 0000000000..4d548257f8
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/compat/py38.py
@@ -0,0 +1,11 @@
+import os
+import sys
+
+from typing import Union
+
+
+if sys.version_info >= (3, 9):
+    StrPath = Union[str, os.PathLike[str]]
+else:
+    # PathLike is only subscriptable at runtime in 3.9+
+    StrPath = Union[str, "os.PathLike[str]"]
diff --git a/setuptools/_vendor/importlib_resources/compat/py39.py b/setuptools/_vendor/importlib_resources/compat/py39.py
new file mode 100644
index 0000000000..ab87b9dc14
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/compat/py39.py
@@ -0,0 +1,10 @@
+import sys
+
+
+__all__ = ['ZipPath']
+
+
+if sys.version_info >= (3, 10):
+    from zipfile import Path as ZipPath  # type: ignore
+else:
+    from zipp import Path as ZipPath  # type: ignore
diff --git a/setuptools/_vendor/importlib_resources/functional.py b/setuptools/_vendor/importlib_resources/functional.py
new file mode 100644
index 0000000000..f59416f2dd
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/functional.py
@@ -0,0 +1,81 @@
+"""Simplified function-based API for importlib.resources"""
+
+import warnings
+
+from ._common import files, as_file
+
+
+_MISSING = object()
+
+
+def open_binary(anchor, *path_names):
+    """Open for binary reading the *resource* within *package*."""
+    return _get_resource(anchor, path_names).open('rb')
+
+
+def open_text(anchor, *path_names, encoding=_MISSING, errors='strict'):
+    """Open for text reading the *resource* within *package*."""
+    encoding = _get_encoding_arg(path_names, encoding)
+    resource = _get_resource(anchor, path_names)
+    return resource.open('r', encoding=encoding, errors=errors)
+
+
+def read_binary(anchor, *path_names):
+    """Read and return contents of *resource* within *package* as bytes."""
+    return _get_resource(anchor, path_names).read_bytes()
+
+
+def read_text(anchor, *path_names, encoding=_MISSING, errors='strict'):
+    """Read and return contents of *resource* within *package* as str."""
+    encoding = _get_encoding_arg(path_names, encoding)
+    resource = _get_resource(anchor, path_names)
+    return resource.read_text(encoding=encoding, errors=errors)
+
+
+def path(anchor, *path_names):
+    """Return the path to the *resource* as an actual file system path."""
+    return as_file(_get_resource(anchor, path_names))
+
+
+def is_resource(anchor, *path_names):
+    """Return ``True`` if there is a resource named *name* in the package,
+
+    Otherwise returns ``False``.
+    """
+    return _get_resource(anchor, path_names).is_file()
+
+
+def contents(anchor, *path_names):
+    """Return an iterable over the named resources within the package.
+
+    The iterable returns :class:`str` resources (e.g. files).
+    The iterable does not recurse into subdirectories.
+    """
+    warnings.warn(
+        "importlib.resources.contents is deprecated. "
+        "Use files(anchor).iterdir() instead.",
+        DeprecationWarning,
+        stacklevel=1,
+    )
+    return (resource.name for resource in _get_resource(anchor, path_names).iterdir())
+
+
+def _get_encoding_arg(path_names, encoding):
+    # For compatibility with versions where *encoding* was a positional
+    # argument, it needs to be given explicitly when there are multiple
+    # *path_names*.
+    # This limitation can be removed in Python 3.15.
+    if encoding is _MISSING:
+        if len(path_names) > 1:
+            raise TypeError(
+                "'encoding' argument required with multiple path names",
+            )
+        else:
+            return 'utf-8'
+    return encoding
+
+
+def _get_resource(anchor, path_names):
+    if anchor is None:
+        raise TypeError("anchor must be module or string, got None")
+    return files(anchor).joinpath(*path_names)
diff --git a/setuptools/_vendor/jaraco/__init__.py b/setuptools/_vendor/importlib_resources/future/__init__.py
similarity index 100%
rename from setuptools/_vendor/jaraco/__init__.py
rename to setuptools/_vendor/importlib_resources/future/__init__.py
diff --git a/setuptools/_vendor/importlib_resources/future/adapters.py b/setuptools/_vendor/importlib_resources/future/adapters.py
new file mode 100644
index 0000000000..0e9764bae8
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/future/adapters.py
@@ -0,0 +1,95 @@
+import functools
+import pathlib
+from contextlib import suppress
+from types import SimpleNamespace
+
+from .. import readers, _adapters
+
+
+def _block_standard(reader_getter):
+    """
+    Wrap _adapters.TraversableResourcesLoader.get_resource_reader
+    and intercept any standard library readers.
+    """
+
+    @functools.wraps(reader_getter)
+    def wrapper(*args, **kwargs):
+        """
+        If the reader is from the standard library, return None to allow
+        allow likely newer implementations in this library to take precedence.
+        """
+        try:
+            reader = reader_getter(*args, **kwargs)
+        except NotADirectoryError:
+            # MultiplexedPath may fail on zip subdirectory
+            return
+        # Python 3.10+
+        mod_name = reader.__class__.__module__
+        if mod_name.startswith('importlib.') and mod_name.endswith('readers'):
+            return
+        # Python 3.8, 3.9
+        if isinstance(reader, _adapters.CompatibilityFiles) and (
+            reader.spec.loader.__class__.__module__.startswith('zipimport')
+            or reader.spec.loader.__class__.__module__.startswith(
+                '_frozen_importlib_external'
+            )
+        ):
+            return
+        return reader
+
+    return wrapper
+
+
+def _skip_degenerate(reader):
+    """
+    Mask any degenerate reader. Ref #298.
+    """
+    is_degenerate = (
+        isinstance(reader, _adapters.CompatibilityFiles) and not reader._reader
+    )
+    return reader if not is_degenerate else None
+
+
+class TraversableResourcesLoader(_adapters.TraversableResourcesLoader):
+    """
+    Adapt loaders to provide TraversableResources and other
+    compatibility.
+
+    Ensures the readers from importlib_resources are preferred
+    over stdlib readers.
+    """
+
+    def get_resource_reader(self, name):
+        return (
+            _skip_degenerate(_block_standard(super().get_resource_reader)(name))
+            or self._standard_reader()
+            or super().get_resource_reader(name)
+        )
+
+    def _standard_reader(self):
+        return self._zip_reader() or self._namespace_reader() or self._file_reader()
+
+    def _zip_reader(self):
+        with suppress(AttributeError):
+            return readers.ZipReader(self.spec.loader, self.spec.name)
+
+    def _namespace_reader(self):
+        with suppress(AttributeError, ValueError):
+            return readers.NamespaceReader(self.spec.submodule_search_locations)
+
+    def _file_reader(self):
+        try:
+            path = pathlib.Path(self.spec.origin)
+        except TypeError:
+            return None
+        if path.exists():
+            return readers.FileReader(SimpleNamespace(path=path))
+
+
+def wrap_spec(package):
+    """
+    Override _adapters.wrap_spec to use TraversableResourcesLoader
+    from above. Ensures that future behavior is always available on older
+    Pythons.
+    """
+    return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
diff --git a/setuptools/_vendor/importlib_resources/readers.py b/setuptools/_vendor/importlib_resources/readers.py
index ab34db7409..4a80a774aa 100644
--- a/setuptools/_vendor/importlib_resources/readers.py
+++ b/setuptools/_vendor/importlib_resources/readers.py
@@ -1,11 +1,15 @@
 import collections
+import contextlib
+import itertools
 import pathlib
 import operator
+import re
+import warnings
 
 from . import abc
 
-from ._itertools import unique_everseen
-from ._compat import ZipPath
+from ._itertools import only
+from .compat.py39 import ZipPath
 
 
 def remove_duplicates(items):
@@ -41,8 +45,10 @@ def open_resource(self, resource):
             raise FileNotFoundError(exc.args[0])
 
     def is_resource(self, path):
-        # workaround for `zipfile.Path.is_file` returning true
-        # for non-existent paths.
+        """
+        Workaround for `zipfile.Path.is_file` returning true
+        for non-existent paths.
+        """
         target = self.files().joinpath(path)
         return target.is_file() and target.exists()
 
@@ -59,7 +65,7 @@ class MultiplexedPath(abc.Traversable):
     """
 
     def __init__(self, *paths):
-        self._paths = list(map(pathlib.Path, remove_duplicates(paths)))
+        self._paths = list(map(_ensure_traversable, remove_duplicates(paths)))
         if not self._paths:
             message = 'MultiplexedPath must contain at least one path'
             raise FileNotFoundError(message)
@@ -67,8 +73,10 @@ def __init__(self, *paths):
             raise NotADirectoryError('MultiplexedPath only supports directories')
 
     def iterdir(self):
-        files = (file for path in self._paths for file in path.iterdir())
-        return unique_everseen(files, key=operator.attrgetter('name'))
+        children = (child for path in self._paths for child in path.iterdir())
+        by_name = operator.attrgetter('name')
+        groups = itertools.groupby(sorted(children, key=by_name), key=by_name)
+        return map(self._follow, (locs for name, locs in groups))
 
     def read_bytes(self):
         raise FileNotFoundError(f'{self} is not a file')
@@ -90,6 +98,25 @@ def joinpath(self, *descendants):
             # Just return something that will not exist.
             return self._paths[0].joinpath(*descendants)
 
+    @classmethod
+    def _follow(cls, children):
+        """
+        Construct a MultiplexedPath if needed.
+
+        If children contains a sole element, return it.
+        Otherwise, return a MultiplexedPath of the items.
+        Unless one of the items is not a Directory, then return the first.
+        """
+        subdirs, one_dir, one_file = itertools.tee(children, 3)
+
+        try:
+            return only(one_dir)
+        except ValueError:
+            try:
+                return cls(*subdirs)
+            except NotADirectoryError:
+                return next(one_file)
+
     def open(self, *args, **kwargs):
         raise FileNotFoundError(f'{self} is not a file')
 
@@ -106,7 +133,36 @@ class NamespaceReader(abc.TraversableResources):
     def __init__(self, namespace_path):
         if 'NamespacePath' not in str(namespace_path):
             raise ValueError('Invalid path')
-        self.path = MultiplexedPath(*list(namespace_path))
+        self.path = MultiplexedPath(*map(self._resolve, namespace_path))
+
+    @classmethod
+    def _resolve(cls, path_str) -> abc.Traversable:
+        r"""
+        Given an item from a namespace path, resolve it to a Traversable.
+
+        path_str might be a directory on the filesystem or a path to a
+        zipfile plus the path within the zipfile, e.g. ``/foo/bar`` or
+        ``/foo/baz.zip/inner_dir`` or ``foo\baz.zip\inner_dir\sub``.
+        """
+        (dir,) = (cand for cand in cls._candidate_paths(path_str) if cand.is_dir())
+        return dir
+
+    @classmethod
+    def _candidate_paths(cls, path_str):
+        yield pathlib.Path(path_str)
+        yield from cls._resolve_zip_path(path_str)
+
+    @staticmethod
+    def _resolve_zip_path(path_str):
+        for match in reversed(list(re.finditer(r'[\\/]', path_str))):
+            with contextlib.suppress(
+                FileNotFoundError,
+                IsADirectoryError,
+                NotADirectoryError,
+                PermissionError,
+            ):
+                inner = path_str[match.end() :].replace('\\', '/') + '/'
+                yield ZipPath(path_str[: match.start()], inner.lstrip('/'))
 
     def resource_path(self, resource):
         """
@@ -118,3 +174,21 @@ def resource_path(self, resource):
 
     def files(self):
         return self.path
+
+
+def _ensure_traversable(path):
+    """
+    Convert deprecated string arguments to traversables (pathlib.Path).
+
+    Remove with Python 3.15.
+    """
+    if not isinstance(path, str):
+        return path
+
+    warnings.warn(
+        "String arguments are deprecated. Pass a Traversable instead.",
+        DeprecationWarning,
+        stacklevel=3,
+    )
+
+    return pathlib.Path(path)
diff --git a/setuptools/_vendor/importlib_resources/simple.py b/setuptools/_vendor/importlib_resources/simple.py
index 7770c922c8..96f117fec6 100644
--- a/setuptools/_vendor/importlib_resources/simple.py
+++ b/setuptools/_vendor/importlib_resources/simple.py
@@ -88,7 +88,7 @@ def is_dir(self):
     def open(self, mode='r', *args, **kwargs):
         stream = self.parent.reader.open_binary(self.name)
         if 'b' not in mode:
-            stream = io.TextIOWrapper(*args, **kwargs)
+            stream = io.TextIOWrapper(stream, *args, **kwargs)
         return stream
 
     def joinpath(self, name):
diff --git a/setuptools/_vendor/importlib_resources/tests/_compat.py b/setuptools/_vendor/importlib_resources/tests/_compat.py
deleted file mode 100644
index e7bf06dd4e..0000000000
--- a/setuptools/_vendor/importlib_resources/tests/_compat.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import os
-
-
-try:
-    from test.support import import_helper  # type: ignore
-except ImportError:
-    # Python 3.9 and earlier
-    class import_helper:  # type: ignore
-        from test.support import (
-            modules_setup,
-            modules_cleanup,
-            DirsOnSysPath,
-            CleanImport,
-        )
-
-
-try:
-    from test.support import os_helper  # type: ignore
-except ImportError:
-    # Python 3.9 compat
-    class os_helper:  # type:ignore
-        from test.support import temp_dir
-
-
-try:
-    # Python 3.10
-    from test.support.os_helper import unlink
-except ImportError:
-    from test.support import unlink as _unlink
-
-    def unlink(target):
-        return _unlink(os.fspath(target))
diff --git a/setuptools/_vendor/importlib_resources/tests/_path.py b/setuptools/_vendor/importlib_resources/tests/_path.py
index c630e4d3d3..1f97c96146 100644
--- a/setuptools/_vendor/importlib_resources/tests/_path.py
+++ b/setuptools/_vendor/importlib_resources/tests/_path.py
@@ -1,12 +1,16 @@
 import pathlib
 import functools
 
+from typing import Dict, Union
+
 
 ####
-# from jaraco.path 3.4
+# from jaraco.path 3.4.1
+
+FilesSpec = Dict[str, Union[str, bytes, 'FilesSpec']]  # type: ignore
 
 
-def build(spec, prefix=pathlib.Path()):
+def build(spec: FilesSpec, prefix=pathlib.Path()):
     """
     Build a set of files/directories, as described by the spec.
 
@@ -23,15 +27,17 @@ def build(spec, prefix=pathlib.Path()):
     ...         "baz.py": "# Some code",
     ...     }
     ... }
-    >>> tmpdir = getfixture('tmpdir')
-    >>> build(spec, tmpdir)
+    >>> target = getfixture('tmp_path')
+    >>> build(spec, target)
+    >>> target.joinpath('foo/baz.py').read_text(encoding='utf-8')
+    '# Some code'
     """
     for name, contents in spec.items():
         create(contents, pathlib.Path(prefix) / name)
 
 
 @functools.singledispatch
-def create(content, path):
+def create(content: Union[str, bytes, FilesSpec], path):
     path.mkdir(exist_ok=True)
     build(content, prefix=path)  # type: ignore
 
@@ -43,7 +49,7 @@ def _(content: bytes, path):
 
 @create.register
 def _(content: str, path):
-    path.write_text(content)
+    path.write_text(content, encoding='utf-8')
 
 
 # end from jaraco.path
diff --git a/setuptools/_vendor/more_itertools-8.8.0.dist-info/REQUESTED b/setuptools/_vendor/importlib_resources/tests/compat/__init__.py
similarity index 100%
rename from setuptools/_vendor/more_itertools-8.8.0.dist-info/REQUESTED
rename to setuptools/_vendor/importlib_resources/tests/compat/__init__.py
diff --git a/setuptools/_vendor/importlib_resources/tests/compat/py312.py b/setuptools/_vendor/importlib_resources/tests/compat/py312.py
new file mode 100644
index 0000000000..ea9a58ba2e
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/tests/compat/py312.py
@@ -0,0 +1,18 @@
+import contextlib
+
+from .py39 import import_helper
+
+
+@contextlib.contextmanager
+def isolated_modules():
+    """
+    Save modules on entry and cleanup on exit.
+    """
+    (saved,) = import_helper.modules_setup()
+    try:
+        yield
+    finally:
+        import_helper.modules_cleanup(saved)
+
+
+vars(import_helper).setdefault('isolated_modules', isolated_modules)
diff --git a/setuptools/_vendor/importlib_resources/tests/compat/py39.py b/setuptools/_vendor/importlib_resources/tests/compat/py39.py
new file mode 100644
index 0000000000..e158eb85d3
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/tests/compat/py39.py
@@ -0,0 +1,10 @@
+"""
+Backward-compatability shims to support Python 3.9 and earlier.
+"""
+
+from jaraco.test.cpython import from_test_support, try_import
+
+import_helper = try_import('import_helper') or from_test_support(
+    'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
+)
+os_helper = try_import('os_helper') or from_test_support('temp_dir')
diff --git a/setuptools/_vendor/importlib_resources/tests/data01/subdirectory/binary.file b/setuptools/_vendor/importlib_resources/tests/data01/subdirectory/binary.file
index eaf36c1daccfdf325514461cd1a2ffbc139b5464..5bd8bb897b13225c93a1d26baa88c96b7bd5d817 100644
GIT binary patch
literal 4
LcmZQ!Wn%{b05$*@

literal 4
LcmZQzWMT#Y01f~L

diff --git a/setuptools/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt b/setuptools/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
new file mode 100644
index 0000000000..48f587a2d0
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
@@ -0,0 +1 @@
+a resource
\ No newline at end of file
diff --git a/setuptools/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file b/setuptools/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
new file mode 100644
index 0000000000..100f50643d
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
@@ -0,0 +1 @@
+

\ No newline at end of file
diff --git a/setuptools/_vendor/importlib_resources/tests/test_compatibilty_files.py b/setuptools/_vendor/importlib_resources/tests/test_compatibilty_files.py
index d92c7c56c9..13ad0dfb21 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_compatibilty_files.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_compatibilty_files.py
@@ -64,11 +64,13 @@ def test_orphan_path_name(self):
 
     def test_spec_path_open(self):
         self.assertEqual(self.files.read_bytes(), b'Hello, world!')
-        self.assertEqual(self.files.read_text(), 'Hello, world!')
+        self.assertEqual(self.files.read_text(encoding='utf-8'), 'Hello, world!')
 
     def test_child_path_open(self):
         self.assertEqual((self.files / 'a').read_bytes(), b'Hello, world!')
-        self.assertEqual((self.files / 'a').read_text(), 'Hello, world!')
+        self.assertEqual(
+            (self.files / 'a').read_text(encoding='utf-8'), 'Hello, world!'
+        )
 
     def test_orphan_path_open(self):
         with self.assertRaises(FileNotFoundError):
diff --git a/setuptools/_vendor/importlib_resources/tests/test_contents.py b/setuptools/_vendor/importlib_resources/tests/test_contents.py
index 525568e8c9..7dc3b0a619 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_contents.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_contents.py
@@ -31,8 +31,8 @@ class ContentsZipTests(ContentsTests, util.ZipSetup, unittest.TestCase):
 class ContentsNamespaceTests(ContentsTests, unittest.TestCase):
     expected = {
         # no __init__ because of namespace design
-        # no subdirectory as incidental difference in fixture
         'binary.file',
+        'subdirectory',
         'utf-16.file',
         'utf-8.file',
     }
diff --git a/setuptools/_vendor/importlib_resources/tests/test_custom.py b/setuptools/_vendor/importlib_resources/tests/test_custom.py
new file mode 100644
index 0000000000..86c65676f1
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/tests/test_custom.py
@@ -0,0 +1,47 @@
+import unittest
+import contextlib
+import pathlib
+
+import importlib_resources as resources
+from .. import abc
+from ..abc import TraversableResources, ResourceReader
+from . import util
+from .compat.py39 import os_helper
+
+
+class SimpleLoader:
+    """
+    A simple loader that only implements a resource reader.
+    """
+
+    def __init__(self, reader: ResourceReader):
+        self.reader = reader
+
+    def get_resource_reader(self, package):
+        return self.reader
+
+
+class MagicResources(TraversableResources):
+    """
+    Magically returns the resources at path.
+    """
+
+    def __init__(self, path: pathlib.Path):
+        self.path = path
+
+    def files(self):
+        return self.path
+
+
+class CustomTraversableResourcesTests(unittest.TestCase):
+    def setUp(self):
+        self.fixtures = contextlib.ExitStack()
+        self.addCleanup(self.fixtures.close)
+
+    def test_custom_loader(self):
+        temp_dir = pathlib.Path(self.fixtures.enter_context(os_helper.temp_dir()))
+        loader = SimpleLoader(MagicResources(temp_dir))
+        pkg = util.create_package_from_loader(loader)
+        files = resources.files(pkg)
+        assert isinstance(files, abc.Traversable)
+        assert list(files.iterdir()) == []
diff --git a/setuptools/_vendor/importlib_resources/tests/test_files.py b/setuptools/_vendor/importlib_resources/tests/test_files.py
index d258fb5f0f..3e86ec64bc 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_files.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_files.py
@@ -1,4 +1,3 @@
-import typing
 import textwrap
 import unittest
 import warnings
@@ -10,7 +9,8 @@
 from . import data01
 from . import util
 from . import _path
-from ._compat import os_helper, import_helper
+from .compat.py39 import os_helper
+from .compat.py312 import import_helper
 
 
 @contextlib.contextmanager
@@ -31,13 +31,14 @@ def test_read_text(self):
         actual = files.joinpath('utf-8.file').read_text(encoding='utf-8')
         assert actual == 'Hello, UTF-8 world!\n'
 
-    @unittest.skipUnless(
-        hasattr(typing, 'runtime_checkable'),
-        "Only suitable when typing supports runtime_checkable",
-    )
     def test_traversable(self):
         assert isinstance(resources.files(self.data), Traversable)
 
+    def test_joinpath_with_multiple_args(self):
+        files = resources.files(self.data)
+        binfile = files.joinpath('subdirectory', 'binary.file')
+        self.assertTrue(binfile.is_file())
+
     def test_old_parameter(self):
         """
         Files used to take a 'package' parameter. Make sure anyone
@@ -63,13 +64,17 @@ def setUp(self):
         self.data = namespacedata01
 
 
+class OpenNamespaceZipTests(FilesTests, util.ZipSetup, unittest.TestCase):
+    ZIP_MODULE = 'namespacedata01'
+
+
 class SiteDir:
     def setUp(self):
         self.fixtures = contextlib.ExitStack()
         self.addCleanup(self.fixtures.close)
         self.site_dir = self.fixtures.enter_context(os_helper.temp_dir())
         self.fixtures.enter_context(import_helper.DirsOnSysPath(self.site_dir))
-        self.fixtures.enter_context(import_helper.CleanImport())
+        self.fixtures.enter_context(import_helper.isolated_modules())
 
 
 class ModulesFilesTests(SiteDir, unittest.TestCase):
@@ -84,7 +89,7 @@ def test_module_resources(self):
         _path.build(spec, self.site_dir)
         import mod
 
-        actual = resources.files(mod).joinpath('res.txt').read_text()
+        actual = resources.files(mod).joinpath('res.txt').read_text(encoding='utf-8')
         assert actual == spec['res.txt']
 
 
@@ -98,7 +103,7 @@ def test_implicit_files(self):
                 '__init__.py': textwrap.dedent(
                     """
                     import importlib_resources as res
-                    val = res.files().joinpath('res.txt').read_text()
+                    val = res.files().joinpath('res.txt').read_text(encoding='utf-8')
                     """
                 ),
                 'res.txt': 'resources are the best',
diff --git a/setuptools/_vendor/importlib_resources/tests/test_functional.py b/setuptools/_vendor/importlib_resources/tests/test_functional.py
new file mode 100644
index 0000000000..69706cf7be
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/tests/test_functional.py
@@ -0,0 +1,242 @@
+import unittest
+import os
+import contextlib
+
+try:
+    from test.support.warnings_helper import ignore_warnings, check_warnings
+except ImportError:
+    # older Python versions
+    from test.support import ignore_warnings, check_warnings
+
+import importlib_resources as resources
+
+# Since the functional API forwards to Traversable, we only test
+# filesystem resources here -- not zip files, namespace packages etc.
+# We do test for two kinds of Anchor, though.
+
+
+class StringAnchorMixin:
+    anchor01 = 'importlib_resources.tests.data01'
+    anchor02 = 'importlib_resources.tests.data02'
+
+
+class ModuleAnchorMixin:
+    from . import data01 as anchor01
+    from . import data02 as anchor02
+
+
+class FunctionalAPIBase:
+    def _gen_resourcetxt_path_parts(self):
+        """Yield various names of a text file in anchor02, each in a subTest"""
+        for path_parts in (
+            ('subdirectory', 'subsubdir', 'resource.txt'),
+            ('subdirectory/subsubdir/resource.txt',),
+            ('subdirectory/subsubdir', 'resource.txt'),
+        ):
+            with self.subTest(path_parts=path_parts):
+                yield path_parts
+
+    def test_read_text(self):
+        self.assertEqual(
+            resources.read_text(self.anchor01, 'utf-8.file'),
+            'Hello, UTF-8 world!\n',
+        )
+        self.assertEqual(
+            resources.read_text(
+                self.anchor02,
+                'subdirectory',
+                'subsubdir',
+                'resource.txt',
+                encoding='utf-8',
+            ),
+            'a resource',
+        )
+        for path_parts in self._gen_resourcetxt_path_parts():
+            self.assertEqual(
+                resources.read_text(
+                    self.anchor02,
+                    *path_parts,
+                    encoding='utf-8',
+                ),
+                'a resource',
+            )
+        # Use generic OSError, since e.g. attempting to read a directory can
+        # fail with PermissionError rather than IsADirectoryError
+        with self.assertRaises(OSError):
+            resources.read_text(self.anchor01)
+        with self.assertRaises(OSError):
+            resources.read_text(self.anchor01, 'no-such-file')
+        with self.assertRaises(UnicodeDecodeError):
+            resources.read_text(self.anchor01, 'utf-16.file')
+        self.assertEqual(
+            resources.read_text(
+                self.anchor01,
+                'binary.file',
+                encoding='latin1',
+            ),
+            '\x00\x01\x02\x03',
+        )
+        self.assertEqual(
+            resources.read_text(
+                self.anchor01,
+                'utf-16.file',
+                errors='backslashreplace',
+            ),
+            'Hello, UTF-16 world!\n'.encode('utf-16').decode(
+                errors='backslashreplace',
+            ),
+        )
+
+    def test_read_binary(self):
+        self.assertEqual(
+            resources.read_binary(self.anchor01, 'utf-8.file'),
+            b'Hello, UTF-8 world!\n',
+        )
+        for path_parts in self._gen_resourcetxt_path_parts():
+            self.assertEqual(
+                resources.read_binary(self.anchor02, *path_parts),
+                b'a resource',
+            )
+
+    def test_open_text(self):
+        with resources.open_text(self.anchor01, 'utf-8.file') as f:
+            self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
+        for path_parts in self._gen_resourcetxt_path_parts():
+            with resources.open_text(
+                self.anchor02,
+                *path_parts,
+                encoding='utf-8',
+            ) as f:
+                self.assertEqual(f.read(), 'a resource')
+        # Use generic OSError, since e.g. attempting to read a directory can
+        # fail with PermissionError rather than IsADirectoryError
+        with self.assertRaises(OSError):
+            resources.open_text(self.anchor01)
+        with self.assertRaises(OSError):
+            resources.open_text(self.anchor01, 'no-such-file')
+        with resources.open_text(self.anchor01, 'utf-16.file') as f:
+            with self.assertRaises(UnicodeDecodeError):
+                f.read()
+        with resources.open_text(
+            self.anchor01,
+            'binary.file',
+            encoding='latin1',
+        ) as f:
+            self.assertEqual(f.read(), '\x00\x01\x02\x03')
+        with resources.open_text(
+            self.anchor01,
+            'utf-16.file',
+            errors='backslashreplace',
+        ) as f:
+            self.assertEqual(
+                f.read(),
+                'Hello, UTF-16 world!\n'.encode('utf-16').decode(
+                    errors='backslashreplace',
+                ),
+            )
+
+    def test_open_binary(self):
+        with resources.open_binary(self.anchor01, 'utf-8.file') as f:
+            self.assertEqual(f.read(), b'Hello, UTF-8 world!\n')
+        for path_parts in self._gen_resourcetxt_path_parts():
+            with resources.open_binary(
+                self.anchor02,
+                *path_parts,
+            ) as f:
+                self.assertEqual(f.read(), b'a resource')
+
+    def test_path(self):
+        with resources.path(self.anchor01, 'utf-8.file') as path:
+            with open(str(path), encoding='utf-8') as f:
+                self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
+        with resources.path(self.anchor01) as path:
+            with open(os.path.join(path, 'utf-8.file'), encoding='utf-8') as f:
+                self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
+
+    def test_is_resource(self):
+        is_resource = resources.is_resource
+        self.assertTrue(is_resource(self.anchor01, 'utf-8.file'))
+        self.assertFalse(is_resource(self.anchor01, 'no_such_file'))
+        self.assertFalse(is_resource(self.anchor01))
+        self.assertFalse(is_resource(self.anchor01, 'subdirectory'))
+        for path_parts in self._gen_resourcetxt_path_parts():
+            self.assertTrue(is_resource(self.anchor02, *path_parts))
+
+    def test_contents(self):
+        with check_warnings((".*contents.*", DeprecationWarning)):
+            c = resources.contents(self.anchor01)
+        self.assertGreaterEqual(
+            set(c),
+            {'utf-8.file', 'utf-16.file', 'binary.file', 'subdirectory'},
+        )
+        with contextlib.ExitStack() as cm:
+            cm.enter_context(self.assertRaises(OSError))
+            cm.enter_context(check_warnings((".*contents.*", DeprecationWarning)))
+
+            list(resources.contents(self.anchor01, 'utf-8.file'))
+
+        for path_parts in self._gen_resourcetxt_path_parts():
+            with contextlib.ExitStack() as cm:
+                cm.enter_context(self.assertRaises(OSError))
+                cm.enter_context(check_warnings((".*contents.*", DeprecationWarning)))
+
+                list(resources.contents(self.anchor01, *path_parts))
+        with check_warnings((".*contents.*", DeprecationWarning)):
+            c = resources.contents(self.anchor01, 'subdirectory')
+        self.assertGreaterEqual(
+            set(c),
+            {'binary.file'},
+        )
+
+    @ignore_warnings(category=DeprecationWarning)
+    def test_common_errors(self):
+        for func in (
+            resources.read_text,
+            resources.read_binary,
+            resources.open_text,
+            resources.open_binary,
+            resources.path,
+            resources.is_resource,
+            resources.contents,
+        ):
+            with self.subTest(func=func):
+                # Rejecting None anchor
+                with self.assertRaises(TypeError):
+                    func(None)
+                # Rejecting invalid anchor type
+                with self.assertRaises((TypeError, AttributeError)):
+                    func(1234)
+                # Unknown module
+                with self.assertRaises(ModuleNotFoundError):
+                    func('$missing module$')
+
+    def test_text_errors(self):
+        for func in (
+            resources.read_text,
+            resources.open_text,
+        ):
+            with self.subTest(func=func):
+                # Multiple path arguments need explicit encoding argument.
+                with self.assertRaises(TypeError):
+                    func(
+                        self.anchor02,
+                        'subdirectory',
+                        'subsubdir',
+                        'resource.txt',
+                    )
+
+
+class FunctionalAPITest_StringAnchor(
+    unittest.TestCase,
+    FunctionalAPIBase,
+    StringAnchorMixin,
+):
+    pass
+
+
+class FunctionalAPITest_ModuleAnchor(
+    unittest.TestCase,
+    FunctionalAPIBase,
+    ModuleAnchorMixin,
+):
+    pass
diff --git a/setuptools/_vendor/importlib_resources/tests/test_open.py b/setuptools/_vendor/importlib_resources/tests/test_open.py
index 87b42c3d39..44f1018af3 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_open.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_open.py
@@ -15,7 +15,7 @@ def execute(self, package, path):
 class CommonTextTests(util.CommonTests, unittest.TestCase):
     def execute(self, package, path):
         target = resources.files(package).joinpath(path)
-        with target.open():
+        with target.open(encoding='utf-8'):
             pass
 
 
@@ -24,11 +24,11 @@ def test_open_binary(self):
         target = resources.files(self.data) / 'binary.file'
         with target.open('rb') as fp:
             result = fp.read()
-            self.assertEqual(result, b'\x00\x01\x02\x03')
+            self.assertEqual(result, bytes(range(4)))
 
     def test_open_text_default_encoding(self):
         target = resources.files(self.data) / 'utf-8.file'
-        with target.open() as fp:
+        with target.open(encoding='utf-8') as fp:
             result = fp.read()
             self.assertEqual(result, 'Hello, UTF-8 world!\n')
 
@@ -39,7 +39,9 @@ def test_open_text_given_encoding(self):
         self.assertEqual(result, 'Hello, UTF-16 world!\n')
 
     def test_open_text_with_errors(self):
-        # Raises UnicodeError without the 'errors' argument.
+        """
+        Raises UnicodeError without the 'errors' argument.
+        """
         target = resources.files(self.data) / 'utf-16.file'
         with target.open(encoding='utf-8', errors='strict') as fp:
             self.assertRaises(UnicodeError, fp.read)
@@ -54,11 +56,13 @@ def test_open_text_with_errors(self):
 
     def test_open_binary_FileNotFoundError(self):
         target = resources.files(self.data) / 'does-not-exist'
-        self.assertRaises(FileNotFoundError, target.open, 'rb')
+        with self.assertRaises(FileNotFoundError):
+            target.open('rb')
 
     def test_open_text_FileNotFoundError(self):
         target = resources.files(self.data) / 'does-not-exist'
-        self.assertRaises(FileNotFoundError, target.open)
+        with self.assertRaises(FileNotFoundError):
+            target.open(encoding='utf-8')
 
 
 class OpenDiskTests(OpenTests, unittest.TestCase):
@@ -77,5 +81,9 @@ class OpenZipTests(OpenTests, util.ZipSetup, unittest.TestCase):
     pass
 
 
+class OpenNamespaceZipTests(OpenTests, util.ZipSetup, unittest.TestCase):
+    ZIP_MODULE = 'namespacedata01'
+
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/setuptools/_vendor/importlib_resources/tests/test_path.py b/setuptools/_vendor/importlib_resources/tests/test_path.py
index 4f4d3943bb..c3e1cbb4ed 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_path.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_path.py
@@ -1,4 +1,5 @@
 import io
+import pathlib
 import unittest
 
 import importlib_resources as resources
@@ -14,16 +15,14 @@ def execute(self, package, path):
 
 class PathTests:
     def test_reading(self):
-        # Path should be readable.
-        # Test also implicitly verifies the returned object is a pathlib.Path
-        # instance.
+        """
+        Path should be readable and a pathlib.Path instance.
+        """
         target = resources.files(self.data) / 'utf-8.file'
         with resources.as_file(target) as path:
+            self.assertIsInstance(path, pathlib.Path)
             self.assertTrue(path.name.endswith("utf-8.file"), repr(path))
-            # pathlib.Path.read_text() was introduced in Python 3.5.
-            with path.open('r', encoding='utf-8') as file:
-                text = file.read()
-            self.assertEqual('Hello, UTF-8 world!\n', text)
+            self.assertEqual('Hello, UTF-8 world!\n', path.read_text(encoding='utf-8'))
 
 
 class PathDiskTests(PathTests, unittest.TestCase):
@@ -53,8 +52,10 @@ def setUp(self):
 
 class PathZipTests(PathTests, util.ZipSetup, unittest.TestCase):
     def test_remove_in_context_manager(self):
-        # It is not an error if the file that was temporarily stashed on the
-        # file system is removed inside the `with` stanza.
+        """
+        It is not an error if the file that was temporarily stashed on the
+        file system is removed inside the `with` stanza.
+        """
         target = resources.files(self.data) / 'utf-8.file'
         with resources.as_file(target) as path:
             path.unlink()
diff --git a/setuptools/_vendor/importlib_resources/tests/test_read.py b/setuptools/_vendor/importlib_resources/tests/test_read.py
index 41dd6db5f3..97d90128cf 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_read.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_read.py
@@ -13,16 +13,20 @@ def execute(self, package, path):
 
 class CommonTextTests(util.CommonTests, unittest.TestCase):
     def execute(self, package, path):
-        resources.files(package).joinpath(path).read_text()
+        resources.files(package).joinpath(path).read_text(encoding='utf-8')
 
 
 class ReadTests:
     def test_read_bytes(self):
         result = resources.files(self.data).joinpath('binary.file').read_bytes()
-        self.assertEqual(result, b'\0\1\2\3')
+        self.assertEqual(result, bytes(range(4)))
 
     def test_read_text_default_encoding(self):
-        result = resources.files(self.data).joinpath('utf-8.file').read_text()
+        result = (
+            resources.files(self.data)
+            .joinpath('utf-8.file')
+            .read_text(encoding='utf-8')
+        )
         self.assertEqual(result, 'Hello, UTF-8 world!\n')
 
     def test_read_text_given_encoding(self):
@@ -34,7 +38,9 @@ def test_read_text_given_encoding(self):
         self.assertEqual(result, 'Hello, UTF-16 world!\n')
 
     def test_read_text_with_errors(self):
-        # Raises UnicodeError without the 'errors' argument.
+        """
+        Raises UnicodeError without the 'errors' argument.
+        """
         target = resources.files(self.data) / 'utf-16.file'
         self.assertRaises(UnicodeError, target.read_text, encoding='utf-8')
         result = target.read_text(encoding='utf-8', errors='ignore')
@@ -52,17 +58,15 @@ class ReadDiskTests(ReadTests, unittest.TestCase):
 
 class ReadZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
     def test_read_submodule_resource(self):
-        submodule = import_module('ziptestdata.subdirectory')
+        submodule = import_module('data01.subdirectory')
         result = resources.files(submodule).joinpath('binary.file').read_bytes()
-        self.assertEqual(result, b'\0\1\2\3')
+        self.assertEqual(result, bytes(range(4, 8)))
 
     def test_read_submodule_resource_by_name(self):
         result = (
-            resources.files('ziptestdata.subdirectory')
-            .joinpath('binary.file')
-            .read_bytes()
+            resources.files('data01.subdirectory').joinpath('binary.file').read_bytes()
         )
-        self.assertEqual(result, b'\0\1\2\3')
+        self.assertEqual(result, bytes(range(4, 8)))
 
 
 class ReadNamespaceTests(ReadTests, unittest.TestCase):
@@ -72,5 +76,22 @@ def setUp(self):
         self.data = namespacedata01
 
 
+class ReadNamespaceZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
+    ZIP_MODULE = 'namespacedata01'
+
+    def test_read_submodule_resource(self):
+        submodule = import_module('namespacedata01.subdirectory')
+        result = resources.files(submodule).joinpath('binary.file').read_bytes()
+        self.assertEqual(result, bytes(range(12, 16)))
+
+    def test_read_submodule_resource_by_name(self):
+        result = (
+            resources.files('namespacedata01.subdirectory')
+            .joinpath('binary.file')
+            .read_bytes()
+        )
+        self.assertEqual(result, bytes(range(12, 16)))
+
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/setuptools/_vendor/importlib_resources/tests/test_reader.py b/setuptools/_vendor/importlib_resources/tests/test_reader.py
index 1c8ebeeb13..95c2fc85a4 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_reader.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_reader.py
@@ -10,8 +10,7 @@
 class MultiplexedPathTest(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
-        path = pathlib.Path(__file__).parent / 'namespacedata01'
-        cls.folder = str(path)
+        cls.folder = pathlib.Path(__file__).parent / 'namespacedata01'
 
     def test_init_no_paths(self):
         with self.assertRaises(FileNotFoundError):
@@ -19,7 +18,7 @@ def test_init_no_paths(self):
 
     def test_init_file(self):
         with self.assertRaises(NotADirectoryError):
-            MultiplexedPath(os.path.join(self.folder, 'binary.file'))
+            MultiplexedPath(self.folder / 'binary.file')
 
     def test_iterdir(self):
         contents = {path.name for path in MultiplexedPath(self.folder).iterdir()}
@@ -27,10 +26,12 @@ def test_iterdir(self):
             contents.remove('__pycache__')
         except (KeyError, ValueError):
             pass
-        self.assertEqual(contents, {'binary.file', 'utf-16.file', 'utf-8.file'})
+        self.assertEqual(
+            contents, {'subdirectory', 'binary.file', 'utf-16.file', 'utf-8.file'}
+        )
 
     def test_iterdir_duplicate(self):
-        data01 = os.path.abspath(os.path.join(__file__, '..', 'data01'))
+        data01 = pathlib.Path(__file__).parent.joinpath('data01')
         contents = {
             path.name for path in MultiplexedPath(self.folder, data01).iterdir()
         }
@@ -60,17 +61,17 @@ def test_open_file(self):
             path.open()
 
     def test_join_path(self):
-        prefix = os.path.abspath(os.path.join(__file__, '..'))
-        data01 = os.path.join(prefix, 'data01')
+        data01 = pathlib.Path(__file__).parent.joinpath('data01')
+        prefix = str(data01.parent)
         path = MultiplexedPath(self.folder, data01)
         self.assertEqual(
             str(path.joinpath('binary.file'))[len(prefix) + 1 :],
             os.path.join('namespacedata01', 'binary.file'),
         )
-        self.assertEqual(
-            str(path.joinpath('subdirectory'))[len(prefix) + 1 :],
-            os.path.join('data01', 'subdirectory'),
-        )
+        sub = path.joinpath('subdirectory')
+        assert isinstance(sub, MultiplexedPath)
+        assert 'namespacedata01' in str(sub)
+        assert 'data01' in str(sub)
         self.assertEqual(
             str(path.joinpath('imaginary'))[len(prefix) + 1 :],
             os.path.join('namespacedata01', 'imaginary'),
@@ -81,6 +82,17 @@ def test_join_path_compound(self):
         path = MultiplexedPath(self.folder)
         assert not path.joinpath('imaginary/foo.py').exists()
 
+    def test_join_path_common_subdir(self):
+        data01 = pathlib.Path(__file__).parent.joinpath('data01')
+        data02 = pathlib.Path(__file__).parent.joinpath('data02')
+        prefix = str(data01.parent)
+        path = MultiplexedPath(data01, data02)
+        self.assertIsInstance(path.joinpath('subdirectory'), MultiplexedPath)
+        self.assertEqual(
+            str(path.joinpath('subdirectory', 'subsubdir'))[len(prefix) + 1 :],
+            os.path.join('data02', 'subdirectory', 'subsubdir'),
+        )
+
     def test_repr(self):
         self.assertEqual(
             repr(MultiplexedPath(self.folder)),
diff --git a/setuptools/_vendor/importlib_resources/tests/test_resource.py b/setuptools/_vendor/importlib_resources/tests/test_resource.py
index 8239027167..dc2a108cde 100644
--- a/setuptools/_vendor/importlib_resources/tests/test_resource.py
+++ b/setuptools/_vendor/importlib_resources/tests/test_resource.py
@@ -1,14 +1,11 @@
 import sys
 import unittest
 import importlib_resources as resources
-import uuid
 import pathlib
 
 from . import data01
-from . import zipdata01, zipdata02
 from . import util
 from importlib import import_module
-from ._compat import import_helper, unlink
 
 
 class ResourceTests:
@@ -69,10 +66,12 @@ def test_resource_missing(self):
 
 class ResourceCornerCaseTests(unittest.TestCase):
     def test_package_has_no_reader_fallback(self):
-        # Test odd ball packages which:
+        """
+        Test odd ball packages which:
         # 1. Do not have a ResourceReader as a loader
         # 2. Are not on the file system
         # 3. Are not in a zip file
+        """
         module = util.create_package(
             file=data01, path=data01.__file__, contents=['A', 'B', 'C']
         )
@@ -86,34 +85,32 @@ def test_package_has_no_reader_fallback(self):
 
 
 class ResourceFromZipsTest01(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = zipdata01  # type: ignore
+    ZIP_MODULE = 'data01'
 
     def test_is_submodule_resource(self):
-        submodule = import_module('ziptestdata.subdirectory')
+        submodule = import_module('data01.subdirectory')
         self.assertTrue(resources.files(submodule).joinpath('binary.file').is_file())
 
     def test_read_submodule_resource_by_name(self):
         self.assertTrue(
-            resources.files('ziptestdata.subdirectory')
-            .joinpath('binary.file')
-            .is_file()
+            resources.files('data01.subdirectory').joinpath('binary.file').is_file()
         )
 
     def test_submodule_contents(self):
-        submodule = import_module('ziptestdata.subdirectory')
+        submodule = import_module('data01.subdirectory')
         self.assertEqual(
             names(resources.files(submodule)), {'__init__.py', 'binary.file'}
         )
 
     def test_submodule_contents_by_name(self):
         self.assertEqual(
-            names(resources.files('ziptestdata.subdirectory')),
+            names(resources.files('data01.subdirectory')),
             {'__init__.py', 'binary.file'},
         )
 
     def test_as_file_directory(self):
-        with resources.as_file(resources.files('ziptestdata')) as data:
-            assert data.name == 'ziptestdata'
+        with resources.as_file(resources.files('data01')) as data:
+            assert data.name == 'data01'
             assert data.is_dir()
             assert data.joinpath('subdirectory').is_dir()
             assert len(list(data.iterdir()))
@@ -121,7 +118,7 @@ def test_as_file_directory(self):
 
 
 class ResourceFromZipsTest02(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = zipdata02  # type: ignore
+    ZIP_MODULE = 'data02'
 
     def test_unrelated_contents(self):
         """
@@ -129,104 +126,48 @@ def test_unrelated_contents(self):
         distinct resources. Ref python/importlib_resources#44.
         """
         self.assertEqual(
-            names(resources.files('ziptestdata.one')),
+            names(resources.files('data02.one')),
             {'__init__.py', 'resource1.txt'},
         )
         self.assertEqual(
-            names(resources.files('ziptestdata.two')),
+            names(resources.files('data02.two')),
             {'__init__.py', 'resource2.txt'},
         )
 
 
-class DeletingZipsTest(unittest.TestCase):
+class DeletingZipsTest(util.ZipSetupBase, unittest.TestCase):
     """Having accessed resources in a zip file should not keep an open
     reference to the zip.
     """
 
-    ZIP_MODULE = zipdata01
-
-    def setUp(self):
-        modules = import_helper.modules_setup()
-        self.addCleanup(import_helper.modules_cleanup, *modules)
-
-        data_path = pathlib.Path(self.ZIP_MODULE.__file__)
-        data_dir = data_path.parent
-        self.source_zip_path = data_dir / 'ziptestdata.zip'
-        self.zip_path = pathlib.Path(f'{uuid.uuid4()}.zip').absolute()
-        self.zip_path.write_bytes(self.source_zip_path.read_bytes())
-        sys.path.append(str(self.zip_path))
-        self.data = import_module('ziptestdata')
-
-    def tearDown(self):
-        try:
-            sys.path.remove(str(self.zip_path))
-        except ValueError:
-            pass
-
-        try:
-            del sys.path_importer_cache[str(self.zip_path)]
-            del sys.modules[self.data.__name__]
-        except KeyError:
-            pass
-
-        try:
-            unlink(self.zip_path)
-        except OSError:
-            # If the test fails, this will probably fail too
-            pass
-
     def test_iterdir_does_not_keep_open(self):
-        c = [item.name for item in resources.files('ziptestdata').iterdir()]
-        self.zip_path.unlink()
-        del c
+        [item.name for item in resources.files('data01').iterdir()]
 
     def test_is_file_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('binary.file').is_file()
-        self.zip_path.unlink()
-        del c
+        resources.files('data01').joinpath('binary.file').is_file()
 
     def test_is_file_failure_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('not-present').is_file()
-        self.zip_path.unlink()
-        del c
+        resources.files('data01').joinpath('not-present').is_file()
 
     @unittest.skip("Desired but not supported.")
     def test_as_file_does_not_keep_open(self):  # pragma: no cover
-        c = resources.as_file(resources.files('ziptestdata') / 'binary.file')
-        self.zip_path.unlink()
-        del c
+        resources.as_file(resources.files('data01') / 'binary.file')
 
     def test_entered_path_does_not_keep_open(self):
-        # This is what certifi does on import to make its bundle
-        # available for the process duration.
-        c = resources.as_file(
-            resources.files('ziptestdata') / 'binary.file'
-        ).__enter__()
-        self.zip_path.unlink()
-        del c
+        """
+        Mimic what certifi does on import to make its bundle
+        available for the process duration.
+        """
+        resources.as_file(resources.files('data01') / 'binary.file').__enter__()
 
     def test_read_binary_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('binary.file').read_bytes()
-        self.zip_path.unlink()
-        del c
+        resources.files('data01').joinpath('binary.file').read_bytes()
 
     def test_read_text_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('utf-8.file').read_text()
-        self.zip_path.unlink()
-        del c
-
-
-class ResourceFromNamespaceTest01(unittest.TestCase):
-    site_dir = str(pathlib.Path(__file__).parent)
+        resources.files('data01').joinpath('utf-8.file').read_text(encoding='utf-8')
 
-    @classmethod
-    def setUpClass(cls):
-        sys.path.append(cls.site_dir)
-
-    @classmethod
-    def tearDownClass(cls):
-        sys.path.remove(cls.site_dir)
 
+class ResourceFromNamespaceTests:
     def test_is_submodule_resource(self):
         self.assertTrue(
             resources.files(import_module('namespacedata01'))
@@ -245,7 +186,9 @@ def test_submodule_contents(self):
             contents.remove('__pycache__')
         except KeyError:
             pass
-        self.assertEqual(contents, {'binary.file', 'utf-8.file', 'utf-16.file'})
+        self.assertEqual(
+            contents, {'subdirectory', 'binary.file', 'utf-8.file', 'utf-16.file'}
+        )
 
     def test_submodule_contents_by_name(self):
         contents = names(resources.files('namespacedata01'))
@@ -253,7 +196,45 @@ def test_submodule_contents_by_name(self):
             contents.remove('__pycache__')
         except KeyError:
             pass
-        self.assertEqual(contents, {'binary.file', 'utf-8.file', 'utf-16.file'})
+        self.assertEqual(
+            contents, {'subdirectory', 'binary.file', 'utf-8.file', 'utf-16.file'}
+        )
+
+    def test_submodule_sub_contents(self):
+        contents = names(resources.files(import_module('namespacedata01.subdirectory')))
+        try:
+            contents.remove('__pycache__')
+        except KeyError:
+            pass
+        self.assertEqual(contents, {'binary.file'})
+
+    def test_submodule_sub_contents_by_name(self):
+        contents = names(resources.files('namespacedata01.subdirectory'))
+        try:
+            contents.remove('__pycache__')
+        except KeyError:
+            pass
+        self.assertEqual(contents, {'binary.file'})
+
+
+class ResourceFromNamespaceDiskTests(ResourceFromNamespaceTests, unittest.TestCase):
+    site_dir = str(pathlib.Path(__file__).parent)
+
+    @classmethod
+    def setUpClass(cls):
+        sys.path.append(cls.site_dir)
+
+    @classmethod
+    def tearDownClass(cls):
+        sys.path.remove(cls.site_dir)
+
+
+class ResourceFromNamespaceZipTests(
+    util.ZipSetupBase,
+    ResourceFromNamespaceTests,
+    unittest.TestCase,
+):
+    ZIP_MODULE = 'namespacedata01'
 
 
 if __name__ == '__main__':
diff --git a/setuptools/_vendor/importlib_resources/tests/update-zips.py b/setuptools/_vendor/importlib_resources/tests/update-zips.py
deleted file mode 100644
index 231334aa7e..0000000000
--- a/setuptools/_vendor/importlib_resources/tests/update-zips.py
+++ /dev/null
@@ -1,53 +0,0 @@
-"""
-Generate the zip test data files.
-
-Run to build the tests/zipdataNN/ziptestdata.zip files from
-files in tests/dataNN.
-
-Replaces the file with the working copy, but does commit anything
-to the source repo.
-"""
-
-import contextlib
-import os
-import pathlib
-import zipfile
-
-
-def main():
-    """
-    >>> from unittest import mock
-    >>> monkeypatch = getfixture('monkeypatch')
-    >>> monkeypatch.setattr(zipfile, 'ZipFile', mock.MagicMock())
-    >>> print(); main()  # print workaround for bpo-32509
-    
-    ...data01... -> ziptestdata/...
-    ...
-    ...data02... -> ziptestdata/...
-    ...
-    """
-    suffixes = '01', '02'
-    tuple(map(generate, suffixes))
-
-
-def generate(suffix):
-    root = pathlib.Path(__file__).parent.relative_to(os.getcwd())
-    zfpath = root / f'zipdata{suffix}/ziptestdata.zip'
-    with zipfile.ZipFile(zfpath, 'w') as zf:
-        for src, rel in walk(root / f'data{suffix}'):
-            dst = 'ziptestdata' / pathlib.PurePosixPath(rel.as_posix())
-            print(src, '->', dst)
-            zf.write(src, dst)
-
-
-def walk(datapath):
-    for dirpath, dirnames, filenames in os.walk(datapath):
-        with contextlib.suppress(ValueError):
-            dirnames.remove('__pycache__')
-        for filename in filenames:
-            res = pathlib.Path(dirpath) / filename
-            rel = res.relative_to(datapath)
-            yield res, rel
-
-
-__name__ == '__main__' and main()
diff --git a/setuptools/_vendor/importlib_resources/tests/util.py b/setuptools/_vendor/importlib_resources/tests/util.py
index b596c0ce4f..fb827d2fa0 100644
--- a/setuptools/_vendor/importlib_resources/tests/util.py
+++ b/setuptools/_vendor/importlib_resources/tests/util.py
@@ -4,11 +4,12 @@
 import sys
 import types
 import pathlib
+import contextlib
 
 from . import data01
-from . import zipdata01
 from ..abc import ResourceReader
-from ._compat import import_helper
+from .compat.py39 import import_helper, os_helper
+from . import zip as zip_
 
 
 from importlib.machinery import ModuleSpec
@@ -80,32 +81,44 @@ def execute(self, package, path):
         """
 
     def test_package_name(self):
-        # Passing in the package name should succeed.
+        """
+        Passing in the package name should succeed.
+        """
         self.execute(data01.__name__, 'utf-8.file')
 
     def test_package_object(self):
-        # Passing in the package itself should succeed.
+        """
+        Passing in the package itself should succeed.
+        """
         self.execute(data01, 'utf-8.file')
 
     def test_string_path(self):
-        # Passing in a string for the path should succeed.
+        """
+        Passing in a string for the path should succeed.
+        """
         path = 'utf-8.file'
         self.execute(data01, path)
 
     def test_pathlib_path(self):
-        # Passing in a pathlib.PurePath object for the path should succeed.
+        """
+        Passing in a pathlib.PurePath object for the path should succeed.
+        """
         path = pathlib.PurePath('utf-8.file')
         self.execute(data01, path)
 
     def test_importing_module_as_side_effect(self):
-        # The anchor package can already be imported.
+        """
+        The anchor package can already be imported.
+        """
         del sys.modules[data01.__name__]
         self.execute(data01.__name__, 'utf-8.file')
 
     def test_missing_path(self):
-        # Attempting to open or read or request the path for a
-        # non-existent path should succeed if open_resource
-        # can return a viable data stream.
+        """
+        Attempting to open or read or request the path for a
+        non-existent path should succeed if open_resource
+        can return a viable data stream.
+        """
         bytes_data = io.BytesIO(b'Hello, world!')
         package = create_package(file=bytes_data, path=FileNotFoundError())
         self.execute(package, 'utf-8.file')
@@ -129,39 +142,23 @@ def test_useless_loader(self):
 
 
 class ZipSetupBase:
-    ZIP_MODULE = None
-
-    @classmethod
-    def setUpClass(cls):
-        data_path = pathlib.Path(cls.ZIP_MODULE.__file__)
-        data_dir = data_path.parent
-        cls._zip_path = str(data_dir / 'ziptestdata.zip')
-        sys.path.append(cls._zip_path)
-        cls.data = importlib.import_module('ziptestdata')
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            sys.path.remove(cls._zip_path)
-        except ValueError:
-            pass
-
-        try:
-            del sys.path_importer_cache[cls._zip_path]
-            del sys.modules[cls.data.__name__]
-        except KeyError:
-            pass
-
-        try:
-            del cls.data
-            del cls._zip_path
-        except AttributeError:
-            pass
+    ZIP_MODULE = 'data01'
 
     def setUp(self):
-        modules = import_helper.modules_setup()
-        self.addCleanup(import_helper.modules_cleanup, *modules)
+        self.fixtures = contextlib.ExitStack()
+        self.addCleanup(self.fixtures.close)
+
+        self.fixtures.enter_context(import_helper.isolated_modules())
+
+        temp_dir = self.fixtures.enter_context(os_helper.temp_dir())
+        modules = pathlib.Path(temp_dir) / 'zipped modules.zip'
+        src_path = pathlib.Path(__file__).parent.joinpath(self.ZIP_MODULE)
+        self.fixtures.enter_context(
+            import_helper.DirsOnSysPath(str(zip_.make_zip_file(src_path, modules)))
+        )
+
+        self.data = importlib.import_module(self.ZIP_MODULE)
 
 
 class ZipSetup(ZipSetupBase):
-    ZIP_MODULE = zipdata01  # type: ignore
+    pass
diff --git a/setuptools/_vendor/importlib_resources/tests/zip.py b/setuptools/_vendor/importlib_resources/tests/zip.py
new file mode 100644
index 0000000000..962195a901
--- /dev/null
+++ b/setuptools/_vendor/importlib_resources/tests/zip.py
@@ -0,0 +1,32 @@
+"""
+Generate zip test data files.
+"""
+
+import contextlib
+import os
+import pathlib
+import zipfile
+
+import zipp
+
+
+def make_zip_file(src, dst):
+    """
+    Zip the files in src into a new zipfile at dst.
+    """
+    with zipfile.ZipFile(dst, 'w') as zf:
+        for src_path, rel in walk(src):
+            dst_name = src.name / pathlib.PurePosixPath(rel.as_posix())
+            zf.write(src_path, dst_name)
+        zipp.CompleteDirs.inject(zf)
+    return dst
+
+
+def walk(datapath):
+    for dirpath, dirnames, filenames in os.walk(datapath):
+        with contextlib.suppress(ValueError):
+            dirnames.remove('__pycache__')
+        for filename in filenames:
+            res = pathlib.Path(dirpath) / filename
+            rel = res.relative_to(datapath)
+            yield res, rel
diff --git a/setuptools/_vendor/importlib_resources/tests/zipdata01/ziptestdata.zip b/setuptools/_vendor/importlib_resources/tests/zipdata01/ziptestdata.zip
deleted file mode 100644
index 9a3bb0739f87e97c1084b94d7d153680f6727738..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 876
zcmWIWW@Zs#00HOCX@Q%&m27l?Y!DU);;PJolGNgol*E!m{nC;&T|+ayw9K5;|NlG~
zQWMD
z9;rDw`8o=rA#S=B3g!7lIVp-}COK17UPc
zNtt;*xhM-3R!jMEPhCreO-3*u>5Df}T7+BJ{639e$2uhfsIs`pJ5Qf}C
xGXyDE@VNvOv@o!wQJfLgCAgysx3f@9jKpUmiW^zkK<;1z!tFpk^MROw0RS~O%0&PG

diff --git a/setuptools/_vendor/importlib_resources/tests/zipdata02/ziptestdata.zip b/setuptools/_vendor/importlib_resources/tests/zipdata02/ziptestdata.zip
deleted file mode 100644
index d63ff512d2807ef2fd259455283b81b02e0e45fb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 698
zcmWIWW@Zs#00HOCX@Ot{ln@8fRhb1Psl_EJi6x2p@$s2?nI-Y@dIgmMI5kP5Y0A$_
z#jWw|&p#`9ff_(q7K_HB)Z+ZoqU2OVy^@L&ph*fa0WRVlP*R?c+X1opI-R&20MZDv
z&j{oIpa8N17@0(vaR(gGH(;=&5k%n(M%;#g0ulz6G@1gL$cA79E2=^00gEsw4~s!C
zUxI@ZWaIMqz|BszK;s4KsL2<9jRy!Q2E6`2cTLHjr{wAk1ZCU@!+_
G1_l6Bc%f?m

diff --git a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/INSTALLER b/setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/jaraco.text-3.7.0.dist-info/INSTALLER
rename to setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER
diff --git a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/LICENSE b/setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE
similarity index 100%
rename from setuptools/_vendor/jaraco.functools-4.0.0.dist-info/LICENSE
rename to setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE
diff --git a/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA b/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA
new file mode 100644
index 0000000000..9a2097a54a
--- /dev/null
+++ b/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA
@@ -0,0 +1,591 @@
+Metadata-Version: 2.1
+Name: inflect
+Version: 7.3.1
+Summary: Correctly generate plurals, singular nouns, ordinals, indefinite articles
+Author-email: Paul Dyson 
+Maintainer-email: "Jason R. Coombs" 
+Project-URL: Source, https://github.com/jaraco/inflect
+Keywords: plural,inflect,participle
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Natural Language :: English
+Classifier: Operating System :: OS Independent
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Text Processing :: Linguistic
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: more-itertools >=8.5.0
+Requires-Dist: typeguard >=4.0.1
+Requires-Dist: typing-extensions ; python_version < "3.9"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: pygments ; extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/inflect.svg
+   :target: https://pypi.org/project/inflect
+
+.. image:: https://img.shields.io/pypi/pyversions/inflect.svg
+
+.. image:: https://github.com/jaraco/inflect/actions/workflows/main.yml/badge.svg
+   :target: https://github.com/jaraco/inflect/actions?query=workflow%3A%22tests%22
+   :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/inflect/badge/?version=latest
+   :target: https://inflect.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+   :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/inflect
+   :target: https://tidelift.com/subscription/pkg/pypi-inflect?utm_source=pypi-inflect&utm_medium=readme
+
+NAME
+====
+
+inflect.py - Correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words.
+
+SYNOPSIS
+========
+
+.. code-block:: python
+
+    import inflect
+
+    p = inflect.engine()
+
+    # METHODS:
+
+    # plural plural_noun plural_verb plural_adj singular_noun no num
+    # compare compare_nouns compare_nouns compare_adjs
+    # a an
+    # present_participle
+    # ordinal number_to_words
+    # join
+    # inflect classical gender
+    # defnoun defverb defadj defa defan
+
+
+    # UNCONDITIONALLY FORM THE PLURAL
+
+    print("The plural of ", word, " is ", p.plural(word))
+
+
+    # CONDITIONALLY FORM THE PLURAL
+
+    print("I saw", cat_count, p.plural("cat", cat_count))
+
+
+    # FORM PLURALS FOR SPECIFIC PARTS OF SPEECH
+
+    print(
+        p.plural_noun("I", N1),
+        p.plural_verb("saw", N1),
+        p.plural_adj("my", N2),
+        p.plural_noun("saw", N2),
+    )
+
+
+    # FORM THE SINGULAR OF PLURAL NOUNS
+
+    print("The singular of ", word, " is ", p.singular_noun(word))
+
+    # SELECT THE GENDER OF SINGULAR PRONOUNS
+
+    print(p.singular_noun("they"))  # 'it'
+    p.gender("feminine")
+    print(p.singular_noun("they"))  # 'she'
+
+
+    # DEAL WITH "0/1/N" -> "no/1/N" TRANSLATION:
+
+    print("There ", p.plural_verb("was", errors), p.no(" error", errors))
+
+
+    # USE DEFAULT COUNTS:
+
+    print(
+        p.num(N1, ""),
+        p.plural("I"),
+        p.plural_verb(" saw"),
+        p.num(N2),
+        p.plural_noun(" saw"),
+    )
+    print("There ", p.num(errors, ""), p.plural_verb("was"), p.no(" error"))
+
+
+    # COMPARE TWO WORDS "NUMBER-INSENSITIVELY":
+
+    if p.compare(word1, word2):
+        print("same")
+    if p.compare_nouns(word1, word2):
+        print("same noun")
+    if p.compare_verbs(word1, word2):
+        print("same verb")
+    if p.compare_adjs(word1, word2):
+        print("same adj.")
+
+
+    # ADD CORRECT "a" OR "an" FOR A GIVEN WORD:
+
+    print("Did you want ", p.a(thing), " or ", p.an(idea))
+
+
+    # CONVERT NUMERALS INTO ORDINALS (i.e. 1->1st, 2->2nd, 3->3rd, etc.)
+
+    print("It was", p.ordinal(position), " from the left\n")
+
+    # CONVERT NUMERALS TO WORDS (i.e. 1->"one", 101->"one hundred and one", etc.)
+    # RETURNS A SINGLE STRING...
+
+    words = p.number_to_words(1234)
+    # "one thousand, two hundred and thirty-four"
+    words = p.number_to_words(p.ordinal(1234))
+    # "one thousand, two hundred and thirty-fourth"
+
+
+    # GET BACK A LIST OF STRINGS, ONE FOR EACH "CHUNK"...
+
+    words = p.number_to_words(1234, wantlist=True)
+    # ("one thousand","two hundred and thirty-four")
+
+
+    # OPTIONAL PARAMETERS CHANGE TRANSLATION:
+
+    words = p.number_to_words(12345, group=1)
+    # "one, two, three, four, five"
+
+    words = p.number_to_words(12345, group=2)
+    # "twelve, thirty-four, five"
+
+    words = p.number_to_words(12345, group=3)
+    # "one twenty-three, forty-five"
+
+    words = p.number_to_words(1234, andword="")
+    # "one thousand, two hundred thirty-four"
+
+    words = p.number_to_words(1234, andword=", plus")
+    # "one thousand, two hundred, plus thirty-four"
+    # TODO: I get no comma before plus: check perl
+
+    words = p.number_to_words(555_1202, group=1, zero="oh")
+    # "five, five, five, one, two, oh, two"
+
+    words = p.number_to_words(555_1202, group=1, one="unity")
+    # "five, five, five, unity, two, oh, two"
+
+    words = p.number_to_words(123.456, group=1, decimal="mark")
+    # "one two three mark four five six"
+    # TODO: DOCBUG: perl gives commas here as do I
+
+    # LITERAL STYLE ONLY NAMES NUMBERS LESS THAN A CERTAIN THRESHOLD...
+
+    words = p.number_to_words(9, threshold=10)  # "nine"
+    words = p.number_to_words(10, threshold=10)  # "ten"
+    words = p.number_to_words(11, threshold=10)  # "11"
+    words = p.number_to_words(1000, threshold=10)  # "1,000"
+
+    # JOIN WORDS INTO A LIST:
+
+    mylist = p.join(("apple", "banana", "carrot"))
+    # "apple, banana, and carrot"
+
+    mylist = p.join(("apple", "banana"))
+    # "apple and banana"
+
+    mylist = p.join(("apple", "banana", "carrot"), final_sep="")
+    # "apple, banana and carrot"
+
+
+    # REQUIRE "CLASSICAL" PLURALS (EG: "focus"->"foci", "cherub"->"cherubim")
+
+    p.classical()  # USE ALL CLASSICAL PLURALS
+
+    p.classical(all=True)  # USE ALL CLASSICAL PLURALS
+    p.classical(all=False)  # SWITCH OFF CLASSICAL MODE
+
+    p.classical(zero=True)  #  "no error" INSTEAD OF "no errors"
+    p.classical(zero=False)  #  "no errors" INSTEAD OF "no error"
+
+    p.classical(herd=True)  #  "2 buffalo" INSTEAD OF "2 buffalos"
+    p.classical(herd=False)  #  "2 buffalos" INSTEAD OF "2 buffalo"
+
+    p.classical(persons=True)  # "2 chairpersons" INSTEAD OF "2 chairpeople"
+    p.classical(persons=False)  # "2 chairpeople" INSTEAD OF "2 chairpersons"
+
+    p.classical(ancient=True)  # "2 formulae" INSTEAD OF "2 formulas"
+    p.classical(ancient=False)  # "2 formulas" INSTEAD OF "2 formulae"
+
+
+    # INTERPOLATE "plural()", "plural_noun()", "plural_verb()", "plural_adj()", "singular_noun()",
+    # a()", "an()", "num()" AND "ordinal()" WITHIN STRINGS:
+
+    print(p.inflect("The plural of {0} is plural('{0}')".format(word)))
+    print(p.inflect("The singular of {0} is singular_noun('{0}')".format(word)))
+    print(p.inflect("I saw {0} plural('cat',{0})".format(cat_count)))
+    print(
+        p.inflect(
+            "plural('I',{0}) "
+            "plural_verb('saw',{0}) "
+            "plural('a',{1}) "
+            "plural_noun('saw',{1})".format(N1, N2)
+        )
+    )
+    print(
+        p.inflect(
+            "num({0}, False)plural('I') "
+            "plural_verb('saw') "
+            "num({1}, False)plural('a') "
+            "plural_noun('saw')".format(N1, N2)
+        )
+    )
+    print(p.inflect("I saw num({0}) plural('cat')\nnum()".format(cat_count)))
+    print(p.inflect("There plural_verb('was',{0}) no('error',{0})".format(errors)))
+    print(p.inflect("There num({0}, False)plural_verb('was') no('error')".format(errors)))
+    print(p.inflect("Did you want a('{0}') or an('{1}')".format(thing, idea)))
+    print(p.inflect("It was ordinal('{0}') from the left".format(position)))
+
+
+    # ADD USER-DEFINED INFLECTIONS (OVERRIDING INBUILT RULES):
+
+    p.defnoun("VAX", "VAXen")  # SINGULAR => PLURAL
+
+    p.defverb(
+        "will",  # 1ST PERSON SINGULAR
+        "shall",  # 1ST PERSON PLURAL
+        "will",  # 2ND PERSON SINGULAR
+        "will",  # 2ND PERSON PLURAL
+        "will",  # 3RD PERSON SINGULAR
+        "will",  # 3RD PERSON PLURAL
+    )
+
+    p.defadj("hir", "their")  # SINGULAR => PLURAL
+
+    p.defa("h")  # "AY HALWAYS SEZ 'HAITCH'!"
+
+    p.defan("horrendous.*")  # "AN HORRENDOUS AFFECTATION"
+
+
+DESCRIPTION
+===========
+
+The methods of the class ``engine`` in module ``inflect.py`` provide plural
+inflections, singular noun inflections, "a"/"an" selection for English words,
+and manipulation of numbers as words.
+
+Plural forms of all nouns, most verbs, and some adjectives are
+provided. Where appropriate, "classical" variants (for example: "brother" ->
+"brethren", "dogma" -> "dogmata", etc.) are also provided.
+
+Single forms of nouns are also provided. The gender of singular pronouns
+can be chosen (for example "they" -> "it" or "she" or "he" or "they").
+
+Pronunciation-based "a"/"an" selection is provided for all English
+words, and most initialisms.
+
+It is also possible to inflect numerals (1,2,3) to ordinals (1st, 2nd, 3rd)
+and to English words ("one", "two", "three").
+
+In generating these inflections, ``inflect.py`` follows the Oxford
+English Dictionary and the guidelines in Fowler's Modern English
+Usage, preferring the former where the two disagree.
+
+The module is built around standard British spelling, but is designed
+to cope with common American variants as well. Slang, jargon, and
+other English dialects are *not* explicitly catered for.
+
+Where two or more inflected forms exist for a single word (typically a
+"classical" form and a "modern" form), ``inflect.py`` prefers the
+more common form (typically the "modern" one), unless "classical"
+processing has been specified
+(see `MODERN VS CLASSICAL INFLECTIONS`).
+
+FORMING PLURALS AND SINGULARS
+=============================
+
+Inflecting Plurals and Singulars
+--------------------------------
+
+All of the ``plural...`` plural inflection methods take the word to be
+inflected as their first argument and return the corresponding inflection.
+Note that all such methods expect the *singular* form of the word. The
+results of passing a plural form are undefined (and unlikely to be correct).
+Similarly, the ``si...`` singular inflection method expects the *plural*
+form of the word.
+
+The ``plural...`` methods also take an optional second argument,
+which indicates the grammatical "number" of the word (or of another word
+with which the word being inflected must agree). If the "number" argument is
+supplied and is not ``1`` (or ``"one"`` or ``"a"``, or some other adjective that
+implies the singular), the plural form of the word is returned. If the
+"number" argument *does* indicate singularity, the (uninflected) word
+itself is returned. If the number argument is omitted, the plural form
+is returned unconditionally.
+
+The ``si...`` method takes a second argument in a similar fashion. If it is
+some form of the number ``1``, or is omitted, the singular form is returned.
+Otherwise the plural is returned unaltered.
+
+
+The various methods of ``inflect.engine`` are:
+
+
+
+``plural_noun(word, count=None)``
+
+ The method ``plural_noun()`` takes a *singular* English noun or
+ pronoun and returns its plural. Pronouns in the nominative ("I" ->
+ "we") and accusative ("me" -> "us") cases are handled, as are
+ possessive pronouns ("mine" -> "ours").
+
+
+``plural_verb(word, count=None)``
+
+ The method ``plural_verb()`` takes the *singular* form of a
+ conjugated verb (that is, one which is already in the correct "person"
+ and "mood") and returns the corresponding plural conjugation.
+
+
+``plural_adj(word, count=None)``
+
+ The method ``plural_adj()`` takes the *singular* form of
+ certain types of adjectives and returns the corresponding plural form.
+ Adjectives that are correctly handled include: "numerical" adjectives
+ ("a" -> "some"), demonstrative adjectives ("this" -> "these", "that" ->
+ "those"), and possessives ("my" -> "our", "cat's" -> "cats'", "child's"
+ -> "childrens'", etc.)
+
+
+``plural(word, count=None)``
+
+ The method ``plural()`` takes a *singular* English noun,
+ pronoun, verb, or adjective and returns its plural form. Where a word
+ has more than one inflection depending on its part of speech (for
+ example, the noun "thought" inflects to "thoughts", the verb "thought"
+ to "thought"), the (singular) noun sense is preferred to the (singular)
+ verb sense.
+
+ Hence ``plural("knife")`` will return "knives" ("knife" having been treated
+ as a singular noun), whereas ``plural("knifes")`` will return "knife"
+ ("knifes" having been treated as a 3rd person singular verb).
+
+ The inherent ambiguity of such cases suggests that,
+ where the part of speech is known, ``plural_noun``, ``plural_verb``, and
+ ``plural_adj`` should be used in preference to ``plural``.
+
+
+``singular_noun(word, count=None)``
+
+ The method ``singular_noun()`` takes a *plural* English noun or
+ pronoun and returns its singular. Pronouns in the nominative ("we" ->
+ "I") and accusative ("us" -> "me") cases are handled, as are
+ possessive pronouns ("ours" -> "mine"). When third person
+ singular pronouns are returned they take the neuter gender by default
+ ("they" -> "it"), not ("they"-> "she") nor ("they" -> "he"). This can be
+ changed with ``gender()``.
+
+Note that all these methods ignore any whitespace surrounding the
+word being inflected, but preserve that whitespace when the result is
+returned. For example, ``plural(" cat  ")`` returns " cats  ".
+
+
+``gender(genderletter)``
+
+ The third person plural pronoun takes the same form for the female, male and
+ neuter (e.g. "they"). The singular however, depends upon gender (e.g. "she",
+ "he", "it" and "they" -- "they" being the gender neutral form.) By default
+ ``singular_noun`` returns the neuter form, however, the gender can be selected with
+ the ``gender`` method. Pass the first letter of the gender to
+ ``gender`` to return the f(eminine), m(asculine), n(euter) or t(hey)
+ form of the singular. e.g.
+ gender('f') followed by singular_noun('themselves') returns 'herself'.
+
+Numbered plurals
+----------------
+
+The ``plural...`` methods return only the inflected word, not the count that
+was used to inflect it. Thus, in order to produce "I saw 3 ducks", it
+is necessary to use:
+
+.. code-block:: python
+
+    print("I saw", N, p.plural_noun(animal, N))
+
+Since the usual purpose of producing a plural is to make it agree with
+a preceding count, inflect.py provides a method
+(``no(word, count)``) which, given a word and a(n optional) count, returns the
+count followed by the correctly inflected word. Hence the previous
+example can be rewritten:
+
+.. code-block:: python
+
+    print("I saw ", p.no(animal, N))
+
+In addition, if the count is zero (or some other term which implies
+zero, such as ``"zero"``, ``"nil"``, etc.) the count is replaced by the
+word "no". Hence, if ``N`` had the value zero, the previous example
+would print (the somewhat more elegant)::
+
+    I saw no animals
+
+rather than::
+
+    I saw 0 animals
+
+Note that the name of the method is a pun: the method
+returns either a number (a *No.*) or a ``"no"``, in front of the
+inflected word.
+
+
+Reducing the number of counts required
+--------------------------------------
+
+In some contexts, the need to supply an explicit count to the various
+``plural...`` methods makes for tiresome repetition. For example:
+
+.. code-block:: python
+
+    print(
+        plural_adj("This", errors),
+        plural_noun(" error", errors),
+        plural_verb(" was", errors),
+        " fatal.",
+    )
+
+inflect.py therefore provides a method
+(``num(count=None, show=None)``) which may be used to set a persistent "default number"
+value. If such a value is set, it is subsequently used whenever an
+optional second "number" argument is omitted. The default value thus set
+can subsequently be removed by calling ``num()`` with no arguments.
+Hence we could rewrite the previous example:
+
+.. code-block:: python
+
+    p.num(errors)
+    print(p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal.")
+    p.num()
+
+Normally, ``num()`` returns its first argument, so that it may also
+be "inlined" in contexts like:
+
+.. code-block:: python
+
+    print(p.num(errors), p.plural_noun(" error"), p.plural_verb(" was"), " detected.")
+    if severity > 1:
+        print(
+            p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
+        )
+
+However, in certain contexts (see `INTERPOLATING INFLECTIONS IN STRINGS`)
+it is preferable that ``num()`` return an empty string. Hence ``num()``
+provides an optional second argument. If that argument is supplied (that is, if
+it is defined) and evaluates to false, ``num`` returns an empty string
+instead of its first argument. For example:
+
+.. code-block:: python
+
+    print(p.num(errors, 0), p.no("error"), p.plural_verb(" was"), " detected.")
+    if severity > 1:
+        print(
+            p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
+        )
+
+
+
+Number-insensitive equality
+---------------------------
+
+inflect.py also provides a solution to the problem
+of comparing words of differing plurality through the methods
+``compare(word1, word2)``, ``compare_nouns(word1, word2)``,
+``compare_verbs(word1, word2)``, and ``compare_adjs(word1, word2)``.
+Each  of these methods takes two strings, and  compares them
+using the corresponding plural-inflection method (``plural()``, ``plural_noun()``,
+``plural_verb()``, and ``plural_adj()`` respectively).
+
+The comparison returns true if:
+
+- the strings are equal, or
+- one string is equal to a plural form of the other, or
+- the strings are two different plural forms of the one word.
+
+
+Hence all of the following return true:
+
+.. code-block:: python
+
+    p.compare("index", "index")  # RETURNS "eq"
+    p.compare("index", "indexes")  # RETURNS "s:p"
+    p.compare("index", "indices")  # RETURNS "s:p"
+    p.compare("indexes", "index")  # RETURNS "p:s"
+    p.compare("indices", "index")  # RETURNS "p:s"
+    p.compare("indices", "indexes")  # RETURNS "p:p"
+    p.compare("indexes", "indices")  # RETURNS "p:p"
+    p.compare("indices", "indices")  # RETURNS "eq"
+
+As indicated by the comments in the previous example, the actual value
+returned by the various ``compare`` methods encodes which of the
+three equality rules succeeded: "eq" is returned if the strings were
+identical, "s:p" if the strings were singular and plural respectively,
+"p:s" for plural and singular, and "p:p" for two distinct plurals.
+Inequality is indicated by returning an empty string.
+
+It should be noted that two distinct singular words which happen to take
+the same plural form are *not* considered equal, nor are cases where
+one (singular) word's plural is the other (plural) word's singular.
+Hence all of the following return false:
+
+.. code-block:: python
+
+    p.compare("base", "basis")  # ALTHOUGH BOTH -> "bases"
+    p.compare("syrinx", "syringe")  # ALTHOUGH BOTH -> "syringes"
+    p.compare("she", "he")  # ALTHOUGH BOTH -> "they"
+
+    p.compare("opus", "operas")  # ALTHOUGH "opus" -> "opera" -> "operas"
+    p.compare("taxi", "taxes")  # ALTHOUGH "taxi" -> "taxis" -> "taxes"
+
+Note too that, although the comparison is "number-insensitive" it is *not*
+case-insensitive (that is, ``plural("time","Times")`` returns false. To obtain
+both number and case insensitivity, use the ``lower()`` method on both strings
+(that is, ``plural("time".lower(), "Times".lower())`` returns true).
+
+Related Functionality
+=====================
+
+Shout out to these libraries that provide related functionality:
+
+* `WordSet `_
+  parses identifiers like variable names into sets of words suitable for re-assembling
+  in another form.
+
+* `word2number `_ converts words to
+  a number.
+
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD b/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD
new file mode 100644
index 0000000000..73ff576be5
--- /dev/null
+++ b/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD
@@ -0,0 +1,13 @@
+inflect-7.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+inflect-7.3.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+inflect-7.3.1.dist-info/METADATA,sha256=ZgMNY0WAZRs-U8wZiV2SMfjSKqBrMngXyDMs_CAwMwg,21079
+inflect-7.3.1.dist-info/RECORD,,
+inflect-7.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
+inflect-7.3.1.dist-info/top_level.txt,sha256=m52ujdp10CqT6jh1XQxZT6kEntcnv-7Tl7UiGNTzWZA,8
+inflect/__init__.py,sha256=Jxy1HJXZiZ85kHeLAhkmvz6EMTdFqBe-duvt34R6IOc,103796
+inflect/__pycache__/__init__.cpython-312.pyc,,
+inflect/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+inflect/compat/__pycache__/__init__.cpython-312.pyc,,
+inflect/compat/__pycache__/py38.cpython-312.pyc,,
+inflect/compat/py38.py,sha256=oObVfVnWX9_OpnOuEJn1mFbJxVhwyR5epbiTNXDDaso,160
+inflect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/WHEEL b/setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL
similarity index 65%
rename from setuptools/_vendor/jaraco.functools-4.0.0.dist-info/WHEEL
rename to setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL
index ba48cbcf92..564c6724e4 100644
--- a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/WHEEL
+++ b/setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL
@@ -1,5 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.41.3)
+Generator: setuptools (70.2.0)
 Root-Is-Purelib: true
 Tag: py3-none-any
 
diff --git a/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt b/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt
new file mode 100644
index 0000000000..0fd75fab3e
--- /dev/null
+++ b/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+inflect
diff --git a/setuptools/_vendor/inflect/__init__.py b/setuptools/_vendor/inflect/__init__.py
new file mode 100644
index 0000000000..3eec27f4c6
--- /dev/null
+++ b/setuptools/_vendor/inflect/__init__.py
@@ -0,0 +1,3986 @@
+"""
+inflect: english language inflection
+ - correctly generate plurals, ordinals, indefinite articles
+ - convert numbers to words
+
+Copyright (C) 2010 Paul Dyson
+
+Based upon the Perl module
+`Lingua::EN::Inflect `_.
+
+methods:
+    classical inflect
+    plural plural_noun plural_verb plural_adj singular_noun no num a an
+    compare compare_nouns compare_verbs compare_adjs
+    present_participle
+    ordinal
+    number_to_words
+    join
+    defnoun defverb defadj defa defan
+
+INFLECTIONS:
+    classical inflect
+    plural plural_noun plural_verb plural_adj singular_noun compare
+    no num a an present_participle
+
+PLURALS:
+    classical inflect
+    plural plural_noun plural_verb plural_adj singular_noun no num
+    compare compare_nouns compare_verbs compare_adjs
+
+COMPARISONS:
+    classical
+    compare compare_nouns compare_verbs compare_adjs
+
+ARTICLES:
+    classical inflect num a an
+
+NUMERICAL:
+    ordinal number_to_words
+
+USER_DEFINED:
+    defnoun defverb defadj defa defan
+
+Exceptions:
+ UnknownClassicalModeError
+ BadNumValueError
+ BadChunkingOptionError
+ NumOutOfRangeError
+ BadUserDefinedPatternError
+ BadRcFileError
+ BadGenderError
+
+"""
+
+from __future__ import annotations
+
+import ast
+import collections
+import contextlib
+import functools
+import itertools
+import re
+from numbers import Number
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Callable,
+    Dict,
+    Iterable,
+    List,
+    Literal,
+    Match,
+    Optional,
+    Sequence,
+    Tuple,
+    Union,
+    cast,
+)
+
+from more_itertools import windowed_complete
+from typeguard import typechecked
+
+from .compat.py38 import Annotated
+
+
+class UnknownClassicalModeError(Exception):
+    pass
+
+
+class BadNumValueError(Exception):
+    pass
+
+
+class BadChunkingOptionError(Exception):
+    pass
+
+
+class NumOutOfRangeError(Exception):
+    pass
+
+
+class BadUserDefinedPatternError(Exception):
+    pass
+
+
+class BadRcFileError(Exception):
+    pass
+
+
+class BadGenderError(Exception):
+    pass
+
+
+def enclose(s: str) -> str:
+    return f"(?:{s})"
+
+
+def joinstem(cutpoint: Optional[int] = 0, words: Optional[Iterable[str]] = None) -> str:
+    """
+    Join stem of each word in words into a string for regex.
+
+    Each word is truncated at cutpoint.
+
+    Cutpoint is usually negative indicating the number of letters to remove
+    from the end of each word.
+
+    >>> joinstem(-2, ["ephemeris", "iris", ".*itis"])
+    '(?:ephemer|ir|.*it)'
+
+    >>> joinstem(None, ["ephemeris"])
+    '(?:ephemeris)'
+
+    >>> joinstem(5, None)
+    '(?:)'
+    """
+    return enclose("|".join(w[:cutpoint] for w in words or []))
+
+
+def bysize(words: Iterable[str]) -> Dict[int, set]:
+    """
+    From a list of words, return a dict of sets sorted by word length.
+
+    >>> words = ['ant', 'cat', 'dog', 'pig', 'frog', 'goat', 'horse', 'elephant']
+    >>> ret = bysize(words)
+    >>> sorted(ret[3])
+    ['ant', 'cat', 'dog', 'pig']
+    >>> ret[5]
+    {'horse'}
+    """
+    res: Dict[int, set] = collections.defaultdict(set)
+    for w in words:
+        res[len(w)].add(w)
+    return res
+
+
+def make_pl_si_lists(
+    lst: Iterable[str],
+    plending: str,
+    siendingsize: Optional[int],
+    dojoinstem: bool = True,
+):
+    """
+    given a list of singular words: lst
+
+    an ending to append to make the plural: plending
+
+    the number of characters to remove from the singular
+    before appending plending: siendingsize
+
+    a flag whether to create a joinstem: dojoinstem
+
+    return:
+    a list of pluralised words: si_list (called si because this is what you need to
+    look for to make the singular)
+
+    the pluralised words as a dict of sets sorted by word length: si_bysize
+    the singular words as a dict of sets sorted by word length: pl_bysize
+    if dojoinstem is True: a regular expression that matches any of the stems: stem
+    """
+    if siendingsize is not None:
+        siendingsize = -siendingsize
+    si_list = [w[:siendingsize] + plending for w in lst]
+    pl_bysize = bysize(lst)
+    si_bysize = bysize(si_list)
+    if dojoinstem:
+        stem = joinstem(siendingsize, lst)
+        return si_list, si_bysize, pl_bysize, stem
+    else:
+        return si_list, si_bysize, pl_bysize
+
+
+# 1. PLURALS
+
+pl_sb_irregular_s = {
+    "corpus": "corpuses|corpora",
+    "opus": "opuses|opera",
+    "genus": "genera",
+    "mythos": "mythoi",
+    "penis": "penises|penes",
+    "testis": "testes",
+    "atlas": "atlases|atlantes",
+    "yes": "yeses",
+}
+
+pl_sb_irregular = {
+    "child": "children",
+    "chili": "chilis|chilies",
+    "brother": "brothers|brethren",
+    "infinity": "infinities|infinity",
+    "loaf": "loaves",
+    "lore": "lores|lore",
+    "hoof": "hoofs|hooves",
+    "beef": "beefs|beeves",
+    "thief": "thiefs|thieves",
+    "money": "monies",
+    "mongoose": "mongooses",
+    "ox": "oxen",
+    "cow": "cows|kine",
+    "graffito": "graffiti",
+    "octopus": "octopuses|octopodes",
+    "genie": "genies|genii",
+    "ganglion": "ganglions|ganglia",
+    "trilby": "trilbys",
+    "turf": "turfs|turves",
+    "numen": "numina",
+    "atman": "atmas",
+    "occiput": "occiputs|occipita",
+    "sabretooth": "sabretooths",
+    "sabertooth": "sabertooths",
+    "lowlife": "lowlifes",
+    "flatfoot": "flatfoots",
+    "tenderfoot": "tenderfoots",
+    "romany": "romanies",
+    "jerry": "jerries",
+    "mary": "maries",
+    "talouse": "talouses",
+    "rom": "roma",
+    "carmen": "carmina",
+}
+
+pl_sb_irregular.update(pl_sb_irregular_s)
+# pl_sb_irregular_keys = enclose('|'.join(pl_sb_irregular.keys()))
+
+pl_sb_irregular_caps = {
+    "Romany": "Romanies",
+    "Jerry": "Jerrys",
+    "Mary": "Marys",
+    "Rom": "Roma",
+}
+
+pl_sb_irregular_compound = {"prima donna": "prima donnas|prime donne"}
+
+si_sb_irregular = {v: k for (k, v) in pl_sb_irregular.items()}
+for k in list(si_sb_irregular):
+    if "|" in k:
+        k1, k2 = k.split("|")
+        si_sb_irregular[k1] = si_sb_irregular[k2] = si_sb_irregular[k]
+        del si_sb_irregular[k]
+si_sb_irregular_caps = {v: k for (k, v) in pl_sb_irregular_caps.items()}
+si_sb_irregular_compound = {v: k for (k, v) in pl_sb_irregular_compound.items()}
+for k in list(si_sb_irregular_compound):
+    if "|" in k:
+        k1, k2 = k.split("|")
+        si_sb_irregular_compound[k1] = si_sb_irregular_compound[k2] = (
+            si_sb_irregular_compound[k]
+        )
+        del si_sb_irregular_compound[k]
+
+# si_sb_irregular_keys = enclose('|'.join(si_sb_irregular.keys()))
+
+# Z's that don't double
+
+pl_sb_z_zes_list = ("quartz", "topaz")
+pl_sb_z_zes_bysize = bysize(pl_sb_z_zes_list)
+
+pl_sb_ze_zes_list = ("snooze",)
+pl_sb_ze_zes_bysize = bysize(pl_sb_ze_zes_list)
+
+
+# CLASSICAL "..is" -> "..ides"
+
+pl_sb_C_is_ides_complete = [
+    # GENERAL WORDS...
+    "ephemeris",
+    "iris",
+    "clitoris",
+    "chrysalis",
+    "epididymis",
+]
+
+pl_sb_C_is_ides_endings = [
+    # INFLAMATIONS...
+    "itis"
+]
+
+pl_sb_C_is_ides = joinstem(
+    -2, pl_sb_C_is_ides_complete + [f".*{w}" for w in pl_sb_C_is_ides_endings]
+)
+
+pl_sb_C_is_ides_list = pl_sb_C_is_ides_complete + pl_sb_C_is_ides_endings
+
+(
+    si_sb_C_is_ides_list,
+    si_sb_C_is_ides_bysize,
+    pl_sb_C_is_ides_bysize,
+) = make_pl_si_lists(pl_sb_C_is_ides_list, "ides", 2, dojoinstem=False)
+
+
+# CLASSICAL "..a" -> "..ata"
+
+pl_sb_C_a_ata_list = (
+    "anathema",
+    "bema",
+    "carcinoma",
+    "charisma",
+    "diploma",
+    "dogma",
+    "drama",
+    "edema",
+    "enema",
+    "enigma",
+    "lemma",
+    "lymphoma",
+    "magma",
+    "melisma",
+    "miasma",
+    "oedema",
+    "sarcoma",
+    "schema",
+    "soma",
+    "stigma",
+    "stoma",
+    "trauma",
+    "gumma",
+    "pragma",
+)
+
+(
+    si_sb_C_a_ata_list,
+    si_sb_C_a_ata_bysize,
+    pl_sb_C_a_ata_bysize,
+    pl_sb_C_a_ata,
+) = make_pl_si_lists(pl_sb_C_a_ata_list, "ata", 1)
+
+# UNCONDITIONAL "..a" -> "..ae"
+
+pl_sb_U_a_ae_list = (
+    "alumna",
+    "alga",
+    "vertebra",
+    "persona",
+    "vita",
+)
+(
+    si_sb_U_a_ae_list,
+    si_sb_U_a_ae_bysize,
+    pl_sb_U_a_ae_bysize,
+    pl_sb_U_a_ae,
+) = make_pl_si_lists(pl_sb_U_a_ae_list, "e", None)
+
+# CLASSICAL "..a" -> "..ae"
+
+pl_sb_C_a_ae_list = (
+    "amoeba",
+    "antenna",
+    "formula",
+    "hyperbola",
+    "medusa",
+    "nebula",
+    "parabola",
+    "abscissa",
+    "hydra",
+    "nova",
+    "lacuna",
+    "aurora",
+    "umbra",
+    "flora",
+    "fauna",
+)
+(
+    si_sb_C_a_ae_list,
+    si_sb_C_a_ae_bysize,
+    pl_sb_C_a_ae_bysize,
+    pl_sb_C_a_ae,
+) = make_pl_si_lists(pl_sb_C_a_ae_list, "e", None)
+
+
+# CLASSICAL "..en" -> "..ina"
+
+pl_sb_C_en_ina_list = ("stamen", "foramen", "lumen")
+
+(
+    si_sb_C_en_ina_list,
+    si_sb_C_en_ina_bysize,
+    pl_sb_C_en_ina_bysize,
+    pl_sb_C_en_ina,
+) = make_pl_si_lists(pl_sb_C_en_ina_list, "ina", 2)
+
+
+# UNCONDITIONAL "..um" -> "..a"
+
+pl_sb_U_um_a_list = (
+    "bacterium",
+    "agendum",
+    "desideratum",
+    "erratum",
+    "stratum",
+    "datum",
+    "ovum",
+    "extremum",
+    "candelabrum",
+)
+(
+    si_sb_U_um_a_list,
+    si_sb_U_um_a_bysize,
+    pl_sb_U_um_a_bysize,
+    pl_sb_U_um_a,
+) = make_pl_si_lists(pl_sb_U_um_a_list, "a", 2)
+
+# CLASSICAL "..um" -> "..a"
+
+pl_sb_C_um_a_list = (
+    "maximum",
+    "minimum",
+    "momentum",
+    "optimum",
+    "quantum",
+    "cranium",
+    "curriculum",
+    "dictum",
+    "phylum",
+    "aquarium",
+    "compendium",
+    "emporium",
+    "encomium",
+    "gymnasium",
+    "honorarium",
+    "interregnum",
+    "lustrum",
+    "memorandum",
+    "millennium",
+    "rostrum",
+    "spectrum",
+    "speculum",
+    "stadium",
+    "trapezium",
+    "ultimatum",
+    "medium",
+    "vacuum",
+    "velum",
+    "consortium",
+    "arboretum",
+)
+
+(
+    si_sb_C_um_a_list,
+    si_sb_C_um_a_bysize,
+    pl_sb_C_um_a_bysize,
+    pl_sb_C_um_a,
+) = make_pl_si_lists(pl_sb_C_um_a_list, "a", 2)
+
+
+# UNCONDITIONAL "..us" -> "i"
+
+pl_sb_U_us_i_list = (
+    "alumnus",
+    "alveolus",
+    "bacillus",
+    "bronchus",
+    "locus",
+    "nucleus",
+    "stimulus",
+    "meniscus",
+    "sarcophagus",
+)
+(
+    si_sb_U_us_i_list,
+    si_sb_U_us_i_bysize,
+    pl_sb_U_us_i_bysize,
+    pl_sb_U_us_i,
+) = make_pl_si_lists(pl_sb_U_us_i_list, "i", 2)
+
+# CLASSICAL "..us" -> "..i"
+
+pl_sb_C_us_i_list = (
+    "focus",
+    "radius",
+    "genius",
+    "incubus",
+    "succubus",
+    "nimbus",
+    "fungus",
+    "nucleolus",
+    "stylus",
+    "torus",
+    "umbilicus",
+    "uterus",
+    "hippopotamus",
+    "cactus",
+)
+
+(
+    si_sb_C_us_i_list,
+    si_sb_C_us_i_bysize,
+    pl_sb_C_us_i_bysize,
+    pl_sb_C_us_i,
+) = make_pl_si_lists(pl_sb_C_us_i_list, "i", 2)
+
+
+# CLASSICAL "..us" -> "..us"  (ASSIMILATED 4TH DECLENSION LATIN NOUNS)
+
+pl_sb_C_us_us = (
+    "status",
+    "apparatus",
+    "prospectus",
+    "sinus",
+    "hiatus",
+    "impetus",
+    "plexus",
+)
+pl_sb_C_us_us_bysize = bysize(pl_sb_C_us_us)
+
+# UNCONDITIONAL "..on" -> "a"
+
+pl_sb_U_on_a_list = (
+    "criterion",
+    "perihelion",
+    "aphelion",
+    "phenomenon",
+    "prolegomenon",
+    "noumenon",
+    "organon",
+    "asyndeton",
+    "hyperbaton",
+)
+(
+    si_sb_U_on_a_list,
+    si_sb_U_on_a_bysize,
+    pl_sb_U_on_a_bysize,
+    pl_sb_U_on_a,
+) = make_pl_si_lists(pl_sb_U_on_a_list, "a", 2)
+
+# CLASSICAL "..on" -> "..a"
+
+pl_sb_C_on_a_list = ("oxymoron",)
+
+(
+    si_sb_C_on_a_list,
+    si_sb_C_on_a_bysize,
+    pl_sb_C_on_a_bysize,
+    pl_sb_C_on_a,
+) = make_pl_si_lists(pl_sb_C_on_a_list, "a", 2)
+
+
+# CLASSICAL "..o" -> "..i"  (BUT NORMALLY -> "..os")
+
+pl_sb_C_o_i = [
+    "solo",
+    "soprano",
+    "basso",
+    "alto",
+    "contralto",
+    "tempo",
+    "piano",
+    "virtuoso",
+]  # list not tuple so can concat for pl_sb_U_o_os
+
+pl_sb_C_o_i_bysize = bysize(pl_sb_C_o_i)
+si_sb_C_o_i_bysize = bysize([f"{w[:-1]}i" for w in pl_sb_C_o_i])
+
+pl_sb_C_o_i_stems = joinstem(-1, pl_sb_C_o_i)
+
+# ALWAYS "..o" -> "..os"
+
+pl_sb_U_o_os_complete = {"ado", "ISO", "NATO", "NCO", "NGO", "oto"}
+si_sb_U_o_os_complete = {f"{w}s" for w in pl_sb_U_o_os_complete}
+
+
+pl_sb_U_o_os_endings = [
+    "aficionado",
+    "aggro",
+    "albino",
+    "allegro",
+    "ammo",
+    "Antananarivo",
+    "archipelago",
+    "armadillo",
+    "auto",
+    "avocado",
+    "Bamako",
+    "Barquisimeto",
+    "bimbo",
+    "bingo",
+    "Biro",
+    "bolero",
+    "Bolzano",
+    "bongo",
+    "Boto",
+    "burro",
+    "Cairo",
+    "canto",
+    "cappuccino",
+    "casino",
+    "cello",
+    "Chicago",
+    "Chimango",
+    "cilantro",
+    "cochito",
+    "coco",
+    "Colombo",
+    "Colorado",
+    "commando",
+    "concertino",
+    "contango",
+    "credo",
+    "crescendo",
+    "cyano",
+    "demo",
+    "ditto",
+    "Draco",
+    "dynamo",
+    "embryo",
+    "Esperanto",
+    "espresso",
+    "euro",
+    "falsetto",
+    "Faro",
+    "fiasco",
+    "Filipino",
+    "flamenco",
+    "furioso",
+    "generalissimo",
+    "Gestapo",
+    "ghetto",
+    "gigolo",
+    "gizmo",
+    "Greensboro",
+    "gringo",
+    "Guaiabero",
+    "guano",
+    "gumbo",
+    "gyro",
+    "hairdo",
+    "hippo",
+    "Idaho",
+    "impetigo",
+    "inferno",
+    "info",
+    "intermezzo",
+    "intertrigo",
+    "Iquico",
+    "jumbo",
+    "junto",
+    "Kakapo",
+    "kilo",
+    "Kinkimavo",
+    "Kokako",
+    "Kosovo",
+    "Lesotho",
+    "libero",
+    "libido",
+    "libretto",
+    "lido",
+    "Lilo",
+    "limbo",
+    "limo",
+    "lineno",
+    "lingo",
+    "lino",
+    "livedo",
+    "loco",
+    "logo",
+    "lumbago",
+    "macho",
+    "macro",
+    "mafioso",
+    "magneto",
+    "magnifico",
+    "Majuro",
+    "Malabo",
+    "manifesto",
+    "Maputo",
+    "Maracaibo",
+    "medico",
+    "memo",
+    "metro",
+    "Mexico",
+    "micro",
+    "Milano",
+    "Monaco",
+    "mono",
+    "Montenegro",
+    "Morocco",
+    "Muqdisho",
+    "myo",
+    "neutrino",
+    "Ningbo",
+    "octavo",
+    "oregano",
+    "Orinoco",
+    "Orlando",
+    "Oslo",
+    "panto",
+    "Paramaribo",
+    "Pardusco",
+    "pedalo",
+    "photo",
+    "pimento",
+    "pinto",
+    "pleco",
+    "Pluto",
+    "pogo",
+    "polo",
+    "poncho",
+    "Porto-Novo",
+    "Porto",
+    "pro",
+    "psycho",
+    "pueblo",
+    "quarto",
+    "Quito",
+    "repo",
+    "rhino",
+    "risotto",
+    "rococo",
+    "rondo",
+    "Sacramento",
+    "saddo",
+    "sago",
+    "salvo",
+    "Santiago",
+    "Sapporo",
+    "Sarajevo",
+    "scherzando",
+    "scherzo",
+    "silo",
+    "sirocco",
+    "sombrero",
+    "staccato",
+    "sterno",
+    "stucco",
+    "stylo",
+    "sumo",
+    "Taiko",
+    "techno",
+    "terrazzo",
+    "testudo",
+    "timpano",
+    "tiro",
+    "tobacco",
+    "Togo",
+    "Tokyo",
+    "torero",
+    "Torino",
+    "Toronto",
+    "torso",
+    "tremolo",
+    "typo",
+    "tyro",
+    "ufo",
+    "UNESCO",
+    "vaquero",
+    "vermicello",
+    "verso",
+    "vibrato",
+    "violoncello",
+    "Virgo",
+    "weirdo",
+    "WHO",
+    "WTO",
+    "Yamoussoukro",
+    "yo-yo",
+    "zero",
+    "Zibo",
+] + pl_sb_C_o_i
+
+pl_sb_U_o_os_bysize = bysize(pl_sb_U_o_os_endings)
+si_sb_U_o_os_bysize = bysize([f"{w}s" for w in pl_sb_U_o_os_endings])
+
+
+# UNCONDITIONAL "..ch" -> "..chs"
+
+pl_sb_U_ch_chs_list = ("czech", "eunuch", "stomach")
+
+(
+    si_sb_U_ch_chs_list,
+    si_sb_U_ch_chs_bysize,
+    pl_sb_U_ch_chs_bysize,
+    pl_sb_U_ch_chs,
+) = make_pl_si_lists(pl_sb_U_ch_chs_list, "s", None)
+
+
+# UNCONDITIONAL "..[ei]x" -> "..ices"
+
+pl_sb_U_ex_ices_list = ("codex", "murex", "silex")
+(
+    si_sb_U_ex_ices_list,
+    si_sb_U_ex_ices_bysize,
+    pl_sb_U_ex_ices_bysize,
+    pl_sb_U_ex_ices,
+) = make_pl_si_lists(pl_sb_U_ex_ices_list, "ices", 2)
+
+pl_sb_U_ix_ices_list = ("radix", "helix")
+(
+    si_sb_U_ix_ices_list,
+    si_sb_U_ix_ices_bysize,
+    pl_sb_U_ix_ices_bysize,
+    pl_sb_U_ix_ices,
+) = make_pl_si_lists(pl_sb_U_ix_ices_list, "ices", 2)
+
+# CLASSICAL "..[ei]x" -> "..ices"
+
+pl_sb_C_ex_ices_list = (
+    "vortex",
+    "vertex",
+    "cortex",
+    "latex",
+    "pontifex",
+    "apex",
+    "index",
+    "simplex",
+)
+
+(
+    si_sb_C_ex_ices_list,
+    si_sb_C_ex_ices_bysize,
+    pl_sb_C_ex_ices_bysize,
+    pl_sb_C_ex_ices,
+) = make_pl_si_lists(pl_sb_C_ex_ices_list, "ices", 2)
+
+
+pl_sb_C_ix_ices_list = ("appendix",)
+
+(
+    si_sb_C_ix_ices_list,
+    si_sb_C_ix_ices_bysize,
+    pl_sb_C_ix_ices_bysize,
+    pl_sb_C_ix_ices,
+) = make_pl_si_lists(pl_sb_C_ix_ices_list, "ices", 2)
+
+
+# ARABIC: ".." -> "..i"
+
+pl_sb_C_i_list = ("afrit", "afreet", "efreet")
+
+(si_sb_C_i_list, si_sb_C_i_bysize, pl_sb_C_i_bysize, pl_sb_C_i) = make_pl_si_lists(
+    pl_sb_C_i_list, "i", None
+)
+
+
+# HEBREW: ".." -> "..im"
+
+pl_sb_C_im_list = ("goy", "seraph", "cherub")
+
+(si_sb_C_im_list, si_sb_C_im_bysize, pl_sb_C_im_bysize, pl_sb_C_im) = make_pl_si_lists(
+    pl_sb_C_im_list, "im", None
+)
+
+
+# UNCONDITIONAL "..man" -> "..mans"
+
+pl_sb_U_man_mans_list = """
+    ataman caiman cayman ceriman
+    desman dolman farman harman hetman
+    human leman ottoman shaman talisman
+""".split()
+pl_sb_U_man_mans_caps_list = """
+    Alabaman Bahaman Burman German
+    Hiroshiman Liman Nakayaman Norman Oklahoman
+    Panaman Roman Selman Sonaman Tacoman Yakiman
+    Yokohaman Yuman
+""".split()
+
+(
+    si_sb_U_man_mans_list,
+    si_sb_U_man_mans_bysize,
+    pl_sb_U_man_mans_bysize,
+) = make_pl_si_lists(pl_sb_U_man_mans_list, "s", None, dojoinstem=False)
+(
+    si_sb_U_man_mans_caps_list,
+    si_sb_U_man_mans_caps_bysize,
+    pl_sb_U_man_mans_caps_bysize,
+) = make_pl_si_lists(pl_sb_U_man_mans_caps_list, "s", None, dojoinstem=False)
+
+# UNCONDITIONAL "..louse" -> "..lice"
+pl_sb_U_louse_lice_list = ("booklouse", "grapelouse", "louse", "woodlouse")
+
+(
+    si_sb_U_louse_lice_list,
+    si_sb_U_louse_lice_bysize,
+    pl_sb_U_louse_lice_bysize,
+) = make_pl_si_lists(pl_sb_U_louse_lice_list, "lice", 5, dojoinstem=False)
+
+pl_sb_uninflected_s_complete = [
+    # PAIRS OR GROUPS SUBSUMED TO A SINGULAR...
+    "breeches",
+    "britches",
+    "pajamas",
+    "pyjamas",
+    "clippers",
+    "gallows",
+    "hijinks",
+    "headquarters",
+    "pliers",
+    "scissors",
+    "testes",
+    "herpes",
+    "pincers",
+    "shears",
+    "proceedings",
+    "trousers",
+    # UNASSIMILATED LATIN 4th DECLENSION
+    "cantus",
+    "coitus",
+    "nexus",
+    # RECENT IMPORTS...
+    "contretemps",
+    "corps",
+    "debris",
+    "siemens",
+    # DISEASES
+    "mumps",
+    # MISCELLANEOUS OTHERS...
+    "diabetes",
+    "jackanapes",
+    "series",
+    "species",
+    "subspecies",
+    "rabies",
+    "chassis",
+    "innings",
+    "news",
+    "mews",
+    "haggis",
+]
+
+pl_sb_uninflected_s_endings = [
+    # RECENT IMPORTS...
+    "ois",
+    # DISEASES
+    "measles",
+]
+
+pl_sb_uninflected_s = pl_sb_uninflected_s_complete + [
+    f".*{w}" for w in pl_sb_uninflected_s_endings
+]
+
+pl_sb_uninflected_herd = (
+    # DON'T INFLECT IN CLASSICAL MODE, OTHERWISE NORMAL INFLECTION
+    "wildebeest",
+    "swine",
+    "eland",
+    "bison",
+    "buffalo",
+    "cattle",
+    "elk",
+    "rhinoceros",
+    "zucchini",
+    "caribou",
+    "dace",
+    "grouse",
+    "guinea fowl",
+    "guinea-fowl",
+    "haddock",
+    "hake",
+    "halibut",
+    "herring",
+    "mackerel",
+    "pickerel",
+    "pike",
+    "roe",
+    "seed",
+    "shad",
+    "snipe",
+    "teal",
+    "turbot",
+    "water fowl",
+    "water-fowl",
+)
+
+pl_sb_uninflected_complete = [
+    # SOME FISH AND HERD ANIMALS
+    "tuna",
+    "salmon",
+    "mackerel",
+    "trout",
+    "bream",
+    "sea-bass",
+    "sea bass",
+    "carp",
+    "cod",
+    "flounder",
+    "whiting",
+    "moose",
+    # OTHER ODDITIES
+    "graffiti",
+    "djinn",
+    "samuri",
+    "offspring",
+    "pence",
+    "quid",
+    "hertz",
+] + pl_sb_uninflected_s_complete
+# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
+
+pl_sb_uninflected_caps = [
+    # ALL NATIONALS ENDING IN -ese
+    "Portuguese",
+    "Amoyese",
+    "Borghese",
+    "Congoese",
+    "Faroese",
+    "Foochowese",
+    "Genevese",
+    "Genoese",
+    "Gilbertese",
+    "Hottentotese",
+    "Kiplingese",
+    "Kongoese",
+    "Lucchese",
+    "Maltese",
+    "Nankingese",
+    "Niasese",
+    "Pekingese",
+    "Piedmontese",
+    "Pistoiese",
+    "Sarawakese",
+    "Shavese",
+    "Vermontese",
+    "Wenchowese",
+    "Yengeese",
+]
+
+
+pl_sb_uninflected_endings = [
+    # UNCOUNTABLE NOUNS
+    "butter",
+    "cash",
+    "furniture",
+    "information",
+    # SOME FISH AND HERD ANIMALS
+    "fish",
+    "deer",
+    "sheep",
+    # ALL NATIONALS ENDING IN -ese
+    "nese",
+    "rese",
+    "lese",
+    "mese",
+    # DISEASES
+    "pox",
+    # OTHER ODDITIES
+    "craft",
+] + pl_sb_uninflected_s_endings
+# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
+
+
+pl_sb_uninflected_bysize = bysize(pl_sb_uninflected_endings)
+
+
+# SINGULAR WORDS ENDING IN ...s (ALL INFLECT WITH ...es)
+
+pl_sb_singular_s_complete = [
+    "acropolis",
+    "aegis",
+    "alias",
+    "asbestos",
+    "bathos",
+    "bias",
+    "bronchitis",
+    "bursitis",
+    "caddis",
+    "cannabis",
+    "canvas",
+    "chaos",
+    "cosmos",
+    "dais",
+    "digitalis",
+    "epidermis",
+    "ethos",
+    "eyas",
+    "gas",
+    "glottis",
+    "hubris",
+    "ibis",
+    "lens",
+    "mantis",
+    "marquis",
+    "metropolis",
+    "pathos",
+    "pelvis",
+    "polis",
+    "rhinoceros",
+    "sassafras",
+    "trellis",
+] + pl_sb_C_is_ides_complete
+
+
+pl_sb_singular_s_endings = ["ss", "us"] + pl_sb_C_is_ides_endings
+
+pl_sb_singular_s_bysize = bysize(pl_sb_singular_s_endings)
+
+si_sb_singular_s_complete = [f"{w}es" for w in pl_sb_singular_s_complete]
+si_sb_singular_s_endings = [f"{w}es" for w in pl_sb_singular_s_endings]
+si_sb_singular_s_bysize = bysize(si_sb_singular_s_endings)
+
+pl_sb_singular_s_es = ["[A-Z].*es"]
+
+pl_sb_singular_s = enclose(
+    "|".join(
+        pl_sb_singular_s_complete
+        + [f".*{w}" for w in pl_sb_singular_s_endings]
+        + pl_sb_singular_s_es
+    )
+)
+
+
+# PLURALS ENDING IN uses -> use
+
+
+si_sb_ois_oi_case = ("Bolshois", "Hanois")
+
+si_sb_uses_use_case = ("Betelgeuses", "Duses", "Meuses", "Syracuses", "Toulouses")
+
+si_sb_uses_use = (
+    "abuses",
+    "applauses",
+    "blouses",
+    "carouses",
+    "causes",
+    "chartreuses",
+    "clauses",
+    "contuses",
+    "douses",
+    "excuses",
+    "fuses",
+    "grouses",
+    "hypotenuses",
+    "masseuses",
+    "menopauses",
+    "misuses",
+    "muses",
+    "overuses",
+    "pauses",
+    "peruses",
+    "profuses",
+    "recluses",
+    "reuses",
+    "ruses",
+    "souses",
+    "spouses",
+    "suffuses",
+    "transfuses",
+    "uses",
+)
+
+si_sb_ies_ie_case = (
+    "Addies",
+    "Aggies",
+    "Allies",
+    "Amies",
+    "Angies",
+    "Annies",
+    "Annmaries",
+    "Archies",
+    "Arties",
+    "Aussies",
+    "Barbies",
+    "Barries",
+    "Basies",
+    "Bennies",
+    "Bernies",
+    "Berties",
+    "Bessies",
+    "Betties",
+    "Billies",
+    "Blondies",
+    "Bobbies",
+    "Bonnies",
+    "Bowies",
+    "Brandies",
+    "Bries",
+    "Brownies",
+    "Callies",
+    "Carnegies",
+    "Carries",
+    "Cassies",
+    "Charlies",
+    "Cheries",
+    "Christies",
+    "Connies",
+    "Curies",
+    "Dannies",
+    "Debbies",
+    "Dixies",
+    "Dollies",
+    "Donnies",
+    "Drambuies",
+    "Eddies",
+    "Effies",
+    "Ellies",
+    "Elsies",
+    "Eries",
+    "Ernies",
+    "Essies",
+    "Eugenies",
+    "Fannies",
+    "Flossies",
+    "Frankies",
+    "Freddies",
+    "Gillespies",
+    "Goldies",
+    "Gracies",
+    "Guthries",
+    "Hallies",
+    "Hatties",
+    "Hetties",
+    "Hollies",
+    "Jackies",
+    "Jamies",
+    "Janies",
+    "Jannies",
+    "Jeanies",
+    "Jeannies",
+    "Jennies",
+    "Jessies",
+    "Jimmies",
+    "Jodies",
+    "Johnies",
+    "Johnnies",
+    "Josies",
+    "Julies",
+    "Kalgoorlies",
+    "Kathies",
+    "Katies",
+    "Kellies",
+    "Kewpies",
+    "Kristies",
+    "Laramies",
+    "Lassies",
+    "Lauries",
+    "Leslies",
+    "Lessies",
+    "Lillies",
+    "Lizzies",
+    "Lonnies",
+    "Lories",
+    "Lorries",
+    "Lotties",
+    "Louies",
+    "Mackenzies",
+    "Maggies",
+    "Maisies",
+    "Mamies",
+    "Marcies",
+    "Margies",
+    "Maries",
+    "Marjories",
+    "Matties",
+    "McKenzies",
+    "Melanies",
+    "Mickies",
+    "Millies",
+    "Minnies",
+    "Mollies",
+    "Mounties",
+    "Nannies",
+    "Natalies",
+    "Nellies",
+    "Netties",
+    "Ollies",
+    "Ozzies",
+    "Pearlies",
+    "Pottawatomies",
+    "Reggies",
+    "Richies",
+    "Rickies",
+    "Robbies",
+    "Ronnies",
+    "Rosalies",
+    "Rosemaries",
+    "Rosies",
+    "Roxies",
+    "Rushdies",
+    "Ruthies",
+    "Sadies",
+    "Sallies",
+    "Sammies",
+    "Scotties",
+    "Selassies",
+    "Sherries",
+    "Sophies",
+    "Stacies",
+    "Stefanies",
+    "Stephanies",
+    "Stevies",
+    "Susies",
+    "Sylvies",
+    "Tammies",
+    "Terries",
+    "Tessies",
+    "Tommies",
+    "Tracies",
+    "Trekkies",
+    "Valaries",
+    "Valeries",
+    "Valkyries",
+    "Vickies",
+    "Virgies",
+    "Willies",
+    "Winnies",
+    "Wylies",
+    "Yorkies",
+)
+
+si_sb_ies_ie = (
+    "aeries",
+    "baggies",
+    "belies",
+    "biggies",
+    "birdies",
+    "bogies",
+    "bonnies",
+    "boogies",
+    "bookies",
+    "bourgeoisies",
+    "brownies",
+    "budgies",
+    "caddies",
+    "calories",
+    "camaraderies",
+    "cockamamies",
+    "collies",
+    "cookies",
+    "coolies",
+    "cooties",
+    "coteries",
+    "crappies",
+    "curies",
+    "cutesies",
+    "dogies",
+    "eyries",
+    "floozies",
+    "footsies",
+    "freebies",
+    "genies",
+    "goalies",
+    "groupies",
+    "hies",
+    "jalousies",
+    "junkies",
+    "kiddies",
+    "laddies",
+    "lassies",
+    "lies",
+    "lingeries",
+    "magpies",
+    "menageries",
+    "mommies",
+    "movies",
+    "neckties",
+    "newbies",
+    "nighties",
+    "oldies",
+    "organdies",
+    "overlies",
+    "pies",
+    "pinkies",
+    "pixies",
+    "potpies",
+    "prairies",
+    "quickies",
+    "reveries",
+    "rookies",
+    "rotisseries",
+    "softies",
+    "sorties",
+    "species",
+    "stymies",
+    "sweeties",
+    "ties",
+    "underlies",
+    "unties",
+    "veggies",
+    "vies",
+    "yuppies",
+    "zombies",
+)
+
+
+si_sb_oes_oe_case = (
+    "Chloes",
+    "Crusoes",
+    "Defoes",
+    "Faeroes",
+    "Ivanhoes",
+    "Joes",
+    "McEnroes",
+    "Moes",
+    "Monroes",
+    "Noes",
+    "Poes",
+    "Roscoes",
+    "Tahoes",
+    "Tippecanoes",
+    "Zoes",
+)
+
+si_sb_oes_oe = (
+    "aloes",
+    "backhoes",
+    "canoes",
+    "does",
+    "floes",
+    "foes",
+    "hoes",
+    "mistletoes",
+    "oboes",
+    "pekoes",
+    "roes",
+    "sloes",
+    "throes",
+    "tiptoes",
+    "toes",
+    "woes",
+)
+
+si_sb_z_zes = ("quartzes", "topazes")
+
+si_sb_zzes_zz = ("buzzes", "fizzes", "frizzes", "razzes")
+
+si_sb_ches_che_case = (
+    "Andromaches",
+    "Apaches",
+    "Blanches",
+    "Comanches",
+    "Nietzsches",
+    "Porsches",
+    "Roches",
+)
+
+si_sb_ches_che = (
+    "aches",
+    "avalanches",
+    "backaches",
+    "bellyaches",
+    "caches",
+    "cloches",
+    "creches",
+    "douches",
+    "earaches",
+    "fiches",
+    "headaches",
+    "heartaches",
+    "microfiches",
+    "niches",
+    "pastiches",
+    "psyches",
+    "quiches",
+    "stomachaches",
+    "toothaches",
+    "tranches",
+)
+
+si_sb_xes_xe = ("annexes", "axes", "deluxes", "pickaxes")
+
+si_sb_sses_sse_case = ("Hesses", "Jesses", "Larousses", "Matisses")
+si_sb_sses_sse = (
+    "bouillabaisses",
+    "crevasses",
+    "demitasses",
+    "impasses",
+    "mousses",
+    "posses",
+)
+
+si_sb_ves_ve_case = (
+    # *[nwl]ives -> [nwl]live
+    "Clives",
+    "Palmolives",
+)
+si_sb_ves_ve = (
+    # *[^d]eaves -> eave
+    "interweaves",
+    "weaves",
+    # *[nwl]ives -> [nwl]live
+    "olives",
+    # *[eoa]lves -> [eoa]lve
+    "bivalves",
+    "dissolves",
+    "resolves",
+    "salves",
+    "twelves",
+    "valves",
+)
+
+
+plverb_special_s = enclose(
+    "|".join(
+        [pl_sb_singular_s]
+        + pl_sb_uninflected_s
+        + list(pl_sb_irregular_s)
+        + ["(.*[csx])is", "(.*)ceps", "[A-Z].*s"]
+    )
+)
+
+_pl_sb_postfix_adj_defn = (
+    ("general", enclose(r"(?!major|lieutenant|brigadier|adjutant|.*star)\S+")),
+    ("martial", enclose("court")),
+    ("force", enclose("pound")),
+)
+
+pl_sb_postfix_adj: Iterable[str] = (
+    enclose(val + f"(?=(?:-|\\s+){key})") for key, val in _pl_sb_postfix_adj_defn
+)
+
+pl_sb_postfix_adj_stems = f"({'|'.join(pl_sb_postfix_adj)})(.*)"
+
+
+# PLURAL WORDS ENDING IS es GO TO SINGULAR is
+
+si_sb_es_is = (
+    "amanuenses",
+    "amniocenteses",
+    "analyses",
+    "antitheses",
+    "apotheoses",
+    "arterioscleroses",
+    "atheroscleroses",
+    "axes",
+    # 'bases', # bases -> basis
+    "catalyses",
+    "catharses",
+    "chasses",
+    "cirrhoses",
+    "cocces",
+    "crises",
+    "diagnoses",
+    "dialyses",
+    "diereses",
+    "electrolyses",
+    "emphases",
+    "exegeses",
+    "geneses",
+    "halitoses",
+    "hydrolyses",
+    "hypnoses",
+    "hypotheses",
+    "hystereses",
+    "metamorphoses",
+    "metastases",
+    "misdiagnoses",
+    "mitoses",
+    "mononucleoses",
+    "narcoses",
+    "necroses",
+    "nemeses",
+    "neuroses",
+    "oases",
+    "osmoses",
+    "osteoporoses",
+    "paralyses",
+    "parentheses",
+    "parthenogeneses",
+    "periphrases",
+    "photosyntheses",
+    "probosces",
+    "prognoses",
+    "prophylaxes",
+    "prostheses",
+    "preces",
+    "psoriases",
+    "psychoanalyses",
+    "psychokineses",
+    "psychoses",
+    "scleroses",
+    "scolioses",
+    "sepses",
+    "silicoses",
+    "symbioses",
+    "synopses",
+    "syntheses",
+    "taxes",
+    "telekineses",
+    "theses",
+    "thromboses",
+    "tuberculoses",
+    "urinalyses",
+)
+
+pl_prep_list = """
+    about above across after among around at athwart before behind
+    below beneath beside besides between betwixt beyond but by
+    during except for from in into near of off on onto out over
+    since till to under until unto upon with""".split()
+
+pl_prep_list_da = pl_prep_list + ["de", "du", "da"]
+
+pl_prep_bysize = bysize(pl_prep_list_da)
+
+pl_prep = enclose("|".join(pl_prep_list_da))
+
+pl_sb_prep_dual_compound = rf"(.*?)((?:-|\s+)(?:{pl_prep})(?:-|\s+))a(?:-|\s+)(.*)"
+
+
+singular_pronoun_genders = {
+    "neuter",
+    "feminine",
+    "masculine",
+    "gender-neutral",
+    "feminine or masculine",
+    "masculine or feminine",
+}
+
+pl_pron_nom = {
+    # NOMINATIVE    REFLEXIVE
+    "i": "we",
+    "myself": "ourselves",
+    "you": "you",
+    "yourself": "yourselves",
+    "she": "they",
+    "herself": "themselves",
+    "he": "they",
+    "himself": "themselves",
+    "it": "they",
+    "itself": "themselves",
+    "they": "they",
+    "themself": "themselves",
+    #   POSSESSIVE
+    "mine": "ours",
+    "yours": "yours",
+    "hers": "theirs",
+    "his": "theirs",
+    "its": "theirs",
+    "theirs": "theirs",
+}
+
+si_pron: Dict[str, Dict[str, Union[str, Dict[str, str]]]] = {
+    "nom": {v: k for (k, v) in pl_pron_nom.items()}
+}
+si_pron["nom"]["we"] = "I"
+
+
+pl_pron_acc = {
+    # ACCUSATIVE    REFLEXIVE
+    "me": "us",
+    "myself": "ourselves",
+    "you": "you",
+    "yourself": "yourselves",
+    "her": "them",
+    "herself": "themselves",
+    "him": "them",
+    "himself": "themselves",
+    "it": "them",
+    "itself": "themselves",
+    "them": "them",
+    "themself": "themselves",
+}
+
+pl_pron_acc_keys = enclose("|".join(pl_pron_acc))
+pl_pron_acc_keys_bysize = bysize(pl_pron_acc)
+
+si_pron["acc"] = {v: k for (k, v) in pl_pron_acc.items()}
+
+for _thecase, _plur, _gend, _sing in (
+    ("nom", "they", "neuter", "it"),
+    ("nom", "they", "feminine", "she"),
+    ("nom", "they", "masculine", "he"),
+    ("nom", "they", "gender-neutral", "they"),
+    ("nom", "they", "feminine or masculine", "she or he"),
+    ("nom", "they", "masculine or feminine", "he or she"),
+    ("nom", "themselves", "neuter", "itself"),
+    ("nom", "themselves", "feminine", "herself"),
+    ("nom", "themselves", "masculine", "himself"),
+    ("nom", "themselves", "gender-neutral", "themself"),
+    ("nom", "themselves", "feminine or masculine", "herself or himself"),
+    ("nom", "themselves", "masculine or feminine", "himself or herself"),
+    ("nom", "theirs", "neuter", "its"),
+    ("nom", "theirs", "feminine", "hers"),
+    ("nom", "theirs", "masculine", "his"),
+    ("nom", "theirs", "gender-neutral", "theirs"),
+    ("nom", "theirs", "feminine or masculine", "hers or his"),
+    ("nom", "theirs", "masculine or feminine", "his or hers"),
+    ("acc", "them", "neuter", "it"),
+    ("acc", "them", "feminine", "her"),
+    ("acc", "them", "masculine", "him"),
+    ("acc", "them", "gender-neutral", "them"),
+    ("acc", "them", "feminine or masculine", "her or him"),
+    ("acc", "them", "masculine or feminine", "him or her"),
+    ("acc", "themselves", "neuter", "itself"),
+    ("acc", "themselves", "feminine", "herself"),
+    ("acc", "themselves", "masculine", "himself"),
+    ("acc", "themselves", "gender-neutral", "themself"),
+    ("acc", "themselves", "feminine or masculine", "herself or himself"),
+    ("acc", "themselves", "masculine or feminine", "himself or herself"),
+):
+    try:
+        si_pron[_thecase][_plur][_gend] = _sing  # type: ignore
+    except TypeError:
+        si_pron[_thecase][_plur] = {}
+        si_pron[_thecase][_plur][_gend] = _sing  # type: ignore
+
+
+si_pron_acc_keys = enclose("|".join(si_pron["acc"]))
+si_pron_acc_keys_bysize = bysize(si_pron["acc"])
+
+
+def get_si_pron(thecase, word, gender) -> str:
+    try:
+        sing = si_pron[thecase][word]
+    except KeyError:
+        raise  # not a pronoun
+    try:
+        return sing[gender]  # has several types due to gender
+    except TypeError:
+        return cast(str, sing)  # answer independent of gender
+
+
+# These dictionaries group verbs by first, second and third person
+# conjugations.
+
+plverb_irregular_pres = {
+    "am": "are",
+    "are": "are",
+    "is": "are",
+    "was": "were",
+    "were": "were",
+    "have": "have",
+    "has": "have",
+    "do": "do",
+    "does": "do",
+}
+
+plverb_ambiguous_pres = {
+    "act": "act",
+    "acts": "act",
+    "blame": "blame",
+    "blames": "blame",
+    "can": "can",
+    "must": "must",
+    "fly": "fly",
+    "flies": "fly",
+    "copy": "copy",
+    "copies": "copy",
+    "drink": "drink",
+    "drinks": "drink",
+    "fight": "fight",
+    "fights": "fight",
+    "fire": "fire",
+    "fires": "fire",
+    "like": "like",
+    "likes": "like",
+    "look": "look",
+    "looks": "look",
+    "make": "make",
+    "makes": "make",
+    "reach": "reach",
+    "reaches": "reach",
+    "run": "run",
+    "runs": "run",
+    "sink": "sink",
+    "sinks": "sink",
+    "sleep": "sleep",
+    "sleeps": "sleep",
+    "view": "view",
+    "views": "view",
+}
+
+plverb_ambiguous_pres_keys = re.compile(
+    rf"^({enclose('|'.join(plverb_ambiguous_pres))})((\s.*)?)$", re.IGNORECASE
+)
+
+
+plverb_irregular_non_pres = (
+    "did",
+    "had",
+    "ate",
+    "made",
+    "put",
+    "spent",
+    "fought",
+    "sank",
+    "gave",
+    "sought",
+    "shall",
+    "could",
+    "ought",
+    "should",
+)
+
+plverb_ambiguous_non_pres = re.compile(
+    r"^((?:thought|saw|bent|will|might|cut))((\s.*)?)$", re.IGNORECASE
+)
+
+# "..oes" -> "..oe" (the rest are "..oes" -> "o")
+
+pl_v_oes_oe = ("canoes", "floes", "oboes", "roes", "throes", "woes")
+pl_v_oes_oe_endings_size4 = ("hoes", "toes")
+pl_v_oes_oe_endings_size5 = ("shoes",)
+
+
+pl_count_zero = ("0", "no", "zero", "nil")
+
+
+pl_count_one = ("1", "a", "an", "one", "each", "every", "this", "that")
+
+pl_adj_special = {"a": "some", "an": "some", "this": "these", "that": "those"}
+
+pl_adj_special_keys = re.compile(
+    rf"^({enclose('|'.join(pl_adj_special))})$", re.IGNORECASE
+)
+
+pl_adj_poss = {
+    "my": "our",
+    "your": "your",
+    "its": "their",
+    "her": "their",
+    "his": "their",
+    "their": "their",
+}
+
+pl_adj_poss_keys = re.compile(rf"^({enclose('|'.join(pl_adj_poss))})$", re.IGNORECASE)
+
+
+# 2. INDEFINITE ARTICLES
+
+# THIS PATTERN MATCHES STRINGS OF CAPITALS STARTING WITH A "VOWEL-SOUND"
+# CONSONANT FOLLOWED BY ANOTHER CONSONANT, AND WHICH ARE NOT LIKELY
+# TO BE REAL WORDS (OH, ALL RIGHT THEN, IT'S JUST MAGIC!)
+
+A_abbrev = re.compile(
+    r"""
+^(?! FJO | [HLMNS]Y.  | RY[EO] | SQU
+  | ( F[LR]? | [HL] | MN? | N | RH? | S[CHKLMNPTVW]? | X(YL)?) [AEIOU])
+[FHLMNRSX][A-Z]
+""",
+    re.VERBOSE,
+)
+
+# THIS PATTERN CODES THE BEGINNINGS OF ALL ENGLISH WORDS BEGINING WITH A
+# 'y' FOLLOWED BY A CONSONANT. ANY OTHER Y-CONSONANT PREFIX THEREFORE
+# IMPLIES AN ABBREVIATION.
+
+A_y_cons = re.compile(r"^(y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt))", re.IGNORECASE)
+
+# EXCEPTIONS TO EXCEPTIONS
+
+A_explicit_a = re.compile(r"^((?:unabomber|unanimous|US))", re.IGNORECASE)
+
+A_explicit_an = re.compile(
+    r"^((?:euler|hour(?!i)|heir|honest|hono[ur]|mpeg))", re.IGNORECASE
+)
+
+A_ordinal_an = re.compile(r"^([aefhilmnorsx]-?th)", re.IGNORECASE)
+
+A_ordinal_a = re.compile(r"^([bcdgjkpqtuvwyz]-?th)", re.IGNORECASE)
+
+
+# NUMERICAL INFLECTIONS
+
+nth = {
+    0: "th",
+    1: "st",
+    2: "nd",
+    3: "rd",
+    4: "th",
+    5: "th",
+    6: "th",
+    7: "th",
+    8: "th",
+    9: "th",
+    11: "th",
+    12: "th",
+    13: "th",
+}
+nth_suff = set(nth.values())
+
+ordinal = dict(
+    ty="tieth",
+    one="first",
+    two="second",
+    three="third",
+    five="fifth",
+    eight="eighth",
+    nine="ninth",
+    twelve="twelfth",
+)
+
+ordinal_suff = re.compile(rf"({'|'.join(ordinal)})\Z")
+
+
+# NUMBERS
+
+unit = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
+teen = [
+    "ten",
+    "eleven",
+    "twelve",
+    "thirteen",
+    "fourteen",
+    "fifteen",
+    "sixteen",
+    "seventeen",
+    "eighteen",
+    "nineteen",
+]
+ten = [
+    "",
+    "",
+    "twenty",
+    "thirty",
+    "forty",
+    "fifty",
+    "sixty",
+    "seventy",
+    "eighty",
+    "ninety",
+]
+mill = [
+    " ",
+    " thousand",
+    " million",
+    " billion",
+    " trillion",
+    " quadrillion",
+    " quintillion",
+    " sextillion",
+    " septillion",
+    " octillion",
+    " nonillion",
+    " decillion",
+]
+
+
+# SUPPORT CLASSICAL PLURALIZATIONS
+
+def_classical = dict(
+    all=False, zero=False, herd=False, names=True, persons=False, ancient=False
+)
+
+all_classical = {k: True for k in def_classical}
+no_classical = {k: False for k in def_classical}
+
+
+# Maps strings to built-in constant types
+string_to_constant = {"True": True, "False": False, "None": None}
+
+
+# Pre-compiled regular expression objects
+DOLLAR_DIGITS = re.compile(r"\$(\d+)")
+FUNCTION_CALL = re.compile(r"((\w+)\([^)]*\)*)", re.IGNORECASE)
+PARTITION_WORD = re.compile(r"\A(\s*)(.+?)(\s*)\Z")
+PL_SB_POSTFIX_ADJ_STEMS_RE = re.compile(
+    rf"^(?:{pl_sb_postfix_adj_stems})$", re.IGNORECASE
+)
+PL_SB_PREP_DUAL_COMPOUND_RE = re.compile(
+    rf"^(?:{pl_sb_prep_dual_compound})$", re.IGNORECASE
+)
+DENOMINATOR = re.compile(r"(?P.+)( (per|a) .+)")
+PLVERB_SPECIAL_S_RE = re.compile(rf"^({plverb_special_s})$")
+WHITESPACE = re.compile(r"\s")
+ENDS_WITH_S = re.compile(r"^(.*[^s])s$", re.IGNORECASE)
+ENDS_WITH_APOSTROPHE_S = re.compile(r"^(.*)'s?$")
+INDEFINITE_ARTICLE_TEST = re.compile(r"\A(\s*)(?:an?\s+)?(.+?)(\s*)\Z", re.IGNORECASE)
+SPECIAL_AN = re.compile(r"^[aefhilmnorsx]$", re.IGNORECASE)
+SPECIAL_A = re.compile(r"^[bcdgjkpqtuvwyz]$", re.IGNORECASE)
+SPECIAL_ABBREV_AN = re.compile(r"^[aefhilmnorsx][.-]", re.IGNORECASE)
+SPECIAL_ABBREV_A = re.compile(r"^[a-z][.-]", re.IGNORECASE)
+CONSONANTS = re.compile(r"^[^aeiouy]", re.IGNORECASE)
+ARTICLE_SPECIAL_EU = re.compile(r"^e[uw]", re.IGNORECASE)
+ARTICLE_SPECIAL_ONCE = re.compile(r"^onc?e\b", re.IGNORECASE)
+ARTICLE_SPECIAL_ONETIME = re.compile(r"^onetime\b", re.IGNORECASE)
+ARTICLE_SPECIAL_UNIT = re.compile(r"^uni([^nmd]|mo)", re.IGNORECASE)
+ARTICLE_SPECIAL_UBA = re.compile(r"^u[bcfghjkqrst][aeiou]", re.IGNORECASE)
+ARTICLE_SPECIAL_UKR = re.compile(r"^ukr", re.IGNORECASE)
+SPECIAL_CAPITALS = re.compile(r"^U[NK][AIEO]?")
+VOWELS = re.compile(r"^[aeiou]", re.IGNORECASE)
+
+DIGIT_GROUP = re.compile(r"(\d)")
+TWO_DIGITS = re.compile(r"(\d)(\d)")
+THREE_DIGITS = re.compile(r"(\d)(\d)(\d)")
+THREE_DIGITS_WORD = re.compile(r"(\d)(\d)(\d)(?=\D*\Z)")
+TWO_DIGITS_WORD = re.compile(r"(\d)(\d)(?=\D*\Z)")
+ONE_DIGIT_WORD = re.compile(r"(\d)(?=\D*\Z)")
+
+FOUR_DIGIT_COMMA = re.compile(r"(\d)(\d{3}(?:,|\Z))")
+NON_DIGIT = re.compile(r"\D")
+WHITESPACES_COMMA = re.compile(r"\s+,")
+COMMA_WORD = re.compile(r", (\S+)\s+\Z")
+WHITESPACES = re.compile(r"\s+")
+
+
+PRESENT_PARTICIPLE_REPLACEMENTS = (
+    (re.compile(r"ie$"), r"y"),
+    (
+        re.compile(r"ue$"),
+        r"u",
+    ),  # TODO: isn't ue$ -> u encompassed in the following rule?
+    (re.compile(r"([auy])e$"), r"\g<1>"),
+    (re.compile(r"ski$"), r"ski"),
+    (re.compile(r"[^b]i$"), r""),
+    (re.compile(r"^(are|were)$"), r"be"),
+    (re.compile(r"^(had)$"), r"hav"),
+    (re.compile(r"^(hoe)$"), r"\g<1>"),
+    (re.compile(r"([^e])e$"), r"\g<1>"),
+    (re.compile(r"er$"), r"er"),
+    (re.compile(r"([^aeiou][aeiouy]([bdgmnprst]))$"), r"\g<1>\g<2>"),
+)
+
+DIGIT = re.compile(r"\d")
+
+
+class Words(str):
+    lowered: str
+    split_: List[str]
+    first: str
+    last: str
+
+    def __init__(self, orig) -> None:
+        self.lowered = self.lower()
+        self.split_ = self.split()
+        self.first = self.split_[0]
+        self.last = self.split_[-1]
+
+
+Falsish = Any  # ideally, falsish would only validate on bool(value) is False
+
+
+_STATIC_TYPE_CHECKING = TYPE_CHECKING
+# ^-- Workaround for typeguard AST manipulation:
+#     https://github.com/agronholm/typeguard/issues/353#issuecomment-1556306554
+
+if _STATIC_TYPE_CHECKING:  # pragma: no cover
+    Word = Annotated[str, "String with at least 1 character"]
+else:
+
+    class _WordMeta(type):  # Too dynamic to be supported by mypy...
+        def __instancecheck__(self, instance: Any) -> bool:
+            return isinstance(instance, str) and len(instance) >= 1
+
+    class Word(metaclass=_WordMeta):  # type: ignore[no-redef]
+        """String with at least 1 character"""
+
+
+class engine:
+    def __init__(self) -> None:
+        self.classical_dict = def_classical.copy()
+        self.persistent_count: Optional[int] = None
+        self.mill_count = 0
+        self.pl_sb_user_defined: List[Optional[Word]] = []
+        self.pl_v_user_defined: List[Optional[Word]] = []
+        self.pl_adj_user_defined: List[Optional[Word]] = []
+        self.si_sb_user_defined: List[Optional[Word]] = []
+        self.A_a_user_defined: List[Optional[Word]] = []
+        self.thegender = "neuter"
+        self.__number_args: Optional[Dict[str, str]] = None
+
+    @property
+    def _number_args(self):
+        return cast(Dict[str, str], self.__number_args)
+
+    @_number_args.setter
+    def _number_args(self, val):
+        self.__number_args = val
+
+    @typechecked
+    def defnoun(self, singular: Optional[Word], plural: Optional[Word]) -> int:
+        """
+        Set the noun plural of singular to plural.
+
+        """
+        self.checkpat(singular)
+        self.checkpatplural(plural)
+        self.pl_sb_user_defined.extend((singular, plural))
+        self.si_sb_user_defined.extend((plural, singular))
+        return 1
+
+    @typechecked
+    def defverb(
+        self,
+        s1: Optional[Word],
+        p1: Optional[Word],
+        s2: Optional[Word],
+        p2: Optional[Word],
+        s3: Optional[Word],
+        p3: Optional[Word],
+    ) -> int:
+        """
+        Set the verb plurals for s1, s2 and s3 to p1, p2 and p3 respectively.
+
+        Where 1, 2 and 3 represent the 1st, 2nd and 3rd person forms of the verb.
+
+        """
+        self.checkpat(s1)
+        self.checkpat(s2)
+        self.checkpat(s3)
+        self.checkpatplural(p1)
+        self.checkpatplural(p2)
+        self.checkpatplural(p3)
+        self.pl_v_user_defined.extend((s1, p1, s2, p2, s3, p3))
+        return 1
+
+    @typechecked
+    def defadj(self, singular: Optional[Word], plural: Optional[Word]) -> int:
+        """
+        Set the adjective plural of singular to plural.
+
+        """
+        self.checkpat(singular)
+        self.checkpatplural(plural)
+        self.pl_adj_user_defined.extend((singular, plural))
+        return 1
+
+    @typechecked
+    def defa(self, pattern: Optional[Word]) -> int:
+        """
+        Define the indefinite article as 'a' for words matching pattern.
+
+        """
+        self.checkpat(pattern)
+        self.A_a_user_defined.extend((pattern, "a"))
+        return 1
+
+    @typechecked
+    def defan(self, pattern: Optional[Word]) -> int:
+        """
+        Define the indefinite article as 'an' for words matching pattern.
+
+        """
+        self.checkpat(pattern)
+        self.A_a_user_defined.extend((pattern, "an"))
+        return 1
+
+    def checkpat(self, pattern: Optional[Word]) -> None:
+        """
+        check for errors in a regex pattern
+        """
+        if pattern is None:
+            return
+        try:
+            re.match(pattern, "")
+        except re.error as err:
+            raise BadUserDefinedPatternError(pattern) from err
+
+    def checkpatplural(self, pattern: Optional[Word]) -> None:
+        """
+        check for errors in a regex replace pattern
+        """
+        return
+
+    @typechecked
+    def ud_match(self, word: Word, wordlist: Sequence[Optional[Word]]) -> Optional[str]:
+        for i in range(len(wordlist) - 2, -2, -2):  # backwards through even elements
+            mo = re.search(rf"^{wordlist[i]}$", word, re.IGNORECASE)
+            if mo:
+                if wordlist[i + 1] is None:
+                    return None
+                pl = DOLLAR_DIGITS.sub(
+                    r"\\1", cast(Word, wordlist[i + 1])
+                )  # change $n to \n for expand
+                return mo.expand(pl)
+        return None
+
+    def classical(self, **kwargs) -> None:
+        """
+        turn classical mode on and off for various categories
+
+        turn on all classical modes:
+        classical()
+        classical(all=True)
+
+        turn on or off specific claassical modes:
+        e.g.
+        classical(herd=True)
+        classical(names=False)
+
+        By default all classical modes are off except names.
+
+        unknown value in args or key in kwargs raises
+        exception: UnknownClasicalModeError
+
+        """
+        if not kwargs:
+            self.classical_dict = all_classical.copy()
+            return
+        if "all" in kwargs:
+            if kwargs["all"]:
+                self.classical_dict = all_classical.copy()
+            else:
+                self.classical_dict = no_classical.copy()
+
+        for k, v in kwargs.items():
+            if k in def_classical:
+                self.classical_dict[k] = v
+            else:
+                raise UnknownClassicalModeError
+
+    def num(
+        self, count: Optional[int] = None, show: Optional[int] = None
+    ) -> str:  # (;$count,$show)
+        """
+        Set the number to be used in other method calls.
+
+        Returns count.
+
+        Set show to False to return '' instead.
+
+        """
+        if count is not None:
+            try:
+                self.persistent_count = int(count)
+            except ValueError as err:
+                raise BadNumValueError from err
+            if (show is None) or show:
+                return str(count)
+        else:
+            self.persistent_count = None
+        return ""
+
+    def gender(self, gender: str) -> None:
+        """
+        set the gender for the singular of plural pronouns
+
+        can be one of:
+        'neuter'                ('they' -> 'it')
+        'feminine'              ('they' -> 'she')
+        'masculine'             ('they' -> 'he')
+        'gender-neutral'        ('they' -> 'they')
+        'feminine or masculine' ('they' -> 'she or he')
+        'masculine or feminine' ('they' -> 'he or she')
+        """
+        if gender in singular_pronoun_genders:
+            self.thegender = gender
+        else:
+            raise BadGenderError
+
+    def _get_value_from_ast(self, obj):
+        """
+        Return the value of the ast object.
+        """
+        if isinstance(obj, ast.Num):
+            return obj.n
+        elif isinstance(obj, ast.Str):
+            return obj.s
+        elif isinstance(obj, ast.List):
+            return [self._get_value_from_ast(e) for e in obj.elts]
+        elif isinstance(obj, ast.Tuple):
+            return tuple([self._get_value_from_ast(e) for e in obj.elts])
+
+        # None, True and False are NameConstants in Py3.4 and above.
+        elif isinstance(obj, ast.NameConstant):
+            return obj.value
+
+        # Probably passed a variable name.
+        # Or passed a single word without wrapping it in quotes as an argument
+        # ex: p.inflect("I plural(see)") instead of p.inflect("I plural('see')")
+        raise NameError(f"name '{obj.id}' is not defined")
+
+    def _string_to_substitute(
+        self, mo: Match, methods_dict: Dict[str, Callable]
+    ) -> str:
+        """
+        Return the string to be substituted for the match.
+        """
+        matched_text, f_name = mo.groups()
+        # matched_text is the complete match string. e.g. plural_noun(cat)
+        # f_name is the function name. e.g. plural_noun
+
+        # Return matched_text if function name is not in methods_dict
+        if f_name not in methods_dict:
+            return matched_text
+
+        # Parse the matched text
+        a_tree = ast.parse(matched_text)
+
+        # get the args and kwargs from ast objects
+        args_list = [
+            self._get_value_from_ast(a)
+            for a in a_tree.body[0].value.args  # type: ignore[attr-defined]
+        ]
+        kwargs_list = {
+            kw.arg: self._get_value_from_ast(kw.value)
+            for kw in a_tree.body[0].value.keywords  # type: ignore[attr-defined]
+        }
+
+        # Call the corresponding function
+        return methods_dict[f_name](*args_list, **kwargs_list)
+
+    # 0. PERFORM GENERAL INFLECTIONS IN A STRING
+
+    @typechecked
+    def inflect(self, text: Word) -> str:
+        """
+        Perform inflections in a string.
+
+        e.g. inflect('The plural of cat is plural(cat)') returns
+        'The plural of cat is cats'
+
+        can use plural, plural_noun, plural_verb, plural_adj,
+        singular_noun, a, an, no, ordinal, number_to_words,
+        and prespart
+
+        """
+        save_persistent_count = self.persistent_count
+
+        # Dictionary of allowed methods
+        methods_dict: Dict[str, Callable] = {
+            "plural": self.plural,
+            "plural_adj": self.plural_adj,
+            "plural_noun": self.plural_noun,
+            "plural_verb": self.plural_verb,
+            "singular_noun": self.singular_noun,
+            "a": self.a,
+            "an": self.a,
+            "no": self.no,
+            "ordinal": self.ordinal,
+            "number_to_words": self.number_to_words,
+            "present_participle": self.present_participle,
+            "num": self.num,
+        }
+
+        # Regular expression to find Python's function call syntax
+        output = FUNCTION_CALL.sub(
+            lambda mo: self._string_to_substitute(mo, methods_dict), text
+        )
+        self.persistent_count = save_persistent_count
+        return output
+
+    # ## PLURAL SUBROUTINES
+
+    def postprocess(self, orig: str, inflected) -> str:
+        inflected = str(inflected)
+        if "|" in inflected:
+            word_options = inflected.split("|")
+            # When two parts of a noun need to be pluralized
+            if len(word_options[0].split(" ")) == len(word_options[1].split(" ")):
+                result = inflected.split("|")[self.classical_dict["all"]].split(" ")
+            # When only the last part of the noun needs to be pluralized
+            else:
+                result = inflected.split(" ")
+                for index, word in enumerate(result):
+                    if "|" in word:
+                        result[index] = word.split("|")[self.classical_dict["all"]]
+        else:
+            result = inflected.split(" ")
+
+        # Try to fix word wise capitalization
+        for index, word in enumerate(orig.split(" ")):
+            if word == "I":
+                # Is this the only word for exceptions like this
+                # Where the original is fully capitalized
+                # without 'meaning' capitalization?
+                # Also this fails to handle a capitalizaion in context
+                continue
+            if word.capitalize() == word:
+                result[index] = result[index].capitalize()
+            if word == word.upper():
+                result[index] = result[index].upper()
+        return " ".join(result)
+
+    def partition_word(self, text: str) -> Tuple[str, str, str]:
+        mo = PARTITION_WORD.search(text)
+        if mo:
+            return mo.group(1), mo.group(2), mo.group(3)
+        else:
+            return "", "", ""
+
+    @typechecked
+    def plural(self, text: Word, count: Optional[Union[str, int, Any]] = None) -> str:
+        """
+        Return the plural of text.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(
+            word,
+            self._pl_special_adjective(word, count)
+            or self._pl_special_verb(word, count)
+            or self._plnoun(word, count),
+        )
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def plural_noun(
+        self, text: Word, count: Optional[Union[str, int, Any]] = None
+    ) -> str:
+        """
+        Return the plural of text, where text is a noun.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(word, self._plnoun(word, count))
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def plural_verb(
+        self, text: Word, count: Optional[Union[str, int, Any]] = None
+    ) -> str:
+        """
+        Return the plural of text, where text is a verb.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(
+            word,
+            self._pl_special_verb(word, count) or self._pl_general_verb(word, count),
+        )
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def plural_adj(
+        self, text: Word, count: Optional[Union[str, int, Any]] = None
+    ) -> str:
+        """
+        Return the plural of text, where text is an adjective.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(word, self._pl_special_adjective(word, count) or word)
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def compare(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        >>> compare = engine().compare
+        >>> compare("egg", "eggs")
+        's:p'
+        >>> compare('egg', 'egg')
+        'eq'
+
+        Words should not be empty.
+
+        >>> compare('egg', '')
+        Traceback (most recent call last):
+        ...
+        typeguard.TypeCheckError:...is not an instance of inflect.Word
+        """
+        norms = self.plural_noun, self.plural_verb, self.plural_adj
+        results = (self._plequal(word1, word2, norm) for norm in norms)
+        return next(filter(None, results), False)
+
+    @typechecked
+    def compare_nouns(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+        word1 and word2 are to be treated as nouns
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        """
+        return self._plequal(word1, word2, self.plural_noun)
+
+    @typechecked
+    def compare_verbs(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+        word1 and word2 are to be treated as verbs
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        """
+        return self._plequal(word1, word2, self.plural_verb)
+
+    @typechecked
+    def compare_adjs(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+        word1 and word2 are to be treated as adjectives
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        """
+        return self._plequal(word1, word2, self.plural_adj)
+
+    @typechecked
+    def singular_noun(
+        self,
+        text: Word,
+        count: Optional[Union[int, str, Any]] = None,
+        gender: Optional[str] = None,
+    ) -> Union[str, Literal[False]]:
+        """
+        Return the singular of text, where text is a plural noun.
+
+        If count supplied, then return the singular if count is one of:
+            1, a, an, one, each, every, this, that or if count is None
+
+        otherwise return text unchanged.
+
+        Whitespace at the start and end is preserved.
+
+        >>> p = engine()
+        >>> p.singular_noun('horses')
+        'horse'
+        >>> p.singular_noun('knights')
+        'knight'
+
+        Returns False when a singular noun is passed.
+
+        >>> p.singular_noun('horse')
+        False
+        >>> p.singular_noun('knight')
+        False
+        >>> p.singular_noun('soldier')
+        False
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        sing = self._sinoun(word, count=count, gender=gender)
+        if sing is not False:
+            plural = self.postprocess(word, sing)
+            return f"{pre}{plural}{post}"
+        return False
+
+    def _plequal(self, word1: str, word2: str, pl) -> Union[str, bool]:  # noqa: C901
+        classval = self.classical_dict.copy()
+        self.classical_dict = all_classical.copy()
+        if word1 == word2:
+            return "eq"
+        if word1 == pl(word2):
+            return "p:s"
+        if pl(word1) == word2:
+            return "s:p"
+        self.classical_dict = no_classical.copy()
+        if word1 == pl(word2):
+            return "p:s"
+        if pl(word1) == word2:
+            return "s:p"
+        self.classical_dict = classval.copy()
+
+        if pl == self.plural or pl == self.plural_noun:
+            if self._pl_check_plurals_N(word1, word2):
+                return "p:p"
+            if self._pl_check_plurals_N(word2, word1):
+                return "p:p"
+        if pl == self.plural or pl == self.plural_adj:
+            if self._pl_check_plurals_adj(word1, word2):
+                return "p:p"
+        return False
+
+    def _pl_reg_plurals(self, pair: str, stems: str, end1: str, end2: str) -> bool:
+        pattern = rf"({stems})({end1}\|\1{end2}|{end2}\|\1{end1})"
+        return bool(re.search(pattern, pair))
+
+    def _pl_check_plurals_N(self, word1: str, word2: str) -> bool:
+        stem_endings = (
+            (pl_sb_C_a_ata, "as", "ata"),
+            (pl_sb_C_is_ides, "is", "ides"),
+            (pl_sb_C_a_ae, "s", "e"),
+            (pl_sb_C_en_ina, "ens", "ina"),
+            (pl_sb_C_um_a, "ums", "a"),
+            (pl_sb_C_us_i, "uses", "i"),
+            (pl_sb_C_on_a, "ons", "a"),
+            (pl_sb_C_o_i_stems, "os", "i"),
+            (pl_sb_C_ex_ices, "exes", "ices"),
+            (pl_sb_C_ix_ices, "ixes", "ices"),
+            (pl_sb_C_i, "s", "i"),
+            (pl_sb_C_im, "s", "im"),
+            (".*eau", "s", "x"),
+            (".*ieu", "s", "x"),
+            (".*tri", "xes", "ces"),
+            (".{2,}[yia]n", "xes", "ges"),
+        )
+
+        words = map(Words, (word1, word2))
+        pair = "|".join(word.last for word in words)
+
+        return (
+            pair in pl_sb_irregular_s.values()
+            or pair in pl_sb_irregular.values()
+            or pair in pl_sb_irregular_caps.values()
+            or any(
+                self._pl_reg_plurals(pair, stems, end1, end2)
+                for stems, end1, end2 in stem_endings
+            )
+        )
+
+    def _pl_check_plurals_adj(self, word1: str, word2: str) -> bool:
+        word1a = word1[: word1.rfind("'")] if word1.endswith(("'s", "'")) else ""
+        word2a = word2[: word2.rfind("'")] if word2.endswith(("'s", "'")) else ""
+
+        return (
+            bool(word1a)
+            and bool(word2a)
+            and (
+                self._pl_check_plurals_N(word1a, word2a)
+                or self._pl_check_plurals_N(word2a, word1a)
+            )
+        )
+
+    def get_count(self, count: Optional[Union[str, int]] = None) -> Union[str, int]:
+        if count is None and self.persistent_count is not None:
+            count = self.persistent_count
+
+        if count is not None:
+            count = (
+                1
+                if (
+                    (str(count) in pl_count_one)
+                    or (
+                        self.classical_dict["zero"]
+                        and str(count).lower() in pl_count_zero
+                    )
+                )
+                else 2
+            )
+        else:
+            count = ""
+        return count
+
+    # @profile
+    def _plnoun(  # noqa: C901
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> str:
+        count = self.get_count(count)
+
+        # DEFAULT TO PLURAL
+
+        if count == 1:
+            return word
+
+        # HANDLE USER-DEFINED NOUNS
+
+        value = self.ud_match(word, self.pl_sb_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
+
+        if word == "":
+            return word
+
+        word = Words(word)
+
+        if word.last.lower() in pl_sb_uninflected_complete:
+            if len(word.split_) >= 3:
+                return self._handle_long_compounds(word, count=2) or word
+            return word
+
+        if word in pl_sb_uninflected_caps:
+            return word
+
+        for k, v in pl_sb_uninflected_bysize.items():
+            if word.lowered[-k:] in v:
+                return word
+
+        if self.classical_dict["herd"] and word.last.lower() in pl_sb_uninflected_herd:
+            return word
+
+        # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
+
+        mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
+        if mo and mo.group(2) != "":
+            return f"{self._plnoun(mo.group(1), 2)}{mo.group(2)}"
+
+        if " a " in word.lowered or "-a-" in word.lowered:
+            mo = PL_SB_PREP_DUAL_COMPOUND_RE.search(word)
+            if mo and mo.group(2) != "" and mo.group(3) != "":
+                return (
+                    f"{self._plnoun(mo.group(1), 2)}"
+                    f"{mo.group(2)}"
+                    f"{self._plnoun(mo.group(3))}"
+                )
+
+        if len(word.split_) >= 3:
+            handled_words = self._handle_long_compounds(word, count=2)
+            if handled_words is not None:
+                return handled_words
+
+        # only pluralize denominators in units
+        mo = DENOMINATOR.search(word.lowered)
+        if mo:
+            index = len(mo.group("denominator"))
+            return f"{self._plnoun(word[:index])}{word[index:]}"
+
+        # handle units given in degrees (only accept if
+        # there is no more than one word following)
+        # degree Celsius => degrees Celsius but degree
+        # fahrenheit hour => degree fahrenheit hours
+        if len(word.split_) >= 2 and word.split_[-2] == "degree":
+            return " ".join([self._plnoun(word.first)] + word.split_[1:])
+
+        with contextlib.suppress(ValueError):
+            return self._handle_prepositional_phrase(
+                word.lowered,
+                functools.partial(self._plnoun, count=2),
+                '-',
+            )
+
+        # HANDLE PRONOUNS
+
+        for k, v in pl_pron_acc_keys_bysize.items():
+            if word.lowered[-k:] in v:  # ends with accusative pronoun
+                for pk, pv in pl_prep_bysize.items():
+                    if word.lowered[:pk] in pv:  # starts with a prep
+                        if word.lowered.split() == [
+                            word.lowered[:pk],
+                            word.lowered[-k:],
+                        ]:
+                            # only whitespace in between
+                            return word.lowered[:-k] + pl_pron_acc[word.lowered[-k:]]
+
+        try:
+            return pl_pron_nom[word.lowered]
+        except KeyError:
+            pass
+
+        try:
+            return pl_pron_acc[word.lowered]
+        except KeyError:
+            pass
+
+        # HANDLE ISOLATED IRREGULAR PLURALS
+
+        if word.last in pl_sb_irregular_caps:
+            llen = len(word.last)
+            return f"{word[:-llen]}{pl_sb_irregular_caps[word.last]}"
+
+        lowered_last = word.last.lower()
+        if lowered_last in pl_sb_irregular:
+            llen = len(lowered_last)
+            return f"{word[:-llen]}{pl_sb_irregular[lowered_last]}"
+
+        dash_split = word.lowered.split('-')
+        if (" ".join(dash_split[-2:])).lower() in pl_sb_irregular_compound:
+            llen = len(
+                " ".join(dash_split[-2:])
+            )  # TODO: what if 2 spaces between these words?
+            return (
+                f"{word[:-llen]}"
+                f"{pl_sb_irregular_compound[(' '.join(dash_split[-2:])).lower()]}"
+            )
+
+        if word.lowered[-3:] == "quy":
+            return f"{word[:-1]}ies"
+
+        if word.lowered[-6:] == "person":
+            if self.classical_dict["persons"]:
+                return f"{word}s"
+            else:
+                return f"{word[:-4]}ople"
+
+        # HANDLE FAMILIES OF IRREGULAR PLURALS
+
+        if word.lowered[-3:] == "man":
+            for k, v in pl_sb_U_man_mans_bysize.items():
+                if word.lowered[-k:] in v:
+                    return f"{word}s"
+            for k, v in pl_sb_U_man_mans_caps_bysize.items():
+                if word[-k:] in v:
+                    return f"{word}s"
+            return f"{word[:-3]}men"
+        if word.lowered[-5:] == "mouse":
+            return f"{word[:-5]}mice"
+        if word.lowered[-5:] == "louse":
+            v = pl_sb_U_louse_lice_bysize.get(len(word))
+            if v and word.lowered in v:
+                return f"{word[:-5]}lice"
+            return f"{word}s"
+        if word.lowered[-5:] == "goose":
+            return f"{word[:-5]}geese"
+        if word.lowered[-5:] == "tooth":
+            return f"{word[:-5]}teeth"
+        if word.lowered[-4:] == "foot":
+            return f"{word[:-4]}feet"
+        if word.lowered[-4:] == "taco":
+            return f"{word[:-5]}tacos"
+
+        if word.lowered == "die":
+            return "dice"
+
+        # HANDLE UNASSIMILATED IMPORTS
+
+        if word.lowered[-4:] == "ceps":
+            return word
+        if word.lowered[-4:] == "zoon":
+            return f"{word[:-2]}a"
+        if word.lowered[-3:] in ("cis", "sis", "xis"):
+            return f"{word[:-2]}es"
+
+        for lastlet, d, numend, post in (
+            ("h", pl_sb_U_ch_chs_bysize, None, "s"),
+            ("x", pl_sb_U_ex_ices_bysize, -2, "ices"),
+            ("x", pl_sb_U_ix_ices_bysize, -2, "ices"),
+            ("m", pl_sb_U_um_a_bysize, -2, "a"),
+            ("s", pl_sb_U_us_i_bysize, -2, "i"),
+            ("n", pl_sb_U_on_a_bysize, -2, "a"),
+            ("a", pl_sb_U_a_ae_bysize, None, "e"),
+        ):
+            if word.lowered[-1] == lastlet:  # this test to add speed
+                for k, v in d.items():
+                    if word.lowered[-k:] in v:
+                        return word[:numend] + post
+
+        # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
+
+        if self.classical_dict["ancient"]:
+            if word.lowered[-4:] == "trix":
+                return f"{word[:-1]}ces"
+            if word.lowered[-3:] in ("eau", "ieu"):
+                return f"{word}x"
+            if word.lowered[-3:] in ("ynx", "inx", "anx") and len(word) > 4:
+                return f"{word[:-1]}ges"
+
+            for lastlet, d, numend, post in (
+                ("n", pl_sb_C_en_ina_bysize, -2, "ina"),
+                ("x", pl_sb_C_ex_ices_bysize, -2, "ices"),
+                ("x", pl_sb_C_ix_ices_bysize, -2, "ices"),
+                ("m", pl_sb_C_um_a_bysize, -2, "a"),
+                ("s", pl_sb_C_us_i_bysize, -2, "i"),
+                ("s", pl_sb_C_us_us_bysize, None, ""),
+                ("a", pl_sb_C_a_ae_bysize, None, "e"),
+                ("a", pl_sb_C_a_ata_bysize, None, "ta"),
+                ("s", pl_sb_C_is_ides_bysize, -1, "des"),
+                ("o", pl_sb_C_o_i_bysize, -1, "i"),
+                ("n", pl_sb_C_on_a_bysize, -2, "a"),
+            ):
+                if word.lowered[-1] == lastlet:  # this test to add speed
+                    for k, v in d.items():
+                        if word.lowered[-k:] in v:
+                            return word[:numend] + post
+
+            for d, numend, post in (
+                (pl_sb_C_i_bysize, None, "i"),
+                (pl_sb_C_im_bysize, None, "im"),
+            ):
+                for k, v in d.items():
+                    if word.lowered[-k:] in v:
+                        return word[:numend] + post
+
+        # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
+
+        if lowered_last in pl_sb_singular_s_complete:
+            return f"{word}es"
+
+        for k, v in pl_sb_singular_s_bysize.items():
+            if word.lowered[-k:] in v:
+                return f"{word}es"
+
+        if word.lowered[-2:] == "es" and word[0] == word[0].upper():
+            return f"{word}es"
+
+        if word.lowered[-1] == "z":
+            for k, v in pl_sb_z_zes_bysize.items():
+                if word.lowered[-k:] in v:
+                    return f"{word}es"
+
+            if word.lowered[-2:-1] != "z":
+                return f"{word}zes"
+
+        if word.lowered[-2:] == "ze":
+            for k, v in pl_sb_ze_zes_bysize.items():
+                if word.lowered[-k:] in v:
+                    return f"{word}s"
+
+        if word.lowered[-2:] in ("ch", "sh", "zz", "ss") or word.lowered[-1] == "x":
+            return f"{word}es"
+
+        # HANDLE ...f -> ...ves
+
+        if word.lowered[-3:] in ("elf", "alf", "olf"):
+            return f"{word[:-1]}ves"
+        if word.lowered[-3:] == "eaf" and word.lowered[-4:-3] != "d":
+            return f"{word[:-1]}ves"
+        if word.lowered[-4:] in ("nife", "life", "wife"):
+            return f"{word[:-2]}ves"
+        if word.lowered[-3:] == "arf":
+            return f"{word[:-1]}ves"
+
+        # HANDLE ...y
+
+        if word.lowered[-1] == "y":
+            if word.lowered[-2:-1] in "aeiou" or len(word) == 1:
+                return f"{word}s"
+
+            if self.classical_dict["names"]:
+                if word.lowered[-1] == "y" and word[0] == word[0].upper():
+                    return f"{word}s"
+
+            return f"{word[:-1]}ies"
+
+        # HANDLE ...o
+
+        if lowered_last in pl_sb_U_o_os_complete:
+            return f"{word}s"
+
+        for k, v in pl_sb_U_o_os_bysize.items():
+            if word.lowered[-k:] in v:
+                return f"{word}s"
+
+        if word.lowered[-2:] in ("ao", "eo", "io", "oo", "uo"):
+            return f"{word}s"
+
+        if word.lowered[-1] == "o":
+            return f"{word}es"
+
+        # OTHERWISE JUST ADD ...s
+
+        return f"{word}s"
+
+    @classmethod
+    def _handle_prepositional_phrase(cls, phrase, transform, sep):
+        """
+        Given a word or phrase possibly separated by sep, parse out
+        the prepositional phrase and apply the transform to the word
+        preceding the prepositional phrase.
+
+        Raise ValueError if the pivot is not found or if at least two
+        separators are not found.
+
+        >>> engine._handle_prepositional_phrase("man-of-war", str.upper, '-')
+        'MAN-of-war'
+        >>> engine._handle_prepositional_phrase("man of war", str.upper, ' ')
+        'MAN of war'
+        """
+        parts = phrase.split(sep)
+        if len(parts) < 3:
+            raise ValueError("Cannot handle words with fewer than two separators")
+
+        pivot = cls._find_pivot(parts, pl_prep_list_da)
+
+        transformed = transform(parts[pivot - 1]) or parts[pivot - 1]
+        return " ".join(
+            parts[: pivot - 1] + [sep.join([transformed, parts[pivot], ''])]
+        ) + " ".join(parts[(pivot + 1) :])
+
+    def _handle_long_compounds(self, word: Words, count: int) -> Union[str, None]:
+        """
+        Handles the plural and singular for compound `Words` that
+        have three or more words, based on the given count.
+
+        >>> engine()._handle_long_compounds(Words("pair of scissors"), 2)
+        'pairs of scissors'
+        >>> engine()._handle_long_compounds(Words("men beyond hills"), 1)
+        'man beyond hills'
+        """
+        inflection = self._sinoun if count == 1 else self._plnoun
+        solutions = (  # type: ignore
+            " ".join(
+                itertools.chain(
+                    leader,
+                    [inflection(cand, count), prep],  # type: ignore
+                    trailer,
+                )
+            )
+            for leader, (cand, prep), trailer in windowed_complete(word.split_, 2)
+            if prep in pl_prep_list_da  # type: ignore
+        )
+        return next(solutions, None)
+
+    @staticmethod
+    def _find_pivot(words, candidates):
+        pivots = (
+            index for index in range(1, len(words) - 1) if words[index] in candidates
+        )
+        try:
+            return next(pivots)
+        except StopIteration:
+            raise ValueError("No pivot found") from None
+
+    def _pl_special_verb(  # noqa: C901
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> Union[str, bool]:
+        if self.classical_dict["zero"] and str(count).lower() in pl_count_zero:
+            return False
+        count = self.get_count(count)
+
+        if count == 1:
+            return word
+
+        # HANDLE USER-DEFINED VERBS
+
+        value = self.ud_match(word, self.pl_v_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE IRREGULAR PRESENT TENSE (SIMPLE AND COMPOUND)
+
+        try:
+            words = Words(word)
+        except IndexError:
+            return False  # word is ''
+
+        if words.first in plverb_irregular_pres:
+            return f"{plverb_irregular_pres[words.first]}{words[len(words.first) :]}"
+
+        # HANDLE IRREGULAR FUTURE, PRETERITE AND PERFECT TENSES
+
+        if words.first in plverb_irregular_non_pres:
+            return word
+
+        # HANDLE PRESENT NEGATIONS (SIMPLE AND COMPOUND)
+
+        if words.first.endswith("n't") and words.first[:-3] in plverb_irregular_pres:
+            return (
+                f"{plverb_irregular_pres[words.first[:-3]]}n't"
+                f"{words[len(words.first) :]}"
+            )
+
+        if words.first.endswith("n't"):
+            return word
+
+        # HANDLE SPECIAL CASES
+
+        mo = PLVERB_SPECIAL_S_RE.search(word)
+        if mo:
+            return False
+        if WHITESPACE.search(word):
+            return False
+
+        if words.lowered == "quizzes":
+            return "quiz"
+
+        # HANDLE STANDARD 3RD PERSON (CHOP THE ...(e)s OFF SINGLE WORDS)
+
+        if (
+            words.lowered[-4:] in ("ches", "shes", "zzes", "sses")
+            or words.lowered[-3:] == "xes"
+        ):
+            return words[:-2]
+
+        if words.lowered[-3:] == "ies" and len(words) > 3:
+            return words.lowered[:-3] + "y"
+
+        if (
+            words.last.lower() in pl_v_oes_oe
+            or words.lowered[-4:] in pl_v_oes_oe_endings_size4
+            or words.lowered[-5:] in pl_v_oes_oe_endings_size5
+        ):
+            return words[:-1]
+
+        if words.lowered.endswith("oes") and len(words) > 3:
+            return words.lowered[:-2]
+
+        mo = ENDS_WITH_S.search(words)
+        if mo:
+            return mo.group(1)
+
+        # OTHERWISE, A REGULAR VERB (HANDLE ELSEWHERE)
+
+        return False
+
+    def _pl_general_verb(
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> str:
+        count = self.get_count(count)
+
+        if count == 1:
+            return word
+
+        # HANDLE AMBIGUOUS PRESENT TENSES  (SIMPLE AND COMPOUND)
+
+        mo = plverb_ambiguous_pres_keys.search(word)
+        if mo:
+            return f"{plverb_ambiguous_pres[mo.group(1).lower()]}{mo.group(2)}"
+
+        # HANDLE AMBIGUOUS PRETERITE AND PERFECT TENSES
+
+        mo = plverb_ambiguous_non_pres.search(word)
+        if mo:
+            return word
+
+        # OTHERWISE, 1st OR 2ND PERSON IS UNINFLECTED
+
+        return word
+
+    def _pl_special_adjective(
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> Union[str, bool]:
+        count = self.get_count(count)
+
+        if count == 1:
+            return word
+
+        # HANDLE USER-DEFINED ADJECTIVES
+
+        value = self.ud_match(word, self.pl_adj_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE KNOWN CASES
+
+        mo = pl_adj_special_keys.search(word)
+        if mo:
+            return pl_adj_special[mo.group(1).lower()]
+
+        # HANDLE POSSESSIVES
+
+        mo = pl_adj_poss_keys.search(word)
+        if mo:
+            return pl_adj_poss[mo.group(1).lower()]
+
+        mo = ENDS_WITH_APOSTROPHE_S.search(word)
+        if mo:
+            pl = self.plural_noun(mo.group(1))
+            trailing_s = "" if pl[-1] == "s" else "s"
+            return f"{pl}'{trailing_s}"
+
+        # OTHERWISE, NO IDEA
+
+        return False
+
+    # @profile
+    def _sinoun(  # noqa: C901
+        self,
+        word: str,
+        count: Optional[Union[str, int]] = None,
+        gender: Optional[str] = None,
+    ) -> Union[str, bool]:
+        count = self.get_count(count)
+
+        # DEFAULT TO PLURAL
+
+        if count == 2:
+            return word
+
+        # SET THE GENDER
+
+        try:
+            if gender is None:
+                gender = self.thegender
+            elif gender not in singular_pronoun_genders:
+                raise BadGenderError
+        except (TypeError, IndexError) as err:
+            raise BadGenderError from err
+
+        # HANDLE USER-DEFINED NOUNS
+
+        value = self.ud_match(word, self.si_sb_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
+
+        if word == "":
+            return word
+
+        if word in si_sb_ois_oi_case:
+            return word[:-1]
+
+        words = Words(word)
+
+        if words.last.lower() in pl_sb_uninflected_complete:
+            if len(words.split_) >= 3:
+                return self._handle_long_compounds(words, count=1) or word
+            return word
+
+        if word in pl_sb_uninflected_caps:
+            return word
+
+        for k, v in pl_sb_uninflected_bysize.items():
+            if words.lowered[-k:] in v:
+                return word
+
+        if self.classical_dict["herd"] and words.last.lower() in pl_sb_uninflected_herd:
+            return word
+
+        if words.last.lower() in pl_sb_C_us_us:
+            return word if self.classical_dict["ancient"] else False
+
+        # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
+
+        mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
+        if mo and mo.group(2) != "":
+            return f"{self._sinoun(mo.group(1), 1, gender=gender)}{mo.group(2)}"
+
+        with contextlib.suppress(ValueError):
+            return self._handle_prepositional_phrase(
+                words.lowered,
+                functools.partial(self._sinoun, count=1, gender=gender),
+                ' ',
+            )
+
+        with contextlib.suppress(ValueError):
+            return self._handle_prepositional_phrase(
+                words.lowered,
+                functools.partial(self._sinoun, count=1, gender=gender),
+                '-',
+            )
+
+        # HANDLE PRONOUNS
+
+        for k, v in si_pron_acc_keys_bysize.items():
+            if words.lowered[-k:] in v:  # ends with accusative pronoun
+                for pk, pv in pl_prep_bysize.items():
+                    if words.lowered[:pk] in pv:  # starts with a prep
+                        if words.lowered.split() == [
+                            words.lowered[:pk],
+                            words.lowered[-k:],
+                        ]:
+                            # only whitespace in between
+                            return words.lowered[:-k] + get_si_pron(
+                                "acc", words.lowered[-k:], gender
+                            )
+
+        try:
+            return get_si_pron("nom", words.lowered, gender)
+        except KeyError:
+            pass
+
+        try:
+            return get_si_pron("acc", words.lowered, gender)
+        except KeyError:
+            pass
+
+        # HANDLE ISOLATED IRREGULAR PLURALS
+
+        if words.last in si_sb_irregular_caps:
+            llen = len(words.last)
+            return f"{word[:-llen]}{si_sb_irregular_caps[words.last]}"
+
+        if words.last.lower() in si_sb_irregular:
+            llen = len(words.last.lower())
+            return f"{word[:-llen]}{si_sb_irregular[words.last.lower()]}"
+
+        dash_split = words.lowered.split("-")
+        if (" ".join(dash_split[-2:])).lower() in si_sb_irregular_compound:
+            llen = len(
+                " ".join(dash_split[-2:])
+            )  # TODO: what if 2 spaces between these words?
+            return "{}{}".format(
+                word[:-llen],
+                si_sb_irregular_compound[(" ".join(dash_split[-2:])).lower()],
+            )
+
+        if words.lowered[-5:] == "quies":
+            return word[:-3] + "y"
+
+        if words.lowered[-7:] == "persons":
+            return word[:-1]
+        if words.lowered[-6:] == "people":
+            return word[:-4] + "rson"
+
+        # HANDLE FAMILIES OF IRREGULAR PLURALS
+
+        if words.lowered[-4:] == "mans":
+            for k, v in si_sb_U_man_mans_bysize.items():
+                if words.lowered[-k:] in v:
+                    return word[:-1]
+            for k, v in si_sb_U_man_mans_caps_bysize.items():
+                if word[-k:] in v:
+                    return word[:-1]
+        if words.lowered[-3:] == "men":
+            return word[:-3] + "man"
+        if words.lowered[-4:] == "mice":
+            return word[:-4] + "mouse"
+        if words.lowered[-4:] == "lice":
+            v = si_sb_U_louse_lice_bysize.get(len(word))
+            if v and words.lowered in v:
+                return word[:-4] + "louse"
+        if words.lowered[-5:] == "geese":
+            return word[:-5] + "goose"
+        if words.lowered[-5:] == "teeth":
+            return word[:-5] + "tooth"
+        if words.lowered[-4:] == "feet":
+            return word[:-4] + "foot"
+
+        if words.lowered == "dice":
+            return "die"
+
+        # HANDLE UNASSIMILATED IMPORTS
+
+        if words.lowered[-4:] == "ceps":
+            return word
+        if words.lowered[-3:] == "zoa":
+            return word[:-1] + "on"
+
+        for lastlet, d, unass_numend, post in (
+            ("s", si_sb_U_ch_chs_bysize, -1, ""),
+            ("s", si_sb_U_ex_ices_bysize, -4, "ex"),
+            ("s", si_sb_U_ix_ices_bysize, -4, "ix"),
+            ("a", si_sb_U_um_a_bysize, -1, "um"),
+            ("i", si_sb_U_us_i_bysize, -1, "us"),
+            ("a", si_sb_U_on_a_bysize, -1, "on"),
+            ("e", si_sb_U_a_ae_bysize, -1, ""),
+        ):
+            if words.lowered[-1] == lastlet:  # this test to add speed
+                for k, v in d.items():
+                    if words.lowered[-k:] in v:
+                        return word[:unass_numend] + post
+
+        # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
+
+        if self.classical_dict["ancient"]:
+            if words.lowered[-6:] == "trices":
+                return word[:-3] + "x"
+            if words.lowered[-4:] in ("eaux", "ieux"):
+                return word[:-1]
+            if words.lowered[-5:] in ("ynges", "inges", "anges") and len(word) > 6:
+                return word[:-3] + "x"
+
+            for lastlet, d, class_numend, post in (
+                ("a", si_sb_C_en_ina_bysize, -3, "en"),
+                ("s", si_sb_C_ex_ices_bysize, -4, "ex"),
+                ("s", si_sb_C_ix_ices_bysize, -4, "ix"),
+                ("a", si_sb_C_um_a_bysize, -1, "um"),
+                ("i", si_sb_C_us_i_bysize, -1, "us"),
+                ("s", pl_sb_C_us_us_bysize, None, ""),
+                ("e", si_sb_C_a_ae_bysize, -1, ""),
+                ("a", si_sb_C_a_ata_bysize, -2, ""),
+                ("s", si_sb_C_is_ides_bysize, -3, "s"),
+                ("i", si_sb_C_o_i_bysize, -1, "o"),
+                ("a", si_sb_C_on_a_bysize, -1, "on"),
+                ("m", si_sb_C_im_bysize, -2, ""),
+                ("i", si_sb_C_i_bysize, -1, ""),
+            ):
+                if words.lowered[-1] == lastlet:  # this test to add speed
+                    for k, v in d.items():
+                        if words.lowered[-k:] in v:
+                            return word[:class_numend] + post
+
+        # HANDLE PLURLS ENDING IN uses -> use
+
+        if (
+            words.lowered[-6:] == "houses"
+            or word in si_sb_uses_use_case
+            or words.last.lower() in si_sb_uses_use
+        ):
+            return word[:-1]
+
+        # HANDLE PLURLS ENDING IN ies -> ie
+
+        if word in si_sb_ies_ie_case or words.last.lower() in si_sb_ies_ie:
+            return word[:-1]
+
+        # HANDLE PLURLS ENDING IN oes -> oe
+
+        if (
+            words.lowered[-5:] == "shoes"
+            or word in si_sb_oes_oe_case
+            or words.last.lower() in si_sb_oes_oe
+        ):
+            return word[:-1]
+
+        # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
+
+        if word in si_sb_sses_sse_case or words.last.lower() in si_sb_sses_sse:
+            return word[:-1]
+
+        if words.last.lower() in si_sb_singular_s_complete:
+            return word[:-2]
+
+        for k, v in si_sb_singular_s_bysize.items():
+            if words.lowered[-k:] in v:
+                return word[:-2]
+
+        if words.lowered[-4:] == "eses" and word[0] == word[0].upper():
+            return word[:-2]
+
+        if words.last.lower() in si_sb_z_zes:
+            return word[:-2]
+
+        if words.last.lower() in si_sb_zzes_zz:
+            return word[:-2]
+
+        if words.lowered[-4:] == "zzes":
+            return word[:-3]
+
+        if word in si_sb_ches_che_case or words.last.lower() in si_sb_ches_che:
+            return word[:-1]
+
+        if words.lowered[-4:] in ("ches", "shes"):
+            return word[:-2]
+
+        if words.last.lower() in si_sb_xes_xe:
+            return word[:-1]
+
+        if words.lowered[-3:] == "xes":
+            return word[:-2]
+
+        # HANDLE ...f -> ...ves
+
+        if word in si_sb_ves_ve_case or words.last.lower() in si_sb_ves_ve:
+            return word[:-1]
+
+        if words.lowered[-3:] == "ves":
+            if words.lowered[-5:-3] in ("el", "al", "ol"):
+                return word[:-3] + "f"
+            if words.lowered[-5:-3] == "ea" and word[-6:-5] != "d":
+                return word[:-3] + "f"
+            if words.lowered[-5:-3] in ("ni", "li", "wi"):
+                return word[:-3] + "fe"
+            if words.lowered[-5:-3] == "ar":
+                return word[:-3] + "f"
+
+        # HANDLE ...y
+
+        if words.lowered[-2:] == "ys":
+            if len(words.lowered) > 2 and words.lowered[-3] in "aeiou":
+                return word[:-1]
+
+            if self.classical_dict["names"]:
+                if words.lowered[-2:] == "ys" and word[0] == word[0].upper():
+                    return word[:-1]
+
+        if words.lowered[-3:] == "ies":
+            return word[:-3] + "y"
+
+        # HANDLE ...o
+
+        if words.lowered[-2:] == "os":
+            if words.last.lower() in si_sb_U_o_os_complete:
+                return word[:-1]
+
+            for k, v in si_sb_U_o_os_bysize.items():
+                if words.lowered[-k:] in v:
+                    return word[:-1]
+
+            if words.lowered[-3:] in ("aos", "eos", "ios", "oos", "uos"):
+                return word[:-1]
+
+        if words.lowered[-3:] == "oes":
+            return word[:-2]
+
+        # UNASSIMILATED IMPORTS FINAL RULE
+
+        if word in si_sb_es_is:
+            return word[:-2] + "is"
+
+        # OTHERWISE JUST REMOVE ...s
+
+        if words.lowered[-1] == "s":
+            return word[:-1]
+
+        # COULD NOT FIND SINGULAR
+
+        return False
+
+    # ADJECTIVES
+
+    @typechecked
+    def a(self, text: Word, count: Optional[Union[int, str, Any]] = 1) -> str:
+        """
+        Return the appropriate indefinite article followed by text.
+
+        The indefinite article is either 'a' or 'an'.
+
+        If count is not one, then return count followed by text
+        instead of 'a' or 'an'.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        mo = INDEFINITE_ARTICLE_TEST.search(text)
+        if mo:
+            word = mo.group(2)
+            if not word:
+                return text
+            pre = mo.group(1)
+            post = mo.group(3)
+            result = self._indef_article(word, count)
+            return f"{pre}{result}{post}"
+        return ""
+
+    an = a
+
+    _indef_article_cases = (
+        # HANDLE ORDINAL FORMS
+        (A_ordinal_a, "a"),
+        (A_ordinal_an, "an"),
+        # HANDLE SPECIAL CASES
+        (A_explicit_an, "an"),
+        (SPECIAL_AN, "an"),
+        (SPECIAL_A, "a"),
+        # HANDLE ABBREVIATIONS
+        (A_abbrev, "an"),
+        (SPECIAL_ABBREV_AN, "an"),
+        (SPECIAL_ABBREV_A, "a"),
+        # HANDLE CONSONANTS
+        (CONSONANTS, "a"),
+        # HANDLE SPECIAL VOWEL-FORMS
+        (ARTICLE_SPECIAL_EU, "a"),
+        (ARTICLE_SPECIAL_ONCE, "a"),
+        (ARTICLE_SPECIAL_ONETIME, "a"),
+        (ARTICLE_SPECIAL_UNIT, "a"),
+        (ARTICLE_SPECIAL_UBA, "a"),
+        (ARTICLE_SPECIAL_UKR, "a"),
+        (A_explicit_a, "a"),
+        # HANDLE SPECIAL CAPITALS
+        (SPECIAL_CAPITALS, "a"),
+        # HANDLE VOWELS
+        (VOWELS, "an"),
+        # HANDLE y...
+        # (BEFORE CERTAIN CONSONANTS IMPLIES (UNNATURALIZED) "i.." SOUND)
+        (A_y_cons, "an"),
+    )
+
+    def _indef_article(self, word: str, count: Union[int, str, Any]) -> str:
+        mycount = self.get_count(count)
+
+        if mycount != 1:
+            return f"{count} {word}"
+
+        # HANDLE USER-DEFINED VARIANTS
+
+        value = self.ud_match(word, self.A_a_user_defined)
+        if value is not None:
+            return f"{value} {word}"
+
+        matches = (
+            f'{article} {word}'
+            for regexen, article in self._indef_article_cases
+            if regexen.search(word)
+        )
+
+        # OTHERWISE, GUESS "a"
+        fallback = f'a {word}'
+        return next(matches, fallback)
+
+    # 2. TRANSLATE ZERO-QUANTIFIED $word TO "no plural($word)"
+
+    @typechecked
+    def no(self, text: Word, count: Optional[Union[int, str]] = None) -> str:
+        """
+        If count is 0, no, zero or nil, return 'no' followed by the plural
+        of text.
+
+        If count is one of:
+            1, a, an, one, each, every, this, that
+            return count followed by text.
+
+        Otherwise return count follow by the plural of text.
+
+        In the return value count is always followed by a space.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        if count is None and self.persistent_count is not None:
+            count = self.persistent_count
+
+        if count is None:
+            count = 0
+        mo = PARTITION_WORD.search(text)
+        if mo:
+            pre = mo.group(1)
+            word = mo.group(2)
+            post = mo.group(3)
+        else:
+            pre = ""
+            word = ""
+            post = ""
+
+        if str(count).lower() in pl_count_zero:
+            count = 'no'
+        return f"{pre}{count} {self.plural(word, count)}{post}"
+
+    # PARTICIPLES
+
+    @typechecked
+    def present_participle(self, word: Word) -> str:
+        """
+        Return the present participle for word.
+
+        word is the 3rd person singular verb.
+
+        """
+        plv = self.plural_verb(word, 2)
+        ans = plv
+
+        for regexen, repl in PRESENT_PARTICIPLE_REPLACEMENTS:
+            ans, num = regexen.subn(repl, plv)
+            if num:
+                return f"{ans}ing"
+        return f"{ans}ing"
+
+    # NUMERICAL INFLECTIONS
+
+    @typechecked
+    def ordinal(self, num: Union[Number, Word]) -> str:
+        """
+        Return the ordinal of num.
+
+        >>> ordinal = engine().ordinal
+        >>> ordinal(1)
+        '1st'
+        >>> ordinal('one')
+        'first'
+        """
+        if DIGIT.match(str(num)):
+            if isinstance(num, (float, int)) and int(num) == num:
+                n = int(num)
+            else:
+                if "." in str(num):
+                    try:
+                        # numbers after decimal,
+                        # so only need last one for ordinal
+                        n = int(str(num)[-1])
+
+                    except ValueError:  # ends with '.', so need to use whole string
+                        n = int(str(num)[:-1])
+                else:
+                    n = int(num)  # type: ignore
+            try:
+                post = nth[n % 100]
+            except KeyError:
+                post = nth[n % 10]
+            return f"{num}{post}"
+        else:
+            return self._sub_ord(num)
+
+    def millfn(self, ind: int = 0) -> str:
+        if ind > len(mill) - 1:
+            raise NumOutOfRangeError
+        return mill[ind]
+
+    def unitfn(self, units: int, mindex: int = 0) -> str:
+        return f"{unit[units]}{self.millfn(mindex)}"
+
+    def tenfn(self, tens, units, mindex=0) -> str:
+        if tens != 1:
+            tens_part = ten[tens]
+            if tens and units:
+                hyphen = "-"
+            else:
+                hyphen = ""
+            unit_part = unit[units]
+            mill_part = self.millfn(mindex)
+            return f"{tens_part}{hyphen}{unit_part}{mill_part}"
+        return f"{teen[units]}{mill[mindex]}"
+
+    def hundfn(self, hundreds: int, tens: int, units: int, mindex: int) -> str:
+        if hundreds:
+            andword = f" {self._number_args['andword']} " if tens or units else ""
+            # use unit not unitfn as simpler
+            return (
+                f"{unit[hundreds]} hundred{andword}"
+                f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
+            )
+        if tens or units:
+            return f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
+        return ""
+
+    def group1sub(self, mo: Match) -> str:
+        units = int(mo.group(1))
+        if units == 1:
+            return f" {self._number_args['one']}, "
+        elif units:
+            return f"{unit[units]}, "
+        else:
+            return f" {self._number_args['zero']}, "
+
+    def group1bsub(self, mo: Match) -> str:
+        units = int(mo.group(1))
+        if units:
+            return f"{unit[units]}, "
+        else:
+            return f" {self._number_args['zero']}, "
+
+    def group2sub(self, mo: Match) -> str:
+        tens = int(mo.group(1))
+        units = int(mo.group(2))
+        if tens:
+            return f"{self.tenfn(tens, units)}, "
+        if units:
+            return f" {self._number_args['zero']} {unit[units]}, "
+        return f" {self._number_args['zero']} {self._number_args['zero']}, "
+
+    def group3sub(self, mo: Match) -> str:
+        hundreds = int(mo.group(1))
+        tens = int(mo.group(2))
+        units = int(mo.group(3))
+        if hundreds == 1:
+            hunword = f" {self._number_args['one']}"
+        elif hundreds:
+            hunword = str(unit[hundreds])
+        else:
+            hunword = f" {self._number_args['zero']}"
+        if tens:
+            tenword = self.tenfn(tens, units)
+        elif units:
+            tenword = f" {self._number_args['zero']} {unit[units]}"
+        else:
+            tenword = f" {self._number_args['zero']} {self._number_args['zero']}"
+        return f"{hunword} {tenword}, "
+
+    def hundsub(self, mo: Match) -> str:
+        ret = self.hundfn(
+            int(mo.group(1)), int(mo.group(2)), int(mo.group(3)), self.mill_count
+        )
+        self.mill_count += 1
+        return ret
+
+    def tensub(self, mo: Match) -> str:
+        return f"{self.tenfn(int(mo.group(1)), int(mo.group(2)), self.mill_count)}, "
+
+    def unitsub(self, mo: Match) -> str:
+        return f"{self.unitfn(int(mo.group(1)), self.mill_count)}, "
+
+    def enword(self, num: str, group: int) -> str:
+        # import pdb
+        # pdb.set_trace()
+
+        if group == 1:
+            num = DIGIT_GROUP.sub(self.group1sub, num)
+        elif group == 2:
+            num = TWO_DIGITS.sub(self.group2sub, num)
+            num = DIGIT_GROUP.sub(self.group1bsub, num, 1)
+        elif group == 3:
+            num = THREE_DIGITS.sub(self.group3sub, num)
+            num = TWO_DIGITS.sub(self.group2sub, num, 1)
+            num = DIGIT_GROUP.sub(self.group1sub, num, 1)
+        elif int(num) == 0:
+            num = self._number_args["zero"]
+        elif int(num) == 1:
+            num = self._number_args["one"]
+        else:
+            num = num.lstrip().lstrip("0")
+            self.mill_count = 0
+            # surely there's a better way to do the next bit
+            mo = THREE_DIGITS_WORD.search(num)
+            while mo:
+                num = THREE_DIGITS_WORD.sub(self.hundsub, num, 1)
+                mo = THREE_DIGITS_WORD.search(num)
+            num = TWO_DIGITS_WORD.sub(self.tensub, num, 1)
+            num = ONE_DIGIT_WORD.sub(self.unitsub, num, 1)
+        return num
+
+    @staticmethod
+    def _sub_ord(val):
+        new = ordinal_suff.sub(lambda match: ordinal[match.group(1)], val)
+        return new + "th" * (new == val)
+
+    @classmethod
+    def _chunk_num(cls, num, decimal, group):
+        if decimal:
+            max_split = -1 if group != 0 else 1
+            chunks = num.split(".", max_split)
+        else:
+            chunks = [num]
+        return cls._remove_last_blank(chunks)
+
+    @staticmethod
+    def _remove_last_blank(chunks):
+        """
+        Remove the last item from chunks if it's a blank string.
+
+        Return the resultant chunks and whether the last item was removed.
+        """
+        removed = chunks[-1] == ""
+        result = chunks[:-1] if removed else chunks
+        return result, removed
+
+    @staticmethod
+    def _get_sign(num):
+        return {'+': 'plus', '-': 'minus'}.get(num.lstrip()[0], '')
+
+    @typechecked
+    def number_to_words(  # noqa: C901
+        self,
+        num: Union[Number, Word],
+        wantlist: bool = False,
+        group: int = 0,
+        comma: Union[Falsish, str] = ",",
+        andword: str = "and",
+        zero: str = "zero",
+        one: str = "one",
+        decimal: Union[Falsish, str] = "point",
+        threshold: Optional[int] = None,
+    ) -> Union[str, List[str]]:
+        """
+        Return a number in words.
+
+        group = 1, 2 or 3 to group numbers before turning into words
+        comma: define comma
+
+        andword:
+            word for 'and'. Can be set to ''.
+            e.g. "one hundred and one" vs "one hundred one"
+
+        zero: word for '0'
+        one: word for '1'
+        decimal: word for decimal point
+        threshold: numbers above threshold not turned into words
+
+        parameters not remembered from last call. Departure from Perl version.
+        """
+        self._number_args = {"andword": andword, "zero": zero, "one": one}
+        num = str(num)
+
+        # Handle "stylistic" conversions (up to a given threshold)...
+        if threshold is not None and float(num) > threshold:
+            spnum = num.split(".", 1)
+            while comma:
+                (spnum[0], n) = FOUR_DIGIT_COMMA.subn(r"\1,\2", spnum[0])
+                if n == 0:
+                    break
+            try:
+                return f"{spnum[0]}.{spnum[1]}"
+            except IndexError:
+                return str(spnum[0])
+
+        if group < 0 or group > 3:
+            raise BadChunkingOptionError
+
+        sign = self._get_sign(num)
+
+        if num in nth_suff:
+            num = zero
+
+        myord = num[-2:] in nth_suff
+        if myord:
+            num = num[:-2]
+
+        chunks, finalpoint = self._chunk_num(num, decimal, group)
+
+        loopstart = chunks[0] == ""
+        first: bool | None = not loopstart
+
+        def _handle_chunk(chunk):
+            nonlocal first
+
+            # remove all non numeric \D
+            chunk = NON_DIGIT.sub("", chunk)
+            if chunk == "":
+                chunk = "0"
+
+            if group == 0 and not first:
+                chunk = self.enword(chunk, 1)
+            else:
+                chunk = self.enword(chunk, group)
+
+            if chunk[-2:] == ", ":
+                chunk = chunk[:-2]
+            chunk = WHITESPACES_COMMA.sub(",", chunk)
+
+            if group == 0 and first:
+                chunk = COMMA_WORD.sub(f" {andword} \\1", chunk)
+            chunk = WHITESPACES.sub(" ", chunk)
+            # chunk = re.sub(r"(\A\s|\s\Z)", self.blankfn, chunk)
+            chunk = chunk.strip()
+            if first:
+                first = None
+            return chunk
+
+        chunks[loopstart:] = map(_handle_chunk, chunks[loopstart:])
+
+        numchunks = []
+        if first != 0:
+            numchunks = chunks[0].split(f"{comma} ")
+
+        if myord and numchunks:
+            numchunks[-1] = self._sub_ord(numchunks[-1])
+
+        for chunk in chunks[1:]:
+            numchunks.append(decimal)
+            numchunks.extend(chunk.split(f"{comma} "))
+
+        if finalpoint:
+            numchunks.append(decimal)
+
+        if wantlist:
+            return [sign] * bool(sign) + numchunks
+
+        signout = f"{sign} " if sign else ""
+        valout = (
+            ', '.join(numchunks)
+            if group
+            else ''.join(self._render(numchunks, decimal, comma))
+        )
+        return signout + valout
+
+    @staticmethod
+    def _render(chunks, decimal, comma):
+        first_item = chunks.pop(0)
+        yield first_item
+        first = decimal is None or not first_item.endswith(decimal)
+        for nc in chunks:
+            if nc == decimal:
+                first = False
+            elif first:
+                yield comma
+            yield f" {nc}"
+
+    @typechecked
+    def join(
+        self,
+        words: Optional[Sequence[Word]],
+        sep: Optional[str] = None,
+        sep_spaced: bool = True,
+        final_sep: Optional[str] = None,
+        conj: str = "and",
+        conj_spaced: bool = True,
+    ) -> str:
+        """
+        Join words into a list.
+
+        e.g. join(['ant', 'bee', 'fly']) returns 'ant, bee, and fly'
+
+        options:
+        conj: replacement for 'and'
+        sep: separator. default ',', unless ',' is in the list then ';'
+        final_sep: final separator. default ',', unless ',' is in the list then ';'
+        conj_spaced: boolean. Should conj have spaces around it
+
+        """
+        if not words:
+            return ""
+        if len(words) == 1:
+            return words[0]
+
+        if conj_spaced:
+            if conj == "":
+                conj = " "
+            else:
+                conj = f" {conj} "
+
+        if len(words) == 2:
+            return f"{words[0]}{conj}{words[1]}"
+
+        if sep is None:
+            if "," in "".join(words):
+                sep = ";"
+            else:
+                sep = ","
+        if final_sep is None:
+            final_sep = sep
+
+        final_sep = f"{final_sep}{conj}"
+
+        if sep_spaced:
+            sep += " "
+
+        return f"{sep.join(words[0:-1])}{final_sep}{words[-1]}"
diff --git a/setuptools/_vendor/ordered_set-3.1.1.dist-info/REQUESTED b/setuptools/_vendor/inflect/compat/__init__.py
similarity index 100%
rename from setuptools/_vendor/ordered_set-3.1.1.dist-info/REQUESTED
rename to setuptools/_vendor/inflect/compat/__init__.py
diff --git a/setuptools/_vendor/inflect/compat/py38.py b/setuptools/_vendor/inflect/compat/py38.py
new file mode 100644
index 0000000000..a2d01bd98f
--- /dev/null
+++ b/setuptools/_vendor/inflect/compat/py38.py
@@ -0,0 +1,7 @@
+import sys
+
+
+if sys.version_info > (3, 9):
+    from typing import Annotated
+else:  # pragma: no cover
+    from typing_extensions import Annotated  # noqa: F401
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/REQUESTED b/setuptools/_vendor/inflect/py.typed
similarity index 100%
rename from setuptools/_vendor/packaging-24.0.dist-info/REQUESTED
rename to setuptools/_vendor/inflect/py.typed
diff --git a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/RECORD b/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/RECORD
deleted file mode 100644
index 783aa7d2b9..0000000000
--- a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/RECORD
+++ /dev/null
@@ -1,10 +0,0 @@
-jaraco.functools-4.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-jaraco.functools-4.0.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-jaraco.functools-4.0.0.dist-info/METADATA,sha256=nVOe_vWvaN2iWJ2aBVkhKvmvH-gFksNCXHwCNvcj65I,3078
-jaraco.functools-4.0.0.dist-info/RECORD,,
-jaraco.functools-4.0.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
-jaraco.functools-4.0.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
-jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642
-jaraco/functools/__init__.pyi,sha256=N4lLbdhMtrmwiK3UuMGhYsiOLLZx69CUNOdmFPSVh6Q,3982
-jaraco/functools/__pycache__/__init__.cpython-312.pyc,,
-jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/setuptools/_vendor/more_itertools-8.8.0.dist-info/INSTALLER b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/more_itertools-8.8.0.dist-info/INSTALLER
rename to setuptools/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
diff --git a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/LICENSE b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
similarity index 97%
rename from setuptools/_vendor/jaraco.text-3.7.0.dist-info/LICENSE
rename to setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
index 353924be0e..1bb5a44356 100644
--- a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/LICENSE
+++ b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
@@ -1,5 +1,3 @@
-Copyright Jason R. Coombs
-
 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
diff --git a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/METADATA b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
similarity index 78%
rename from setuptools/_vendor/jaraco.functools-4.0.0.dist-info/METADATA
rename to setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
index 581b308378..c865140ab2 100644
--- a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/METADATA
+++ b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
@@ -1,16 +1,16 @@
 Metadata-Version: 2.1
 Name: jaraco.functools
-Version: 4.0.0
+Version: 4.0.1
 Summary: Functools like those found in stdlib
-Home-page: https://github.com/jaraco/jaraco.functools
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/jaraco.functools
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
 Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
 License-File: LICENSE
 Requires-Dist: more-itertools
 Provides-Extra: docs
@@ -26,17 +26,16 @@ Requires-Dist: pytest >=6 ; extra == 'testing'
 Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
 Requires-Dist: pytest-cov ; extra == 'testing'
 Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
-Requires-Dist: pytest-ruff ; extra == 'testing'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
 Requires-Dist: jaraco.classes ; extra == 'testing'
-Requires-Dist: pytest-black >=0.3.7 ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy >=0.9.1 ; (platform_python_implementation != "PyPy") and extra == 'testing'
+Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
 
 .. image:: https://img.shields.io/pypi/v/jaraco.functools.svg
    :target: https://pypi.org/project/jaraco.functools
 
 .. image:: https://img.shields.io/pypi/pyversions/jaraco.functools.svg
 
-.. image:: https://github.com/jaraco/jaraco.functools/workflows/tests/badge.svg
+.. image:: https://github.com/jaraco/jaraco.functools/actions/workflows/main.yml/badge.svg
    :target: https://github.com/jaraco/jaraco.functools/actions?query=workflow%3A%22tests%22
    :alt: tests
 
@@ -44,14 +43,10 @@ Requires-Dist: pytest-mypy >=0.9.1 ; (platform_python_implementation != "PyPy")
     :target: https://github.com/astral-sh/ruff
     :alt: Ruff
 
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
-
 .. image:: https://readthedocs.org/projects/jaracofunctools/badge/?version=latest
    :target: https://jaracofunctools.readthedocs.io/en/latest/?badge=latest
 
-.. image:: https://img.shields.io/badge/skeleton-2023-informational
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
    :target: https://blog.jaraco.com/skeleton
 
 .. image:: https://tidelift.com/badges/package/pypi/jaraco.functools
diff --git a/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
new file mode 100644
index 0000000000..ef3bc21e92
--- /dev/null
+++ b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
@@ -0,0 +1,10 @@
+jaraco.functools-4.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.functools-4.0.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.functools-4.0.1.dist-info/METADATA,sha256=i4aUaQDX-jjdEQK5wevhegyx8JyLfin2HyvaSk3FHso,2891
+jaraco.functools-4.0.1.dist-info/RECORD,,
+jaraco.functools-4.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+jaraco.functools-4.0.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642
+jaraco/functools/__init__.pyi,sha256=gk3dsgHzo5F_U74HzAvpNivFAPCkPJ1b2-yCd62dfnw,3878
+jaraco/functools/__pycache__/__init__.cpython-312.pyc,,
+jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/WHEEL b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
similarity index 65%
rename from setuptools/_vendor/jaraco.text-3.7.0.dist-info/WHEEL
rename to setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
index becc9a66ea..bab98d6758 100644
--- a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/WHEEL
+++ b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
@@ -1,5 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.37.1)
+Generator: bdist_wheel (0.43.0)
 Root-Is-Purelib: true
 Tag: py3-none-any
 
diff --git a/setuptools/_vendor/jaraco.functools-4.0.0.dist-info/top_level.txt b/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
similarity index 100%
rename from setuptools/_vendor/jaraco.functools-4.0.0.dist-info/top_level.txt
rename to setuptools/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
diff --git a/setuptools/_vendor/ordered_set-3.1.1.dist-info/INSTALLER b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/ordered_set-3.1.1.dist-info/INSTALLER
rename to setuptools/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
diff --git a/setuptools/_vendor/zipp-3.7.0.dist-info/LICENSE b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
similarity index 97%
rename from setuptools/_vendor/zipp-3.7.0.dist-info/LICENSE
rename to setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
index 353924be0e..1bb5a44356 100644
--- a/setuptools/_vendor/zipp-3.7.0.dist-info/LICENSE
+++ b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
@@ -1,5 +1,3 @@
-Copyright Jason R. Coombs
-
 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
diff --git a/setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA
new file mode 100644
index 0000000000..0258a380f4
--- /dev/null
+++ b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA
@@ -0,0 +1,95 @@
+Metadata-Version: 2.1
+Name: jaraco.text
+Version: 3.12.1
+Summary: Module for text manipulation
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/jaraco.text
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: jaraco.functools
+Requires-Dist: jaraco.context >=4.1
+Requires-Dist: autocommand
+Requires-Dist: inflect
+Requires-Dist: more-itertools
+Requires-Dist: importlib-resources ; python_version < "3.9"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: pathlib2 ; (python_version < "3.10") and extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/jaraco.text.svg
+   :target: https://pypi.org/project/jaraco.text
+
+.. image:: https://img.shields.io/pypi/pyversions/jaraco.text.svg
+
+.. image:: https://github.com/jaraco/jaraco.text/actions/workflows/main.yml/badge.svg
+   :target: https://github.com/jaraco/jaraco.text/actions?query=workflow%3A%22tests%22
+   :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/jaracotext/badge/?version=latest
+   :target: https://jaracotext.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+   :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/jaraco.text
+   :target: https://tidelift.com/subscription/pkg/pypi-jaraco.text?utm_source=pypi-jaraco.text&utm_medium=readme
+
+
+This package provides handy routines for dealing with text, such as
+wrapping, substitution, trimming, stripping, prefix and suffix removal,
+line continuation, indentation, comment processing, identifier processing,
+values parsing, case insensitive comparison, and more. See the docs
+(linked in the badge above) for the detailed documentation and examples.
+
+Layouts
+=======
+
+One of the features of this package is the layouts module, which
+provides a simple example of translating keystrokes from one keyboard
+layout to another::
+
+    echo qwerty | python -m jaraco.text.to-dvorak
+    ',.pyf
+    echo  "',.pyf" | python -m jaraco.text.to-qwerty
+    qwerty
+
+Newline Reporting
+=================
+
+Need to know what newlines appear in a file?
+
+::
+
+    $ python -m jaraco.text.show-newlines README.rst
+    newline is '\n'
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD
new file mode 100644
index 0000000000..19e2d8402a
--- /dev/null
+++ b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD
@@ -0,0 +1,20 @@
+jaraco.text-3.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.text-3.12.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.text-3.12.1.dist-info/METADATA,sha256=AzWdm6ViMfDOPoQMfLWn2zgBQSGJScyqeN29TcuWXVI,3658
+jaraco.text-3.12.1.dist-info/RECORD,,
+jaraco.text-3.12.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+jaraco.text-3.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+jaraco.text-3.12.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
+jaraco/text/__init__.py,sha256=Y2YUqXR_orUoDaY4SkPRe6ZZhb5HUHB_Ah9RCNsVyho,16250
+jaraco/text/__pycache__/__init__.cpython-312.pyc,,
+jaraco/text/__pycache__/layouts.cpython-312.pyc,,
+jaraco/text/__pycache__/show-newlines.cpython-312.pyc,,
+jaraco/text/__pycache__/strip-prefix.cpython-312.pyc,,
+jaraco/text/__pycache__/to-dvorak.cpython-312.pyc,,
+jaraco/text/__pycache__/to-qwerty.cpython-312.pyc,,
+jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643
+jaraco/text/show-newlines.py,sha256=WGQa65e8lyhb92LUOLqVn6KaCtoeVgVws6WtSRmLk6w,904
+jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412
+jaraco/text/to-dvorak.py,sha256=1SNcbSsvISpXXg-LnybIHHY-RUFOQr36zcHkY1pWFqw,119
+jaraco/text/to-qwerty.py,sha256=s4UMQUnPwFn_dB5uZC27BurHOQcYondBfzIpVL5pEzw,119
diff --git a/setuptools/_vendor/zipp-3.7.0.dist-info/REQUESTED b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED
similarity index 100%
rename from setuptools/_vendor/zipp-3.7.0.dist-info/REQUESTED
rename to setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED
diff --git a/setuptools/_vendor/more_itertools-8.8.0.dist-info/WHEEL b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
similarity index 65%
rename from setuptools/_vendor/more_itertools-8.8.0.dist-info/WHEEL
rename to setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
index 385faab052..bab98d6758 100644
--- a/setuptools/_vendor/more_itertools-8.8.0.dist-info/WHEEL
+++ b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
@@ -1,5 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.36.2)
+Generator: bdist_wheel (0.43.0)
 Root-Is-Purelib: true
 Tag: py3-none-any
 
diff --git a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/top_level.txt b/setuptools/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
similarity index 100%
rename from setuptools/_vendor/jaraco.text-3.7.0.dist-info/top_level.txt
rename to setuptools/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
diff --git a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/METADATA b/setuptools/_vendor/jaraco.text-3.7.0.dist-info/METADATA
deleted file mode 100644
index 615a50a4ae..0000000000
--- a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/METADATA
+++ /dev/null
@@ -1,55 +0,0 @@
-Metadata-Version: 2.1
-Name: jaraco.text
-Version: 3.7.0
-Summary: Module for text manipulation
-Home-page: https://github.com/jaraco/jaraco.text
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
-License: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.6
-License-File: LICENSE
-Requires-Dist: jaraco.functools
-Requires-Dist: jaraco.context (>=4.1)
-Requires-Dist: importlib-resources ; python_version < "3.9"
-Provides-Extra: docs
-Requires-Dist: sphinx ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=8.2) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest (>=6) ; extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
-Requires-Dist: pytest-flake8 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler (>=1.0.1) ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/jaraco.text.svg
-   :target: `PyPI link`_
-
-.. image:: https://img.shields.io/pypi/pyversions/jaraco.text.svg
-   :target: `PyPI link`_
-
-.. _PyPI link: https://pypi.org/project/jaraco.text
-
-.. image:: https://github.com/jaraco/jaraco.text/workflows/tests/badge.svg
-   :target: https://github.com/jaraco/jaraco.text/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
-
-.. image:: https://readthedocs.org/projects/jaracotext/badge/?version=latest
-   :target: https://jaracotext.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2021-informational
-   :target: https://blog.jaraco.com/skeleton
-
-
diff --git a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/RECORD b/setuptools/_vendor/jaraco.text-3.7.0.dist-info/RECORD
deleted file mode 100644
index c698101cb4..0000000000
--- a/setuptools/_vendor/jaraco.text-3.7.0.dist-info/RECORD
+++ /dev/null
@@ -1,10 +0,0 @@
-jaraco.text-3.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-jaraco.text-3.7.0.dist-info/LICENSE,sha256=2z8CRrH5J48VhFuZ_sR4uLUG63ZIeZNyL4xuJUKF-vg,1050
-jaraco.text-3.7.0.dist-info/METADATA,sha256=5mcR1dY0cJNrM-VIkAFkpjOgvgzmq6nM1GfD0gwTIhs,2136
-jaraco.text-3.7.0.dist-info/RECORD,,
-jaraco.text-3.7.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-jaraco.text-3.7.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
-jaraco.text-3.7.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
-jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
-jaraco/text/__init__.py,sha256=I56MW2ZFwPrYXIxzqxMBe2A1t-T4uZBgEgAKe9-JoqM,15538
-jaraco/text/__pycache__/__init__.cpython-312.pyc,,
diff --git a/setuptools/_vendor/jaraco/context.py b/setuptools/_vendor/jaraco/context.py
index 0322c45d4a..61b27135df 100644
--- a/setuptools/_vendor/jaraco/context.py
+++ b/setuptools/_vendor/jaraco/context.py
@@ -14,7 +14,7 @@
 
 
 if sys.version_info < (3, 12):
-    from setuptools.extern.backports import tarfile
+    from backports import tarfile
 else:
     import tarfile
 
diff --git a/setuptools/_vendor/jaraco/functools/__init__.py b/setuptools/_vendor/jaraco/functools/__init__.py
index 130b87a485..ca6c22fa9b 100644
--- a/setuptools/_vendor/jaraco/functools/__init__.py
+++ b/setuptools/_vendor/jaraco/functools/__init__.py
@@ -7,7 +7,7 @@
 import types
 import warnings
 
-import setuptools.extern.more_itertools
+import more_itertools
 
 
 def compose(*funcs):
@@ -603,10 +603,10 @@ def splat(func):
     simple ``map``.
 
     >>> pairs = [(-1, 1), (0, 2)]
-    >>> setuptools.extern.more_itertools.consume(itertools.starmap(print, pairs))
+    >>> more_itertools.consume(itertools.starmap(print, pairs))
     -1 1
     0 2
-    >>> setuptools.extern.more_itertools.consume(map(splat(print), pairs))
+    >>> more_itertools.consume(map(splat(print), pairs))
     -1 1
     0 2
 
diff --git a/setuptools/_vendor/jaraco/functools/__init__.pyi b/setuptools/_vendor/jaraco/functools/__init__.pyi
index c2b9ab1757..19191bf93e 100644
--- a/setuptools/_vendor/jaraco/functools/__init__.pyi
+++ b/setuptools/_vendor/jaraco/functools/__init__.pyi
@@ -74,9 +74,6 @@ def result_invoke(
 def invoke(
     f: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs
 ) -> Callable[_P, _R]: ...
-def call_aside(
-    f: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs
-) -> Callable[_P, _R]: ...
 
 class Throttler(Generic[_R]):
     last_called: float
diff --git a/setuptools/_vendor/jaraco/text/__init__.py b/setuptools/_vendor/jaraco/text/__init__.py
index a0306d5ff5..0fabd0c3f0 100644
--- a/setuptools/_vendor/jaraco/text/__init__.py
+++ b/setuptools/_vendor/jaraco/text/__init__.py
@@ -6,10 +6,10 @@
 try:
     from importlib.resources import files  # type: ignore
 except ImportError:  # pragma: nocover
-    from setuptools.extern.importlib_resources import files  # type: ignore
+    from importlib_resources import files  # type: ignore
 
-from setuptools.extern.jaraco.functools import compose, method_cache
-from setuptools.extern.jaraco.context import ExceptionTrap
+from jaraco.functools import compose, method_cache
+from jaraco.context import ExceptionTrap
 
 
 def substitution(old, new):
@@ -66,7 +66,7 @@ class FoldedCase(str):
     >>> s in ["Hello World"]
     True
 
-    You may test for set inclusion, but candidate and elements
+    Allows testing for set inclusion, but candidate and elements
     must both be folded.
 
     >>> FoldedCase("Hello World") in {s}
@@ -92,37 +92,40 @@ class FoldedCase(str):
 
     >>> FoldedCase('hello') > FoldedCase('Hello')
     False
+
+    >>> FoldedCase('ß') == FoldedCase('ss')
+    True
     """
 
     def __lt__(self, other):
-        return self.lower() < other.lower()
+        return self.casefold() < other.casefold()
 
     def __gt__(self, other):
-        return self.lower() > other.lower()
+        return self.casefold() > other.casefold()
 
     def __eq__(self, other):
-        return self.lower() == other.lower()
+        return self.casefold() == other.casefold()
 
     def __ne__(self, other):
-        return self.lower() != other.lower()
+        return self.casefold() != other.casefold()
 
     def __hash__(self):
-        return hash(self.lower())
+        return hash(self.casefold())
 
     def __contains__(self, other):
-        return super().lower().__contains__(other.lower())
+        return super().casefold().__contains__(other.casefold())
 
     def in_(self, other):
         "Does self appear in other?"
         return self in FoldedCase(other)
 
-    # cache lower since it's likely to be called frequently.
+    # cache casefold since it's likely to be called frequently.
     @method_cache
-    def lower(self):
-        return super().lower()
+    def casefold(self):
+        return super().casefold()
 
     def index(self, sub):
-        return self.lower().index(sub.lower())
+        return self.casefold().index(sub.casefold())
 
     def split(self, splitter=' ', maxsplit=0):
         pattern = re.compile(re.escape(splitter), re.I)
@@ -224,9 +227,12 @@ def unwrap(s):
     return '\n'.join(cleaned)
 
 
+lorem_ipsum: str = (
+    files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
+)
 
 
-class Splitter(object):
+class Splitter:
     """object that will split a string with the given arguments for each call
 
     >>> s = Splitter(',')
@@ -276,7 +282,7 @@ class WordSet(tuple):
     >>> WordSet.parse("myABCClass")
     ('my', 'ABC', 'Class')
 
-    The result is a WordSet, so you can get the form you need.
+    The result is a WordSet, providing access to other forms.
 
     >>> WordSet.parse("myABCClass").underscore_separated()
     'my_ABC_Class'
@@ -363,7 +369,7 @@ def trim(self, item):
         return self.trim_left(item).trim_right(item)
 
     def __getitem__(self, item):
-        result = super(WordSet, self).__getitem__(item)
+        result = super().__getitem__(item)
         if isinstance(item, slice):
             result = WordSet(result)
         return result
@@ -578,7 +584,7 @@ def join_continuation(lines):
     ['foobarbaz']
 
     Not sure why, but...
-    The character preceeding the backslash is also elided.
+    The character preceding the backslash is also elided.
 
     >>> list(join_continuation(['goo\\', 'dly']))
     ['godly']
@@ -597,3 +603,22 @@ def join_continuation(lines):
             except StopIteration:
                 return
         yield item
+
+
+def read_newlines(filename, limit=1024):
+    r"""
+    >>> tmp_path = getfixture('tmp_path')
+    >>> filename = tmp_path / 'out.txt'
+    >>> _ = filename.write_text('foo\n', newline='', encoding='utf-8')
+    >>> read_newlines(filename)
+    '\n'
+    >>> _ = filename.write_text('foo\r\n', newline='', encoding='utf-8')
+    >>> read_newlines(filename)
+    '\r\n'
+    >>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='', encoding='utf-8')
+    >>> read_newlines(filename)
+    ('\r', '\n', '\r\n')
+    """
+    with open(filename, encoding='utf-8') as fp:
+        fp.read(limit)
+    return fp.newlines
diff --git a/setuptools/_vendor/jaraco/text/layouts.py b/setuptools/_vendor/jaraco/text/layouts.py
new file mode 100644
index 0000000000..9636f0f7b5
--- /dev/null
+++ b/setuptools/_vendor/jaraco/text/layouts.py
@@ -0,0 +1,25 @@
+qwerty = "-=qwertyuiop[]asdfghjkl;'zxcvbnm,./_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"
+dvorak = "[]',.pyfgcrl/=aoeuidhtns-;qjkxbmwvz{}\"<>PYFGCRL?+AOEUIDHTNS_:QJKXBMWVZ"
+
+
+to_dvorak = str.maketrans(qwerty, dvorak)
+to_qwerty = str.maketrans(dvorak, qwerty)
+
+
+def translate(input, translation):
+    """
+    >>> translate('dvorak', to_dvorak)
+    'ekrpat'
+    >>> translate('qwerty', to_qwerty)
+    'x,dokt'
+    """
+    return input.translate(translation)
+
+
+def _translate_stream(stream, translation):
+    """
+    >>> import io
+    >>> _translate_stream(io.StringIO('foo'), to_dvorak)
+    urr
+    """
+    print(translate(stream.read(), translation))
diff --git a/setuptools/_vendor/jaraco/text/show-newlines.py b/setuptools/_vendor/jaraco/text/show-newlines.py
new file mode 100644
index 0000000000..e11d1ba428
--- /dev/null
+++ b/setuptools/_vendor/jaraco/text/show-newlines.py
@@ -0,0 +1,33 @@
+import autocommand
+import inflect
+
+from more_itertools import always_iterable
+
+import jaraco.text
+
+
+def report_newlines(filename):
+    r"""
+    Report the newlines in the indicated file.
+
+    >>> tmp_path = getfixture('tmp_path')
+    >>> filename = tmp_path / 'out.txt'
+    >>> _ = filename.write_text('foo\nbar\n', newline='', encoding='utf-8')
+    >>> report_newlines(filename)
+    newline is '\n'
+    >>> filename = tmp_path / 'out.txt'
+    >>> _ = filename.write_text('foo\nbar\r\n', newline='', encoding='utf-8')
+    >>> report_newlines(filename)
+    newlines are ('\n', '\r\n')
+    """
+    newlines = jaraco.text.read_newlines(filename)
+    count = len(tuple(always_iterable(newlines)))
+    engine = inflect.engine()
+    print(
+        engine.plural_noun("newline", count),
+        engine.plural_verb("is", count),
+        repr(newlines),
+    )
+
+
+autocommand.autocommand(__name__)(report_newlines)
diff --git a/setuptools/_vendor/jaraco/text/strip-prefix.py b/setuptools/_vendor/jaraco/text/strip-prefix.py
new file mode 100644
index 0000000000..761717a9b9
--- /dev/null
+++ b/setuptools/_vendor/jaraco/text/strip-prefix.py
@@ -0,0 +1,21 @@
+import sys
+
+import autocommand
+
+from jaraco.text import Stripper
+
+
+def strip_prefix():
+    r"""
+    Strip any common prefix from stdin.
+
+    >>> import io, pytest
+    >>> getfixture('monkeypatch').setattr('sys.stdin', io.StringIO('abcdef\nabc123'))
+    >>> strip_prefix()
+    def
+    123
+    """
+    sys.stdout.writelines(Stripper.strip_prefix(sys.stdin).lines)
+
+
+autocommand.autocommand(__name__)(strip_prefix)
diff --git a/setuptools/_vendor/jaraco/text/to-dvorak.py b/setuptools/_vendor/jaraco/text/to-dvorak.py
new file mode 100644
index 0000000000..a6d5da80b3
--- /dev/null
+++ b/setuptools/_vendor/jaraco/text/to-dvorak.py
@@ -0,0 +1,6 @@
+import sys
+
+from . import layouts
+
+
+__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_dvorak)
diff --git a/setuptools/_vendor/jaraco/text/to-qwerty.py b/setuptools/_vendor/jaraco/text/to-qwerty.py
new file mode 100644
index 0000000000..abe2728662
--- /dev/null
+++ b/setuptools/_vendor/jaraco/text/to-qwerty.py
@@ -0,0 +1,6 @@
+import sys
+
+from . import layouts
+
+
+__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_qwerty)
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/INSTALLER b/setuptools/_vendor/more_itertools-10.3.0.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/packaging-24.0.dist-info/INSTALLER
rename to setuptools/_vendor/more_itertools-10.3.0.dist-info/INSTALLER
diff --git a/setuptools/_vendor/more_itertools-8.8.0.dist-info/LICENSE b/setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE
similarity index 100%
rename from setuptools/_vendor/more_itertools-8.8.0.dist-info/LICENSE
rename to setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE
diff --git a/setuptools/_vendor/more_itertools-8.8.0.dist-info/METADATA b/setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA
similarity index 60%
rename from setuptools/_vendor/more_itertools-8.8.0.dist-info/METADATA
rename to setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA
index bdaee6553f..fb41b0cfe6 100644
--- a/setuptools/_vendor/more_itertools-8.8.0.dist-info/METADATA
+++ b/setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA
@@ -1,28 +1,26 @@
 Metadata-Version: 2.1
 Name: more-itertools
-Version: 8.8.0
+Version: 10.3.0
 Summary: More routines for operating on iterables, beyond itertools
-Home-page: https://github.com/more-itertools/more-itertools
-Author: Erik Rose
-Author-email: erikrose@grinchcentral.com
-License: MIT
-Keywords: itertools,iterator,iteration,filter,peek,peekable,collate,chunk,chunked
-Platform: UNKNOWN
+Keywords: itertools,iterator,iteration,filter,peek,peekable,chunk,chunked
+Author-email: Erik Rose 
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: Natural Language :: English
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
-Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: 3 :: Only
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries
-Requires-Python: >=3.5
-Description-Content-Type: text/x-rst
+Project-URL: Homepage, https://github.com/more-itertools/more-itertools
 
 ==============
 More Itertools
@@ -36,124 +34,169 @@ for a variety of problems with the functions it provides. In ``more-itertools``
 we collect additional building blocks, recipes, and routines for working with
 Python iterables.
 
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Grouping               | `chunked `_,                                                                                                                        |
-|                        | `ichunked `_,                                                                                                                      |
-|                        | `sliced `_,                                                                                                                          |
-|                        | `distribute `_,                                                                                                                  |
-|                        | `divide `_,                                                                                                                          |
-|                        | `split_at `_,                                                                                                                      |
-|                        | `split_before `_,                                                                                                              |
-|                        | `split_after `_,                                                                                                                |
-|                        | `split_into `_,                                                                                                                  |
-|                        | `split_when `_,                                                                                                                  |
-|                        | `bucket `_,                                                                                                                          |
-|                        | `unzip `_,                                                                                                                            |
-|                        | `grouper `_,                                                                                                                        |
-|                        | `partition `_                                                                                                                     |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Lookahead and lookback | `spy `_,                                                                                                                                |
-|                        | `peekable `_,                                                                                                                      |
-|                        | `seekable `_                                                                                                                       |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Windowing              | `windowed `_,                                                                                                                      |
-|                        | `substrings `_,                                                                                                                  |
-|                        | `substrings_indexes `_,                                                                                                  |
-|                        | `stagger `_,                                                                                                                        |
-|                        | `windowed_complete `_,                                                                                                    |
-|                        | `pairwise `_                                                                                                                       |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Augmenting             | `count_cycle `_,                                                                                                                |
-|                        | `intersperse `_,                                                                                                                |
-|                        | `padded `_,                                                                                                                          |
-|                        | `mark_ends `_,                                                                                                                    |
-|                        | `repeat_last `_,                                                                                                                |
-|                        | `adjacent `_,                                                                                                                      |
-|                        | `groupby_transform `_,                                                                                                    |
-|                        | `padnone `_,                                                                                                                        |
-|                        | `ncycles `_                                                                                                                         |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Combining              | `collapse `_,                                                                                                                      |
-|                        | `sort_together `_,                                                                                                            |
-|                        | `interleave `_,                                                                                                                  |
-|                        | `interleave_longest `_,                                                                                                  |
-|                        | `zip_offset `_,                                                                                                                  |
-|                        | `zip_equal `_,                                                                                                                    |
-|                        | `dotproduct `_,                                                                                                                  |
-|                        | `convolve `_,                                                                                                                      |
-|                        | `flatten `_,                                                                                                                        |
-|                        | `roundrobin `_,                                                                                                                  |
-|                        | `prepend `_,                                                                                                                        |
-|                        | `value_chain `_                                                                                                                 |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Summarizing            | `ilen `_,                                                                                                                              |
-|                        | `unique_to_each `_,                                                                                                          |
-|                        | `sample `_,                                                                                                                          |
-|                        | `consecutive_groups `_,                                                                                                  |
-|                        | `run_length `_,                                                                                                                  |
-|                        | `map_reduce `_,                                                                                                                  |
-|                        | `exactly_n `_,                                                                                                                    |
-|                        | `is_sorted `_,                                                                                                                    |
-|                        | `all_equal `_,                                                                                                                    |
-|                        | `all_unique `_,                                                                                                                  |
-|                        | `first_true `_,                                                                                                                  |
-|                        | `quantify `_                                                                                                                       |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Selecting              | `islice_extended `_,                                                                                                        |
-|                        | `first `_,                                                                                                                            |
-|                        | `last `_,                                                                                                                              |
-|                        | `one `_,                                                                                                                                |
-|                        | `only `_,                                                                                                                              |
-|                        | `strip `_,                                                                                                                            |
-|                        | `lstrip `_,                                                                                                                          |
-|                        | `rstrip `_,                                                                                                                          |
-|                        | `filter_except `_                                                                                                             |
-|                        | `map_except `_                                                                                                                   |
-|                        | `nth_or_last `_,                                                                                                                |
-|                        | `nth `_,                                                                                                                                |
-|                        | `take `_,                                                                                                                              |
-|                        | `tail `_,                                                                                                                              |
-|                        | `unique_everseen `_,                                                                                                       |
-|                        | `unique_justseen `_                                                                                                         |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Combinatorics          | `distinct_permutations `_,                                                                                            |
-|                        | `distinct_combinations `_,                                                                                            |
-|                        | `circular_shifts `_,                                                                                                        |
-|                        | `partitions `_,                                                                                                                  |
-|                        | `set_partitions `_,                                                                                                          |
-|                        | `product_index `_,                                                                                                            |
-|                        | `combination_index `_,                                                                                                    |
-|                        | `permutation_index `_,                                                                                                    |
-|                        | `powerset `_,                                                                                                                      |
-|                        | `random_product `_,                                                                                                          |
-|                        | `random_permutation `_,                                                                                                  |
-|                        | `random_combination `_,                                                                                                  |
-|                        | `random_combination_with_replacement `_,                                                                |
-|                        | `nth_product `_                                                                                                                 |
-|                        | `nth_permutation `_                                                                                                         |
-|                        | `nth_combination `_                                                                                                         |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Wrapping               | `always_iterable `_,                                                                                                        |
-|                        | `always_reversible `_,                                                                                                    |
-|                        | `countable `_,                                                                                                                    |
-|                        | `consumer `_,                                                                                                                      |
-|                        | `with_iter `_,                                                                                                                    |
-|                        | `iter_except `_                                                                                                                 |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| Others                 | `locate `_,                                                                                                                          |
-|                        | `rlocate `_,                                                                                                                        |
-|                        | `replace `_,                                                                                                                        |
-|                        | `numeric_range `_,                                                                                                            |
-|                        | `side_effect `_,                                                                                                                |
-|                        | `iterate `_,                                                                                                                        |
-|                        | `difference `_,                                                                                                                  |
-|                        | `make_decorator `_,                                                                                                          |
-|                        | `SequenceView `_,                                                                                                              |
-|                        | `time_limited `_,                                                                                                              |
-|                        | `consume `_,                                                                                                                        |
-|                        | `tabulate `_,                                                                                                                      |
-|                        | `repeatfunc `_                                                                                                                   |
-+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Grouping               | `chunked `_,                                                                               |
+|                        | `ichunked `_,                                                                             |
+|                        | `chunked_even `_,                                                                     |
+|                        | `sliced `_,                                                                                 |
+|                        | `constrained_batches `_,                                                       |
+|                        | `distribute `_,                                                                         |
+|                        | `divide `_,                                                                                 |
+|                        | `split_at `_,                                                                             |
+|                        | `split_before `_,                                                                     |
+|                        | `split_after `_,                                                                       |
+|                        | `split_into `_,                                                                         |
+|                        | `split_when `_,                                                                         |
+|                        | `bucket `_,                                                                                 |
+|                        | `unzip `_,                                                                                   |
+|                        | `batched `_,                                                                               |
+|                        | `grouper `_,                                                                               |
+|                        | `partition `_,                                                                           |
+|                        | `transpose `_                                                                            |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Lookahead and lookback | `spy `_,                                                                                       |
+|                        | `peekable `_,                                                                             |
+|                        | `seekable `_                                                                              |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Windowing              | `windowed `_,                                                                             |
+|                        | `substrings `_,                                                                         |
+|                        | `substrings_indexes `_,                                                         |
+|                        | `stagger `_,                                                                               |
+|                        | `windowed_complete `_,                                                           |
+|                        | `pairwise `_,                                                                             |
+|                        | `triplewise `_,                                                                         |
+|                        | `sliding_window `_,                                                                 |
+|                        | `subslices `_                                                                            |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Augmenting             | `count_cycle `_,                                                                       |
+|                        | `intersperse `_,                                                                       |
+|                        | `padded `_,                                                                                 |
+|                        | `repeat_each `_,                                                                       |
+|                        | `mark_ends `_,                                                                           |
+|                        | `repeat_last `_,                                                                       |
+|                        | `adjacent `_,                                                                             |
+|                        | `groupby_transform `_,                                                           |
+|                        | `pad_none `_,                                                                             |
+|                        | `ncycles `_                                                                                |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Combining              | `collapse `_,                                                                             |
+|                        | `sort_together `_,                                                                   |
+|                        | `interleave `_,                                                                         |
+|                        | `interleave_longest `_,                                                         |
+|                        | `interleave_evenly `_,                                                           |
+|                        | `zip_offset `_,                                                                         |
+|                        | `zip_equal `_,                                                                           |
+|                        | `zip_broadcast `_,                                                                   |
+|                        | `flatten `_,                                                                               |
+|                        | `roundrobin `_,                                                                         |
+|                        | `prepend `_,                                                                               |
+|                        | `value_chain `_,                                                                       |
+|                        | `partial_product `_                                                                |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Summarizing            | `ilen `_,                                                                                     |
+|                        | `unique_to_each `_,                                                                 |
+|                        | `sample `_,                                                                                 |
+|                        | `consecutive_groups `_,                                                         |
+|                        | `run_length `_,                                                                         |
+|                        | `map_reduce `_,                                                                         |
+|                        | `join_mappings `_,                                                                   |
+|                        | `exactly_n `_,                                                                           |
+|                        | `is_sorted `_,                                                                           |
+|                        | `all_equal `_,                                                                           |
+|                        | `all_unique `_,                                                                         |
+|                        | `minmax `_,                                                                                 |
+|                        | `first_true `_,                                                                         |
+|                        | `quantify `_,                                                                             |
+|                        | `iequals `_                                                                                |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Selecting              | `islice_extended `_,                                                               |
+|                        | `first `_,                                                                                   |
+|                        | `last `_,                                                                                     |
+|                        | `one `_,                                                                                       |
+|                        | `only `_,                                                                                     |
+|                        | `strictly_n `_,                                                                         |
+|                        | `strip `_,                                                                                   |
+|                        | `lstrip `_,                                                                                 |
+|                        | `rstrip `_,                                                                                 |
+|                        | `filter_except `_,                                                                   |
+|                        | `map_except `_,                                                                         |
+|                        | `filter_map `_,                                                                         |
+|                        | `iter_suppress `_,                                                                   |
+|                        | `nth_or_last `_,                                                                       |
+|                        | `unique_in_window `_,                                                             |
+|                        | `before_and_after `_,                                                             |
+|                        | `nth `_,                                                                                       |
+|                        | `take `_,                                                                                     |
+|                        | `tail `_,                                                                                     |
+|                        | `unique_everseen `_,                                                               |
+|                        | `unique_justseen `_,                                                               |
+|                        | `unique `_,                                                                                 |
+|                        | `duplicates_everseen `_,                                                       |
+|                        | `duplicates_justseen `_,                                                       |
+|                        | `classify_unique `_,                                                               |
+|                        | `longest_common_prefix `_,                                                   |
+|                        | `takewhile_inclusive `_                                                        |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Math                   | `dft `_,                                                                                       |
+|                        | `idft `_,                                                                                     |
+|                        | `convolve `_,                                                                             |
+|                        | `dotproduct `_,                                                                         |
+|                        | `factor `_,                                                                                 |
+|                        | `matmul `_,                                                                                 |
+|                        | `polynomial_from_roots `_,                                                   |
+|                        | `polynomial_derivative `_,                                                   |
+|                        | `polynomial_eval `_,                                                               |
+|                        | `sieve `_,                                                                                   |
+|                        | `sum_of_squares `_,                                                                 |
+|                        | `totient `_                                                                                |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Combinatorics          | `distinct_permutations `_,                                                   |
+|                        | `distinct_combinations `_,                                                   |
+|                        | `circular_shifts `_,                                                               |
+|                        | `partitions `_,                                                                         |
+|                        | `set_partitions `_,                                                                 |
+|                        | `product_index `_,                                                                   |
+|                        | `combination_index `_,                                                           |
+|                        | `permutation_index `_,                                                           |
+|                        | `combination_with_replacement_index `_,                         |
+|                        | `gray_product  `_,                                                                    |
+|                        | `outer_product  `_,                                                                  |
+|                        | `powerset `_,                                                                             |
+|                        | `powerset_of_sets `_,                                                             |
+|                        | `random_product `_,                                                                 |
+|                        | `random_permutation `_,                                                         |
+|                        | `random_combination `_,                                                         |
+|                        | `random_combination_with_replacement `_,                       |
+|                        | `nth_product `_,                                                                       |
+|                        | `nth_permutation `_,                                                               |
+|                        | `nth_combination `_,                                                               |
+|                        | `nth_combination_with_replacement `_                              |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Wrapping               | `always_iterable `_,                                                               |
+|                        | `always_reversible `_,                                                           |
+|                        | `countable `_,                                                                           |
+|                        | `consumer `_,                                                                             |
+|                        | `with_iter `_,                                                                           |
+|                        | `iter_except `_                                                                        |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Others                 | `locate `_,                                                                                 |
+|                        | `rlocate `_,                                                                               |
+|                        | `replace `_,                                                                               |
+|                        | `numeric_range `_,                                                                   |
+|                        | `side_effect `_,                                                                       |
+|                        | `iterate `_,                                                                               |
+|                        | `difference `_,                                                                         |
+|                        | `make_decorator `_,                                                                 |
+|                        | `SequenceView `_,                                                                     |
+|                        | `time_limited `_,                                                                     |
+|                        | `map_if `_,                                                                                 |
+|                        | `iter_index `_,                                                                         |
+|                        | `consume `_,                                                                               |
+|                        | `tabulate `_,                                                                             |
+|                        | `repeatfunc `_,                                                                         |
+|                        | `reshape `_                                                                                |
+|                        | `doublestarmap `_                                                                    |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
 
 Getting started
@@ -204,6 +247,7 @@ Blog posts about ``more-itertools``:
 
 * `Yo, I heard you like decorators `__
 * `Tour of Python Itertools `__ (`Alternate `__)
+* `Real-World Python More Itertools `_
 
 
 Development
@@ -218,245 +262,5 @@ repository. Thanks for contributing!
 Version History
 ===============
 
-
-   :noindex:
-
-8.8.0
------
-
-* New functions
-    * countable (thanks to krzysieq)
-
-* Changes to existing functions
-    * split_before was updated to handle empy collections (thanks to TiunovNN)
-    * unique_everseen got a performance boost (thanks to Numerlor)
-    * The type hint for value_chain was corrected (thanks to vr2262)
-
-8.7.0
------
-
-* New functions
-    * convolve (from the Python itertools docs)
-    * product_index, combination_index, and permutation_index (thanks to N8Brooks)
-    * value_chain (thanks to jenstroeger)
-
-* Changes to existing functions
-    * distinct_combinations now uses a non-recursive algorithm (thanks to  knutdrand)
-    * pad_none is now the preferred name for padnone, though the latter remains available.
-    * pairwise will now use the Python standard library implementation on Python 3.10+
-    * sort_together now accepts a ``key`` argument (thanks to brianmaissy)
-    * seekable now has a ``peek`` method, and can indicate whether the iterator it's wrapping is exhausted (thanks to gsakkis)
-    * time_limited can now indicate whether its iterator has expired (thanks to roysmith)
-    * The implementation of unique_everseen was improved (thanks to plammens)
-
-* Other changes:
-    * Various documentation updates (thanks to cthoyt, Evantm, and cyphase)
-
-8.6.0
------
-
-* New itertools
-    * all_unique (thanks to brianmaissy)
-    * nth_product and nth_permutation (thanks to N8Brooks)
-
-* Changes to existing itertools
-    * chunked and sliced now accept a ``strict`` parameter (thanks to shlomif and jtwool)
-
-* Other changes
-    * Python 3.5 has reached its end of life and is no longer supported.
-    * Python 3.9 is officially supported.
-    * Various documentation fixes (thanks to timgates42)
-
-8.5.0
------
-
-* New itertools
-    * windowed_complete (thanks to MarcinKonowalczyk)
-
-* Changes to existing itertools:
-    * The is_sorted implementation was improved (thanks to cool-RR)
-    * The groupby_transform now accepts a ``reducefunc`` parameter.
-    * The last implementation was improved (thanks to brianmaissy)
-
-* Other changes
-    * Various documentation fixes (thanks to craigrosie, samuelstjean, PiCT0)
-    * The tests for distinct_combinations were improved (thanks to Minabsapi)
-    * Automated tests now run on GitHub Actions. All commits now check:
-        * That unit tests pass
-        * That the examples in docstrings work
-        * That test coverage remains high (using `coverage`)
-        * For linting errors (using `flake8`)
-        * For consistent style (using `black`)
-        * That the type stubs work (using `mypy`)
-        * That the docs build correctly (using `sphinx`)
-        * That packages build correctly (using `twine`)
-
-8.4.0
------
-
-* New itertools
-    * mark_ends (thanks to kalekundert)
-    * is_sorted
-
-* Changes to existing itertools:
-    * islice_extended can now be used with real slices (thanks to cool-RR)
-    * The implementations for filter_except and map_except were improved (thanks to SergBobrovsky)
-
-* Other changes
-    * Automated tests now enforce code style (using `black `__)
-    * The various signatures of islice_extended and numeric_range now appear in the docs (thanks to dsfulf)
-    * The test configuration for mypy was updated (thanks to blueyed)
-
-
-8.3.0
------
-
-* New itertools
-    * zip_equal (thanks to frankier and alexmojaki)
-
-* Changes to existing itertools:
-    * split_at, split_before, split_after, and split_when all got a ``maxsplit`` paramter (thanks to jferard and ilai-deutel)
-    * split_at now accepts a ``keep_separator`` parameter (thanks to jferard)
-    * distinct_permutations can now generate ``r``-length permutations (thanks to SergBobrovsky and ilai-deutel)
-    * The windowed implementation was improved  (thanks to SergBobrovsky)
-    * The spy implementation was improved (thanks to has2k1)
-
-* Other changes
-    * Type stubs are now tested with ``stubtest`` (thanks to ilai-deutel)
-    * Tests now run with ``python -m unittest`` instead of ``python setup.py test`` (thanks to jdufresne)
-
-8.2.0
------
-
-* Bug fixes
-    * The .pyi files for typing were updated. (thanks to blueyed and ilai-deutel)
-
-* Changes to existing itertools:
-    * numeric_range now behaves more like the built-in range. (thanks to jferard)
-    * bucket now allows for enumerating keys. (thanks to alexchandel)
-    * sliced now should now work for numpy arrays. (thanks to sswingle)
-    * seekable now has a ``maxlen`` parameter.
-
-8.1.0
------
-
-* Bug fixes
-    * partition works with ``pred=None`` again. (thanks to MSeifert04)
-
-* New itertools
-    * sample (thanks to tommyod)
-    * nth_or_last (thanks to d-ryzhikov)
-
-* Changes to existing itertools:
-    * The implementation for divide was improved. (thanks to jferard)
-
-8.0.2
------
-
-* Bug fixes
-    * The type stub files are now part of the wheel distribution (thanks to keisheiled)
-
-8.0.1
------
-
-* Bug fixes
-    * The type stub files now work for functions imported from the
-      root package (thanks to keisheiled)
-
-8.0.0
------
-
-* New itertools and other additions
-    * This library now ships type hints for use with mypy.
-      (thanks to ilai-deutel for the implementation, and to gabbard and fmagin for assistance)
-    * split_when (thanks to jferard)
-    * repeat_last (thanks to d-ryzhikov)
-
-* Changes to existing itertools:
-    * The implementation for set_partitions was improved. (thanks to jferard)
-    * partition was optimized for expensive predicates. (thanks to stevecj)
-    * unique_everseen and groupby_transform were re-factored. (thanks to SergBobrovsky)
-    * The implementation for difference was improved. (thanks to Jabbey92)
-
-* Other changes
-    * Python 3.4 has reached its end of life and is no longer supported.
-    * Python 3.8 is officially supported. (thanks to jdufresne)
-    * The ``collate`` function has been deprecated.
-      It raises a ``DeprecationWarning`` if used, and will be removed in a future release.
-    * one and only now provide more informative error messages. (thanks to gabbard)
-    * Unit tests were moved outside of the main package (thanks to jdufresne)
-    * Various documentation fixes (thanks to kriomant, gabbard, jdufresne)
-
-
-7.2.0
------
-
-* New itertools
-    * distinct_combinations
-    * set_partitions (thanks to kbarrett)
-    * filter_except
-    * map_except
-
-7.1.0
------
-
-* New itertools
-    * ichunked (thanks davebelais and youtux)
-    * only (thanks jaraco)
-
-* Changes to existing itertools:
-    * numeric_range now supports ranges specified by
-      ``datetime.datetime`` and ``datetime.timedelta`` objects (thanks to MSeifert04 for tests).
-    * difference now supports an *initial* keyword argument.
-
-
-* Other changes
-    * Various documentation fixes (thanks raimon49, pylang)
-
-7.0.0
------
-
-* New itertools:
-    * time_limited
-    * partitions (thanks to rominf and Saluev)
-    * substrings_indexes (thanks to rominf)
-
-* Changes to existing itertools:
-    * collapse now treats ``bytes`` objects the same as ``str`` objects. (thanks to Sweenpet)
-
-The major version update is due to the change in the default behavior of
-collapse. It now treats ``bytes`` objects the same as ``str`` objects.
-This aligns its behavior with always_iterable.
-
-.. code-block:: python
-
-    >>> from more_itertools import collapse
-    >>> iterable = [[1, 2], b'345', [6]]
-    >>> print(list(collapse(iterable)))
-    [1, 2, b'345', 6]
-
-6.0.0
------
-
-* Major changes:
-    * Python 2.7 is no longer supported. The 5.0.0 release will be the last
-      version targeting Python 2.7.
-    * All future releases will target the active versions of Python 3.
-      As of 2019, those are Python 3.4 and above.
-    * The ``six`` library is no longer a dependency.
-    * The accumulate function is no longer part of this library. You
-      may import a better version from the standard ``itertools`` module.
-
-* Changes to existing itertools:
-    * The order of the parameters in grouper have changed to match
-      the latest recipe in the itertools documentation. Use of the old order
-      will be supported in this release, but emit a  ``DeprecationWarning``.
-      The legacy behavior will be dropped in a future release. (thanks to jaraco)
-    * distinct_permutations was improved (thanks to jferard - see also `permutations with unique values `_ at StackOverflow.)
-    * An unused parameter was removed from substrings. (thanks to pylang)
-
-* Other changes:
-    * The docs for unique_everseen were improved. (thanks to jferard and MSeifert04)
-    * Several Python 2-isms were removed. (thanks to jaraco, MSeifert04, and hugovk)
-
+The version history can be found in `documentation `_.
 
diff --git a/setuptools/_vendor/more_itertools-10.3.0.dist-info/RECORD b/setuptools/_vendor/more_itertools-10.3.0.dist-info/RECORD
new file mode 100644
index 0000000000..f15f3fcdc5
--- /dev/null
+++ b/setuptools/_vendor/more_itertools-10.3.0.dist-info/RECORD
@@ -0,0 +1,16 @@
+more_itertools-10.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+more_itertools-10.3.0.dist-info/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053
+more_itertools-10.3.0.dist-info/METADATA,sha256=BFO90O-fLNiVQMpj7oIS5ztzgJUUQZ3TA32P5HH3N-A,36293
+more_itertools-10.3.0.dist-info/RECORD,,
+more_itertools-10.3.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+more_itertools-10.3.0.dist-info/WHEEL,sha256=rSgq_JpHF9fHR1lx53qwg_1-2LypZE_qmcuXbVUq948,81
+more_itertools/__init__.py,sha256=dtAbGjTDmn_ghiU5YXfhyDy0phAlXVdt5klZA5fUa-Q,149
+more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43
+more_itertools/__pycache__/__init__.cpython-312.pyc,,
+more_itertools/__pycache__/more.cpython-312.pyc,,
+more_itertools/__pycache__/recipes.cpython-312.pyc,,
+more_itertools/more.py,sha256=1E5kzFncRKTDw0cYv1yRXMgDdunstLQd1QStcnL6U90,148370
+more_itertools/more.pyi,sha256=iXXeqt48Nxe8VGmIWpkVXuKpR2FYNuu2DU8nQLWCCu0,21484
+more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+more_itertools/recipes.py,sha256=WedhhfhGVgr6zii8fIbGJVmRTw0ZKRiLKnYBDGJv4nY,28591
+more_itertools/recipes.pyi,sha256=T_mdGpcFdfrP3JSWbwzYP9JyNV-Go-7RPfpxfftAWlA,4617
diff --git a/setuptools/_vendor/more_itertools-10.3.0.dist-info/REQUESTED b/setuptools/_vendor/more_itertools-10.3.0.dist-info/REQUESTED
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/more_itertools-10.3.0.dist-info/WHEEL b/setuptools/_vendor/more_itertools-10.3.0.dist-info/WHEEL
new file mode 100644
index 0000000000..db4a255f3a
--- /dev/null
+++ b/setuptools/_vendor/more_itertools-10.3.0.dist-info/WHEEL
@@ -0,0 +1,4 @@
+Wheel-Version: 1.0
+Generator: flit 3.8.0
+Root-Is-Purelib: true
+Tag: py3-none-any
diff --git a/setuptools/_vendor/more_itertools-8.8.0.dist-info/RECORD b/setuptools/_vendor/more_itertools-8.8.0.dist-info/RECORD
deleted file mode 100644
index d1a6ea0d22..0000000000
--- a/setuptools/_vendor/more_itertools-8.8.0.dist-info/RECORD
+++ /dev/null
@@ -1,17 +0,0 @@
-more_itertools-8.8.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-more_itertools-8.8.0.dist-info/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053
-more_itertools-8.8.0.dist-info/METADATA,sha256=Gke9w7RnfiAvveik_iBBrzd0RjrDhsQ8uRYNBJdo4qQ,40482
-more_itertools-8.8.0.dist-info/RECORD,,
-more_itertools-8.8.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-more_itertools-8.8.0.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
-more_itertools-8.8.0.dist-info/top_level.txt,sha256=fAuqRXu9LPhxdB9ujJowcFOu1rZ8wzSpOW9_jlKis6M,15
-more_itertools/__init__.py,sha256=C7sXffHTXM3P-iaLPPfqfmDoxOflQMJLcM7ed9p3jak,82
-more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43
-more_itertools/__pycache__/__init__.cpython-312.pyc,,
-more_itertools/__pycache__/more.cpython-312.pyc,,
-more_itertools/__pycache__/recipes.cpython-312.pyc,,
-more_itertools/more.py,sha256=DlZa8v6JihVwfQ5zHidOA-xDE0orcQIUyxVnCaUoDKE,117968
-more_itertools/more.pyi,sha256=r32pH2raBC1zih3evK4fyvAXvrUamJqc6dgV7QCRL_M,14977
-more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-more_itertools/recipes.py,sha256=UkNkrsZyqiwgLHANBTmvMhCvaNSvSNYhyOpz_Jc55DY,16256
-more_itertools/recipes.pyi,sha256=9BpeKd5_qalYVSnuHfqPSCfoGgqnQY2Xu9pNwrDlHU8,3551
diff --git a/setuptools/_vendor/more_itertools-8.8.0.dist-info/top_level.txt b/setuptools/_vendor/more_itertools-8.8.0.dist-info/top_level.txt
deleted file mode 100644
index a5035befb3..0000000000
--- a/setuptools/_vendor/more_itertools-8.8.0.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-more_itertools
diff --git a/setuptools/_vendor/more_itertools/__init__.py b/setuptools/_vendor/more_itertools/__init__.py
index 19a169fc30..9c4662fc31 100644
--- a/setuptools/_vendor/more_itertools/__init__.py
+++ b/setuptools/_vendor/more_itertools/__init__.py
@@ -1,4 +1,6 @@
+"""More routines for operating on iterables, beyond itertools"""
+
 from .more import *  # noqa
 from .recipes import *  # noqa
 
-__version__ = '8.8.0'
+__version__ = '10.3.0'
diff --git a/setuptools/_vendor/more_itertools/more.py b/setuptools/_vendor/more_itertools/more.py
old mode 100644
new mode 100755
index e6fca4d47f..7b481907da
--- a/setuptools/_vendor/more_itertools/more.py
+++ b/setuptools/_vendor/more_itertools/more.py
@@ -1,11 +1,13 @@
+import math
 import warnings
 
 from collections import Counter, defaultdict, deque, abc
 from collections.abc import Sequence
-from functools import partial, reduce, wraps
-from heapq import merge, heapify, heapreplace, heappop
+from functools import cached_property, partial, reduce, wraps
+from heapq import heapify, heapreplace, heappop
 from itertools import (
     chain,
+    combinations,
     compress,
     count,
     cycle,
@@ -17,72 +19,106 @@
     takewhile,
     tee,
     zip_longest,
+    product,
 )
-from math import exp, factorial, floor, log
+from math import comb, e, exp, factorial, floor, fsum, log, perm, tau
 from queue import Empty, Queue
 from random import random, randrange, uniform
-from operator import itemgetter, mul, sub, gt, lt
+from operator import itemgetter, mul, sub, gt, lt, ge, le
 from sys import hexversion, maxsize
 from time import monotonic
 
 from .recipes import (
+    _marker,
+    _zip_equal,
+    UnequalIterablesError,
     consume,
     flatten,
     pairwise,
     powerset,
     take,
     unique_everseen,
+    all_equal,
+    batched,
 )
 
 __all__ = [
     'AbortThread',
+    'SequenceView',
+    'UnequalIterablesError',
     'adjacent',
+    'all_unique',
     'always_iterable',
     'always_reversible',
     'bucket',
     'callback_iter',
     'chunked',
+    'chunked_even',
     'circular_shifts',
     'collapse',
-    'collate',
+    'combination_index',
+    'combination_with_replacement_index',
     'consecutive_groups',
+    'constrained_batches',
     'consumer',
-    'countable',
     'count_cycle',
-    'mark_ends',
+    'countable',
+    'dft',
     'difference',
     'distinct_combinations',
     'distinct_permutations',
     'distribute',
     'divide',
+    'doublestarmap',
+    'duplicates_everseen',
+    'duplicates_justseen',
+    'classify_unique',
     'exactly_n',
     'filter_except',
+    'filter_map',
     'first',
+    'gray_product',
     'groupby_transform',
+    'ichunked',
+    'iequals',
+    'idft',
     'ilen',
-    'interleave_longest',
     'interleave',
+    'interleave_evenly',
+    'interleave_longest',
     'intersperse',
+    'is_sorted',
     'islice_extended',
     'iterate',
-    'ichunked',
-    'is_sorted',
+    'iter_suppress',
+    'join_mappings',
     'last',
     'locate',
+    'longest_common_prefix',
     'lstrip',
     'make_decorator',
     'map_except',
+    'map_if',
     'map_reduce',
+    'mark_ends',
+    'minmax',
     'nth_or_last',
     'nth_permutation',
     'nth_product',
+    'nth_combination_with_replacement',
     'numeric_range',
     'one',
     'only',
+    'outer_product',
     'padded',
+    'partial_product',
     'partitions',
-    'set_partitions',
     'peekable',
+    'permutation_index',
+    'powerset_of_sets',
+    'product_index',
+    'raise_',
+    'repeat_each',
     'repeat_last',
     'replace',
     'rlocate',
@@ -90,37 +126,37 @@
     'run_length',
     'sample',
     'seekable',
-    'SequenceView',
+    'set_partitions',
     'side_effect',
     'sliced',
     'sort_together',
-    'split_at',
     'split_after',
+    'split_at',
     'split_before',
-    'split_when',
     'split_into',
+    'split_when',
     'spy',
     'stagger',
     'strip',
+    'strictly_n',
     'substrings',
     'substrings_indexes',
+    'takewhile_inclusive',
     'time_limited',
+    'unique_in_window',
     'unique_to_each',
     'unzip',
+    'value_chain',
     'windowed',
+    'windowed_complete',
     'with_iter',
-    'UnequalIterablesError',
+    'zip_broadcast',
     'zip_equal',
     'zip_offset',
-    'windowed_complete',
-    'all_unique',
-    'value_chain',
-    'product_index',
-    'combination_index',
-    'permutation_index',
 ]
 
-_marker = object()
+# math.sumprod is available for Python 3.12+
+_fsumprod = getattr(math, 'sumprod', lambda x, y: fsum(map(mul, x, y)))
 
 
 def chunked(iterable, n, strict=False):
@@ -144,6 +180,8 @@ def chunked(iterable, n, strict=False):
     """
     iterator = iter(partial(take, n, iter(iterable)), [])
     if strict:
+        if n is None:
+            raise ValueError('n must not be None when using strict mode.')
 
         def ret():
             for chunk in iterator:
@@ -173,15 +211,14 @@ def first(iterable, default=_marker):
     ``next(iter(iterable), default)``.
 
     """
-    try:
-        return next(iter(iterable))
-    except StopIteration as e:
-        if default is _marker:
-            raise ValueError(
-                'first() was called on an empty iterable, and no '
-                'default value was provided.'
-            ) from e
-        return default
+    for item in iterable:
+        return item
+    if default is _marker:
+        raise ValueError(
+            'first() was called on an empty iterable, and no '
+            'default value was provided.'
+        )
+    return default
 
 
 def last(iterable, default=_marker):
@@ -395,44 +432,6 @@ def __getitem__(self, index):
         return self._cache[index]
 
 
-def collate(*iterables, **kwargs):
-    """Return a sorted merge of the items from each of several already-sorted
-    *iterables*.
-
-        >>> list(collate('ACDZ', 'AZ', 'JKL'))
-        ['A', 'A', 'C', 'D', 'J', 'K', 'L', 'Z', 'Z']
-
-    Works lazily, keeping only the next value from each iterable in memory. Use
-    :func:`collate` to, for example, perform a n-way mergesort of items that
-    don't fit in memory.
-
-    If a *key* function is specified, the iterables will be sorted according
-    to its result:
-
-        >>> key = lambda s: int(s)  # Sort by numeric value, not by string
-        >>> list(collate(['1', '10'], ['2', '11'], key=key))
-        ['1', '2', '10', '11']
-
-
-    If the *iterables* are sorted in descending order, set *reverse* to
-    ``True``:
-
-        >>> list(collate([5, 3, 1], [4, 2, 0], reverse=True))
-        [5, 4, 3, 2, 1, 0]
-
-    If the elements of the passed-in iterables are out of order, you might get
-    unexpected results.
-
-    On Python 3.5+, this function is an alias for :func:`heapq.merge`.
-
-    """
-    warnings.warn(
-        "collate is no longer part of more_itertools, use heapq.merge",
-        DeprecationWarning,
-    )
-    return merge(*iterables, **kwargs)
-
-
 def consumer(func):
     """Decorator that automatically advances a PEP-342-style "reverse iterator"
     to its first yield point so you don't have to call ``next()`` on it
@@ -492,7 +491,10 @@ def iterate(func, start):
     """
     while True:
         yield start
-        start = func(start)
+        try:
+            start = func(start)
+        except StopIteration:
+            break
 
 
 def with_iter(context_manager):
@@ -558,10 +560,10 @@ def one(iterable, too_short=None, too_long=None):
 
     try:
         first_value = next(it)
-    except StopIteration as e:
+    except StopIteration as exc:
         raise (
             too_short or ValueError('too few items in iterable (expected 1)')
-        ) from e
+        ) from exc
 
     try:
         second_value = next(it)
@@ -577,6 +579,87 @@ def one(iterable, too_short=None, too_long=None):
     return first_value
 
 
+def raise_(exception, *args):
+    raise exception(*args)
+
+
+def strictly_n(iterable, n, too_short=None, too_long=None):
+    """Validate that *iterable* has exactly *n* items and return them if
+    it does. If it has fewer than *n* items, call function *too_short*
+    with those items. If it has more than *n* items, call function
+    *too_long* with the first ``n + 1`` items.
+
+        >>> iterable = ['a', 'b', 'c', 'd']
+        >>> n = 4
+        >>> list(strictly_n(iterable, n))
+        ['a', 'b', 'c', 'd']
+
+    Note that the returned iterable must be consumed in order for the check to
+    be made.
+
+    By default, *too_short* and *too_long* are functions that raise
+    ``ValueError``.
+
+        >>> list(strictly_n('ab', 3))  # doctest: +IGNORE_EXCEPTION_DETAIL
+        Traceback (most recent call last):
+        ...
+        ValueError: too few items in iterable (got 2)
+
+        >>> list(strictly_n('abc', 2))  # doctest: +IGNORE_EXCEPTION_DETAIL
+        Traceback (most recent call last):
+        ...
+        ValueError: too many items in iterable (got at least 3)
+
+    You can instead supply functions that do something else.
+    *too_short* will be called with the number of items in *iterable*.
+    *too_long* will be called with `n + 1`.
+
+        >>> def too_short(item_count):
+        ...     raise RuntimeError
+        >>> it = strictly_n('abcd', 6, too_short=too_short)
+        >>> list(it)  # doctest: +IGNORE_EXCEPTION_DETAIL
+        Traceback (most recent call last):
+        ...
+        RuntimeError
+
+        >>> def too_long(item_count):
+        ...     print('The boss is going to hear about this')
+        >>> it = strictly_n('abcdef', 4, too_long=too_long)
+        >>> list(it)
+        The boss is going to hear about this
+        ['a', 'b', 'c', 'd']
+
+    """
+    if too_short is None:
+        too_short = lambda item_count: raise_(
+            ValueError,
+            'Too few items in iterable (got {})'.format(item_count),
+        )
+
+    if too_long is None:
+        too_long = lambda item_count: raise_(
+            ValueError,
+            'Too many items in iterable (got at least {})'.format(item_count),
+        )
+
+    it = iter(iterable)
+    for i in range(n):
+        try:
+            item = next(it)
+        except StopIteration:
+            too_short(i)
+            return
+        else:
+            yield item
+
+    try:
+        next(it)
+    except StopIteration:
+        pass
+    else:
+        too_long(n + 1)
+
+
 def distinct_permutations(iterable, r=None):
     """Yield successive distinct permutations of the elements in *iterable*.
 
@@ -601,6 +684,7 @@ def distinct_permutations(iterable, r=None):
         [(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]
 
     """
+
     # Algorithm: https://w.wiki/Qai
     def _full(A):
         while True:
@@ -691,8 +775,8 @@ def intersperse(e, iterable, n=1):
     if n == 0:
         raise ValueError('n must be > 0')
     elif n == 1:
-        # interleave(repeat(e), iterable) -> e, x_0, e, e, x_1, e, x_2...
-        # islice(..., 1, None) -> x_0, e, e, x_1, e, x_2...
+        # interleave(repeat(e), iterable) -> e, x_0, e, x_1, e, x_2...
+        # islice(..., 1, None) -> x_0, e, x_1, e, x_2...
         return islice(interleave(repeat(e), iterable), 1, None)
     else:
         # interleave(filler, chunks) -> [e], [x_0, x_1], [e], [x_2, x_3]...
@@ -766,24 +850,31 @@ def windowed(seq, n, fillvalue=None, step=1):
     if n < 0:
         raise ValueError('n must be >= 0')
     if n == 0:
-        yield tuple()
+        yield ()
         return
     if step < 1:
         raise ValueError('step must be >= 1')
 
-    window = deque(maxlen=n)
-    i = n
-    for _ in map(window.append, seq):
-        i -= 1
-        if not i:
-            i = step
-            yield tuple(window)
-
-    size = len(window)
-    if size < n:
-        yield tuple(chain(window, repeat(fillvalue, n - size)))
-    elif 0 < i < min(step, n):
-        window += (fillvalue,) * i
+    iterable = iter(seq)
+
+    # Generate first window
+    window = deque(islice(iterable, n), maxlen=n)
+
+    # Deal with the first window not being full
+    if not window:
+        return
+    if len(window) < n:
+        yield tuple(window) + ((fillvalue,) * (n - len(window)))
+        return
+    yield tuple(window)
+
+    # Create the filler for the next windows. The padding ensures
+    # we have just enough elements to fill the last window.
+    padding = (fillvalue,) * (n - 1 if step >= n else step - 1)
+    filler = map(window.append, chain(iterable, padding))
+
+    # Generate the rest of the windows
+    for _ in islice(filler, step - 1, None, step):
         yield tuple(window)
 
 
@@ -848,7 +939,7 @@ def substrings_indexes(seq, reverse=False):
 
 
 class bucket:
-    """Wrap *iterable* and return an object that buckets it iterable into
+    """Wrap *iterable* and return an object that buckets the iterable into
     child iterables based on a *key* function.
 
         >>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3']
@@ -1016,6 +1107,72 @@ def interleave_longest(*iterables):
     return (x for x in i if x is not _marker)
 
 
+def interleave_evenly(iterables, lengths=None):
+    """
+    Interleave multiple iterables so that their elements are evenly distributed
+    throughout the output sequence.
+
+    >>> iterables = [1, 2, 3, 4, 5], ['a', 'b']
+    >>> list(interleave_evenly(iterables))
+    [1, 2, 'a', 3, 4, 'b', 5]
+
+    >>> iterables = [[1, 2, 3], [4, 5], [6, 7, 8]]
+    >>> list(interleave_evenly(iterables))
+    [1, 6, 4, 2, 7, 3, 8, 5]
+
+    This function requires iterables of known length. Iterables without
+    ``__len__()`` can be used by manually specifying lengths with *lengths*:
+
+    >>> from itertools import combinations, repeat
+    >>> iterables = [combinations(range(4), 2), ['a', 'b', 'c']]
+    >>> lengths = [4 * (4 - 1) // 2, 3]
+    >>> list(interleave_evenly(iterables, lengths=lengths))
+    [(0, 1), (0, 2), 'a', (0, 3), (1, 2), 'b', (1, 3), (2, 3), 'c']
+
+    Based on Bresenham's algorithm.
+    """
+    if lengths is None:
+        try:
+            lengths = [len(it) for it in iterables]
+        except TypeError:
+            raise ValueError(
+                'Iterable lengths could not be determined automatically. '
+                'Specify them with the lengths keyword.'
+            )
+    elif len(iterables) != len(lengths):
+        raise ValueError('Mismatching number of iterables and lengths.')
+
+    dims = len(lengths)
+
+    # sort iterables by length, descending
+    lengths_permute = sorted(
+        range(dims), key=lambda i: lengths[i], reverse=True
+    )
+    lengths_desc = [lengths[i] for i in lengths_permute]
+    iters_desc = [iter(iterables[i]) for i in lengths_permute]
+
+    # the longest iterable is the primary one (Bresenham: the longest
+    # distance along an axis)
+    delta_primary, deltas_secondary = lengths_desc[0], lengths_desc[1:]
+    iter_primary, iters_secondary = iters_desc[0], iters_desc[1:]
+    errors = [delta_primary // dims] * len(deltas_secondary)
+
+    to_yield = sum(lengths)
+    while to_yield:
+        yield next(iter_primary)
+        to_yield -= 1
+        # update errors for each secondary iterable
+        errors = [e - delta for e, delta in zip(errors, deltas_secondary)]
+
+        # those iterables for which the error is negative are yielded
+        # ("diagonal step" in Bresenham)
+        for i, e_ in enumerate(errors):
+            if e_ < 0:
+                yield next(iters_secondary[i])
+                to_yield -= 1
+                errors[i] += delta_primary
+
+
 def collapse(iterable, base_type=None, levels=None):
     """Flatten an iterable with multiple levels of nesting (e.g., a list of
     lists of tuples) into non-iterable types.
@@ -1042,26 +1199,38 @@ def collapse(iterable, base_type=None, levels=None):
     ['a', ['b'], 'c', ['d']]
 
     """
+    stack = deque()
+    # Add our first node group, treat the iterable as a single node
+    stack.appendleft((0, repeat(iterable, 1)))
 
-    def walk(node, level):
-        if (
-            ((levels is not None) and (level > levels))
-            or isinstance(node, (str, bytes))
-            or ((base_type is not None) and isinstance(node, base_type))
-        ):
-            yield node
-            return
+    while stack:
+        node_group = stack.popleft()
+        level, nodes = node_group
 
-        try:
-            tree = iter(node)
-        except TypeError:
-            yield node
-            return
-        else:
-            for child in tree:
-                yield from walk(child, level + 1)
+        # Check if beyond max level
+        if levels is not None and level > levels:
+            yield from nodes
+            continue
 
-    yield from walk(iterable, 0)
+        for node in nodes:
+            # Check if done iterating
+            if isinstance(node, (str, bytes)) or (
+                (base_type is not None) and isinstance(node, base_type)
+            ):
+                yield node
+            # Otherwise try to create child nodes
+            else:
+                try:
+                    tree = iter(node)
+                except TypeError:
+                    yield node
+                else:
+                    # Save our current location
+                    stack.appendleft(node_group)
+                    # Append the new child node
+                    stack.appendleft((level + 1, tree))
+                    # Break to process child node
+                    break
 
 
 def side_effect(func, iterable, chunk_size=None, before=None, after=None):
@@ -1176,7 +1345,7 @@ def split_at(iterable, pred, maxsplit=-1, keep_separator=False):
         [[0], [2], [4, 5, 6, 7, 8, 9]]
 
     By default, the delimiting items are not included in the output.
-    The include them, set *keep_separator* to ``True``.
+    To include them, set *keep_separator* to ``True``.
 
         >>> list(split_at('abcdcba', lambda x: x == 'b', keep_separator=True))
         [['a'], ['b'], ['c', 'd', 'c'], ['b'], ['a']]
@@ -1266,7 +1435,9 @@ def split_after(iterable, pred, maxsplit=-1):
         if pred(item) and buf:
             yield buf
             if maxsplit == 1:
-                yield list(it)
+                buf = list(it)
+                if buf:
+                    yield buf
                 return
             buf = []
             maxsplit -= 1
@@ -1372,28 +1543,50 @@ def padded(iterable, fillvalue=None, n=None, next_multiple=False):
         [1, 2, 3, '?', '?']
 
     If *next_multiple* is ``True``, *fillvalue* will be emitted until the
-    number of items emitted is a multiple of *n*::
+    number of items emitted is a multiple of *n*:
 
         >>> list(padded([1, 2, 3, 4], n=3, next_multiple=True))
         [1, 2, 3, 4, None, None]
 
     If *n* is ``None``, *fillvalue* will be emitted indefinitely.
 
+    To create an *iterable* of exactly size *n*, you can truncate with
+    :func:`islice`.
+
+        >>> list(islice(padded([1, 2, 3], '?'), 5))
+        [1, 2, 3, '?', '?']
+        >>> list(islice(padded([1, 2, 3, 4, 5, 6, 7, 8], '?'), 5))
+        [1, 2, 3, 4, 5]
+
     """
-    it = iter(iterable)
+    iterable = iter(iterable)
+    iterable_with_repeat = chain(iterable, repeat(fillvalue))
+
     if n is None:
-        yield from chain(it, repeat(fillvalue))
+        return iterable_with_repeat
     elif n < 1:
         raise ValueError('n must be at least 1')
+    elif next_multiple:
+
+        def slice_generator():
+            for first in iterable:
+                yield (first,)
+                yield islice(iterable_with_repeat, n - 1)
+
+        # While elements exist produce slices of size n
+        return chain.from_iterable(slice_generator())
     else:
-        item_count = 0
-        for item in it:
-            yield item
-            item_count += 1
+        # Ensure the first batch is at least size n then iterate
+        return chain(islice(iterable_with_repeat, n), iterable)
 
-        remaining = (n - item_count) % n if next_multiple else n - item_count
-        for _ in range(remaining):
-            yield fillvalue
+
+def repeat_each(iterable, n=2):
+    """Repeat each element in *iterable* *n* times.
+
+    >>> list(repeat_each('ABC', 3))
+    ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C']
+    """
+    return chain.from_iterable(map(repeat, iterable, repeat(n)))
 
 
 def repeat_last(iterable, default=None):
@@ -1439,7 +1632,9 @@ def distribute(n, iterable):
         [[1], [2], [3], [], []]
 
     This function uses :func:`itertools.tee` and may require significant
-    storage. If you need the order items in the smaller iterables to match the
+    storage.
+
+    If you need the order items in the smaller iterables to match the
     original iterable, see :func:`divide`.
 
     """
@@ -1478,25 +1673,6 @@ def stagger(iterable, offsets=(-1, 0, 1), longest=False, fillvalue=None):
     )
 
 
-class UnequalIterablesError(ValueError):
-    def __init__(self, details=None):
-        msg = 'Iterables have different lengths'
-        if details is not None:
-            msg += (': index 0 has length {}; index {} has length {}').format(
-                *details
-            )
-
-        super().__init__(msg)
-
-
-def _zip_equal_generator(iterables):
-    for combo in zip_longest(*iterables, fillvalue=_marker):
-        for val in combo:
-            if val is _marker:
-                raise UnequalIterablesError()
-        yield combo
-
-
 def zip_equal(*iterables):
     """``zip`` the input *iterables* together, but raise
     ``UnequalIterablesError`` if they aren't all the same length.
@@ -1524,23 +1700,8 @@ def zip_equal(*iterables):
             ),
             DeprecationWarning,
         )
-    # Check whether the iterables are all the same size.
-    try:
-        first_size = len(iterables[0])
-        for i, it in enumerate(iterables[1:], 1):
-            size = len(it)
-            if size != first_size:
-                break
-        else:
-            # If we didn't break out, we can use the built-in zip.
-            return zip(*iterables)
 
-        # If we did break out, there was a mismatch.
-        raise UnequalIterablesError(details=(first_size, i, size))
-    # If any one of the iterables didn't have a length, start reading
-    # them until one runs out.
-    except TypeError:
-        return _zip_equal_generator(iterables)
+    return _zip_equal(*iterables)
 
 
 def zip_offset(*iterables, offsets, longest=False, fillvalue=None):
@@ -1653,7 +1814,7 @@ def unzip(iterable):
     of the zipped *iterable*.
 
     The ``i``-th iterable contains the ``i``-th element from each element
-    of the zipped iterable. The first element is used to to determine the
+    of the zipped iterable. The first element is used to determine the
     length of the remaining elements.
 
         >>> iterable = [('a', 1), ('b', 2), ('c', 3), ('d', 4)]
@@ -1721,9 +1882,9 @@ def divide(n, iterable):
         >>> [list(c) for c in children]
         [[1], [2], [3], [], []]
 
-    This function will exhaust the iterable before returning and may require
-    significant storage. If order is not important, see :func:`distribute`,
-    which does not first pull the iterable into memory.
+    This function will exhaust the iterable before returning.
+    If order is not important, see :func:`distribute`, which does not first
+    pull the iterable into memory.
 
     """
     if n < 1:
@@ -1965,7 +2126,6 @@ def __init__(self, *args):
         if self._step == self._zero:
             raise ValueError('numeric_range() arg 3 must not be zero')
         self._growing = self._step > self._zero
-        self._init_len()
 
     def __bool__(self):
         if self._growing:
@@ -2041,7 +2201,8 @@ def __iter__(self):
     def __len__(self):
         return self._len
 
-    def _init_len(self):
+    @cached_property
+    def _len(self):
         if self._growing:
             start = self._start
             stop = self._stop
@@ -2052,10 +2213,10 @@ def _init_len(self):
             step = -self._step
         distance = stop - start
         if distance <= self._zero:
-            self._len = 0
+            return 0
         else:  # distance > 0 and step > 0: regular euclidean division
             q, r = divmod(distance, step)
-            self._len = int(q) + int(r != self._zero)
+            return int(q) + int(r != self._zero)
 
     def __reduce__(self):
         return numeric_range, (self._start, self._stop, self._step)
@@ -2203,6 +2364,16 @@ def locate(iterable, pred=bool, window_size=None):
     return compress(count(), starmap(pred, it))
 
 
+def longest_common_prefix(iterables):
+    """Yield elements of the longest common prefix amongst given *iterables*.
+
+    >>> ''.join(longest_common_prefix(['abcd', 'abc', 'abf']))
+    'ab'
+
+    """
+    return (c[0] for c in takewhile(all_equal, zip(*iterables)))
+
+
 def lstrip(iterable, pred):
     """Yield the items from *iterable*, but strip any from the beginning
     for which *pred* returns ``True``.
@@ -2511,7 +2682,7 @@ def difference(iterable, func=sub, *, initial=None):
     if initial is not None:
         first = []
 
-    return chain(first, starmap(func, zip(b, a)))
+    return chain(first, map(func, b, a))
 
 
 class SequenceView(Sequence):
@@ -2585,6 +2756,9 @@ class seekable:
         >>> it.seek(10)
         >>> next(it)
         '10'
+        >>> it.relative_seek(-2)  # Seeking relative to the current position
+        >>> next(it)
+        '9'
         >>> it.seek(20)  # Seeking past the end of the source isn't a problem
         >>> list(it)
         []
@@ -2698,6 +2872,10 @@ def seek(self, index):
         if remainder > 0:
             consume(self, remainder)
 
+    def relative_seek(self, count):
+        index = len(self._cache)
+        self.seek(max(index + count, 0))
+
 
 class run_length:
     """
@@ -2804,6 +2982,7 @@ def make_decorator(wrapping_func, result_index=0):
         '7'
 
     """
+
     # See https://sites.google.com/site/bbayles/index/decorator_factory for
     # notes on how this works.
     def decorator(*wrapping_args, **wrapping_kwargs):
@@ -3090,6 +3269,8 @@ class time_limited:
     stops if  the time elapsed is greater than *limit_seconds*. If your time
     limit is 1 second, but it takes 2 seconds to generate the first item from
     the iterable, the function will run for 2 seconds and not yield anything.
+    As a special case, when *limit_seconds* is zero, the iterator never
+    returns anything.
 
     """
 
@@ -3105,6 +3286,9 @@ def __iter__(self):
         return self
 
     def __next__(self):
+        if self.limit_seconds == 0:
+            self.timed_out = True
+            raise StopIteration
         item = next(self._iterable)
         if monotonic() - self._start_time > self.limit_seconds:
             self.timed_out = True
@@ -3154,6 +3338,40 @@ def only(iterable, default=None, too_long=None):
     return first_value
 
 
+def _ichunk(iterable, n):
+    cache = deque()
+    chunk = islice(iterable, n)
+
+    def generator():
+        while True:
+            if cache:
+                yield cache.popleft()
+            else:
+                try:
+                    item = next(chunk)
+                except StopIteration:
+                    return
+                else:
+                    yield item
+
+    def materialize_next(n=1):
+        # if n not specified materialize everything
+        if n is None:
+            cache.extend(chunk)
+            return len(cache)
+
+        to_cache = n - len(cache)
+
+        # materialize up to n
+        if to_cache > 0:
+            cache.extend(islice(chunk, to_cache))
+
+        # return number materialized up to n
+        return min(n, len(cache))
+
+    return (generator(), materialize_next)
+
+
 def ichunked(iterable, n):
     """Break *iterable* into sub-iterables with *n* elements each.
     :func:`ichunked` is like :func:`chunked`, but it yields iterables
@@ -3175,20 +3393,39 @@ def ichunked(iterable, n):
     [8, 9, 10, 11]
 
     """
-    source = iter(iterable)
-
+    iterable = iter(iterable)
     while True:
+        # Create new chunk
+        chunk, materialize_next = _ichunk(iterable, n)
+
         # Check to see whether we're at the end of the source iterable
-        item = next(source, _marker)
-        if item is _marker:
+        if not materialize_next():
             return
 
-        # Clone the source and yield an n-length slice
-        source, it = tee(chain([item], source))
-        yield islice(it, n)
+        yield chunk
+
+        # Fill previous chunk's cache
+        materialize_next(None)
+
+
+def iequals(*iterables):
+    """Return ``True`` if all given *iterables* are equal to each other,
+    which means that they contain the same elements in the same order.
 
-        # Advance the source iterable
-        consume(source, n)
+    The function is useful for comparing iterables of different data types
+    or iterables that do not support equality checks.
+
+    >>> iequals("abc", ['a', 'b', 'c'], ('a', 'b', 'c'), iter("abc"))
+    True
+
+    >>> iequals("abc", "acb")
+    False
+
+    Not to be confused with :func:`all_equal`, which checks whether all
+    elements of iterable are equal to each other.
+
+    """
+    return all(map(all_equal, zip_longest(*iterables, fillvalue=object())))
 
 
 def distinct_combinations(iterable, r):
@@ -3260,7 +3497,7 @@ def map_except(function, iterable, *exceptions):
     result, unless *function* raises one of the specified *exceptions*.
 
     *function* is called to transform each item in *iterable*.
-    It should be a accept one argument.
+    It should accept one argument.
 
     >>> iterable = ['1', '2', 'three', '4', None]
     >>> list(map_except(int, iterable, ValueError, TypeError))
@@ -3276,6 +3513,28 @@ def map_except(function, iterable, *exceptions):
             pass
 
 
+def map_if(iterable, pred, func, func_else=lambda x: x):
+    """Evaluate each item from *iterable* using *pred*. If the result is
+    equivalent to ``True``, transform the item with *func* and yield it.
+    Otherwise, transform the item with *func_else* and yield it.
+
+    *pred*, *func*, and *func_else* should each be functions that accept
+    one argument. By default, *func_else* is the identity function.
+
+    >>> from math import sqrt
+    >>> iterable = list(range(-5, 5))
+    >>> iterable
+    [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]
+    >>> list(map_if(iterable, lambda x: x > 3, lambda x: 'toobig'))
+    [-5, -4, -3, -2, -1, 0, 1, 2, 3, 'toobig']
+    >>> list(map_if(iterable, lambda x: x >= 0,
+    ... lambda x: f'{sqrt(x):.2f}', lambda x: None))
+    [None, None, None, None, None, '0.00', '1.00', '1.41', '1.73', '2.00']
+    """
+    for item in iterable:
+        yield func(item) if pred(item) else func_else(item)
+
+
 def _sample_unweighted(iterable, k):
     # Implementation of "Algorithm L" from the 1994 paper by Kim-Hung Li:
     # "Reservoir-Sampling Algorithms of Time Complexity O(n(1+log(N/n)))".
@@ -3292,7 +3551,6 @@ def _sample_unweighted(iterable, k):
     next_index = k + floor(log(random()) / log(1 - W))
 
     for index, element in enumerate(iterable, k):
-
         if index == next_index:
             reservoir[randrange(k)] = element
             # The new W is the largest in a sample of k U(0, `old_W`) numbers
@@ -3373,7 +3631,7 @@ def sample(iterable, k, weights=None):
         return _sample_weighted(iterable, k, weights)
 
 
-def is_sorted(iterable, key=None, reverse=False):
+def is_sorted(iterable, key=None, reverse=False, strict=False):
     """Returns ``True`` if the items of iterable are in sorted order, and
     ``False`` otherwise. *key* and *reverse* have the same meaning that they do
     in the built-in :func:`sorted` function.
@@ -3383,12 +3641,20 @@ def is_sorted(iterable, key=None, reverse=False):
     >>> is_sorted([5, 4, 3, 1, 2], reverse=True)
     False
 
+    If *strict*, tests for strict sorting, that is, returns ``False`` if equal
+    elements are found:
+
+    >>> is_sorted([1, 2, 2])
+    True
+    >>> is_sorted([1, 2, 2], strict=True)
+    False
+
     The function returns ``False`` after encountering the first out-of-order
     item. If there are no out-of-order items, the iterable is exhausted.
     """
 
-    compare = lt if reverse else gt
-    it = iterable if (key is None) else map(key, iterable)
+    compare = (le if reverse else ge) if strict else (lt if reverse else gt)
+    it = iterable if key is None else map(key, iterable)
     return not any(starmap(compare, pairwise(it)))
 
 
@@ -3453,7 +3719,10 @@ def __init__(self, func, callback_kwd='callback', wait_seconds=0.1):
         self._aborted = False
         self._future = None
         self._wait_seconds = wait_seconds
-        self._executor = __import__("concurrent.futures").futures.ThreadPoolExecutor(max_workers=1)
+        # Lazily import concurrent.future
+        self._executor = __import__(
+            'concurrent.futures'
+        ).futures.ThreadPoolExecutor(max_workers=1)
         self._iterator = self._reader()
 
     def __enter__(self):
@@ -3649,7 +3918,8 @@ def nth_permutation(iterable, r, index):
     elif not 0 <= r < n:
         raise ValueError
     else:
-        c = factorial(n) // factorial(n - r)
+        c = perm(n, r)
+    assert c > 0  # factortial(n)>0, and r>> nth_combination_with_replacement(range(5), 3, 5)
+        (0, 1, 1)
+
+    ``ValueError`` will be raised If *r* is negative or greater than the length
+    of *iterable*.
+    ``IndexError`` will be raised if the given *index* is invalid.
+    """
+    pool = tuple(iterable)
+    n = len(pool)
+    if (r < 0) or (r > n):
+        raise ValueError
+
+    c = comb(n + r - 1, r)
+
+    if index < 0:
+        index += c
+
+    if (index < 0) or (index >= c):
+        raise IndexError
+
+    result = []
+    i = 0
+    while r:
+        r -= 1
+        while n >= 0:
+            num_combs = comb(n + r - 1, r)
+            if index < num_combs:
+                break
+            n -= 1
+            i += 1
+            index -= num_combs
+        result.append(pool[i])
+
+    return tuple(result)
+
+
 def value_chain(*args):
     """Yield all arguments passed to the function in the same order in which
     they were passed. If an argument itself is iterable then iterate over its
@@ -3686,6 +3999,12 @@ def value_chain(*args):
         >>> list(value_chain('12', '34', ['56', '78']))
         ['12', '34', '56', '78']
 
+    Pre- or postpend a single element to an iterable:
+
+        >>> list(value_chain(1, [2, 3, 4, 5, 6]))
+        [1, 2, 3, 4, 5, 6]
+        >>> list(value_chain([1, 2, 3, 4, 5], 6))
+        [1, 2, 3, 4, 5, 6]
 
     Multiple levels of nesting are not flattened.
 
@@ -3758,14 +4077,71 @@ def combination_index(element, iterable):
 
     n, _ = last(pool, default=(n, None))
 
-    # Python versiosn below 3.8 don't have math.comb
+    # Python versions below 3.8 don't have math.comb
     index = 1
     for i, j in enumerate(reversed(indexes), start=1):
         j = n - j
         if i <= j:
-            index += factorial(j) // (factorial(i) * factorial(j - i))
+            index += comb(j, i)
+
+    return comb(n + 1, k + 1) - index
+
+
+def combination_with_replacement_index(element, iterable):
+    """Equivalent to
+    ``list(combinations_with_replacement(iterable, r)).index(element)``
+
+    The subsequences with repetition of *iterable* that are of length *r* can
+    be ordered lexicographically. :func:`combination_with_replacement_index`
+    computes the index of the first *element*, without computing the previous
+    combinations with replacement.
+
+        >>> combination_with_replacement_index('adf', 'abcdefg')
+        20
+
+    ``ValueError`` will be raised if the given *element* isn't one of the
+    combinations with replacement of *iterable*.
+    """
+    element = tuple(element)
+    l = len(element)
+    element = enumerate(element)
+
+    k, y = next(element, (None, None))
+    if k is None:
+        return 0
+
+    indexes = []
+    pool = tuple(iterable)
+    for n, x in enumerate(pool):
+        while x == y:
+            indexes.append(n)
+            tmp, y = next(element, (None, None))
+            if tmp is None:
+                break
+            else:
+                k = tmp
+        if y is None:
+            break
+    else:
+        raise ValueError(
+            'element is not a combination with replacement of iterable'
+        )
+
+    n = len(pool)
+    occupations = [0] * n
+    for p in indexes:
+        occupations[p] += 1
+
+    index = 0
+    cumulative_sum = 0
+    for k in range(1, n):
+        cumulative_sum += occupations[k - 1]
+        j = l + n - 1 - k - cumulative_sum
+        i = n - k
+        if i <= j:
+            index += comb(j, i)
 
-    return factorial(n + 1) // (factorial(k + 1) * factorial(n - k)) - index
+    return index
 
 
 def permutation_index(element, iterable):
@@ -3822,3 +4198,609 @@ def __next__(self):
         self.items_seen += 1
 
         return item
+
+
+def chunked_even(iterable, n):
+    """Break *iterable* into lists of approximately length *n*.
+    Items are distributed such the lengths of the lists differ by at most
+    1 item.
+
+    >>> iterable = [1, 2, 3, 4, 5, 6, 7]
+    >>> n = 3
+    >>> list(chunked_even(iterable, n))  # List lengths: 3, 2, 2
+    [[1, 2, 3], [4, 5], [6, 7]]
+    >>> list(chunked(iterable, n))  # List lengths: 3, 3, 1
+    [[1, 2, 3], [4, 5, 6], [7]]
+
+    """
+    iterable = iter(iterable)
+
+    # Initialize a buffer to process the chunks while keeping
+    # some back to fill any underfilled chunks
+    min_buffer = (n - 1) * (n - 2)
+    buffer = list(islice(iterable, min_buffer))
+
+    # Append items until we have a completed chunk
+    for _ in islice(map(buffer.append, iterable), n, None, n):
+        yield buffer[:n]
+        del buffer[:n]
+
+    # Check if any chunks need addition processing
+    if not buffer:
+        return
+    length = len(buffer)
+
+    # Chunks are either size `full_size <= n` or `partial_size = full_size - 1`
+    q, r = divmod(length, n)
+    num_lists = q + (1 if r > 0 else 0)
+    q, r = divmod(length, num_lists)
+    full_size = q + (1 if r > 0 else 0)
+    partial_size = full_size - 1
+    num_full = length - partial_size * num_lists
+
+    # Yield chunks of full size
+    partial_start_idx = num_full * full_size
+    if full_size > 0:
+        for i in range(0, partial_start_idx, full_size):
+            yield buffer[i : i + full_size]
+
+    # Yield chunks of partial size
+    if partial_size > 0:
+        for i in range(partial_start_idx, length, partial_size):
+            yield buffer[i : i + partial_size]
+
+
+def zip_broadcast(*objects, scalar_types=(str, bytes), strict=False):
+    """A version of :func:`zip` that "broadcasts" any scalar
+    (i.e., non-iterable) items into output tuples.
+
+    >>> iterable_1 = [1, 2, 3]
+    >>> iterable_2 = ['a', 'b', 'c']
+    >>> scalar = '_'
+    >>> list(zip_broadcast(iterable_1, iterable_2, scalar))
+    [(1, 'a', '_'), (2, 'b', '_'), (3, 'c', '_')]
+
+    The *scalar_types* keyword argument determines what types are considered
+    scalar. It is set to ``(str, bytes)`` by default. Set it to ``None`` to
+    treat strings and byte strings as iterable:
+
+    >>> list(zip_broadcast('abc', 0, 'xyz', scalar_types=None))
+    [('a', 0, 'x'), ('b', 0, 'y'), ('c', 0, 'z')]
+
+    If the *strict* keyword argument is ``True``, then
+    ``UnequalIterablesError`` will be raised if any of the iterables have
+    different lengths.
+    """
+
+    def is_scalar(obj):
+        if scalar_types and isinstance(obj, scalar_types):
+            return True
+        try:
+            iter(obj)
+        except TypeError:
+            return True
+        else:
+            return False
+
+    size = len(objects)
+    if not size:
+        return
+
+    new_item = [None] * size
+    iterables, iterable_positions = [], []
+    for i, obj in enumerate(objects):
+        if is_scalar(obj):
+            new_item[i] = obj
+        else:
+            iterables.append(iter(obj))
+            iterable_positions.append(i)
+
+    if not iterables:
+        yield tuple(objects)
+        return
+
+    zipper = _zip_equal if strict else zip
+    for item in zipper(*iterables):
+        for i, new_item[i] in zip(iterable_positions, item):
+            pass
+        yield tuple(new_item)
+
+
+def unique_in_window(iterable, n, key=None):
+    """Yield the items from *iterable* that haven't been seen recently.
+    *n* is the size of the lookback window.
+
+        >>> iterable = [0, 1, 0, 2, 3, 0]
+        >>> n = 3
+        >>> list(unique_in_window(iterable, n))
+        [0, 1, 2, 3, 0]
+
+    The *key* function, if provided, will be used to determine uniqueness:
+
+        >>> list(unique_in_window('abAcda', 3, key=lambda x: x.lower()))
+        ['a', 'b', 'c', 'd', 'a']
+
+    The items in *iterable* must be hashable.
+
+    """
+    if n <= 0:
+        raise ValueError('n must be greater than 0')
+
+    window = deque(maxlen=n)
+    counts = defaultdict(int)
+    use_key = key is not None
+
+    for item in iterable:
+        if len(window) == n:
+            to_discard = window[0]
+            if counts[to_discard] == 1:
+                del counts[to_discard]
+            else:
+                counts[to_discard] -= 1
+
+        k = key(item) if use_key else item
+        if k not in counts:
+            yield item
+        counts[k] += 1
+        window.append(k)
+
+
+def duplicates_everseen(iterable, key=None):
+    """Yield duplicate elements after their first appearance.
+
+    >>> list(duplicates_everseen('mississippi'))
+    ['s', 'i', 's', 's', 'i', 'p', 'i']
+    >>> list(duplicates_everseen('AaaBbbCccAaa', str.lower))
+    ['a', 'a', 'b', 'b', 'c', 'c', 'A', 'a', 'a']
+
+    This function is analogous to :func:`unique_everseen` and is subject to
+    the same performance considerations.
+
+    """
+    seen_set = set()
+    seen_list = []
+    use_key = key is not None
+
+    for element in iterable:
+        k = key(element) if use_key else element
+        try:
+            if k not in seen_set:
+                seen_set.add(k)
+            else:
+                yield element
+        except TypeError:
+            if k not in seen_list:
+                seen_list.append(k)
+            else:
+                yield element
+
+
+def duplicates_justseen(iterable, key=None):
+    """Yields serially-duplicate elements after their first appearance.
+
+    >>> list(duplicates_justseen('mississippi'))
+    ['s', 's', 'p']
+    >>> list(duplicates_justseen('AaaBbbCccAaa', str.lower))
+    ['a', 'a', 'b', 'b', 'c', 'c', 'a', 'a']
+
+    This function is analogous to :func:`unique_justseen`.
+
+    """
+    return flatten(g for _, g in groupby(iterable, key) for _ in g)
+
+
+def classify_unique(iterable, key=None):
+    """Classify each element in terms of its uniqueness.
+
+    For each element in the input iterable, return a 3-tuple consisting of:
+
+    1. The element itself
+    2. ``False`` if the element is equal to the one preceding it in the input,
+       ``True`` otherwise (i.e. the equivalent of :func:`unique_justseen`)
+    3. ``False`` if this element has been seen anywhere in the input before,
+       ``True`` otherwise (i.e. the equivalent of :func:`unique_everseen`)
+
+    >>> list(classify_unique('otto'))    # doctest: +NORMALIZE_WHITESPACE
+    [('o', True,  True),
+     ('t', True,  True),
+     ('t', False, False),
+     ('o', True,  False)]
+
+    This function is analogous to :func:`unique_everseen` and is subject to
+    the same performance considerations.
+
+    """
+    seen_set = set()
+    seen_list = []
+    use_key = key is not None
+    previous = None
+
+    for i, element in enumerate(iterable):
+        k = key(element) if use_key else element
+        is_unique_justseen = not i or previous != k
+        previous = k
+        is_unique_everseen = False
+        try:
+            if k not in seen_set:
+                seen_set.add(k)
+                is_unique_everseen = True
+        except TypeError:
+            if k not in seen_list:
+                seen_list.append(k)
+                is_unique_everseen = True
+        yield element, is_unique_justseen, is_unique_everseen
+
+
+def minmax(iterable_or_value, *others, key=None, default=_marker):
+    """Returns both the smallest and largest items in an iterable
+    or the largest of two or more arguments.
+
+        >>> minmax([3, 1, 5])
+        (1, 5)
+
+        >>> minmax(4, 2, 6)
+        (2, 6)
+
+    If a *key* function is provided, it will be used to transform the input
+    items for comparison.
+
+        >>> minmax([5, 30], key=str)  # '30' sorts before '5'
+        (30, 5)
+
+    If a *default* value is provided, it will be returned if there are no
+    input items.
+
+        >>> minmax([], default=(0, 0))
+        (0, 0)
+
+    Otherwise ``ValueError`` is raised.
+
+    This function is based on the
+    `recipe `__ by
+    Raymond Hettinger and takes care to minimize the number of comparisons
+    performed.
+    """
+    iterable = (iterable_or_value, *others) if others else iterable_or_value
+
+    it = iter(iterable)
+
+    try:
+        lo = hi = next(it)
+    except StopIteration as exc:
+        if default is _marker:
+            raise ValueError(
+                '`minmax()` argument is an empty iterable. '
+                'Provide a `default` value to suppress this error.'
+            ) from exc
+        return default
+
+    # Different branches depending on the presence of key. This saves a lot
+    # of unimportant copies which would slow the "key=None" branch
+    # significantly down.
+    if key is None:
+        for x, y in zip_longest(it, it, fillvalue=lo):
+            if y < x:
+                x, y = y, x
+            if x < lo:
+                lo = x
+            if hi < y:
+                hi = y
+
+    else:
+        lo_key = hi_key = key(lo)
+
+        for x, y in zip_longest(it, it, fillvalue=lo):
+            x_key, y_key = key(x), key(y)
+
+            if y_key < x_key:
+                x, y, x_key, y_key = y, x, y_key, x_key
+            if x_key < lo_key:
+                lo, lo_key = x, x_key
+            if hi_key < y_key:
+                hi, hi_key = y, y_key
+
+    return lo, hi
+
+
+def constrained_batches(
+    iterable, max_size, max_count=None, get_len=len, strict=True
+):
+    """Yield batches of items from *iterable* with a combined size limited by
+    *max_size*.
+
+    >>> iterable = [b'12345', b'123', b'12345678', b'1', b'1', b'12', b'1']
+    >>> list(constrained_batches(iterable, 10))
+    [(b'12345', b'123'), (b'12345678', b'1', b'1'), (b'12', b'1')]
+
+    If a *max_count* is supplied, the number of items per batch is also
+    limited:
+
+    >>> iterable = [b'12345', b'123', b'12345678', b'1', b'1', b'12', b'1']
+    >>> list(constrained_batches(iterable, 10, max_count = 2))
+    [(b'12345', b'123'), (b'12345678', b'1'), (b'1', b'12'), (b'1',)]
+
+    If a *get_len* function is supplied, use that instead of :func:`len` to
+    determine item size.
+
+    If *strict* is ``True``, raise ``ValueError`` if any single item is bigger
+    than *max_size*. Otherwise, allow single items to exceed *max_size*.
+    """
+    if max_size <= 0:
+        raise ValueError('maximum size must be greater than zero')
+
+    batch = []
+    batch_size = 0
+    batch_count = 0
+    for item in iterable:
+        item_len = get_len(item)
+        if strict and item_len > max_size:
+            raise ValueError('item size exceeds maximum size')
+
+        reached_count = batch_count == max_count
+        reached_size = item_len + batch_size > max_size
+        if batch_count and (reached_size or reached_count):
+            yield tuple(batch)
+            batch.clear()
+            batch_size = 0
+            batch_count = 0
+
+        batch.append(item)
+        batch_size += item_len
+        batch_count += 1
+
+    if batch:
+        yield tuple(batch)
+
+
+def gray_product(*iterables):
+    """Like :func:`itertools.product`, but return tuples in an order such
+    that only one element in the generated tuple changes from one iteration
+    to the next.
+
+        >>> list(gray_product('AB','CD'))
+        [('A', 'C'), ('B', 'C'), ('B', 'D'), ('A', 'D')]
+
+    This function consumes all of the input iterables before producing output.
+    If any of the input iterables have fewer than two items, ``ValueError``
+    is raised.
+
+    For information on the algorithm, see
+    `this section `__
+    of Donald Knuth's *The Art of Computer Programming*.
+    """
+    all_iterables = tuple(tuple(x) for x in iterables)
+    iterable_count = len(all_iterables)
+    for iterable in all_iterables:
+        if len(iterable) < 2:
+            raise ValueError("each iterable must have two or more items")
+
+    # This is based on "Algorithm H" from section 7.2.1.1, page 20.
+    # a holds the indexes of the source iterables for the n-tuple to be yielded
+    # f is the array of "focus pointers"
+    # o is the array of "directions"
+    a = [0] * iterable_count
+    f = list(range(iterable_count + 1))
+    o = [1] * iterable_count
+    while True:
+        yield tuple(all_iterables[i][a[i]] for i in range(iterable_count))
+        j = f[0]
+        f[0] = 0
+        if j == iterable_count:
+            break
+        a[j] = a[j] + o[j]
+        if a[j] == 0 or a[j] == len(all_iterables[j]) - 1:
+            o[j] = -o[j]
+            f[j] = f[j + 1]
+            f[j + 1] = j + 1
+
+
+def partial_product(*iterables):
+    """Yields tuples containing one item from each iterator, with subsequent
+    tuples changing a single item at a time by advancing each iterator until it
+    is exhausted. This sequence guarantees every value in each iterable is
+    output at least once without generating all possible combinations.
+
+    This may be useful, for example, when testing an expensive function.
+
+        >>> list(partial_product('AB', 'C', 'DEF'))
+        [('A', 'C', 'D'), ('B', 'C', 'D'), ('B', 'C', 'E'), ('B', 'C', 'F')]
+    """
+
+    iterators = list(map(iter, iterables))
+
+    try:
+        prod = [next(it) for it in iterators]
+    except StopIteration:
+        return
+    yield tuple(prod)
+
+    for i, it in enumerate(iterators):
+        for prod[i] in it:
+            yield tuple(prod)
+
+
+def takewhile_inclusive(predicate, iterable):
+    """A variant of :func:`takewhile` that yields one additional element.
+
+        >>> list(takewhile_inclusive(lambda x: x < 5, [1, 4, 6, 4, 1]))
+        [1, 4, 6]
+
+    :func:`takewhile` would return ``[1, 4]``.
+    """
+    for x in iterable:
+        yield x
+        if not predicate(x):
+            break
+
+
+def outer_product(func, xs, ys, *args, **kwargs):
+    """A generalized outer product that applies a binary function to all
+    pairs of items. Returns a 2D matrix with ``len(xs)`` rows and ``len(ys)``
+    columns.
+    Also accepts ``*args`` and ``**kwargs`` that are passed to ``func``.
+
+    Multiplication table:
+
+    >>> list(outer_product(mul, range(1, 4), range(1, 6)))
+    [(1, 2, 3, 4, 5), (2, 4, 6, 8, 10), (3, 6, 9, 12, 15)]
+
+    Cross tabulation:
+
+    >>> xs = ['A', 'B', 'A', 'A', 'B', 'B', 'A', 'A', 'B', 'B']
+    >>> ys = ['X', 'X', 'X', 'Y', 'Z', 'Z', 'Y', 'Y', 'Z', 'Z']
+    >>> rows = list(zip(xs, ys))
+    >>> count_rows = lambda x, y: rows.count((x, y))
+    >>> list(outer_product(count_rows, sorted(set(xs)), sorted(set(ys))))
+    [(2, 3, 0), (1, 0, 4)]
+
+    Usage with ``*args`` and ``**kwargs``:
+
+    >>> animals = ['cat', 'wolf', 'mouse']
+    >>> list(outer_product(min, animals, animals, key=len))
+    [('cat', 'cat', 'cat'), ('cat', 'wolf', 'wolf'), ('cat', 'wolf', 'mouse')]
+    """
+    ys = tuple(ys)
+    return batched(
+        starmap(lambda x, y: func(x, y, *args, **kwargs), product(xs, ys)),
+        n=len(ys),
+    )
+
+
+def iter_suppress(iterable, *exceptions):
+    """Yield each of the items from *iterable*. If the iteration raises one of
+    the specified *exceptions*, that exception will be suppressed and iteration
+    will stop.
+
+    >>> from itertools import chain
+    >>> def breaks_at_five(x):
+    ...     while True:
+    ...         if x >= 5:
+    ...             raise RuntimeError
+    ...         yield x
+    ...         x += 1
+    >>> it_1 = iter_suppress(breaks_at_five(1), RuntimeError)
+    >>> it_2 = iter_suppress(breaks_at_five(2), RuntimeError)
+    >>> list(chain(it_1, it_2))
+    [1, 2, 3, 4, 2, 3, 4]
+    """
+    try:
+        yield from iterable
+    except exceptions:
+        return
+
+
+def filter_map(func, iterable):
+    """Apply *func* to every element of *iterable*, yielding only those which
+    are not ``None``.
+
+    >>> elems = ['1', 'a', '2', 'b', '3']
+    >>> list(filter_map(lambda s: int(s) if s.isnumeric() else None, elems))
+    [1, 2, 3]
+    """
+    for x in iterable:
+        y = func(x)
+        if y is not None:
+            yield y
+
+
+def powerset_of_sets(iterable):
+    """Yields all possible subsets of the iterable.
+
+        >>> list(powerset_of_sets([1, 2, 3]))  # doctest: +SKIP
+        [set(), {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}]
+        >>> list(powerset_of_sets([1, 1, 0]))  # doctest: +SKIP
+        [set(), {1}, {0}, {0, 1}]
+
+    :func:`powerset_of_sets` takes care to minimize the number
+    of hash operations performed.
+    """
+    sets = tuple(map(set, dict.fromkeys(map(frozenset, zip(iterable)))))
+    for r in range(len(sets) + 1):
+        yield from starmap(set().union, combinations(sets, r))
+
+
+def join_mappings(**field_to_map):
+    """
+    Joins multiple mappings together using their common keys.
+
+    >>> user_scores = {'elliot': 50, 'claris': 60}
+    >>> user_times = {'elliot': 30, 'claris': 40}
+    >>> join_mappings(score=user_scores, time=user_times)
+    {'elliot': {'score': 50, 'time': 30}, 'claris': {'score': 60, 'time': 40}}
+    """
+    ret = defaultdict(dict)
+
+    for field_name, mapping in field_to_map.items():
+        for key, value in mapping.items():
+            ret[key][field_name] = value
+
+    return dict(ret)
+
+
+def _complex_sumprod(v1, v2):
+    """High precision sumprod() for complex numbers.
+    Used by :func:`dft` and :func:`idft`.
+    """
+
+    r1 = chain((p.real for p in v1), (-p.imag for p in v1))
+    r2 = chain((q.real for q in v2), (q.imag for q in v2))
+    i1 = chain((p.real for p in v1), (p.imag for p in v1))
+    i2 = chain((q.imag for q in v2), (q.real for q in v2))
+    return complex(_fsumprod(r1, r2), _fsumprod(i1, i2))
+
+
+def dft(xarr):
+    """Discrete Fourier Tranform. *xarr* is a sequence of complex numbers.
+    Yields the components of the corresponding transformed output vector.
+
+    >>> import cmath
+    >>> xarr = [1, 2-1j, -1j, -1+2j]
+    >>> Xarr = [2, -2-2j, -2j, 4+4j]
+    >>> all(map(cmath.isclose, dft(xarr), Xarr))
+    True
+
+    See :func:`idft` for the inverse Discrete Fourier Transform.
+    """
+    N = len(xarr)
+    roots_of_unity = [e ** (n / N * tau * -1j) for n in range(N)]
+    for k in range(N):
+        coeffs = [roots_of_unity[k * n % N] for n in range(N)]
+        yield _complex_sumprod(xarr, coeffs)
+
+
+def idft(Xarr):
+    """Inverse Discrete Fourier Tranform. *Xarr* is a sequence of
+    complex numbers. Yields the components of the corresponding
+    inverse-transformed output vector.
+
+    >>> import cmath
+    >>> xarr = [1, 2-1j, -1j, -1+2j]
+    >>> Xarr = [2, -2-2j, -2j, 4+4j]
+    >>> all(map(cmath.isclose, idft(Xarr), xarr))
+    True
+
+    See :func:`dft` for the Discrete Fourier Transform.
+    """
+    N = len(Xarr)
+    roots_of_unity = [e ** (n / N * tau * 1j) for n in range(N)]
+    for k in range(N):
+        coeffs = [roots_of_unity[k * n % N] for n in range(N)]
+        yield _complex_sumprod(Xarr, coeffs) / N
+
+
+def doublestarmap(func, iterable):
+    """Apply *func* to every item of *iterable* by dictionary unpacking
+    the item into *func*.
+
+    The difference between :func:`itertools.starmap` and :func:`doublestarmap`
+    parallels the distinction between ``func(*a)`` and ``func(**a)``.
+
+    >>> iterable = [{'a': 1, 'b': 2}, {'a': 40, 'b': 60}]
+    >>> list(doublestarmap(lambda a, b: a + b, iterable))
+    [3, 100]
+
+    ``TypeError`` will be raised if *func*'s signature doesn't match the
+    mapping contained in *iterable* or if *iterable* does not contain mappings.
+    """
+    for item in iterable:
+        yield func(**item)
diff --git a/setuptools/_vendor/more_itertools/more.pyi b/setuptools/_vendor/more_itertools/more.pyi
index 2fba9cb300..e946023259 100644
--- a/setuptools/_vendor/more_itertools/more.pyi
+++ b/setuptools/_vendor/more_itertools/more.pyi
@@ -1,35 +1,39 @@
 """Stubs for more_itertools.more"""
 
+from __future__ import annotations
+
+from types import TracebackType
 from typing import (
     Any,
     Callable,
     Container,
-    Dict,
+    ContextManager,
     Generic,
     Hashable,
+    Mapping,
     Iterable,
     Iterator,
-    List,
-    Optional,
+    Mapping,
+    overload,
     Reversible,
     Sequence,
     Sized,
-    Tuple,
-    Union,
+    Type,
     TypeVar,
     type_check_only,
 )
-from types import TracebackType
-from typing_extensions import ContextManager, Protocol, Type, overload
+from typing_extensions import Protocol
 
 # Type and type variable definitions
 _T = TypeVar('_T')
+_T1 = TypeVar('_T1')
+_T2 = TypeVar('_T2')
 _U = TypeVar('_U')
 _V = TypeVar('_V')
 _W = TypeVar('_W')
 _T_co = TypeVar('_T_co', covariant=True)
-_GenFn = TypeVar('_GenFn', bound=Callable[..., Iterator[object]])
-_Raisable = Union[BaseException, 'Type[BaseException]']
+_GenFn = TypeVar('_GenFn', bound=Callable[..., Iterator[Any]])
+_Raisable = BaseException | Type[BaseException]
 
 @type_check_only
 class _SizedIterable(Protocol[_T_co], Sized, Iterable[_T_co]): ...
@@ -37,23 +41,25 @@ class _SizedIterable(Protocol[_T_co], Sized, Iterable[_T_co]): ...
 @type_check_only
 class _SizedReversible(Protocol[_T_co], Sized, Reversible[_T_co]): ...
 
+@type_check_only
+class _SupportsSlicing(Protocol[_T_co]):
+    def __getitem__(self, __k: slice) -> _T_co: ...
+
 def chunked(
-    iterable: Iterable[_T], n: int, strict: bool = ...
-) -> Iterator[List[_T]]: ...
+    iterable: Iterable[_T], n: int | None, strict: bool = ...
+) -> Iterator[list[_T]]: ...
 @overload
 def first(iterable: Iterable[_T]) -> _T: ...
 @overload
-def first(iterable: Iterable[_T], default: _U) -> Union[_T, _U]: ...
+def first(iterable: Iterable[_T], default: _U) -> _T | _U: ...
 @overload
 def last(iterable: Iterable[_T]) -> _T: ...
 @overload
-def last(iterable: Iterable[_T], default: _U) -> Union[_T, _U]: ...
+def last(iterable: Iterable[_T], default: _U) -> _T | _U: ...
 @overload
 def nth_or_last(iterable: Iterable[_T], n: int) -> _T: ...
 @overload
-def nth_or_last(
-    iterable: Iterable[_T], n: int, default: _U
-) -> Union[_T, _U]: ...
+def nth_or_last(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ...
 
 class peekable(Generic[_T], Iterator[_T]):
     def __init__(self, iterable: Iterable[_T]) -> None: ...
@@ -62,52 +68,58 @@ class peekable(Generic[_T], Iterator[_T]):
     @overload
     def peek(self) -> _T: ...
     @overload
-    def peek(self, default: _U) -> Union[_T, _U]: ...
+    def peek(self, default: _U) -> _T | _U: ...
     def prepend(self, *items: _T) -> None: ...
     def __next__(self) -> _T: ...
     @overload
     def __getitem__(self, index: int) -> _T: ...
     @overload
-    def __getitem__(self, index: slice) -> List[_T]: ...
+    def __getitem__(self, index: slice) -> list[_T]: ...
 
-def collate(*iterables: Iterable[_T], **kwargs: Any) -> Iterable[_T]: ...
 def consumer(func: _GenFn) -> _GenFn: ...
-def ilen(iterable: Iterable[object]) -> int: ...
+def ilen(iterable: Iterable[_T]) -> int: ...
 def iterate(func: Callable[[_T], _T], start: _T) -> Iterator[_T]: ...
 def with_iter(
     context_manager: ContextManager[Iterable[_T]],
 ) -> Iterator[_T]: ...
 def one(
     iterable: Iterable[_T],
-    too_short: Optional[_Raisable] = ...,
-    too_long: Optional[_Raisable] = ...,
+    too_short: _Raisable | None = ...,
+    too_long: _Raisable | None = ...,
 ) -> _T: ...
+def raise_(exception: _Raisable, *args: Any) -> None: ...
+def strictly_n(
+    iterable: Iterable[_T],
+    n: int,
+    too_short: _GenFn | None = ...,
+    too_long: _GenFn | None = ...,
+) -> list[_T]: ...
 def distinct_permutations(
-    iterable: Iterable[_T], r: Optional[int] = ...
-) -> Iterator[Tuple[_T, ...]]: ...
+    iterable: Iterable[_T], r: int | None = ...
+) -> Iterator[tuple[_T, ...]]: ...
 def intersperse(
     e: _U, iterable: Iterable[_T], n: int = ...
-) -> Iterator[Union[_T, _U]]: ...
-def unique_to_each(*iterables: Iterable[_T]) -> List[List[_T]]: ...
+) -> Iterator[_T | _U]: ...
+def unique_to_each(*iterables: Iterable[_T]) -> list[list[_T]]: ...
 @overload
 def windowed(
     seq: Iterable[_T], n: int, *, step: int = ...
-) -> Iterator[Tuple[Optional[_T], ...]]: ...
+) -> Iterator[tuple[_T | None, ...]]: ...
 @overload
 def windowed(
     seq: Iterable[_T], n: int, fillvalue: _U, step: int = ...
-) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
-def substrings(iterable: Iterable[_T]) -> Iterator[Tuple[_T, ...]]: ...
+) -> Iterator[tuple[_T | _U, ...]]: ...
+def substrings(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
 def substrings_indexes(
     seq: Sequence[_T], reverse: bool = ...
-) -> Iterator[Tuple[Sequence[_T], int, int]]: ...
+) -> Iterator[tuple[Sequence[_T], int, int]]: ...
 
 class bucket(Generic[_T, _U], Container[_U]):
     def __init__(
         self,
         iterable: Iterable[_T],
         key: Callable[[_T], _U],
-        validator: Optional[Callable[[object], object]] = ...,
+        validator: Callable[[_U], object] | None = ...,
     ) -> None: ...
     def __contains__(self, value: object) -> bool: ...
     def __iter__(self) -> Iterator[_U]: ...
@@ -115,130 +127,232 @@ class bucket(Generic[_T, _U], Container[_U]):
 
 def spy(
     iterable: Iterable[_T], n: int = ...
-) -> Tuple[List[_T], Iterator[_T]]: ...
+) -> tuple[list[_T], Iterator[_T]]: ...
 def interleave(*iterables: Iterable[_T]) -> Iterator[_T]: ...
 def interleave_longest(*iterables: Iterable[_T]) -> Iterator[_T]: ...
+def interleave_evenly(
+    iterables: list[Iterable[_T]], lengths: list[int] | None = ...
+) -> Iterator[_T]: ...
 def collapse(
     iterable: Iterable[Any],
-    base_type: Optional[type] = ...,
-    levels: Optional[int] = ...,
+    base_type: type | None = ...,
+    levels: int | None = ...,
 ) -> Iterator[Any]: ...
 @overload
 def side_effect(
     func: Callable[[_T], object],
     iterable: Iterable[_T],
     chunk_size: None = ...,
-    before: Optional[Callable[[], object]] = ...,
-    after: Optional[Callable[[], object]] = ...,
+    before: Callable[[], object] | None = ...,
+    after: Callable[[], object] | None = ...,
 ) -> Iterator[_T]: ...
 @overload
 def side_effect(
-    func: Callable[[List[_T]], object],
+    func: Callable[[list[_T]], object],
     iterable: Iterable[_T],
     chunk_size: int,
-    before: Optional[Callable[[], object]] = ...,
-    after: Optional[Callable[[], object]] = ...,
+    before: Callable[[], object] | None = ...,
+    after: Callable[[], object] | None = ...,
 ) -> Iterator[_T]: ...
 def sliced(
-    seq: Sequence[_T], n: int, strict: bool = ...
-) -> Iterator[Sequence[_T]]: ...
+    seq: _SupportsSlicing[_T], n: int, strict: bool = ...
+) -> Iterator[_T]: ...
 def split_at(
     iterable: Iterable[_T],
     pred: Callable[[_T], object],
     maxsplit: int = ...,
     keep_separator: bool = ...,
-) -> Iterator[List[_T]]: ...
+) -> Iterator[list[_T]]: ...
 def split_before(
     iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
-) -> Iterator[List[_T]]: ...
+) -> Iterator[list[_T]]: ...
 def split_after(
     iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ...
-) -> Iterator[List[_T]]: ...
+) -> Iterator[list[_T]]: ...
 def split_when(
     iterable: Iterable[_T],
     pred: Callable[[_T, _T], object],
     maxsplit: int = ...,
-) -> Iterator[List[_T]]: ...
+) -> Iterator[list[_T]]: ...
 def split_into(
-    iterable: Iterable[_T], sizes: Iterable[Optional[int]]
-) -> Iterator[List[_T]]: ...
+    iterable: Iterable[_T], sizes: Iterable[int | None]
+) -> Iterator[list[_T]]: ...
 @overload
 def padded(
     iterable: Iterable[_T],
     *,
-    n: Optional[int] = ...,
-    next_multiple: bool = ...
-) -> Iterator[Optional[_T]]: ...
+    n: int | None = ...,
+    next_multiple: bool = ...,
+) -> Iterator[_T | None]: ...
 @overload
 def padded(
     iterable: Iterable[_T],
     fillvalue: _U,
-    n: Optional[int] = ...,
+    n: int | None = ...,
     next_multiple: bool = ...,
-) -> Iterator[Union[_T, _U]]: ...
+) -> Iterator[_T | _U]: ...
 @overload
 def repeat_last(iterable: Iterable[_T]) -> Iterator[_T]: ...
 @overload
-def repeat_last(
-    iterable: Iterable[_T], default: _U
-) -> Iterator[Union[_T, _U]]: ...
-def distribute(n: int, iterable: Iterable[_T]) -> List[Iterator[_T]]: ...
+def repeat_last(iterable: Iterable[_T], default: _U) -> Iterator[_T | _U]: ...
+def distribute(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ...
 @overload
 def stagger(
     iterable: Iterable[_T],
     offsets: _SizedIterable[int] = ...,
     longest: bool = ...,
-) -> Iterator[Tuple[Optional[_T], ...]]: ...
+) -> Iterator[tuple[_T | None, ...]]: ...
 @overload
 def stagger(
     iterable: Iterable[_T],
     offsets: _SizedIterable[int] = ...,
     longest: bool = ...,
     fillvalue: _U = ...,
-) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+) -> Iterator[tuple[_T | _U, ...]]: ...
 
 class UnequalIterablesError(ValueError):
-    def __init__(
-        self, details: Optional[Tuple[int, int, int]] = ...
-    ) -> None: ...
+    def __init__(self, details: tuple[int, int, int] | None = ...) -> None: ...
 
-def zip_equal(*iterables: Iterable[_T]) -> Iterator[Tuple[_T, ...]]: ...
+@overload
+def zip_equal(__iter1: Iterable[_T1]) -> Iterator[tuple[_T1]]: ...
+@overload
+def zip_equal(
+    __iter1: Iterable[_T1], __iter2: Iterable[_T2]
+) -> Iterator[tuple[_T1, _T2]]: ...
+@overload
+def zip_equal(
+    __iter1: Iterable[_T],
+    __iter2: Iterable[_T],
+    __iter3: Iterable[_T],
+    *iterables: Iterable[_T],
+) -> Iterator[tuple[_T, ...]]: ...
 @overload
 def zip_offset(
-    *iterables: Iterable[_T], offsets: _SizedIterable[int], longest: bool = ...
-) -> Iterator[Tuple[Optional[_T], ...]]: ...
+    __iter1: Iterable[_T1],
+    *,
+    offsets: _SizedIterable[int],
+    longest: bool = ...,
+    fillvalue: None = None,
+) -> Iterator[tuple[_T1 | None]]: ...
 @overload
 def zip_offset(
+    __iter1: Iterable[_T1],
+    __iter2: Iterable[_T2],
+    *,
+    offsets: _SizedIterable[int],
+    longest: bool = ...,
+    fillvalue: None = None,
+) -> Iterator[tuple[_T1 | None, _T2 | None]]: ...
+@overload
+def zip_offset(
+    __iter1: Iterable[_T],
+    __iter2: Iterable[_T],
+    __iter3: Iterable[_T],
     *iterables: Iterable[_T],
     offsets: _SizedIterable[int],
     longest: bool = ...,
-    fillvalue: _U
-) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+    fillvalue: None = None,
+) -> Iterator[tuple[_T | None, ...]]: ...
+@overload
+def zip_offset(
+    __iter1: Iterable[_T1],
+    *,
+    offsets: _SizedIterable[int],
+    longest: bool = ...,
+    fillvalue: _U,
+) -> Iterator[tuple[_T1 | _U]]: ...
+@overload
+def zip_offset(
+    __iter1: Iterable[_T1],
+    __iter2: Iterable[_T2],
+    *,
+    offsets: _SizedIterable[int],
+    longest: bool = ...,
+    fillvalue: _U,
+) -> Iterator[tuple[_T1 | _U, _T2 | _U]]: ...
+@overload
+def zip_offset(
+    __iter1: Iterable[_T],
+    __iter2: Iterable[_T],
+    __iter3: Iterable[_T],
+    *iterables: Iterable[_T],
+    offsets: _SizedIterable[int],
+    longest: bool = ...,
+    fillvalue: _U,
+) -> Iterator[tuple[_T | _U, ...]]: ...
 def sort_together(
     iterables: Iterable[Iterable[_T]],
     key_list: Iterable[int] = ...,
-    key: Optional[Callable[..., Any]] = ...,
+    key: Callable[..., Any] | None = ...,
     reverse: bool = ...,
-) -> List[Tuple[_T, ...]]: ...
-def unzip(iterable: Iterable[Sequence[_T]]) -> Tuple[Iterator[_T], ...]: ...
-def divide(n: int, iterable: Iterable[_T]) -> List[Iterator[_T]]: ...
+) -> list[tuple[_T, ...]]: ...
+def unzip(iterable: Iterable[Sequence[_T]]) -> tuple[Iterator[_T], ...]: ...
+def divide(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ...
 def always_iterable(
     obj: object,
-    base_type: Union[
-        type, Tuple[Union[type, Tuple[Any, ...]], ...], None
-    ] = ...,
+    base_type: type | tuple[type | tuple[Any, ...], ...] | None = ...,
 ) -> Iterator[Any]: ...
 def adjacent(
     predicate: Callable[[_T], bool],
     iterable: Iterable[_T],
     distance: int = ...,
-) -> Iterator[Tuple[bool, _T]]: ...
+) -> Iterator[tuple[bool, _T]]: ...
+@overload
+def groupby_transform(
+    iterable: Iterable[_T],
+    keyfunc: None = None,
+    valuefunc: None = None,
+    reducefunc: None = None,
+) -> Iterator[tuple[_T, Iterator[_T]]]: ...
+@overload
+def groupby_transform(
+    iterable: Iterable[_T],
+    keyfunc: Callable[[_T], _U],
+    valuefunc: None,
+    reducefunc: None,
+) -> Iterator[tuple[_U, Iterator[_T]]]: ...
+@overload
+def groupby_transform(
+    iterable: Iterable[_T],
+    keyfunc: None,
+    valuefunc: Callable[[_T], _V],
+    reducefunc: None,
+) -> Iterable[tuple[_T, Iterable[_V]]]: ...
+@overload
+def groupby_transform(
+    iterable: Iterable[_T],
+    keyfunc: Callable[[_T], _U],
+    valuefunc: Callable[[_T], _V],
+    reducefunc: None,
+) -> Iterable[tuple[_U, Iterator[_V]]]: ...
+@overload
+def groupby_transform(
+    iterable: Iterable[_T],
+    keyfunc: None,
+    valuefunc: None,
+    reducefunc: Callable[[Iterator[_T]], _W],
+) -> Iterable[tuple[_T, _W]]: ...
+@overload
+def groupby_transform(
+    iterable: Iterable[_T],
+    keyfunc: Callable[[_T], _U],
+    valuefunc: None,
+    reducefunc: Callable[[Iterator[_T]], _W],
+) -> Iterable[tuple[_U, _W]]: ...
+@overload
 def groupby_transform(
     iterable: Iterable[_T],
-    keyfunc: Optional[Callable[[_T], _U]] = ...,
-    valuefunc: Optional[Callable[[_T], _V]] = ...,
-    reducefunc: Optional[Callable[..., _W]] = ...,
-) -> Iterator[Tuple[_T, _W]]: ...
+    keyfunc: None,
+    valuefunc: Callable[[_T], _V],
+    reducefunc: Callable[[Iterable[_V]], _W],
+) -> Iterable[tuple[_T, _W]]: ...
+@overload
+def groupby_transform(
+    iterable: Iterable[_T],
+    keyfunc: Callable[[_T], _U],
+    valuefunc: Callable[[_T], _V],
+    reducefunc: Callable[[Iterable[_V]], _W],
+) -> Iterable[tuple[_U, _W]]: ...
 
 class numeric_range(Generic[_T, _U], Sequence[_T], Hashable, Reversible[_T]):
     @overload
@@ -259,22 +373,22 @@ class numeric_range(Generic[_T, _U], Sequence[_T], Hashable, Reversible[_T]):
     def __len__(self) -> int: ...
     def __reduce__(
         self,
-    ) -> Tuple[Type[numeric_range[_T, _U]], Tuple[_T, _T, _U]]: ...
+    ) -> tuple[Type[numeric_range[_T, _U]], tuple[_T, _T, _U]]: ...
     def __repr__(self) -> str: ...
     def __reversed__(self) -> Iterator[_T]: ...
     def count(self, value: _T) -> int: ...
     def index(self, value: _T) -> int: ...  # type: ignore
 
 def count_cycle(
-    iterable: Iterable[_T], n: Optional[int] = ...
-) -> Iterable[Tuple[int, _T]]: ...
+    iterable: Iterable[_T], n: int | None = ...
+) -> Iterable[tuple[int, _T]]: ...
 def mark_ends(
     iterable: Iterable[_T],
-) -> Iterable[Tuple[bool, bool, _T]]: ...
+) -> Iterable[tuple[bool, bool, _T]]: ...
 def locate(
-    iterable: Iterable[object],
+    iterable: Iterable[_T],
     pred: Callable[..., Any] = ...,
-    window_size: Optional[int] = ...,
+    window_size: int | None = ...,
 ) -> Iterator[int]: ...
 def lstrip(
     iterable: Iterable[_T], pred: Callable[[_T], object]
@@ -287,9 +401,7 @@ def strip(
 ) -> Iterator[_T]: ...
 
 class islice_extended(Generic[_T], Iterator[_T]):
-    def __init__(
-        self, iterable: Iterable[_T], *args: Optional[int]
-    ) -> None: ...
+    def __init__(self, iterable: Iterable[_T], *args: int | None) -> None: ...
     def __iter__(self) -> islice_extended[_T]: ...
     def __next__(self) -> _T: ...
     def __getitem__(self, index: slice) -> islice_extended[_T]: ...
@@ -303,8 +415,8 @@ def difference(
     iterable: Iterable[_T],
     func: Callable[[_T, _T], _U] = ...,
     *,
-    initial: None = ...
-) -> Iterator[Union[_T, _U]]: ...
+    initial: None = ...,
+) -> Iterator[_T | _U]: ...
 @overload
 def difference(
     iterable: Iterable[_T], func: Callable[[_T, _T], _U] = ..., *, initial: _U
@@ -320,7 +432,7 @@ class SequenceView(Generic[_T], Sequence[_T]):
 
 class seekable(Generic[_T], Iterator[_T]):
     def __init__(
-        self, iterable: Iterable[_T], maxlen: Optional[int] = ...
+        self, iterable: Iterable[_T], maxlen: int | None = ...
     ) -> None: ...
     def __iter__(self) -> seekable[_T]: ...
     def __next__(self) -> _T: ...
@@ -328,20 +440,21 @@ class seekable(Generic[_T], Iterator[_T]):
     @overload
     def peek(self) -> _T: ...
     @overload
-    def peek(self, default: _U) -> Union[_T, _U]: ...
+    def peek(self, default: _U) -> _T | _U: ...
     def elements(self) -> SequenceView[_T]: ...
     def seek(self, index: int) -> None: ...
+    def relative_seek(self, count: int) -> None: ...
 
 class run_length:
     @staticmethod
-    def encode(iterable: Iterable[_T]) -> Iterator[Tuple[_T, int]]: ...
+    def encode(iterable: Iterable[_T]) -> Iterator[tuple[_T, int]]: ...
     @staticmethod
-    def decode(iterable: Iterable[Tuple[_T, int]]) -> Iterator[_T]: ...
+    def decode(iterable: Iterable[tuple[_T, int]]) -> Iterator[_T]: ...
 
 def exactly_n(
     iterable: Iterable[_T], n: int, predicate: Callable[[_T], object] = ...
 ) -> bool: ...
-def circular_shifts(iterable: Iterable[_T]) -> List[Tuple[_T, ...]]: ...
+def circular_shifts(iterable: Iterable[_T]) -> list[tuple[_T, ...]]: ...
 def make_decorator(
     wrapping_func: Callable[..., _U], result_index: int = ...
 ) -> Callable[..., Callable[[Callable[..., Any]], Callable[..., _U]]]: ...
@@ -351,44 +464,44 @@ def map_reduce(
     keyfunc: Callable[[_T], _U],
     valuefunc: None = ...,
     reducefunc: None = ...,
-) -> Dict[_U, List[_T]]: ...
+) -> dict[_U, list[_T]]: ...
 @overload
 def map_reduce(
     iterable: Iterable[_T],
     keyfunc: Callable[[_T], _U],
     valuefunc: Callable[[_T], _V],
     reducefunc: None = ...,
-) -> Dict[_U, List[_V]]: ...
+) -> dict[_U, list[_V]]: ...
 @overload
 def map_reduce(
     iterable: Iterable[_T],
     keyfunc: Callable[[_T], _U],
     valuefunc: None = ...,
-    reducefunc: Callable[[List[_T]], _W] = ...,
-) -> Dict[_U, _W]: ...
+    reducefunc: Callable[[list[_T]], _W] = ...,
+) -> dict[_U, _W]: ...
 @overload
 def map_reduce(
     iterable: Iterable[_T],
     keyfunc: Callable[[_T], _U],
     valuefunc: Callable[[_T], _V],
-    reducefunc: Callable[[List[_V]], _W],
-) -> Dict[_U, _W]: ...
+    reducefunc: Callable[[list[_V]], _W],
+) -> dict[_U, _W]: ...
 def rlocate(
     iterable: Iterable[_T],
     pred: Callable[..., object] = ...,
-    window_size: Optional[int] = ...,
+    window_size: int | None = ...,
 ) -> Iterator[int]: ...
 def replace(
     iterable: Iterable[_T],
     pred: Callable[..., object],
     substitutes: Iterable[_U],
-    count: Optional[int] = ...,
+    count: int | None = ...,
     window_size: int = ...,
-) -> Iterator[Union[_T, _U]]: ...
-def partitions(iterable: Iterable[_T]) -> Iterator[List[List[_T]]]: ...
+) -> Iterator[_T | _U]: ...
+def partitions(iterable: Iterable[_T]) -> Iterator[list[list[_T]]]: ...
 def set_partitions(
-    iterable: Iterable[_T], k: Optional[int] = ...
-) -> Iterator[List[List[_T]]]: ...
+    iterable: Iterable[_T], k: int | None = ...
+) -> Iterator[list[list[_T]]]: ...
 
 class time_limited(Generic[_T], Iterator[_T]):
     def __init__(
@@ -399,35 +512,42 @@ class time_limited(Generic[_T], Iterator[_T]):
 
 @overload
 def only(
-    iterable: Iterable[_T], *, too_long: Optional[_Raisable] = ...
-) -> Optional[_T]: ...
+    iterable: Iterable[_T], *, too_long: _Raisable | None = ...
+) -> _T | None: ...
 @overload
 def only(
-    iterable: Iterable[_T], default: _U, too_long: Optional[_Raisable] = ...
-) -> Union[_T, _U]: ...
+    iterable: Iterable[_T], default: _U, too_long: _Raisable | None = ...
+) -> _T | _U: ...
 def ichunked(iterable: Iterable[_T], n: int) -> Iterator[Iterator[_T]]: ...
 def distinct_combinations(
     iterable: Iterable[_T], r: int
-) -> Iterator[Tuple[_T, ...]]: ...
+) -> Iterator[tuple[_T, ...]]: ...
 def filter_except(
     validator: Callable[[Any], object],
     iterable: Iterable[_T],
-    *exceptions: Type[BaseException]
+    *exceptions: Type[BaseException],
 ) -> Iterator[_T]: ...
 def map_except(
     function: Callable[[Any], _U],
     iterable: Iterable[_T],
-    *exceptions: Type[BaseException]
+    *exceptions: Type[BaseException],
 ) -> Iterator[_U]: ...
+def map_if(
+    iterable: Iterable[Any],
+    pred: Callable[[Any], bool],
+    func: Callable[[Any], Any],
+    func_else: Callable[[Any], Any] | None = ...,
+) -> Iterator[Any]: ...
 def sample(
     iterable: Iterable[_T],
     k: int,
-    weights: Optional[Iterable[float]] = ...,
-) -> List[_T]: ...
+    weights: Iterable[float] | None = ...,
+) -> list[_T]: ...
 def is_sorted(
     iterable: Iterable[_T],
-    key: Optional[Callable[[_T], _U]] = ...,
+    key: Callable[[_T], _U] | None = ...,
     reverse: bool = False,
+    strict: bool = False,
 ) -> bool: ...
 
 class AbortThread(BaseException):
@@ -443,10 +563,10 @@ class callback_iter(Generic[_T], Iterator[_T]):
     def __enter__(self) -> callback_iter[_T]: ...
     def __exit__(
         self,
-        exc_type: Optional[Type[BaseException]],
-        exc_value: Optional[BaseException],
-        traceback: Optional[TracebackType],
-    ) -> Optional[bool]: ...
+        exc_type: Type[BaseException] | None,
+        exc_value: BaseException | None,
+        traceback: TracebackType | None,
+    ) -> bool | None: ...
     def __iter__(self) -> callback_iter[_T]: ...
     def __next__(self) -> _T: ...
     def _reader(self) -> Iterator[_T]: ...
@@ -457,24 +577,133 @@ class callback_iter(Generic[_T], Iterator[_T]):
 
 def windowed_complete(
     iterable: Iterable[_T], n: int
-) -> Iterator[Tuple[_T, ...]]: ...
+) -> Iterator[tuple[_T, ...]]: ...
 def all_unique(
-    iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = ...
+    iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
 ) -> bool: ...
-def nth_product(index: int, *args: Iterable[_T]) -> Tuple[_T, ...]: ...
+def nth_product(index: int, *args: Iterable[_T]) -> tuple[_T, ...]: ...
+def nth_combination_with_replacement(
+    iterable: Iterable[_T], r: int, index: int
+) -> tuple[_T, ...]: ...
 def nth_permutation(
     iterable: Iterable[_T], r: int, index: int
-) -> Tuple[_T, ...]: ...
-def value_chain(*args: Union[_T, Iterable[_T]]) -> Iterable[_T]: ...
+) -> tuple[_T, ...]: ...
+def value_chain(*args: _T | Iterable[_T]) -> Iterable[_T]: ...
 def product_index(element: Iterable[_T], *args: Iterable[_T]) -> int: ...
 def combination_index(
     element: Iterable[_T], iterable: Iterable[_T]
 ) -> int: ...
+def combination_with_replacement_index(
+    element: Iterable[_T], iterable: Iterable[_T]
+) -> int: ...
 def permutation_index(
     element: Iterable[_T], iterable: Iterable[_T]
 ) -> int: ...
+def repeat_each(iterable: Iterable[_T], n: int = ...) -> Iterator[_T]: ...
 
 class countable(Generic[_T], Iterator[_T]):
     def __init__(self, iterable: Iterable[_T]) -> None: ...
     def __iter__(self) -> countable[_T]: ...
     def __next__(self) -> _T: ...
+    items_seen: int
+
+def chunked_even(iterable: Iterable[_T], n: int) -> Iterator[list[_T]]: ...
+def zip_broadcast(
+    *objects: _T | Iterable[_T],
+    scalar_types: type | tuple[type | tuple[Any, ...], ...] | None = ...,
+    strict: bool = ...,
+) -> Iterable[tuple[_T, ...]]: ...
+def unique_in_window(
+    iterable: Iterable[_T], n: int, key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def duplicates_everseen(
+    iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def duplicates_justseen(
+    iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[_T]: ...
+def classify_unique(
+    iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> Iterator[tuple[_T, bool, bool]]: ...
+
+class _SupportsLessThan(Protocol):
+    def __lt__(self, __other: Any) -> bool: ...
+
+_SupportsLessThanT = TypeVar("_SupportsLessThanT", bound=_SupportsLessThan)
+
+@overload
+def minmax(
+    iterable_or_value: Iterable[_SupportsLessThanT], *, key: None = None
+) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+    iterable_or_value: Iterable[_T], *, key: Callable[[_T], _SupportsLessThan]
+) -> tuple[_T, _T]: ...
+@overload
+def minmax(
+    iterable_or_value: Iterable[_SupportsLessThanT],
+    *,
+    key: None = None,
+    default: _U,
+) -> _U | tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+    iterable_or_value: Iterable[_T],
+    *,
+    key: Callable[[_T], _SupportsLessThan],
+    default: _U,
+) -> _U | tuple[_T, _T]: ...
+@overload
+def minmax(
+    iterable_or_value: _SupportsLessThanT,
+    __other: _SupportsLessThanT,
+    *others: _SupportsLessThanT,
+) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ...
+@overload
+def minmax(
+    iterable_or_value: _T,
+    __other: _T,
+    *others: _T,
+    key: Callable[[_T], _SupportsLessThan],
+) -> tuple[_T, _T]: ...
+def longest_common_prefix(
+    iterables: Iterable[Iterable[_T]],
+) -> Iterator[_T]: ...
+def iequals(*iterables: Iterable[Any]) -> bool: ...
+def constrained_batches(
+    iterable: Iterable[_T],
+    max_size: int,
+    max_count: int | None = ...,
+    get_len: Callable[[_T], object] = ...,
+    strict: bool = ...,
+) -> Iterator[tuple[_T]]: ...
+def gray_product(*iterables: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def partial_product(*iterables: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
+def takewhile_inclusive(
+    predicate: Callable[[_T], bool], iterable: Iterable[_T]
+) -> Iterator[_T]: ...
+def outer_product(
+    func: Callable[[_T, _U], _V],
+    xs: Iterable[_T],
+    ys: Iterable[_U],
+    *args: Any,
+    **kwargs: Any,
+) -> Iterator[tuple[_V, ...]]: ...
+def iter_suppress(
+    iterable: Iterable[_T],
+    *exceptions: Type[BaseException],
+) -> Iterator[_T]: ...
+def filter_map(
+    func: Callable[[_T], _V | None],
+    iterable: Iterable[_T],
+) -> Iterator[_V]: ...
+def powerset_of_sets(iterable: Iterable[_T]) -> Iterator[set[_T]]: ...
+def join_mappings(
+    **field_to_map: Mapping[_T, _V]
+) -> dict[_T, dict[str, _V]]: ...
+def doublestarmap(
+    func: Callable[..., _T],
+    iterable: Iterable[Mapping[str, Any]],
+) -> Iterator[_T]: ...
+def dft(xarr: Sequence[complex]) -> Iterator[complex]: ...
+def idft(Xarr: Sequence[complex]) -> Iterator[complex]: ...
diff --git a/setuptools/_vendor/more_itertools/recipes.py b/setuptools/_vendor/more_itertools/recipes.py
index 521abd7c2c..b32fa95533 100644
--- a/setuptools/_vendor/more_itertools/recipes.py
+++ b/setuptools/_vendor/more_itertools/recipes.py
@@ -7,32 +7,44 @@
 .. [1] http://docs.python.org/library/itertools.html#recipes
 
 """
-import warnings
+
+import math
+import operator
+
 from collections import deque
+from collections.abc import Sized
+from functools import partial, reduce
 from itertools import (
     chain,
     combinations,
+    compress,
     count,
     cycle,
     groupby,
     islice,
+    product,
     repeat,
     starmap,
     tee,
     zip_longest,
 )
-import operator
 from random import randrange, sample, choice
+from sys import hexversion
 
 __all__ = [
     'all_equal',
+    'batched',
+    'before_and_after',
     'consume',
     'convolve',
     'dotproduct',
     'first_true',
+    'factor',
     'flatten',
     'grouper',
     'iter_except',
+    'iter_index',
+    'matmul',
     'ncycles',
     'nth',
     'nth_combination',
@@ -40,22 +52,48 @@
     'pad_none',
     'pairwise',
     'partition',
+    'polynomial_eval',
+    'polynomial_from_roots',
+    'polynomial_derivative',
     'powerset',
     'prepend',
     'quantify',
+    'reshape',
     'random_combination_with_replacement',
     'random_combination',
     'random_permutation',
     'random_product',
     'repeatfunc',
     'roundrobin',
+    'sieve',
+    'sliding_window',
+    'subslices',
+    'sum_of_squares',
     'tabulate',
     'tail',
     'take',
+    'totient',
+    'transpose',
+    'triplewise',
+    'unique',
     'unique_everseen',
     'unique_justseen',
 ]
 
+_marker = object()
+
+
+# zip with strict is available for Python 3.10+
+try:
+    zip(strict=True)
+except TypeError:
+    _zip_strict = zip
+else:
+    _zip_strict = partial(zip, strict=True)
+
+# math.sumprod is available for Python 3.12+
+_sumprod = getattr(math, 'sumprod', lambda x, y: dotproduct(x, y))
+
 
 def take(n, iterable):
     """Return first *n* items of the iterable as a list.
@@ -99,7 +137,14 @@ def tail(n, iterable):
     ['E', 'F', 'G']
 
     """
-    return iter(deque(iterable, maxlen=n))
+    # If the given iterable has a length, then we can use islice to get its
+    # final elements. Note that if the iterable is not actually Iterable,
+    # either islice or deque will throw a TypeError. This is why we don't
+    # check if it is Iterable.
+    if isinstance(iterable, Sized):
+        yield from islice(iterable, max(0, len(iterable) - n), None)
+    else:
+        yield from iter(deque(iterable, maxlen=n))
 
 
 def consume(iterator, n=None):
@@ -155,7 +200,7 @@ def nth(iterable, n, default=None):
     return next(islice(iterable, n, None), default)
 
 
-def all_equal(iterable):
+def all_equal(iterable, key=None):
     """
     Returns ``True`` if all the elements are equal to each other.
 
@@ -164,9 +209,16 @@ def all_equal(iterable):
         >>> all_equal('aaab')
         False
 
+    A function that accepts a single argument and returns a transformed version
+    of each input item can be specified with *key*:
+
+        >>> all_equal('AaaA', key=str.casefold)
+        True
+        >>> all_equal([1, 2, 3], key=lambda x: x < 10)
+        True
+
     """
-    g = groupby(iterable)
-    return next(g, True) and not next(g, False)
+    return len(list(islice(groupby(iterable, key), 2))) <= 1
 
 
 def quantify(iterable, pred=bool):
@@ -266,7 +318,7 @@ def _pairwise(iterable):
     """
     a, b = tee(iterable)
     next(b, None)
-    yield from zip(a, b)
+    return zip(a, b)
 
 
 try:
@@ -276,25 +328,84 @@ def _pairwise(iterable):
 else:
 
     def pairwise(iterable):
-        yield from itertools_pairwise(iterable)
+        return itertools_pairwise(iterable)
 
     pairwise.__doc__ = _pairwise.__doc__
 
 
-def grouper(iterable, n, fillvalue=None):
-    """Collect data into fixed-length chunks or blocks.
+class UnequalIterablesError(ValueError):
+    def __init__(self, details=None):
+        msg = 'Iterables have different lengths'
+        if details is not None:
+            msg += (': index 0 has length {}; index {} has length {}').format(
+                *details
+            )
+
+        super().__init__(msg)
+
 
-    >>> list(grouper('ABCDEFG', 3, 'x'))
+def _zip_equal_generator(iterables):
+    for combo in zip_longest(*iterables, fillvalue=_marker):
+        for val in combo:
+            if val is _marker:
+                raise UnequalIterablesError()
+        yield combo
+
+
+def _zip_equal(*iterables):
+    # Check whether the iterables are all the same size.
+    try:
+        first_size = len(iterables[0])
+        for i, it in enumerate(iterables[1:], 1):
+            size = len(it)
+            if size != first_size:
+                raise UnequalIterablesError(details=(first_size, i, size))
+        # All sizes are equal, we can use the built-in zip.
+        return zip(*iterables)
+    # If any one of the iterables didn't have a length, start reading
+    # them until one runs out.
+    except TypeError:
+        return _zip_equal_generator(iterables)
+
+
+def grouper(iterable, n, incomplete='fill', fillvalue=None):
+    """Group elements from *iterable* into fixed-length groups of length *n*.
+
+    >>> list(grouper('ABCDEF', 3))
+    [('A', 'B', 'C'), ('D', 'E', 'F')]
+
+    The keyword arguments *incomplete* and *fillvalue* control what happens for
+    iterables whose length is not a multiple of *n*.
+
+    When *incomplete* is `'fill'`, the last group will contain instances of
+    *fillvalue*.
+
+    >>> list(grouper('ABCDEFG', 3, incomplete='fill', fillvalue='x'))
     [('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'x', 'x')]
 
+    When *incomplete* is `'ignore'`, the last group will not be emitted.
+
+    >>> list(grouper('ABCDEFG', 3, incomplete='ignore', fillvalue='x'))
+    [('A', 'B', 'C'), ('D', 'E', 'F')]
+
+    When *incomplete* is `'strict'`, a subclass of `ValueError` will be raised.
+
+    >>> it = grouper('ABCDEFG', 3, incomplete='strict')
+    >>> list(it)  # doctest: +IGNORE_EXCEPTION_DETAIL
+    Traceback (most recent call last):
+    ...
+    UnequalIterablesError
+
     """
-    if isinstance(iterable, int):
-        warnings.warn(
-            "grouper expects iterable as first parameter", DeprecationWarning
-        )
-        n, iterable = iterable, n
     args = [iter(iterable)] * n
-    return zip_longest(fillvalue=fillvalue, *args)
+    if incomplete == 'fill':
+        return zip_longest(*args, fillvalue=fillvalue)
+    if incomplete == 'strict':
+        return _zip_equal(*args)
+    if incomplete == 'ignore':
+        return zip(*args)
+    else:
+        raise ValueError('Expected fill, strict, or ignore')
 
 
 def roundrobin(*iterables):
@@ -308,16 +419,11 @@ def roundrobin(*iterables):
     iterables is small).
 
     """
-    # Recipe credited to George Sakkis
-    pending = len(iterables)
-    nexts = cycle(iter(it).__next__ for it in iterables)
-    while pending:
-        try:
-            for next in nexts:
-                yield next()
-        except StopIteration:
-            pending -= 1
-            nexts = cycle(islice(nexts, pending))
+    # Algorithm credited to George Sakkis
+    iterators = map(iter, iterables)
+    for num_active in range(len(iterables), 0, -1):
+        iterators = cycle(islice(iterators, num_active))
+        yield from map(next, iterators)
 
 
 def partition(pred, iterable):
@@ -343,12 +449,9 @@ def partition(pred, iterable):
     if pred is None:
         pred = bool
 
-    evaluations = ((pred(x), x) for x in iterable)
-    t1, t2 = tee(evaluations)
-    return (
-        (x for (cond, x) in t1 if not cond),
-        (x for (cond, x) in t2 if cond),
-    )
+    t1, t2, p = tee(iterable, 3)
+    p1, p2 = tee(map(pred, p))
+    return (compress(t1, map(operator.not_, p1)), compress(t2, p2))
 
 
 def powerset(iterable):
@@ -359,16 +462,14 @@ def powerset(iterable):
 
     :func:`powerset` will operate on iterables that aren't :class:`set`
     instances, so repeated elements in the input will produce repeated elements
-    in the output. Use :func:`unique_everseen` on the input to avoid generating
-    duplicates:
+    in the output.
 
         >>> seq = [1, 1, 0]
         >>> list(powerset(seq))
         [(), (1,), (1,), (0,), (1, 1), (1, 0), (1, 0), (1, 1, 0)]
-        >>> from more_itertools import unique_everseen
-        >>> list(powerset(unique_everseen(seq)))
-        [(), (1,), (0,), (1, 0)]
 
+    For a variant that efficiently yields actual :class:`set` instances, see
+    :func:`powerset_of_sets`.
     """
     s = list(iterable)
     return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
@@ -396,7 +497,7 @@ def unique_everseen(iterable, key=None):
         >>> list(unique_everseen(iterable, key=tuple))  # Faster
         [[1, 2], [2, 3]]
 
-    Similary, you may want to convert unhashable ``set`` objects with
+    Similarly, you may want to convert unhashable ``set`` objects with
     ``key=frozenset``. For ``dict`` objects,
     ``key=lambda x: frozenset(x.items())`` can be used.
 
@@ -428,9 +529,31 @@ def unique_justseen(iterable, key=None):
     ['A', 'B', 'C', 'A', 'D']
 
     """
+    if key is None:
+        return map(operator.itemgetter(0), groupby(iterable))
+
     return map(next, map(operator.itemgetter(1), groupby(iterable, key)))
 
 
+def unique(iterable, key=None, reverse=False):
+    """Yields unique elements in sorted order.
+
+    >>> list(unique([[1, 2], [3, 4], [1, 2]]))
+    [[1, 2], [3, 4]]
+
+    *key* and *reverse* are passed to :func:`sorted`.
+
+    >>> list(unique('ABBcCAD', str.casefold))
+    ['A', 'B', 'c', 'D']
+    >>> list(unique('ABBcCAD', str.casefold, reverse=True))
+    ['D', 'c', 'B', 'A']
+
+    The elements in *iterable* need not be hashable, but they must be
+    comparable for sorting to work.
+    """
+    return unique_justseen(sorted(iterable, key=key, reverse=reverse), key=key)
+
+
 def iter_except(func, exception, first=None):
     """Yields results from a function repeatedly until an exception is raised.
 
@@ -442,6 +565,16 @@ def iter_except(func, exception, first=None):
         >>> list(iter_except(l.pop, IndexError))
         [2, 1, 0]
 
+    Multiple exceptions can be specified as a stopping condition:
+
+        >>> l = [1, 2, 3, '...', 4, 5, 6]
+        >>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
+        [7, 6, 5]
+        >>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
+        [4, 3, 2]
+        >>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
+        []
+
     """
     try:
         if first is not None:
@@ -612,9 +745,302 @@ def convolve(signal, kernel):
     is immediately consumed and stored.
 
     """
+    # This implementation intentionally doesn't match the one in the itertools
+    # documentation.
     kernel = tuple(kernel)[::-1]
     n = len(kernel)
     window = deque([0], maxlen=n) * n
     for x in chain(signal, repeat(0, n - 1)):
         window.append(x)
-        yield sum(map(operator.mul, kernel, window))
+        yield _sumprod(kernel, window)
+
+
+def before_and_after(predicate, it):
+    """A variant of :func:`takewhile` that allows complete access to the
+    remainder of the iterator.
+
+         >>> it = iter('ABCdEfGhI')
+         >>> all_upper, remainder = before_and_after(str.isupper, it)
+         >>> ''.join(all_upper)
+         'ABC'
+         >>> ''.join(remainder) # takewhile() would lose the 'd'
+         'dEfGhI'
+
+    Note that the first iterator must be fully consumed before the second
+    iterator can generate valid results.
+    """
+    it = iter(it)
+    transition = []
+
+    def true_iterator():
+        for elem in it:
+            if predicate(elem):
+                yield elem
+            else:
+                transition.append(elem)
+                return
+
+    # Note: this is different from itertools recipes to allow nesting
+    # before_and_after remainders into before_and_after again. See tests
+    # for an example.
+    remainder_iterator = chain(transition, it)
+
+    return true_iterator(), remainder_iterator
+
+
+def triplewise(iterable):
+    """Return overlapping triplets from *iterable*.
+
+    >>> list(triplewise('ABCDE'))
+    [('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E')]
+
+    """
+    for (a, _), (b, c) in pairwise(pairwise(iterable)):
+        yield a, b, c
+
+
+def sliding_window(iterable, n):
+    """Return a sliding window of width *n* over *iterable*.
+
+        >>> list(sliding_window(range(6), 4))
+        [(0, 1, 2, 3), (1, 2, 3, 4), (2, 3, 4, 5)]
+
+    If *iterable* has fewer than *n* items, then nothing is yielded:
+
+        >>> list(sliding_window(range(3), 4))
+        []
+
+    For a variant with more features, see :func:`windowed`.
+    """
+    it = iter(iterable)
+    window = deque(islice(it, n - 1), maxlen=n)
+    for x in it:
+        window.append(x)
+        yield tuple(window)
+
+
+def subslices(iterable):
+    """Return all contiguous non-empty subslices of *iterable*.
+
+        >>> list(subslices('ABC'))
+        [['A'], ['A', 'B'], ['A', 'B', 'C'], ['B'], ['B', 'C'], ['C']]
+
+    This is similar to :func:`substrings`, but emits items in a different
+    order.
+    """
+    seq = list(iterable)
+    slices = starmap(slice, combinations(range(len(seq) + 1), 2))
+    return map(operator.getitem, repeat(seq), slices)
+
+
+def polynomial_from_roots(roots):
+    """Compute a polynomial's coefficients from its roots.
+
+    >>> roots = [5, -4, 3]  # (x - 5) * (x + 4) * (x - 3)
+    >>> polynomial_from_roots(roots)  # x^3 - 4 * x^2 - 17 * x + 60
+    [1, -4, -17, 60]
+    """
+    factors = zip(repeat(1), map(operator.neg, roots))
+    return list(reduce(convolve, factors, [1]))
+
+
+def iter_index(iterable, value, start=0, stop=None):
+    """Yield the index of each place in *iterable* that *value* occurs,
+    beginning with index *start* and ending before index *stop*.
+
+
+    >>> list(iter_index('AABCADEAF', 'A'))
+    [0, 1, 4, 7]
+    >>> list(iter_index('AABCADEAF', 'A', 1))  # start index is inclusive
+    [1, 4, 7]
+    >>> list(iter_index('AABCADEAF', 'A', 1, 7))  # stop index is not inclusive
+    [1, 4]
+
+    The behavior for non-scalar *values* matches the built-in Python types.
+
+    >>> list(iter_index('ABCDABCD', 'AB'))
+    [0, 4]
+    >>> list(iter_index([0, 1, 2, 3, 0, 1, 2, 3], [0, 1]))
+    []
+    >>> list(iter_index([[0, 1], [2, 3], [0, 1], [2, 3]], [0, 1]))
+    [0, 2]
+
+    See :func:`locate` for a more general means of finding the indexes
+    associated with particular values.
+
+    """
+    seq_index = getattr(iterable, 'index', None)
+    if seq_index is None:
+        # Slow path for general iterables
+        it = islice(iterable, start, stop)
+        for i, element in enumerate(it, start):
+            if element is value or element == value:
+                yield i
+    else:
+        # Fast path for sequences
+        stop = len(iterable) if stop is None else stop
+        i = start - 1
+        try:
+            while True:
+                yield (i := seq_index(value, i + 1, stop))
+        except ValueError:
+            pass
+
+
+def sieve(n):
+    """Yield the primes less than n.
+
+    >>> list(sieve(30))
+    [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
+    """
+    if n > 2:
+        yield 2
+    start = 3
+    data = bytearray((0, 1)) * (n // 2)
+    limit = math.isqrt(n) + 1
+    for p in iter_index(data, 1, start, limit):
+        yield from iter_index(data, 1, start, p * p)
+        data[p * p : n : p + p] = bytes(len(range(p * p, n, p + p)))
+        start = p * p
+    yield from iter_index(data, 1, start)
+
+
+def _batched(iterable, n, *, strict=False):
+    """Batch data into tuples of length *n*. If the number of items in
+    *iterable* is not divisible by *n*:
+    * The last batch will be shorter if *strict* is ``False``.
+    * :exc:`ValueError` will be raised if *strict* is ``True``.
+
+    >>> list(batched('ABCDEFG', 3))
+    [('A', 'B', 'C'), ('D', 'E', 'F'), ('G',)]
+
+    On Python 3.13 and above, this is an alias for :func:`itertools.batched`.
+    """
+    if n < 1:
+        raise ValueError('n must be at least one')
+    it = iter(iterable)
+    while batch := tuple(islice(it, n)):
+        if strict and len(batch) != n:
+            raise ValueError('batched(): incomplete batch')
+        yield batch
+
+
+if hexversion >= 0x30D00A2:
+    from itertools import batched as itertools_batched
+
+    def batched(iterable, n, *, strict=False):
+        return itertools_batched(iterable, n, strict=strict)
+
+else:
+    batched = _batched
+
+    batched.__doc__ = _batched.__doc__
+
+
+def transpose(it):
+    """Swap the rows and columns of the input matrix.
+
+    >>> list(transpose([(1, 2, 3), (11, 22, 33)]))
+    [(1, 11), (2, 22), (3, 33)]
+
+    The caller should ensure that the dimensions of the input are compatible.
+    If the input is empty, no output will be produced.
+    """
+    return _zip_strict(*it)
+
+
+def reshape(matrix, cols):
+    """Reshape the 2-D input *matrix* to have a column count given by *cols*.
+
+    >>> matrix = [(0, 1), (2, 3), (4, 5)]
+    >>> cols = 3
+    >>> list(reshape(matrix, cols))
+    [(0, 1, 2), (3, 4, 5)]
+    """
+    return batched(chain.from_iterable(matrix), cols)
+
+
+def matmul(m1, m2):
+    """Multiply two matrices.
+
+    >>> list(matmul([(7, 5), (3, 5)], [(2, 5), (7, 9)]))
+    [(49, 80), (41, 60)]
+
+    The caller should ensure that the dimensions of the input matrices are
+    compatible with each other.
+    """
+    n = len(m2[0])
+    return batched(starmap(_sumprod, product(m1, transpose(m2))), n)
+
+
+def factor(n):
+    """Yield the prime factors of n.
+
+    >>> list(factor(360))
+    [2, 2, 2, 3, 3, 5]
+    """
+    for prime in sieve(math.isqrt(n) + 1):
+        while not n % prime:
+            yield prime
+            n //= prime
+            if n == 1:
+                return
+    if n > 1:
+        yield n
+
+
+def polynomial_eval(coefficients, x):
+    """Evaluate a polynomial at a specific value.
+
+    Example: evaluating x^3 - 4 * x^2 - 17 * x + 60 at x = 2.5:
+
+    >>> coefficients = [1, -4, -17, 60]
+    >>> x = 2.5
+    >>> polynomial_eval(coefficients, x)
+    8.125
+    """
+    n = len(coefficients)
+    if n == 0:
+        return x * 0  # coerce zero to the type of x
+    powers = map(pow, repeat(x), reversed(range(n)))
+    return _sumprod(coefficients, powers)
+
+
+def sum_of_squares(it):
+    """Return the sum of the squares of the input values.
+
+    >>> sum_of_squares([10, 20, 30])
+    1400
+    """
+    return _sumprod(*tee(it))
+
+
+def polynomial_derivative(coefficients):
+    """Compute the first derivative of a polynomial.
+
+    Example: evaluating the derivative of x^3 - 4 * x^2 - 17 * x + 60
+
+    >>> coefficients = [1, -4, -17, 60]
+    >>> derivative_coefficients = polynomial_derivative(coefficients)
+    >>> derivative_coefficients
+    [3, -8, -17]
+    """
+    n = len(coefficients)
+    powers = reversed(range(1, n))
+    return list(map(operator.mul, coefficients, powers))
+
+
+def totient(n):
+    """Return the count of natural numbers up to *n* that are coprime with *n*.
+
+    >>> totient(9)
+    6
+    >>> totient(12)
+    4
+    """
+    # The itertools docs use unique_justseen instead of set; see
+    # https://github.com/more-itertools/more-itertools/issues/823
+    for p in set(factor(n)):
+        n = n // p * (p - 1)
+
+    return n
diff --git a/setuptools/_vendor/more_itertools/recipes.pyi b/setuptools/_vendor/more_itertools/recipes.pyi
index 5e39d96390..739acec05f 100644
--- a/setuptools/_vendor/more_itertools/recipes.pyi
+++ b/setuptools/_vendor/more_itertools/recipes.pyi
@@ -1,103 +1,136 @@
 """Stubs for more_itertools.recipes"""
+
+from __future__ import annotations
+
 from typing import (
     Any,
     Callable,
     Iterable,
     Iterator,
-    List,
-    Optional,
-    Tuple,
+    overload,
+    Sequence,
+    Type,
     TypeVar,
-    Union,
 )
-from typing_extensions import overload, Type
 
 # Type and type variable definitions
 _T = TypeVar('_T')
+_T1 = TypeVar('_T1')
+_T2 = TypeVar('_T2')
 _U = TypeVar('_U')
 
-def take(n: int, iterable: Iterable[_T]) -> List[_T]: ...
+def take(n: int, iterable: Iterable[_T]) -> list[_T]: ...
 def tabulate(
     function: Callable[[int], _T], start: int = ...
 ) -> Iterator[_T]: ...
 def tail(n: int, iterable: Iterable[_T]) -> Iterator[_T]: ...
-def consume(iterator: Iterable[object], n: Optional[int] = ...) -> None: ...
+def consume(iterator: Iterable[_T], n: int | None = ...) -> None: ...
 @overload
-def nth(iterable: Iterable[_T], n: int) -> Optional[_T]: ...
+def nth(iterable: Iterable[_T], n: int) -> _T | None: ...
 @overload
-def nth(iterable: Iterable[_T], n: int, default: _U) -> Union[_T, _U]: ...
-def all_equal(iterable: Iterable[object]) -> bool: ...
+def nth(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ...
+def all_equal(
+    iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> bool: ...
 def quantify(
     iterable: Iterable[_T], pred: Callable[[_T], bool] = ...
 ) -> int: ...
-def pad_none(iterable: Iterable[_T]) -> Iterator[Optional[_T]]: ...
-def padnone(iterable: Iterable[_T]) -> Iterator[Optional[_T]]: ...
+def pad_none(iterable: Iterable[_T]) -> Iterator[_T | None]: ...
+def padnone(iterable: Iterable[_T]) -> Iterator[_T | None]: ...
 def ncycles(iterable: Iterable[_T], n: int) -> Iterator[_T]: ...
-def dotproduct(vec1: Iterable[object], vec2: Iterable[object]) -> object: ...
+def dotproduct(vec1: Iterable[_T1], vec2: Iterable[_T2]) -> Any: ...
 def flatten(listOfLists: Iterable[Iterable[_T]]) -> Iterator[_T]: ...
 def repeatfunc(
-    func: Callable[..., _U], times: Optional[int] = ..., *args: Any
+    func: Callable[..., _U], times: int | None = ..., *args: Any
 ) -> Iterator[_U]: ...
-def pairwise(iterable: Iterable[_T]) -> Iterator[Tuple[_T, _T]]: ...
-@overload
+def pairwise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T]]: ...
 def grouper(
-    iterable: Iterable[_T], n: int
-) -> Iterator[Tuple[Optional[_T], ...]]: ...
-@overload
-def grouper(
-    iterable: Iterable[_T], n: int, fillvalue: _U
-) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
-@overload
-def grouper(  # Deprecated interface
-    iterable: int, n: Iterable[_T]
-) -> Iterator[Tuple[Optional[_T], ...]]: ...
-@overload
-def grouper(  # Deprecated interface
-    iterable: int, n: Iterable[_T], fillvalue: _U
-) -> Iterator[Tuple[Union[_T, _U], ...]]: ...
+    iterable: Iterable[_T],
+    n: int,
+    incomplete: str = ...,
+    fillvalue: _U = ...,
+) -> Iterator[tuple[_T | _U, ...]]: ...
 def roundrobin(*iterables: Iterable[_T]) -> Iterator[_T]: ...
 def partition(
-    pred: Optional[Callable[[_T], object]], iterable: Iterable[_T]
-) -> Tuple[Iterator[_T], Iterator[_T]]: ...
-def powerset(iterable: Iterable[_T]) -> Iterator[Tuple[_T, ...]]: ...
+    pred: Callable[[_T], object] | None, iterable: Iterable[_T]
+) -> tuple[Iterator[_T], Iterator[_T]]: ...
+def powerset(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ...
 def unique_everseen(
-    iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = ...
+    iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
 ) -> Iterator[_T]: ...
 def unique_justseen(
-    iterable: Iterable[_T], key: Optional[Callable[[_T], object]] = ...
+    iterable: Iterable[_T], key: Callable[[_T], object] | None = ...
+) -> Iterator[_T]: ...
+def unique(
+    iterable: Iterable[_T],
+    key: Callable[[_T], object] | None = ...,
+    reverse: bool = False,
 ) -> Iterator[_T]: ...
 @overload
 def iter_except(
-    func: Callable[[], _T], exception: Type[BaseException], first: None = ...
+    func: Callable[[], _T],
+    exception: Type[BaseException] | tuple[Type[BaseException], ...],
+    first: None = ...,
 ) -> Iterator[_T]: ...
 @overload
 def iter_except(
     func: Callable[[], _T],
-    exception: Type[BaseException],
+    exception: Type[BaseException] | tuple[Type[BaseException], ...],
     first: Callable[[], _U],
-) -> Iterator[Union[_T, _U]]: ...
+) -> Iterator[_T | _U]: ...
 @overload
 def first_true(
-    iterable: Iterable[_T], *, pred: Optional[Callable[[_T], object]] = ...
-) -> Optional[_T]: ...
+    iterable: Iterable[_T], *, pred: Callable[[_T], object] | None = ...
+) -> _T | None: ...
 @overload
 def first_true(
     iterable: Iterable[_T],
     default: _U,
-    pred: Optional[Callable[[_T], object]] = ...,
-) -> Union[_T, _U]: ...
+    pred: Callable[[_T], object] | None = ...,
+) -> _T | _U: ...
 def random_product(
     *args: Iterable[_T], repeat: int = ...
-) -> Tuple[_T, ...]: ...
+) -> tuple[_T, ...]: ...
 def random_permutation(
-    iterable: Iterable[_T], r: Optional[int] = ...
-) -> Tuple[_T, ...]: ...
-def random_combination(iterable: Iterable[_T], r: int) -> Tuple[_T, ...]: ...
+    iterable: Iterable[_T], r: int | None = ...
+) -> tuple[_T, ...]: ...
+def random_combination(iterable: Iterable[_T], r: int) -> tuple[_T, ...]: ...
 def random_combination_with_replacement(
     iterable: Iterable[_T], r: int
-) -> Tuple[_T, ...]: ...
+) -> tuple[_T, ...]: ...
 def nth_combination(
     iterable: Iterable[_T], r: int, index: int
-) -> Tuple[_T, ...]: ...
-def prepend(value: _T, iterator: Iterable[_U]) -> Iterator[Union[_T, _U]]: ...
+) -> tuple[_T, ...]: ...
+def prepend(value: _T, iterator: Iterable[_U]) -> Iterator[_T | _U]: ...
 def convolve(signal: Iterable[_T], kernel: Iterable[_T]) -> Iterator[_T]: ...
+def before_and_after(
+    predicate: Callable[[_T], bool], it: Iterable[_T]
+) -> tuple[Iterator[_T], Iterator[_T]]: ...
+def triplewise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T, _T]]: ...
+def sliding_window(
+    iterable: Iterable[_T], n: int
+) -> Iterator[tuple[_T, ...]]: ...
+def subslices(iterable: Iterable[_T]) -> Iterator[list[_T]]: ...
+def polynomial_from_roots(roots: Sequence[_T]) -> list[_T]: ...
+def iter_index(
+    iterable: Iterable[_T],
+    value: Any,
+    start: int | None = ...,
+    stop: int | None = ...,
+) -> Iterator[int]: ...
+def sieve(n: int) -> Iterator[int]: ...
+def batched(
+    iterable: Iterable[_T], n: int, *, strict: bool = False
+) -> Iterator[tuple[_T]]: ...
+def transpose(
+    it: Iterable[Iterable[_T]],
+) -> Iterator[tuple[_T, ...]]: ...
+def reshape(
+    matrix: Iterable[Iterable[_T]], cols: int
+) -> Iterator[tuple[_T, ...]]: ...
+def matmul(m1: Sequence[_T], m2: Sequence[_T]) -> Iterator[tuple[_T]]: ...
+def factor(n: int) -> Iterator[int]: ...
+def polynomial_eval(coefficients: Sequence[_T], x: _U) -> _U: ...
+def sum_of_squares(it: Iterable[_T]) -> _T: ...
+def polynomial_derivative(coefficients: Sequence[_T]) -> list[_T]: ...
+def totient(n: int) -> int: ...
diff --git a/setuptools/_vendor/ordered_set-3.1.1.dist-info/RECORD b/setuptools/_vendor/ordered_set-3.1.1.dist-info/RECORD
deleted file mode 100644
index 3267872d45..0000000000
--- a/setuptools/_vendor/ordered_set-3.1.1.dist-info/RECORD
+++ /dev/null
@@ -1,9 +0,0 @@
-__pycache__/ordered_set.cpython-312.pyc,,
-ordered_set-3.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-ordered_set-3.1.1.dist-info/METADATA,sha256=qEaJM9CbGNixB_jvfohisKbXTUjcef6nCCcBJju6f4U,5357
-ordered_set-3.1.1.dist-info/MIT-LICENSE,sha256=TvRE7qUSUBcd0ols7wgNf3zDEEJWW7kv7WDRySrMBBE,1071
-ordered_set-3.1.1.dist-info/RECORD,,
-ordered_set-3.1.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-ordered_set-3.1.1.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
-ordered_set-3.1.1.dist-info/top_level.txt,sha256=NTY2_aDi1Do9fl3Z9EmWPxasFkUeW2dzO2D3RDx5CfM,12
-ordered_set.py,sha256=dbaCcs27dyN9gnMWGF5nA_BrVn6Q-NrjKYJpV9_fgBs,15130
diff --git a/setuptools/_vendor/ordered_set-3.1.1.dist-info/top_level.txt b/setuptools/_vendor/ordered_set-3.1.1.dist-info/top_level.txt
deleted file mode 100644
index 1c191eef52..0000000000
--- a/setuptools/_vendor/ordered_set-3.1.1.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-ordered_set
diff --git a/setuptools/_vendor/zipp-3.7.0.dist-info/INSTALLER b/setuptools/_vendor/ordered_set-4.1.0.dist-info/INSTALLER
similarity index 100%
rename from setuptools/_vendor/zipp-3.7.0.dist-info/INSTALLER
rename to setuptools/_vendor/ordered_set-4.1.0.dist-info/INSTALLER
diff --git a/setuptools/_vendor/ordered_set-3.1.1.dist-info/METADATA b/setuptools/_vendor/ordered_set-4.1.0.dist-info/METADATA
similarity index 74%
rename from setuptools/_vendor/ordered_set-3.1.1.dist-info/METADATA
rename to setuptools/_vendor/ordered_set-4.1.0.dist-info/METADATA
index 4c64d142b9..7aea136818 100644
--- a/setuptools/_vendor/ordered_set-3.1.1.dist-info/METADATA
+++ b/setuptools/_vendor/ordered_set-4.1.0.dist-info/METADATA
@@ -1,37 +1,46 @@
 Metadata-Version: 2.1
 Name: ordered-set
-Version: 3.1.1
-Summary: A MutableSet that remembers its order, so that every entry has an index.
-Home-page: https://github.com/LuminosoInsight/ordered-set
-Maintainer: Robyn Speer
-Maintainer-email: rspeer@luminoso.com
-License: MIT-LICENSE
-Platform: any
+Version: 4.1.0
+Summary: An OrderedSet is a custom MutableSet that remembers its order, so that every
+Author-email: Elia Robyn Lake 
+Requires-Python: >=3.7
+Description-Content-Type: text/markdown
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
-Classifier: Programming Language :: Python :: 3.5
-Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
-Requires-Python: >=2.7
-Description-Content-Type: text/markdown
-License-File: MIT-LICENSE
+Requires-Dist: pytest ; extra == "dev"
+Requires-Dist: black ; extra == "dev"
+Requires-Dist: mypy ; extra == "dev"
+Project-URL: Home, https://github.com/rspeer/ordered-set
+Provides-Extra: dev
 
-[![Travis](https://img.shields.io/travis/LuminosoInsight/ordered-set/master.svg?label=Travis%20CI)](https://travis-ci.org/LuminosoInsight/ordered-set)
-[![Codecov](https://codecov.io/github/LuminosoInsight/ordered-set/badge.svg?branch=master&service=github)](https://codecov.io/github/LuminosoInsight/ordered-set?branch=master)
 [![Pypi](https://img.shields.io/pypi/v/ordered-set.svg)](https://pypi.python.org/pypi/ordered-set)
 
 An OrderedSet is a mutable data structure that is a hybrid of a list and a set.
 It remembers the order of its entries, and every entry has an index number that
 can be looked up.
 
+## Installation
+
+`ordered_set` is available on PyPI and packaged as a wheel. You can list it
+as a dependency of your project, in whatever form that takes.
+
+To install it into your current Python environment:
+
+    pip install ordered-set
+
+To install the code for development, after checking out the repository:
+
+    pip install flit
+    flit install
 
 ## Usage examples
 
@@ -95,8 +104,13 @@ OrderedSet implements `__getstate__` and `__setstate__` so it can be pickled,
 and implements the abstract base classes `collections.MutableSet` and
 `collections.Sequence`.
 
+OrderedSet can be used as a generic collection type, similar to the collections
+in the `typing` module like List, Dict, and Set. For example, you can annotate
+a variable as having the type `OrderedSet[str]` or `OrderedSet[Tuple[int,
+str]]`.
 
-## Interoperability with NumPy and Pandas
+
+## OrderedSet in data science applications
 
 An OrderedSet can be used as a bi-directional mapping between a sparse
 vocabulary and dense index numbers. As of version 3.1, it accepts NumPy arrays
@@ -112,17 +126,11 @@ indexing in reverse) are both aliases for `index` (which handles both cases
 in OrderedSet).
 
 
-## Type hinting
-To use type hinting features install `ordered-set-stubs` package from
-[PyPI](https://pypi.org/project/ordered-set-stubs/):
-
-    $ pip install ordered-set-stubs
-
-
 ## Authors
 
-OrderedSet was implemented by Robyn Speer. Jon Crall contributed changes and
-tests to make it fit the Python set API.
+OrderedSet was implemented by Elia Robyn Lake (maiden name: Robyn Speer).
+Jon Crall contributed changes and tests to make it fit the Python set API.
+Roman Inflianskas added the original type annotations.
 
 
 ## Comparisons
@@ -148,8 +156,3 @@ does not provide the list-like random access features of OrderedSet. You
 would have to convert it to a list in O(N) to look up the index of an entry or
 look up an entry by its index.
 
-
-## Compatibility
-
-OrderedSet is automatically tested on Python 2.7, 3.4, 3.5, 3.6, and 3.7.
-We've checked more informally that it works on PyPy and PyPy3.
diff --git a/setuptools/_vendor/ordered_set-4.1.0.dist-info/RECORD b/setuptools/_vendor/ordered_set-4.1.0.dist-info/RECORD
new file mode 100644
index 0000000000..a9875cde4e
--- /dev/null
+++ b/setuptools/_vendor/ordered_set-4.1.0.dist-info/RECORD
@@ -0,0 +1,8 @@
+ordered_set-4.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+ordered_set-4.1.0.dist-info/METADATA,sha256=FqVN_VUTJTCDQ-vtnmXrbgapDjciET-54gSNJ47sro8,5340
+ordered_set-4.1.0.dist-info/RECORD,,
+ordered_set-4.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+ordered_set-4.1.0.dist-info/WHEEL,sha256=jPMR_Dzkc4X4icQtmz81lnNY_kAsfog7ry7qoRvYLXw,81
+ordered_set/__init__.py,sha256=ytazgKsyBKi9uFtBt938yXxQtdat1VCC681s9s0CMqg,17146
+ordered_set/__pycache__/__init__.cpython-312.pyc,,
+ordered_set/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/setuptools/_vendor/ordered_set-4.1.0.dist-info/REQUESTED b/setuptools/_vendor/ordered_set-4.1.0.dist-info/REQUESTED
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/ordered_set-4.1.0.dist-info/WHEEL b/setuptools/_vendor/ordered_set-4.1.0.dist-info/WHEEL
new file mode 100644
index 0000000000..c727d14823
--- /dev/null
+++ b/setuptools/_vendor/ordered_set-4.1.0.dist-info/WHEEL
@@ -0,0 +1,4 @@
+Wheel-Version: 1.0
+Generator: flit 3.6.0
+Root-Is-Purelib: true
+Tag: py3-none-any
diff --git a/setuptools/_vendor/ordered_set.py b/setuptools/_vendor/ordered_set/__init__.py
similarity index 72%
rename from setuptools/_vendor/ordered_set.py
rename to setuptools/_vendor/ordered_set/__init__.py
index 14876000de..e86c70ed80 100644
--- a/setuptools/_vendor/ordered_set.py
+++ b/setuptools/_vendor/ordered_set/__init__.py
@@ -1,45 +1,58 @@
 """
 An OrderedSet is a custom MutableSet that remembers its order, so that every
-entry has an index that can be looked up.
+entry has an index that can be looked up. It can also act like a Sequence.
 
 Based on a recipe originally posted to ActiveState Recipes by Raymond Hettiger,
 and released under the MIT license.
 """
 import itertools as it
-from collections import deque
-
-try:
-    # Python 3
-    from collections.abc import MutableSet, Sequence
-except ImportError:
-    # Python 2.7
-    from collections import MutableSet, Sequence
+from typing import (
+    Any,
+    Dict,
+    Iterable,
+    Iterator,
+    List,
+    MutableSet,
+    AbstractSet,
+    Sequence,
+    Set,
+    TypeVar,
+    Union,
+    overload,
+)
 
 SLICE_ALL = slice(None)
-__version__ = "3.1"
+__version__ = "4.1.0"
+
+
+T = TypeVar("T")
 
+# SetLike[T] is either a set of elements of type T, or a sequence, which
+# we will convert to an OrderedSet by adding its elements in order.
+SetLike = Union[AbstractSet[T], Sequence[T]]
+OrderedSetInitializer = Union[AbstractSet[T], Sequence[T], Iterable[T]]
 
-def is_iterable(obj):
+
+def _is_atomic(obj: Any) -> bool:
     """
-    Are we being asked to look up a list of things, instead of a single thing?
-    We check for the `__iter__` attribute so that this can cover types that
-    don't have to be known by this module, such as NumPy arrays.
+    Returns True for objects which are iterable but should not be iterated in
+    the context of indexing an OrderedSet.
+
+    When we index by an iterable, usually that means we're being asked to look
+    up a list of things.
 
-    Strings, however, should be considered as atomic values to look up, not
-    iterables. The same goes for tuples, since they are immutable and therefore
-    valid entries.
+    However, in the case of the .index() method, we shouldn't handle strings
+    and tuples like other iterables. They're not sequences of things to look
+    up, they're the single, atomic thing we're trying to find.
 
-    We don't need to check for the Python 2 `unicode` type, because it doesn't
-    have an `__iter__` attribute anyway.
+    As an example, oset.index('hello') should give the index of 'hello' in an
+    OrderedSet of strings. It shouldn't give the indexes of each individual
+    character.
     """
-    return (
-        hasattr(obj, "__iter__")
-        and not isinstance(obj, str)
-        and not isinstance(obj, tuple)
-    )
+    return isinstance(obj, str) or isinstance(obj, tuple)
 
 
-class OrderedSet(MutableSet, Sequence):
+class OrderedSet(MutableSet[T], Sequence[T]):
     """
     An OrderedSet is a custom MutableSet that remembers its order, so that
     every entry has an index that can be looked up.
@@ -49,11 +62,14 @@ class OrderedSet(MutableSet, Sequence):
         OrderedSet([1, 2, 3])
     """
 
-    def __init__(self, iterable=None):
-        self.items = []
-        self.map = {}
-        if iterable is not None:
-            self |= iterable
+    def __init__(self, initial: OrderedSetInitializer[T] = None):
+        self.items: List[T] = []
+        self.map: Dict[T, int] = {}
+        if initial is not None:
+            # In terms of duck-typing, the default __ior__ is compatible with
+            # the types we use, but it doesn't expect all the types we
+            # support as values for `initial`.
+            self |= initial  # type: ignore
 
     def __len__(self):
         """
@@ -67,6 +83,19 @@ def __len__(self):
         """
         return len(self.items)
 
+    @overload
+    def __getitem__(self, index: slice) -> "OrderedSet[T]":
+        ...
+
+    @overload
+    def __getitem__(self, index: Sequence[int]) -> List[T]:
+        ...
+
+    @overload
+    def __getitem__(self, index: int) -> T:
+        ...
+
+    # concrete implementation
     def __getitem__(self, index):
         """
         Get the item at a given index.
@@ -87,9 +116,9 @@ def __getitem__(self, index):
         """
         if isinstance(index, slice) and index == SLICE_ALL:
             return self.copy()
-        elif is_iterable(index):
+        elif isinstance(index, Iterable):
             return [self.items[i] for i in index]
-        elif hasattr(index, "__index__") or isinstance(index, slice):
+        elif isinstance(index, slice) or hasattr(index, "__index__"):
             result = self.items[index]
             if isinstance(result, list):
                 return self.__class__(result)
@@ -98,7 +127,7 @@ def __getitem__(self, index):
         else:
             raise TypeError("Don't know how to index an OrderedSet by %r" % index)
 
-    def copy(self):
+    def copy(self) -> "OrderedSet[T]":
         """
         Return a shallow copy of this object.
 
@@ -112,9 +141,12 @@ def copy(self):
         """
         return self.__class__(self)
 
+    # Define the gritty details of how an OrderedSet is serialized as a pickle.
+    # We leave off type annotations, because the only code that should interact
+    # with these is a generalized tool such as pickle.
     def __getstate__(self):
         if len(self) == 0:
-            # The state can't be an empty list.
+            # In pickle, the state can't be an empty list.
             # We need to return a truthy value, or else __setstate__ won't be run.
             #
             # This could have been done more gracefully by always putting the state
@@ -130,9 +162,9 @@ def __setstate__(self, state):
         else:
             self.__init__(state)
 
-    def __contains__(self, key):
+    def __contains__(self, key: Any) -> bool:
         """
-        Test if the item is in this ordered set
+        Test if the item is in this ordered set.
 
         Example:
             >>> 1 in OrderedSet([1, 3, 2])
@@ -142,7 +174,10 @@ def __contains__(self, key):
         """
         return key in self.map
 
-    def add(self, key):
+    # Technically type-incompatible with MutableSet, because we return an
+    # int instead of nothing. This is also one of the things that makes
+    # OrderedSet convenient to use.
+    def add(self, key: T) -> int:
         """
         Add `key` as an item to this OrderedSet, then return its index.
 
@@ -163,7 +198,7 @@ def add(self, key):
 
     append = add
 
-    def update(self, sequence):
+    def update(self, sequence: SetLike[T]) -> int:
         """
         Update the set with the given iterable sequence, then return the index
         of the last element inserted.
@@ -175,7 +210,7 @@ def update(self, sequence):
             >>> print(oset)
             OrderedSet([1, 2, 3, 5, 4])
         """
-        item_index = None
+        item_index = 0
         try:
             for item in sequence:
                 item_index = self.add(item)
@@ -185,6 +220,15 @@ def update(self, sequence):
             )
         return item_index
 
+    @overload
+    def index(self, key: Sequence[T]) -> List[int]:
+        ...
+
+    @overload
+    def index(self, key: T) -> int:
+        ...
+
+    # concrete implementation
     def index(self, key):
         """
         Get the index of a given entry, raising an IndexError if it's not
@@ -198,7 +242,7 @@ def index(self, key):
             >>> oset.index(2)
             1
         """
-        if is_iterable(key):
+        if isinstance(key, Iterable) and not _is_atomic(key):
             return [self.index(subkey) for subkey in key]
         return self.map[key]
 
@@ -206,11 +250,12 @@ def index(self, key):
     get_loc = index
     get_indexer = index
 
-    def pop(self):
+    def pop(self, index=-1) -> T:
         """
-        Remove and return the last element from the set.
+        Remove and return item at index (default last).
 
         Raises KeyError if the set is empty.
+        Raises IndexError if index is out of range.
 
         Example:
             >>> oset = OrderedSet([1, 2, 3])
@@ -220,12 +265,12 @@ def pop(self):
         if not self.items:
             raise KeyError("Set is empty")
 
-        elem = self.items[-1]
-        del self.items[-1]
+        elem = self.items[index]
+        del self.items[index]
         del self.map[elem]
         return elem
 
-    def discard(self, key):
+    def discard(self, key: T) -> None:
         """
         Remove an element.  Do not raise an exception if absent.
 
@@ -249,14 +294,14 @@ def discard(self, key):
                 if v >= i:
                     self.map[k] = v - 1
 
-    def clear(self):
+    def clear(self) -> None:
         """
         Remove all items from this OrderedSet.
         """
         del self.items[:]
         self.map.clear()
 
-    def __iter__(self):
+    def __iter__(self) -> Iterator[T]:
         """
         Example:
             >>> list(iter(OrderedSet([1, 2, 3])))
@@ -264,7 +309,7 @@ def __iter__(self):
         """
         return iter(self.items)
 
-    def __reversed__(self):
+    def __reversed__(self) -> Iterator[T]:
         """
         Example:
             >>> list(reversed(OrderedSet([1, 2, 3])))
@@ -272,12 +317,12 @@ def __reversed__(self):
         """
         return reversed(self.items)
 
-    def __repr__(self):
+    def __repr__(self) -> str:
         if not self:
             return "%s()" % (self.__class__.__name__,)
         return "%s(%r)" % (self.__class__.__name__, list(self))
 
-    def __eq__(self, other):
+    def __eq__(self, other: Any) -> bool:
         """
         Returns true if the containers have the same items. If `other` is a
         Sequence, then order is checked, otherwise it is ignored.
@@ -293,9 +338,7 @@ def __eq__(self, other):
             >>> oset == OrderedSet([3, 2, 1])
             False
         """
-        # In Python 2 deque is not a Sequence, so treat it as one for
-        # consistent behavior with Python 3.
-        if isinstance(other, (Sequence, deque)):
+        if isinstance(other, Sequence):
             # Check that this OrderedSet contains the same elements, in the
             # same order, as the other object.
             return list(self) == list(other)
@@ -307,7 +350,7 @@ def __eq__(self, other):
         else:
             return set(self) == other_as_set
 
-    def union(self, *sets):
+    def union(self, *sets: SetLike[T]) -> "OrderedSet[T]":
         """
         Combines all unique items.
         Each items order is defined by its first appearance.
@@ -321,16 +364,18 @@ def union(self, *sets):
             >>> oset | {10}
             OrderedSet([3, 1, 4, 5, 2, 0, 10])
         """
-        cls = self.__class__ if isinstance(self, OrderedSet) else OrderedSet
+        cls: type = OrderedSet
+        if isinstance(self, OrderedSet):
+            cls = self.__class__
         containers = map(list, it.chain([self], sets))
         items = it.chain.from_iterable(containers)
         return cls(items)
 
-    def __and__(self, other):
+    def __and__(self, other: SetLike[T]) -> "OrderedSet[T]":
         # the parent implementation of this is backwards
         return self.intersection(other)
 
-    def intersection(self, *sets):
+    def intersection(self, *sets: SetLike[T]) -> "OrderedSet[T]":
         """
         Returns elements in common between all sets. Order is defined only
         by the first set.
@@ -344,15 +389,16 @@ def intersection(self, *sets):
             >>> oset.intersection()
             OrderedSet([1, 2, 3])
         """
-        cls = self.__class__ if isinstance(self, OrderedSet) else OrderedSet
+        cls: type = OrderedSet
+        items: OrderedSetInitializer[T] = self
+        if isinstance(self, OrderedSet):
+            cls = self.__class__
         if sets:
             common = set.intersection(*map(set, sets))
             items = (item for item in self if item in common)
-        else:
-            items = self
         return cls(items)
 
-    def difference(self, *sets):
+    def difference(self, *sets: SetLike[T]) -> "OrderedSet[T]":
         """
         Returns all elements that are in this set but not the others.
 
@@ -367,14 +413,13 @@ def difference(self, *sets):
             OrderedSet([1, 2, 3])
         """
         cls = self.__class__
+        items: OrderedSetInitializer[T] = self
         if sets:
             other = set.union(*map(set, sets))
             items = (item for item in self if item not in other)
-        else:
-            items = self
         return cls(items)
 
-    def issubset(self, other):
+    def issubset(self, other: SetLike[T]) -> bool:
         """
         Report whether another set contains this set.
 
@@ -390,7 +435,7 @@ def issubset(self, other):
             return False
         return all(item in other for item in self)
 
-    def issuperset(self, other):
+    def issuperset(self, other: SetLike[T]) -> bool:
         """
         Report whether this set contains another set.
 
@@ -406,7 +451,7 @@ def issuperset(self, other):
             return False
         return all(item in self for item in other)
 
-    def symmetric_difference(self, other):
+    def symmetric_difference(self, other: SetLike[T]) -> "OrderedSet[T]":
         """
         Return the symmetric difference of two OrderedSets as a new set.
         That is, the new set will contain all elements that are in exactly
@@ -421,12 +466,14 @@ def symmetric_difference(self, other):
             >>> this.symmetric_difference(other)
             OrderedSet([4, 5, 9, 2])
         """
-        cls = self.__class__ if isinstance(self, OrderedSet) else OrderedSet
+        cls: type = OrderedSet
+        if isinstance(self, OrderedSet):
+            cls = self.__class__
         diff1 = cls(self).difference(other)
         diff2 = cls(other).difference(self)
         return diff1.union(diff2)
 
-    def _update_items(self, items):
+    def _update_items(self, items: list) -> None:
         """
         Replace the 'items' list of this OrderedSet with a new one, updating
         self.map accordingly.
@@ -434,7 +481,7 @@ def _update_items(self, items):
         self.items = items
         self.map = {item: idx for (idx, item) in enumerate(items)}
 
-    def difference_update(self, *sets):
+    def difference_update(self, *sets: SetLike[T]) -> None:
         """
         Update this OrderedSet to remove items from one or more other sets.
 
@@ -449,12 +496,13 @@ def difference_update(self, *sets):
             >>> print(this)
             OrderedSet([3, 5])
         """
-        items_to_remove = set()
+        items_to_remove = set()  # type: Set[T]
         for other in sets:
-            items_to_remove |= set(other)
+            items_as_set = set(other)  # type: Set[T]
+            items_to_remove |= items_as_set
         self._update_items([item for item in self.items if item not in items_to_remove])
 
-    def intersection_update(self, other):
+    def intersection_update(self, other: SetLike[T]) -> None:
         """
         Update this OrderedSet to keep only items in another set, preserving
         their order in this set.
@@ -469,7 +517,7 @@ def intersection_update(self, other):
         other = set(other)
         self._update_items([item for item in self.items if item in other])
 
-    def symmetric_difference_update(self, other):
+    def symmetric_difference_update(self, other: SetLike[T]) -> None:
         """
         Update this OrderedSet to remove items from another set, then
         add items from the other set that were not present in this set.
diff --git a/setuptools/_vendor/ordered_set/py.typed b/setuptools/_vendor/ordered_set/py.typed
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/RECORD b/setuptools/_vendor/packaging-24.0.dist-info/RECORD
deleted file mode 100644
index bcf796c2f4..0000000000
--- a/setuptools/_vendor/packaging-24.0.dist-info/RECORD
+++ /dev/null
@@ -1,37 +0,0 @@
-packaging-24.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-packaging-24.0.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197
-packaging-24.0.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
-packaging-24.0.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344
-packaging-24.0.dist-info/METADATA,sha256=0dESdhY_wHValuOrbgdebiEw04EbX4dkujlxPdEsFus,3203
-packaging-24.0.dist-info/RECORD,,
-packaging-24.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-packaging-24.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
-packaging/__init__.py,sha256=UzotcV07p8vcJzd80S-W0srhgY8NMVD_XvJcZ7JN-tA,496
-packaging/__pycache__/__init__.cpython-312.pyc,,
-packaging/__pycache__/_elffile.cpython-312.pyc,,
-packaging/__pycache__/_manylinux.cpython-312.pyc,,
-packaging/__pycache__/_musllinux.cpython-312.pyc,,
-packaging/__pycache__/_parser.cpython-312.pyc,,
-packaging/__pycache__/_structures.cpython-312.pyc,,
-packaging/__pycache__/_tokenizer.cpython-312.pyc,,
-packaging/__pycache__/markers.cpython-312.pyc,,
-packaging/__pycache__/metadata.cpython-312.pyc,,
-packaging/__pycache__/requirements.cpython-312.pyc,,
-packaging/__pycache__/specifiers.cpython-312.pyc,,
-packaging/__pycache__/tags.cpython-312.pyc,,
-packaging/__pycache__/utils.cpython-312.pyc,,
-packaging/__pycache__/version.cpython-312.pyc,,
-packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266
-packaging/_manylinux.py,sha256=1ng_TqyH49hY6s3W_zVHyoJIaogbJqbIF1jJ0fAehc4,9590
-packaging/_musllinux.py,sha256=kgmBGLFybpy8609-KTvzmt2zChCPWYvhp5BWP4JX7dE,2676
-packaging/_parser.py,sha256=zlsFB1FpMRjkUdQb6WLq7xON52ruQadxFpYsDXWhLb4,10347
-packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
-packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292
-packaging/markers.py,sha256=eH-txS2zq1HdNpTd9LcZUcVIwewAiNU0grmq5wjKnOk,8208
-packaging/metadata.py,sha256=w7jPEg6mDf1FTZMn79aFxFuk4SKtynUJtxr2InTxlV4,33036
-packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-packaging/requirements.py,sha256=dgoBeVprPu2YE6Q8nGfwOPTjATHbRa_ZGLyXhFEln6Q,2933
-packaging/specifiers.py,sha256=dB2DwbmvSbEuVilEyiIQ382YfW5JfwzXTfRRPVtaENY,39784
-packaging/tags.py,sha256=fedHXiOHkBxNZTXotXv8uXPmMFU9ae-TKBujgYHigcA,18950
-packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268
-packaging/version.py,sha256=XjRBLNK17UMDgLeP8UHnqwiY3TdSi03xFQURtec211A,16236
diff --git a/setuptools/_vendor/packaging-24.1.dist-info/INSTALLER b/setuptools/_vendor/packaging-24.1.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/setuptools/_vendor/packaging-24.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/LICENSE b/setuptools/_vendor/packaging-24.1.dist-info/LICENSE
similarity index 100%
rename from setuptools/_vendor/packaging-24.0.dist-info/LICENSE
rename to setuptools/_vendor/packaging-24.1.dist-info/LICENSE
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/LICENSE.APACHE b/setuptools/_vendor/packaging-24.1.dist-info/LICENSE.APACHE
similarity index 100%
rename from setuptools/_vendor/packaging-24.0.dist-info/LICENSE.APACHE
rename to setuptools/_vendor/packaging-24.1.dist-info/LICENSE.APACHE
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/LICENSE.BSD b/setuptools/_vendor/packaging-24.1.dist-info/LICENSE.BSD
similarity index 100%
rename from setuptools/_vendor/packaging-24.0.dist-info/LICENSE.BSD
rename to setuptools/_vendor/packaging-24.1.dist-info/LICENSE.BSD
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/METADATA b/setuptools/_vendor/packaging-24.1.dist-info/METADATA
similarity index 97%
rename from setuptools/_vendor/packaging-24.0.dist-info/METADATA
rename to setuptools/_vendor/packaging-24.1.dist-info/METADATA
index 10ab4390a9..255dc46e0e 100644
--- a/setuptools/_vendor/packaging-24.0.dist-info/METADATA
+++ b/setuptools/_vendor/packaging-24.1.dist-info/METADATA
@@ -1,9 +1,9 @@
 Metadata-Version: 2.1
 Name: packaging
-Version: 24.0
+Version: 24.1
 Summary: Core utilities for Python packages
 Author-email: Donald Stufft 
-Requires-Python: >=3.7
+Requires-Python: >=3.8
 Description-Content-Type: text/x-rst
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
@@ -12,12 +12,12 @@ Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: 3.11
 Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Typing :: Typed
diff --git a/setuptools/_vendor/packaging-24.1.dist-info/RECORD b/setuptools/_vendor/packaging-24.1.dist-info/RECORD
new file mode 100644
index 0000000000..2b1e6bd4db
--- /dev/null
+++ b/setuptools/_vendor/packaging-24.1.dist-info/RECORD
@@ -0,0 +1,37 @@
+packaging-24.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+packaging-24.1.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197
+packaging-24.1.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
+packaging-24.1.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344
+packaging-24.1.dist-info/METADATA,sha256=X3ooO3WnCfzNSBrqQjefCD1POAF1M2WSLmsHMgQlFdk,3204
+packaging-24.1.dist-info/RECORD,,
+packaging-24.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+packaging-24.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
+packaging/__init__.py,sha256=dtw2bNmWCQ9WnMoK3bk_elL1svSlikXtLpZhCFIB9SE,496
+packaging/__pycache__/__init__.cpython-312.pyc,,
+packaging/__pycache__/_elffile.cpython-312.pyc,,
+packaging/__pycache__/_manylinux.cpython-312.pyc,,
+packaging/__pycache__/_musllinux.cpython-312.pyc,,
+packaging/__pycache__/_parser.cpython-312.pyc,,
+packaging/__pycache__/_structures.cpython-312.pyc,,
+packaging/__pycache__/_tokenizer.cpython-312.pyc,,
+packaging/__pycache__/markers.cpython-312.pyc,,
+packaging/__pycache__/metadata.cpython-312.pyc,,
+packaging/__pycache__/requirements.cpython-312.pyc,,
+packaging/__pycache__/specifiers.cpython-312.pyc,,
+packaging/__pycache__/tags.cpython-312.pyc,,
+packaging/__pycache__/utils.cpython-312.pyc,,
+packaging/__pycache__/version.cpython-312.pyc,,
+packaging/_elffile.py,sha256=_LcJW4YNKywYsl4169B2ukKRqwxjxst_8H0FRVQKlz8,3282
+packaging/_manylinux.py,sha256=Xo4V0PZz8sbuVCbTni0t1CR0AHeir_7ib4lTmV8scD4,9586
+packaging/_musllinux.py,sha256=p9ZqNYiOItGee8KcZFeHF_YcdhVwGHdK6r-8lgixvGQ,2694
+packaging/_parser.py,sha256=s_TvTvDNK0NrM2QB3VKThdWFM4Nc0P6JnkObkl3MjpM,10236
+packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
+packaging/_tokenizer.py,sha256=J6v5H7Jzvb-g81xp_2QACKwO7LxHQA6ikryMU7zXwN8,5273
+packaging/markers.py,sha256=dWKSqn5Sp-jDmOG-W3GfLHKjwhf1IsznbT71VlBoB5M,10671
+packaging/metadata.py,sha256=KINuSkJ12u-SyoKNTy_pHNGAfMUtxNvZ53qA1zAKcKI,32349
+packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+packaging/requirements.py,sha256=gYyRSAdbrIyKDY66ugIDUQjRMvxkH2ALioTmX3tnL6o,2947
+packaging/specifiers.py,sha256=rjpc3hoJuunRIT6DdH7gLTnQ5j5QKSuWjoTC5sdHtHI,39714
+packaging/tags.py,sha256=y8EbheOu9WS7s-MebaXMcHMF-jzsA_C1Lz5XRTiSy4w,18883
+packaging/utils.py,sha256=NAdYUwnlAOpkat_RthavX8a07YuVxgGL_vwrx73GSDM,5287
+packaging/version.py,sha256=V0H3SOj_8werrvorrb6QDLRhlcqSErNTTkCvvfszhDI,16198
diff --git a/setuptools/_vendor/packaging-24.1.dist-info/REQUESTED b/setuptools/_vendor/packaging-24.1.dist-info/REQUESTED
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/packaging-24.0.dist-info/WHEEL b/setuptools/_vendor/packaging-24.1.dist-info/WHEEL
similarity index 100%
rename from setuptools/_vendor/packaging-24.0.dist-info/WHEEL
rename to setuptools/_vendor/packaging-24.1.dist-info/WHEEL
diff --git a/setuptools/_vendor/packaging/__init__.py b/setuptools/_vendor/packaging/__init__.py
index e7c0aa12ca..9ba41d8357 100644
--- a/setuptools/_vendor/packaging/__init__.py
+++ b/setuptools/_vendor/packaging/__init__.py
@@ -6,7 +6,7 @@
 __summary__ = "Core utilities for Python packages"
 __uri__ = "https://github.com/pypa/packaging"
 
-__version__ = "24.0"
+__version__ = "24.1"
 
 __author__ = "Donald Stufft and individual contributors"
 __email__ = "donald@stufft.io"
diff --git a/setuptools/_vendor/packaging/_elffile.py b/setuptools/_vendor/packaging/_elffile.py
index 6fb19b30bb..f7a02180bf 100644
--- a/setuptools/_vendor/packaging/_elffile.py
+++ b/setuptools/_vendor/packaging/_elffile.py
@@ -8,10 +8,12 @@
 ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
 """
 
+from __future__ import annotations
+
 import enum
 import os
 import struct
-from typing import IO, Optional, Tuple
+from typing import IO
 
 
 class ELFInvalid(ValueError):
@@ -87,11 +89,11 @@ def __init__(self, f: IO[bytes]) -> None:
         except struct.error as e:
             raise ELFInvalid("unable to parse machine and section information") from e
 
-    def _read(self, fmt: str) -> Tuple[int, ...]:
+    def _read(self, fmt: str) -> tuple[int, ...]:
         return struct.unpack(fmt, self._f.read(struct.calcsize(fmt)))
 
     @property
-    def interpreter(self) -> Optional[str]:
+    def interpreter(self) -> str | None:
         """
         The path recorded in the ``PT_INTERP`` section header.
         """
diff --git a/setuptools/_vendor/packaging/_manylinux.py b/setuptools/_vendor/packaging/_manylinux.py
index ad62505f3f..08f651fbd8 100644
--- a/setuptools/_vendor/packaging/_manylinux.py
+++ b/setuptools/_vendor/packaging/_manylinux.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 import collections
 import contextlib
 import functools
@@ -5,7 +7,7 @@
 import re
 import sys
 import warnings
-from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple
+from typing import Generator, Iterator, NamedTuple, Sequence
 
 from ._elffile import EIClass, EIData, ELFFile, EMachine
 
@@ -17,7 +19,7 @@
 # `os.PathLike` not a generic type until Python 3.9, so sticking with `str`
 # as the type for `path` until then.
 @contextlib.contextmanager
-def _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]:
+def _parse_elf(path: str) -> Generator[ELFFile | None, None, None]:
     try:
         with open(path, "rb") as f:
             yield ELFFile(f)
@@ -72,7 +74,7 @@ def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool:
 # For now, guess what the highest minor version might be, assume it will
 # be 50 for testing. Once this actually happens, update the dictionary
 # with the actual value.
-_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50)
+_LAST_GLIBC_MINOR: dict[int, int] = collections.defaultdict(lambda: 50)
 
 
 class _GLibCVersion(NamedTuple):
@@ -80,7 +82,7 @@ class _GLibCVersion(NamedTuple):
     minor: int
 
 
-def _glibc_version_string_confstr() -> Optional[str]:
+def _glibc_version_string_confstr() -> str | None:
     """
     Primary implementation of glibc_version_string using os.confstr.
     """
@@ -90,7 +92,7 @@ def _glibc_version_string_confstr() -> Optional[str]:
     # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183
     try:
         # Should be a string like "glibc 2.17".
-        version_string: Optional[str] = os.confstr("CS_GNU_LIBC_VERSION")
+        version_string: str | None = os.confstr("CS_GNU_LIBC_VERSION")
         assert version_string is not None
         _, version = version_string.rsplit()
     except (AssertionError, AttributeError, OSError, ValueError):
@@ -99,7 +101,7 @@ def _glibc_version_string_confstr() -> Optional[str]:
     return version
 
 
-def _glibc_version_string_ctypes() -> Optional[str]:
+def _glibc_version_string_ctypes() -> str | None:
     """
     Fallback implementation of glibc_version_string using ctypes.
     """
@@ -143,12 +145,12 @@ def _glibc_version_string_ctypes() -> Optional[str]:
     return version_str
 
 
-def _glibc_version_string() -> Optional[str]:
+def _glibc_version_string() -> str | None:
     """Returns glibc version string, or None if not using glibc."""
     return _glibc_version_string_confstr() or _glibc_version_string_ctypes()
 
 
-def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
+def _parse_glibc_version(version_str: str) -> tuple[int, int]:
     """Parse glibc version.
 
     We use a regexp instead of str.split because we want to discard any
@@ -167,8 +169,8 @@ def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
     return int(m.group("major")), int(m.group("minor"))
 
 
-@functools.lru_cache()
-def _get_glibc_version() -> Tuple[int, int]:
+@functools.lru_cache
+def _get_glibc_version() -> tuple[int, int]:
     version_str = _glibc_version_string()
     if version_str is None:
         return (-1, -1)
diff --git a/setuptools/_vendor/packaging/_musllinux.py b/setuptools/_vendor/packaging/_musllinux.py
index 86419df9d7..d2bf30b563 100644
--- a/setuptools/_vendor/packaging/_musllinux.py
+++ b/setuptools/_vendor/packaging/_musllinux.py
@@ -4,11 +4,13 @@
 linked against musl, and what musl version is used.
 """
 
+from __future__ import annotations
+
 import functools
 import re
 import subprocess
 import sys
-from typing import Iterator, NamedTuple, Optional, Sequence
+from typing import Iterator, NamedTuple, Sequence
 
 from ._elffile import ELFFile
 
@@ -18,7 +20,7 @@ class _MuslVersion(NamedTuple):
     minor: int
 
 
-def _parse_musl_version(output: str) -> Optional[_MuslVersion]:
+def _parse_musl_version(output: str) -> _MuslVersion | None:
     lines = [n for n in (n.strip() for n in output.splitlines()) if n]
     if len(lines) < 2 or lines[0][:4] != "musl":
         return None
@@ -28,8 +30,8 @@ def _parse_musl_version(output: str) -> Optional[_MuslVersion]:
     return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2)))
 
 
-@functools.lru_cache()
-def _get_musl_version(executable: str) -> Optional[_MuslVersion]:
+@functools.lru_cache
+def _get_musl_version(executable: str) -> _MuslVersion | None:
     """Detect currently-running musl runtime version.
 
     This is done by checking the specified executable's dynamic linking
diff --git a/setuptools/_vendor/packaging/_parser.py b/setuptools/_vendor/packaging/_parser.py
index 684df75457..c1238c06ea 100644
--- a/setuptools/_vendor/packaging/_parser.py
+++ b/setuptools/_vendor/packaging/_parser.py
@@ -1,11 +1,13 @@
 """Handwritten parser of dependency specifiers.
 
-The docstring for each __parse_* function contains ENBF-inspired grammar representing
+The docstring for each __parse_* function contains EBNF-inspired grammar representing
 the implementation.
 """
 
+from __future__ import annotations
+
 import ast
-from typing import Any, List, NamedTuple, Optional, Tuple, Union
+from typing import NamedTuple, Sequence, Tuple, Union
 
 from ._tokenizer import DEFAULT_RULES, Tokenizer
 
@@ -41,20 +43,16 @@ def serialize(self) -> str:
 
 MarkerVar = Union[Variable, Value]
 MarkerItem = Tuple[MarkerVar, Op, MarkerVar]
-# MarkerAtom = Union[MarkerItem, List["MarkerAtom"]]
-# MarkerList = List[Union["MarkerList", MarkerAtom, str]]
-# mypy does not support recursive type definition
-# https://github.com/python/mypy/issues/731
-MarkerAtom = Any
-MarkerList = List[Any]
+MarkerAtom = Union[MarkerItem, Sequence["MarkerAtom"]]
+MarkerList = Sequence[Union["MarkerList", MarkerAtom, str]]
 
 
 class ParsedRequirement(NamedTuple):
     name: str
     url: str
-    extras: List[str]
+    extras: list[str]
     specifier: str
-    marker: Optional[MarkerList]
+    marker: MarkerList | None
 
 
 # --------------------------------------------------------------------------------------
@@ -87,7 +85,7 @@ def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement:
 
 def _parse_requirement_details(
     tokenizer: Tokenizer,
-) -> Tuple[str, str, Optional[MarkerList]]:
+) -> tuple[str, str, MarkerList | None]:
     """
     requirement_details = AT URL (WS requirement_marker?)?
                         | specifier WS? (requirement_marker)?
@@ -156,7 +154,7 @@ def _parse_requirement_marker(
     return marker
 
 
-def _parse_extras(tokenizer: Tokenizer) -> List[str]:
+def _parse_extras(tokenizer: Tokenizer) -> list[str]:
     """
     extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)?
     """
@@ -175,11 +173,11 @@ def _parse_extras(tokenizer: Tokenizer) -> List[str]:
     return extras
 
 
-def _parse_extras_list(tokenizer: Tokenizer) -> List[str]:
+def _parse_extras_list(tokenizer: Tokenizer) -> list[str]:
     """
     extras_list = identifier (wsp* ',' wsp* identifier)*
     """
-    extras: List[str] = []
+    extras: list[str] = []
 
     if not tokenizer.check("IDENTIFIER"):
         return extras
diff --git a/setuptools/_vendor/packaging/_tokenizer.py b/setuptools/_vendor/packaging/_tokenizer.py
index dd0d648d49..89d041605c 100644
--- a/setuptools/_vendor/packaging/_tokenizer.py
+++ b/setuptools/_vendor/packaging/_tokenizer.py
@@ -1,7 +1,9 @@
+from __future__ import annotations
+
 import contextlib
 import re
 from dataclasses import dataclass
-from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union
+from typing import Iterator, NoReturn
 
 from .specifiers import Specifier
 
@@ -21,7 +23,7 @@ def __init__(
         message: str,
         *,
         source: str,
-        span: Tuple[int, int],
+        span: tuple[int, int],
     ) -> None:
         self.span = span
         self.message = message
@@ -34,7 +36,7 @@ def __str__(self) -> str:
         return "\n    ".join([self.message, self.source, marker])
 
 
-DEFAULT_RULES: "Dict[str, Union[str, re.Pattern[str]]]" = {
+DEFAULT_RULES: dict[str, str | re.Pattern[str]] = {
     "LEFT_PARENTHESIS": r"\(",
     "RIGHT_PARENTHESIS": r"\)",
     "LEFT_BRACKET": r"\[",
@@ -96,13 +98,13 @@ def __init__(
         self,
         source: str,
         *,
-        rules: "Dict[str, Union[str, re.Pattern[str]]]",
+        rules: dict[str, str | re.Pattern[str]],
     ) -> None:
         self.source = source
-        self.rules: Dict[str, re.Pattern[str]] = {
+        self.rules: dict[str, re.Pattern[str]] = {
             name: re.compile(pattern) for name, pattern in rules.items()
         }
-        self.next_token: Optional[Token] = None
+        self.next_token: Token | None = None
         self.position = 0
 
     def consume(self, name: str) -> None:
@@ -154,8 +156,8 @@ def raise_syntax_error(
         self,
         message: str,
         *,
-        span_start: Optional[int] = None,
-        span_end: Optional[int] = None,
+        span_start: int | None = None,
+        span_end: int | None = None,
     ) -> NoReturn:
         """Raise ParserSyntaxError at the given position."""
         span = (
diff --git a/setuptools/_vendor/packaging/markers.py b/setuptools/_vendor/packaging/markers.py
index 8b98fca723..7ac7bb69a5 100644
--- a/setuptools/_vendor/packaging/markers.py
+++ b/setuptools/_vendor/packaging/markers.py
@@ -2,20 +2,16 @@
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
 
+from __future__ import annotations
+
 import operator
 import os
 import platform
 import sys
-from typing import Any, Callable, Dict, List, Optional, Tuple, Union
-
-from ._parser import (
-    MarkerAtom,
-    MarkerList,
-    Op,
-    Value,
-    Variable,
-    parse_marker as _parse_marker,
-)
+from typing import Any, Callable, TypedDict, cast
+
+from ._parser import MarkerAtom, MarkerList, Op, Value, Variable
+from ._parser import parse_marker as _parse_marker
 from ._tokenizer import ParserSyntaxError
 from .specifiers import InvalidSpecifier, Specifier
 from .utils import canonicalize_name
@@ -50,6 +46,78 @@ class UndefinedEnvironmentName(ValueError):
     """
 
 
+class Environment(TypedDict):
+    implementation_name: str
+    """The implementation's identifier, e.g. ``'cpython'``."""
+
+    implementation_version: str
+    """
+    The implementation's version, e.g. ``'3.13.0a2'`` for CPython 3.13.0a2, or
+    ``'7.3.13'`` for PyPy3.10 v7.3.13.
+    """
+
+    os_name: str
+    """
+    The value of :py:data:`os.name`. The name of the operating system dependent module
+    imported, e.g. ``'posix'``.
+    """
+
+    platform_machine: str
+    """
+    Returns the machine type, e.g. ``'i386'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    platform_release: str
+    """
+    The system's release, e.g. ``'2.2.0'`` or ``'NT'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    platform_system: str
+    """
+    The system/OS name, e.g. ``'Linux'``, ``'Windows'`` or ``'Java'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    platform_version: str
+    """
+    The system's release version, e.g. ``'#3 on degas'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    python_full_version: str
+    """
+    The Python version as string ``'major.minor.patchlevel'``.
+
+    Note that unlike the Python :py:data:`sys.version`, this value will always include
+    the patchlevel (it defaults to 0).
+    """
+
+    platform_python_implementation: str
+    """
+    A string identifying the Python implementation, e.g. ``'CPython'``.
+    """
+
+    python_version: str
+    """The Python version as string ``'major.minor'``."""
+
+    sys_platform: str
+    """
+    This string contains a platform identifier that can be used to append
+    platform-specific components to :py:data:`sys.path`, for instance.
+
+    For Unix systems, except on Linux and AIX, this is the lowercased OS name as
+    returned by ``uname -s`` with the first part of the version as returned by
+    ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, at the time when Python
+    was built.
+    """
+
+
 def _normalize_extra_values(results: Any) -> Any:
     """
     Normalize extra values.
@@ -67,9 +135,8 @@ def _normalize_extra_values(results: Any) -> Any:
 
 
 def _format_marker(
-    marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True
+    marker: list[str] | MarkerAtom | str, first: bool | None = True
 ) -> str:
-
     assert isinstance(marker, (list, tuple, str))
 
     # Sometimes we have a structure like [[...]] which is a single item list
@@ -95,7 +162,7 @@ def _format_marker(
         return marker
 
 
-_operators: Dict[str, Operator] = {
+_operators: dict[str, Operator] = {
     "in": lambda lhs, rhs: lhs in rhs,
     "not in": lambda lhs, rhs: lhs not in rhs,
     "<": operator.lt,
@@ -115,14 +182,14 @@ def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
     else:
         return spec.contains(lhs, prereleases=True)
 
-    oper: Optional[Operator] = _operators.get(op.serialize())
+    oper: Operator | None = _operators.get(op.serialize())
     if oper is None:
         raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.")
 
     return oper(lhs, rhs)
 
 
-def _normalize(*values: str, key: str) -> Tuple[str, ...]:
+def _normalize(*values: str, key: str) -> tuple[str, ...]:
     # PEP 685 – Comparison of extra names for optional distribution dependencies
     # https://peps.python.org/pep-0685/
     # > When comparing extra names, tools MUST normalize the names being
@@ -134,8 +201,8 @@ def _normalize(*values: str, key: str) -> Tuple[str, ...]:
     return values
 
 
-def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool:
-    groups: List[List[bool]] = [[]]
+def _evaluate_markers(markers: MarkerList, environment: dict[str, str]) -> bool:
+    groups: list[list[bool]] = [[]]
 
     for marker in markers:
         assert isinstance(marker, (list, tuple, str))
@@ -164,7 +231,7 @@ def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool:
     return any(all(item) for item in groups)
 
 
-def format_full_version(info: "sys._version_info") -> str:
+def format_full_version(info: sys._version_info) -> str:
     version = "{0.major}.{0.minor}.{0.micro}".format(info)
     kind = info.releaselevel
     if kind != "final":
@@ -172,7 +239,7 @@ def format_full_version(info: "sys._version_info") -> str:
     return version
 
 
-def default_environment() -> Dict[str, str]:
+def default_environment() -> Environment:
     iver = format_full_version(sys.implementation.version)
     implementation_name = sys.implementation.name
     return {
@@ -231,7 +298,7 @@ def __eq__(self, other: Any) -> bool:
 
         return str(self) == str(other)
 
-    def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool:
+    def evaluate(self, environment: dict[str, str] | None = None) -> bool:
         """Evaluate a marker.
 
         Return the boolean from evaluating the given marker against the
@@ -240,8 +307,14 @@ def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool:
 
         The environment is determined from the current Python process.
         """
-        current_environment = default_environment()
+        current_environment = cast("dict[str, str]", default_environment())
         current_environment["extra"] = ""
+        # Work around platform.python_version() returning something that is not PEP 440
+        # compliant for non-tagged Python builds. We preserve default_environment()'s
+        # behavior of returning platform.python_version() verbatim, and leave it to the
+        # caller to provide a syntactically valid version if they want to override it.
+        if current_environment["python_full_version"].endswith("+"):
+            current_environment["python_full_version"] += "local"
         if environment is not None:
             current_environment.update(environment)
             # The API used to allow setting extra to None. We need to handle this
diff --git a/setuptools/_vendor/packaging/metadata.py b/setuptools/_vendor/packaging/metadata.py
index fb27493079..eb8dc844d2 100644
--- a/setuptools/_vendor/packaging/metadata.py
+++ b/setuptools/_vendor/packaging/metadata.py
@@ -1,50 +1,31 @@
+from __future__ import annotations
+
 import email.feedparser
 import email.header
 import email.message
 import email.parser
 import email.policy
-import sys
 import typing
 from typing import (
     Any,
     Callable,
-    Dict,
     Generic,
-    List,
-    Optional,
-    Tuple,
-    Type,
-    Union,
+    Literal,
+    TypedDict,
     cast,
 )
 
-from . import requirements, specifiers, utils, version as version_module
+from . import requirements, specifiers, utils
+from . import version as version_module
 
 T = typing.TypeVar("T")
-if sys.version_info[:2] >= (3, 8):  # pragma: no cover
-    from typing import Literal, TypedDict
-else:  # pragma: no cover
-    if typing.TYPE_CHECKING:
-        from typing_extensions import Literal, TypedDict
-    else:
-        try:
-            from typing_extensions import Literal, TypedDict
-        except ImportError:
-
-            class Literal:
-                def __init_subclass__(*_args, **_kwargs):
-                    pass
-
-            class TypedDict:
-                def __init_subclass__(*_args, **_kwargs):
-                    pass
 
 
 try:
     ExceptionGroup
 except NameError:  # pragma: no cover
 
-    class ExceptionGroup(Exception):  # noqa: N818
+    class ExceptionGroup(Exception):
         """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11.
 
         If :external:exc:`ExceptionGroup` is already defined by Python itself,
@@ -52,9 +33,9 @@ class ExceptionGroup(Exception):  # noqa: N818
         """
 
         message: str
-        exceptions: List[Exception]
+        exceptions: list[Exception]
 
-        def __init__(self, message: str, exceptions: List[Exception]) -> None:
+        def __init__(self, message: str, exceptions: list[Exception]) -> None:
             self.message = message
             self.exceptions = exceptions
 
@@ -100,32 +81,32 @@ class RawMetadata(TypedDict, total=False):
     metadata_version: str
     name: str
     version: str
-    platforms: List[str]
+    platforms: list[str]
     summary: str
     description: str
-    keywords: List[str]
+    keywords: list[str]
     home_page: str
     author: str
     author_email: str
     license: str
 
     # Metadata 1.1 - PEP 314
-    supported_platforms: List[str]
+    supported_platforms: list[str]
     download_url: str
-    classifiers: List[str]
-    requires: List[str]
-    provides: List[str]
-    obsoletes: List[str]
+    classifiers: list[str]
+    requires: list[str]
+    provides: list[str]
+    obsoletes: list[str]
 
     # Metadata 1.2 - PEP 345
     maintainer: str
     maintainer_email: str
-    requires_dist: List[str]
-    provides_dist: List[str]
-    obsoletes_dist: List[str]
+    requires_dist: list[str]
+    provides_dist: list[str]
+    obsoletes_dist: list[str]
     requires_python: str
-    requires_external: List[str]
-    project_urls: Dict[str, str]
+    requires_external: list[str]
+    project_urls: dict[str, str]
 
     # Metadata 2.0
     # PEP 426 attempted to completely revamp the metadata format
@@ -138,10 +119,10 @@ class RawMetadata(TypedDict, total=False):
 
     # Metadata 2.1 - PEP 566
     description_content_type: str
-    provides_extra: List[str]
+    provides_extra: list[str]
 
     # Metadata 2.2 - PEP 643
-    dynamic: List[str]
+    dynamic: list[str]
 
     # Metadata 2.3 - PEP 685
     # No new fields were added in PEP 685, just some edge case were
@@ -185,12 +166,12 @@ class RawMetadata(TypedDict, total=False):
 }
 
 
-def _parse_keywords(data: str) -> List[str]:
+def _parse_keywords(data: str) -> list[str]:
     """Split a string of comma-separate keyboards into a list of keywords."""
     return [k.strip() for k in data.split(",")]
 
 
-def _parse_project_urls(data: List[str]) -> Dict[str, str]:
+def _parse_project_urls(data: list[str]) -> dict[str, str]:
     """Parse a list of label/URL string pairings separated by a comma."""
     urls = {}
     for pair in data:
@@ -230,7 +211,7 @@ def _parse_project_urls(data: List[str]) -> Dict[str, str]:
     return urls
 
 
-def _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str:
+def _get_payload(msg: email.message.Message, source: bytes | str) -> str:
     """Get the body of the message."""
     # If our source is a str, then our caller has managed encodings for us,
     # and we don't need to deal with it.
@@ -292,7 +273,7 @@ def _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str:
 _RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()}
 
 
-def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[str]]]:
+def parse_email(data: bytes | str) -> tuple[RawMetadata, dict[str, list[str]]]:
     """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``).
 
     This function returns a two-item tuple of dicts. The first dict is of
@@ -308,8 +289,8 @@ def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[st
     included in this dict.
 
     """
-    raw: Dict[str, Union[str, List[str], Dict[str, str]]] = {}
-    unparsed: Dict[str, List[str]] = {}
+    raw: dict[str, str | list[str] | dict[str, str]] = {}
+    unparsed: dict[str, list[str]] = {}
 
     if isinstance(data, str):
         parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data)
@@ -357,7 +338,7 @@ def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[st
                 # The Header object stores it's data as chunks, and each chunk
                 # can be independently encoded, so we'll need to check each
                 # of them.
-                chunks: List[Tuple[bytes, Optional[str]]] = []
+                chunks: list[tuple[bytes, str | None]] = []
                 for bin, encoding in email.header.decode_header(h):
                     try:
                         bin.decode("utf8", "strict")
@@ -499,11 +480,11 @@ def __init__(
     ) -> None:
         self.added = added
 
-    def __set_name__(self, _owner: "Metadata", name: str) -> None:
+    def __set_name__(self, _owner: Metadata, name: str) -> None:
         self.name = name
         self.raw_name = _RAW_TO_EMAIL_MAPPING[name]
 
-    def __get__(self, instance: "Metadata", _owner: Type["Metadata"]) -> T:
+    def __get__(self, instance: Metadata, _owner: type[Metadata]) -> T:
         # With Python 3.8, the caching can be replaced with functools.cached_property().
         # No need to check the cache as attribute lookup will resolve into the
         # instance's __dict__ before __get__ is called.
@@ -531,7 +512,7 @@ def __get__(self, instance: "Metadata", _owner: Type["Metadata"]) -> T:
         return cast(T, value)
 
     def _invalid_metadata(
-        self, msg: str, cause: Optional[Exception] = None
+        self, msg: str, cause: Exception | None = None
     ) -> InvalidMetadata:
         exc = InvalidMetadata(
             self.raw_name, msg.format_map({"field": repr(self.raw_name)})
@@ -606,7 +587,7 @@ def _process_description_content_type(self, value: str) -> str:
             )
         return value
 
-    def _process_dynamic(self, value: List[str]) -> List[str]:
+    def _process_dynamic(self, value: list[str]) -> list[str]:
         for dynamic_field in map(str.lower, value):
             if dynamic_field in {"name", "version", "metadata-version"}:
                 raise self._invalid_metadata(
@@ -618,8 +599,8 @@ def _process_dynamic(self, value: List[str]) -> List[str]:
 
     def _process_provides_extra(
         self,
-        value: List[str],
-    ) -> List[utils.NormalizedName]:
+        value: list[str],
+    ) -> list[utils.NormalizedName]:
         normalized_names = []
         try:
             for name in value:
@@ -641,8 +622,8 @@ def _process_requires_python(self, value: str) -> specifiers.SpecifierSet:
 
     def _process_requires_dist(
         self,
-        value: List[str],
-    ) -> List[requirements.Requirement]:
+        value: list[str],
+    ) -> list[requirements.Requirement]:
         reqs = []
         try:
             for req in value:
@@ -665,7 +646,7 @@ class Metadata:
     _raw: RawMetadata
 
     @classmethod
-    def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata":
+    def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> Metadata:
         """Create an instance from :class:`RawMetadata`.
 
         If *validate* is true, all metadata will be validated. All exceptions
@@ -675,7 +656,7 @@ def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata":
         ins._raw = data.copy()  # Mutations occur due to caching enriched values.
 
         if validate:
-            exceptions: List[Exception] = []
+            exceptions: list[Exception] = []
             try:
                 metadata_version = ins.metadata_version
                 metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version)
@@ -722,9 +703,7 @@ def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata":
         return ins
 
     @classmethod
-    def from_email(
-        cls, data: Union[bytes, str], *, validate: bool = True
-    ) -> "Metadata":
+    def from_email(cls, data: bytes | str, *, validate: bool = True) -> Metadata:
         """Parse metadata from email headers.
 
         If *validate* is true, the metadata will be validated. All exceptions
@@ -760,66 +739,66 @@ def from_email(
     *validate* parameter)"""
     version: _Validator[version_module.Version] = _Validator()
     """:external:ref:`core-metadata-version` (required)"""
-    dynamic: _Validator[Optional[List[str]]] = _Validator(
+    dynamic: _Validator[list[str] | None] = _Validator(
         added="2.2",
     )
     """:external:ref:`core-metadata-dynamic`
     (validated against core metadata field names and lowercased)"""
-    platforms: _Validator[Optional[List[str]]] = _Validator()
+    platforms: _Validator[list[str] | None] = _Validator()
     """:external:ref:`core-metadata-platform`"""
-    supported_platforms: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    supported_platforms: _Validator[list[str] | None] = _Validator(added="1.1")
     """:external:ref:`core-metadata-supported-platform`"""
-    summary: _Validator[Optional[str]] = _Validator()
+    summary: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-summary` (validated to contain no newlines)"""
-    description: _Validator[Optional[str]] = _Validator()  # TODO 2.1: can be in body
+    description: _Validator[str | None] = _Validator()  # TODO 2.1: can be in body
     """:external:ref:`core-metadata-description`"""
-    description_content_type: _Validator[Optional[str]] = _Validator(added="2.1")
+    description_content_type: _Validator[str | None] = _Validator(added="2.1")
     """:external:ref:`core-metadata-description-content-type` (validated)"""
-    keywords: _Validator[Optional[List[str]]] = _Validator()
+    keywords: _Validator[list[str] | None] = _Validator()
     """:external:ref:`core-metadata-keywords`"""
-    home_page: _Validator[Optional[str]] = _Validator()
+    home_page: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-home-page`"""
-    download_url: _Validator[Optional[str]] = _Validator(added="1.1")
+    download_url: _Validator[str | None] = _Validator(added="1.1")
     """:external:ref:`core-metadata-download-url`"""
-    author: _Validator[Optional[str]] = _Validator()
+    author: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-author`"""
-    author_email: _Validator[Optional[str]] = _Validator()
+    author_email: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-author-email`"""
-    maintainer: _Validator[Optional[str]] = _Validator(added="1.2")
+    maintainer: _Validator[str | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-maintainer`"""
-    maintainer_email: _Validator[Optional[str]] = _Validator(added="1.2")
+    maintainer_email: _Validator[str | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-maintainer-email`"""
-    license: _Validator[Optional[str]] = _Validator()
+    license: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-license`"""
-    classifiers: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    classifiers: _Validator[list[str] | None] = _Validator(added="1.1")
     """:external:ref:`core-metadata-classifier`"""
-    requires_dist: _Validator[Optional[List[requirements.Requirement]]] = _Validator(
+    requires_dist: _Validator[list[requirements.Requirement] | None] = _Validator(
         added="1.2"
     )
     """:external:ref:`core-metadata-requires-dist`"""
-    requires_python: _Validator[Optional[specifiers.SpecifierSet]] = _Validator(
+    requires_python: _Validator[specifiers.SpecifierSet | None] = _Validator(
         added="1.2"
     )
     """:external:ref:`core-metadata-requires-python`"""
     # Because `Requires-External` allows for non-PEP 440 version specifiers, we
     # don't do any processing on the values.
-    requires_external: _Validator[Optional[List[str]]] = _Validator(added="1.2")
+    requires_external: _Validator[list[str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-requires-external`"""
-    project_urls: _Validator[Optional[Dict[str, str]]] = _Validator(added="1.2")
+    project_urls: _Validator[dict[str, str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-project-url`"""
     # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation
     # regardless of metadata version.
-    provides_extra: _Validator[Optional[List[utils.NormalizedName]]] = _Validator(
+    provides_extra: _Validator[list[utils.NormalizedName] | None] = _Validator(
         added="2.1",
     )
     """:external:ref:`core-metadata-provides-extra`"""
-    provides_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2")
+    provides_dist: _Validator[list[str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-provides-dist`"""
-    obsoletes_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2")
+    obsoletes_dist: _Validator[list[str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-obsoletes-dist`"""
-    requires: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    requires: _Validator[list[str] | None] = _Validator(added="1.1")
     """``Requires`` (deprecated)"""
-    provides: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    provides: _Validator[list[str] | None] = _Validator(added="1.1")
     """``Provides`` (deprecated)"""
-    obsoletes: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    obsoletes: _Validator[list[str] | None] = _Validator(added="1.1")
     """``Obsoletes`` (deprecated)"""
diff --git a/setuptools/_vendor/packaging/requirements.py b/setuptools/_vendor/packaging/requirements.py
index bdc43a7e98..4e068c9567 100644
--- a/setuptools/_vendor/packaging/requirements.py
+++ b/setuptools/_vendor/packaging/requirements.py
@@ -1,8 +1,9 @@
 # This file is dual licensed under the terms of the Apache License, Version
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
+from __future__ import annotations
 
-from typing import Any, Iterator, Optional, Set
+from typing import Any, Iterator
 
 from ._parser import parse_requirement as _parse_requirement
 from ._tokenizer import ParserSyntaxError
@@ -37,10 +38,10 @@ def __init__(self, requirement_string: str) -> None:
             raise InvalidRequirement(str(e)) from e
 
         self.name: str = parsed.name
-        self.url: Optional[str] = parsed.url or None
-        self.extras: Set[str] = set(parsed.extras or [])
+        self.url: str | None = parsed.url or None
+        self.extras: set[str] = set(parsed.extras or [])
         self.specifier: SpecifierSet = SpecifierSet(parsed.specifier)
-        self.marker: Optional[Marker] = None
+        self.marker: Marker | None = None
         if parsed.marker is not None:
             self.marker = Marker.__new__(Marker)
             self.marker._markers = _normalize_extra_values(parsed.marker)
diff --git a/setuptools/_vendor/packaging/specifiers.py b/setuptools/_vendor/packaging/specifiers.py
index 2d015bab59..2fa75f7abb 100644
--- a/setuptools/_vendor/packaging/specifiers.py
+++ b/setuptools/_vendor/packaging/specifiers.py
@@ -8,10 +8,12 @@
     from packaging.version import Version
 """
 
+from __future__ import annotations
+
 import abc
 import itertools
 import re
-from typing import Callable, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union
+from typing import Callable, Iterable, Iterator, TypeVar, Union
 
 from .utils import canonicalize_version
 from .version import Version
@@ -64,7 +66,7 @@ def __eq__(self, other: object) -> bool:
 
     @property
     @abc.abstractmethod
-    def prereleases(self) -> Optional[bool]:
+    def prereleases(self) -> bool | None:
         """Whether or not pre-releases as a whole are allowed.
 
         This can be set to either ``True`` or ``False`` to explicitly enable or disable
@@ -79,14 +81,14 @@ def prereleases(self, value: bool) -> None:
         """
 
     @abc.abstractmethod
-    def contains(self, item: str, prereleases: Optional[bool] = None) -> bool:
+    def contains(self, item: str, prereleases: bool | None = None) -> bool:
         """
         Determines if the given item is contained within this specifier.
         """
 
     @abc.abstractmethod
     def filter(
-        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None
     ) -> Iterator[UnparsedVersionVar]:
         """
         Takes an iterable of items and filters them so that only items which
@@ -217,7 +219,7 @@ class Specifier(BaseSpecifier):
         "===": "arbitrary",
     }
 
-    def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None:
+    def __init__(self, spec: str = "", prereleases: bool | None = None) -> None:
         """Initialize a Specifier instance.
 
         :param spec:
@@ -234,7 +236,7 @@ def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None:
         if not match:
             raise InvalidSpecifier(f"Invalid specifier: '{spec}'")
 
-        self._spec: Tuple[str, str] = (
+        self._spec: tuple[str, str] = (
             match.group("operator").strip(),
             match.group("version").strip(),
         )
@@ -318,7 +320,7 @@ def __str__(self) -> str:
         return "{}{}".format(*self._spec)
 
     @property
-    def _canonical_spec(self) -> Tuple[str, str]:
+    def _canonical_spec(self) -> tuple[str, str]:
         canonical_version = canonicalize_version(
             self._spec[1],
             strip_trailing_zero=(self._spec[0] != "~="),
@@ -364,7 +366,6 @@ def _get_operator(self, op: str) -> CallableOperator:
         return operator_callable
 
     def _compare_compatible(self, prospective: Version, spec: str) -> bool:
-
         # Compatible releases have an equivalent combination of >= and ==. That
         # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
         # implement this in terms of the other specifiers instead of
@@ -385,7 +386,6 @@ def _compare_compatible(self, prospective: Version, spec: str) -> bool:
         )
 
     def _compare_equal(self, prospective: Version, spec: str) -> bool:
-
         # We need special logic to handle prefix matching
         if spec.endswith(".*"):
             # In the case of prefix matching we want to ignore local segment.
@@ -429,21 +429,18 @@ def _compare_not_equal(self, prospective: Version, spec: str) -> bool:
         return not self._compare_equal(prospective, spec)
 
     def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool:
-
         # NB: Local version identifiers are NOT permitted in the version
         # specifier, so local version labels can be universally removed from
         # the prospective version.
         return Version(prospective.public) <= Version(spec)
 
     def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool:
-
         # NB: Local version identifiers are NOT permitted in the version
         # specifier, so local version labels can be universally removed from
         # the prospective version.
         return Version(prospective.public) >= Version(spec)
 
     def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:
-
         # Convert our spec to a Version instance, since we'll want to work with
         # it as a version.
         spec = Version(spec_str)
@@ -468,7 +465,6 @@ def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:
         return True
 
     def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:
-
         # Convert our spec to a Version instance, since we'll want to work with
         # it as a version.
         spec = Version(spec_str)
@@ -501,7 +497,7 @@ def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:
     def _compare_arbitrary(self, prospective: Version, spec: str) -> bool:
         return str(prospective).lower() == str(spec).lower()
 
-    def __contains__(self, item: Union[str, Version]) -> bool:
+    def __contains__(self, item: str | Version) -> bool:
         """Return whether or not the item is contained in this specifier.
 
         :param item: The item to check for.
@@ -522,9 +518,7 @@ def __contains__(self, item: Union[str, Version]) -> bool:
         """
         return self.contains(item)
 
-    def contains(
-        self, item: UnparsedVersion, prereleases: Optional[bool] = None
-    ) -> bool:
+    def contains(self, item: UnparsedVersion, prereleases: bool | None = None) -> bool:
         """Return whether or not the item is contained in this specifier.
 
         :param item:
@@ -569,7 +563,7 @@ def contains(
         return operator_callable(normalized_item, self.version)
 
     def filter(
-        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None
     ) -> Iterator[UnparsedVersionVar]:
         """Filter items in the given iterable, that match the specifier.
 
@@ -633,7 +627,7 @@ def filter(
 _prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
 
 
-def _version_split(version: str) -> List[str]:
+def _version_split(version: str) -> list[str]:
     """Split version into components.
 
     The split components are intended for version comparison. The logic does
@@ -641,7 +635,7 @@ def _version_split(version: str) -> List[str]:
     components back with :func:`_version_join` may not produce the original
     version string.
     """
-    result: List[str] = []
+    result: list[str] = []
 
     epoch, _, rest = version.rpartition("!")
     result.append(epoch or "0")
@@ -655,7 +649,7 @@ def _version_split(version: str) -> List[str]:
     return result
 
 
-def _version_join(components: List[str]) -> str:
+def _version_join(components: list[str]) -> str:
     """Join split version components into a version string.
 
     This function assumes the input came from :func:`_version_split`, where the
@@ -672,7 +666,7 @@ def _is_not_suffix(segment: str) -> bool:
     )
 
 
-def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]:
+def _pad_version(left: list[str], right: list[str]) -> tuple[list[str], list[str]]:
     left_split, right_split = [], []
 
     # Get the release segment of our versions
@@ -700,9 +694,7 @@ class SpecifierSet(BaseSpecifier):
     specifiers (``>=3.0,!=3.1``), or no specifier at all.
     """
 
-    def __init__(
-        self, specifiers: str = "", prereleases: Optional[bool] = None
-    ) -> None:
+    def __init__(self, specifiers: str = "", prereleases: bool | None = None) -> None:
         """Initialize a SpecifierSet instance.
 
         :param specifiers:
@@ -730,7 +722,7 @@ def __init__(
         self._prereleases = prereleases
 
     @property
-    def prereleases(self) -> Optional[bool]:
+    def prereleases(self) -> bool | None:
         # If we have been given an explicit prerelease modifier, then we'll
         # pass that through here.
         if self._prereleases is not None:
@@ -787,7 +779,7 @@ def __str__(self) -> str:
     def __hash__(self) -> int:
         return hash(self._specs)
 
-    def __and__(self, other: Union["SpecifierSet", str]) -> "SpecifierSet":
+    def __and__(self, other: SpecifierSet | str) -> SpecifierSet:
         """Return a SpecifierSet which is a combination of the two sets.
 
         :param other: The other object to combine with.
@@ -883,8 +875,8 @@ def __contains__(self, item: UnparsedVersion) -> bool:
     def contains(
         self,
         item: UnparsedVersion,
-        prereleases: Optional[bool] = None,
-        installed: Optional[bool] = None,
+        prereleases: bool | None = None,
+        installed: bool | None = None,
     ) -> bool:
         """Return whether or not the item is contained in this SpecifierSet.
 
@@ -938,7 +930,7 @@ def contains(
         return all(s.contains(item, prereleases=prereleases) for s in self._specs)
 
     def filter(
-        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None
     ) -> Iterator[UnparsedVersionVar]:
         """Filter items in the given iterable, that match the specifiers in this set.
 
@@ -995,8 +987,8 @@ def filter(
         # which will filter out any pre-releases, unless there are no final
         # releases.
         else:
-            filtered: List[UnparsedVersionVar] = []
-            found_prereleases: List[UnparsedVersionVar] = []
+            filtered: list[UnparsedVersionVar] = []
+            found_prereleases: list[UnparsedVersionVar] = []
 
             for item in iterable:
                 parsed_version = _coerce_version(item)
diff --git a/setuptools/_vendor/packaging/tags.py b/setuptools/_vendor/packaging/tags.py
index 89f1926137..6667d29908 100644
--- a/setuptools/_vendor/packaging/tags.py
+++ b/setuptools/_vendor/packaging/tags.py
@@ -2,6 +2,8 @@
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
 
+from __future__ import annotations
+
 import logging
 import platform
 import re
@@ -11,15 +13,10 @@
 import sysconfig
 from importlib.machinery import EXTENSION_SUFFIXES
 from typing import (
-    Dict,
-    FrozenSet,
     Iterable,
     Iterator,
-    List,
-    Optional,
     Sequence,
     Tuple,
-    Union,
     cast,
 )
 
@@ -30,7 +27,7 @@
 PythonVersion = Sequence[int]
 MacVersion = Tuple[int, int]
 
-INTERPRETER_SHORT_NAMES: Dict[str, str] = {
+INTERPRETER_SHORT_NAMES: dict[str, str] = {
     "python": "py",  # Generic.
     "cpython": "cp",
     "pypy": "pp",
@@ -96,7 +93,7 @@ def __repr__(self) -> str:
         return f"<{self} @ {id(self)}>"
 
 
-def parse_tag(tag: str) -> FrozenSet[Tag]:
+def parse_tag(tag: str) -> frozenset[Tag]:
     """
     Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances.
 
@@ -112,8 +109,8 @@ def parse_tag(tag: str) -> FrozenSet[Tag]:
     return frozenset(tags)
 
 
-def _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]:
-    value: Union[int, str, None] = sysconfig.get_config_var(name)
+def _get_config_var(name: str, warn: bool = False) -> int | str | None:
+    value: int | str | None = sysconfig.get_config_var(name)
     if value is None and warn:
         logger.debug(
             "Config variable '%s' is unset, Python ABI tag may be incorrect", name
@@ -125,7 +122,7 @@ def _normalize_string(string: str) -> str:
     return string.replace(".", "_").replace("-", "_").replace(" ", "_")
 
 
-def _is_threaded_cpython(abis: List[str]) -> bool:
+def _is_threaded_cpython(abis: list[str]) -> bool:
     """
     Determine if the ABI corresponds to a threaded (`--disable-gil`) build.
 
@@ -151,7 +148,7 @@ def _abi3_applies(python_version: PythonVersion, threading: bool) -> bool:
     return len(python_version) > 1 and tuple(python_version) >= (3, 2) and not threading
 
 
-def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]:
+def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> list[str]:
     py_version = tuple(py_version)  # To allow for version comparison.
     abis = []
     version = _version_nodot(py_version[:2])
@@ -185,9 +182,9 @@ def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]:
 
 
 def cpython_tags(
-    python_version: Optional[PythonVersion] = None,
-    abis: Optional[Iterable[str]] = None,
-    platforms: Optional[Iterable[str]] = None,
+    python_version: PythonVersion | None = None,
+    abis: Iterable[str] | None = None,
+    platforms: Iterable[str] | None = None,
     *,
     warn: bool = False,
 ) -> Iterator[Tag]:
@@ -244,7 +241,7 @@ def cpython_tags(
                 yield Tag(interpreter, "abi3", platform_)
 
 
-def _generic_abi() -> List[str]:
+def _generic_abi() -> list[str]:
     """
     Return the ABI tag based on EXT_SUFFIX.
     """
@@ -286,9 +283,9 @@ def _generic_abi() -> List[str]:
 
 
 def generic_tags(
-    interpreter: Optional[str] = None,
-    abis: Optional[Iterable[str]] = None,
-    platforms: Optional[Iterable[str]] = None,
+    interpreter: str | None = None,
+    abis: Iterable[str] | None = None,
+    platforms: Iterable[str] | None = None,
     *,
     warn: bool = False,
 ) -> Iterator[Tag]:
@@ -332,9 +329,9 @@ def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]:
 
 
 def compatible_tags(
-    python_version: Optional[PythonVersion] = None,
-    interpreter: Optional[str] = None,
-    platforms: Optional[Iterable[str]] = None,
+    python_version: PythonVersion | None = None,
+    interpreter: str | None = None,
+    platforms: Iterable[str] | None = None,
 ) -> Iterator[Tag]:
     """
     Yields the sequence of tags that are compatible with a specific version of Python.
@@ -366,7 +363,7 @@ def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str:
     return "i386"
 
 
-def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]:
+def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> list[str]:
     formats = [cpu_arch]
     if cpu_arch == "x86_64":
         if version < (10, 4):
@@ -399,7 +396,7 @@ def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]:
 
 
 def mac_platforms(
-    version: Optional[MacVersion] = None, arch: Optional[str] = None
+    version: MacVersion | None = None, arch: str | None = None
 ) -> Iterator[str]:
     """
     Yields the platform tags for a macOS system.
diff --git a/setuptools/_vendor/packaging/utils.py b/setuptools/_vendor/packaging/utils.py
index c2c2f75aa8..d33da5bb8b 100644
--- a/setuptools/_vendor/packaging/utils.py
+++ b/setuptools/_vendor/packaging/utils.py
@@ -2,8 +2,10 @@
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
 
+from __future__ import annotations
+
 import re
-from typing import FrozenSet, NewType, Tuple, Union, cast
+from typing import NewType, Tuple, Union, cast
 
 from .tags import Tag, parse_tag
 from .version import InvalidVersion, Version
@@ -53,7 +55,7 @@ def is_normalized_name(name: str) -> bool:
 
 
 def canonicalize_version(
-    version: Union[Version, str], *, strip_trailing_zero: bool = True
+    version: Version | str, *, strip_trailing_zero: bool = True
 ) -> str:
     """
     This is very similar to Version.__str__, but has one subtle difference
@@ -102,7 +104,7 @@ def canonicalize_version(
 
 def parse_wheel_filename(
     filename: str,
-) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]:
+) -> tuple[NormalizedName, Version, BuildTag, frozenset[Tag]]:
     if not filename.endswith(".whl"):
         raise InvalidWheelFilename(
             f"Invalid wheel filename (extension must be '.whl'): {filename}"
@@ -143,7 +145,7 @@ def parse_wheel_filename(
     return (name, version, build, tags)
 
 
-def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]:
+def parse_sdist_filename(filename: str) -> tuple[NormalizedName, Version]:
     if filename.endswith(".tar.gz"):
         file_stem = filename[: -len(".tar.gz")]
     elif filename.endswith(".zip"):
diff --git a/setuptools/_vendor/packaging/version.py b/setuptools/_vendor/packaging/version.py
index 5faab9bd0d..46bc261308 100644
--- a/setuptools/_vendor/packaging/version.py
+++ b/setuptools/_vendor/packaging/version.py
@@ -7,9 +7,11 @@
     from packaging.version import parse, Version
 """
 
+from __future__ import annotations
+
 import itertools
 import re
-from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union
+from typing import Any, Callable, NamedTuple, SupportsInt, Tuple, Union
 
 from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType
 
@@ -35,14 +37,14 @@
 
 class _Version(NamedTuple):
     epoch: int
-    release: Tuple[int, ...]
-    dev: Optional[Tuple[str, int]]
-    pre: Optional[Tuple[str, int]]
-    post: Optional[Tuple[str, int]]
-    local: Optional[LocalType]
+    release: tuple[int, ...]
+    dev: tuple[str, int] | None
+    pre: tuple[str, int] | None
+    post: tuple[str, int] | None
+    local: LocalType | None
 
 
-def parse(version: str) -> "Version":
+def parse(version: str) -> Version:
     """Parse the given version string.
 
     >>> parse('1.0.dev1')
@@ -65,7 +67,7 @@ class InvalidVersion(ValueError):
 
 
 class _BaseVersion:
-    _key: Tuple[Any, ...]
+    _key: tuple[Any, ...]
 
     def __hash__(self) -> int:
         return hash(self._key)
@@ -73,13 +75,13 @@ def __hash__(self) -> int:
     # Please keep the duplicated `isinstance` check
     # in the six comparisons hereunder
     # unless you find a way to avoid adding overhead function calls.
-    def __lt__(self, other: "_BaseVersion") -> bool:
+    def __lt__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
         return self._key < other._key
 
-    def __le__(self, other: "_BaseVersion") -> bool:
+    def __le__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
@@ -91,13 +93,13 @@ def __eq__(self, other: object) -> bool:
 
         return self._key == other._key
 
-    def __ge__(self, other: "_BaseVersion") -> bool:
+    def __ge__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
         return self._key >= other._key
 
-    def __gt__(self, other: "_BaseVersion") -> bool:
+    def __gt__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
@@ -274,7 +276,7 @@ def epoch(self) -> int:
         return self._version.epoch
 
     @property
-    def release(self) -> Tuple[int, ...]:
+    def release(self) -> tuple[int, ...]:
         """The components of the "release" segment of the version.
 
         >>> Version("1.2.3").release
@@ -290,7 +292,7 @@ def release(self) -> Tuple[int, ...]:
         return self._version.release
 
     @property
-    def pre(self) -> Optional[Tuple[str, int]]:
+    def pre(self) -> tuple[str, int] | None:
         """The pre-release segment of the version.
 
         >>> print(Version("1.2.3").pre)
@@ -305,7 +307,7 @@ def pre(self) -> Optional[Tuple[str, int]]:
         return self._version.pre
 
     @property
-    def post(self) -> Optional[int]:
+    def post(self) -> int | None:
         """The post-release number of the version.
 
         >>> print(Version("1.2.3").post)
@@ -316,7 +318,7 @@ def post(self) -> Optional[int]:
         return self._version.post[1] if self._version.post else None
 
     @property
-    def dev(self) -> Optional[int]:
+    def dev(self) -> int | None:
         """The development number of the version.
 
         >>> print(Version("1.2.3").dev)
@@ -327,7 +329,7 @@ def dev(self) -> Optional[int]:
         return self._version.dev[1] if self._version.dev else None
 
     @property
-    def local(self) -> Optional[str]:
+    def local(self) -> str | None:
         """The local version segment of the version.
 
         >>> print(Version("1.2.3").local)
@@ -450,9 +452,8 @@ def micro(self) -> int:
 
 
 def _parse_letter_version(
-    letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
-) -> Optional[Tuple[str, int]]:
-
+    letter: str | None, number: str | bytes | SupportsInt | None
+) -> tuple[str, int] | None:
     if letter:
         # We consider there to be an implicit 0 in a pre-release if there is
         # not a numeral associated with it.
@@ -488,7 +489,7 @@ def _parse_letter_version(
 _local_version_separators = re.compile(r"[\._-]")
 
 
-def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
+def _parse_local_version(local: str | None) -> LocalType | None:
     """
     Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
     """
@@ -502,13 +503,12 @@ def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
 
 def _cmpkey(
     epoch: int,
-    release: Tuple[int, ...],
-    pre: Optional[Tuple[str, int]],
-    post: Optional[Tuple[str, int]],
-    dev: Optional[Tuple[str, int]],
-    local: Optional[LocalType],
+    release: tuple[int, ...],
+    pre: tuple[str, int] | None,
+    post: tuple[str, int] | None,
+    dev: tuple[str, int] | None,
+    local: LocalType | None,
 ) -> CmpKey:
-
     # When we compare a release version, we want to compare it with all of the
     # trailing zeros removed. So we'll use a reverse the list, drop all the now
     # leading zeros until we come to something non zero, then take the rest
diff --git a/setuptools/_vendor/typeguard-4.3.0.dist-info/INSTALLER b/setuptools/_vendor/typeguard-4.3.0.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/setuptools/_vendor/typeguard-4.3.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/setuptools/_vendor/typeguard-4.3.0.dist-info/LICENSE b/setuptools/_vendor/typeguard-4.3.0.dist-info/LICENSE
new file mode 100644
index 0000000000..07806f8af9
--- /dev/null
+++ b/setuptools/_vendor/typeguard-4.3.0.dist-info/LICENSE
@@ -0,0 +1,19 @@
+This is the MIT license: http://www.opensource.org/licenses/mit-license.php
+
+Copyright (c) Alex Grönholm
+
+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/setuptools/_vendor/typeguard-4.3.0.dist-info/METADATA b/setuptools/_vendor/typeguard-4.3.0.dist-info/METADATA
new file mode 100644
index 0000000000..6e5750b485
--- /dev/null
+++ b/setuptools/_vendor/typeguard-4.3.0.dist-info/METADATA
@@ -0,0 +1,81 @@
+Metadata-Version: 2.1
+Name: typeguard
+Version: 4.3.0
+Summary: Run-time type checker for Python
+Author-email: Alex Grönholm 
+License: MIT
+Project-URL: Documentation, https://typeguard.readthedocs.io/en/latest/
+Project-URL: Change log, https://typeguard.readthedocs.io/en/latest/versionhistory.html
+Project-URL: Source code, https://github.com/agronholm/typeguard
+Project-URL: Issue tracker, https://github.com/agronholm/typeguard/issues
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+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
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: typing-extensions >=4.10.0
+Requires-Dist: importlib-metadata >=3.6 ; python_version < "3.10"
+Provides-Extra: doc
+Requires-Dist: packaging ; extra == 'doc'
+Requires-Dist: Sphinx >=7 ; extra == 'doc'
+Requires-Dist: sphinx-autodoc-typehints >=1.2.0 ; extra == 'doc'
+Requires-Dist: sphinx-rtd-theme >=1.3.0 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: coverage[toml] >=7 ; extra == 'test'
+Requires-Dist: pytest >=7 ; extra == 'test'
+Requires-Dist: mypy >=1.2.0 ; (platform_python_implementation != "PyPy") and extra == 'test'
+
+.. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg
+  :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml
+  :alt: Build Status
+.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github
+  :target: https://coveralls.io/github/agronholm/typeguard?branch=master
+  :alt: Code Coverage
+.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest
+  :target: https://typeguard.readthedocs.io/en/latest/?badge=latest
+  :alt: Documentation
+
+This library provides run-time type checking for functions defined with
+`PEP 484 `_ argument (and return) type
+annotations, and any arbitrary objects. It can be used together with static type
+checkers as an additional layer of type safety, to catch type violations that could only
+be detected at run time.
+
+Two principal ways to do type checking are provided:
+
+#. The ``check_type`` function:
+
+   * like ``isinstance()``, but supports arbitrary type annotations (within limits)
+   * can be used as a ``cast()`` replacement, but with actual checking of the value
+#. Code instrumentation:
+
+   * entire modules, or individual functions (via ``@typechecked``) are recompiled, with
+     type checking code injected into them
+   * automatically checks function arguments, return values and assignments to annotated
+     local variables
+   * for generator functions (regular and async), checks yield and send values
+   * requires the original source code of the instrumented module(s) to be accessible
+
+Two options are provided for code instrumentation:
+
+#. the ``@typechecked`` function:
+
+   * can be applied to functions individually
+#. the import hook (``typeguard.install_import_hook()``):
+
+   * automatically instruments targeted modules on import
+   * no manual code changes required in the target modules
+   * requires the import hook to be installed before the targeted modules are imported
+   * may clash with other import hooks
+
+See the documentation_ for further information.
+
+.. _documentation: https://typeguard.readthedocs.io/en/latest/
diff --git a/setuptools/_vendor/typeguard-4.3.0.dist-info/RECORD b/setuptools/_vendor/typeguard-4.3.0.dist-info/RECORD
new file mode 100644
index 0000000000..801e73347c
--- /dev/null
+++ b/setuptools/_vendor/typeguard-4.3.0.dist-info/RECORD
@@ -0,0 +1,34 @@
+typeguard-4.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+typeguard-4.3.0.dist-info/LICENSE,sha256=YWP3mH37ONa8MgzitwsvArhivEESZRbVUu8c1DJH51g,1130
+typeguard-4.3.0.dist-info/METADATA,sha256=z2dcHAp0TwhYCFU5Deh8x31nazElgujUz9tbuP0pjSE,3717
+typeguard-4.3.0.dist-info/RECORD,,
+typeguard-4.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+typeguard-4.3.0.dist-info/entry_points.txt,sha256=qp7NQ1aLtiSgMQqo6gWlfGpy0IIXzoMJmeQTLpzqFZQ,48
+typeguard-4.3.0.dist-info/top_level.txt,sha256=4z28AhuDodwRS_c1J_l8H51t5QuwfTseskYzlxp6grs,10
+typeguard/__init__.py,sha256=Onh4w38elPCjtlcU3JY9k3h70NjsxXIkAflmQn-Z0FY,2071
+typeguard/__pycache__/__init__.cpython-312.pyc,,
+typeguard/__pycache__/_checkers.cpython-312.pyc,,
+typeguard/__pycache__/_config.cpython-312.pyc,,
+typeguard/__pycache__/_decorators.cpython-312.pyc,,
+typeguard/__pycache__/_exceptions.cpython-312.pyc,,
+typeguard/__pycache__/_functions.cpython-312.pyc,,
+typeguard/__pycache__/_importhook.cpython-312.pyc,,
+typeguard/__pycache__/_memo.cpython-312.pyc,,
+typeguard/__pycache__/_pytest_plugin.cpython-312.pyc,,
+typeguard/__pycache__/_suppression.cpython-312.pyc,,
+typeguard/__pycache__/_transformer.cpython-312.pyc,,
+typeguard/__pycache__/_union_transformer.cpython-312.pyc,,
+typeguard/__pycache__/_utils.cpython-312.pyc,,
+typeguard/_checkers.py,sha256=JRrgKicdOEfIBoNEtegYCEIlhpad-a1u1Em7GCj0WCI,31360
+typeguard/_config.py,sha256=nIz8QwDa-oFO3L9O8_6srzlmd99pSby2wOM4Wb7F_B0,2846
+typeguard/_decorators.py,sha256=v6dsIeWvPhExGLP_wXF-RmDUyjZf_Ak28g7gBJ_v0-0,9033
+typeguard/_exceptions.py,sha256=ZIPeiV-FBd5Emw2EaWd2Fvlsrwi4ocwT2fVGBIAtHcQ,1121
+typeguard/_functions.py,sha256=ibgSAKa5ptIm1eR9ARG0BSozAFJPFNASZqhPVyQeqig,10393
+typeguard/_importhook.py,sha256=ugjCDvFcdWMU7UugqlJG91IpVNpEIxtRr-99s0h1k7M,6389
+typeguard/_memo.py,sha256=1juQV_vxnD2JYKbSrebiQuj4oKHz6n67v9pYA-CCISg,1303
+typeguard/_pytest_plugin.py,sha256=-fcSqkv54rIfIF8pDavY5YQPkj4OX8GMt_lL7CQSD4I,4416
+typeguard/_suppression.py,sha256=VQfzxcwIbu3if0f7VBkKM7hkYOA7tNFw9a7jMBsmMg4,2266
+typeguard/_transformer.py,sha256=9Ha7_QhdwoUni_6hvdY-hZbuEergowHrNL2vzHIakFY,44937
+typeguard/_union_transformer.py,sha256=v_42r7-6HuRX2SoFwnyJ-E5PlxXpVeUJPJR1-HU9qSo,1354
+typeguard/_utils.py,sha256=5HhO1rPn5f1M6ymkVAEv7Xmlz1cX-j0OnTMlyHqqrR8,5270
+typeguard/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/setuptools/_vendor/typeguard-4.3.0.dist-info/WHEEL b/setuptools/_vendor/typeguard-4.3.0.dist-info/WHEEL
new file mode 100644
index 0000000000..bab98d6758
--- /dev/null
+++ b/setuptools/_vendor/typeguard-4.3.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/setuptools/_vendor/typeguard-4.3.0.dist-info/entry_points.txt b/setuptools/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
new file mode 100644
index 0000000000..47c9d0bd91
--- /dev/null
+++ b/setuptools/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
@@ -0,0 +1,2 @@
+[pytest11]
+typeguard = typeguard._pytest_plugin
diff --git a/setuptools/_vendor/typeguard-4.3.0.dist-info/top_level.txt b/setuptools/_vendor/typeguard-4.3.0.dist-info/top_level.txt
new file mode 100644
index 0000000000..be5ec23ea2
--- /dev/null
+++ b/setuptools/_vendor/typeguard-4.3.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+typeguard
diff --git a/setuptools/_vendor/typeguard/__init__.py b/setuptools/_vendor/typeguard/__init__.py
new file mode 100644
index 0000000000..6781cad094
--- /dev/null
+++ b/setuptools/_vendor/typeguard/__init__.py
@@ -0,0 +1,48 @@
+import os
+from typing import Any
+
+from ._checkers import TypeCheckerCallable as TypeCheckerCallable
+from ._checkers import TypeCheckLookupCallback as TypeCheckLookupCallback
+from ._checkers import check_type_internal as check_type_internal
+from ._checkers import checker_lookup_functions as checker_lookup_functions
+from ._checkers import load_plugins as load_plugins
+from ._config import CollectionCheckStrategy as CollectionCheckStrategy
+from ._config import ForwardRefPolicy as ForwardRefPolicy
+from ._config import TypeCheckConfiguration as TypeCheckConfiguration
+from ._decorators import typechecked as typechecked
+from ._decorators import typeguard_ignore as typeguard_ignore
+from ._exceptions import InstrumentationWarning as InstrumentationWarning
+from ._exceptions import TypeCheckError as TypeCheckError
+from ._exceptions import TypeCheckWarning as TypeCheckWarning
+from ._exceptions import TypeHintWarning as TypeHintWarning
+from ._functions import TypeCheckFailCallback as TypeCheckFailCallback
+from ._functions import check_type as check_type
+from ._functions import warn_on_error as warn_on_error
+from ._importhook import ImportHookManager as ImportHookManager
+from ._importhook import TypeguardFinder as TypeguardFinder
+from ._importhook import install_import_hook as install_import_hook
+from ._memo import TypeCheckMemo as TypeCheckMemo
+from ._suppression import suppress_type_checks as suppress_type_checks
+from ._utils import Unset as Unset
+
+# Re-export imports so they look like they live directly in this package
+for value in list(locals().values()):
+    if getattr(value, "__module__", "").startswith(f"{__name__}."):
+        value.__module__ = __name__
+
+
+config: TypeCheckConfiguration
+
+
+def __getattr__(name: str) -> Any:
+    if name == "config":
+        from ._config import global_config
+
+        return global_config
+
+    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
+
+# Automatically load checker lookup functions unless explicitly disabled
+if "TYPEGUARD_DISABLE_PLUGIN_AUTOLOAD" not in os.environ:
+    load_plugins()
diff --git a/setuptools/_vendor/typeguard/_checkers.py b/setuptools/_vendor/typeguard/_checkers.py
new file mode 100644
index 0000000000..67dd5ad4dc
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_checkers.py
@@ -0,0 +1,993 @@
+from __future__ import annotations
+
+import collections.abc
+import inspect
+import sys
+import types
+import typing
+import warnings
+from enum import Enum
+from inspect import Parameter, isclass, isfunction
+from io import BufferedIOBase, IOBase, RawIOBase, TextIOBase
+from textwrap import indent
+from typing import (
+    IO,
+    AbstractSet,
+    Any,
+    BinaryIO,
+    Callable,
+    Dict,
+    ForwardRef,
+    List,
+    Mapping,
+    MutableMapping,
+    NewType,
+    Optional,
+    Sequence,
+    Set,
+    TextIO,
+    Tuple,
+    Type,
+    TypeVar,
+    Union,
+)
+from unittest.mock import Mock
+from weakref import WeakKeyDictionary
+
+try:
+    import typing_extensions
+except ImportError:
+    typing_extensions = None  # type: ignore[assignment]
+
+# Must use this because typing.is_typeddict does not recognize
+# TypedDict from typing_extensions, and as of version 4.12.0
+# typing_extensions.TypedDict is different from typing.TypedDict
+# on all versions.
+from typing_extensions import is_typeddict
+
+from ._config import ForwardRefPolicy
+from ._exceptions import TypeCheckError, TypeHintWarning
+from ._memo import TypeCheckMemo
+from ._utils import evaluate_forwardref, get_stacklevel, get_type_name, qualified_name
+
+if sys.version_info >= (3, 11):
+    from typing import (
+        Annotated,
+        NotRequired,
+        TypeAlias,
+        get_args,
+        get_origin,
+    )
+
+    SubclassableAny = Any
+else:
+    from typing_extensions import (
+        Annotated,
+        NotRequired,
+        TypeAlias,
+        get_args,
+        get_origin,
+    )
+    from typing_extensions import Any as SubclassableAny
+
+if sys.version_info >= (3, 10):
+    from importlib.metadata import entry_points
+    from typing import ParamSpec
+else:
+    from importlib_metadata import entry_points
+    from typing_extensions import ParamSpec
+
+TypeCheckerCallable: TypeAlias = Callable[
+    [Any, Any, Tuple[Any, ...], TypeCheckMemo], Any
+]
+TypeCheckLookupCallback: TypeAlias = Callable[
+    [Any, Tuple[Any, ...], Tuple[Any, ...]], Optional[TypeCheckerCallable]
+]
+
+checker_lookup_functions: list[TypeCheckLookupCallback] = []
+generic_alias_types: tuple[type, ...] = (type(List), type(List[Any]))
+if sys.version_info >= (3, 9):
+    generic_alias_types += (types.GenericAlias,)
+
+protocol_check_cache: WeakKeyDictionary[
+    type[Any], dict[type[Any], TypeCheckError | None]
+] = WeakKeyDictionary()
+
+# Sentinel
+_missing = object()
+
+# Lifted from mypy.sharedparse
+BINARY_MAGIC_METHODS = {
+    "__add__",
+    "__and__",
+    "__cmp__",
+    "__divmod__",
+    "__div__",
+    "__eq__",
+    "__floordiv__",
+    "__ge__",
+    "__gt__",
+    "__iadd__",
+    "__iand__",
+    "__idiv__",
+    "__ifloordiv__",
+    "__ilshift__",
+    "__imatmul__",
+    "__imod__",
+    "__imul__",
+    "__ior__",
+    "__ipow__",
+    "__irshift__",
+    "__isub__",
+    "__itruediv__",
+    "__ixor__",
+    "__le__",
+    "__lshift__",
+    "__lt__",
+    "__matmul__",
+    "__mod__",
+    "__mul__",
+    "__ne__",
+    "__or__",
+    "__pow__",
+    "__radd__",
+    "__rand__",
+    "__rdiv__",
+    "__rfloordiv__",
+    "__rlshift__",
+    "__rmatmul__",
+    "__rmod__",
+    "__rmul__",
+    "__ror__",
+    "__rpow__",
+    "__rrshift__",
+    "__rshift__",
+    "__rsub__",
+    "__rtruediv__",
+    "__rxor__",
+    "__sub__",
+    "__truediv__",
+    "__xor__",
+}
+
+
+def check_callable(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not callable(value):
+        raise TypeCheckError("is not callable")
+
+    if args:
+        try:
+            signature = inspect.signature(value)
+        except (TypeError, ValueError):
+            return
+
+        argument_types = args[0]
+        if isinstance(argument_types, list) and not any(
+            type(item) is ParamSpec for item in argument_types
+        ):
+            # The callable must not have keyword-only arguments without defaults
+            unfulfilled_kwonlyargs = [
+                param.name
+                for param in signature.parameters.values()
+                if param.kind == Parameter.KEYWORD_ONLY
+                and param.default == Parameter.empty
+            ]
+            if unfulfilled_kwonlyargs:
+                raise TypeCheckError(
+                    f"has mandatory keyword-only arguments in its declaration: "
+                    f'{", ".join(unfulfilled_kwonlyargs)}'
+                )
+
+            num_positional_args = num_mandatory_pos_args = 0
+            has_varargs = False
+            for param in signature.parameters.values():
+                if param.kind in (
+                    Parameter.POSITIONAL_ONLY,
+                    Parameter.POSITIONAL_OR_KEYWORD,
+                ):
+                    num_positional_args += 1
+                    if param.default is Parameter.empty:
+                        num_mandatory_pos_args += 1
+                elif param.kind == Parameter.VAR_POSITIONAL:
+                    has_varargs = True
+
+            if num_mandatory_pos_args > len(argument_types):
+                raise TypeCheckError(
+                    f"has too many mandatory positional arguments in its declaration; "
+                    f"expected {len(argument_types)} but {num_mandatory_pos_args} "
+                    f"mandatory positional argument(s) declared"
+                )
+            elif not has_varargs and num_positional_args < len(argument_types):
+                raise TypeCheckError(
+                    f"has too few arguments in its declaration; expected "
+                    f"{len(argument_types)} but {num_positional_args} argument(s) "
+                    f"declared"
+                )
+
+
+def check_mapping(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is Dict or origin_type is dict:
+        if not isinstance(value, dict):
+            raise TypeCheckError("is not a dict")
+    if origin_type is MutableMapping or origin_type is collections.abc.MutableMapping:
+        if not isinstance(value, collections.abc.MutableMapping):
+            raise TypeCheckError("is not a mutable mapping")
+    elif not isinstance(value, collections.abc.Mapping):
+        raise TypeCheckError("is not a mapping")
+
+    if args:
+        key_type, value_type = args
+        if key_type is not Any or value_type is not Any:
+            samples = memo.config.collection_check_strategy.iterate_samples(
+                value.items()
+            )
+            for k, v in samples:
+                try:
+                    check_type_internal(k, key_type, memo)
+                except TypeCheckError as exc:
+                    exc.append_path_element(f"key {k!r}")
+                    raise
+
+                try:
+                    check_type_internal(v, value_type, memo)
+                except TypeCheckError as exc:
+                    exc.append_path_element(f"value of key {k!r}")
+                    raise
+
+
+def check_typed_dict(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, dict):
+        raise TypeCheckError("is not a dict")
+
+    declared_keys = frozenset(origin_type.__annotations__)
+    if hasattr(origin_type, "__required_keys__"):
+        required_keys = set(origin_type.__required_keys__)
+    else:  # py3.8 and lower
+        required_keys = set(declared_keys) if origin_type.__total__ else set()
+
+    existing_keys = set(value)
+    extra_keys = existing_keys - declared_keys
+    if extra_keys:
+        keys_formatted = ", ".join(f'"{key}"' for key in sorted(extra_keys, key=repr))
+        raise TypeCheckError(f"has unexpected extra key(s): {keys_formatted}")
+
+    # Detect NotRequired fields which are hidden by get_type_hints()
+    type_hints: dict[str, type] = {}
+    for key, annotation in origin_type.__annotations__.items():
+        if isinstance(annotation, ForwardRef):
+            annotation = evaluate_forwardref(annotation, memo)
+            if get_origin(annotation) is NotRequired:
+                required_keys.discard(key)
+                annotation = get_args(annotation)[0]
+
+        type_hints[key] = annotation
+
+    missing_keys = required_keys - existing_keys
+    if missing_keys:
+        keys_formatted = ", ".join(f'"{key}"' for key in sorted(missing_keys, key=repr))
+        raise TypeCheckError(f"is missing required key(s): {keys_formatted}")
+
+    for key, argtype in type_hints.items():
+        argvalue = value.get(key, _missing)
+        if argvalue is not _missing:
+            try:
+                check_type_internal(argvalue, argtype, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"value of key {key!r}")
+                raise
+
+
+def check_list(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, list):
+        raise TypeCheckError("is not a list")
+
+    if args and args != (Any,):
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for i, v in enumerate(samples):
+            try:
+                check_type_internal(v, args[0], memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+
+
+def check_sequence(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, collections.abc.Sequence):
+        raise TypeCheckError("is not a sequence")
+
+    if args and args != (Any,):
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for i, v in enumerate(samples):
+            try:
+                check_type_internal(v, args[0], memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+
+
+def check_set(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is frozenset:
+        if not isinstance(value, frozenset):
+            raise TypeCheckError("is not a frozenset")
+    elif not isinstance(value, AbstractSet):
+        raise TypeCheckError("is not a set")
+
+    if args and args != (Any,):
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for v in samples:
+            try:
+                check_type_internal(v, args[0], memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"[{v}]")
+                raise
+
+
+def check_tuple(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    # Specialized check for NamedTuples
+    if field_types := getattr(origin_type, "__annotations__", None):
+        if not isinstance(value, origin_type):
+            raise TypeCheckError(
+                f"is not a named tuple of type {qualified_name(origin_type)}"
+            )
+
+        for name, field_type in field_types.items():
+            try:
+                check_type_internal(getattr(value, name), field_type, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"attribute {name!r}")
+                raise
+
+        return
+    elif not isinstance(value, tuple):
+        raise TypeCheckError("is not a tuple")
+
+    if args:
+        use_ellipsis = args[-1] is Ellipsis
+        tuple_params = args[: -1 if use_ellipsis else None]
+    else:
+        # Unparametrized Tuple or plain tuple
+        return
+
+    if use_ellipsis:
+        element_type = tuple_params[0]
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for i, element in enumerate(samples):
+            try:
+                check_type_internal(element, element_type, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+    elif tuple_params == ((),):
+        if value != ():
+            raise TypeCheckError("is not an empty tuple")
+    else:
+        if len(value) != len(tuple_params):
+            raise TypeCheckError(
+                f"has wrong number of elements (expected {len(tuple_params)}, got "
+                f"{len(value)} instead)"
+            )
+
+        for i, (element, element_type) in enumerate(zip(value, tuple_params)):
+            try:
+                check_type_internal(element, element_type, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+
+
+def check_union(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    errors: dict[str, TypeCheckError] = {}
+    try:
+        for type_ in args:
+            try:
+                check_type_internal(value, type_, memo)
+                return
+            except TypeCheckError as exc:
+                errors[get_type_name(type_)] = exc
+
+        formatted_errors = indent(
+            "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
+        )
+    finally:
+        del errors  # avoid creating ref cycle
+    raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
+
+
+def check_uniontype(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    errors: dict[str, TypeCheckError] = {}
+    for type_ in args:
+        try:
+            check_type_internal(value, type_, memo)
+            return
+        except TypeCheckError as exc:
+            errors[get_type_name(type_)] = exc
+
+    formatted_errors = indent(
+        "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
+    )
+    raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
+
+
+def check_class(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isclass(value) and not isinstance(value, generic_alias_types):
+        raise TypeCheckError("is not a class")
+
+    if not args:
+        return
+
+    if isinstance(args[0], ForwardRef):
+        expected_class = evaluate_forwardref(args[0], memo)
+    else:
+        expected_class = args[0]
+
+    if expected_class is Any:
+        return
+    elif getattr(expected_class, "_is_protocol", False):
+        check_protocol(value, expected_class, (), memo)
+    elif isinstance(expected_class, TypeVar):
+        check_typevar(value, expected_class, (), memo, subclass_check=True)
+    elif get_origin(expected_class) is Union:
+        errors: dict[str, TypeCheckError] = {}
+        for arg in get_args(expected_class):
+            if arg is Any:
+                return
+
+            try:
+                check_class(value, type, (arg,), memo)
+                return
+            except TypeCheckError as exc:
+                errors[get_type_name(arg)] = exc
+        else:
+            formatted_errors = indent(
+                "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
+            )
+            raise TypeCheckError(
+                f"did not match any element in the union:\n{formatted_errors}"
+            )
+    elif not issubclass(value, expected_class):  # type: ignore[arg-type]
+        raise TypeCheckError(f"is not a subclass of {qualified_name(expected_class)}")
+
+
+def check_newtype(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    check_type_internal(value, origin_type.__supertype__, memo)
+
+
+def check_instance(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, origin_type):
+        raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
+
+
+def check_typevar(
+    value: Any,
+    origin_type: TypeVar,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+    *,
+    subclass_check: bool = False,
+) -> None:
+    if origin_type.__bound__ is not None:
+        annotation = (
+            Type[origin_type.__bound__] if subclass_check else origin_type.__bound__
+        )
+        check_type_internal(value, annotation, memo)
+    elif origin_type.__constraints__:
+        for constraint in origin_type.__constraints__:
+            annotation = Type[constraint] if subclass_check else constraint
+            try:
+                check_type_internal(value, annotation, memo)
+            except TypeCheckError:
+                pass
+            else:
+                break
+        else:
+            formatted_constraints = ", ".join(
+                get_type_name(constraint) for constraint in origin_type.__constraints__
+            )
+            raise TypeCheckError(
+                f"does not match any of the constraints " f"({formatted_constraints})"
+            )
+
+
+if typing_extensions is None:
+
+    def _is_literal_type(typ: object) -> bool:
+        return typ is typing.Literal
+
+else:
+
+    def _is_literal_type(typ: object) -> bool:
+        return typ is typing.Literal or typ is typing_extensions.Literal
+
+
+def check_literal(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    def get_literal_args(literal_args: tuple[Any, ...]) -> tuple[Any, ...]:
+        retval: list[Any] = []
+        for arg in literal_args:
+            if _is_literal_type(get_origin(arg)):
+                retval.extend(get_literal_args(arg.__args__))
+            elif arg is None or isinstance(arg, (int, str, bytes, bool, Enum)):
+                retval.append(arg)
+            else:
+                raise TypeError(
+                    f"Illegal literal value: {arg}"
+                )  # TypeError here is deliberate
+
+        return tuple(retval)
+
+    final_args = tuple(get_literal_args(args))
+    try:
+        index = final_args.index(value)
+    except ValueError:
+        pass
+    else:
+        if type(final_args[index]) is type(value):
+            return
+
+    formatted_args = ", ".join(repr(arg) for arg in final_args)
+    raise TypeCheckError(f"is not any of ({formatted_args})") from None
+
+
+def check_literal_string(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    check_type_internal(value, str, memo)
+
+
+def check_typeguard(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    check_type_internal(value, bool, memo)
+
+
+def check_none(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if value is not None:
+        raise TypeCheckError("is not None")
+
+
+def check_number(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is complex and not isinstance(value, (complex, float, int)):
+        raise TypeCheckError("is neither complex, float or int")
+    elif origin_type is float and not isinstance(value, (float, int)):
+        raise TypeCheckError("is neither float or int")
+
+
+def check_io(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is TextIO or (origin_type is IO and args == (str,)):
+        if not isinstance(value, TextIOBase):
+            raise TypeCheckError("is not a text based I/O object")
+    elif origin_type is BinaryIO or (origin_type is IO and args == (bytes,)):
+        if not isinstance(value, (RawIOBase, BufferedIOBase)):
+            raise TypeCheckError("is not a binary I/O object")
+    elif not isinstance(value, IOBase):
+        raise TypeCheckError("is not an I/O object")
+
+
+def check_protocol(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    subject: type[Any] = value if isclass(value) else type(value)
+
+    if subject in protocol_check_cache:
+        result_map = protocol_check_cache[subject]
+        if origin_type in result_map:
+            if exc := result_map[origin_type]:
+                raise exc
+            else:
+                return
+
+    # Collect a set of methods and non-method attributes present in the protocol
+    ignored_attrs = set(dir(typing.Protocol)) | {
+        "__annotations__",
+        "__non_callable_proto_members__",
+    }
+    expected_methods: dict[str, tuple[Any, Any]] = {}
+    expected_noncallable_members: dict[str, Any] = {}
+    for attrname in dir(origin_type):
+        # Skip attributes present in typing.Protocol
+        if attrname in ignored_attrs:
+            continue
+
+        member = getattr(origin_type, attrname)
+        if callable(member):
+            signature = inspect.signature(member)
+            argtypes = [
+                (p.annotation if p.annotation is not Parameter.empty else Any)
+                for p in signature.parameters.values()
+                if p.kind is not Parameter.KEYWORD_ONLY
+            ] or Ellipsis
+            return_annotation = (
+                signature.return_annotation
+                if signature.return_annotation is not Parameter.empty
+                else Any
+            )
+            expected_methods[attrname] = argtypes, return_annotation
+        else:
+            expected_noncallable_members[attrname] = member
+
+    for attrname, annotation in typing.get_type_hints(origin_type).items():
+        expected_noncallable_members[attrname] = annotation
+
+    subject_annotations = typing.get_type_hints(subject)
+
+    # Check that all required methods are present and their signatures are compatible
+    result_map = protocol_check_cache.setdefault(subject, {})
+    try:
+        for attrname, callable_args in expected_methods.items():
+            try:
+                method = getattr(subject, attrname)
+            except AttributeError:
+                if attrname in subject_annotations:
+                    raise TypeCheckError(
+                        f"is not compatible with the {origin_type.__qualname__} protocol "
+                        f"because its {attrname!r} attribute is not a method"
+                    ) from None
+                else:
+                    raise TypeCheckError(
+                        f"is not compatible with the {origin_type.__qualname__} protocol "
+                        f"because it has no method named {attrname!r}"
+                    ) from None
+
+            if not callable(method):
+                raise TypeCheckError(
+                    f"is not compatible with the {origin_type.__qualname__} protocol "
+                    f"because its {attrname!r} attribute is not a callable"
+                )
+
+            # TODO: raise exception on added keyword-only arguments without defaults
+            try:
+                check_callable(method, Callable, callable_args, memo)
+            except TypeCheckError as exc:
+                raise TypeCheckError(
+                    f"is not compatible with the {origin_type.__qualname__} protocol "
+                    f"because its {attrname!r} method {exc}"
+                ) from None
+
+        # Check that all required non-callable members are present
+        for attrname in expected_noncallable_members:
+            # TODO: implement assignability checks for non-callable members
+            if attrname not in subject_annotations and not hasattr(subject, attrname):
+                raise TypeCheckError(
+                    f"is not compatible with the {origin_type.__qualname__} protocol "
+                    f"because it has no attribute named {attrname!r}"
+                )
+    except TypeCheckError as exc:
+        result_map[origin_type] = exc
+        raise
+    else:
+        result_map[origin_type] = None
+
+
+def check_byteslike(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, (bytearray, bytes, memoryview)):
+        raise TypeCheckError("is not bytes-like")
+
+
+def check_self(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if memo.self_type is None:
+        raise TypeCheckError("cannot be checked against Self outside of a method call")
+
+    if isclass(value):
+        if not issubclass(value, memo.self_type):
+            raise TypeCheckError(
+                f"is not an instance of the self type "
+                f"({qualified_name(memo.self_type)})"
+            )
+    elif not isinstance(value, memo.self_type):
+        raise TypeCheckError(
+            f"is not an instance of the self type ({qualified_name(memo.self_type)})"
+        )
+
+
+def check_paramspec(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    pass  # No-op for now
+
+
+def check_instanceof(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, origin_type):
+        raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
+
+
+def check_type_internal(
+    value: Any,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> None:
+    """
+    Check that the given object is compatible with the given type annotation.
+
+    This function should only be used by type checker callables. Applications should use
+    :func:`~.check_type` instead.
+
+    :param value: the value to check
+    :param annotation: the type annotation to check against
+    :param memo: a memo object containing configuration and information necessary for
+        looking up forward references
+    """
+
+    if isinstance(annotation, ForwardRef):
+        try:
+            annotation = evaluate_forwardref(annotation, memo)
+        except NameError:
+            if memo.config.forward_ref_policy is ForwardRefPolicy.ERROR:
+                raise
+            elif memo.config.forward_ref_policy is ForwardRefPolicy.WARN:
+                warnings.warn(
+                    f"Cannot resolve forward reference {annotation.__forward_arg__!r}",
+                    TypeHintWarning,
+                    stacklevel=get_stacklevel(),
+                )
+
+            return
+
+    if annotation is Any or annotation is SubclassableAny or isinstance(value, Mock):
+        return
+
+    # Skip type checks if value is an instance of a class that inherits from Any
+    if not isclass(value) and SubclassableAny in type(value).__bases__:
+        return
+
+    extras: tuple[Any, ...]
+    origin_type = get_origin(annotation)
+    if origin_type is Annotated:
+        annotation, *extras_ = get_args(annotation)
+        extras = tuple(extras_)
+        origin_type = get_origin(annotation)
+    else:
+        extras = ()
+
+    if origin_type is not None:
+        args = get_args(annotation)
+
+        # Compatibility hack to distinguish between unparametrized and empty tuple
+        # (tuple[()]), necessary due to https://github.com/python/cpython/issues/91137
+        if origin_type in (tuple, Tuple) and annotation is not Tuple and not args:
+            args = ((),)
+    else:
+        origin_type = annotation
+        args = ()
+
+    for lookup_func in checker_lookup_functions:
+        checker = lookup_func(origin_type, args, extras)
+        if checker:
+            checker(value, origin_type, args, memo)
+            return
+
+    if isclass(origin_type):
+        if not isinstance(value, origin_type):
+            raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
+    elif type(origin_type) is str:  # noqa: E721
+        warnings.warn(
+            f"Skipping type check against {origin_type!r}; this looks like a "
+            f"string-form forward reference imported from another module",
+            TypeHintWarning,
+            stacklevel=get_stacklevel(),
+        )
+
+
+# Equality checks are applied to these
+origin_type_checkers = {
+    bytes: check_byteslike,
+    AbstractSet: check_set,
+    BinaryIO: check_io,
+    Callable: check_callable,
+    collections.abc.Callable: check_callable,
+    complex: check_number,
+    dict: check_mapping,
+    Dict: check_mapping,
+    float: check_number,
+    frozenset: check_set,
+    IO: check_io,
+    list: check_list,
+    List: check_list,
+    typing.Literal: check_literal,
+    Mapping: check_mapping,
+    MutableMapping: check_mapping,
+    None: check_none,
+    collections.abc.Mapping: check_mapping,
+    collections.abc.MutableMapping: check_mapping,
+    Sequence: check_sequence,
+    collections.abc.Sequence: check_sequence,
+    collections.abc.Set: check_set,
+    set: check_set,
+    Set: check_set,
+    TextIO: check_io,
+    tuple: check_tuple,
+    Tuple: check_tuple,
+    type: check_class,
+    Type: check_class,
+    Union: check_union,
+}
+if sys.version_info >= (3, 10):
+    origin_type_checkers[types.UnionType] = check_uniontype
+    origin_type_checkers[typing.TypeGuard] = check_typeguard
+if sys.version_info >= (3, 11):
+    origin_type_checkers.update(
+        {typing.LiteralString: check_literal_string, typing.Self: check_self}
+    )
+if typing_extensions is not None:
+    # On some Python versions, these may simply be re-exports from typing,
+    # but exactly which Python versions is subject to change,
+    # so it's best to err on the safe side
+    # and update the dictionary on all Python versions
+    # if typing_extensions is installed
+    origin_type_checkers[typing_extensions.Literal] = check_literal
+    origin_type_checkers[typing_extensions.LiteralString] = check_literal_string
+    origin_type_checkers[typing_extensions.Self] = check_self
+    origin_type_checkers[typing_extensions.TypeGuard] = check_typeguard
+
+
+def builtin_checker_lookup(
+    origin_type: Any, args: tuple[Any, ...], extras: tuple[Any, ...]
+) -> TypeCheckerCallable | None:
+    checker = origin_type_checkers.get(origin_type)
+    if checker is not None:
+        return checker
+    elif is_typeddict(origin_type):
+        return check_typed_dict
+    elif isclass(origin_type) and issubclass(
+        origin_type,
+        Tuple,  # type: ignore[arg-type]
+    ):
+        # NamedTuple
+        return check_tuple
+    elif getattr(origin_type, "_is_protocol", False):
+        return check_protocol
+    elif isinstance(origin_type, ParamSpec):
+        return check_paramspec
+    elif isinstance(origin_type, TypeVar):
+        return check_typevar
+    elif origin_type.__class__ is NewType:
+        # typing.NewType on Python 3.10+
+        return check_newtype
+    elif (
+        isfunction(origin_type)
+        and getattr(origin_type, "__module__", None) == "typing"
+        and getattr(origin_type, "__qualname__", "").startswith("NewType.")
+        and hasattr(origin_type, "__supertype__")
+    ):
+        # typing.NewType on Python 3.9 and below
+        return check_newtype
+
+    return None
+
+
+checker_lookup_functions.append(builtin_checker_lookup)
+
+
+def load_plugins() -> None:
+    """
+    Load all type checker lookup functions from entry points.
+
+    All entry points from the ``typeguard.checker_lookup`` group are loaded, and the
+    returned lookup functions are added to :data:`typeguard.checker_lookup_functions`.
+
+    .. note:: This function is called implicitly on import, unless the
+        ``TYPEGUARD_DISABLE_PLUGIN_AUTOLOAD`` environment variable is present.
+    """
+
+    for ep in entry_points(group="typeguard.checker_lookup"):
+        try:
+            plugin = ep.load()
+        except Exception as exc:
+            warnings.warn(
+                f"Failed to load plugin {ep.name!r}: " f"{qualified_name(exc)}: {exc}",
+                stacklevel=2,
+            )
+            continue
+
+        if not callable(plugin):
+            warnings.warn(
+                f"Plugin {ep} returned a non-callable object: {plugin!r}", stacklevel=2
+            )
+            continue
+
+        checker_lookup_functions.insert(0, plugin)
diff --git a/setuptools/_vendor/typeguard/_config.py b/setuptools/_vendor/typeguard/_config.py
new file mode 100644
index 0000000000..36efad5396
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_config.py
@@ -0,0 +1,108 @@
+from __future__ import annotations
+
+from collections.abc import Iterable
+from dataclasses import dataclass
+from enum import Enum, auto
+from typing import TYPE_CHECKING, TypeVar
+
+if TYPE_CHECKING:
+    from ._functions import TypeCheckFailCallback
+
+T = TypeVar("T")
+
+
+class ForwardRefPolicy(Enum):
+    """
+    Defines how unresolved forward references are handled.
+
+    Members:
+
+    * ``ERROR``: propagate the :exc:`NameError` when the forward reference lookup fails
+    * ``WARN``: emit a :class:`~.TypeHintWarning` if the forward reference lookup fails
+    * ``IGNORE``: silently skip checks for unresolveable forward references
+    """
+
+    ERROR = auto()
+    WARN = auto()
+    IGNORE = auto()
+
+
+class CollectionCheckStrategy(Enum):
+    """
+    Specifies how thoroughly the contents of collections are type checked.
+
+    This has an effect on the following built-in checkers:
+
+    * ``AbstractSet``
+    * ``Dict``
+    * ``List``
+    * ``Mapping``
+    * ``Set``
+    * ``Tuple[, ...]`` (arbitrarily sized tuples)
+
+    Members:
+
+    * ``FIRST_ITEM``: check only the first item
+    * ``ALL_ITEMS``: check all items
+    """
+
+    FIRST_ITEM = auto()
+    ALL_ITEMS = auto()
+
+    def iterate_samples(self, collection: Iterable[T]) -> Iterable[T]:
+        if self is CollectionCheckStrategy.FIRST_ITEM:
+            try:
+                return [next(iter(collection))]
+            except StopIteration:
+                return ()
+        else:
+            return collection
+
+
+@dataclass
+class TypeCheckConfiguration:
+    """
+     You can change Typeguard's behavior with these settings.
+
+    .. attribute:: typecheck_fail_callback
+       :type: Callable[[TypeCheckError, TypeCheckMemo], Any]
+
+         Callable that is called when type checking fails.
+
+         Default: ``None`` (the :exc:`~.TypeCheckError` is raised directly)
+
+    .. attribute:: forward_ref_policy
+       :type: ForwardRefPolicy
+
+         Specifies what to do when a forward reference fails to resolve.
+
+         Default: ``WARN``
+
+    .. attribute:: collection_check_strategy
+       :type: CollectionCheckStrategy
+
+         Specifies how thoroughly the contents of collections (list, dict, etc.) are
+         type checked.
+
+         Default: ``FIRST_ITEM``
+
+    .. attribute:: debug_instrumentation
+       :type: bool
+
+         If set to ``True``, the code of modules or functions instrumented by typeguard
+         is printed to ``sys.stderr`` after the instrumentation is done
+
+         Requires Python 3.9 or newer.
+
+         Default: ``False``
+    """
+
+    forward_ref_policy: ForwardRefPolicy = ForwardRefPolicy.WARN
+    typecheck_fail_callback: TypeCheckFailCallback | None = None
+    collection_check_strategy: CollectionCheckStrategy = (
+        CollectionCheckStrategy.FIRST_ITEM
+    )
+    debug_instrumentation: bool = False
+
+
+global_config = TypeCheckConfiguration()
diff --git a/setuptools/_vendor/typeguard/_decorators.py b/setuptools/_vendor/typeguard/_decorators.py
new file mode 100644
index 0000000000..cf3253351f
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_decorators.py
@@ -0,0 +1,235 @@
+from __future__ import annotations
+
+import ast
+import inspect
+import sys
+from collections.abc import Sequence
+from functools import partial
+from inspect import isclass, isfunction
+from types import CodeType, FrameType, FunctionType
+from typing import TYPE_CHECKING, Any, Callable, ForwardRef, TypeVar, cast, overload
+from warnings import warn
+
+from ._config import CollectionCheckStrategy, ForwardRefPolicy, global_config
+from ._exceptions import InstrumentationWarning
+from ._functions import TypeCheckFailCallback
+from ._transformer import TypeguardTransformer
+from ._utils import Unset, function_name, get_stacklevel, is_method_of, unset
+
+if TYPE_CHECKING:
+    from typeshed.stdlib.types import _Cell
+
+    _F = TypeVar("_F")
+
+    def typeguard_ignore(f: _F) -> _F:
+        """This decorator is a noop during static type-checking."""
+        return f
+
+else:
+    from typing import no_type_check as typeguard_ignore  # noqa: F401
+
+T_CallableOrType = TypeVar("T_CallableOrType", bound=Callable[..., Any])
+
+
+def make_cell(value: object) -> _Cell:
+    return (lambda: value).__closure__[0]  # type: ignore[index]
+
+
+def find_target_function(
+    new_code: CodeType, target_path: Sequence[str], firstlineno: int
+) -> CodeType | None:
+    target_name = target_path[0]
+    for const in new_code.co_consts:
+        if isinstance(const, CodeType):
+            if const.co_name == target_name:
+                if const.co_firstlineno == firstlineno:
+                    return const
+                elif len(target_path) > 1:
+                    target_code = find_target_function(
+                        const, target_path[1:], firstlineno
+                    )
+                    if target_code:
+                        return target_code
+
+    return None
+
+
+def instrument(f: T_CallableOrType) -> FunctionType | str:
+    if not getattr(f, "__code__", None):
+        return "no code associated"
+    elif not getattr(f, "__module__", None):
+        return "__module__ attribute is not set"
+    elif f.__code__.co_filename == "":
+        return "cannot instrument functions defined in a REPL"
+    elif hasattr(f, "__wrapped__"):
+        return (
+            "@typechecked only supports instrumenting functions wrapped with "
+            "@classmethod, @staticmethod or @property"
+        )
+
+    target_path = [item for item in f.__qualname__.split(".") if item != ""]
+    module_source = inspect.getsource(sys.modules[f.__module__])
+    module_ast = ast.parse(module_source)
+    instrumentor = TypeguardTransformer(target_path, f.__code__.co_firstlineno)
+    instrumentor.visit(module_ast)
+
+    if not instrumentor.target_node or instrumentor.target_lineno is None:
+        return "instrumentor did not find the target function"
+
+    module_code = compile(module_ast, f.__code__.co_filename, "exec", dont_inherit=True)
+    new_code = find_target_function(
+        module_code, target_path, instrumentor.target_lineno
+    )
+    if not new_code:
+        return "cannot find the target function in the AST"
+
+    if global_config.debug_instrumentation and sys.version_info >= (3, 9):
+        # Find the matching AST node, then unparse it to source and print to stdout
+        print(
+            f"Source code of {f.__qualname__}() after instrumentation:"
+            "\n----------------------------------------------",
+            file=sys.stderr,
+        )
+        print(ast.unparse(instrumentor.target_node), file=sys.stderr)
+        print(
+            "----------------------------------------------",
+            file=sys.stderr,
+        )
+
+    closure = f.__closure__
+    if new_code.co_freevars != f.__code__.co_freevars:
+        # Create a new closure and find values for the new free variables
+        frame = cast(FrameType, inspect.currentframe())
+        frame = cast(FrameType, frame.f_back)
+        frame_locals = cast(FrameType, frame.f_back).f_locals
+        cells: list[_Cell] = []
+        for key in new_code.co_freevars:
+            if key in instrumentor.names_used_in_annotations:
+                # Find the value and make a new cell from it
+                value = frame_locals.get(key) or ForwardRef(key)
+                cells.append(make_cell(value))
+            else:
+                # Reuse the cell from the existing closure
+                assert f.__closure__
+                cells.append(f.__closure__[f.__code__.co_freevars.index(key)])
+
+        closure = tuple(cells)
+
+    new_function = FunctionType(new_code, f.__globals__, f.__name__, closure=closure)
+    new_function.__module__ = f.__module__
+    new_function.__name__ = f.__name__
+    new_function.__qualname__ = f.__qualname__
+    new_function.__annotations__ = f.__annotations__
+    new_function.__doc__ = f.__doc__
+    new_function.__defaults__ = f.__defaults__
+    new_function.__kwdefaults__ = f.__kwdefaults__
+    return new_function
+
+
+@overload
+def typechecked(
+    *,
+    forward_ref_policy: ForwardRefPolicy | Unset = unset,
+    typecheck_fail_callback: TypeCheckFailCallback | Unset = unset,
+    collection_check_strategy: CollectionCheckStrategy | Unset = unset,
+    debug_instrumentation: bool | Unset = unset,
+) -> Callable[[T_CallableOrType], T_CallableOrType]: ...
+
+
+@overload
+def typechecked(target: T_CallableOrType) -> T_CallableOrType: ...
+
+
+def typechecked(
+    target: T_CallableOrType | None = None,
+    *,
+    forward_ref_policy: ForwardRefPolicy | Unset = unset,
+    typecheck_fail_callback: TypeCheckFailCallback | Unset = unset,
+    collection_check_strategy: CollectionCheckStrategy | Unset = unset,
+    debug_instrumentation: bool | Unset = unset,
+) -> Any:
+    """
+    Instrument the target function to perform run-time type checking.
+
+    This decorator recompiles the target function, injecting code to type check
+    arguments, return values, yield values (excluding ``yield from``) and assignments to
+    annotated local variables.
+
+    This can also be used as a class decorator. This will instrument all type annotated
+    methods, including :func:`@classmethod `,
+    :func:`@staticmethod `,  and :class:`@property ` decorated
+    methods in the class.
+
+    .. note:: When Python is run in optimized mode (``-O`` or ``-OO``, this decorator
+        is a no-op). This is a feature meant for selectively introducing type checking
+        into a code base where the checks aren't meant to be run in production.
+
+    :param target: the function or class to enable type checking for
+    :param forward_ref_policy: override for
+        :attr:`.TypeCheckConfiguration.forward_ref_policy`
+    :param typecheck_fail_callback: override for
+        :attr:`.TypeCheckConfiguration.typecheck_fail_callback`
+    :param collection_check_strategy: override for
+        :attr:`.TypeCheckConfiguration.collection_check_strategy`
+    :param debug_instrumentation: override for
+        :attr:`.TypeCheckConfiguration.debug_instrumentation`
+
+    """
+    if target is None:
+        return partial(
+            typechecked,
+            forward_ref_policy=forward_ref_policy,
+            typecheck_fail_callback=typecheck_fail_callback,
+            collection_check_strategy=collection_check_strategy,
+            debug_instrumentation=debug_instrumentation,
+        )
+
+    if not __debug__:
+        return target
+
+    if isclass(target):
+        for key, attr in target.__dict__.items():
+            if is_method_of(attr, target):
+                retval = instrument(attr)
+                if isfunction(retval):
+                    setattr(target, key, retval)
+            elif isinstance(attr, (classmethod, staticmethod)):
+                if is_method_of(attr.__func__, target):
+                    retval = instrument(attr.__func__)
+                    if isfunction(retval):
+                        wrapper = attr.__class__(retval)
+                        setattr(target, key, wrapper)
+            elif isinstance(attr, property):
+                kwargs: dict[str, Any] = dict(doc=attr.__doc__)
+                for name in ("fset", "fget", "fdel"):
+                    property_func = kwargs[name] = getattr(attr, name)
+                    if is_method_of(property_func, target):
+                        retval = instrument(property_func)
+                        if isfunction(retval):
+                            kwargs[name] = retval
+
+                setattr(target, key, attr.__class__(**kwargs))
+
+        return target
+
+    # Find either the first Python wrapper or the actual function
+    wrapper_class: (
+        type[classmethod[Any, Any, Any]] | type[staticmethod[Any, Any]] | None
+    ) = None
+    if isinstance(target, (classmethod, staticmethod)):
+        wrapper_class = target.__class__
+        target = target.__func__
+
+    retval = instrument(target)
+    if isinstance(retval, str):
+        warn(
+            f"{retval} -- not typechecking {function_name(target)}",
+            InstrumentationWarning,
+            stacklevel=get_stacklevel(),
+        )
+        return target
+
+    if wrapper_class is None:
+        return retval
+    else:
+        return wrapper_class(retval)
diff --git a/setuptools/_vendor/typeguard/_exceptions.py b/setuptools/_vendor/typeguard/_exceptions.py
new file mode 100644
index 0000000000..625437a649
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_exceptions.py
@@ -0,0 +1,42 @@
+from collections import deque
+from typing import Deque
+
+
+class TypeHintWarning(UserWarning):
+    """
+    A warning that is emitted when a type hint in string form could not be resolved to
+    an actual type.
+    """
+
+
+class TypeCheckWarning(UserWarning):
+    """Emitted by typeguard's type checkers when a type mismatch is detected."""
+
+    def __init__(self, message: str):
+        super().__init__(message)
+
+
+class InstrumentationWarning(UserWarning):
+    """Emitted when there's a problem with instrumenting a function for type checks."""
+
+    def __init__(self, message: str):
+        super().__init__(message)
+
+
+class TypeCheckError(Exception):
+    """
+    Raised by typeguard's type checkers when a type mismatch is detected.
+    """
+
+    def __init__(self, message: str):
+        super().__init__(message)
+        self._path: Deque[str] = deque()
+
+    def append_path_element(self, element: str) -> None:
+        self._path.append(element)
+
+    def __str__(self) -> str:
+        if self._path:
+            return " of ".join(self._path) + " " + str(self.args[0])
+        else:
+            return str(self.args[0])
diff --git a/setuptools/_vendor/typeguard/_functions.py b/setuptools/_vendor/typeguard/_functions.py
new file mode 100644
index 0000000000..28497856a3
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_functions.py
@@ -0,0 +1,308 @@
+from __future__ import annotations
+
+import sys
+import warnings
+from typing import Any, Callable, NoReturn, TypeVar, Union, overload
+
+from . import _suppression
+from ._checkers import BINARY_MAGIC_METHODS, check_type_internal
+from ._config import (
+    CollectionCheckStrategy,
+    ForwardRefPolicy,
+    TypeCheckConfiguration,
+)
+from ._exceptions import TypeCheckError, TypeCheckWarning
+from ._memo import TypeCheckMemo
+from ._utils import get_stacklevel, qualified_name
+
+if sys.version_info >= (3, 11):
+    from typing import Literal, Never, TypeAlias
+else:
+    from typing_extensions import Literal, Never, TypeAlias
+
+T = TypeVar("T")
+TypeCheckFailCallback: TypeAlias = Callable[[TypeCheckError, TypeCheckMemo], Any]
+
+
+@overload
+def check_type(
+    value: object,
+    expected_type: type[T],
+    *,
+    forward_ref_policy: ForwardRefPolicy = ...,
+    typecheck_fail_callback: TypeCheckFailCallback | None = ...,
+    collection_check_strategy: CollectionCheckStrategy = ...,
+) -> T: ...
+
+
+@overload
+def check_type(
+    value: object,
+    expected_type: Any,
+    *,
+    forward_ref_policy: ForwardRefPolicy = ...,
+    typecheck_fail_callback: TypeCheckFailCallback | None = ...,
+    collection_check_strategy: CollectionCheckStrategy = ...,
+) -> Any: ...
+
+
+def check_type(
+    value: object,
+    expected_type: Any,
+    *,
+    forward_ref_policy: ForwardRefPolicy = TypeCheckConfiguration().forward_ref_policy,
+    typecheck_fail_callback: TypeCheckFailCallback | None = (
+        TypeCheckConfiguration().typecheck_fail_callback
+    ),
+    collection_check_strategy: CollectionCheckStrategy = (
+        TypeCheckConfiguration().collection_check_strategy
+    ),
+) -> Any:
+    """
+    Ensure that ``value`` matches ``expected_type``.
+
+    The types from the :mod:`typing` module do not support :func:`isinstance` or
+    :func:`issubclass` so a number of type specific checks are required. This function
+    knows which checker to call for which type.
+
+    This function wraps :func:`~.check_type_internal` in the following ways:
+
+    * Respects type checking suppression (:func:`~.suppress_type_checks`)
+    * Forms a :class:`~.TypeCheckMemo` from the current stack frame
+    * Calls the configured type check fail callback if the check fails
+
+    Note that this function is independent of the globally shared configuration in
+    :data:`typeguard.config`. This means that usage within libraries is safe from being
+    affected configuration changes made by other libraries or by the integrating
+    application. Instead, configuration options have the same default values as their
+    corresponding fields in :class:`TypeCheckConfiguration`.
+
+    :param value: value to be checked against ``expected_type``
+    :param expected_type: a class or generic type instance, or a tuple of such things
+    :param forward_ref_policy: see :attr:`TypeCheckConfiguration.forward_ref_policy`
+    :param typecheck_fail_callback:
+        see :attr`TypeCheckConfiguration.typecheck_fail_callback`
+    :param collection_check_strategy:
+        see :attr:`TypeCheckConfiguration.collection_check_strategy`
+    :return: ``value``, unmodified
+    :raises TypeCheckError: if there is a type mismatch
+
+    """
+    if type(expected_type) is tuple:
+        expected_type = Union[expected_type]
+
+    config = TypeCheckConfiguration(
+        forward_ref_policy=forward_ref_policy,
+        typecheck_fail_callback=typecheck_fail_callback,
+        collection_check_strategy=collection_check_strategy,
+    )
+
+    if _suppression.type_checks_suppressed or expected_type is Any:
+        return value
+
+    frame = sys._getframe(1)
+    memo = TypeCheckMemo(frame.f_globals, frame.f_locals, config=config)
+    try:
+        check_type_internal(value, expected_type, memo)
+    except TypeCheckError as exc:
+        exc.append_path_element(qualified_name(value, add_class_prefix=True))
+        if config.typecheck_fail_callback:
+            config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return value
+
+
+def check_argument_types(
+    func_name: str,
+    arguments: dict[str, tuple[Any, Any]],
+    memo: TypeCheckMemo,
+) -> Literal[True]:
+    if _suppression.type_checks_suppressed:
+        return True
+
+    for argname, (value, annotation) in arguments.items():
+        if annotation is NoReturn or annotation is Never:
+            exc = TypeCheckError(
+                f"{func_name}() was declared never to be called but it was"
+            )
+            if memo.config.typecheck_fail_callback:
+                memo.config.typecheck_fail_callback(exc, memo)
+            else:
+                raise exc
+
+        try:
+            check_type_internal(value, annotation, memo)
+        except TypeCheckError as exc:
+            qualname = qualified_name(value, add_class_prefix=True)
+            exc.append_path_element(f'argument "{argname}" ({qualname})')
+            if memo.config.typecheck_fail_callback:
+                memo.config.typecheck_fail_callback(exc, memo)
+            else:
+                raise
+
+    return True
+
+
+def check_return_type(
+    func_name: str,
+    retval: T,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> T:
+    if _suppression.type_checks_suppressed:
+        return retval
+
+    if annotation is NoReturn or annotation is Never:
+        exc = TypeCheckError(f"{func_name}() was declared never to return but it did")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise exc
+
+    try:
+        check_type_internal(retval, annotation, memo)
+    except TypeCheckError as exc:
+        # Allow NotImplemented if this is a binary magic method (__eq__() et al)
+        if retval is NotImplemented and annotation is bool:
+            # This does (and cannot) not check if it's actually a method
+            func_name = func_name.rsplit(".", 1)[-1]
+            if func_name in BINARY_MAGIC_METHODS:
+                return retval
+
+        qualname = qualified_name(retval, add_class_prefix=True)
+        exc.append_path_element(f"the return value ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return retval
+
+
+def check_send_type(
+    func_name: str,
+    sendval: T,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> T:
+    if _suppression.type_checks_suppressed:
+        return sendval
+
+    if annotation is NoReturn or annotation is Never:
+        exc = TypeCheckError(
+            f"{func_name}() was declared never to be sent a value to but it was"
+        )
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise exc
+
+    try:
+        check_type_internal(sendval, annotation, memo)
+    except TypeCheckError as exc:
+        qualname = qualified_name(sendval, add_class_prefix=True)
+        exc.append_path_element(f"the value sent to generator ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return sendval
+
+
+def check_yield_type(
+    func_name: str,
+    yieldval: T,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> T:
+    if _suppression.type_checks_suppressed:
+        return yieldval
+
+    if annotation is NoReturn or annotation is Never:
+        exc = TypeCheckError(f"{func_name}() was declared never to yield but it did")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise exc
+
+    try:
+        check_type_internal(yieldval, annotation, memo)
+    except TypeCheckError as exc:
+        qualname = qualified_name(yieldval, add_class_prefix=True)
+        exc.append_path_element(f"the yielded value ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return yieldval
+
+
+def check_variable_assignment(
+    value: object, varname: str, annotation: Any, memo: TypeCheckMemo
+) -> Any:
+    if _suppression.type_checks_suppressed:
+        return value
+
+    try:
+        check_type_internal(value, annotation, memo)
+    except TypeCheckError as exc:
+        qualname = qualified_name(value, add_class_prefix=True)
+        exc.append_path_element(f"value assigned to {varname} ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return value
+
+
+def check_multi_variable_assignment(
+    value: Any, targets: list[dict[str, Any]], memo: TypeCheckMemo
+) -> Any:
+    if max(len(target) for target in targets) == 1:
+        iterated_values = [value]
+    else:
+        iterated_values = list(value)
+
+    if not _suppression.type_checks_suppressed:
+        for expected_types in targets:
+            value_index = 0
+            for ann_index, (varname, expected_type) in enumerate(
+                expected_types.items()
+            ):
+                if varname.startswith("*"):
+                    varname = varname[1:]
+                    keys_left = len(expected_types) - 1 - ann_index
+                    next_value_index = len(iterated_values) - keys_left
+                    obj: object = iterated_values[value_index:next_value_index]
+                    value_index = next_value_index
+                else:
+                    obj = iterated_values[value_index]
+                    value_index += 1
+
+                try:
+                    check_type_internal(obj, expected_type, memo)
+                except TypeCheckError as exc:
+                    qualname = qualified_name(obj, add_class_prefix=True)
+                    exc.append_path_element(f"value assigned to {varname} ({qualname})")
+                    if memo.config.typecheck_fail_callback:
+                        memo.config.typecheck_fail_callback(exc, memo)
+                    else:
+                        raise
+
+    return iterated_values[0] if len(iterated_values) == 1 else iterated_values
+
+
+def warn_on_error(exc: TypeCheckError, memo: TypeCheckMemo) -> None:
+    """
+    Emit a warning on a type mismatch.
+
+    This is intended to be used as an error handler in
+    :attr:`TypeCheckConfiguration.typecheck_fail_callback`.
+
+    """
+    warnings.warn(TypeCheckWarning(str(exc)), stacklevel=get_stacklevel())
diff --git a/setuptools/_vendor/typeguard/_importhook.py b/setuptools/_vendor/typeguard/_importhook.py
new file mode 100644
index 0000000000..8590540a5a
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_importhook.py
@@ -0,0 +1,213 @@
+from __future__ import annotations
+
+import ast
+import sys
+import types
+from collections.abc import Callable, Iterable
+from importlib.abc import MetaPathFinder
+from importlib.machinery import ModuleSpec, SourceFileLoader
+from importlib.util import cache_from_source, decode_source
+from inspect import isclass
+from os import PathLike
+from types import CodeType, ModuleType, TracebackType
+from typing import Sequence, TypeVar
+from unittest.mock import patch
+
+from ._config import global_config
+from ._transformer import TypeguardTransformer
+
+if sys.version_info >= (3, 12):
+    from collections.abc import Buffer
+else:
+    from typing_extensions import Buffer
+
+if sys.version_info >= (3, 11):
+    from typing import ParamSpec
+else:
+    from typing_extensions import ParamSpec
+
+if sys.version_info >= (3, 10):
+    from importlib.metadata import PackageNotFoundError, version
+else:
+    from importlib_metadata import PackageNotFoundError, version
+
+try:
+    OPTIMIZATION = "typeguard" + "".join(version("typeguard").split(".")[:3])
+except PackageNotFoundError:
+    OPTIMIZATION = "typeguard"
+
+P = ParamSpec("P")
+T = TypeVar("T")
+
+
+# The name of this function is magical
+def _call_with_frames_removed(
+    f: Callable[P, T], *args: P.args, **kwargs: P.kwargs
+) -> T:
+    return f(*args, **kwargs)
+
+
+def optimized_cache_from_source(path: str, debug_override: bool | None = None) -> str:
+    return cache_from_source(path, debug_override, optimization=OPTIMIZATION)
+
+
+class TypeguardLoader(SourceFileLoader):
+    @staticmethod
+    def source_to_code(
+        data: Buffer | str | ast.Module | ast.Expression | ast.Interactive,
+        path: Buffer | str | PathLike[str] = "",
+    ) -> CodeType:
+        if isinstance(data, (ast.Module, ast.Expression, ast.Interactive)):
+            tree = data
+        else:
+            if isinstance(data, str):
+                source = data
+            else:
+                source = decode_source(data)
+
+            tree = _call_with_frames_removed(
+                ast.parse,
+                source,
+                path,
+                "exec",
+            )
+
+        tree = TypeguardTransformer().visit(tree)
+        ast.fix_missing_locations(tree)
+
+        if global_config.debug_instrumentation and sys.version_info >= (3, 9):
+            print(
+                f"Source code of {path!r} after instrumentation:\n"
+                "----------------------------------------------",
+                file=sys.stderr,
+            )
+            print(ast.unparse(tree), file=sys.stderr)
+            print("----------------------------------------------", file=sys.stderr)
+
+        return _call_with_frames_removed(
+            compile, tree, path, "exec", 0, dont_inherit=True
+        )
+
+    def exec_module(self, module: ModuleType) -> None:
+        # Use a custom optimization marker – the import lock should make this monkey
+        # patch safe
+        with patch(
+            "importlib._bootstrap_external.cache_from_source",
+            optimized_cache_from_source,
+        ):
+            super().exec_module(module)
+
+
+class TypeguardFinder(MetaPathFinder):
+    """
+    Wraps another path finder and instruments the module with
+    :func:`@typechecked ` if :meth:`should_instrument` returns
+    ``True``.
+
+    Should not be used directly, but rather via :func:`~.install_import_hook`.
+
+    .. versionadded:: 2.6
+    """
+
+    def __init__(self, packages: list[str] | None, original_pathfinder: MetaPathFinder):
+        self.packages = packages
+        self._original_pathfinder = original_pathfinder
+
+    def find_spec(
+        self,
+        fullname: str,
+        path: Sequence[str] | None,
+        target: types.ModuleType | None = None,
+    ) -> ModuleSpec | None:
+        if self.should_instrument(fullname):
+            spec = self._original_pathfinder.find_spec(fullname, path, target)
+            if spec is not None and isinstance(spec.loader, SourceFileLoader):
+                spec.loader = TypeguardLoader(spec.loader.name, spec.loader.path)
+                return spec
+
+        return None
+
+    def should_instrument(self, module_name: str) -> bool:
+        """
+        Determine whether the module with the given name should be instrumented.
+
+        :param module_name: full name of the module that is about to be imported (e.g.
+            ``xyz.abc``)
+
+        """
+        if self.packages is None:
+            return True
+
+        for package in self.packages:
+            if module_name == package or module_name.startswith(package + "."):
+                return True
+
+        return False
+
+
+class ImportHookManager:
+    """
+    A handle that can be used to uninstall the Typeguard import hook.
+    """
+
+    def __init__(self, hook: MetaPathFinder):
+        self.hook = hook
+
+    def __enter__(self) -> None:
+        pass
+
+    def __exit__(
+        self,
+        exc_type: type[BaseException],
+        exc_val: BaseException,
+        exc_tb: TracebackType,
+    ) -> None:
+        self.uninstall()
+
+    def uninstall(self) -> None:
+        """Uninstall the import hook."""
+        try:
+            sys.meta_path.remove(self.hook)
+        except ValueError:
+            pass  # already removed
+
+
+def install_import_hook(
+    packages: Iterable[str] | None = None,
+    *,
+    cls: type[TypeguardFinder] = TypeguardFinder,
+) -> ImportHookManager:
+    """
+    Install an import hook that instruments functions for automatic type checking.
+
+    This only affects modules loaded **after** this hook has been installed.
+
+    :param packages: an iterable of package names to instrument, or ``None`` to
+        instrument all packages
+    :param cls: a custom meta path finder class
+    :return: a context manager that uninstalls the hook on exit (or when you call
+        ``.uninstall()``)
+
+    .. versionadded:: 2.6
+
+    """
+    if packages is None:
+        target_packages: list[str] | None = None
+    elif isinstance(packages, str):
+        target_packages = [packages]
+    else:
+        target_packages = list(packages)
+
+    for finder in sys.meta_path:
+        if (
+            isclass(finder)
+            and finder.__name__ == "PathFinder"
+            and hasattr(finder, "find_spec")
+        ):
+            break
+    else:
+        raise RuntimeError("Cannot find a PathFinder in sys.meta_path")
+
+    hook = cls(target_packages, finder)
+    sys.meta_path.insert(0, hook)
+    return ImportHookManager(hook)
diff --git a/setuptools/_vendor/typeguard/_memo.py b/setuptools/_vendor/typeguard/_memo.py
new file mode 100644
index 0000000000..1d0d80c66d
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_memo.py
@@ -0,0 +1,48 @@
+from __future__ import annotations
+
+from typing import Any
+
+from typeguard._config import TypeCheckConfiguration, global_config
+
+
+class TypeCheckMemo:
+    """
+    Contains information necessary for type checkers to do their work.
+
+    .. attribute:: globals
+       :type: dict[str, Any]
+
+        Dictionary of global variables to use for resolving forward references.
+
+    .. attribute:: locals
+       :type: dict[str, Any]
+
+        Dictionary of local variables to use for resolving forward references.
+
+    .. attribute:: self_type
+       :type: type | None
+
+        When running type checks within an instance method or class method, this is the
+        class object that the first argument (usually named ``self`` or ``cls``) refers
+        to.
+
+    .. attribute:: config
+       :type: TypeCheckConfiguration
+
+         Contains the configuration for a particular set of type checking operations.
+    """
+
+    __slots__ = "globals", "locals", "self_type", "config"
+
+    def __init__(
+        self,
+        globals: dict[str, Any],
+        locals: dict[str, Any],
+        *,
+        self_type: type | None = None,
+        config: TypeCheckConfiguration = global_config,
+    ):
+        self.globals = globals
+        self.locals = locals
+        self.self_type = self_type
+        self.config = config
diff --git a/setuptools/_vendor/typeguard/_pytest_plugin.py b/setuptools/_vendor/typeguard/_pytest_plugin.py
new file mode 100644
index 0000000000..7b2f494ec7
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_pytest_plugin.py
@@ -0,0 +1,127 @@
+from __future__ import annotations
+
+import sys
+import warnings
+from typing import TYPE_CHECKING, Any, Literal
+
+from typeguard._config import CollectionCheckStrategy, ForwardRefPolicy, global_config
+from typeguard._exceptions import InstrumentationWarning
+from typeguard._importhook import install_import_hook
+from typeguard._utils import qualified_name, resolve_reference
+
+if TYPE_CHECKING:
+    from pytest import Config, Parser
+
+
+def pytest_addoption(parser: Parser) -> None:
+    def add_ini_option(
+        opt_type: (
+            Literal["string", "paths", "pathlist", "args", "linelist", "bool"] | None
+        ),
+    ) -> None:
+        parser.addini(
+            group.options[-1].names()[0][2:],
+            group.options[-1].attrs()["help"],
+            opt_type,
+        )
+
+    group = parser.getgroup("typeguard")
+    group.addoption(
+        "--typeguard-packages",
+        action="store",
+        help="comma separated name list of packages and modules to instrument for "
+        "type checking, or :all: to instrument all modules loaded after typeguard",
+    )
+    add_ini_option("linelist")
+
+    group.addoption(
+        "--typeguard-debug-instrumentation",
+        action="store_true",
+        help="print all instrumented code to stderr",
+    )
+    add_ini_option("bool")
+
+    group.addoption(
+        "--typeguard-typecheck-fail-callback",
+        action="store",
+        help=(
+            "a module:varname (e.g. typeguard:warn_on_error) reference to a function "
+            "that is called (with the exception, and memo object as arguments) to "
+            "handle a TypeCheckError"
+        ),
+    )
+    add_ini_option("string")
+
+    group.addoption(
+        "--typeguard-forward-ref-policy",
+        action="store",
+        choices=list(ForwardRefPolicy.__members__),
+        help=(
+            "determines how to deal with unresolveable forward references in type "
+            "annotations"
+        ),
+    )
+    add_ini_option("string")
+
+    group.addoption(
+        "--typeguard-collection-check-strategy",
+        action="store",
+        choices=list(CollectionCheckStrategy.__members__),
+        help="determines how thoroughly to check collections (list, dict, etc)",
+    )
+    add_ini_option("string")
+
+
+def pytest_configure(config: Config) -> None:
+    def getoption(name: str) -> Any:
+        return config.getoption(name.replace("-", "_")) or config.getini(name)
+
+    packages: list[str] | None = []
+    if packages_option := config.getoption("typeguard_packages"):
+        packages = [pkg.strip() for pkg in packages_option.split(",")]
+    elif packages_ini := config.getini("typeguard-packages"):
+        packages = packages_ini
+
+    if packages:
+        if packages == [":all:"]:
+            packages = None
+        else:
+            already_imported_packages = sorted(
+                package for package in packages if package in sys.modules
+            )
+            if already_imported_packages:
+                warnings.warn(
+                    f"typeguard cannot check these packages because they are already "
+                    f"imported: {', '.join(already_imported_packages)}",
+                    InstrumentationWarning,
+                    stacklevel=1,
+                )
+
+        install_import_hook(packages=packages)
+
+    debug_option = getoption("typeguard-debug-instrumentation")
+    if debug_option:
+        global_config.debug_instrumentation = True
+
+    fail_callback_option = getoption("typeguard-typecheck-fail-callback")
+    if fail_callback_option:
+        callback = resolve_reference(fail_callback_option)
+        if not callable(callback):
+            raise TypeError(
+                f"{fail_callback_option} ({qualified_name(callback.__class__)}) is not "
+                f"a callable"
+            )
+
+        global_config.typecheck_fail_callback = callback
+
+    forward_ref_policy_option = getoption("typeguard-forward-ref-policy")
+    if forward_ref_policy_option:
+        forward_ref_policy = ForwardRefPolicy.__members__[forward_ref_policy_option]
+        global_config.forward_ref_policy = forward_ref_policy
+
+    collection_check_strategy_option = getoption("typeguard-collection-check-strategy")
+    if collection_check_strategy_option:
+        collection_check_strategy = CollectionCheckStrategy.__members__[
+            collection_check_strategy_option
+        ]
+        global_config.collection_check_strategy = collection_check_strategy
diff --git a/setuptools/_vendor/typeguard/_suppression.py b/setuptools/_vendor/typeguard/_suppression.py
new file mode 100644
index 0000000000..bbbfbfbe8e
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_suppression.py
@@ -0,0 +1,86 @@
+from __future__ import annotations
+
+import sys
+from collections.abc import Callable, Generator
+from contextlib import contextmanager
+from functools import update_wrapper
+from threading import Lock
+from typing import ContextManager, TypeVar, overload
+
+if sys.version_info >= (3, 10):
+    from typing import ParamSpec
+else:
+    from typing_extensions import ParamSpec
+
+P = ParamSpec("P")
+T = TypeVar("T")
+
+type_checks_suppressed = 0
+type_checks_suppress_lock = Lock()
+
+
+@overload
+def suppress_type_checks(func: Callable[P, T]) -> Callable[P, T]: ...
+
+
+@overload
+def suppress_type_checks() -> ContextManager[None]: ...
+
+
+def suppress_type_checks(
+    func: Callable[P, T] | None = None,
+) -> Callable[P, T] | ContextManager[None]:
+    """
+    Temporarily suppress all type checking.
+
+    This function has two operating modes, based on how it's used:
+
+    #. as a context manager (``with suppress_type_checks(): ...``)
+    #. as a decorator (``@suppress_type_checks``)
+
+    When used as a context manager, :func:`check_type` and any automatically
+    instrumented functions skip the actual type checking. These context managers can be
+    nested.
+
+    When used as a decorator, all type checking is suppressed while the function is
+    running.
+
+    Type checking will resume once no more context managers are active and no decorated
+    functions are running.
+
+    Both operating modes are thread-safe.
+
+    """
+
+    def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
+        global type_checks_suppressed
+
+        with type_checks_suppress_lock:
+            type_checks_suppressed += 1
+
+        assert func is not None
+        try:
+            return func(*args, **kwargs)
+        finally:
+            with type_checks_suppress_lock:
+                type_checks_suppressed -= 1
+
+    def cm() -> Generator[None, None, None]:
+        global type_checks_suppressed
+
+        with type_checks_suppress_lock:
+            type_checks_suppressed += 1
+
+        try:
+            yield
+        finally:
+            with type_checks_suppress_lock:
+                type_checks_suppressed -= 1
+
+    if func is None:
+        # Context manager mode
+        return contextmanager(cm)()
+    else:
+        # Decorator mode
+        update_wrapper(wrapper, func)
+        return wrapper
diff --git a/setuptools/_vendor/typeguard/_transformer.py b/setuptools/_vendor/typeguard/_transformer.py
new file mode 100644
index 0000000000..13ac3630e6
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_transformer.py
@@ -0,0 +1,1229 @@
+from __future__ import annotations
+
+import ast
+import builtins
+import sys
+import typing
+from ast import (
+    AST,
+    Add,
+    AnnAssign,
+    Assign,
+    AsyncFunctionDef,
+    Attribute,
+    AugAssign,
+    BinOp,
+    BitAnd,
+    BitOr,
+    BitXor,
+    Call,
+    ClassDef,
+    Constant,
+    Dict,
+    Div,
+    Expr,
+    Expression,
+    FloorDiv,
+    FunctionDef,
+    If,
+    Import,
+    ImportFrom,
+    Index,
+    List,
+    Load,
+    LShift,
+    MatMult,
+    Mod,
+    Module,
+    Mult,
+    Name,
+    NamedExpr,
+    NodeTransformer,
+    NodeVisitor,
+    Pass,
+    Pow,
+    Return,
+    RShift,
+    Starred,
+    Store,
+    Sub,
+    Subscript,
+    Tuple,
+    Yield,
+    YieldFrom,
+    alias,
+    copy_location,
+    expr,
+    fix_missing_locations,
+    keyword,
+    walk,
+)
+from collections import defaultdict
+from collections.abc import Generator, Sequence
+from contextlib import contextmanager
+from copy import deepcopy
+from dataclasses import dataclass, field
+from typing import Any, ClassVar, cast, overload
+
+generator_names = (
+    "typing.Generator",
+    "collections.abc.Generator",
+    "typing.Iterator",
+    "collections.abc.Iterator",
+    "typing.Iterable",
+    "collections.abc.Iterable",
+    "typing.AsyncIterator",
+    "collections.abc.AsyncIterator",
+    "typing.AsyncIterable",
+    "collections.abc.AsyncIterable",
+    "typing.AsyncGenerator",
+    "collections.abc.AsyncGenerator",
+)
+anytype_names = (
+    "typing.Any",
+    "typing_extensions.Any",
+)
+literal_names = (
+    "typing.Literal",
+    "typing_extensions.Literal",
+)
+annotated_names = (
+    "typing.Annotated",
+    "typing_extensions.Annotated",
+)
+ignore_decorators = (
+    "typing.no_type_check",
+    "typeguard.typeguard_ignore",
+)
+aug_assign_functions = {
+    Add: "iadd",
+    Sub: "isub",
+    Mult: "imul",
+    MatMult: "imatmul",
+    Div: "itruediv",
+    FloorDiv: "ifloordiv",
+    Mod: "imod",
+    Pow: "ipow",
+    LShift: "ilshift",
+    RShift: "irshift",
+    BitAnd: "iand",
+    BitXor: "ixor",
+    BitOr: "ior",
+}
+
+
+@dataclass
+class TransformMemo:
+    node: Module | ClassDef | FunctionDef | AsyncFunctionDef | None
+    parent: TransformMemo | None
+    path: tuple[str, ...]
+    joined_path: Constant = field(init=False)
+    return_annotation: expr | None = None
+    yield_annotation: expr | None = None
+    send_annotation: expr | None = None
+    is_async: bool = False
+    local_names: set[str] = field(init=False, default_factory=set)
+    imported_names: dict[str, str] = field(init=False, default_factory=dict)
+    ignored_names: set[str] = field(init=False, default_factory=set)
+    load_names: defaultdict[str, dict[str, Name]] = field(
+        init=False, default_factory=lambda: defaultdict(dict)
+    )
+    has_yield_expressions: bool = field(init=False, default=False)
+    has_return_expressions: bool = field(init=False, default=False)
+    memo_var_name: Name | None = field(init=False, default=None)
+    should_instrument: bool = field(init=False, default=True)
+    variable_annotations: dict[str, expr] = field(init=False, default_factory=dict)
+    configuration_overrides: dict[str, Any] = field(init=False, default_factory=dict)
+    code_inject_index: int = field(init=False, default=0)
+
+    def __post_init__(self) -> None:
+        elements: list[str] = []
+        memo = self
+        while isinstance(memo.node, (ClassDef, FunctionDef, AsyncFunctionDef)):
+            elements.insert(0, memo.node.name)
+            if not memo.parent:
+                break
+
+            memo = memo.parent
+            if isinstance(memo.node, (FunctionDef, AsyncFunctionDef)):
+                elements.insert(0, "")
+
+        self.joined_path = Constant(".".join(elements))
+
+        # Figure out where to insert instrumentation code
+        if self.node:
+            for index, child in enumerate(self.node.body):
+                if isinstance(child, ImportFrom) and child.module == "__future__":
+                    # (module only) __future__ imports must come first
+                    continue
+                elif (
+                    isinstance(child, Expr)
+                    and isinstance(child.value, Constant)
+                    and isinstance(child.value.value, str)
+                ):
+                    continue  # docstring
+
+                self.code_inject_index = index
+                break
+
+    def get_unused_name(self, name: str) -> str:
+        memo: TransformMemo | None = self
+        while memo is not None:
+            if name in memo.local_names:
+                memo = self
+                name += "_"
+            else:
+                memo = memo.parent
+
+        self.local_names.add(name)
+        return name
+
+    def is_ignored_name(self, expression: expr | Expr | None) -> bool:
+        top_expression = (
+            expression.value if isinstance(expression, Expr) else expression
+        )
+
+        if isinstance(top_expression, Attribute) and isinstance(
+            top_expression.value, Name
+        ):
+            name = top_expression.value.id
+        elif isinstance(top_expression, Name):
+            name = top_expression.id
+        else:
+            return False
+
+        memo: TransformMemo | None = self
+        while memo is not None:
+            if name in memo.ignored_names:
+                return True
+
+            memo = memo.parent
+
+        return False
+
+    def get_memo_name(self) -> Name:
+        if not self.memo_var_name:
+            self.memo_var_name = Name(id="memo", ctx=Load())
+
+        return self.memo_var_name
+
+    def get_import(self, module: str, name: str) -> Name:
+        if module in self.load_names and name in self.load_names[module]:
+            return self.load_names[module][name]
+
+        qualified_name = f"{module}.{name}"
+        if name in self.imported_names and self.imported_names[name] == qualified_name:
+            return Name(id=name, ctx=Load())
+
+        alias = self.get_unused_name(name)
+        node = self.load_names[module][name] = Name(id=alias, ctx=Load())
+        self.imported_names[name] = qualified_name
+        return node
+
+    def insert_imports(self, node: Module | FunctionDef | AsyncFunctionDef) -> None:
+        """Insert imports needed by injected code."""
+        if not self.load_names:
+            return
+
+        # Insert imports after any "from __future__ ..." imports and any docstring
+        for modulename, names in self.load_names.items():
+            aliases = [
+                alias(orig_name, new_name.id if orig_name != new_name.id else None)
+                for orig_name, new_name in sorted(names.items())
+            ]
+            node.body.insert(self.code_inject_index, ImportFrom(modulename, aliases, 0))
+
+    def name_matches(self, expression: expr | Expr | None, *names: str) -> bool:
+        if expression is None:
+            return False
+
+        path: list[str] = []
+        top_expression = (
+            expression.value if isinstance(expression, Expr) else expression
+        )
+
+        if isinstance(top_expression, Subscript):
+            top_expression = top_expression.value
+        elif isinstance(top_expression, Call):
+            top_expression = top_expression.func
+
+        while isinstance(top_expression, Attribute):
+            path.insert(0, top_expression.attr)
+            top_expression = top_expression.value
+
+        if not isinstance(top_expression, Name):
+            return False
+
+        if top_expression.id in self.imported_names:
+            translated = self.imported_names[top_expression.id]
+        elif hasattr(builtins, top_expression.id):
+            translated = "builtins." + top_expression.id
+        else:
+            translated = top_expression.id
+
+        path.insert(0, translated)
+        joined_path = ".".join(path)
+        if joined_path in names:
+            return True
+        elif self.parent:
+            return self.parent.name_matches(expression, *names)
+        else:
+            return False
+
+    def get_config_keywords(self) -> list[keyword]:
+        if self.parent and isinstance(self.parent.node, ClassDef):
+            overrides = self.parent.configuration_overrides.copy()
+        else:
+            overrides = {}
+
+        overrides.update(self.configuration_overrides)
+        return [keyword(key, value) for key, value in overrides.items()]
+
+
+class NameCollector(NodeVisitor):
+    def __init__(self) -> None:
+        self.names: set[str] = set()
+
+    def visit_Import(self, node: Import) -> None:
+        for name in node.names:
+            self.names.add(name.asname or name.name)
+
+    def visit_ImportFrom(self, node: ImportFrom) -> None:
+        for name in node.names:
+            self.names.add(name.asname or name.name)
+
+    def visit_Assign(self, node: Assign) -> None:
+        for target in node.targets:
+            if isinstance(target, Name):
+                self.names.add(target.id)
+
+    def visit_NamedExpr(self, node: NamedExpr) -> Any:
+        if isinstance(node.target, Name):
+            self.names.add(node.target.id)
+
+    def visit_FunctionDef(self, node: FunctionDef) -> None:
+        pass
+
+    def visit_ClassDef(self, node: ClassDef) -> None:
+        pass
+
+
+class GeneratorDetector(NodeVisitor):
+    """Detects if a function node is a generator function."""
+
+    contains_yields: bool = False
+    in_root_function: bool = False
+
+    def visit_Yield(self, node: Yield) -> Any:
+        self.contains_yields = True
+
+    def visit_YieldFrom(self, node: YieldFrom) -> Any:
+        self.contains_yields = True
+
+    def visit_ClassDef(self, node: ClassDef) -> Any:
+        pass
+
+    def visit_FunctionDef(self, node: FunctionDef | AsyncFunctionDef) -> Any:
+        if not self.in_root_function:
+            self.in_root_function = True
+            self.generic_visit(node)
+            self.in_root_function = False
+
+    def visit_AsyncFunctionDef(self, node: AsyncFunctionDef) -> Any:
+        self.visit_FunctionDef(node)
+
+
+class AnnotationTransformer(NodeTransformer):
+    type_substitutions: ClassVar[dict[str, tuple[str, str]]] = {
+        "builtins.dict": ("typing", "Dict"),
+        "builtins.list": ("typing", "List"),
+        "builtins.tuple": ("typing", "Tuple"),
+        "builtins.set": ("typing", "Set"),
+        "builtins.frozenset": ("typing", "FrozenSet"),
+    }
+
+    def __init__(self, transformer: TypeguardTransformer):
+        self.transformer = transformer
+        self._memo = transformer._memo
+        self._level = 0
+
+    def visit(self, node: AST) -> Any:
+        # Don't process Literals
+        if isinstance(node, expr) and self._memo.name_matches(node, *literal_names):
+            return node
+
+        self._level += 1
+        new_node = super().visit(node)
+        self._level -= 1
+
+        if isinstance(new_node, Expression) and not hasattr(new_node, "body"):
+            return None
+
+        # Return None if this new node matches a variation of typing.Any
+        if (
+            self._level == 0
+            and isinstance(new_node, expr)
+            and self._memo.name_matches(new_node, *anytype_names)
+        ):
+            return None
+
+        return new_node
+
+    def visit_BinOp(self, node: BinOp) -> Any:
+        self.generic_visit(node)
+
+        if isinstance(node.op, BitOr):
+            # If either branch of the BinOp has been transformed to `None`, it means
+            # that a type in the union was ignored, so the entire annotation should e
+            # ignored
+            if not hasattr(node, "left") or not hasattr(node, "right"):
+                return None
+
+            # Return Any if either side is Any
+            if self._memo.name_matches(node.left, *anytype_names):
+                return node.left
+            elif self._memo.name_matches(node.right, *anytype_names):
+                return node.right
+
+            if sys.version_info < (3, 10):
+                union_name = self.transformer._get_import("typing", "Union")
+                return Subscript(
+                    value=union_name,
+                    slice=Index(
+                        Tuple(elts=[node.left, node.right], ctx=Load()), ctx=Load()
+                    ),
+                    ctx=Load(),
+                )
+
+        return node
+
+    def visit_Attribute(self, node: Attribute) -> Any:
+        if self._memo.is_ignored_name(node):
+            return None
+
+        return node
+
+    def visit_Subscript(self, node: Subscript) -> Any:
+        if self._memo.is_ignored_name(node.value):
+            return None
+
+        # The subscript of typing(_extensions).Literal can be any arbitrary string, so
+        # don't try to evaluate it as code
+        if node.slice:
+            if isinstance(node.slice, Index):
+                # Python 3.8
+                slice_value = node.slice.value  # type: ignore[attr-defined]
+            else:
+                slice_value = node.slice
+
+            if isinstance(slice_value, Tuple):
+                if self._memo.name_matches(node.value, *annotated_names):
+                    # Only treat the first argument to typing.Annotated as a potential
+                    # forward reference
+                    items = cast(
+                        typing.List[expr],
+                        [self.visit(slice_value.elts[0])] + slice_value.elts[1:],
+                    )
+                else:
+                    items = cast(
+                        typing.List[expr],
+                        [self.visit(item) for item in slice_value.elts],
+                    )
+
+                # If this is a Union and any of the items is Any, erase the entire
+                # annotation
+                if self._memo.name_matches(node.value, "typing.Union") and any(
+                    item is None
+                    or (
+                        isinstance(item, expr)
+                        and self._memo.name_matches(item, *anytype_names)
+                    )
+                    for item in items
+                ):
+                    return None
+
+                # If all items in the subscript were Any, erase the subscript entirely
+                if all(item is None for item in items):
+                    return node.value
+
+                for index, item in enumerate(items):
+                    if item is None:
+                        items[index] = self.transformer._get_import("typing", "Any")
+
+                slice_value.elts = items
+            else:
+                self.generic_visit(node)
+
+                # If the transformer erased the slice entirely, just return the node
+                # value without the subscript (unless it's Optional, in which case erase
+                # the node entirely
+                if self._memo.name_matches(
+                    node.value, "typing.Optional"
+                ) and not hasattr(node, "slice"):
+                    return None
+                if sys.version_info >= (3, 9) and not hasattr(node, "slice"):
+                    return node.value
+                elif sys.version_info < (3, 9) and not hasattr(node.slice, "value"):
+                    return node.value
+
+        return node
+
+    def visit_Name(self, node: Name) -> Any:
+        if self._memo.is_ignored_name(node):
+            return None
+
+        if sys.version_info < (3, 9):
+            for typename, substitute in self.type_substitutions.items():
+                if self._memo.name_matches(node, typename):
+                    new_node = self.transformer._get_import(*substitute)
+                    return copy_location(new_node, node)
+
+        return node
+
+    def visit_Call(self, node: Call) -> Any:
+        # Don't recurse into calls
+        return node
+
+    def visit_Constant(self, node: Constant) -> Any:
+        if isinstance(node.value, str):
+            expression = ast.parse(node.value, mode="eval")
+            new_node = self.visit(expression)
+            if new_node:
+                return copy_location(new_node.body, node)
+            else:
+                return None
+
+        return node
+
+
+class TypeguardTransformer(NodeTransformer):
+    def __init__(
+        self, target_path: Sequence[str] | None = None, target_lineno: int | None = None
+    ) -> None:
+        self._target_path = tuple(target_path) if target_path else None
+        self._memo = self._module_memo = TransformMemo(None, None, ())
+        self.names_used_in_annotations: set[str] = set()
+        self.target_node: FunctionDef | AsyncFunctionDef | None = None
+        self.target_lineno = target_lineno
+
+    def generic_visit(self, node: AST) -> AST:
+        has_non_empty_body_initially = bool(getattr(node, "body", None))
+        initial_type = type(node)
+
+        node = super().generic_visit(node)
+
+        if (
+            type(node) is initial_type
+            and has_non_empty_body_initially
+            and hasattr(node, "body")
+            and not node.body
+        ):
+            # If we have still the same node type after transformation
+            # but we've optimised it's body away, we add a `pass` statement.
+            node.body = [Pass()]
+
+        return node
+
+    @contextmanager
+    def _use_memo(
+        self, node: ClassDef | FunctionDef | AsyncFunctionDef
+    ) -> Generator[None, Any, None]:
+        new_memo = TransformMemo(node, self._memo, self._memo.path + (node.name,))
+        old_memo = self._memo
+        self._memo = new_memo
+
+        if isinstance(node, (FunctionDef, AsyncFunctionDef)):
+            new_memo.should_instrument = (
+                self._target_path is None or new_memo.path == self._target_path
+            )
+            if new_memo.should_instrument:
+                # Check if the function is a generator function
+                detector = GeneratorDetector()
+                detector.visit(node)
+
+                # Extract yield, send and return types where possible from a subscripted
+                # annotation like Generator[int, str, bool]
+                return_annotation = deepcopy(node.returns)
+                if detector.contains_yields and new_memo.name_matches(
+                    return_annotation, *generator_names
+                ):
+                    if isinstance(return_annotation, Subscript):
+                        annotation_slice = return_annotation.slice
+
+                        # Python < 3.9
+                        if isinstance(annotation_slice, Index):
+                            annotation_slice = (
+                                annotation_slice.value  # type: ignore[attr-defined]
+                            )
+
+                        if isinstance(annotation_slice, Tuple):
+                            items = annotation_slice.elts
+                        else:
+                            items = [annotation_slice]
+
+                        if len(items) > 0:
+                            new_memo.yield_annotation = self._convert_annotation(
+                                items[0]
+                            )
+
+                        if len(items) > 1:
+                            new_memo.send_annotation = self._convert_annotation(
+                                items[1]
+                            )
+
+                        if len(items) > 2:
+                            new_memo.return_annotation = self._convert_annotation(
+                                items[2]
+                            )
+                else:
+                    new_memo.return_annotation = self._convert_annotation(
+                        return_annotation
+                    )
+
+        if isinstance(node, AsyncFunctionDef):
+            new_memo.is_async = True
+
+        yield
+        self._memo = old_memo
+
+    def _get_import(self, module: str, name: str) -> Name:
+        memo = self._memo if self._target_path else self._module_memo
+        return memo.get_import(module, name)
+
+    @overload
+    def _convert_annotation(self, annotation: None) -> None: ...
+
+    @overload
+    def _convert_annotation(self, annotation: expr) -> expr: ...
+
+    def _convert_annotation(self, annotation: expr | None) -> expr | None:
+        if annotation is None:
+            return None
+
+        # Convert PEP 604 unions (x | y) and generic built-in collections where
+        # necessary, and undo forward references
+        new_annotation = cast(expr, AnnotationTransformer(self).visit(annotation))
+        if isinstance(new_annotation, expr):
+            new_annotation = ast.copy_location(new_annotation, annotation)
+
+            # Store names used in the annotation
+            names = {node.id for node in walk(new_annotation) if isinstance(node, Name)}
+            self.names_used_in_annotations.update(names)
+
+        return new_annotation
+
+    def visit_Name(self, node: Name) -> Name:
+        self._memo.local_names.add(node.id)
+        return node
+
+    def visit_Module(self, node: Module) -> Module:
+        self._module_memo = self._memo = TransformMemo(node, None, ())
+        self.generic_visit(node)
+        self._module_memo.insert_imports(node)
+
+        fix_missing_locations(node)
+        return node
+
+    def visit_Import(self, node: Import) -> Import:
+        for name in node.names:
+            self._memo.local_names.add(name.asname or name.name)
+            self._memo.imported_names[name.asname or name.name] = name.name
+
+        return node
+
+    def visit_ImportFrom(self, node: ImportFrom) -> ImportFrom:
+        for name in node.names:
+            if name.name != "*":
+                alias = name.asname or name.name
+                self._memo.local_names.add(alias)
+                self._memo.imported_names[alias] = f"{node.module}.{name.name}"
+
+        return node
+
+    def visit_ClassDef(self, node: ClassDef) -> ClassDef | None:
+        self._memo.local_names.add(node.name)
+
+        # Eliminate top level classes not belonging to the target path
+        if (
+            self._target_path is not None
+            and not self._memo.path
+            and node.name != self._target_path[0]
+        ):
+            return None
+
+        with self._use_memo(node):
+            for decorator in node.decorator_list.copy():
+                if self._memo.name_matches(decorator, "typeguard.typechecked"):
+                    # Remove the decorator to prevent duplicate instrumentation
+                    node.decorator_list.remove(decorator)
+
+                    # Store any configuration overrides
+                    if isinstance(decorator, Call) and decorator.keywords:
+                        self._memo.configuration_overrides.update(
+                            {kw.arg: kw.value for kw in decorator.keywords if kw.arg}
+                        )
+
+            self.generic_visit(node)
+            return node
+
+    def visit_FunctionDef(
+        self, node: FunctionDef | AsyncFunctionDef
+    ) -> FunctionDef | AsyncFunctionDef | None:
+        """
+        Injects type checks for function arguments, and for a return of None if the
+        function is annotated to return something else than Any or None, and the body
+        ends without an explicit "return".
+
+        """
+        self._memo.local_names.add(node.name)
+
+        # Eliminate top level functions not belonging to the target path
+        if (
+            self._target_path is not None
+            and not self._memo.path
+            and node.name != self._target_path[0]
+        ):
+            return None
+
+        # Skip instrumentation if we're instrumenting the whole module and the function
+        # contains either @no_type_check or @typeguard_ignore
+        if self._target_path is None:
+            for decorator in node.decorator_list:
+                if self._memo.name_matches(decorator, *ignore_decorators):
+                    return node
+
+        with self._use_memo(node):
+            arg_annotations: dict[str, Any] = {}
+            if self._target_path is None or self._memo.path == self._target_path:
+                # Find line number we're supposed to match against
+                if node.decorator_list:
+                    first_lineno = node.decorator_list[0].lineno
+                else:
+                    first_lineno = node.lineno
+
+                for decorator in node.decorator_list.copy():
+                    if self._memo.name_matches(decorator, "typing.overload"):
+                        # Remove overloads entirely
+                        return None
+                    elif self._memo.name_matches(decorator, "typeguard.typechecked"):
+                        # Remove the decorator to prevent duplicate instrumentation
+                        node.decorator_list.remove(decorator)
+
+                        # Store any configuration overrides
+                        if isinstance(decorator, Call) and decorator.keywords:
+                            self._memo.configuration_overrides = {
+                                kw.arg: kw.value for kw in decorator.keywords if kw.arg
+                            }
+
+                if self.target_lineno == first_lineno:
+                    assert self.target_node is None
+                    self.target_node = node
+                    if node.decorator_list:
+                        self.target_lineno = node.decorator_list[0].lineno
+                    else:
+                        self.target_lineno = node.lineno
+
+                all_args = node.args.args + node.args.kwonlyargs + node.args.posonlyargs
+
+                # Ensure that any type shadowed by the positional or keyword-only
+                # argument names are ignored in this function
+                for arg in all_args:
+                    self._memo.ignored_names.add(arg.arg)
+
+                # Ensure that any type shadowed by the variable positional argument name
+                # (e.g. "args" in *args) is ignored this function
+                if node.args.vararg:
+                    self._memo.ignored_names.add(node.args.vararg.arg)
+
+                # Ensure that any type shadowed by the variable keywrod argument name
+                # (e.g. "kwargs" in *kwargs) is ignored this function
+                if node.args.kwarg:
+                    self._memo.ignored_names.add(node.args.kwarg.arg)
+
+                for arg in all_args:
+                    annotation = self._convert_annotation(deepcopy(arg.annotation))
+                    if annotation:
+                        arg_annotations[arg.arg] = annotation
+
+                if node.args.vararg:
+                    annotation_ = self._convert_annotation(node.args.vararg.annotation)
+                    if annotation_:
+                        if sys.version_info >= (3, 9):
+                            container = Name("tuple", ctx=Load())
+                        else:
+                            container = self._get_import("typing", "Tuple")
+
+                        subscript_slice: Tuple | Index = Tuple(
+                            [
+                                annotation_,
+                                Constant(Ellipsis),
+                            ],
+                            ctx=Load(),
+                        )
+                        if sys.version_info < (3, 9):
+                            subscript_slice = Index(subscript_slice, ctx=Load())
+
+                        arg_annotations[node.args.vararg.arg] = Subscript(
+                            container, subscript_slice, ctx=Load()
+                        )
+
+                if node.args.kwarg:
+                    annotation_ = self._convert_annotation(node.args.kwarg.annotation)
+                    if annotation_:
+                        if sys.version_info >= (3, 9):
+                            container = Name("dict", ctx=Load())
+                        else:
+                            container = self._get_import("typing", "Dict")
+
+                        subscript_slice = Tuple(
+                            [
+                                Name("str", ctx=Load()),
+                                annotation_,
+                            ],
+                            ctx=Load(),
+                        )
+                        if sys.version_info < (3, 9):
+                            subscript_slice = Index(subscript_slice, ctx=Load())
+
+                        arg_annotations[node.args.kwarg.arg] = Subscript(
+                            container, subscript_slice, ctx=Load()
+                        )
+
+                if arg_annotations:
+                    self._memo.variable_annotations.update(arg_annotations)
+
+            self.generic_visit(node)
+
+            if arg_annotations:
+                annotations_dict = Dict(
+                    keys=[Constant(key) for key in arg_annotations.keys()],
+                    values=[
+                        Tuple([Name(key, ctx=Load()), annotation], ctx=Load())
+                        for key, annotation in arg_annotations.items()
+                    ],
+                )
+                func_name = self._get_import(
+                    "typeguard._functions", "check_argument_types"
+                )
+                args = [
+                    self._memo.joined_path,
+                    annotations_dict,
+                    self._memo.get_memo_name(),
+                ]
+                node.body.insert(
+                    self._memo.code_inject_index, Expr(Call(func_name, args, []))
+                )
+
+            # Add a checked "return None" to the end if there's no explicit return
+            # Skip if the return annotation is None or Any
+            if (
+                self._memo.return_annotation
+                and (not self._memo.is_async or not self._memo.has_yield_expressions)
+                and not isinstance(node.body[-1], Return)
+                and (
+                    not isinstance(self._memo.return_annotation, Constant)
+                    or self._memo.return_annotation.value is not None
+                )
+            ):
+                func_name = self._get_import(
+                    "typeguard._functions", "check_return_type"
+                )
+                return_node = Return(
+                    Call(
+                        func_name,
+                        [
+                            self._memo.joined_path,
+                            Constant(None),
+                            self._memo.return_annotation,
+                            self._memo.get_memo_name(),
+                        ],
+                        [],
+                    )
+                )
+
+                # Replace a placeholder "pass" at the end
+                if isinstance(node.body[-1], Pass):
+                    copy_location(return_node, node.body[-1])
+                    del node.body[-1]
+
+                node.body.append(return_node)
+
+            # Insert code to create the call memo, if it was ever needed for this
+            # function
+            if self._memo.memo_var_name:
+                memo_kwargs: dict[str, Any] = {}
+                if self._memo.parent and isinstance(self._memo.parent.node, ClassDef):
+                    for decorator in node.decorator_list:
+                        if (
+                            isinstance(decorator, Name)
+                            and decorator.id == "staticmethod"
+                        ):
+                            break
+                        elif (
+                            isinstance(decorator, Name)
+                            and decorator.id == "classmethod"
+                        ):
+                            memo_kwargs["self_type"] = Name(
+                                id=node.args.args[0].arg, ctx=Load()
+                            )
+                            break
+                    else:
+                        if node.args.args:
+                            if node.name == "__new__":
+                                memo_kwargs["self_type"] = Name(
+                                    id=node.args.args[0].arg, ctx=Load()
+                                )
+                            else:
+                                memo_kwargs["self_type"] = Attribute(
+                                    Name(id=node.args.args[0].arg, ctx=Load()),
+                                    "__class__",
+                                    ctx=Load(),
+                                )
+
+                # Construct the function reference
+                # Nested functions get special treatment: the function name is added
+                # to free variables (and the closure of the resulting function)
+                names: list[str] = [node.name]
+                memo = self._memo.parent
+                while memo:
+                    if isinstance(memo.node, (FunctionDef, AsyncFunctionDef)):
+                        # This is a nested function. Use the function name as-is.
+                        del names[:-1]
+                        break
+                    elif not isinstance(memo.node, ClassDef):
+                        break
+
+                    names.insert(0, memo.node.name)
+                    memo = memo.parent
+
+                config_keywords = self._memo.get_config_keywords()
+                if config_keywords:
+                    memo_kwargs["config"] = Call(
+                        self._get_import("dataclasses", "replace"),
+                        [self._get_import("typeguard._config", "global_config")],
+                        config_keywords,
+                    )
+
+                self._memo.memo_var_name.id = self._memo.get_unused_name("memo")
+                memo_store_name = Name(id=self._memo.memo_var_name.id, ctx=Store())
+                globals_call = Call(Name(id="globals", ctx=Load()), [], [])
+                locals_call = Call(Name(id="locals", ctx=Load()), [], [])
+                memo_expr = Call(
+                    self._get_import("typeguard", "TypeCheckMemo"),
+                    [globals_call, locals_call],
+                    [keyword(key, value) for key, value in memo_kwargs.items()],
+                )
+                node.body.insert(
+                    self._memo.code_inject_index,
+                    Assign([memo_store_name], memo_expr),
+                )
+
+                self._memo.insert_imports(node)
+
+                # Special case the __new__() method to create a local alias from the
+                # class name to the first argument (usually "cls")
+                if (
+                    isinstance(node, FunctionDef)
+                    and node.args
+                    and self._memo.parent is not None
+                    and isinstance(self._memo.parent.node, ClassDef)
+                    and node.name == "__new__"
+                ):
+                    first_args_expr = Name(node.args.args[0].arg, ctx=Load())
+                    cls_name = Name(self._memo.parent.node.name, ctx=Store())
+                    node.body.insert(
+                        self._memo.code_inject_index,
+                        Assign([cls_name], first_args_expr),
+                    )
+
+                # Rmove any placeholder "pass" at the end
+                if isinstance(node.body[-1], Pass):
+                    del node.body[-1]
+
+        return node
+
+    def visit_AsyncFunctionDef(
+        self, node: AsyncFunctionDef
+    ) -> FunctionDef | AsyncFunctionDef | None:
+        return self.visit_FunctionDef(node)
+
+    def visit_Return(self, node: Return) -> Return:
+        """This injects type checks into "return" statements."""
+        self.generic_visit(node)
+        if (
+            self._memo.return_annotation
+            and self._memo.should_instrument
+            and not self._memo.is_ignored_name(self._memo.return_annotation)
+        ):
+            func_name = self._get_import("typeguard._functions", "check_return_type")
+            old_node = node
+            retval = old_node.value or Constant(None)
+            node = Return(
+                Call(
+                    func_name,
+                    [
+                        self._memo.joined_path,
+                        retval,
+                        self._memo.return_annotation,
+                        self._memo.get_memo_name(),
+                    ],
+                    [],
+                )
+            )
+            copy_location(node, old_node)
+
+        return node
+
+    def visit_Yield(self, node: Yield) -> Yield | Call:
+        """
+        This injects type checks into "yield" expressions, checking both the yielded
+        value and the value sent back to the generator, when appropriate.
+
+        """
+        self._memo.has_yield_expressions = True
+        self.generic_visit(node)
+
+        if (
+            self._memo.yield_annotation
+            and self._memo.should_instrument
+            and not self._memo.is_ignored_name(self._memo.yield_annotation)
+        ):
+            func_name = self._get_import("typeguard._functions", "check_yield_type")
+            yieldval = node.value or Constant(None)
+            node.value = Call(
+                func_name,
+                [
+                    self._memo.joined_path,
+                    yieldval,
+                    self._memo.yield_annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+
+        if (
+            self._memo.send_annotation
+            and self._memo.should_instrument
+            and not self._memo.is_ignored_name(self._memo.send_annotation)
+        ):
+            func_name = self._get_import("typeguard._functions", "check_send_type")
+            old_node = node
+            call_node = Call(
+                func_name,
+                [
+                    self._memo.joined_path,
+                    old_node,
+                    self._memo.send_annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+            copy_location(call_node, old_node)
+            return call_node
+
+        return node
+
+    def visit_AnnAssign(self, node: AnnAssign) -> Any:
+        """
+        This injects a type check into a local variable annotation-assignment within a
+        function body.
+
+        """
+        self.generic_visit(node)
+
+        if (
+            isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef))
+            and node.annotation
+            and isinstance(node.target, Name)
+        ):
+            self._memo.ignored_names.add(node.target.id)
+            annotation = self._convert_annotation(deepcopy(node.annotation))
+            if annotation:
+                self._memo.variable_annotations[node.target.id] = annotation
+                if node.value:
+                    func_name = self._get_import(
+                        "typeguard._functions", "check_variable_assignment"
+                    )
+                    node.value = Call(
+                        func_name,
+                        [
+                            node.value,
+                            Constant(node.target.id),
+                            annotation,
+                            self._memo.get_memo_name(),
+                        ],
+                        [],
+                    )
+
+        return node
+
+    def visit_Assign(self, node: Assign) -> Any:
+        """
+        This injects a type check into a local variable assignment within a function
+        body. The variable must have been annotated earlier in the function body.
+
+        """
+        self.generic_visit(node)
+
+        # Only instrument function-local assignments
+        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)):
+            targets: list[dict[Constant, expr | None]] = []
+            check_required = False
+            for target in node.targets:
+                elts: Sequence[expr]
+                if isinstance(target, Name):
+                    elts = [target]
+                elif isinstance(target, Tuple):
+                    elts = target.elts
+                else:
+                    continue
+
+                annotations_: dict[Constant, expr | None] = {}
+                for exp in elts:
+                    prefix = ""
+                    if isinstance(exp, Starred):
+                        exp = exp.value
+                        prefix = "*"
+
+                    if isinstance(exp, Name):
+                        self._memo.ignored_names.add(exp.id)
+                        name = prefix + exp.id
+                        annotation = self._memo.variable_annotations.get(exp.id)
+                        if annotation:
+                            annotations_[Constant(name)] = annotation
+                            check_required = True
+                        else:
+                            annotations_[Constant(name)] = None
+
+                targets.append(annotations_)
+
+            if check_required:
+                # Replace missing annotations with typing.Any
+                for item in targets:
+                    for key, expression in item.items():
+                        if expression is None:
+                            item[key] = self._get_import("typing", "Any")
+
+                if len(targets) == 1 and len(targets[0]) == 1:
+                    func_name = self._get_import(
+                        "typeguard._functions", "check_variable_assignment"
+                    )
+                    target_varname = next(iter(targets[0]))
+                    node.value = Call(
+                        func_name,
+                        [
+                            node.value,
+                            target_varname,
+                            targets[0][target_varname],
+                            self._memo.get_memo_name(),
+                        ],
+                        [],
+                    )
+                elif targets:
+                    func_name = self._get_import(
+                        "typeguard._functions", "check_multi_variable_assignment"
+                    )
+                    targets_arg = List(
+                        [
+                            Dict(keys=list(target), values=list(target.values()))
+                            for target in targets
+                        ],
+                        ctx=Load(),
+                    )
+                    node.value = Call(
+                        func_name,
+                        [node.value, targets_arg, self._memo.get_memo_name()],
+                        [],
+                    )
+
+        return node
+
+    def visit_NamedExpr(self, node: NamedExpr) -> Any:
+        """This injects a type check into an assignment expression (a := foo())."""
+        self.generic_visit(node)
+
+        # Only instrument function-local assignments
+        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)) and isinstance(
+            node.target, Name
+        ):
+            self._memo.ignored_names.add(node.target.id)
+
+            # Bail out if no matching annotation is found
+            annotation = self._memo.variable_annotations.get(node.target.id)
+            if annotation is None:
+                return node
+
+            func_name = self._get_import(
+                "typeguard._functions", "check_variable_assignment"
+            )
+            node.value = Call(
+                func_name,
+                [
+                    node.value,
+                    Constant(node.target.id),
+                    annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+
+        return node
+
+    def visit_AugAssign(self, node: AugAssign) -> Any:
+        """
+        This injects a type check into an augmented assignment expression (a += 1).
+
+        """
+        self.generic_visit(node)
+
+        # Only instrument function-local assignments
+        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)) and isinstance(
+            node.target, Name
+        ):
+            # Bail out if no matching annotation is found
+            annotation = self._memo.variable_annotations.get(node.target.id)
+            if annotation is None:
+                return node
+
+            # Bail out if the operator is not found (newer Python version?)
+            try:
+                operator_func_name = aug_assign_functions[node.op.__class__]
+            except KeyError:
+                return node
+
+            operator_func = self._get_import("operator", operator_func_name)
+            operator_call = Call(
+                operator_func, [Name(node.target.id, ctx=Load()), node.value], []
+            )
+            check_call = Call(
+                self._get_import("typeguard._functions", "check_variable_assignment"),
+                [
+                    operator_call,
+                    Constant(node.target.id),
+                    annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+            return Assign(targets=[node.target], value=check_call)
+
+        return node
+
+    def visit_If(self, node: If) -> Any:
+        """
+        This blocks names from being collected from a module-level
+        "if typing.TYPE_CHECKING:" block, so that they won't be type checked.
+
+        """
+        self.generic_visit(node)
+
+        if (
+            self._memo is self._module_memo
+            and isinstance(node.test, Name)
+            and self._memo.name_matches(node.test, "typing.TYPE_CHECKING")
+        ):
+            collector = NameCollector()
+            collector.visit(node)
+            self._memo.ignored_names.update(collector.names)
+
+        return node
diff --git a/setuptools/_vendor/typeguard/_union_transformer.py b/setuptools/_vendor/typeguard/_union_transformer.py
new file mode 100644
index 0000000000..19617e6af5
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_union_transformer.py
@@ -0,0 +1,55 @@
+"""
+Transforms lazily evaluated PEP 604 unions into typing.Unions, for compatibility with
+Python versions older than 3.10.
+"""
+
+from __future__ import annotations
+
+from ast import (
+    BinOp,
+    BitOr,
+    Index,
+    Load,
+    Name,
+    NodeTransformer,
+    Subscript,
+    fix_missing_locations,
+    parse,
+)
+from ast import Tuple as ASTTuple
+from types import CodeType
+from typing import Any, Dict, FrozenSet, List, Set, Tuple, Union
+
+type_substitutions = {
+    "dict": Dict,
+    "list": List,
+    "tuple": Tuple,
+    "set": Set,
+    "frozenset": FrozenSet,
+    "Union": Union,
+}
+
+
+class UnionTransformer(NodeTransformer):
+    def __init__(self, union_name: Name | None = None):
+        self.union_name = union_name or Name(id="Union", ctx=Load())
+
+    def visit_BinOp(self, node: BinOp) -> Any:
+        self.generic_visit(node)
+        if isinstance(node.op, BitOr):
+            return Subscript(
+                value=self.union_name,
+                slice=Index(
+                    ASTTuple(elts=[node.left, node.right], ctx=Load()), ctx=Load()
+                ),
+                ctx=Load(),
+            )
+
+        return node
+
+
+def compile_type_hint(hint: str) -> CodeType:
+    parsed = parse(hint, "", "eval")
+    UnionTransformer().visit(parsed)
+    fix_missing_locations(parsed)
+    return compile(parsed, "", "eval", flags=0)
diff --git a/setuptools/_vendor/typeguard/_utils.py b/setuptools/_vendor/typeguard/_utils.py
new file mode 100644
index 0000000000..9bcc8417f8
--- /dev/null
+++ b/setuptools/_vendor/typeguard/_utils.py
@@ -0,0 +1,173 @@
+from __future__ import annotations
+
+import inspect
+import sys
+from importlib import import_module
+from inspect import currentframe
+from types import CodeType, FrameType, FunctionType
+from typing import TYPE_CHECKING, Any, Callable, ForwardRef, Union, cast, final
+from weakref import WeakValueDictionary
+
+if TYPE_CHECKING:
+    from ._memo import TypeCheckMemo
+
+if sys.version_info >= (3, 13):
+    from typing import get_args, get_origin
+
+    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
+        return forwardref._evaluate(
+            memo.globals, memo.locals, type_params=(), recursive_guard=frozenset()
+        )
+
+elif sys.version_info >= (3, 10):
+    from typing import get_args, get_origin
+
+    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
+        return forwardref._evaluate(
+            memo.globals, memo.locals, recursive_guard=frozenset()
+        )
+
+else:
+    from typing_extensions import get_args, get_origin
+
+    evaluate_extra_args: tuple[frozenset[Any], ...] = (
+        (frozenset(),) if sys.version_info >= (3, 9) else ()
+    )
+
+    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
+        from ._union_transformer import compile_type_hint, type_substitutions
+
+        if not forwardref.__forward_evaluated__:
+            forwardref.__forward_code__ = compile_type_hint(forwardref.__forward_arg__)
+
+        try:
+            return forwardref._evaluate(memo.globals, memo.locals, *evaluate_extra_args)
+        except NameError:
+            if sys.version_info < (3, 10):
+                # Try again, with the type substitutions (list -> List etc.) in place
+                new_globals = memo.globals.copy()
+                new_globals.setdefault("Union", Union)
+                if sys.version_info < (3, 9):
+                    new_globals.update(type_substitutions)
+
+                return forwardref._evaluate(
+                    new_globals, memo.locals or new_globals, *evaluate_extra_args
+                )
+
+            raise
+
+
+_functions_map: WeakValueDictionary[CodeType, FunctionType] = WeakValueDictionary()
+
+
+def get_type_name(type_: Any) -> str:
+    name: str
+    for attrname in "__name__", "_name", "__forward_arg__":
+        candidate = getattr(type_, attrname, None)
+        if isinstance(candidate, str):
+            name = candidate
+            break
+    else:
+        origin = get_origin(type_)
+        candidate = getattr(origin, "_name", None)
+        if candidate is None:
+            candidate = type_.__class__.__name__.strip("_")
+
+        if isinstance(candidate, str):
+            name = candidate
+        else:
+            return "(unknown)"
+
+    args = get_args(type_)
+    if args:
+        if name == "Literal":
+            formatted_args = ", ".join(repr(arg) for arg in args)
+        else:
+            formatted_args = ", ".join(get_type_name(arg) for arg in args)
+
+        name += f"[{formatted_args}]"
+
+    module = getattr(type_, "__module__", None)
+    if module and module not in (None, "typing", "typing_extensions", "builtins"):
+        name = module + "." + name
+
+    return name
+
+
+def qualified_name(obj: Any, *, add_class_prefix: bool = False) -> str:
+    """
+    Return the qualified name (e.g. package.module.Type) for the given object.
+
+    Builtins and types from the :mod:`typing` package get special treatment by having
+    the module name stripped from the generated name.
+
+    """
+    if obj is None:
+        return "None"
+    elif inspect.isclass(obj):
+        prefix = "class " if add_class_prefix else ""
+        type_ = obj
+    else:
+        prefix = ""
+        type_ = type(obj)
+
+    module = type_.__module__
+    qualname = type_.__qualname__
+    name = qualname if module in ("typing", "builtins") else f"{module}.{qualname}"
+    return prefix + name
+
+
+def function_name(func: Callable[..., Any]) -> str:
+    """
+    Return the qualified name of the given function.
+
+    Builtins and types from the :mod:`typing` package get special treatment by having
+    the module name stripped from the generated name.
+
+    """
+    # For partial functions and objects with __call__ defined, __qualname__ does not
+    # exist
+    module = getattr(func, "__module__", "")
+    qualname = (module + ".") if module not in ("builtins", "") else ""
+    return qualname + getattr(func, "__qualname__", repr(func))
+
+
+def resolve_reference(reference: str) -> Any:
+    modulename, varname = reference.partition(":")[::2]
+    if not modulename or not varname:
+        raise ValueError(f"{reference!r} is not a module:varname reference")
+
+    obj = import_module(modulename)
+    for attr in varname.split("."):
+        obj = getattr(obj, attr)
+
+    return obj
+
+
+def is_method_of(obj: object, cls: type) -> bool:
+    return (
+        inspect.isfunction(obj)
+        and obj.__module__ == cls.__module__
+        and obj.__qualname__.startswith(cls.__qualname__ + ".")
+    )
+
+
+def get_stacklevel() -> int:
+    level = 1
+    frame = cast(FrameType, currentframe()).f_back
+    while frame and frame.f_globals.get("__name__", "").startswith("typeguard."):
+        level += 1
+        frame = frame.f_back
+
+    return level
+
+
+@final
+class Unset:
+    __slots__ = ()
+
+    def __repr__(self) -> str:
+        return ""
+
+
+unset = Unset()
diff --git a/setuptools/_vendor/typeguard/py.typed b/setuptools/_vendor/typeguard/py.typed
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/setuptools/_vendor/typing_extensions-4.12.2.dist-info/LICENSE b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
new file mode 100644
index 0000000000..f26bcf4d2d
--- /dev/null
+++ b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
@@ -0,0 +1,279 @@
+A. HISTORY OF THE SOFTWARE
+==========================
+
+Python was created in the early 1990s by Guido van Rossum at Stichting
+Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
+as a successor of a language called ABC.  Guido remains Python's
+principal author, although it includes many contributions from others.
+
+In 1995, Guido continued his work on Python at the Corporation for
+National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
+in Reston, Virginia where he released several versions of the
+software.
+
+In May 2000, Guido and the Python core development team moved to
+BeOpen.com to form the BeOpen PythonLabs team.  In October of the same
+year, the PythonLabs team moved to Digital Creations, which became
+Zope Corporation.  In 2001, the Python Software Foundation (PSF, see
+https://www.python.org/psf/) was formed, a non-profit organization
+created specifically to own Python-related Intellectual Property.
+Zope Corporation was a sponsoring member of the PSF.
+
+All Python releases are Open Source (see https://opensource.org for
+the Open Source Definition).  Historically, most, but not all, Python
+releases have also been GPL-compatible; the table below summarizes
+the various releases.
+
+    Release         Derived     Year        Owner       GPL-
+                    from                                compatible? (1)
+
+    0.9.0 thru 1.2              1991-1995   CWI         yes
+    1.3 thru 1.5.2  1.2         1995-1999   CNRI        yes
+    1.6             1.5.2       2000        CNRI        no
+    2.0             1.6         2000        BeOpen.com  no
+    1.6.1           1.6         2001        CNRI        yes (2)
+    2.1             2.0+1.6.1   2001        PSF         no
+    2.0.1           2.0+1.6.1   2001        PSF         yes
+    2.1.1           2.1+2.0.1   2001        PSF         yes
+    2.1.2           2.1.1       2002        PSF         yes
+    2.1.3           2.1.2       2002        PSF         yes
+    2.2 and above   2.1.1       2001-now    PSF         yes
+
+Footnotes:
+
+(1) GPL-compatible doesn't mean that we're distributing Python under
+    the GPL.  All Python licenses, unlike the GPL, let you distribute
+    a modified version without making your changes open source.  The
+    GPL-compatible licenses make it possible to combine Python with
+    other software that is released under the GPL; the others don't.
+
+(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
+    because its license has a choice of law clause.  According to
+    CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
+    is "not incompatible" with the GPL.
+
+Thanks to the many outside volunteers who have worked under Guido's
+direction to make these releases possible.
+
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+===============================================================
+
+Python software and documentation are licensed under the
+Python Software Foundation License Version 2.
+
+Starting with Python 3.8.6, examples, recipes, and other code in
+the documentation are dual licensed under the PSF License Version 2
+and the Zero-Clause BSD license.
+
+Some software incorporated into Python is under different licenses.
+The licenses are listed with code falling under that license.
+
+
+PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+--------------------------------------------
+
+1. This LICENSE AGREEMENT is between the Python Software Foundation
+("PSF"), and the Individual or Organization ("Licensee") accessing and
+otherwise using this software ("Python") in source or binary form and
+its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF hereby
+grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
+analyze, test, perform and/or display publicly, prepare derivative works,
+distribute, and otherwise use Python alone or in any derivative version,
+provided, however, that PSF's License Agreement and PSF's notice of copyright,
+i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
+All Rights Reserved" are retained in Python alone or in any derivative version
+prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python.
+
+4. PSF is making Python available to Licensee on an "AS IS"
+basis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between PSF and
+Licensee.  This License Agreement does not grant permission to use PSF
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
+-------------------------------------------
+
+BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
+office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
+Individual or Organization ("Licensee") accessing and otherwise using
+this software in source or binary form and its associated
+documentation ("the Software").
+
+2. Subject to the terms and conditions of this BeOpen Python License
+Agreement, BeOpen hereby grants Licensee a non-exclusive,
+royalty-free, world-wide license to reproduce, analyze, test, perform
+and/or display publicly, prepare derivative works, distribute, and
+otherwise use the Software alone or in any derivative version,
+provided, however, that the BeOpen Python License is retained in the
+Software, alone or in any derivative version prepared by Licensee.
+
+3. BeOpen is making the Software available to Licensee on an "AS IS"
+basis.  BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
+SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
+AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
+DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+5. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+6. This License Agreement shall be governed by and interpreted in all
+respects by the law of the State of California, excluding conflict of
+law provisions.  Nothing in this License Agreement shall be deemed to
+create any relationship of agency, partnership, or joint venture
+between BeOpen and Licensee.  This License Agreement does not grant
+permission to use BeOpen trademarks or trade names in a trademark
+sense to endorse or promote products or services of Licensee, or any
+third party.  As an exception, the "BeOpen Python" logos available at
+http://www.pythonlabs.com/logos.html may be used according to the
+permissions granted on that web page.
+
+7. By copying, installing or otherwise using the software, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
+---------------------------------------
+
+1. This LICENSE AGREEMENT is between the Corporation for National
+Research Initiatives, having an office at 1895 Preston White Drive,
+Reston, VA 20191 ("CNRI"), and the Individual or Organization
+("Licensee") accessing and otherwise using Python 1.6.1 software in
+source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, CNRI
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python 1.6.1
+alone or in any derivative version, provided, however, that CNRI's
+License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
+1995-2001 Corporation for National Research Initiatives; All Rights
+Reserved" are retained in Python 1.6.1 alone or in any derivative
+version prepared by Licensee.  Alternately, in lieu of CNRI's License
+Agreement, Licensee may substitute the following text (omitting the
+quotes): "Python 1.6.1 is made available subject to the terms and
+conditions in CNRI's License Agreement.  This Agreement together with
+Python 1.6.1 may be located on the internet using the following
+unique, persistent identifier (known as a handle): 1895.22/1013.  This
+Agreement may also be obtained from a proxy server on the internet
+using the following URL: http://hdl.handle.net/1895.22/1013".
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python 1.6.1 or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python 1.6.1.
+
+4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
+basis.  CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. This License Agreement shall be governed by the federal
+intellectual property law of the United States, including without
+limitation the federal copyright law, and, to the extent such
+U.S. federal law does not apply, by the law of the Commonwealth of
+Virginia, excluding Virginia's conflict of law provisions.
+Notwithstanding the foregoing, with regard to derivative works based
+on Python 1.6.1 that incorporate non-separable material that was
+previously distributed under the GNU General Public License (GPL), the
+law of the Commonwealth of Virginia shall govern this License
+Agreement only as to issues arising under or with respect to
+Paragraphs 4, 5, and 7 of this License Agreement.  Nothing in this
+License Agreement shall be deemed to create any relationship of
+agency, partnership, or joint venture between CNRI and Licensee.  This
+License Agreement does not grant permission to use CNRI trademarks or
+trade name in a trademark sense to endorse or promote products or
+services of Licensee, or any third party.
+
+8. By clicking on the "ACCEPT" button where indicated, or by copying,
+installing or otherwise using Python 1.6.1, Licensee agrees to be
+bound by the terms and conditions of this License Agreement.
+
+        ACCEPT
+
+
+CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
+--------------------------------------------------
+
+Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
+The Netherlands.  All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
+----------------------------------------------------------------------
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/setuptools/_vendor/typing_extensions-4.12.2.dist-info/METADATA b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/METADATA
new file mode 100644
index 0000000000..f15e2b3877
--- /dev/null
+++ b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/METADATA
@@ -0,0 +1,67 @@
+Metadata-Version: 2.1
+Name: typing_extensions
+Version: 4.12.2
+Summary: Backported and Experimental Type Hints for Python 3.8+
+Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing
+Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" 
+Requires-Python: >=3.8
+Description-Content-Type: text/markdown
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Python Software Foundation License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: 3.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: Topic :: Software Development
+Project-URL: Bug Tracker, https://github.com/python/typing_extensions/issues
+Project-URL: Changes, https://github.com/python/typing_extensions/blob/main/CHANGELOG.md
+Project-URL: Documentation, https://typing-extensions.readthedocs.io/
+Project-URL: Home, https://github.com/python/typing_extensions
+Project-URL: Q & A, https://github.com/python/typing/discussions
+Project-URL: Repository, https://github.com/python/typing_extensions
+
+# Typing Extensions
+
+[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing)
+
+[Documentation](https://typing-extensions.readthedocs.io/en/latest/#) –
+[PyPI](https://pypi.org/project/typing-extensions/)
+
+## Overview
+
+The `typing_extensions` module serves two related purposes:
+
+- Enable use of new type system features on older Python versions. For example,
+  `typing.TypeGuard` is new in Python 3.10, but `typing_extensions` allows
+  users on previous Python versions to use it too.
+- Enable experimentation with new type system PEPs before they are accepted and
+  added to the `typing` module.
+
+`typing_extensions` is treated specially by static type checkers such as
+mypy and pyright. Objects defined in `typing_extensions` are treated the same
+way as equivalent forms in `typing`.
+
+`typing_extensions` uses
+[Semantic Versioning](https://semver.org/). The
+major version will be incremented only for backwards-incompatible changes.
+Therefore, it's safe to depend
+on `typing_extensions` like this: `typing_extensions >=x.y, <(x+1)`,
+where `x.y` is the first version that includes all features you need.
+
+## Included items
+
+See [the documentation](https://typing-extensions.readthedocs.io/en/latest/#) for a
+complete listing of module contents.
+
+## Contributing
+
+See [CONTRIBUTING.md](https://github.com/python/typing_extensions/blob/main/CONTRIBUTING.md)
+for how to contribute to `typing_extensions`.
+
diff --git a/setuptools/_vendor/typing_extensions-4.12.2.dist-info/RECORD b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/RECORD
new file mode 100644
index 0000000000..bc7b45334d
--- /dev/null
+++ b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/RECORD
@@ -0,0 +1,7 @@
+__pycache__/typing_extensions.cpython-312.pyc,,
+typing_extensions-4.12.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+typing_extensions-4.12.2.dist-info/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936
+typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjWx-N8TOznM9UGW5Gm2DicVpDtRA8W0,3018
+typing_extensions-4.12.2.dist-info/RECORD,,
+typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
+typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
diff --git a/setuptools/_vendor/typing_extensions-4.12.2.dist-info/WHEEL b/setuptools/_vendor/typing_extensions-4.12.2.dist-info/WHEEL
new file mode 100644
index 0000000000..3b5e64b5e6
--- /dev/null
+++ b/setuptools/_vendor/typing_extensions-4.12.2.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/setuptools/_vendor/typing_extensions.py b/setuptools/_vendor/typing_extensions.py
new file mode 100644
index 0000000000..dec429ca87
--- /dev/null
+++ b/setuptools/_vendor/typing_extensions.py
@@ -0,0 +1,3641 @@
+import abc
+import collections
+import collections.abc
+import contextlib
+import functools
+import inspect
+import operator
+import sys
+import types as _types
+import typing
+import warnings
+
+__all__ = [
+    # Super-special typing primitives.
+    'Any',
+    'ClassVar',
+    'Concatenate',
+    'Final',
+    'LiteralString',
+    'ParamSpec',
+    'ParamSpecArgs',
+    'ParamSpecKwargs',
+    'Self',
+    'Type',
+    'TypeVar',
+    'TypeVarTuple',
+    'Unpack',
+
+    # ABCs (from collections.abc).
+    'Awaitable',
+    'AsyncIterator',
+    'AsyncIterable',
+    'Coroutine',
+    'AsyncGenerator',
+    'AsyncContextManager',
+    'Buffer',
+    'ChainMap',
+
+    # Concrete collection types.
+    'ContextManager',
+    'Counter',
+    'Deque',
+    'DefaultDict',
+    'NamedTuple',
+    'OrderedDict',
+    'TypedDict',
+
+    # Structural checks, a.k.a. protocols.
+    'SupportsAbs',
+    'SupportsBytes',
+    'SupportsComplex',
+    'SupportsFloat',
+    'SupportsIndex',
+    'SupportsInt',
+    'SupportsRound',
+
+    # One-off things.
+    'Annotated',
+    'assert_never',
+    'assert_type',
+    'clear_overloads',
+    'dataclass_transform',
+    'deprecated',
+    'Doc',
+    'get_overloads',
+    'final',
+    'get_args',
+    'get_origin',
+    'get_original_bases',
+    'get_protocol_members',
+    'get_type_hints',
+    'IntVar',
+    'is_protocol',
+    'is_typeddict',
+    'Literal',
+    'NewType',
+    'overload',
+    'override',
+    'Protocol',
+    'reveal_type',
+    'runtime',
+    'runtime_checkable',
+    'Text',
+    'TypeAlias',
+    'TypeAliasType',
+    'TypeGuard',
+    'TypeIs',
+    'TYPE_CHECKING',
+    'Never',
+    'NoReturn',
+    'ReadOnly',
+    'Required',
+    'NotRequired',
+
+    # Pure aliases, have always been in typing
+    'AbstractSet',
+    'AnyStr',
+    'BinaryIO',
+    'Callable',
+    'Collection',
+    'Container',
+    'Dict',
+    'ForwardRef',
+    'FrozenSet',
+    'Generator',
+    'Generic',
+    'Hashable',
+    'IO',
+    'ItemsView',
+    'Iterable',
+    'Iterator',
+    'KeysView',
+    'List',
+    'Mapping',
+    'MappingView',
+    'Match',
+    'MutableMapping',
+    'MutableSequence',
+    'MutableSet',
+    'NoDefault',
+    'Optional',
+    'Pattern',
+    'Reversible',
+    'Sequence',
+    'Set',
+    'Sized',
+    'TextIO',
+    'Tuple',
+    'Union',
+    'ValuesView',
+    'cast',
+    'no_type_check',
+    'no_type_check_decorator',
+]
+
+# for backward compatibility
+PEP_560 = True
+GenericMeta = type
+_PEP_696_IMPLEMENTED = sys.version_info >= (3, 13, 0, "beta")
+
+# The functions below are modified copies of typing internal helpers.
+# They are needed by _ProtocolMeta and they provide support for PEP 646.
+
+
+class _Sentinel:
+    def __repr__(self):
+        return ""
+
+
+_marker = _Sentinel()
+
+
+if sys.version_info >= (3, 10):
+    def _should_collect_from_parameters(t):
+        return isinstance(
+            t, (typing._GenericAlias, _types.GenericAlias, _types.UnionType)
+        )
+elif sys.version_info >= (3, 9):
+    def _should_collect_from_parameters(t):
+        return isinstance(t, (typing._GenericAlias, _types.GenericAlias))
+else:
+    def _should_collect_from_parameters(t):
+        return isinstance(t, typing._GenericAlias) and not t._special
+
+
+NoReturn = typing.NoReturn
+
+# Some unconstrained type variables.  These are used by the container types.
+# (These are not for export.)
+T = typing.TypeVar('T')  # Any type.
+KT = typing.TypeVar('KT')  # Key type.
+VT = typing.TypeVar('VT')  # Value type.
+T_co = typing.TypeVar('T_co', covariant=True)  # Any type covariant containers.
+T_contra = typing.TypeVar('T_contra', contravariant=True)  # Ditto contravariant.
+
+
+if sys.version_info >= (3, 11):
+    from typing import Any
+else:
+
+    class _AnyMeta(type):
+        def __instancecheck__(self, obj):
+            if self is Any:
+                raise TypeError("typing_extensions.Any cannot be used with isinstance()")
+            return super().__instancecheck__(obj)
+
+        def __repr__(self):
+            if self is Any:
+                return "typing_extensions.Any"
+            return super().__repr__()
+
+    class Any(metaclass=_AnyMeta):
+        """Special type indicating an unconstrained type.
+        - Any is compatible with every type.
+        - Any assumed to have all methods.
+        - All values assumed to be instances of Any.
+        Note that all the above statements are true from the point of view of
+        static type checkers. At runtime, Any should not be used with instance
+        checks.
+        """
+        def __new__(cls, *args, **kwargs):
+            if cls is Any:
+                raise TypeError("Any cannot be instantiated")
+            return super().__new__(cls, *args, **kwargs)
+
+
+ClassVar = typing.ClassVar
+
+
+class _ExtensionsSpecialForm(typing._SpecialForm, _root=True):
+    def __repr__(self):
+        return 'typing_extensions.' + self._name
+
+
+Final = typing.Final
+
+if sys.version_info >= (3, 11):
+    final = typing.final
+else:
+    # @final exists in 3.8+, but we backport it for all versions
+    # before 3.11 to keep support for the __final__ attribute.
+    # See https://bugs.python.org/issue46342
+    def final(f):
+        """This decorator can be used to indicate to type checkers that
+        the decorated method cannot be overridden, and decorated class
+        cannot be subclassed. For example:
+
+            class Base:
+                @final
+                def done(self) -> None:
+                    ...
+            class Sub(Base):
+                def done(self) -> None:  # Error reported by type checker
+                    ...
+            @final
+            class Leaf:
+                ...
+            class Other(Leaf):  # Error reported by type checker
+                ...
+
+        There is no runtime checking of these properties. The decorator
+        sets the ``__final__`` attribute to ``True`` on the decorated object
+        to allow runtime introspection.
+        """
+        try:
+            f.__final__ = True
+        except (AttributeError, TypeError):
+            # Skip the attribute silently if it is not writable.
+            # AttributeError happens if the object has __slots__ or a
+            # read-only property, TypeError if it's a builtin class.
+            pass
+        return f
+
+
+def IntVar(name):
+    return typing.TypeVar(name)
+
+
+# A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8
+if sys.version_info >= (3, 10, 1):
+    Literal = typing.Literal
+else:
+    def _flatten_literal_params(parameters):
+        """An internal helper for Literal creation: flatten Literals among parameters"""
+        params = []
+        for p in parameters:
+            if isinstance(p, _LiteralGenericAlias):
+                params.extend(p.__args__)
+            else:
+                params.append(p)
+        return tuple(params)
+
+    def _value_and_type_iter(params):
+        for p in params:
+            yield p, type(p)
+
+    class _LiteralGenericAlias(typing._GenericAlias, _root=True):
+        def __eq__(self, other):
+            if not isinstance(other, _LiteralGenericAlias):
+                return NotImplemented
+            these_args_deduped = set(_value_and_type_iter(self.__args__))
+            other_args_deduped = set(_value_and_type_iter(other.__args__))
+            return these_args_deduped == other_args_deduped
+
+        def __hash__(self):
+            return hash(frozenset(_value_and_type_iter(self.__args__)))
+
+    class _LiteralForm(_ExtensionsSpecialForm, _root=True):
+        def __init__(self, doc: str):
+            self._name = 'Literal'
+            self._doc = self.__doc__ = doc
+
+        def __getitem__(self, parameters):
+            if not isinstance(parameters, tuple):
+                parameters = (parameters,)
+
+            parameters = _flatten_literal_params(parameters)
+
+            val_type_pairs = list(_value_and_type_iter(parameters))
+            try:
+                deduped_pairs = set(val_type_pairs)
+            except TypeError:
+                # unhashable parameters
+                pass
+            else:
+                # similar logic to typing._deduplicate on Python 3.9+
+                if len(deduped_pairs) < len(val_type_pairs):
+                    new_parameters = []
+                    for pair in val_type_pairs:
+                        if pair in deduped_pairs:
+                            new_parameters.append(pair[0])
+                            deduped_pairs.remove(pair)
+                    assert not deduped_pairs, deduped_pairs
+                    parameters = tuple(new_parameters)
+
+            return _LiteralGenericAlias(self, parameters)
+
+    Literal = _LiteralForm(doc="""\
+                           A type that can be used to indicate to type checkers
+                           that the corresponding value has a value literally equivalent
+                           to the provided parameter. For example:
+
+                               var: Literal[4] = 4
+
+                           The type checker understands that 'var' is literally equal to
+                           the value 4 and no other value.
+
+                           Literal[...] cannot be subclassed. There is no runtime
+                           checking verifying that the parameter is actually a value
+                           instead of a type.""")
+
+
+_overload_dummy = typing._overload_dummy
+
+
+if hasattr(typing, "get_overloads"):  # 3.11+
+    overload = typing.overload
+    get_overloads = typing.get_overloads
+    clear_overloads = typing.clear_overloads
+else:
+    # {module: {qualname: {firstlineno: func}}}
+    _overload_registry = collections.defaultdict(
+        functools.partial(collections.defaultdict, dict)
+    )
+
+    def overload(func):
+        """Decorator for overloaded functions/methods.
+
+        In a stub file, place two or more stub definitions for the same
+        function in a row, each decorated with @overload.  For example:
+
+        @overload
+        def utf8(value: None) -> None: ...
+        @overload
+        def utf8(value: bytes) -> bytes: ...
+        @overload
+        def utf8(value: str) -> bytes: ...
+
+        In a non-stub file (i.e. a regular .py file), do the same but
+        follow it with an implementation.  The implementation should *not*
+        be decorated with @overload.  For example:
+
+        @overload
+        def utf8(value: None) -> None: ...
+        @overload
+        def utf8(value: bytes) -> bytes: ...
+        @overload
+        def utf8(value: str) -> bytes: ...
+        def utf8(value):
+            # implementation goes here
+
+        The overloads for a function can be retrieved at runtime using the
+        get_overloads() function.
+        """
+        # classmethod and staticmethod
+        f = getattr(func, "__func__", func)
+        try:
+            _overload_registry[f.__module__][f.__qualname__][
+                f.__code__.co_firstlineno
+            ] = func
+        except AttributeError:
+            # Not a normal function; ignore.
+            pass
+        return _overload_dummy
+
+    def get_overloads(func):
+        """Return all defined overloads for *func* as a sequence."""
+        # classmethod and staticmethod
+        f = getattr(func, "__func__", func)
+        if f.__module__ not in _overload_registry:
+            return []
+        mod_dict = _overload_registry[f.__module__]
+        if f.__qualname__ not in mod_dict:
+            return []
+        return list(mod_dict[f.__qualname__].values())
+
+    def clear_overloads():
+        """Clear all overloads in the registry."""
+        _overload_registry.clear()
+
+
+# This is not a real generic class.  Don't use outside annotations.
+Type = typing.Type
+
+# Various ABCs mimicking those in collections.abc.
+# A few are simply re-exported for completeness.
+Awaitable = typing.Awaitable
+Coroutine = typing.Coroutine
+AsyncIterable = typing.AsyncIterable
+AsyncIterator = typing.AsyncIterator
+Deque = typing.Deque
+DefaultDict = typing.DefaultDict
+OrderedDict = typing.OrderedDict
+Counter = typing.Counter
+ChainMap = typing.ChainMap
+Text = typing.Text
+TYPE_CHECKING = typing.TYPE_CHECKING
+
+
+if sys.version_info >= (3, 13, 0, "beta"):
+    from typing import AsyncContextManager, AsyncGenerator, ContextManager, Generator
+else:
+    def _is_dunder(attr):
+        return attr.startswith('__') and attr.endswith('__')
+
+    # Python <3.9 doesn't have typing._SpecialGenericAlias
+    _special_generic_alias_base = getattr(
+        typing, "_SpecialGenericAlias", typing._GenericAlias
+    )
+
+    class _SpecialGenericAlias(_special_generic_alias_base, _root=True):
+        def __init__(self, origin, nparams, *, inst=True, name=None, defaults=()):
+            if _special_generic_alias_base is typing._GenericAlias:
+                # Python <3.9
+                self.__origin__ = origin
+                self._nparams = nparams
+                super().__init__(origin, nparams, special=True, inst=inst, name=name)
+            else:
+                # Python >= 3.9
+                super().__init__(origin, nparams, inst=inst, name=name)
+            self._defaults = defaults
+
+        def __setattr__(self, attr, val):
+            allowed_attrs = {'_name', '_inst', '_nparams', '_defaults'}
+            if _special_generic_alias_base is typing._GenericAlias:
+                # Python <3.9
+                allowed_attrs.add("__origin__")
+            if _is_dunder(attr) or attr in allowed_attrs:
+                object.__setattr__(self, attr, val)
+            else:
+                setattr(self.__origin__, attr, val)
+
+        @typing._tp_cache
+        def __getitem__(self, params):
+            if not isinstance(params, tuple):
+                params = (params,)
+            msg = "Parameters to generic types must be types."
+            params = tuple(typing._type_check(p, msg) for p in params)
+            if (
+                self._defaults
+                and len(params) < self._nparams
+                and len(params) + len(self._defaults) >= self._nparams
+            ):
+                params = (*params, *self._defaults[len(params) - self._nparams:])
+            actual_len = len(params)
+
+            if actual_len != self._nparams:
+                if self._defaults:
+                    expected = f"at least {self._nparams - len(self._defaults)}"
+                else:
+                    expected = str(self._nparams)
+                if not self._nparams:
+                    raise TypeError(f"{self} is not a generic class")
+                raise TypeError(
+                    f"Too {'many' if actual_len > self._nparams else 'few'}"
+                    f" arguments for {self};"
+                    f" actual {actual_len}, expected {expected}"
+                )
+            return self.copy_with(params)
+
+    _NoneType = type(None)
+    Generator = _SpecialGenericAlias(
+        collections.abc.Generator, 3, defaults=(_NoneType, _NoneType)
+    )
+    AsyncGenerator = _SpecialGenericAlias(
+        collections.abc.AsyncGenerator, 2, defaults=(_NoneType,)
+    )
+    ContextManager = _SpecialGenericAlias(
+        contextlib.AbstractContextManager,
+        2,
+        name="ContextManager",
+        defaults=(typing.Optional[bool],)
+    )
+    AsyncContextManager = _SpecialGenericAlias(
+        contextlib.AbstractAsyncContextManager,
+        2,
+        name="AsyncContextManager",
+        defaults=(typing.Optional[bool],)
+    )
+
+
+_PROTO_ALLOWLIST = {
+    'collections.abc': [
+        'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable',
+        'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', 'Buffer',
+    ],
+    'contextlib': ['AbstractContextManager', 'AbstractAsyncContextManager'],
+    'typing_extensions': ['Buffer'],
+}
+
+
+_EXCLUDED_ATTRS = frozenset(typing.EXCLUDED_ATTRIBUTES) | {
+    "__match_args__", "__protocol_attrs__", "__non_callable_proto_members__",
+    "__final__",
+}
+
+
+def _get_protocol_attrs(cls):
+    attrs = set()
+    for base in cls.__mro__[:-1]:  # without object
+        if base.__name__ in {'Protocol', 'Generic'}:
+            continue
+        annotations = getattr(base, '__annotations__', {})
+        for attr in (*base.__dict__, *annotations):
+            if (not attr.startswith('_abc_') and attr not in _EXCLUDED_ATTRS):
+                attrs.add(attr)
+    return attrs
+
+
+def _caller(depth=2):
+    try:
+        return sys._getframe(depth).f_globals.get('__name__', '__main__')
+    except (AttributeError, ValueError):  # For platforms without _getframe()
+        return None
+
+
+# `__match_args__` attribute was removed from protocol members in 3.13,
+# we want to backport this change to older Python versions.
+if sys.version_info >= (3, 13):
+    Protocol = typing.Protocol
+else:
+    def _allow_reckless_class_checks(depth=3):
+        """Allow instance and class checks for special stdlib modules.
+        The abc and functools modules indiscriminately call isinstance() and
+        issubclass() on the whole MRO of a user class, which may contain protocols.
+        """
+        return _caller(depth) in {'abc', 'functools', None}
+
+    def _no_init(self, *args, **kwargs):
+        if type(self)._is_protocol:
+            raise TypeError('Protocols cannot be instantiated')
+
+    def _type_check_issubclass_arg_1(arg):
+        """Raise TypeError if `arg` is not an instance of `type`
+        in `issubclass(arg, )`.
+
+        In most cases, this is verified by type.__subclasscheck__.
+        Checking it again unnecessarily would slow down issubclass() checks,
+        so, we don't perform this check unless we absolutely have to.
+
+        For various error paths, however,
+        we want to ensure that *this* error message is shown to the user
+        where relevant, rather than a typing.py-specific error message.
+        """
+        if not isinstance(arg, type):
+            # Same error message as for issubclass(1, int).
+            raise TypeError('issubclass() arg 1 must be a class')
+
+    # Inheriting from typing._ProtocolMeta isn't actually desirable,
+    # but is necessary to allow typing.Protocol and typing_extensions.Protocol
+    # to mix without getting TypeErrors about "metaclass conflict"
+    class _ProtocolMeta(type(typing.Protocol)):
+        # This metaclass is somewhat unfortunate,
+        # but is necessary for several reasons...
+        #
+        # NOTE: DO NOT call super() in any methods in this class
+        # That would call the methods on typing._ProtocolMeta on Python 3.8-3.11
+        # and those are slow
+        def __new__(mcls, name, bases, namespace, **kwargs):
+            if name == "Protocol" and len(bases) < 2:
+                pass
+            elif {Protocol, typing.Protocol} & set(bases):
+                for base in bases:
+                    if not (
+                        base in {object, typing.Generic, Protocol, typing.Protocol}
+                        or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__, [])
+                        or is_protocol(base)
+                    ):
+                        raise TypeError(
+                            f"Protocols can only inherit from other protocols, "
+                            f"got {base!r}"
+                        )
+            return abc.ABCMeta.__new__(mcls, name, bases, namespace, **kwargs)
+
+        def __init__(cls, *args, **kwargs):
+            abc.ABCMeta.__init__(cls, *args, **kwargs)
+            if getattr(cls, "_is_protocol", False):
+                cls.__protocol_attrs__ = _get_protocol_attrs(cls)
+
+        def __subclasscheck__(cls, other):
+            if cls is Protocol:
+                return type.__subclasscheck__(cls, other)
+            if (
+                getattr(cls, '_is_protocol', False)
+                and not _allow_reckless_class_checks()
+            ):
+                if not getattr(cls, '_is_runtime_protocol', False):
+                    _type_check_issubclass_arg_1(other)
+                    raise TypeError(
+                        "Instance and class checks can only be used with "
+                        "@runtime_checkable protocols"
+                    )
+                if (
+                    # this attribute is set by @runtime_checkable:
+                    cls.__non_callable_proto_members__
+                    and cls.__dict__.get("__subclasshook__") is _proto_hook
+                ):
+                    _type_check_issubclass_arg_1(other)
+                    non_method_attrs = sorted(cls.__non_callable_proto_members__)
+                    raise TypeError(
+                        "Protocols with non-method members don't support issubclass()."
+                        f" Non-method members: {str(non_method_attrs)[1:-1]}."
+                    )
+            return abc.ABCMeta.__subclasscheck__(cls, other)
+
+        def __instancecheck__(cls, instance):
+            # We need this method for situations where attributes are
+            # assigned in __init__.
+            if cls is Protocol:
+                return type.__instancecheck__(cls, instance)
+            if not getattr(cls, "_is_protocol", False):
+                # i.e., it's a concrete subclass of a protocol
+                return abc.ABCMeta.__instancecheck__(cls, instance)
+
+            if (
+                not getattr(cls, '_is_runtime_protocol', False) and
+                not _allow_reckless_class_checks()
+            ):
+                raise TypeError("Instance and class checks can only be used with"
+                                " @runtime_checkable protocols")
+
+            if abc.ABCMeta.__instancecheck__(cls, instance):
+                return True
+
+            for attr in cls.__protocol_attrs__:
+                try:
+                    val = inspect.getattr_static(instance, attr)
+                except AttributeError:
+                    break
+                # this attribute is set by @runtime_checkable:
+                if val is None and attr not in cls.__non_callable_proto_members__:
+                    break
+            else:
+                return True
+
+            return False
+
+        def __eq__(cls, other):
+            # Hack so that typing.Generic.__class_getitem__
+            # treats typing_extensions.Protocol
+            # as equivalent to typing.Protocol
+            if abc.ABCMeta.__eq__(cls, other) is True:
+                return True
+            return cls is Protocol and other is typing.Protocol
+
+        # This has to be defined, or the abc-module cache
+        # complains about classes with this metaclass being unhashable,
+        # if we define only __eq__!
+        def __hash__(cls) -> int:
+            return type.__hash__(cls)
+
+    @classmethod
+    def _proto_hook(cls, other):
+        if not cls.__dict__.get('_is_protocol', False):
+            return NotImplemented
+
+        for attr in cls.__protocol_attrs__:
+            for base in other.__mro__:
+                # Check if the members appears in the class dictionary...
+                if attr in base.__dict__:
+                    if base.__dict__[attr] is None:
+                        return NotImplemented
+                    break
+
+                # ...or in annotations, if it is a sub-protocol.
+                annotations = getattr(base, '__annotations__', {})
+                if (
+                    isinstance(annotations, collections.abc.Mapping)
+                    and attr in annotations
+                    and is_protocol(other)
+                ):
+                    break
+            else:
+                return NotImplemented
+        return True
+
+    class Protocol(typing.Generic, metaclass=_ProtocolMeta):
+        __doc__ = typing.Protocol.__doc__
+        __slots__ = ()
+        _is_protocol = True
+        _is_runtime_protocol = False
+
+        def __init_subclass__(cls, *args, **kwargs):
+            super().__init_subclass__(*args, **kwargs)
+
+            # Determine if this is a protocol or a concrete subclass.
+            if not cls.__dict__.get('_is_protocol', False):
+                cls._is_protocol = any(b is Protocol for b in cls.__bases__)
+
+            # Set (or override) the protocol subclass hook.
+            if '__subclasshook__' not in cls.__dict__:
+                cls.__subclasshook__ = _proto_hook
+
+            # Prohibit instantiation for protocol classes
+            if cls._is_protocol and cls.__init__ is Protocol.__init__:
+                cls.__init__ = _no_init
+
+
+if sys.version_info >= (3, 13):
+    runtime_checkable = typing.runtime_checkable
+else:
+    def runtime_checkable(cls):
+        """Mark a protocol class as a runtime protocol.
+
+        Such protocol can be used with isinstance() and issubclass().
+        Raise TypeError if applied to a non-protocol class.
+        This allows a simple-minded structural check very similar to
+        one trick ponies in collections.abc such as Iterable.
+
+        For example::
+
+            @runtime_checkable
+            class Closable(Protocol):
+                def close(self): ...
+
+            assert isinstance(open('/some/file'), Closable)
+
+        Warning: this will check only the presence of the required methods,
+        not their type signatures!
+        """
+        if not issubclass(cls, typing.Generic) or not getattr(cls, '_is_protocol', False):
+            raise TypeError(f'@runtime_checkable can be only applied to protocol classes,'
+                            f' got {cls!r}')
+        cls._is_runtime_protocol = True
+
+        # typing.Protocol classes on <=3.11 break if we execute this block,
+        # because typing.Protocol classes on <=3.11 don't have a
+        # `__protocol_attrs__` attribute, and this block relies on the
+        # `__protocol_attrs__` attribute. Meanwhile, typing.Protocol classes on 3.12.2+
+        # break if we *don't* execute this block, because *they* assume that all
+        # protocol classes have a `__non_callable_proto_members__` attribute
+        # (which this block sets)
+        if isinstance(cls, _ProtocolMeta) or sys.version_info >= (3, 12, 2):
+            # PEP 544 prohibits using issubclass()
+            # with protocols that have non-method members.
+            # See gh-113320 for why we compute this attribute here,
+            # rather than in `_ProtocolMeta.__init__`
+            cls.__non_callable_proto_members__ = set()
+            for attr in cls.__protocol_attrs__:
+                try:
+                    is_callable = callable(getattr(cls, attr, None))
+                except Exception as e:
+                    raise TypeError(
+                        f"Failed to determine whether protocol member {attr!r} "
+                        "is a method member"
+                    ) from e
+                else:
+                    if not is_callable:
+                        cls.__non_callable_proto_members__.add(attr)
+
+        return cls
+
+
+# The "runtime" alias exists for backwards compatibility.
+runtime = runtime_checkable
+
+
+# Our version of runtime-checkable protocols is faster on Python 3.8-3.11
+if sys.version_info >= (3, 12):
+    SupportsInt = typing.SupportsInt
+    SupportsFloat = typing.SupportsFloat
+    SupportsComplex = typing.SupportsComplex
+    SupportsBytes = typing.SupportsBytes
+    SupportsIndex = typing.SupportsIndex
+    SupportsAbs = typing.SupportsAbs
+    SupportsRound = typing.SupportsRound
+else:
+    @runtime_checkable
+    class SupportsInt(Protocol):
+        """An ABC with one abstract method __int__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __int__(self) -> int:
+            pass
+
+    @runtime_checkable
+    class SupportsFloat(Protocol):
+        """An ABC with one abstract method __float__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __float__(self) -> float:
+            pass
+
+    @runtime_checkable
+    class SupportsComplex(Protocol):
+        """An ABC with one abstract method __complex__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __complex__(self) -> complex:
+            pass
+
+    @runtime_checkable
+    class SupportsBytes(Protocol):
+        """An ABC with one abstract method __bytes__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __bytes__(self) -> bytes:
+            pass
+
+    @runtime_checkable
+    class SupportsIndex(Protocol):
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __index__(self) -> int:
+            pass
+
+    @runtime_checkable
+    class SupportsAbs(Protocol[T_co]):
+        """
+        An ABC with one abstract method __abs__ that is covariant in its return type.
+        """
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __abs__(self) -> T_co:
+            pass
+
+    @runtime_checkable
+    class SupportsRound(Protocol[T_co]):
+        """
+        An ABC with one abstract method __round__ that is covariant in its return type.
+        """
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __round__(self, ndigits: int = 0) -> T_co:
+            pass
+
+
+def _ensure_subclassable(mro_entries):
+    def inner(func):
+        if sys.implementation.name == "pypy" and sys.version_info < (3, 9):
+            cls_dict = {
+                "__call__": staticmethod(func),
+                "__mro_entries__": staticmethod(mro_entries)
+            }
+            t = type(func.__name__, (), cls_dict)
+            return functools.update_wrapper(t(), func)
+        else:
+            func.__mro_entries__ = mro_entries
+            return func
+    return inner
+
+
+# Update this to something like >=3.13.0b1 if and when
+# PEP 728 is implemented in CPython
+_PEP_728_IMPLEMENTED = False
+
+if _PEP_728_IMPLEMENTED:
+    # The standard library TypedDict in Python 3.8 does not store runtime information
+    # about which (if any) keys are optional.  See https://bugs.python.org/issue38834
+    # The standard library TypedDict in Python 3.9.0/1 does not honour the "total"
+    # keyword with old-style TypedDict().  See https://bugs.python.org/issue42059
+    # The standard library TypedDict below Python 3.11 does not store runtime
+    # information about optional and required keys when using Required or NotRequired.
+    # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11.
+    # Aaaand on 3.12 we add __orig_bases__ to TypedDict
+    # to enable better runtime introspection.
+    # On 3.13 we deprecate some odd ways of creating TypedDicts.
+    # Also on 3.13, PEP 705 adds the ReadOnly[] qualifier.
+    # PEP 728 (still pending) makes more changes.
+    TypedDict = typing.TypedDict
+    _TypedDictMeta = typing._TypedDictMeta
+    is_typeddict = typing.is_typeddict
+else:
+    # 3.10.0 and later
+    _TAKES_MODULE = "module" in inspect.signature(typing._type_check).parameters
+
+    def _get_typeddict_qualifiers(annotation_type):
+        while True:
+            annotation_origin = get_origin(annotation_type)
+            if annotation_origin is Annotated:
+                annotation_args = get_args(annotation_type)
+                if annotation_args:
+                    annotation_type = annotation_args[0]
+                else:
+                    break
+            elif annotation_origin is Required:
+                yield Required
+                annotation_type, = get_args(annotation_type)
+            elif annotation_origin is NotRequired:
+                yield NotRequired
+                annotation_type, = get_args(annotation_type)
+            elif annotation_origin is ReadOnly:
+                yield ReadOnly
+                annotation_type, = get_args(annotation_type)
+            else:
+                break
+
+    class _TypedDictMeta(type):
+        def __new__(cls, name, bases, ns, *, total=True, closed=False):
+            """Create new typed dict class object.
+
+            This method is called when TypedDict is subclassed,
+            or when TypedDict is instantiated. This way
+            TypedDict supports all three syntax forms described in its docstring.
+            Subclasses and instances of TypedDict return actual dictionaries.
+            """
+            for base in bases:
+                if type(base) is not _TypedDictMeta and base is not typing.Generic:
+                    raise TypeError('cannot inherit from both a TypedDict type '
+                                    'and a non-TypedDict base class')
+
+            if any(issubclass(b, typing.Generic) for b in bases):
+                generic_base = (typing.Generic,)
+            else:
+                generic_base = ()
+
+            # typing.py generally doesn't let you inherit from plain Generic, unless
+            # the name of the class happens to be "Protocol"
+            tp_dict = type.__new__(_TypedDictMeta, "Protocol", (*generic_base, dict), ns)
+            tp_dict.__name__ = name
+            if tp_dict.__qualname__ == "Protocol":
+                tp_dict.__qualname__ = name
+
+            if not hasattr(tp_dict, '__orig_bases__'):
+                tp_dict.__orig_bases__ = bases
+
+            annotations = {}
+            if "__annotations__" in ns:
+                own_annotations = ns["__annotations__"]
+            elif "__annotate__" in ns:
+                # TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
+                own_annotations = ns["__annotate__"](1)
+            else:
+                own_annotations = {}
+            msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type"
+            if _TAKES_MODULE:
+                own_annotations = {
+                    n: typing._type_check(tp, msg, module=tp_dict.__module__)
+                    for n, tp in own_annotations.items()
+                }
+            else:
+                own_annotations = {
+                    n: typing._type_check(tp, msg)
+                    for n, tp in own_annotations.items()
+                }
+            required_keys = set()
+            optional_keys = set()
+            readonly_keys = set()
+            mutable_keys = set()
+            extra_items_type = None
+
+            for base in bases:
+                base_dict = base.__dict__
+
+                annotations.update(base_dict.get('__annotations__', {}))
+                required_keys.update(base_dict.get('__required_keys__', ()))
+                optional_keys.update(base_dict.get('__optional_keys__', ()))
+                readonly_keys.update(base_dict.get('__readonly_keys__', ()))
+                mutable_keys.update(base_dict.get('__mutable_keys__', ()))
+                base_extra_items_type = base_dict.get('__extra_items__', None)
+                if base_extra_items_type is not None:
+                    extra_items_type = base_extra_items_type
+
+            if closed and extra_items_type is None:
+                extra_items_type = Never
+            if closed and "__extra_items__" in own_annotations:
+                annotation_type = own_annotations.pop("__extra_items__")
+                qualifiers = set(_get_typeddict_qualifiers(annotation_type))
+                if Required in qualifiers:
+                    raise TypeError(
+                        "Special key __extra_items__ does not support "
+                        "Required"
+                    )
+                if NotRequired in qualifiers:
+                    raise TypeError(
+                        "Special key __extra_items__ does not support "
+                        "NotRequired"
+                    )
+                extra_items_type = annotation_type
+
+            annotations.update(own_annotations)
+            for annotation_key, annotation_type in own_annotations.items():
+                qualifiers = set(_get_typeddict_qualifiers(annotation_type))
+
+                if Required in qualifiers:
+                    required_keys.add(annotation_key)
+                elif NotRequired in qualifiers:
+                    optional_keys.add(annotation_key)
+                elif total:
+                    required_keys.add(annotation_key)
+                else:
+                    optional_keys.add(annotation_key)
+                if ReadOnly in qualifiers:
+                    mutable_keys.discard(annotation_key)
+                    readonly_keys.add(annotation_key)
+                else:
+                    mutable_keys.add(annotation_key)
+                    readonly_keys.discard(annotation_key)
+
+            tp_dict.__annotations__ = annotations
+            tp_dict.__required_keys__ = frozenset(required_keys)
+            tp_dict.__optional_keys__ = frozenset(optional_keys)
+            tp_dict.__readonly_keys__ = frozenset(readonly_keys)
+            tp_dict.__mutable_keys__ = frozenset(mutable_keys)
+            if not hasattr(tp_dict, '__total__'):
+                tp_dict.__total__ = total
+            tp_dict.__closed__ = closed
+            tp_dict.__extra_items__ = extra_items_type
+            return tp_dict
+
+        __call__ = dict  # static method
+
+        def __subclasscheck__(cls, other):
+            # Typed dicts are only for static structural subtyping.
+            raise TypeError('TypedDict does not support instance and class checks')
+
+        __instancecheck__ = __subclasscheck__
+
+    _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
+
+    @_ensure_subclassable(lambda bases: (_TypedDict,))
+    def TypedDict(typename, fields=_marker, /, *, total=True, closed=False, **kwargs):
+        """A simple typed namespace. At runtime it is equivalent to a plain dict.
+
+        TypedDict creates a dictionary type such that a type checker will expect all
+        instances to have a certain set of keys, where each key is
+        associated with a value of a consistent type. This expectation
+        is not checked at runtime.
+
+        Usage::
+
+            class Point2D(TypedDict):
+                x: int
+                y: int
+                label: str
+
+            a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
+            b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check
+
+            assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
+
+        The type info can be accessed via the Point2D.__annotations__ dict, and
+        the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets.
+        TypedDict supports an additional equivalent form::
+
+            Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
+
+        By default, all keys must be present in a TypedDict. It is possible
+        to override this by specifying totality::
+
+            class Point2D(TypedDict, total=False):
+                x: int
+                y: int
+
+        This means that a Point2D TypedDict can have any of the keys omitted. A type
+        checker is only expected to support a literal False or True as the value of
+        the total argument. True is the default, and makes all items defined in the
+        class body be required.
+
+        The Required and NotRequired special forms can also be used to mark
+        individual keys as being required or not required::
+
+            class Point2D(TypedDict):
+                x: int  # the "x" key must always be present (Required is the default)
+                y: NotRequired[int]  # the "y" key can be omitted
+
+        See PEP 655 for more details on Required and NotRequired.
+        """
+        if fields is _marker or fields is None:
+            if fields is _marker:
+                deprecated_thing = "Failing to pass a value for the 'fields' parameter"
+            else:
+                deprecated_thing = "Passing `None` as the 'fields' parameter"
+
+            example = f"`{typename} = TypedDict({typename!r}, {{}})`"
+            deprecation_msg = (
+                f"{deprecated_thing} is deprecated and will be disallowed in "
+                "Python 3.15. To create a TypedDict class with 0 fields "
+                "using the functional syntax, pass an empty dictionary, e.g. "
+            ) + example + "."
+            warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2)
+            if closed is not False and closed is not True:
+                kwargs["closed"] = closed
+                closed = False
+            fields = kwargs
+        elif kwargs:
+            raise TypeError("TypedDict takes either a dict or keyword arguments,"
+                            " but not both")
+        if kwargs:
+            if sys.version_info >= (3, 13):
+                raise TypeError("TypedDict takes no keyword arguments")
+            warnings.warn(
+                "The kwargs-based syntax for TypedDict definitions is deprecated "
+                "in Python 3.11, will be removed in Python 3.13, and may not be "
+                "understood by third-party type checkers.",
+                DeprecationWarning,
+                stacklevel=2,
+            )
+
+        ns = {'__annotations__': dict(fields)}
+        module = _caller()
+        if module is not None:
+            # Setting correct module is necessary to make typed dict classes pickleable.
+            ns['__module__'] = module
+
+        td = _TypedDictMeta(typename, (), ns, total=total, closed=closed)
+        td.__orig_bases__ = (TypedDict,)
+        return td
+
+    if hasattr(typing, "_TypedDictMeta"):
+        _TYPEDDICT_TYPES = (typing._TypedDictMeta, _TypedDictMeta)
+    else:
+        _TYPEDDICT_TYPES = (_TypedDictMeta,)
+
+    def is_typeddict(tp):
+        """Check if an annotation is a TypedDict class
+
+        For example::
+            class Film(TypedDict):
+                title: str
+                year: int
+
+            is_typeddict(Film)  # => True
+            is_typeddict(Union[list, str])  # => False
+        """
+        # On 3.8, this would otherwise return True
+        if hasattr(typing, "TypedDict") and tp is typing.TypedDict:
+            return False
+        return isinstance(tp, _TYPEDDICT_TYPES)
+
+
+if hasattr(typing, "assert_type"):
+    assert_type = typing.assert_type
+
+else:
+    def assert_type(val, typ, /):
+        """Assert (to the type checker) that the value is of the given type.
+
+        When the type checker encounters a call to assert_type(), it
+        emits an error if the value is not of the specified type::
+
+            def greet(name: str) -> None:
+                assert_type(name, str)  # ok
+                assert_type(name, int)  # type checker error
+
+        At runtime this returns the first argument unchanged and otherwise
+        does nothing.
+        """
+        return val
+
+
+if hasattr(typing, "ReadOnly"):  # 3.13+
+    get_type_hints = typing.get_type_hints
+else:  # <=3.13
+    # replaces _strip_annotations()
+    def _strip_extras(t):
+        """Strips Annotated, Required and NotRequired from a given type."""
+        if isinstance(t, _AnnotatedAlias):
+            return _strip_extras(t.__origin__)
+        if hasattr(t, "__origin__") and t.__origin__ in (Required, NotRequired, ReadOnly):
+            return _strip_extras(t.__args__[0])
+        if isinstance(t, typing._GenericAlias):
+            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
+            if stripped_args == t.__args__:
+                return t
+            return t.copy_with(stripped_args)
+        if hasattr(_types, "GenericAlias") and isinstance(t, _types.GenericAlias):
+            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
+            if stripped_args == t.__args__:
+                return t
+            return _types.GenericAlias(t.__origin__, stripped_args)
+        if hasattr(_types, "UnionType") and isinstance(t, _types.UnionType):
+            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
+            if stripped_args == t.__args__:
+                return t
+            return functools.reduce(operator.or_, stripped_args)
+
+        return t
+
+    def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
+        """Return type hints for an object.
+
+        This is often the same as obj.__annotations__, but it handles
+        forward references encoded as string literals, adds Optional[t] if a
+        default value equal to None is set and recursively replaces all
+        'Annotated[T, ...]', 'Required[T]' or 'NotRequired[T]' with 'T'
+        (unless 'include_extras=True').
+
+        The argument may be a module, class, method, or function. The annotations
+        are returned as a dictionary. For classes, annotations include also
+        inherited members.
+
+        TypeError is raised if the argument is not of a type that can contain
+        annotations, and an empty dictionary is returned if no annotations are
+        present.
+
+        BEWARE -- the behavior of globalns and localns is counterintuitive
+        (unless you are familiar with how eval() and exec() work).  The
+        search order is locals first, then globals.
+
+        - If no dict arguments are passed, an attempt is made to use the
+          globals from obj (or the respective module's globals for classes),
+          and these are also used as the locals.  If the object does not appear
+          to have globals, an empty dictionary is used.
+
+        - If one dict argument is passed, it is used for both globals and
+          locals.
+
+        - If two dict arguments are passed, they specify globals and
+          locals, respectively.
+        """
+        if hasattr(typing, "Annotated"):  # 3.9+
+            hint = typing.get_type_hints(
+                obj, globalns=globalns, localns=localns, include_extras=True
+            )
+        else:  # 3.8
+            hint = typing.get_type_hints(obj, globalns=globalns, localns=localns)
+        if include_extras:
+            return hint
+        return {k: _strip_extras(t) for k, t in hint.items()}
+
+
+# Python 3.9+ has PEP 593 (Annotated)
+if hasattr(typing, 'Annotated'):
+    Annotated = typing.Annotated
+    # Not exported and not a public API, but needed for get_origin() and get_args()
+    # to work.
+    _AnnotatedAlias = typing._AnnotatedAlias
+# 3.8
+else:
+    class _AnnotatedAlias(typing._GenericAlias, _root=True):
+        """Runtime representation of an annotated type.
+
+        At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't'
+        with extra annotations. The alias behaves like a normal typing alias,
+        instantiating is the same as instantiating the underlying type, binding
+        it to types is also the same.
+        """
+        def __init__(self, origin, metadata):
+            if isinstance(origin, _AnnotatedAlias):
+                metadata = origin.__metadata__ + metadata
+                origin = origin.__origin__
+            super().__init__(origin, origin)
+            self.__metadata__ = metadata
+
+        def copy_with(self, params):
+            assert len(params) == 1
+            new_type = params[0]
+            return _AnnotatedAlias(new_type, self.__metadata__)
+
+        def __repr__(self):
+            return (f"typing_extensions.Annotated[{typing._type_repr(self.__origin__)}, "
+                    f"{', '.join(repr(a) for a in self.__metadata__)}]")
+
+        def __reduce__(self):
+            return operator.getitem, (
+                Annotated, (self.__origin__, *self.__metadata__)
+            )
+
+        def __eq__(self, other):
+            if not isinstance(other, _AnnotatedAlias):
+                return NotImplemented
+            if self.__origin__ != other.__origin__:
+                return False
+            return self.__metadata__ == other.__metadata__
+
+        def __hash__(self):
+            return hash((self.__origin__, self.__metadata__))
+
+    class Annotated:
+        """Add context specific metadata to a type.
+
+        Example: Annotated[int, runtime_check.Unsigned] indicates to the
+        hypothetical runtime_check module that this type is an unsigned int.
+        Every other consumer of this type can ignore this metadata and treat
+        this type as int.
+
+        The first argument to Annotated must be a valid type (and will be in
+        the __origin__ field), the remaining arguments are kept as a tuple in
+        the __extra__ field.
+
+        Details:
+
+        - It's an error to call `Annotated` with less than two arguments.
+        - Nested Annotated are flattened::
+
+            Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]
+
+        - Instantiating an annotated type is equivalent to instantiating the
+        underlying type::
+
+            Annotated[C, Ann1](5) == C(5)
+
+        - Annotated can be used as a generic type alias::
+
+            Optimized = Annotated[T, runtime.Optimize()]
+            Optimized[int] == Annotated[int, runtime.Optimize()]
+
+            OptimizedList = Annotated[List[T], runtime.Optimize()]
+            OptimizedList[int] == Annotated[List[int], runtime.Optimize()]
+        """
+
+        __slots__ = ()
+
+        def __new__(cls, *args, **kwargs):
+            raise TypeError("Type Annotated cannot be instantiated.")
+
+        @typing._tp_cache
+        def __class_getitem__(cls, params):
+            if not isinstance(params, tuple) or len(params) < 2:
+                raise TypeError("Annotated[...] should be used "
+                                "with at least two arguments (a type and an "
+                                "annotation).")
+            allowed_special_forms = (ClassVar, Final)
+            if get_origin(params[0]) in allowed_special_forms:
+                origin = params[0]
+            else:
+                msg = "Annotated[t, ...]: t must be a type."
+                origin = typing._type_check(params[0], msg)
+            metadata = tuple(params[1:])
+            return _AnnotatedAlias(origin, metadata)
+
+        def __init_subclass__(cls, *args, **kwargs):
+            raise TypeError(
+                f"Cannot subclass {cls.__module__}.Annotated"
+            )
+
+# Python 3.8 has get_origin() and get_args() but those implementations aren't
+# Annotated-aware, so we can't use those. Python 3.9's versions don't support
+# ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do.
+if sys.version_info[:2] >= (3, 10):
+    get_origin = typing.get_origin
+    get_args = typing.get_args
+# 3.8-3.9
+else:
+    try:
+        # 3.9+
+        from typing import _BaseGenericAlias
+    except ImportError:
+        _BaseGenericAlias = typing._GenericAlias
+    try:
+        # 3.9+
+        from typing import GenericAlias as _typing_GenericAlias
+    except ImportError:
+        _typing_GenericAlias = typing._GenericAlias
+
+    def get_origin(tp):
+        """Get the unsubscripted version of a type.
+
+        This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar
+        and Annotated. Return None for unsupported types. Examples::
+
+            get_origin(Literal[42]) is Literal
+            get_origin(int) is None
+            get_origin(ClassVar[int]) is ClassVar
+            get_origin(Generic) is Generic
+            get_origin(Generic[T]) is Generic
+            get_origin(Union[T, int]) is Union
+            get_origin(List[Tuple[T, T]][int]) == list
+            get_origin(P.args) is P
+        """
+        if isinstance(tp, _AnnotatedAlias):
+            return Annotated
+        if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias, _BaseGenericAlias,
+                           ParamSpecArgs, ParamSpecKwargs)):
+            return tp.__origin__
+        if tp is typing.Generic:
+            return typing.Generic
+        return None
+
+    def get_args(tp):
+        """Get type arguments with all substitutions performed.
+
+        For unions, basic simplifications used by Union constructor are performed.
+        Examples::
+            get_args(Dict[str, int]) == (str, int)
+            get_args(int) == ()
+            get_args(Union[int, Union[T, int], str][int]) == (int, str)
+            get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
+            get_args(Callable[[], T][int]) == ([], int)
+        """
+        if isinstance(tp, _AnnotatedAlias):
+            return (tp.__origin__, *tp.__metadata__)
+        if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias)):
+            if getattr(tp, "_special", False):
+                return ()
+            res = tp.__args__
+            if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis:
+                res = (list(res[:-1]), res[-1])
+            return res
+        return ()
+
+
+# 3.10+
+if hasattr(typing, 'TypeAlias'):
+    TypeAlias = typing.TypeAlias
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def TypeAlias(self, parameters):
+        """Special marker indicating that an assignment should
+        be recognized as a proper type alias definition by type
+        checkers.
+
+        For example::
+
+            Predicate: TypeAlias = Callable[..., bool]
+
+        It's invalid when used anywhere except as in the example above.
+        """
+        raise TypeError(f"{self} is not subscriptable")
+# 3.8
+else:
+    TypeAlias = _ExtensionsSpecialForm(
+        'TypeAlias',
+        doc="""Special marker indicating that an assignment should
+        be recognized as a proper type alias definition by type
+        checkers.
+
+        For example::
+
+            Predicate: TypeAlias = Callable[..., bool]
+
+        It's invalid when used anywhere except as in the example
+        above."""
+    )
+
+
+if hasattr(typing, "NoDefault"):
+    NoDefault = typing.NoDefault
+else:
+    class NoDefaultTypeMeta(type):
+        def __setattr__(cls, attr, value):
+            # TypeError is consistent with the behavior of NoneType
+            raise TypeError(
+                f"cannot set {attr!r} attribute of immutable type {cls.__name__!r}"
+            )
+
+    class NoDefaultType(metaclass=NoDefaultTypeMeta):
+        """The type of the NoDefault singleton."""
+
+        __slots__ = ()
+
+        def __new__(cls):
+            return globals().get("NoDefault") or object.__new__(cls)
+
+        def __repr__(self):
+            return "typing_extensions.NoDefault"
+
+        def __reduce__(self):
+            return "NoDefault"
+
+    NoDefault = NoDefaultType()
+    del NoDefaultType, NoDefaultTypeMeta
+
+
+def _set_default(type_param, default):
+    type_param.has_default = lambda: default is not NoDefault
+    type_param.__default__ = default
+
+
+def _set_module(typevarlike):
+    # for pickling:
+    def_mod = _caller(depth=3)
+    if def_mod != 'typing_extensions':
+        typevarlike.__module__ = def_mod
+
+
+class _DefaultMixin:
+    """Mixin for TypeVarLike defaults."""
+
+    __slots__ = ()
+    __init__ = _set_default
+
+
+# Classes using this metaclass must provide a _backported_typevarlike ClassVar
+class _TypeVarLikeMeta(type):
+    def __instancecheck__(cls, __instance: Any) -> bool:
+        return isinstance(__instance, cls._backported_typevarlike)
+
+
+if _PEP_696_IMPLEMENTED:
+    from typing import TypeVar
+else:
+    # Add default and infer_variance parameters from PEP 696 and 695
+    class TypeVar(metaclass=_TypeVarLikeMeta):
+        """Type variable."""
+
+        _backported_typevarlike = typing.TypeVar
+
+        def __new__(cls, name, *constraints, bound=None,
+                    covariant=False, contravariant=False,
+                    default=NoDefault, infer_variance=False):
+            if hasattr(typing, "TypeAliasType"):
+                # PEP 695 implemented (3.12+), can pass infer_variance to typing.TypeVar
+                typevar = typing.TypeVar(name, *constraints, bound=bound,
+                                         covariant=covariant, contravariant=contravariant,
+                                         infer_variance=infer_variance)
+            else:
+                typevar = typing.TypeVar(name, *constraints, bound=bound,
+                                         covariant=covariant, contravariant=contravariant)
+                if infer_variance and (covariant or contravariant):
+                    raise ValueError("Variance cannot be specified with infer_variance.")
+                typevar.__infer_variance__ = infer_variance
+
+            _set_default(typevar, default)
+            _set_module(typevar)
+
+            def _tvar_prepare_subst(alias, args):
+                if (
+                    typevar.has_default()
+                    and alias.__parameters__.index(typevar) == len(args)
+                ):
+                    args += (typevar.__default__,)
+                return args
+
+            typevar.__typing_prepare_subst__ = _tvar_prepare_subst
+            return typevar
+
+        def __init_subclass__(cls) -> None:
+            raise TypeError(f"type '{__name__}.TypeVar' is not an acceptable base type")
+
+
+# Python 3.10+ has PEP 612
+if hasattr(typing, 'ParamSpecArgs'):
+    ParamSpecArgs = typing.ParamSpecArgs
+    ParamSpecKwargs = typing.ParamSpecKwargs
+# 3.8-3.9
+else:
+    class _Immutable:
+        """Mixin to indicate that object should not be copied."""
+        __slots__ = ()
+
+        def __copy__(self):
+            return self
+
+        def __deepcopy__(self, memo):
+            return self
+
+    class ParamSpecArgs(_Immutable):
+        """The args for a ParamSpec object.
+
+        Given a ParamSpec object P, P.args is an instance of ParamSpecArgs.
+
+        ParamSpecArgs objects have a reference back to their ParamSpec:
+
+        P.args.__origin__ is P
+
+        This type is meant for runtime introspection and has no special meaning to
+        static type checkers.
+        """
+        def __init__(self, origin):
+            self.__origin__ = origin
+
+        def __repr__(self):
+            return f"{self.__origin__.__name__}.args"
+
+        def __eq__(self, other):
+            if not isinstance(other, ParamSpecArgs):
+                return NotImplemented
+            return self.__origin__ == other.__origin__
+
+    class ParamSpecKwargs(_Immutable):
+        """The kwargs for a ParamSpec object.
+
+        Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs.
+
+        ParamSpecKwargs objects have a reference back to their ParamSpec:
+
+        P.kwargs.__origin__ is P
+
+        This type is meant for runtime introspection and has no special meaning to
+        static type checkers.
+        """
+        def __init__(self, origin):
+            self.__origin__ = origin
+
+        def __repr__(self):
+            return f"{self.__origin__.__name__}.kwargs"
+
+        def __eq__(self, other):
+            if not isinstance(other, ParamSpecKwargs):
+                return NotImplemented
+            return self.__origin__ == other.__origin__
+
+
+if _PEP_696_IMPLEMENTED:
+    from typing import ParamSpec
+
+# 3.10+
+elif hasattr(typing, 'ParamSpec'):
+
+    # Add default parameter - PEP 696
+    class ParamSpec(metaclass=_TypeVarLikeMeta):
+        """Parameter specification."""
+
+        _backported_typevarlike = typing.ParamSpec
+
+        def __new__(cls, name, *, bound=None,
+                    covariant=False, contravariant=False,
+                    infer_variance=False, default=NoDefault):
+            if hasattr(typing, "TypeAliasType"):
+                # PEP 695 implemented, can pass infer_variance to typing.TypeVar
+                paramspec = typing.ParamSpec(name, bound=bound,
+                                             covariant=covariant,
+                                             contravariant=contravariant,
+                                             infer_variance=infer_variance)
+            else:
+                paramspec = typing.ParamSpec(name, bound=bound,
+                                             covariant=covariant,
+                                             contravariant=contravariant)
+                paramspec.__infer_variance__ = infer_variance
+
+            _set_default(paramspec, default)
+            _set_module(paramspec)
+
+            def _paramspec_prepare_subst(alias, args):
+                params = alias.__parameters__
+                i = params.index(paramspec)
+                if i == len(args) and paramspec.has_default():
+                    args = [*args, paramspec.__default__]
+                if i >= len(args):
+                    raise TypeError(f"Too few arguments for {alias}")
+                # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
+                if len(params) == 1 and not typing._is_param_expr(args[0]):
+                    assert i == 0
+                    args = (args,)
+                # Convert lists to tuples to help other libraries cache the results.
+                elif isinstance(args[i], list):
+                    args = (*args[:i], tuple(args[i]), *args[i + 1:])
+                return args
+
+            paramspec.__typing_prepare_subst__ = _paramspec_prepare_subst
+            return paramspec
+
+        def __init_subclass__(cls) -> None:
+            raise TypeError(f"type '{__name__}.ParamSpec' is not an acceptable base type")
+
+# 3.8-3.9
+else:
+
+    # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
+    class ParamSpec(list, _DefaultMixin):
+        """Parameter specification variable.
+
+        Usage::
+
+           P = ParamSpec('P')
+
+        Parameter specification variables exist primarily for the benefit of static
+        type checkers.  They are used to forward the parameter types of one
+        callable to another callable, a pattern commonly found in higher order
+        functions and decorators.  They are only valid when used in ``Concatenate``,
+        or s the first argument to ``Callable``. In Python 3.10 and higher,
+        they are also supported in user-defined Generics at runtime.
+        See class Generic for more information on generic types.  An
+        example for annotating a decorator::
+
+           T = TypeVar('T')
+           P = ParamSpec('P')
+
+           def add_logging(f: Callable[P, T]) -> Callable[P, T]:
+               '''A type-safe decorator to add logging to a function.'''
+               def inner(*args: P.args, **kwargs: P.kwargs) -> T:
+                   logging.info(f'{f.__name__} was called')
+                   return f(*args, **kwargs)
+               return inner
+
+           @add_logging
+           def add_two(x: float, y: float) -> float:
+               '''Add two numbers together.'''
+               return x + y
+
+        Parameter specification variables defined with covariant=True or
+        contravariant=True can be used to declare covariant or contravariant
+        generic types.  These keyword arguments are valid, but their actual semantics
+        are yet to be decided.  See PEP 612 for details.
+
+        Parameter specification variables can be introspected. e.g.:
+
+           P.__name__ == 'T'
+           P.__bound__ == None
+           P.__covariant__ == False
+           P.__contravariant__ == False
+
+        Note that only parameter specification variables defined in global scope can
+        be pickled.
+        """
+
+        # Trick Generic __parameters__.
+        __class__ = typing.TypeVar
+
+        @property
+        def args(self):
+            return ParamSpecArgs(self)
+
+        @property
+        def kwargs(self):
+            return ParamSpecKwargs(self)
+
+        def __init__(self, name, *, bound=None, covariant=False, contravariant=False,
+                     infer_variance=False, default=NoDefault):
+            list.__init__(self, [self])
+            self.__name__ = name
+            self.__covariant__ = bool(covariant)
+            self.__contravariant__ = bool(contravariant)
+            self.__infer_variance__ = bool(infer_variance)
+            if bound:
+                self.__bound__ = typing._type_check(bound, 'Bound must be a type.')
+            else:
+                self.__bound__ = None
+            _DefaultMixin.__init__(self, default)
+
+            # for pickling:
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+
+        def __repr__(self):
+            if self.__infer_variance__:
+                prefix = ''
+            elif self.__covariant__:
+                prefix = '+'
+            elif self.__contravariant__:
+                prefix = '-'
+            else:
+                prefix = '~'
+            return prefix + self.__name__
+
+        def __hash__(self):
+            return object.__hash__(self)
+
+        def __eq__(self, other):
+            return self is other
+
+        def __reduce__(self):
+            return self.__name__
+
+        # Hack to get typing._type_check to pass.
+        def __call__(self, *args, **kwargs):
+            pass
+
+
+# 3.8-3.9
+if not hasattr(typing, 'Concatenate'):
+    # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
+    class _ConcatenateGenericAlias(list):
+
+        # Trick Generic into looking into this for __parameters__.
+        __class__ = typing._GenericAlias
+
+        # Flag in 3.8.
+        _special = False
+
+        def __init__(self, origin, args):
+            super().__init__(args)
+            self.__origin__ = origin
+            self.__args__ = args
+
+        def __repr__(self):
+            _type_repr = typing._type_repr
+            return (f'{_type_repr(self.__origin__)}'
+                    f'[{", ".join(_type_repr(arg) for arg in self.__args__)}]')
+
+        def __hash__(self):
+            return hash((self.__origin__, self.__args__))
+
+        # Hack to get typing._type_check to pass in Generic.
+        def __call__(self, *args, **kwargs):
+            pass
+
+        @property
+        def __parameters__(self):
+            return tuple(
+                tp for tp in self.__args__ if isinstance(tp, (typing.TypeVar, ParamSpec))
+            )
+
+
+# 3.8-3.9
+@typing._tp_cache
+def _concatenate_getitem(self, parameters):
+    if parameters == ():
+        raise TypeError("Cannot take a Concatenate of no types.")
+    if not isinstance(parameters, tuple):
+        parameters = (parameters,)
+    if not isinstance(parameters[-1], ParamSpec):
+        raise TypeError("The last parameter to Concatenate should be a "
+                        "ParamSpec variable.")
+    msg = "Concatenate[arg, ...]: each arg must be a type."
+    parameters = tuple(typing._type_check(p, msg) for p in parameters)
+    return _ConcatenateGenericAlias(self, parameters)
+
+
+# 3.10+
+if hasattr(typing, 'Concatenate'):
+    Concatenate = typing.Concatenate
+    _ConcatenateGenericAlias = typing._ConcatenateGenericAlias
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def Concatenate(self, parameters):
+        """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
+        higher order function which adds, removes or transforms parameters of a
+        callable.
+
+        For example::
+
+           Callable[Concatenate[int, P], int]
+
+        See PEP 612 for detailed information.
+        """
+        return _concatenate_getitem(self, parameters)
+# 3.8
+else:
+    class _ConcatenateForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            return _concatenate_getitem(self, parameters)
+
+    Concatenate = _ConcatenateForm(
+        'Concatenate',
+        doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
+        higher order function which adds, removes or transforms parameters of a
+        callable.
+
+        For example::
+
+           Callable[Concatenate[int, P], int]
+
+        See PEP 612 for detailed information.
+        """)
+
+# 3.10+
+if hasattr(typing, 'TypeGuard'):
+    TypeGuard = typing.TypeGuard
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def TypeGuard(self, parameters):
+        """Special typing form used to annotate the return type of a user-defined
+        type guard function.  ``TypeGuard`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeGuard[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeGuard`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the type inside ``TypeGuard``.
+
+        For example::
+
+            def is_str(val: Union[str, float]):
+                # "isinstance" type guard
+                if isinstance(val, str):
+                    # Type of ``val`` is narrowed to ``str``
+                    ...
+                else:
+                    # Else, type of ``val`` is narrowed to ``float``.
+                    ...
+
+        Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
+        form of ``TypeA`` (it can even be a wider form) and this may lead to
+        type-unsafe results.  The main reason is to allow for things like
+        narrowing ``List[object]`` to ``List[str]`` even though the latter is not
+        a subtype of the former, since ``List`` is invariant.  The responsibility of
+        writing type-safe type guards is left to the user.
+
+        ``TypeGuard`` also works with type variables.  For more information, see
+        PEP 647 (User-Defined Type Guards).
+        """
+        item = typing._type_check(parameters, f'{self} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+# 3.8
+else:
+    class _TypeGuardForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type')
+            return typing._GenericAlias(self, (item,))
+
+    TypeGuard = _TypeGuardForm(
+        'TypeGuard',
+        doc="""Special typing form used to annotate the return type of a user-defined
+        type guard function.  ``TypeGuard`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeGuard[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeGuard`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the type inside ``TypeGuard``.
+
+        For example::
+
+            def is_str(val: Union[str, float]):
+                # "isinstance" type guard
+                if isinstance(val, str):
+                    # Type of ``val`` is narrowed to ``str``
+                    ...
+                else:
+                    # Else, type of ``val`` is narrowed to ``float``.
+                    ...
+
+        Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
+        form of ``TypeA`` (it can even be a wider form) and this may lead to
+        type-unsafe results.  The main reason is to allow for things like
+        narrowing ``List[object]`` to ``List[str]`` even though the latter is not
+        a subtype of the former, since ``List`` is invariant.  The responsibility of
+        writing type-safe type guards is left to the user.
+
+        ``TypeGuard`` also works with type variables.  For more information, see
+        PEP 647 (User-Defined Type Guards).
+        """)
+
+# 3.13+
+if hasattr(typing, 'TypeIs'):
+    TypeIs = typing.TypeIs
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def TypeIs(self, parameters):
+        """Special typing form used to annotate the return type of a user-defined
+        type narrower function.  ``TypeIs`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeIs[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeIs`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the intersection of the type inside ``TypeGuard`` and the argument's
+        previously known type.
+
+        For example::
+
+            def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
+                return hasattr(val, '__await__')
+
+            def f(val: Union[int, Awaitable[int]]) -> int:
+                if is_awaitable(val):
+                    assert_type(val, Awaitable[int])
+                else:
+                    assert_type(val, int)
+
+        ``TypeIs`` also works with type variables.  For more information, see
+        PEP 742 (Narrowing types with TypeIs).
+        """
+        item = typing._type_check(parameters, f'{self} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+# 3.8
+else:
+    class _TypeIsForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type')
+            return typing._GenericAlias(self, (item,))
+
+    TypeIs = _TypeIsForm(
+        'TypeIs',
+        doc="""Special typing form used to annotate the return type of a user-defined
+        type narrower function.  ``TypeIs`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeIs[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeIs`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the intersection of the type inside ``TypeGuard`` and the argument's
+        previously known type.
+
+        For example::
+
+            def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
+                return hasattr(val, '__await__')
+
+            def f(val: Union[int, Awaitable[int]]) -> int:
+                if is_awaitable(val):
+                    assert_type(val, Awaitable[int])
+                else:
+                    assert_type(val, int)
+
+        ``TypeIs`` also works with type variables.  For more information, see
+        PEP 742 (Narrowing types with TypeIs).
+        """)
+
+
+# Vendored from cpython typing._SpecialFrom
+class _SpecialForm(typing._Final, _root=True):
+    __slots__ = ('_name', '__doc__', '_getitem')
+
+    def __init__(self, getitem):
+        self._getitem = getitem
+        self._name = getitem.__name__
+        self.__doc__ = getitem.__doc__
+
+    def __getattr__(self, item):
+        if item in {'__name__', '__qualname__'}:
+            return self._name
+
+        raise AttributeError(item)
+
+    def __mro_entries__(self, bases):
+        raise TypeError(f"Cannot subclass {self!r}")
+
+    def __repr__(self):
+        return f'typing_extensions.{self._name}'
+
+    def __reduce__(self):
+        return self._name
+
+    def __call__(self, *args, **kwds):
+        raise TypeError(f"Cannot instantiate {self!r}")
+
+    def __or__(self, other):
+        return typing.Union[self, other]
+
+    def __ror__(self, other):
+        return typing.Union[other, self]
+
+    def __instancecheck__(self, obj):
+        raise TypeError(f"{self} cannot be used with isinstance()")
+
+    def __subclasscheck__(self, cls):
+        raise TypeError(f"{self} cannot be used with issubclass()")
+
+    @typing._tp_cache
+    def __getitem__(self, parameters):
+        return self._getitem(self, parameters)
+
+
+if hasattr(typing, "LiteralString"):  # 3.11+
+    LiteralString = typing.LiteralString
+else:
+    @_SpecialForm
+    def LiteralString(self, params):
+        """Represents an arbitrary literal string.
+
+        Example::
+
+          from typing_extensions import LiteralString
+
+          def query(sql: LiteralString) -> ...:
+              ...
+
+          query("SELECT * FROM table")  # ok
+          query(f"SELECT * FROM {input()}")  # not ok
+
+        See PEP 675 for details.
+
+        """
+        raise TypeError(f"{self} is not subscriptable")
+
+
+if hasattr(typing, "Self"):  # 3.11+
+    Self = typing.Self
+else:
+    @_SpecialForm
+    def Self(self, params):
+        """Used to spell the type of "self" in classes.
+
+        Example::
+
+          from typing import Self
+
+          class ReturnsSelf:
+              def parse(self, data: bytes) -> Self:
+                  ...
+                  return self
+
+        """
+
+        raise TypeError(f"{self} is not subscriptable")
+
+
+if hasattr(typing, "Never"):  # 3.11+
+    Never = typing.Never
+else:
+    @_SpecialForm
+    def Never(self, params):
+        """The bottom type, a type that has no members.
+
+        This can be used to define a function that should never be
+        called, or a function that never returns::
+
+            from typing_extensions import Never
+
+            def never_call_me(arg: Never) -> None:
+                pass
+
+            def int_or_str(arg: int | str) -> None:
+                never_call_me(arg)  # type checker error
+                match arg:
+                    case int():
+                        print("It's an int")
+                    case str():
+                        print("It's a str")
+                    case _:
+                        never_call_me(arg)  # ok, arg is of type Never
+
+        """
+
+        raise TypeError(f"{self} is not subscriptable")
+
+
+if hasattr(typing, 'Required'):  # 3.11+
+    Required = typing.Required
+    NotRequired = typing.NotRequired
+elif sys.version_info[:2] >= (3, 9):  # 3.9-3.10
+    @_ExtensionsSpecialForm
+    def Required(self, parameters):
+        """A special typing construct to mark a key of a total=False TypedDict
+        as required. For example:
+
+            class Movie(TypedDict, total=False):
+                title: Required[str]
+                year: int
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+
+        There is no runtime checking that a required key is actually provided
+        when instantiating a related TypedDict.
+        """
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+
+    @_ExtensionsSpecialForm
+    def NotRequired(self, parameters):
+        """A special typing construct to mark a key of a TypedDict as
+        potentially missing. For example:
+
+            class Movie(TypedDict):
+                title: str
+                year: NotRequired[int]
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+        """
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+
+else:  # 3.8
+    class _RequiredForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type.')
+            return typing._GenericAlias(self, (item,))
+
+    Required = _RequiredForm(
+        'Required',
+        doc="""A special typing construct to mark a key of a total=False TypedDict
+        as required. For example:
+
+            class Movie(TypedDict, total=False):
+                title: Required[str]
+                year: int
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+
+        There is no runtime checking that a required key is actually provided
+        when instantiating a related TypedDict.
+        """)
+    NotRequired = _RequiredForm(
+        'NotRequired',
+        doc="""A special typing construct to mark a key of a TypedDict as
+        potentially missing. For example:
+
+            class Movie(TypedDict):
+                title: str
+                year: NotRequired[int]
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+        """)
+
+
+if hasattr(typing, 'ReadOnly'):
+    ReadOnly = typing.ReadOnly
+elif sys.version_info[:2] >= (3, 9):  # 3.9-3.12
+    @_ExtensionsSpecialForm
+    def ReadOnly(self, parameters):
+        """A special typing construct to mark an item of a TypedDict as read-only.
+
+        For example:
+
+            class Movie(TypedDict):
+                title: ReadOnly[str]
+                year: int
+
+            def mutate_movie(m: Movie) -> None:
+                m["year"] = 1992  # allowed
+                m["title"] = "The Matrix"  # typechecker error
+
+        There is no runtime checking for this property.
+        """
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+
+else:  # 3.8
+    class _ReadOnlyForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type.')
+            return typing._GenericAlias(self, (item,))
+
+    ReadOnly = _ReadOnlyForm(
+        'ReadOnly',
+        doc="""A special typing construct to mark a key of a TypedDict as read-only.
+
+        For example:
+
+            class Movie(TypedDict):
+                title: ReadOnly[str]
+                year: int
+
+            def mutate_movie(m: Movie) -> None:
+                m["year"] = 1992  # allowed
+                m["title"] = "The Matrix"  # typechecker error
+
+        There is no runtime checking for this propery.
+        """)
+
+
+_UNPACK_DOC = """\
+Type unpack operator.
+
+The type unpack operator takes the child types from some container type,
+such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For
+example:
+
+  # For some generic class `Foo`:
+  Foo[Unpack[tuple[int, str]]]  # Equivalent to Foo[int, str]
+
+  Ts = TypeVarTuple('Ts')
+  # Specifies that `Bar` is generic in an arbitrary number of types.
+  # (Think of `Ts` as a tuple of an arbitrary number of individual
+  #  `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
+  #  `Generic[]`.)
+  class Bar(Generic[Unpack[Ts]]): ...
+  Bar[int]  # Valid
+  Bar[int, str]  # Also valid
+
+From Python 3.11, this can also be done using the `*` operator:
+
+    Foo[*tuple[int, str]]
+    class Bar(Generic[*Ts]): ...
+
+The operator can also be used along with a `TypedDict` to annotate
+`**kwargs` in a function signature. For instance:
+
+  class Movie(TypedDict):
+    name: str
+    year: int
+
+  # This function expects two keyword arguments - *name* of type `str` and
+  # *year* of type `int`.
+  def foo(**kwargs: Unpack[Movie]): ...
+
+Note that there is only some runtime checking of this operator. Not
+everything the runtime allows may be accepted by static type checkers.
+
+For more information, see PEP 646 and PEP 692.
+"""
+
+
+if sys.version_info >= (3, 12):  # PEP 692 changed the repr of Unpack[]
+    Unpack = typing.Unpack
+
+    def _is_unpack(obj):
+        return get_origin(obj) is Unpack
+
+elif sys.version_info[:2] >= (3, 9):  # 3.9+
+    class _UnpackSpecialForm(_ExtensionsSpecialForm, _root=True):
+        def __init__(self, getitem):
+            super().__init__(getitem)
+            self.__doc__ = _UNPACK_DOC
+
+    class _UnpackAlias(typing._GenericAlias, _root=True):
+        __class__ = typing.TypeVar
+
+        @property
+        def __typing_unpacked_tuple_args__(self):
+            assert self.__origin__ is Unpack
+            assert len(self.__args__) == 1
+            arg, = self.__args__
+            if isinstance(arg, (typing._GenericAlias, _types.GenericAlias)):
+                if arg.__origin__ is not tuple:
+                    raise TypeError("Unpack[...] must be used with a tuple type")
+                return arg.__args__
+            return None
+
+    @_UnpackSpecialForm
+    def Unpack(self, parameters):
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return _UnpackAlias(self, (item,))
+
+    def _is_unpack(obj):
+        return isinstance(obj, _UnpackAlias)
+
+else:  # 3.8
+    class _UnpackAlias(typing._GenericAlias, _root=True):
+        __class__ = typing.TypeVar
+
+    class _UnpackForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type.')
+            return _UnpackAlias(self, (item,))
+
+    Unpack = _UnpackForm('Unpack', doc=_UNPACK_DOC)
+
+    def _is_unpack(obj):
+        return isinstance(obj, _UnpackAlias)
+
+
+if _PEP_696_IMPLEMENTED:
+    from typing import TypeVarTuple
+
+elif hasattr(typing, "TypeVarTuple"):  # 3.11+
+
+    def _unpack_args(*args):
+        newargs = []
+        for arg in args:
+            subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
+            if subargs is not None and not (subargs and subargs[-1] is ...):
+                newargs.extend(subargs)
+            else:
+                newargs.append(arg)
+        return newargs
+
+    # Add default parameter - PEP 696
+    class TypeVarTuple(metaclass=_TypeVarLikeMeta):
+        """Type variable tuple."""
+
+        _backported_typevarlike = typing.TypeVarTuple
+
+        def __new__(cls, name, *, default=NoDefault):
+            tvt = typing.TypeVarTuple(name)
+            _set_default(tvt, default)
+            _set_module(tvt)
+
+            def _typevartuple_prepare_subst(alias, args):
+                params = alias.__parameters__
+                typevartuple_index = params.index(tvt)
+                for param in params[typevartuple_index + 1:]:
+                    if isinstance(param, TypeVarTuple):
+                        raise TypeError(
+                            f"More than one TypeVarTuple parameter in {alias}"
+                        )
+
+                alen = len(args)
+                plen = len(params)
+                left = typevartuple_index
+                right = plen - typevartuple_index - 1
+                var_tuple_index = None
+                fillarg = None
+                for k, arg in enumerate(args):
+                    if not isinstance(arg, type):
+                        subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
+                        if subargs and len(subargs) == 2 and subargs[-1] is ...:
+                            if var_tuple_index is not None:
+                                raise TypeError(
+                                    "More than one unpacked "
+                                    "arbitrary-length tuple argument"
+                                )
+                            var_tuple_index = k
+                            fillarg = subargs[0]
+                if var_tuple_index is not None:
+                    left = min(left, var_tuple_index)
+                    right = min(right, alen - var_tuple_index - 1)
+                elif left + right > alen:
+                    raise TypeError(f"Too few arguments for {alias};"
+                                    f" actual {alen}, expected at least {plen - 1}")
+                if left == alen - right and tvt.has_default():
+                    replacement = _unpack_args(tvt.__default__)
+                else:
+                    replacement = args[left: alen - right]
+
+                return (
+                    *args[:left],
+                    *([fillarg] * (typevartuple_index - left)),
+                    replacement,
+                    *([fillarg] * (plen - right - left - typevartuple_index - 1)),
+                    *args[alen - right:],
+                )
+
+            tvt.__typing_prepare_subst__ = _typevartuple_prepare_subst
+            return tvt
+
+        def __init_subclass__(self, *args, **kwds):
+            raise TypeError("Cannot subclass special typing classes")
+
+else:  # <=3.10
+    class TypeVarTuple(_DefaultMixin):
+        """Type variable tuple.
+
+        Usage::
+
+            Ts = TypeVarTuple('Ts')
+
+        In the same way that a normal type variable is a stand-in for a single
+        type such as ``int``, a type variable *tuple* is a stand-in for a *tuple*
+        type such as ``Tuple[int, str]``.
+
+        Type variable tuples can be used in ``Generic`` declarations.
+        Consider the following example::
+
+            class Array(Generic[*Ts]): ...
+
+        The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``,
+        where ``T1`` and ``T2`` are type variables. To use these type variables
+        as type parameters of ``Array``, we must *unpack* the type variable tuple using
+        the star operator: ``*Ts``. The signature of ``Array`` then behaves
+        as if we had simply written ``class Array(Generic[T1, T2]): ...``.
+        In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows
+        us to parameterise the class with an *arbitrary* number of type parameters.
+
+        Type variable tuples can be used anywhere a normal ``TypeVar`` can.
+        This includes class definitions, as shown above, as well as function
+        signatures and variable annotations::
+
+            class Array(Generic[*Ts]):
+
+                def __init__(self, shape: Tuple[*Ts]):
+                    self._shape: Tuple[*Ts] = shape
+
+                def get_shape(self) -> Tuple[*Ts]:
+                    return self._shape
+
+            shape = (Height(480), Width(640))
+            x: Array[Height, Width] = Array(shape)
+            y = abs(x)  # Inferred type is Array[Height, Width]
+            z = x + x   #        ...    is Array[Height, Width]
+            x.get_shape()  #     ...    is tuple[Height, Width]
+
+        """
+
+        # Trick Generic __parameters__.
+        __class__ = typing.TypeVar
+
+        def __iter__(self):
+            yield self.__unpacked__
+
+        def __init__(self, name, *, default=NoDefault):
+            self.__name__ = name
+            _DefaultMixin.__init__(self, default)
+
+            # for pickling:
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+
+            self.__unpacked__ = Unpack[self]
+
+        def __repr__(self):
+            return self.__name__
+
+        def __hash__(self):
+            return object.__hash__(self)
+
+        def __eq__(self, other):
+            return self is other
+
+        def __reduce__(self):
+            return self.__name__
+
+        def __init_subclass__(self, *args, **kwds):
+            if '_root' not in kwds:
+                raise TypeError("Cannot subclass special typing classes")
+
+
+if hasattr(typing, "reveal_type"):  # 3.11+
+    reveal_type = typing.reveal_type
+else:  # <=3.10
+    def reveal_type(obj: T, /) -> T:
+        """Reveal the inferred type of a variable.
+
+        When a static type checker encounters a call to ``reveal_type()``,
+        it will emit the inferred type of the argument::
+
+            x: int = 1
+            reveal_type(x)
+
+        Running a static type checker (e.g., ``mypy``) on this example
+        will produce output similar to 'Revealed type is "builtins.int"'.
+
+        At runtime, the function prints the runtime type of the
+        argument and returns it unchanged.
+
+        """
+        print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr)
+        return obj
+
+
+if hasattr(typing, "_ASSERT_NEVER_REPR_MAX_LENGTH"):  # 3.11+
+    _ASSERT_NEVER_REPR_MAX_LENGTH = typing._ASSERT_NEVER_REPR_MAX_LENGTH
+else:  # <=3.10
+    _ASSERT_NEVER_REPR_MAX_LENGTH = 100
+
+
+if hasattr(typing, "assert_never"):  # 3.11+
+    assert_never = typing.assert_never
+else:  # <=3.10
+    def assert_never(arg: Never, /) -> Never:
+        """Assert to the type checker that a line of code is unreachable.
+
+        Example::
+
+            def int_or_str(arg: int | str) -> None:
+                match arg:
+                    case int():
+                        print("It's an int")
+                    case str():
+                        print("It's a str")
+                    case _:
+                        assert_never(arg)
+
+        If a type checker finds that a call to assert_never() is
+        reachable, it will emit an error.
+
+        At runtime, this throws an exception when called.
+
+        """
+        value = repr(arg)
+        if len(value) > _ASSERT_NEVER_REPR_MAX_LENGTH:
+            value = value[:_ASSERT_NEVER_REPR_MAX_LENGTH] + '...'
+        raise AssertionError(f"Expected code to be unreachable, but got: {value}")
+
+
+if sys.version_info >= (3, 12):  # 3.12+
+    # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
+    dataclass_transform = typing.dataclass_transform
+else:  # <=3.11
+    def dataclass_transform(
+        *,
+        eq_default: bool = True,
+        order_default: bool = False,
+        kw_only_default: bool = False,
+        frozen_default: bool = False,
+        field_specifiers: typing.Tuple[
+            typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
+            ...
+        ] = (),
+        **kwargs: typing.Any,
+    ) -> typing.Callable[[T], T]:
+        """Decorator that marks a function, class, or metaclass as providing
+        dataclass-like behavior.
+
+        Example:
+
+            from typing_extensions import dataclass_transform
+
+            _T = TypeVar("_T")
+
+            # Used on a decorator function
+            @dataclass_transform()
+            def create_model(cls: type[_T]) -> type[_T]:
+                ...
+                return cls
+
+            @create_model
+            class CustomerModel:
+                id: int
+                name: str
+
+            # Used on a base class
+            @dataclass_transform()
+            class ModelBase: ...
+
+            class CustomerModel(ModelBase):
+                id: int
+                name: str
+
+            # Used on a metaclass
+            @dataclass_transform()
+            class ModelMeta(type): ...
+
+            class ModelBase(metaclass=ModelMeta): ...
+
+            class CustomerModel(ModelBase):
+                id: int
+                name: str
+
+        Each of the ``CustomerModel`` classes defined in this example will now
+        behave similarly to a dataclass created with the ``@dataclasses.dataclass``
+        decorator. For example, the type checker will synthesize an ``__init__``
+        method.
+
+        The arguments to this decorator can be used to customize this behavior:
+        - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be
+          True or False if it is omitted by the caller.
+        - ``order_default`` indicates whether the ``order`` parameter is
+          assumed to be True or False if it is omitted by the caller.
+        - ``kw_only_default`` indicates whether the ``kw_only`` parameter is
+          assumed to be True or False if it is omitted by the caller.
+        - ``frozen_default`` indicates whether the ``frozen`` parameter is
+          assumed to be True or False if it is omitted by the caller.
+        - ``field_specifiers`` specifies a static list of supported classes
+          or functions that describe fields, similar to ``dataclasses.field()``.
+
+        At runtime, this decorator records its arguments in the
+        ``__dataclass_transform__`` attribute on the decorated object.
+
+        See PEP 681 for details.
+
+        """
+        def decorator(cls_or_fn):
+            cls_or_fn.__dataclass_transform__ = {
+                "eq_default": eq_default,
+                "order_default": order_default,
+                "kw_only_default": kw_only_default,
+                "frozen_default": frozen_default,
+                "field_specifiers": field_specifiers,
+                "kwargs": kwargs,
+            }
+            return cls_or_fn
+        return decorator
+
+
+if hasattr(typing, "override"):  # 3.12+
+    override = typing.override
+else:  # <=3.11
+    _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any])
+
+    def override(arg: _F, /) -> _F:
+        """Indicate that a method is intended to override a method in a base class.
+
+        Usage:
+
+            class Base:
+                def method(self) -> None:
+                    pass
+
+            class Child(Base):
+                @override
+                def method(self) -> None:
+                    super().method()
+
+        When this decorator is applied to a method, the type checker will
+        validate that it overrides a method with the same name on a base class.
+        This helps prevent bugs that may occur when a base class is changed
+        without an equivalent change to a child class.
+
+        There is no runtime checking of these properties. The decorator
+        sets the ``__override__`` attribute to ``True`` on the decorated object
+        to allow runtime introspection.
+
+        See PEP 698 for details.
+
+        """
+        try:
+            arg.__override__ = True
+        except (AttributeError, TypeError):
+            # Skip the attribute silently if it is not writable.
+            # AttributeError happens if the object has __slots__ or a
+            # read-only property, TypeError if it's a builtin class.
+            pass
+        return arg
+
+
+if hasattr(warnings, "deprecated"):
+    deprecated = warnings.deprecated
+else:
+    _T = typing.TypeVar("_T")
+
+    class deprecated:
+        """Indicate that a class, function or overload is deprecated.
+
+        When this decorator is applied to an object, the type checker
+        will generate a diagnostic on usage of the deprecated object.
+
+        Usage:
+
+            @deprecated("Use B instead")
+            class A:
+                pass
+
+            @deprecated("Use g instead")
+            def f():
+                pass
+
+            @overload
+            @deprecated("int support is deprecated")
+            def g(x: int) -> int: ...
+            @overload
+            def g(x: str) -> int: ...
+
+        The warning specified by *category* will be emitted at runtime
+        on use of deprecated objects. For functions, that happens on calls;
+        for classes, on instantiation and on creation of subclasses.
+        If the *category* is ``None``, no warning is emitted at runtime.
+        The *stacklevel* determines where the
+        warning is emitted. If it is ``1`` (the default), the warning
+        is emitted at the direct caller of the deprecated object; if it
+        is higher, it is emitted further up the stack.
+        Static type checker behavior is not affected by the *category*
+        and *stacklevel* arguments.
+
+        The deprecation message passed to the decorator is saved in the
+        ``__deprecated__`` attribute on the decorated object.
+        If applied to an overload, the decorator
+        must be after the ``@overload`` decorator for the attribute to
+        exist on the overload as returned by ``get_overloads()``.
+
+        See PEP 702 for details.
+
+        """
+        def __init__(
+            self,
+            message: str,
+            /,
+            *,
+            category: typing.Optional[typing.Type[Warning]] = DeprecationWarning,
+            stacklevel: int = 1,
+        ) -> None:
+            if not isinstance(message, str):
+                raise TypeError(
+                    "Expected an object of type str for 'message', not "
+                    f"{type(message).__name__!r}"
+                )
+            self.message = message
+            self.category = category
+            self.stacklevel = stacklevel
+
+        def __call__(self, arg: _T, /) -> _T:
+            # Make sure the inner functions created below don't
+            # retain a reference to self.
+            msg = self.message
+            category = self.category
+            stacklevel = self.stacklevel
+            if category is None:
+                arg.__deprecated__ = msg
+                return arg
+            elif isinstance(arg, type):
+                import functools
+                from types import MethodType
+
+                original_new = arg.__new__
+
+                @functools.wraps(original_new)
+                def __new__(cls, *args, **kwargs):
+                    if cls is arg:
+                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                    if original_new is not object.__new__:
+                        return original_new(cls, *args, **kwargs)
+                    # Mirrors a similar check in object.__new__.
+                    elif cls.__init__ is object.__init__ and (args or kwargs):
+                        raise TypeError(f"{cls.__name__}() takes no arguments")
+                    else:
+                        return original_new(cls)
+
+                arg.__new__ = staticmethod(__new__)
+
+                original_init_subclass = arg.__init_subclass__
+                # We need slightly different behavior if __init_subclass__
+                # is a bound method (likely if it was implemented in Python)
+                if isinstance(original_init_subclass, MethodType):
+                    original_init_subclass = original_init_subclass.__func__
+
+                    @functools.wraps(original_init_subclass)
+                    def __init_subclass__(*args, **kwargs):
+                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                        return original_init_subclass(*args, **kwargs)
+
+                    arg.__init_subclass__ = classmethod(__init_subclass__)
+                # Or otherwise, which likely means it's a builtin such as
+                # object's implementation of __init_subclass__.
+                else:
+                    @functools.wraps(original_init_subclass)
+                    def __init_subclass__(*args, **kwargs):
+                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                        return original_init_subclass(*args, **kwargs)
+
+                    arg.__init_subclass__ = __init_subclass__
+
+                arg.__deprecated__ = __new__.__deprecated__ = msg
+                __init_subclass__.__deprecated__ = msg
+                return arg
+            elif callable(arg):
+                import functools
+
+                @functools.wraps(arg)
+                def wrapper(*args, **kwargs):
+                    warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                    return arg(*args, **kwargs)
+
+                arg.__deprecated__ = wrapper.__deprecated__ = msg
+                return wrapper
+            else:
+                raise TypeError(
+                    "@deprecated decorator with non-None category must be applied to "
+                    f"a class or callable, not {arg!r}"
+                )
+
+
+# We have to do some monkey patching to deal with the dual nature of
+# Unpack/TypeVarTuple:
+# - We want Unpack to be a kind of TypeVar so it gets accepted in
+#   Generic[Unpack[Ts]]
+# - We want it to *not* be treated as a TypeVar for the purposes of
+#   counting generic parameters, so that when we subscript a generic,
+#   the runtime doesn't try to substitute the Unpack with the subscripted type.
+if not hasattr(typing, "TypeVarTuple"):
+    def _check_generic(cls, parameters, elen=_marker):
+        """Check correct count for parameters of a generic cls (internal helper).
+
+        This gives a nice error message in case of count mismatch.
+        """
+        if not elen:
+            raise TypeError(f"{cls} is not a generic class")
+        if elen is _marker:
+            if not hasattr(cls, "__parameters__") or not cls.__parameters__:
+                raise TypeError(f"{cls} is not a generic class")
+            elen = len(cls.__parameters__)
+        alen = len(parameters)
+        if alen != elen:
+            expect_val = elen
+            if hasattr(cls, "__parameters__"):
+                parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
+                num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in parameters)
+                if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
+                    return
+
+                # deal with TypeVarLike defaults
+                # required TypeVarLikes cannot appear after a defaulted one.
+                if alen < elen:
+                    # since we validate TypeVarLike default in _collect_type_vars
+                    # or _collect_parameters we can safely check parameters[alen]
+                    if (
+                        getattr(parameters[alen], '__default__', NoDefault)
+                        is not NoDefault
+                    ):
+                        return
+
+                    num_default_tv = sum(getattr(p, '__default__', NoDefault)
+                                         is not NoDefault for p in parameters)
+
+                    elen -= num_default_tv
+
+                    expect_val = f"at least {elen}"
+
+            things = "arguments" if sys.version_info >= (3, 10) else "parameters"
+            raise TypeError(f"Too {'many' if alen > elen else 'few'} {things}"
+                            f" for {cls}; actual {alen}, expected {expect_val}")
+else:
+    # Python 3.11+
+
+    def _check_generic(cls, parameters, elen):
+        """Check correct count for parameters of a generic cls (internal helper).
+
+        This gives a nice error message in case of count mismatch.
+        """
+        if not elen:
+            raise TypeError(f"{cls} is not a generic class")
+        alen = len(parameters)
+        if alen != elen:
+            expect_val = elen
+            if hasattr(cls, "__parameters__"):
+                parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
+
+                # deal with TypeVarLike defaults
+                # required TypeVarLikes cannot appear after a defaulted one.
+                if alen < elen:
+                    # since we validate TypeVarLike default in _collect_type_vars
+                    # or _collect_parameters we can safely check parameters[alen]
+                    if (
+                        getattr(parameters[alen], '__default__', NoDefault)
+                        is not NoDefault
+                    ):
+                        return
+
+                    num_default_tv = sum(getattr(p, '__default__', NoDefault)
+                                         is not NoDefault for p in parameters)
+
+                    elen -= num_default_tv
+
+                    expect_val = f"at least {elen}"
+
+            raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
+                            f" for {cls}; actual {alen}, expected {expect_val}")
+
+if not _PEP_696_IMPLEMENTED:
+    typing._check_generic = _check_generic
+
+
+def _has_generic_or_protocol_as_origin() -> bool:
+    try:
+        frame = sys._getframe(2)
+    # - Catch AttributeError: not all Python implementations have sys._getframe()
+    # - Catch ValueError: maybe we're called from an unexpected module
+    #   and the call stack isn't deep enough
+    except (AttributeError, ValueError):
+        return False  # err on the side of leniency
+    else:
+        # If we somehow get invoked from outside typing.py,
+        # also err on the side of leniency
+        if frame.f_globals.get("__name__") != "typing":
+            return False
+        origin = frame.f_locals.get("origin")
+        # Cannot use "in" because origin may be an object with a buggy __eq__ that
+        # throws an error.
+        return origin is typing.Generic or origin is Protocol or origin is typing.Protocol
+
+
+_TYPEVARTUPLE_TYPES = {TypeVarTuple, getattr(typing, "TypeVarTuple", None)}
+
+
+def _is_unpacked_typevartuple(x) -> bool:
+    if get_origin(x) is not Unpack:
+        return False
+    args = get_args(x)
+    return (
+        bool(args)
+        and len(args) == 1
+        and type(args[0]) in _TYPEVARTUPLE_TYPES
+    )
+
+
+# Python 3.11+ _collect_type_vars was renamed to _collect_parameters
+if hasattr(typing, '_collect_type_vars'):
+    def _collect_type_vars(types, typevar_types=None):
+        """Collect all type variable contained in types in order of
+        first appearance (lexicographic order). For example::
+
+            _collect_type_vars((T, List[S, T])) == (T, S)
+        """
+        if typevar_types is None:
+            typevar_types = typing.TypeVar
+        tvars = []
+
+        # A required TypeVarLike cannot appear after a TypeVarLike with a default
+        # if it was a direct call to `Generic[]` or `Protocol[]`
+        enforce_default_ordering = _has_generic_or_protocol_as_origin()
+        default_encountered = False
+
+        # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
+        type_var_tuple_encountered = False
+
+        for t in types:
+            if _is_unpacked_typevartuple(t):
+                type_var_tuple_encountered = True
+            elif isinstance(t, typevar_types) and t not in tvars:
+                if enforce_default_ordering:
+                    has_default = getattr(t, '__default__', NoDefault) is not NoDefault
+                    if has_default:
+                        if type_var_tuple_encountered:
+                            raise TypeError('Type parameter with a default'
+                                            ' follows TypeVarTuple')
+                        default_encountered = True
+                    elif default_encountered:
+                        raise TypeError(f'Type parameter {t!r} without a default'
+                                        ' follows type parameter with a default')
+
+                tvars.append(t)
+            if _should_collect_from_parameters(t):
+                tvars.extend([t for t in t.__parameters__ if t not in tvars])
+        return tuple(tvars)
+
+    typing._collect_type_vars = _collect_type_vars
+else:
+    def _collect_parameters(args):
+        """Collect all type variables and parameter specifications in args
+        in order of first appearance (lexicographic order).
+
+        For example::
+
+            assert _collect_parameters((T, Callable[P, T])) == (T, P)
+        """
+        parameters = []
+
+        # A required TypeVarLike cannot appear after a TypeVarLike with default
+        # if it was a direct call to `Generic[]` or `Protocol[]`
+        enforce_default_ordering = _has_generic_or_protocol_as_origin()
+        default_encountered = False
+
+        # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
+        type_var_tuple_encountered = False
+
+        for t in args:
+            if isinstance(t, type):
+                # We don't want __parameters__ descriptor of a bare Python class.
+                pass
+            elif isinstance(t, tuple):
+                # `t` might be a tuple, when `ParamSpec` is substituted with
+                # `[T, int]`, or `[int, *Ts]`, etc.
+                for x in t:
+                    for collected in _collect_parameters([x]):
+                        if collected not in parameters:
+                            parameters.append(collected)
+            elif hasattr(t, '__typing_subst__'):
+                if t not in parameters:
+                    if enforce_default_ordering:
+                        has_default = (
+                            getattr(t, '__default__', NoDefault) is not NoDefault
+                        )
+
+                        if type_var_tuple_encountered and has_default:
+                            raise TypeError('Type parameter with a default'
+                                            ' follows TypeVarTuple')
+
+                        if has_default:
+                            default_encountered = True
+                        elif default_encountered:
+                            raise TypeError(f'Type parameter {t!r} without a default'
+                                            ' follows type parameter with a default')
+
+                    parameters.append(t)
+            else:
+                if _is_unpacked_typevartuple(t):
+                    type_var_tuple_encountered = True
+                for x in getattr(t, '__parameters__', ()):
+                    if x not in parameters:
+                        parameters.append(x)
+
+        return tuple(parameters)
+
+    if not _PEP_696_IMPLEMENTED:
+        typing._collect_parameters = _collect_parameters
+
+# Backport typing.NamedTuple as it exists in Python 3.13.
+# In 3.11, the ability to define generic `NamedTuple`s was supported.
+# This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8.
+# On 3.12, we added __orig_bases__ to call-based NamedTuples
+# On 3.13, we deprecated kwargs-based NamedTuples
+if sys.version_info >= (3, 13):
+    NamedTuple = typing.NamedTuple
+else:
+    def _make_nmtuple(name, types, module, defaults=()):
+        fields = [n for n, t in types]
+        annotations = {n: typing._type_check(t, f"field {n} annotation must be a type")
+                       for n, t in types}
+        nm_tpl = collections.namedtuple(name, fields,
+                                        defaults=defaults, module=module)
+        nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations
+        # The `_field_types` attribute was removed in 3.9;
+        # in earlier versions, it is the same as the `__annotations__` attribute
+        if sys.version_info < (3, 9):
+            nm_tpl._field_types = annotations
+        return nm_tpl
+
+    _prohibited_namedtuple_fields = typing._prohibited
+    _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'})
+
+    class _NamedTupleMeta(type):
+        def __new__(cls, typename, bases, ns):
+            assert _NamedTuple in bases
+            for base in bases:
+                if base is not _NamedTuple and base is not typing.Generic:
+                    raise TypeError(
+                        'can only inherit from a NamedTuple type and Generic')
+            bases = tuple(tuple if base is _NamedTuple else base for base in bases)
+            if "__annotations__" in ns:
+                types = ns["__annotations__"]
+            elif "__annotate__" in ns:
+                # TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
+                types = ns["__annotate__"](1)
+            else:
+                types = {}
+            default_names = []
+            for field_name in types:
+                if field_name in ns:
+                    default_names.append(field_name)
+                elif default_names:
+                    raise TypeError(f"Non-default namedtuple field {field_name} "
+                                    f"cannot follow default field"
+                                    f"{'s' if len(default_names) > 1 else ''} "
+                                    f"{', '.join(default_names)}")
+            nm_tpl = _make_nmtuple(
+                typename, types.items(),
+                defaults=[ns[n] for n in default_names],
+                module=ns['__module__']
+            )
+            nm_tpl.__bases__ = bases
+            if typing.Generic in bases:
+                if hasattr(typing, '_generic_class_getitem'):  # 3.12+
+                    nm_tpl.__class_getitem__ = classmethod(typing._generic_class_getitem)
+                else:
+                    class_getitem = typing.Generic.__class_getitem__.__func__
+                    nm_tpl.__class_getitem__ = classmethod(class_getitem)
+            # update from user namespace without overriding special namedtuple attributes
+            for key, val in ns.items():
+                if key in _prohibited_namedtuple_fields:
+                    raise AttributeError("Cannot overwrite NamedTuple attribute " + key)
+                elif key not in _special_namedtuple_fields:
+                    if key not in nm_tpl._fields:
+                        setattr(nm_tpl, key, ns[key])
+                    try:
+                        set_name = type(val).__set_name__
+                    except AttributeError:
+                        pass
+                    else:
+                        try:
+                            set_name(val, nm_tpl, key)
+                        except BaseException as e:
+                            msg = (
+                                f"Error calling __set_name__ on {type(val).__name__!r} "
+                                f"instance {key!r} in {typename!r}"
+                            )
+                            # BaseException.add_note() existed on py311,
+                            # but the __set_name__ machinery didn't start
+                            # using add_note() until py312.
+                            # Making sure exceptions are raised in the same way
+                            # as in "normal" classes seems most important here.
+                            if sys.version_info >= (3, 12):
+                                e.add_note(msg)
+                                raise
+                            else:
+                                raise RuntimeError(msg) from e
+
+            if typing.Generic in bases:
+                nm_tpl.__init_subclass__()
+            return nm_tpl
+
+    _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {})
+
+    def _namedtuple_mro_entries(bases):
+        assert NamedTuple in bases
+        return (_NamedTuple,)
+
+    @_ensure_subclassable(_namedtuple_mro_entries)
+    def NamedTuple(typename, fields=_marker, /, **kwargs):
+        """Typed version of namedtuple.
+
+        Usage::
+
+            class Employee(NamedTuple):
+                name: str
+                id: int
+
+        This is equivalent to::
+
+            Employee = collections.namedtuple('Employee', ['name', 'id'])
+
+        The resulting class has an extra __annotations__ attribute, giving a
+        dict that maps field names to types.  (The field names are also in
+        the _fields attribute, which is part of the namedtuple API.)
+        An alternative equivalent functional syntax is also accepted::
+
+            Employee = NamedTuple('Employee', [('name', str), ('id', int)])
+        """
+        if fields is _marker:
+            if kwargs:
+                deprecated_thing = "Creating NamedTuple classes using keyword arguments"
+                deprecation_msg = (
+                    "{name} is deprecated and will be disallowed in Python {remove}. "
+                    "Use the class-based or functional syntax instead."
+                )
+            else:
+                deprecated_thing = "Failing to pass a value for the 'fields' parameter"
+                example = f"`{typename} = NamedTuple({typename!r}, [])`"
+                deprecation_msg = (
+                    "{name} is deprecated and will be disallowed in Python {remove}. "
+                    "To create a NamedTuple class with 0 fields "
+                    "using the functional syntax, "
+                    "pass an empty list, e.g. "
+                ) + example + "."
+        elif fields is None:
+            if kwargs:
+                raise TypeError(
+                    "Cannot pass `None` as the 'fields' parameter "
+                    "and also specify fields using keyword arguments"
+                )
+            else:
+                deprecated_thing = "Passing `None` as the 'fields' parameter"
+                example = f"`{typename} = NamedTuple({typename!r}, [])`"
+                deprecation_msg = (
+                    "{name} is deprecated and will be disallowed in Python {remove}. "
+                    "To create a NamedTuple class with 0 fields "
+                    "using the functional syntax, "
+                    "pass an empty list, e.g. "
+                ) + example + "."
+        elif kwargs:
+            raise TypeError("Either list of fields or keywords"
+                            " can be provided to NamedTuple, not both")
+        if fields is _marker or fields is None:
+            warnings.warn(
+                deprecation_msg.format(name=deprecated_thing, remove="3.15"),
+                DeprecationWarning,
+                stacklevel=2,
+            )
+            fields = kwargs.items()
+        nt = _make_nmtuple(typename, fields, module=_caller())
+        nt.__orig_bases__ = (NamedTuple,)
+        return nt
+
+
+if hasattr(collections.abc, "Buffer"):
+    Buffer = collections.abc.Buffer
+else:
+    class Buffer(abc.ABC):  # noqa: B024
+        """Base class for classes that implement the buffer protocol.
+
+        The buffer protocol allows Python objects to expose a low-level
+        memory buffer interface. Before Python 3.12, it is not possible
+        to implement the buffer protocol in pure Python code, or even
+        to check whether a class implements the buffer protocol. In
+        Python 3.12 and higher, the ``__buffer__`` method allows access
+        to the buffer protocol from Python code, and the
+        ``collections.abc.Buffer`` ABC allows checking whether a class
+        implements the buffer protocol.
+
+        To indicate support for the buffer protocol in earlier versions,
+        inherit from this ABC, either in a stub file or at runtime,
+        or use ABC registration. This ABC provides no methods, because
+        there is no Python-accessible methods shared by pre-3.12 buffer
+        classes. It is useful primarily for static checks.
+
+        """
+
+    # As a courtesy, register the most common stdlib buffer classes.
+    Buffer.register(memoryview)
+    Buffer.register(bytearray)
+    Buffer.register(bytes)
+
+
+# Backport of types.get_original_bases, available on 3.12+ in CPython
+if hasattr(_types, "get_original_bases"):
+    get_original_bases = _types.get_original_bases
+else:
+    def get_original_bases(cls, /):
+        """Return the class's "original" bases prior to modification by `__mro_entries__`.
+
+        Examples::
+
+            from typing import TypeVar, Generic
+            from typing_extensions import NamedTuple, TypedDict
+
+            T = TypeVar("T")
+            class Foo(Generic[T]): ...
+            class Bar(Foo[int], float): ...
+            class Baz(list[str]): ...
+            Eggs = NamedTuple("Eggs", [("a", int), ("b", str)])
+            Spam = TypedDict("Spam", {"a": int, "b": str})
+
+            assert get_original_bases(Bar) == (Foo[int], float)
+            assert get_original_bases(Baz) == (list[str],)
+            assert get_original_bases(Eggs) == (NamedTuple,)
+            assert get_original_bases(Spam) == (TypedDict,)
+            assert get_original_bases(int) == (object,)
+        """
+        try:
+            return cls.__dict__.get("__orig_bases__", cls.__bases__)
+        except AttributeError:
+            raise TypeError(
+                f'Expected an instance of type, not {type(cls).__name__!r}'
+            ) from None
+
+
+# NewType is a class on Python 3.10+, making it pickleable
+# The error message for subclassing instances of NewType was improved on 3.11+
+if sys.version_info >= (3, 11):
+    NewType = typing.NewType
+else:
+    class NewType:
+        """NewType creates simple unique types with almost zero
+        runtime overhead. NewType(name, tp) is considered a subtype of tp
+        by static type checkers. At runtime, NewType(name, tp) returns
+        a dummy callable that simply returns its argument. Usage::
+            UserId = NewType('UserId', int)
+            def name_by_id(user_id: UserId) -> str:
+                ...
+            UserId('user')          # Fails type check
+            name_by_id(42)          # Fails type check
+            name_by_id(UserId(42))  # OK
+            num = UserId(5) + 1     # type: int
+        """
+
+        def __call__(self, obj, /):
+            return obj
+
+        def __init__(self, name, tp):
+            self.__qualname__ = name
+            if '.' in name:
+                name = name.rpartition('.')[-1]
+            self.__name__ = name
+            self.__supertype__ = tp
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+
+        def __mro_entries__(self, bases):
+            # We defined __mro_entries__ to get a better error message
+            # if a user attempts to subclass a NewType instance. bpo-46170
+            supercls_name = self.__name__
+
+            class Dummy:
+                def __init_subclass__(cls):
+                    subcls_name = cls.__name__
+                    raise TypeError(
+                        f"Cannot subclass an instance of NewType. "
+                        f"Perhaps you were looking for: "
+                        f"`{subcls_name} = NewType({subcls_name!r}, {supercls_name})`"
+                    )
+
+            return (Dummy,)
+
+        def __repr__(self):
+            return f'{self.__module__}.{self.__qualname__}'
+
+        def __reduce__(self):
+            return self.__qualname__
+
+        if sys.version_info >= (3, 10):
+            # PEP 604 methods
+            # It doesn't make sense to have these methods on Python <3.10
+
+            def __or__(self, other):
+                return typing.Union[self, other]
+
+            def __ror__(self, other):
+                return typing.Union[other, self]
+
+
+if hasattr(typing, "TypeAliasType"):
+    TypeAliasType = typing.TypeAliasType
+else:
+    def _is_unionable(obj):
+        """Corresponds to is_unionable() in unionobject.c in CPython."""
+        return obj is None or isinstance(obj, (
+            type,
+            _types.GenericAlias,
+            _types.UnionType,
+            TypeAliasType,
+        ))
+
+    class TypeAliasType:
+        """Create named, parameterized type aliases.
+
+        This provides a backport of the new `type` statement in Python 3.12:
+
+            type ListOrSet[T] = list[T] | set[T]
+
+        is equivalent to:
+
+            T = TypeVar("T")
+            ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,))
+
+        The name ListOrSet can then be used as an alias for the type it refers to.
+
+        The type_params argument should contain all the type parameters used
+        in the value of the type alias. If the alias is not generic, this
+        argument is omitted.
+
+        Static type checkers should only support type aliases declared using
+        TypeAliasType that follow these rules:
+
+        - The first argument (the name) must be a string literal.
+        - The TypeAliasType instance must be immediately assigned to a variable
+          of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid,
+          as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)').
+
+        """
+
+        def __init__(self, name: str, value, *, type_params=()):
+            if not isinstance(name, str):
+                raise TypeError("TypeAliasType name must be a string")
+            self.__value__ = value
+            self.__type_params__ = type_params
+
+            parameters = []
+            for type_param in type_params:
+                if isinstance(type_param, TypeVarTuple):
+                    parameters.extend(type_param)
+                else:
+                    parameters.append(type_param)
+            self.__parameters__ = tuple(parameters)
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+            # Setting this attribute closes the TypeAliasType from further modification
+            self.__name__ = name
+
+        def __setattr__(self, name: str, value: object, /) -> None:
+            if hasattr(self, "__name__"):
+                self._raise_attribute_error(name)
+            super().__setattr__(name, value)
+
+        def __delattr__(self, name: str, /) -> Never:
+            self._raise_attribute_error(name)
+
+        def _raise_attribute_error(self, name: str) -> Never:
+            # Match the Python 3.12 error messages exactly
+            if name == "__name__":
+                raise AttributeError("readonly attribute")
+            elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}:
+                raise AttributeError(
+                    f"attribute '{name}' of 'typing.TypeAliasType' objects "
+                    "is not writable"
+                )
+            else:
+                raise AttributeError(
+                    f"'typing.TypeAliasType' object has no attribute '{name}'"
+                )
+
+        def __repr__(self) -> str:
+            return self.__name__
+
+        def __getitem__(self, parameters):
+            if not isinstance(parameters, tuple):
+                parameters = (parameters,)
+            parameters = [
+                typing._type_check(
+                    item, f'Subscripting {self.__name__} requires a type.'
+                )
+                for item in parameters
+            ]
+            return typing._GenericAlias(self, tuple(parameters))
+
+        def __reduce__(self):
+            return self.__name__
+
+        def __init_subclass__(cls, *args, **kwargs):
+            raise TypeError(
+                "type 'typing_extensions.TypeAliasType' is not an acceptable base type"
+            )
+
+        # The presence of this method convinces typing._type_check
+        # that TypeAliasTypes are types.
+        def __call__(self):
+            raise TypeError("Type alias is not callable")
+
+        if sys.version_info >= (3, 10):
+            def __or__(self, right):
+                # For forward compatibility with 3.12, reject Unions
+                # that are not accepted by the built-in Union.
+                if not _is_unionable(right):
+                    return NotImplemented
+                return typing.Union[self, right]
+
+            def __ror__(self, left):
+                if not _is_unionable(left):
+                    return NotImplemented
+                return typing.Union[left, self]
+
+
+if hasattr(typing, "is_protocol"):
+    is_protocol = typing.is_protocol
+    get_protocol_members = typing.get_protocol_members
+else:
+    def is_protocol(tp: type, /) -> bool:
+        """Return True if the given type is a Protocol.
+
+        Example::
+
+            >>> from typing_extensions import Protocol, is_protocol
+            >>> class P(Protocol):
+            ...     def a(self) -> str: ...
+            ...     b: int
+            >>> is_protocol(P)
+            True
+            >>> is_protocol(int)
+            False
+        """
+        return (
+            isinstance(tp, type)
+            and getattr(tp, '_is_protocol', False)
+            and tp is not Protocol
+            and tp is not typing.Protocol
+        )
+
+    def get_protocol_members(tp: type, /) -> typing.FrozenSet[str]:
+        """Return the set of members defined in a Protocol.
+
+        Example::
+
+            >>> from typing_extensions import Protocol, get_protocol_members
+            >>> class P(Protocol):
+            ...     def a(self) -> str: ...
+            ...     b: int
+            >>> get_protocol_members(P)
+            frozenset({'a', 'b'})
+
+        Raise a TypeError for arguments that are not Protocols.
+        """
+        if not is_protocol(tp):
+            raise TypeError(f'{tp!r} is not a Protocol')
+        if hasattr(tp, '__protocol_attrs__'):
+            return frozenset(tp.__protocol_attrs__)
+        return frozenset(_get_protocol_attrs(tp))
+
+
+if hasattr(typing, "Doc"):
+    Doc = typing.Doc
+else:
+    class Doc:
+        """Define the documentation of a type annotation using ``Annotated``, to be
+         used in class attributes, function and method parameters, return values,
+         and variables.
+
+        The value should be a positional-only string literal to allow static tools
+        like editors and documentation generators to use it.
+
+        This complements docstrings.
+
+        The string value passed is available in the attribute ``documentation``.
+
+        Example::
+
+            >>> from typing_extensions import Annotated, Doc
+            >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ...
+        """
+        def __init__(self, documentation: str, /) -> None:
+            self.documentation = documentation
+
+        def __repr__(self) -> str:
+            return f"Doc({self.documentation!r})"
+
+        def __hash__(self) -> int:
+            return hash(self.documentation)
+
+        def __eq__(self, other: object) -> bool:
+            if not isinstance(other, Doc):
+                return NotImplemented
+            return self.documentation == other.documentation
+
+
+_CapsuleType = getattr(_types, "CapsuleType", None)
+
+if _CapsuleType is None:
+    try:
+        import _socket
+    except ImportError:
+        pass
+    else:
+        _CAPI = getattr(_socket, "CAPI", None)
+        if _CAPI is not None:
+            _CapsuleType = type(_CAPI)
+
+if _CapsuleType is not None:
+    CapsuleType = _CapsuleType
+    __all__.append("CapsuleType")
+
+
+# Aliases for items that have always been in typing.
+# Explicitly assign these (rather than using `from typing import *` at the top),
+# so that we get a CI error if one of these is deleted from typing.py
+# in a future version of Python
+AbstractSet = typing.AbstractSet
+AnyStr = typing.AnyStr
+BinaryIO = typing.BinaryIO
+Callable = typing.Callable
+Collection = typing.Collection
+Container = typing.Container
+Dict = typing.Dict
+ForwardRef = typing.ForwardRef
+FrozenSet = typing.FrozenSet
+Generic = typing.Generic
+Hashable = typing.Hashable
+IO = typing.IO
+ItemsView = typing.ItemsView
+Iterable = typing.Iterable
+Iterator = typing.Iterator
+KeysView = typing.KeysView
+List = typing.List
+Mapping = typing.Mapping
+MappingView = typing.MappingView
+Match = typing.Match
+MutableMapping = typing.MutableMapping
+MutableSequence = typing.MutableSequence
+MutableSet = typing.MutableSet
+Optional = typing.Optional
+Pattern = typing.Pattern
+Reversible = typing.Reversible
+Sequence = typing.Sequence
+Set = typing.Set
+Sized = typing.Sized
+TextIO = typing.TextIO
+Tuple = typing.Tuple
+Union = typing.Union
+ValuesView = typing.ValuesView
+cast = typing.cast
+no_type_check = typing.no_type_check
+no_type_check_decorator = typing.no_type_check_decorator
diff --git a/setuptools/_vendor/wheel-0.43.0.dist-info/RECORD b/setuptools/_vendor/wheel-0.43.0.dist-info/RECORD
index 786fe55190..a3c6c3ea2f 100644
--- a/setuptools/_vendor/wheel-0.43.0.dist-info/RECORD
+++ b/setuptools/_vendor/wheel-0.43.0.dist-info/RECORD
@@ -1,63 +1,63 @@
-../../bin/wheel,sha256=Y73OywJ5gxOkyLS7G4Z9CS6Pb63oCt-LMViLs-ygeGE,245
-wheel-0.43.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-wheel-0.43.0.dist-info/LICENSE.txt,sha256=MMI2GGeRCPPo6h0qZYx8pBe9_IkcmO8aifpP8MmChlQ,1107
-wheel-0.43.0.dist-info/METADATA,sha256=WbrCKwClnT5WCKVrjPjvxDgxo2tyeS7kOJyc1GaceEE,2153
-wheel-0.43.0.dist-info/RECORD,,
-wheel-0.43.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-wheel-0.43.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
-wheel-0.43.0.dist-info/entry_points.txt,sha256=rTY1BbkPHhkGMm4Q3F0pIzJBzW2kMxoG1oriffvGdA0,104
-wheel/__init__.py,sha256=D6jhH00eMzbgrXGAeOwVfD5i-lCAMMycuG1L0useDlo,59
-wheel/__main__.py,sha256=NkMUnuTCGcOkgY0IBLgBCVC_BGGcWORx2K8jYGS12UE,455
-wheel/__pycache__/__init__.cpython-312.pyc,,
-wheel/__pycache__/__main__.cpython-312.pyc,,
-wheel/__pycache__/_setuptools_logging.cpython-312.pyc,,
-wheel/__pycache__/bdist_wheel.cpython-312.pyc,,
-wheel/__pycache__/macosx_libfile.cpython-312.pyc,,
-wheel/__pycache__/metadata.cpython-312.pyc,,
-wheel/__pycache__/util.cpython-312.pyc,,
-wheel/__pycache__/wheelfile.cpython-312.pyc,,
-wheel/_setuptools_logging.py,sha256=NoCnjJ4DFEZ45Eo-2BdXLsWJCwGkait1tp_17paleVw,746
-wheel/bdist_wheel.py,sha256=OKJyp9E831zJrxoRfmM9AgOjByG1CB-pzF5kXQFmaKk,20938
-wheel/cli/__init__.py,sha256=eBNhnPwWTtdKAJHy77lvz7gOQ5Eu3GavGugXxhSsn-U,4264
-wheel/cli/__pycache__/__init__.cpython-312.pyc,,
-wheel/cli/__pycache__/convert.cpython-312.pyc,,
-wheel/cli/__pycache__/pack.cpython-312.pyc,,
-wheel/cli/__pycache__/tags.cpython-312.pyc,,
-wheel/cli/__pycache__/unpack.cpython-312.pyc,,
-wheel/cli/convert.py,sha256=qJcpYGKqdfw1P6BelgN1Hn_suNgM6bvyEWFlZeuSWx0,9439
-wheel/cli/pack.py,sha256=CAFcHdBVulvsHYJlndKVO7KMI9JqBTZz5ii0PKxxCOs,3103
-wheel/cli/tags.py,sha256=lHw-LaWrkS5Jy_qWcw-6pSjeNM6yAjDnqKI3E5JTTCU,4760
-wheel/cli/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021
-wheel/macosx_libfile.py,sha256=HnW6OPdN993psStvwl49xtx2kw7hoVbe6nvwmf8WsKI,16103
-wheel/metadata.py,sha256=q-xCCqSAK7HzyZxK9A6_HAWmhqS1oB4BFw1-rHQxBiQ,5884
-wheel/util.py,sha256=e0jpnsbbM9QhaaMSyap-_ZgUxcxwpyLDk6RHcrduPLg,621
-wheel/vendored/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-wheel/vendored/__pycache__/__init__.cpython-312.pyc,,
-wheel/vendored/packaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-wheel/vendored/packaging/__pycache__/__init__.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/_elffile.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/_manylinux.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/_musllinux.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/_parser.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/_structures.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/_tokenizer.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/markers.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/requirements.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/specifiers.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/tags.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/utils.cpython-312.pyc,,
-wheel/vendored/packaging/__pycache__/version.cpython-312.pyc,,
-wheel/vendored/packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266
-wheel/vendored/packaging/_manylinux.py,sha256=P7sdR5_7XBY09LVYYPhHmydMJIIwPXWsh4olk74Uuj4,9588
-wheel/vendored/packaging/_musllinux.py,sha256=z1s8To2hQ0vpn_d-O2i5qxGwEK8WmGlLt3d_26V7NeY,2674
-wheel/vendored/packaging/_parser.py,sha256=4tT4emSl2qTaU7VTQE1Xa9o1jMPCsBezsYBxyNMUN-s,10347
-wheel/vendored/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
-wheel/vendored/packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292
-wheel/vendored/packaging/markers.py,sha256=_TSPI1BhJYO7Bp9AzTmHQxIqHEVXaTjmDh9G-w8qzPA,8232
-wheel/vendored/packaging/requirements.py,sha256=dgoBeVprPu2YE6Q8nGfwOPTjATHbRa_ZGLyXhFEln6Q,2933
-wheel/vendored/packaging/specifiers.py,sha256=IWSt0SrLSP72heWhAC8UL0eGvas7XIQHjqiViVfmPKE,39778
-wheel/vendored/packaging/tags.py,sha256=fedHXiOHkBxNZTXotXv8uXPmMFU9ae-TKBujgYHigcA,18950
-wheel/vendored/packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268
-wheel/vendored/packaging/version.py,sha256=PFJaYZDxBgyxkfYhH3SQw4qfE9ICCWrTmitvq14y3bs,16234
-wheel/vendored/vendor.txt,sha256=Z2ENjB1i5prfez8CdM1Sdr3c6Zxv2rRRolMpLmBncAE,16
-wheel/wheelfile.py,sha256=DtJDWoZMvnBh4leNMDPGOprQU9d_dp6q-MmV0U--4xc,7694
+../../bin/wheel,sha256=cT2EHbrv-J-UyUXu26cDY-0I7RgcruysJeHFanT1Xfo,249
+wheel-0.43.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+wheel-0.43.0.dist-info/LICENSE.txt,sha256=MMI2GGeRCPPo6h0qZYx8pBe9_IkcmO8aifpP8MmChlQ,1107
+wheel-0.43.0.dist-info/METADATA,sha256=WbrCKwClnT5WCKVrjPjvxDgxo2tyeS7kOJyc1GaceEE,2153
+wheel-0.43.0.dist-info/RECORD,,
+wheel-0.43.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+wheel-0.43.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
+wheel-0.43.0.dist-info/entry_points.txt,sha256=rTY1BbkPHhkGMm4Q3F0pIzJBzW2kMxoG1oriffvGdA0,104
+wheel/__init__.py,sha256=D6jhH00eMzbgrXGAeOwVfD5i-lCAMMycuG1L0useDlo,59
+wheel/__main__.py,sha256=NkMUnuTCGcOkgY0IBLgBCVC_BGGcWORx2K8jYGS12UE,455
+wheel/__pycache__/__init__.cpython-312.pyc,,
+wheel/__pycache__/__main__.cpython-312.pyc,,
+wheel/__pycache__/_setuptools_logging.cpython-312.pyc,,
+wheel/__pycache__/bdist_wheel.cpython-312.pyc,,
+wheel/__pycache__/macosx_libfile.cpython-312.pyc,,
+wheel/__pycache__/metadata.cpython-312.pyc,,
+wheel/__pycache__/util.cpython-312.pyc,,
+wheel/__pycache__/wheelfile.cpython-312.pyc,,
+wheel/_setuptools_logging.py,sha256=NoCnjJ4DFEZ45Eo-2BdXLsWJCwGkait1tp_17paleVw,746
+wheel/bdist_wheel.py,sha256=OKJyp9E831zJrxoRfmM9AgOjByG1CB-pzF5kXQFmaKk,20938
+wheel/cli/__init__.py,sha256=eBNhnPwWTtdKAJHy77lvz7gOQ5Eu3GavGugXxhSsn-U,4264
+wheel/cli/__pycache__/__init__.cpython-312.pyc,,
+wheel/cli/__pycache__/convert.cpython-312.pyc,,
+wheel/cli/__pycache__/pack.cpython-312.pyc,,
+wheel/cli/__pycache__/tags.cpython-312.pyc,,
+wheel/cli/__pycache__/unpack.cpython-312.pyc,,
+wheel/cli/convert.py,sha256=qJcpYGKqdfw1P6BelgN1Hn_suNgM6bvyEWFlZeuSWx0,9439
+wheel/cli/pack.py,sha256=CAFcHdBVulvsHYJlndKVO7KMI9JqBTZz5ii0PKxxCOs,3103
+wheel/cli/tags.py,sha256=lHw-LaWrkS5Jy_qWcw-6pSjeNM6yAjDnqKI3E5JTTCU,4760
+wheel/cli/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021
+wheel/macosx_libfile.py,sha256=HnW6OPdN993psStvwl49xtx2kw7hoVbe6nvwmf8WsKI,16103
+wheel/metadata.py,sha256=q-xCCqSAK7HzyZxK9A6_HAWmhqS1oB4BFw1-rHQxBiQ,5884
+wheel/util.py,sha256=e0jpnsbbM9QhaaMSyap-_ZgUxcxwpyLDk6RHcrduPLg,621
+wheel/vendored/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+wheel/vendored/__pycache__/__init__.cpython-312.pyc,,
+wheel/vendored/packaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+wheel/vendored/packaging/__pycache__/__init__.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/_elffile.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/_manylinux.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/_musllinux.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/_parser.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/_structures.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/_tokenizer.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/markers.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/requirements.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/specifiers.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/tags.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/utils.cpython-312.pyc,,
+wheel/vendored/packaging/__pycache__/version.cpython-312.pyc,,
+wheel/vendored/packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266
+wheel/vendored/packaging/_manylinux.py,sha256=P7sdR5_7XBY09LVYYPhHmydMJIIwPXWsh4olk74Uuj4,9588
+wheel/vendored/packaging/_musllinux.py,sha256=z1s8To2hQ0vpn_d-O2i5qxGwEK8WmGlLt3d_26V7NeY,2674
+wheel/vendored/packaging/_parser.py,sha256=4tT4emSl2qTaU7VTQE1Xa9o1jMPCsBezsYBxyNMUN-s,10347
+wheel/vendored/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
+wheel/vendored/packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292
+wheel/vendored/packaging/markers.py,sha256=_TSPI1BhJYO7Bp9AzTmHQxIqHEVXaTjmDh9G-w8qzPA,8232
+wheel/vendored/packaging/requirements.py,sha256=dgoBeVprPu2YE6Q8nGfwOPTjATHbRa_ZGLyXhFEln6Q,2933
+wheel/vendored/packaging/specifiers.py,sha256=IWSt0SrLSP72heWhAC8UL0eGvas7XIQHjqiViVfmPKE,39778
+wheel/vendored/packaging/tags.py,sha256=fedHXiOHkBxNZTXotXv8uXPmMFU9ae-TKBujgYHigcA,18950
+wheel/vendored/packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268
+wheel/vendored/packaging/version.py,sha256=PFJaYZDxBgyxkfYhH3SQw4qfE9ICCWrTmitvq14y3bs,16234
+wheel/vendored/vendor.txt,sha256=Z2ENjB1i5prfez8CdM1Sdr3c6Zxv2rRRolMpLmBncAE,16
+wheel/wheelfile.py,sha256=DtJDWoZMvnBh4leNMDPGOprQU9d_dp6q-MmV0U--4xc,7694
diff --git a/setuptools/_vendor/wheel/__main__.py b/setuptools/_vendor/wheel/__main__.py
new file mode 100644
index 0000000000..0be7453749
--- /dev/null
+++ b/setuptools/_vendor/wheel/__main__.py
@@ -0,0 +1,23 @@
+"""
+Wheel command line tool (enable python -m wheel syntax)
+"""
+
+from __future__ import annotations
+
+import sys
+
+
+def main():  # needed for console script
+    if __package__ == "":
+        # To be able to run 'python wheel-0.9.whl/wheel':
+        import os.path
+
+        path = os.path.dirname(os.path.dirname(__file__))
+        sys.path[0:0] = [path]
+    import wheel.cli
+
+    sys.exit(wheel.cli.main())
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/setuptools/_vendor/wheel/_setuptools_logging.py b/setuptools/_vendor/wheel/_setuptools_logging.py
new file mode 100644
index 0000000000..006c098523
--- /dev/null
+++ b/setuptools/_vendor/wheel/_setuptools_logging.py
@@ -0,0 +1,26 @@
+# copied from setuptools.logging, omitting monkeypatching
+from __future__ import annotations
+
+import logging
+import sys
+
+
+def _not_warning(record):
+    return record.levelno < logging.WARNING
+
+
+def configure():
+    """
+    Configure logging to emit warning and above to stderr
+    and everything else to stdout. This behavior is provided
+    for compatibility with distutils.log but may change in
+    the future.
+    """
+    err_handler = logging.StreamHandler()
+    err_handler.setLevel(logging.WARNING)
+    out_handler = logging.StreamHandler(sys.stdout)
+    out_handler.addFilter(_not_warning)
+    handlers = err_handler, out_handler
+    logging.basicConfig(
+        format="{message}", style="{", handlers=handlers, level=logging.DEBUG
+    )
diff --git a/setuptools/_vendor/wheel/bdist_wheel.py b/setuptools/_vendor/wheel/bdist_wheel.py
new file mode 100644
index 0000000000..6b811ee3df
--- /dev/null
+++ b/setuptools/_vendor/wheel/bdist_wheel.py
@@ -0,0 +1,595 @@
+"""
+Create a wheel (.whl) distribution.
+
+A wheel is a built archive format.
+"""
+
+from __future__ import annotations
+
+import os
+import re
+import shutil
+import stat
+import struct
+import sys
+import sysconfig
+import warnings
+from email.generator import BytesGenerator, Generator
+from email.policy import EmailPolicy
+from glob import iglob
+from shutil import rmtree
+from zipfile import ZIP_DEFLATED, ZIP_STORED
+
+import setuptools
+from setuptools import Command
+
+from . import __version__ as wheel_version
+from .macosx_libfile import calculate_macosx_platform_tag
+from .metadata import pkginfo_to_metadata
+from .util import log
+from .vendored.packaging import tags
+from .vendored.packaging import version as _packaging_version
+from .wheelfile import WheelFile
+
+
+def safe_name(name):
+    """Convert an arbitrary string to a standard distribution name
+    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
+    """
+    return re.sub("[^A-Za-z0-9.]+", "-", name)
+
+
+def safe_version(version):
+    """
+    Convert an arbitrary string to a standard version string
+    """
+    try:
+        # normalize the version
+        return str(_packaging_version.Version(version))
+    except _packaging_version.InvalidVersion:
+        version = version.replace(" ", ".")
+        return re.sub("[^A-Za-z0-9.]+", "-", version)
+
+
+setuptools_major_version = int(setuptools.__version__.split(".")[0])
+
+PY_LIMITED_API_PATTERN = r"cp3\d"
+
+
+def _is_32bit_interpreter():
+    return struct.calcsize("P") == 4
+
+
+def python_tag():
+    return f"py{sys.version_info[0]}"
+
+
+def get_platform(archive_root):
+    """Return our platform name 'win32', 'linux_x86_64'"""
+    result = sysconfig.get_platform()
+    if result.startswith("macosx") and archive_root is not None:
+        result = calculate_macosx_platform_tag(archive_root, result)
+    elif _is_32bit_interpreter():
+        if result == "linux-x86_64":
+            # pip pull request #3497
+            result = "linux-i686"
+        elif result == "linux-aarch64":
+            # packaging pull request #234
+            # TODO armv8l, packaging pull request #690 => this did not land
+            # in pip/packaging yet
+            result = "linux-armv7l"
+
+    return result.replace("-", "_")
+
+
+def get_flag(var, fallback, expected=True, warn=True):
+    """Use a fallback value for determining SOABI flags if the needed config
+    var is unset or unavailable."""
+    val = sysconfig.get_config_var(var)
+    if val is None:
+        if warn:
+            warnings.warn(
+                f"Config variable '{var}' is unset, Python ABI tag may " "be incorrect",
+                RuntimeWarning,
+                stacklevel=2,
+            )
+        return fallback
+    return val == expected
+
+
+def get_abi_tag():
+    """Return the ABI tag based on SOABI (if available) or emulate SOABI (PyPy2)."""
+    soabi = sysconfig.get_config_var("SOABI")
+    impl = tags.interpreter_name()
+    if not soabi and impl in ("cp", "pp") and hasattr(sys, "maxunicode"):
+        d = ""
+        m = ""
+        u = ""
+        if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")):
+            d = "d"
+
+        if get_flag(
+            "WITH_PYMALLOC",
+            impl == "cp",
+            warn=(impl == "cp" and sys.version_info < (3, 8)),
+        ) and sys.version_info < (3, 8):
+            m = "m"
+
+        abi = f"{impl}{tags.interpreter_version()}{d}{m}{u}"
+    elif soabi and impl == "cp" and soabi.startswith("cpython"):
+        # non-Windows
+        abi = "cp" + soabi.split("-")[1]
+    elif soabi and impl == "cp" and soabi.startswith("cp"):
+        # Windows
+        abi = soabi.split("-")[0]
+    elif soabi and impl == "pp":
+        # we want something like pypy36-pp73
+        abi = "-".join(soabi.split("-")[:2])
+        abi = abi.replace(".", "_").replace("-", "_")
+    elif soabi and impl == "graalpy":
+        abi = "-".join(soabi.split("-")[:3])
+        abi = abi.replace(".", "_").replace("-", "_")
+    elif soabi:
+        abi = soabi.replace(".", "_").replace("-", "_")
+    else:
+        abi = None
+
+    return abi
+
+
+def safer_name(name):
+    return safe_name(name).replace("-", "_")
+
+
+def safer_version(version):
+    return safe_version(version).replace("-", "_")
+
+
+def remove_readonly(func, path, excinfo):
+    remove_readonly_exc(func, path, excinfo[1])
+
+
+def remove_readonly_exc(func, path, exc):
+    os.chmod(path, stat.S_IWRITE)
+    func(path)
+
+
+class bdist_wheel(Command):
+    description = "create a wheel distribution"
+
+    supported_compressions = {
+        "stored": ZIP_STORED,
+        "deflated": ZIP_DEFLATED,
+    }
+
+    user_options = [
+        ("bdist-dir=", "b", "temporary directory for creating the distribution"),
+        (
+            "plat-name=",
+            "p",
+            "platform name to embed in generated filenames "
+            "(default: %s)" % get_platform(None),
+        ),
+        (
+            "keep-temp",
+            "k",
+            "keep the pseudo-installation tree around after "
+            "creating the distribution archive",
+        ),
+        ("dist-dir=", "d", "directory to put final built distributions in"),
+        ("skip-build", None, "skip rebuilding everything (for testing/debugging)"),
+        (
+            "relative",
+            None,
+            "build the archive using relative paths " "(default: false)",
+        ),
+        (
+            "owner=",
+            "u",
+            "Owner name used when creating a tar file" " [default: current user]",
+        ),
+        (
+            "group=",
+            "g",
+            "Group name used when creating a tar file" " [default: current group]",
+        ),
+        ("universal", None, "make a universal wheel" " (default: false)"),
+        (
+            "compression=",
+            None,
+            "zipfile compression (one of: {})" " (default: 'deflated')".format(
+                ", ".join(supported_compressions)
+            ),
+        ),
+        (
+            "python-tag=",
+            None,
+            "Python implementation compatibility tag"
+            " (default: '%s')" % (python_tag()),
+        ),
+        (
+            "build-number=",
+            None,
+            "Build number for this particular version. "
+            "As specified in PEP-0427, this must start with a digit. "
+            "[default: None]",
+        ),
+        (
+            "py-limited-api=",
+            None,
+            "Python tag (cp32|cp33|cpNN) for abi3 wheel tag" " (default: false)",
+        ),
+    ]
+
+    boolean_options = ["keep-temp", "skip-build", "relative", "universal"]
+
+    def initialize_options(self):
+        self.bdist_dir = None
+        self.data_dir = None
+        self.plat_name = None
+        self.plat_tag = None
+        self.format = "zip"
+        self.keep_temp = False
+        self.dist_dir = None
+        self.egginfo_dir = None
+        self.root_is_pure = None
+        self.skip_build = None
+        self.relative = False
+        self.owner = None
+        self.group = None
+        self.universal = False
+        self.compression = "deflated"
+        self.python_tag = python_tag()
+        self.build_number = None
+        self.py_limited_api = False
+        self.plat_name_supplied = False
+
+    def finalize_options(self):
+        if self.bdist_dir is None:
+            bdist_base = self.get_finalized_command("bdist").bdist_base
+            self.bdist_dir = os.path.join(bdist_base, "wheel")
+
+        egg_info = self.distribution.get_command_obj("egg_info")
+        egg_info.ensure_finalized()  # needed for correct `wheel_dist_name`
+
+        self.data_dir = self.wheel_dist_name + ".data"
+        self.plat_name_supplied = self.plat_name is not None
+
+        try:
+            self.compression = self.supported_compressions[self.compression]
+        except KeyError:
+            raise ValueError(f"Unsupported compression: {self.compression}") from None
+
+        need_options = ("dist_dir", "plat_name", "skip_build")
+
+        self.set_undefined_options("bdist", *zip(need_options, need_options))
+
+        self.root_is_pure = not (
+            self.distribution.has_ext_modules() or self.distribution.has_c_libraries()
+        )
+
+        if self.py_limited_api and not re.match(
+            PY_LIMITED_API_PATTERN, self.py_limited_api
+        ):
+            raise ValueError("py-limited-api must match '%s'" % PY_LIMITED_API_PATTERN)
+
+        # Support legacy [wheel] section for setting universal
+        wheel = self.distribution.get_option_dict("wheel")
+        if "universal" in wheel:
+            # please don't define this in your global configs
+            log.warning(
+                "The [wheel] section is deprecated. Use [bdist_wheel] instead.",
+            )
+            val = wheel["universal"][1].strip()
+            if val.lower() in ("1", "true", "yes"):
+                self.universal = True
+
+        if self.build_number is not None and not self.build_number[:1].isdigit():
+            raise ValueError("Build tag (build-number) must start with a digit.")
+
+    @property
+    def wheel_dist_name(self):
+        """Return distribution full name with - replaced with _"""
+        components = (
+            safer_name(self.distribution.get_name()),
+            safer_version(self.distribution.get_version()),
+        )
+        if self.build_number:
+            components += (self.build_number,)
+        return "-".join(components)
+
+    def get_tag(self):
+        # bdist sets self.plat_name if unset, we should only use it for purepy
+        # wheels if the user supplied it.
+        if self.plat_name_supplied:
+            plat_name = self.plat_name
+        elif self.root_is_pure:
+            plat_name = "any"
+        else:
+            # macosx contains system version in platform name so need special handle
+            if self.plat_name and not self.plat_name.startswith("macosx"):
+                plat_name = self.plat_name
+            else:
+                # on macosx always limit the platform name to comply with any
+                # c-extension modules in bdist_dir, since the user can specify
+                # a higher MACOSX_DEPLOYMENT_TARGET via tools like CMake
+
+                # on other platforms, and on macosx if there are no c-extension
+                # modules, use the default platform name.
+                plat_name = get_platform(self.bdist_dir)
+
+            if _is_32bit_interpreter():
+                if plat_name in ("linux-x86_64", "linux_x86_64"):
+                    plat_name = "linux_i686"
+                if plat_name in ("linux-aarch64", "linux_aarch64"):
+                    # TODO armv8l, packaging pull request #690 => this did not land
+                    # in pip/packaging yet
+                    plat_name = "linux_armv7l"
+
+        plat_name = (
+            plat_name.lower().replace("-", "_").replace(".", "_").replace(" ", "_")
+        )
+
+        if self.root_is_pure:
+            if self.universal:
+                impl = "py2.py3"
+            else:
+                impl = self.python_tag
+            tag = (impl, "none", plat_name)
+        else:
+            impl_name = tags.interpreter_name()
+            impl_ver = tags.interpreter_version()
+            impl = impl_name + impl_ver
+            # We don't work on CPython 3.1, 3.0.
+            if self.py_limited_api and (impl_name + impl_ver).startswith("cp3"):
+                impl = self.py_limited_api
+                abi_tag = "abi3"
+            else:
+                abi_tag = str(get_abi_tag()).lower()
+            tag = (impl, abi_tag, plat_name)
+            # issue gh-374: allow overriding plat_name
+            supported_tags = [
+                (t.interpreter, t.abi, plat_name) for t in tags.sys_tags()
+            ]
+            assert (
+                tag in supported_tags
+            ), f"would build wheel with unsupported tag {tag}"
+        return tag
+
+    def run(self):
+        build_scripts = self.reinitialize_command("build_scripts")
+        build_scripts.executable = "python"
+        build_scripts.force = True
+
+        build_ext = self.reinitialize_command("build_ext")
+        build_ext.inplace = False
+
+        if not self.skip_build:
+            self.run_command("build")
+
+        install = self.reinitialize_command("install", reinit_subcommands=True)
+        install.root = self.bdist_dir
+        install.compile = False
+        install.skip_build = self.skip_build
+        install.warn_dir = False
+
+        # A wheel without setuptools scripts is more cross-platform.
+        # Use the (undocumented) `no_ep` option to setuptools'
+        # install_scripts command to avoid creating entry point scripts.
+        install_scripts = self.reinitialize_command("install_scripts")
+        install_scripts.no_ep = True
+
+        # Use a custom scheme for the archive, because we have to decide
+        # at installation time which scheme to use.
+        for key in ("headers", "scripts", "data", "purelib", "platlib"):
+            setattr(install, "install_" + key, os.path.join(self.data_dir, key))
+
+        basedir_observed = ""
+
+        if os.name == "nt":
+            # win32 barfs if any of these are ''; could be '.'?
+            # (distutils.command.install:change_roots bug)
+            basedir_observed = os.path.normpath(os.path.join(self.data_dir, ".."))
+            self.install_libbase = self.install_lib = basedir_observed
+
+        setattr(
+            install,
+            "install_purelib" if self.root_is_pure else "install_platlib",
+            basedir_observed,
+        )
+
+        log.info(f"installing to {self.bdist_dir}")
+
+        self.run_command("install")
+
+        impl_tag, abi_tag, plat_tag = self.get_tag()
+        archive_basename = f"{self.wheel_dist_name}-{impl_tag}-{abi_tag}-{plat_tag}"
+        if not self.relative:
+            archive_root = self.bdist_dir
+        else:
+            archive_root = os.path.join(
+                self.bdist_dir, self._ensure_relative(install.install_base)
+            )
+
+        self.set_undefined_options("install_egg_info", ("target", "egginfo_dir"))
+        distinfo_dirname = (
+            f"{safer_name(self.distribution.get_name())}-"
+            f"{safer_version(self.distribution.get_version())}.dist-info"
+        )
+        distinfo_dir = os.path.join(self.bdist_dir, distinfo_dirname)
+        self.egg2dist(self.egginfo_dir, distinfo_dir)
+
+        self.write_wheelfile(distinfo_dir)
+
+        # Make the archive
+        if not os.path.exists(self.dist_dir):
+            os.makedirs(self.dist_dir)
+
+        wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl")
+        with WheelFile(wheel_path, "w", self.compression) as wf:
+            wf.write_files(archive_root)
+
+        # Add to 'Distribution.dist_files' so that the "upload" command works
+        getattr(self.distribution, "dist_files", []).append(
+            (
+                "bdist_wheel",
+                "{}.{}".format(*sys.version_info[:2]),  # like 3.7
+                wheel_path,
+            )
+        )
+
+        if not self.keep_temp:
+            log.info(f"removing {self.bdist_dir}")
+            if not self.dry_run:
+                if sys.version_info < (3, 12):
+                    rmtree(self.bdist_dir, onerror=remove_readonly)
+                else:
+                    rmtree(self.bdist_dir, onexc=remove_readonly_exc)
+
+    def write_wheelfile(
+        self, wheelfile_base, generator="bdist_wheel (" + wheel_version + ")"
+    ):
+        from email.message import Message
+
+        msg = Message()
+        msg["Wheel-Version"] = "1.0"  # of the spec
+        msg["Generator"] = generator
+        msg["Root-Is-Purelib"] = str(self.root_is_pure).lower()
+        if self.build_number is not None:
+            msg["Build"] = self.build_number
+
+        # Doesn't work for bdist_wininst
+        impl_tag, abi_tag, plat_tag = self.get_tag()
+        for impl in impl_tag.split("."):
+            for abi in abi_tag.split("."):
+                for plat in plat_tag.split("."):
+                    msg["Tag"] = "-".join((impl, abi, plat))
+
+        wheelfile_path = os.path.join(wheelfile_base, "WHEEL")
+        log.info(f"creating {wheelfile_path}")
+        with open(wheelfile_path, "wb") as f:
+            BytesGenerator(f, maxheaderlen=0).flatten(msg)
+
+    def _ensure_relative(self, path):
+        # copied from dir_util, deleted
+        drive, path = os.path.splitdrive(path)
+        if path[0:1] == os.sep:
+            path = drive + path[1:]
+        return path
+
+    @property
+    def license_paths(self):
+        if setuptools_major_version >= 57:
+            # Setuptools has resolved any patterns to actual file names
+            return self.distribution.metadata.license_files or ()
+
+        files = set()
+        metadata = self.distribution.get_option_dict("metadata")
+        if setuptools_major_version >= 42:
+            # Setuptools recognizes the license_files option but does not do globbing
+            patterns = self.distribution.metadata.license_files
+        else:
+            # Prior to those, wheel is entirely responsible for handling license files
+            if "license_files" in metadata:
+                patterns = metadata["license_files"][1].split()
+            else:
+                patterns = ()
+
+        if "license_file" in metadata:
+            warnings.warn(
+                'The "license_file" option is deprecated. Use "license_files" instead.',
+                DeprecationWarning,
+                stacklevel=2,
+            )
+            files.add(metadata["license_file"][1])
+
+        if not files and not patterns and not isinstance(patterns, list):
+            patterns = ("LICEN[CS]E*", "COPYING*", "NOTICE*", "AUTHORS*")
+
+        for pattern in patterns:
+            for path in iglob(pattern):
+                if path.endswith("~"):
+                    log.debug(
+                        f'ignoring license file "{path}" as it looks like a backup'
+                    )
+                    continue
+
+                if path not in files and os.path.isfile(path):
+                    log.info(
+                        f'adding license file "{path}" (matched pattern "{pattern}")'
+                    )
+                    files.add(path)
+
+        return files
+
+    def egg2dist(self, egginfo_path, distinfo_path):
+        """Convert an .egg-info directory into a .dist-info directory"""
+
+        def adios(p):
+            """Appropriately delete directory, file or link."""
+            if os.path.exists(p) and not os.path.islink(p) and os.path.isdir(p):
+                shutil.rmtree(p)
+            elif os.path.exists(p):
+                os.unlink(p)
+
+        adios(distinfo_path)
+
+        if not os.path.exists(egginfo_path):
+            # There is no egg-info. This is probably because the egg-info
+            # file/directory is not named matching the distribution name used
+            # to name the archive file. Check for this case and report
+            # accordingly.
+            import glob
+
+            pat = os.path.join(os.path.dirname(egginfo_path), "*.egg-info")
+            possible = glob.glob(pat)
+            err = f"Egg metadata expected at {egginfo_path} but not found"
+            if possible:
+                alt = os.path.basename(possible[0])
+                err += f" ({alt} found - possible misnamed archive file?)"
+
+            raise ValueError(err)
+
+        if os.path.isfile(egginfo_path):
+            # .egg-info is a single file
+            pkginfo_path = egginfo_path
+            pkg_info = pkginfo_to_metadata(egginfo_path, egginfo_path)
+            os.mkdir(distinfo_path)
+        else:
+            # .egg-info is a directory
+            pkginfo_path = os.path.join(egginfo_path, "PKG-INFO")
+            pkg_info = pkginfo_to_metadata(egginfo_path, pkginfo_path)
+
+            # ignore common egg metadata that is useless to wheel
+            shutil.copytree(
+                egginfo_path,
+                distinfo_path,
+                ignore=lambda x, y: {
+                    "PKG-INFO",
+                    "requires.txt",
+                    "SOURCES.txt",
+                    "not-zip-safe",
+                },
+            )
+
+            # delete dependency_links if it is only whitespace
+            dependency_links_path = os.path.join(distinfo_path, "dependency_links.txt")
+            with open(dependency_links_path, encoding="utf-8") as dependency_links_file:
+                dependency_links = dependency_links_file.read().strip()
+            if not dependency_links:
+                adios(dependency_links_path)
+
+        pkg_info_path = os.path.join(distinfo_path, "METADATA")
+        serialization_policy = EmailPolicy(
+            utf8=True,
+            mangle_from_=False,
+            max_line_length=0,
+        )
+        with open(pkg_info_path, "w", encoding="utf-8") as out:
+            Generator(out, policy=serialization_policy).flatten(pkg_info)
+
+        for license_path in self.license_paths:
+            filename = os.path.basename(license_path)
+            shutil.copy(license_path, os.path.join(distinfo_path, filename))
+
+        adios(egginfo_path)
diff --git a/setuptools/_vendor/wheel/cli/__init__.py b/setuptools/_vendor/wheel/cli/__init__.py
new file mode 100644
index 0000000000..a38860f5a6
--- /dev/null
+++ b/setuptools/_vendor/wheel/cli/__init__.py
@@ -0,0 +1,155 @@
+"""
+Wheel command-line utility.
+"""
+
+from __future__ import annotations
+
+import argparse
+import os
+import sys
+from argparse import ArgumentTypeError
+
+
+class WheelError(Exception):
+    pass
+
+
+def unpack_f(args):
+    from .unpack import unpack
+
+    unpack(args.wheelfile, args.dest)
+
+
+def pack_f(args):
+    from .pack import pack
+
+    pack(args.directory, args.dest_dir, args.build_number)
+
+
+def convert_f(args):
+    from .convert import convert
+
+    convert(args.files, args.dest_dir, args.verbose)
+
+
+def tags_f(args):
+    from .tags import tags
+
+    names = (
+        tags(
+            wheel,
+            args.python_tag,
+            args.abi_tag,
+            args.platform_tag,
+            args.build,
+            args.remove,
+        )
+        for wheel in args.wheel
+    )
+
+    for name in names:
+        print(name)
+
+
+def version_f(args):
+    from .. import __version__
+
+    print("wheel %s" % __version__)
+
+
+def parse_build_tag(build_tag: str) -> str:
+    if build_tag and not build_tag[0].isdigit():
+        raise ArgumentTypeError("build tag must begin with a digit")
+    elif "-" in build_tag:
+        raise ArgumentTypeError("invalid character ('-') in build tag")
+
+    return build_tag
+
+
+TAGS_HELP = """\
+Make a new wheel with given tags. Any tags unspecified will remain the same.
+Starting the tags with a "+" will append to the existing tags. Starting with a
+"-" will remove a tag (use --option=-TAG syntax). Multiple tags can be
+separated by ".". The original file will remain unless --remove is given.  The
+output filename(s) will be displayed on stdout for further processing.
+"""
+
+
+def parser():
+    p = argparse.ArgumentParser()
+    s = p.add_subparsers(help="commands")
+
+    unpack_parser = s.add_parser("unpack", help="Unpack wheel")
+    unpack_parser.add_argument(
+        "--dest", "-d", help="Destination directory", default="."
+    )
+    unpack_parser.add_argument("wheelfile", help="Wheel file")
+    unpack_parser.set_defaults(func=unpack_f)
+
+    repack_parser = s.add_parser("pack", help="Repack wheel")
+    repack_parser.add_argument("directory", help="Root directory of the unpacked wheel")
+    repack_parser.add_argument(
+        "--dest-dir",
+        "-d",
+        default=os.path.curdir,
+        help="Directory to store the wheel (default %(default)s)",
+    )
+    repack_parser.add_argument(
+        "--build-number", help="Build tag to use in the wheel name"
+    )
+    repack_parser.set_defaults(func=pack_f)
+
+    convert_parser = s.add_parser("convert", help="Convert egg or wininst to wheel")
+    convert_parser.add_argument("files", nargs="*", help="Files to convert")
+    convert_parser.add_argument(
+        "--dest-dir",
+        "-d",
+        default=os.path.curdir,
+        help="Directory to store wheels (default %(default)s)",
+    )
+    convert_parser.add_argument("--verbose", "-v", action="store_true")
+    convert_parser.set_defaults(func=convert_f)
+
+    tags_parser = s.add_parser(
+        "tags", help="Add or replace the tags on a wheel", description=TAGS_HELP
+    )
+    tags_parser.add_argument("wheel", nargs="*", help="Existing wheel(s) to retag")
+    tags_parser.add_argument(
+        "--remove",
+        action="store_true",
+        help="Remove the original files, keeping only the renamed ones",
+    )
+    tags_parser.add_argument(
+        "--python-tag", metavar="TAG", help="Specify an interpreter tag(s)"
+    )
+    tags_parser.add_argument("--abi-tag", metavar="TAG", help="Specify an ABI tag(s)")
+    tags_parser.add_argument(
+        "--platform-tag", metavar="TAG", help="Specify a platform tag(s)"
+    )
+    tags_parser.add_argument(
+        "--build", type=parse_build_tag, metavar="BUILD", help="Specify a build tag"
+    )
+    tags_parser.set_defaults(func=tags_f)
+
+    version_parser = s.add_parser("version", help="Print version and exit")
+    version_parser.set_defaults(func=version_f)
+
+    help_parser = s.add_parser("help", help="Show this help")
+    help_parser.set_defaults(func=lambda args: p.print_help())
+
+    return p
+
+
+def main():
+    p = parser()
+    args = p.parse_args()
+    if not hasattr(args, "func"):
+        p.print_help()
+    else:
+        try:
+            args.func(args)
+            return 0
+        except WheelError as e:
+            print(e, file=sys.stderr)
+
+    return 1
diff --git a/setuptools/_vendor/wheel/cli/convert.py b/setuptools/_vendor/wheel/cli/convert.py
new file mode 100644
index 0000000000..291534046a
--- /dev/null
+++ b/setuptools/_vendor/wheel/cli/convert.py
@@ -0,0 +1,273 @@
+from __future__ import annotations
+
+import os.path
+import re
+import shutil
+import tempfile
+import zipfile
+from glob import iglob
+
+from ..bdist_wheel import bdist_wheel
+from ..wheelfile import WheelFile
+from . import WheelError
+
+try:
+    from setuptools import Distribution
+except ImportError:
+    from distutils.dist import Distribution
+
+egg_info_re = re.compile(
+    r"""
+    (?P.+?)-(?P.+?)
+    (-(?Ppy\d\.\d+)
+     (-(?P.+?))?
+    )?.egg$""",
+    re.VERBOSE,
+)
+
+
+class _bdist_wheel_tag(bdist_wheel):
+    # allow the client to override the default generated wheel tag
+    # The default bdist_wheel implementation uses python and abi tags
+    # of the running python process. This is not suitable for
+    # generating/repackaging prebuild binaries.
+
+    full_tag_supplied = False
+    full_tag = None  # None or a (pytag, soabitag, plattag) triple
+
+    def get_tag(self):
+        if self.full_tag_supplied and self.full_tag is not None:
+            return self.full_tag
+        else:
+            return bdist_wheel.get_tag(self)
+
+
+def egg2wheel(egg_path: str, dest_dir: str) -> None:
+    filename = os.path.basename(egg_path)
+    match = egg_info_re.match(filename)
+    if not match:
+        raise WheelError(f"Invalid egg file name: {filename}")
+
+    egg_info = match.groupdict()
+    dir = tempfile.mkdtemp(suffix="_e2w")
+    if os.path.isfile(egg_path):
+        # assume we have a bdist_egg otherwise
+        with zipfile.ZipFile(egg_path) as egg:
+            egg.extractall(dir)
+    else:
+        # support buildout-style installed eggs directories
+        for pth in os.listdir(egg_path):
+            src = os.path.join(egg_path, pth)
+            if os.path.isfile(src):
+                shutil.copy2(src, dir)
+            else:
+                shutil.copytree(src, os.path.join(dir, pth))
+
+    pyver = egg_info["pyver"]
+    if pyver:
+        pyver = egg_info["pyver"] = pyver.replace(".", "")
+
+    arch = (egg_info["arch"] or "any").replace(".", "_").replace("-", "_")
+
+    # assume all binary eggs are for CPython
+    abi = "cp" + pyver[2:] if arch != "any" else "none"
+
+    root_is_purelib = egg_info["arch"] is None
+    if root_is_purelib:
+        bw = bdist_wheel(Distribution())
+    else:
+        bw = _bdist_wheel_tag(Distribution())
+
+    bw.root_is_pure = root_is_purelib
+    bw.python_tag = pyver
+    bw.plat_name_supplied = True
+    bw.plat_name = egg_info["arch"] or "any"
+    if not root_is_purelib:
+        bw.full_tag_supplied = True
+        bw.full_tag = (pyver, abi, arch)
+
+    dist_info_dir = os.path.join(dir, "{name}-{ver}.dist-info".format(**egg_info))
+    bw.egg2dist(os.path.join(dir, "EGG-INFO"), dist_info_dir)
+    bw.write_wheelfile(dist_info_dir, generator="egg2wheel")
+    wheel_name = "{name}-{ver}-{pyver}-{}-{}.whl".format(abi, arch, **egg_info)
+    with WheelFile(os.path.join(dest_dir, wheel_name), "w") as wf:
+        wf.write_files(dir)
+
+    shutil.rmtree(dir)
+
+
+def parse_wininst_info(wininfo_name, egginfo_name):
+    """Extract metadata from filenames.
+
+    Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
+    the installer filename and the name of the egg-info directory embedded in
+    the zipfile (if any).
+
+    The egginfo filename has the format::
+
+        name-ver(-pyver)(-arch).egg-info
+
+    The installer filename has the format::
+
+        name-ver.arch(-pyver).exe
+
+    Some things to note:
+
+    1. The installer filename is not definitive. An installer can be renamed
+       and work perfectly well as an installer. So more reliable data should
+       be used whenever possible.
+    2. The egg-info data should be preferred for the name and version, because
+       these come straight from the distutils metadata, and are mandatory.
+    3. The pyver from the egg-info data should be ignored, as it is
+       constructed from the version of Python used to build the installer,
+       which is irrelevant - the installer filename is correct here (even to
+       the point that when it's not there, any version is implied).
+    4. The architecture must be taken from the installer filename, as it is
+       not included in the egg-info data.
+    5. Architecture-neutral installers still have an architecture because the
+       installer format itself (being executable) is architecture-specific. We
+       should therefore ignore the architecture if the content is pure-python.
+    """
+
+    egginfo = None
+    if egginfo_name:
+        egginfo = egg_info_re.search(egginfo_name)
+        if not egginfo:
+            raise ValueError(f"Egg info filename {egginfo_name} is not valid")
+
+    # Parse the wininst filename
+    # 1. Distribution name (up to the first '-')
+    w_name, sep, rest = wininfo_name.partition("-")
+    if not sep:
+        raise ValueError(f"Installer filename {wininfo_name} is not valid")
+
+    # Strip '.exe'
+    rest = rest[:-4]
+    # 2. Python version (from the last '-', must start with 'py')
+    rest2, sep, w_pyver = rest.rpartition("-")
+    if sep and w_pyver.startswith("py"):
+        rest = rest2
+        w_pyver = w_pyver.replace(".", "")
+    else:
+        # Not version specific - use py2.py3. While it is possible that
+        # pure-Python code is not compatible with both Python 2 and 3, there
+        # is no way of knowing from the wininst format, so we assume the best
+        # here (the user can always manually rename the wheel to be more
+        # restrictive if needed).
+        w_pyver = "py2.py3"
+    # 3. Version and architecture
+    w_ver, sep, w_arch = rest.rpartition(".")
+    if not sep:
+        raise ValueError(f"Installer filename {wininfo_name} is not valid")
+
+    if egginfo:
+        w_name = egginfo.group("name")
+        w_ver = egginfo.group("ver")
+
+    return {"name": w_name, "ver": w_ver, "arch": w_arch, "pyver": w_pyver}
+
+
+def wininst2wheel(path, dest_dir):
+    with zipfile.ZipFile(path) as bdw:
+        # Search for egg-info in the archive
+        egginfo_name = None
+        for filename in bdw.namelist():
+            if ".egg-info" in filename:
+                egginfo_name = filename
+                break
+
+        info = parse_wininst_info(os.path.basename(path), egginfo_name)
+
+        root_is_purelib = True
+        for zipinfo in bdw.infolist():
+            if zipinfo.filename.startswith("PLATLIB"):
+                root_is_purelib = False
+                break
+        if root_is_purelib:
+            paths = {"purelib": ""}
+        else:
+            paths = {"platlib": ""}
+
+        dist_info = "{name}-{ver}".format(**info)
+        datadir = "%s.data/" % dist_info
+
+        # rewrite paths to trick ZipFile into extracting an egg
+        # XXX grab wininst .ini - between .exe, padding, and first zip file.
+        members = []
+        egginfo_name = ""
+        for zipinfo in bdw.infolist():
+            key, basename = zipinfo.filename.split("/", 1)
+            key = key.lower()
+            basepath = paths.get(key, None)
+            if basepath is None:
+                basepath = datadir + key.lower() + "/"
+            oldname = zipinfo.filename
+            newname = basepath + basename
+            zipinfo.filename = newname
+            del bdw.NameToInfo[oldname]
+            bdw.NameToInfo[newname] = zipinfo
+            # Collect member names, but omit '' (from an entry like "PLATLIB/"
+            if newname:
+                members.append(newname)
+            # Remember egg-info name for the egg2dist call below
+            if not egginfo_name:
+                if newname.endswith(".egg-info"):
+                    egginfo_name = newname
+                elif ".egg-info/" in newname:
+                    egginfo_name, sep, _ = newname.rpartition("/")
+        dir = tempfile.mkdtemp(suffix="_b2w")
+        bdw.extractall(dir, members)
+
+    # egg2wheel
+    abi = "none"
+    pyver = info["pyver"]
+    arch = (info["arch"] or "any").replace(".", "_").replace("-", "_")
+    # Wininst installers always have arch even if they are not
+    # architecture-specific (because the format itself is).
+    # So, assume the content is architecture-neutral if root is purelib.
+    if root_is_purelib:
+        arch = "any"
+    # If the installer is architecture-specific, it's almost certainly also
+    # CPython-specific.
+    if arch != "any":
+        pyver = pyver.replace("py", "cp")
+    wheel_name = "-".join((dist_info, pyver, abi, arch))
+    if root_is_purelib:
+        bw = bdist_wheel(Distribution())
+    else:
+        bw = _bdist_wheel_tag(Distribution())
+
+    bw.root_is_pure = root_is_purelib
+    bw.python_tag = pyver
+    bw.plat_name_supplied = True
+    bw.plat_name = info["arch"] or "any"
+
+    if not root_is_purelib:
+        bw.full_tag_supplied = True
+        bw.full_tag = (pyver, abi, arch)
+
+    dist_info_dir = os.path.join(dir, "%s.dist-info" % dist_info)
+    bw.egg2dist(os.path.join(dir, egginfo_name), dist_info_dir)
+    bw.write_wheelfile(dist_info_dir, generator="wininst2wheel")
+
+    wheel_path = os.path.join(dest_dir, wheel_name)
+    with WheelFile(wheel_path, "w") as wf:
+        wf.write_files(dir)
+
+    shutil.rmtree(dir)
+
+
+def convert(files, dest_dir, verbose):
+    for pat in files:
+        for installer in iglob(pat):
+            if os.path.splitext(installer)[1] == ".egg":
+                conv = egg2wheel
+            else:
+                conv = wininst2wheel
+
+            if verbose:
+                print(f"{installer}... ", flush=True)
+
+            conv(installer, dest_dir)
+            if verbose:
+                print("OK")
diff --git a/setuptools/_vendor/wheel/cli/pack.py b/setuptools/_vendor/wheel/cli/pack.py
new file mode 100644
index 0000000000..64469c0c73
--- /dev/null
+++ b/setuptools/_vendor/wheel/cli/pack.py
@@ -0,0 +1,85 @@
+from __future__ import annotations
+
+import email.policy
+import os.path
+import re
+from email.generator import BytesGenerator
+from email.parser import BytesParser
+
+from wheel.cli import WheelError
+from wheel.wheelfile import WheelFile
+
+DIST_INFO_RE = re.compile(r"^(?P(?P.+?)-(?P\d.*?))\.dist-info$")
+
+
+def pack(directory: str, dest_dir: str, build_number: str | None) -> None:
+    """Repack a previously unpacked wheel directory into a new wheel file.
+
+    The .dist-info/WHEEL file must contain one or more tags so that the target
+    wheel file name can be determined.
+
+    :param directory: The unpacked wheel directory
+    :param dest_dir: Destination directory (defaults to the current directory)
+    """
+    # Find the .dist-info directory
+    dist_info_dirs = [
+        fn
+        for fn in os.listdir(directory)
+        if os.path.isdir(os.path.join(directory, fn)) and DIST_INFO_RE.match(fn)
+    ]
+    if len(dist_info_dirs) > 1:
+        raise WheelError(f"Multiple .dist-info directories found in {directory}")
+    elif not dist_info_dirs:
+        raise WheelError(f"No .dist-info directories found in {directory}")
+
+    # Determine the target wheel filename
+    dist_info_dir = dist_info_dirs[0]
+    name_version = DIST_INFO_RE.match(dist_info_dir).group("namever")
+
+    # Read the tags and the existing build number from .dist-info/WHEEL
+    wheel_file_path = os.path.join(directory, dist_info_dir, "WHEEL")
+    with open(wheel_file_path, "rb") as f:
+        info = BytesParser(policy=email.policy.compat32).parse(f)
+        tags: list[str] = info.get_all("Tag", [])
+        existing_build_number = info.get("Build")
+
+        if not tags:
+            raise WheelError(
+                f"No tags present in {dist_info_dir}/WHEEL; cannot determine target "
+                f"wheel filename"
+            )
+
+    # Set the wheel file name and add/replace/remove the Build tag in .dist-info/WHEEL
+    build_number = build_number if build_number is not None else existing_build_number
+    if build_number is not None:
+        del info["Build"]
+        if build_number:
+            info["Build"] = build_number
+            name_version += "-" + build_number
+
+        if build_number != existing_build_number:
+            with open(wheel_file_path, "wb") as f:
+                BytesGenerator(f, maxheaderlen=0).flatten(info)
+
+    # Reassemble the tags for the wheel file
+    tagline = compute_tagline(tags)
+
+    # Repack the wheel
+    wheel_path = os.path.join(dest_dir, f"{name_version}-{tagline}.whl")
+    with WheelFile(wheel_path, "w") as wf:
+        print(f"Repacking wheel as {wheel_path}...", end="", flush=True)
+        wf.write_files(directory)
+
+    print("OK")
+
+
+def compute_tagline(tags: list[str]) -> str:
+    """Compute a tagline from a list of tags.
+
+    :param tags: A list of tags
+    :return: A tagline
+    """
+    impls = sorted({tag.split("-")[0] for tag in tags})
+    abivers = sorted({tag.split("-")[1] for tag in tags})
+    platforms = sorted({tag.split("-")[2] for tag in tags})
+    return "-".join([".".join(impls), ".".join(abivers), ".".join(platforms)])
diff --git a/setuptools/_vendor/wheel/cli/tags.py b/setuptools/_vendor/wheel/cli/tags.py
new file mode 100644
index 0000000000..88da72e9ec
--- /dev/null
+++ b/setuptools/_vendor/wheel/cli/tags.py
@@ -0,0 +1,139 @@
+from __future__ import annotations
+
+import email.policy
+import itertools
+import os
+from collections.abc import Iterable
+from email.parser import BytesParser
+
+from ..wheelfile import WheelFile
+
+
+def _compute_tags(original_tags: Iterable[str], new_tags: str | None) -> set[str]:
+    """Add or replace tags. Supports dot-separated tags"""
+    if new_tags is None:
+        return set(original_tags)
+
+    if new_tags.startswith("+"):
+        return {*original_tags, *new_tags[1:].split(".")}
+
+    if new_tags.startswith("-"):
+        return set(original_tags) - set(new_tags[1:].split("."))
+
+    return set(new_tags.split("."))
+
+
+def tags(
+    wheel: str,
+    python_tags: str | None = None,
+    abi_tags: str | None = None,
+    platform_tags: str | None = None,
+    build_tag: str | None = None,
+    remove: bool = False,
+) -> str:
+    """Change the tags on a wheel file.
+
+    The tags are left unchanged if they are not specified. To specify "none",
+    use ["none"]. To append to the previous tags, a tag should start with a
+    "+".  If a tag starts with "-", it will be removed from existing tags.
+    Processing is done left to right.
+
+    :param wheel: The paths to the wheels
+    :param python_tags: The Python tags to set
+    :param abi_tags: The ABI tags to set
+    :param platform_tags: The platform tags to set
+    :param build_tag: The build tag to set
+    :param remove: Remove the original wheel
+    """
+    with WheelFile(wheel, "r") as f:
+        assert f.filename, f"{f.filename} must be available"
+
+        wheel_info = f.read(f.dist_info_path + "/WHEEL")
+        info = BytesParser(policy=email.policy.compat32).parsebytes(wheel_info)
+
+        original_wheel_name = os.path.basename(f.filename)
+        namever = f.parsed_filename.group("namever")
+        build = f.parsed_filename.group("build")
+        original_python_tags = f.parsed_filename.group("pyver").split(".")
+        original_abi_tags = f.parsed_filename.group("abi").split(".")
+        original_plat_tags = f.parsed_filename.group("plat").split(".")
+
+    tags: list[str] = info.get_all("Tag", [])
+    existing_build_tag = info.get("Build")
+
+    impls = {tag.split("-")[0] for tag in tags}
+    abivers = {tag.split("-")[1] for tag in tags}
+    platforms = {tag.split("-")[2] for tag in tags}
+
+    if impls != set(original_python_tags):
+        msg = f"Wheel internal tags {impls!r} != filename tags {original_python_tags!r}"
+        raise AssertionError(msg)
+
+    if abivers != set(original_abi_tags):
+        msg = f"Wheel internal tags {abivers!r} != filename tags {original_abi_tags!r}"
+        raise AssertionError(msg)
+
+    if platforms != set(original_plat_tags):
+        msg = (
+            f"Wheel internal tags {platforms!r} != filename tags {original_plat_tags!r}"
+        )
+        raise AssertionError(msg)
+
+    if existing_build_tag != build:
+        msg = (
+            f"Incorrect filename '{build}' "
+            f"& *.dist-info/WHEEL '{existing_build_tag}' build numbers"
+        )
+        raise AssertionError(msg)
+
+    # Start changing as needed
+    if build_tag is not None:
+        build = build_tag
+
+    final_python_tags = sorted(_compute_tags(original_python_tags, python_tags))
+    final_abi_tags = sorted(_compute_tags(original_abi_tags, abi_tags))
+    final_plat_tags = sorted(_compute_tags(original_plat_tags, platform_tags))
+
+    final_tags = [
+        namever,
+        ".".join(final_python_tags),
+        ".".join(final_abi_tags),
+        ".".join(final_plat_tags),
+    ]
+    if build:
+        final_tags.insert(1, build)
+
+    final_wheel_name = "-".join(final_tags) + ".whl"
+
+    if original_wheel_name != final_wheel_name:
+        del info["Tag"], info["Build"]
+        for a, b, c in itertools.product(
+            final_python_tags, final_abi_tags, final_plat_tags
+        ):
+            info["Tag"] = f"{a}-{b}-{c}"
+        if build:
+            info["Build"] = build
+
+        original_wheel_path = os.path.join(
+            os.path.dirname(f.filename), original_wheel_name
+        )
+        final_wheel_path = os.path.join(os.path.dirname(f.filename), final_wheel_name)
+
+        with WheelFile(original_wheel_path, "r") as fin, WheelFile(
+            final_wheel_path, "w"
+        ) as fout:
+            fout.comment = fin.comment  # preserve the comment
+            for item in fin.infolist():
+                if item.is_dir():
+                    continue
+                if item.filename == f.dist_info_path + "/RECORD":
+                    continue
+                if item.filename == f.dist_info_path + "/WHEEL":
+                    fout.writestr(item, info.as_bytes())
+                else:
+                    fout.writestr(item, fin.read(item))
+
+        if remove:
+            os.remove(original_wheel_path)
+
+    return final_wheel_name
diff --git a/setuptools/_vendor/wheel/cli/unpack.py b/setuptools/_vendor/wheel/cli/unpack.py
new file mode 100644
index 0000000000..d48840e6ec
--- /dev/null
+++ b/setuptools/_vendor/wheel/cli/unpack.py
@@ -0,0 +1,30 @@
+from __future__ import annotations
+
+from pathlib import Path
+
+from ..wheelfile import WheelFile
+
+
+def unpack(path: str, dest: str = ".") -> None:
+    """Unpack a wheel.
+
+    Wheel content will be unpacked to {dest}/{name}-{ver}, where {name}
+    is the package name and {ver} its version.
+
+    :param path: The path to the wheel.
+    :param dest: Destination directory (default to current directory).
+    """
+    with WheelFile(path) as wf:
+        namever = wf.parsed_filename.group("namever")
+        destination = Path(dest) / namever
+        print(f"Unpacking to: {destination}...", end="", flush=True)
+        for zinfo in wf.filelist:
+            wf.extract(zinfo, destination)
+
+            # Set permissions to the same values as they were set in the archive
+            # We have to do this manually due to
+            # https://github.com/python/cpython/issues/59999
+            permissions = zinfo.external_attr >> 16 & 0o777
+            destination.joinpath(zinfo.filename).chmod(permissions)
+
+    print("OK")
diff --git a/setuptools/_vendor/wheel/metadata.py b/setuptools/_vendor/wheel/metadata.py
index 341f614ceb..6aa4362808 100644
--- a/setuptools/_vendor/wheel/metadata.py
+++ b/setuptools/_vendor/wheel/metadata.py
@@ -13,7 +13,7 @@
 from email.parser import Parser
 from typing import Iterator
 
-from ..packaging.requirements import Requirement
+from .vendored.packaging.requirements import Requirement
 
 
 def _nonblank(str):
diff --git a/setuptools/_vendor/wheel/vendored/__init__.py b/setuptools/_vendor/wheel/vendored/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/wheel/vendored/packaging/__init__.py b/setuptools/_vendor/wheel/vendored/packaging/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/wheel/vendored/packaging/_elffile.py b/setuptools/_vendor/wheel/vendored/packaging/_elffile.py
new file mode 100644
index 0000000000..6fb19b30bb
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/_elffile.py
@@ -0,0 +1,108 @@
+"""
+ELF file parser.
+
+This provides a class ``ELFFile`` that parses an ELF executable in a similar
+interface to ``ZipFile``. Only the read interface is implemented.
+
+Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca
+ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
+"""
+
+import enum
+import os
+import struct
+from typing import IO, Optional, Tuple
+
+
+class ELFInvalid(ValueError):
+    pass
+
+
+class EIClass(enum.IntEnum):
+    C32 = 1
+    C64 = 2
+
+
+class EIData(enum.IntEnum):
+    Lsb = 1
+    Msb = 2
+
+
+class EMachine(enum.IntEnum):
+    I386 = 3
+    S390 = 22
+    Arm = 40
+    X8664 = 62
+    AArc64 = 183
+
+
+class ELFFile:
+    """
+    Representation of an ELF executable.
+    """
+
+    def __init__(self, f: IO[bytes]) -> None:
+        self._f = f
+
+        try:
+            ident = self._read("16B")
+        except struct.error:
+            raise ELFInvalid("unable to parse identification")
+        magic = bytes(ident[:4])
+        if magic != b"\x7fELF":
+            raise ELFInvalid(f"invalid magic: {magic!r}")
+
+        self.capacity = ident[4]  # Format for program header (bitness).
+        self.encoding = ident[5]  # Data structure encoding (endianness).
+
+        try:
+            # e_fmt: Format for program header.
+            # p_fmt: Format for section header.
+            # p_idx: Indexes to find p_type, p_offset, and p_filesz.
+            e_fmt, self._p_fmt, self._p_idx = {
+                (1, 1): ("HHIIIIIHHH", ">IIIIIIII", (0, 1, 4)),  # 32-bit MSB.
+                (2, 1): ("HHIQQQIHHH", ">IIQQQQQQ", (0, 2, 5)),  # 64-bit MSB.
+            }[(self.capacity, self.encoding)]
+        except KeyError:
+            raise ELFInvalid(
+                f"unrecognized capacity ({self.capacity}) or "
+                f"encoding ({self.encoding})"
+            )
+
+        try:
+            (
+                _,
+                self.machine,  # Architecture type.
+                _,
+                _,
+                self._e_phoff,  # Offset of program header.
+                _,
+                self.flags,  # Processor-specific flags.
+                _,
+                self._e_phentsize,  # Size of section.
+                self._e_phnum,  # Number of sections.
+            ) = self._read(e_fmt)
+        except struct.error as e:
+            raise ELFInvalid("unable to parse machine and section information") from e
+
+    def _read(self, fmt: str) -> Tuple[int, ...]:
+        return struct.unpack(fmt, self._f.read(struct.calcsize(fmt)))
+
+    @property
+    def interpreter(self) -> Optional[str]:
+        """
+        The path recorded in the ``PT_INTERP`` section header.
+        """
+        for index in range(self._e_phnum):
+            self._f.seek(self._e_phoff + self._e_phentsize * index)
+            try:
+                data = self._read(self._p_fmt)
+            except struct.error:
+                continue
+            if data[self._p_idx[0]] != 3:  # Not PT_INTERP.
+                continue
+            self._f.seek(data[self._p_idx[1]])
+            return os.fsdecode(self._f.read(data[self._p_idx[2]])).strip("\0")
+        return None
diff --git a/setuptools/_vendor/wheel/vendored/packaging/_manylinux.py b/setuptools/_vendor/wheel/vendored/packaging/_manylinux.py
new file mode 100644
index 0000000000..1f5f4ab3e5
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/_manylinux.py
@@ -0,0 +1,260 @@
+import collections
+import contextlib
+import functools
+import os
+import re
+import sys
+import warnings
+from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple
+
+from ._elffile import EIClass, EIData, ELFFile, EMachine
+
+EF_ARM_ABIMASK = 0xFF000000
+EF_ARM_ABI_VER5 = 0x05000000
+EF_ARM_ABI_FLOAT_HARD = 0x00000400
+
+
+# `os.PathLike` not a generic type until Python 3.9, so sticking with `str`
+# as the type for `path` until then.
+@contextlib.contextmanager
+def _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]:
+    try:
+        with open(path, "rb") as f:
+            yield ELFFile(f)
+    except (OSError, TypeError, ValueError):
+        yield None
+
+
+def _is_linux_armhf(executable: str) -> bool:
+    # hard-float ABI can be detected from the ELF header of the running
+    # process
+    # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf
+    with _parse_elf(executable) as f:
+        return (
+            f is not None
+            and f.capacity == EIClass.C32
+            and f.encoding == EIData.Lsb
+            and f.machine == EMachine.Arm
+            and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5
+            and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD
+        )
+
+
+def _is_linux_i686(executable: str) -> bool:
+    with _parse_elf(executable) as f:
+        return (
+            f is not None
+            and f.capacity == EIClass.C32
+            and f.encoding == EIData.Lsb
+            and f.machine == EMachine.I386
+        )
+
+
+def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool:
+    if "armv7l" in archs:
+        return _is_linux_armhf(executable)
+    if "i686" in archs:
+        return _is_linux_i686(executable)
+    allowed_archs = {
+        "x86_64",
+        "aarch64",
+        "ppc64",
+        "ppc64le",
+        "s390x",
+        "loongarch64",
+        "riscv64",
+    }
+    return any(arch in allowed_archs for arch in archs)
+
+
+# If glibc ever changes its major version, we need to know what the last
+# minor version was, so we can build the complete list of all versions.
+# For now, guess what the highest minor version might be, assume it will
+# be 50 for testing. Once this actually happens, update the dictionary
+# with the actual value.
+_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50)
+
+
+class _GLibCVersion(NamedTuple):
+    major: int
+    minor: int
+
+
+def _glibc_version_string_confstr() -> Optional[str]:
+    """
+    Primary implementation of glibc_version_string using os.confstr.
+    """
+    # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely
+    # to be broken or missing. This strategy is used in the standard library
+    # platform module.
+    # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183
+    try:
+        # Should be a string like "glibc 2.17".
+        version_string: Optional[str] = os.confstr("CS_GNU_LIBC_VERSION")
+        assert version_string is not None
+        _, version = version_string.rsplit()
+    except (AssertionError, AttributeError, OSError, ValueError):
+        # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
+        return None
+    return version
+
+
+def _glibc_version_string_ctypes() -> Optional[str]:
+    """
+    Fallback implementation of glibc_version_string using ctypes.
+    """
+    try:
+        import ctypes
+    except ImportError:
+        return None
+
+    # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
+    # manpage says, "If filename is NULL, then the returned handle is for the
+    # main program". This way we can let the linker do the work to figure out
+    # which libc our process is actually using.
+    #
+    # We must also handle the special case where the executable is not a
+    # dynamically linked executable. This can occur when using musl libc,
+    # for example. In this situation, dlopen() will error, leading to an
+    # OSError. Interestingly, at least in the case of musl, there is no
+    # errno set on the OSError. The single string argument used to construct
+    # OSError comes from libc itself and is therefore not portable to
+    # hard code here. In any case, failure to call dlopen() means we
+    # can proceed, so we bail on our attempt.
+    try:
+        process_namespace = ctypes.CDLL(None)
+    except OSError:
+        return None
+
+    try:
+        gnu_get_libc_version = process_namespace.gnu_get_libc_version
+    except AttributeError:
+        # Symbol doesn't exist -> therefore, we are not linked to
+        # glibc.
+        return None
+
+    # Call gnu_get_libc_version, which returns a string like "2.5"
+    gnu_get_libc_version.restype = ctypes.c_char_p
+    version_str: str = gnu_get_libc_version()
+    # py2 / py3 compatibility:
+    if not isinstance(version_str, str):
+        version_str = version_str.decode("ascii")
+
+    return version_str
+
+
+def _glibc_version_string() -> Optional[str]:
+    """Returns glibc version string, or None if not using glibc."""
+    return _glibc_version_string_confstr() or _glibc_version_string_ctypes()
+
+
+def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
+    """Parse glibc version.
+
+    We use a regexp instead of str.split because we want to discard any
+    random junk that might come after the minor version -- this might happen
+    in patched/forked versions of glibc (e.g. Linaro's version of glibc
+    uses version strings like "2.20-2014.11"). See gh-3588.
+    """
+    m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str)
+    if not m:
+        warnings.warn(
+            f"Expected glibc version with 2 components major.minor,"
+            f" got: {version_str}",
+            RuntimeWarning,
+        )
+        return -1, -1
+    return int(m.group("major")), int(m.group("minor"))
+
+
+@functools.lru_cache
+def _get_glibc_version() -> Tuple[int, int]:
+    version_str = _glibc_version_string()
+    if version_str is None:
+        return (-1, -1)
+    return _parse_glibc_version(version_str)
+
+
+# From PEP 513, PEP 600
+def _is_compatible(arch: str, version: _GLibCVersion) -> bool:
+    sys_glibc = _get_glibc_version()
+    if sys_glibc < version:
+        return False
+    # Check for presence of _manylinux module.
+    try:
+        import _manylinux
+    except ImportError:
+        return True
+    if hasattr(_manylinux, "manylinux_compatible"):
+        result = _manylinux.manylinux_compatible(version[0], version[1], arch)
+        if result is not None:
+            return bool(result)
+        return True
+    if version == _GLibCVersion(2, 5):
+        if hasattr(_manylinux, "manylinux1_compatible"):
+            return bool(_manylinux.manylinux1_compatible)
+    if version == _GLibCVersion(2, 12):
+        if hasattr(_manylinux, "manylinux2010_compatible"):
+            return bool(_manylinux.manylinux2010_compatible)
+    if version == _GLibCVersion(2, 17):
+        if hasattr(_manylinux, "manylinux2014_compatible"):
+            return bool(_manylinux.manylinux2014_compatible)
+    return True
+
+
+_LEGACY_MANYLINUX_MAP = {
+    # CentOS 7 w/ glibc 2.17 (PEP 599)
+    (2, 17): "manylinux2014",
+    # CentOS 6 w/ glibc 2.12 (PEP 571)
+    (2, 12): "manylinux2010",
+    # CentOS 5 w/ glibc 2.5 (PEP 513)
+    (2, 5): "manylinux1",
+}
+
+
+def platform_tags(archs: Sequence[str]) -> Iterator[str]:
+    """Generate manylinux tags compatible to the current platform.
+
+    :param archs: Sequence of compatible architectures.
+        The first one shall be the closest to the actual architecture and be the part of
+        platform tag after the ``linux_`` prefix, e.g. ``x86_64``.
+        The ``linux_`` prefix is assumed as a prerequisite for the current platform to
+        be manylinux-compatible.
+
+    :returns: An iterator of compatible manylinux tags.
+    """
+    if not _have_compatible_abi(sys.executable, archs):
+        return
+    # Oldest glibc to be supported regardless of architecture is (2, 17).
+    too_old_glibc2 = _GLibCVersion(2, 16)
+    if set(archs) & {"x86_64", "i686"}:
+        # On x86/i686 also oldest glibc to be supported is (2, 5).
+        too_old_glibc2 = _GLibCVersion(2, 4)
+    current_glibc = _GLibCVersion(*_get_glibc_version())
+    glibc_max_list = [current_glibc]
+    # We can assume compatibility across glibc major versions.
+    # https://sourceware.org/bugzilla/show_bug.cgi?id=24636
+    #
+    # Build a list of maximum glibc versions so that we can
+    # output the canonical list of all glibc from current_glibc
+    # down to too_old_glibc2, including all intermediary versions.
+    for glibc_major in range(current_glibc.major - 1, 1, -1):
+        glibc_minor = _LAST_GLIBC_MINOR[glibc_major]
+        glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor))
+    for arch in archs:
+        for glibc_max in glibc_max_list:
+            if glibc_max.major == too_old_glibc2.major:
+                min_minor = too_old_glibc2.minor
+            else:
+                # For other glibc major versions oldest supported is (x, 0).
+                min_minor = -1
+            for glibc_minor in range(glibc_max.minor, min_minor, -1):
+                glibc_version = _GLibCVersion(glibc_max.major, glibc_minor)
+                tag = "manylinux_{}_{}".format(*glibc_version)
+                if _is_compatible(arch, glibc_version):
+                    yield f"{tag}_{arch}"
+                # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags.
+                if glibc_version in _LEGACY_MANYLINUX_MAP:
+                    legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version]
+                    if _is_compatible(arch, glibc_version):
+                        yield f"{legacy_tag}_{arch}"
diff --git a/setuptools/_vendor/wheel/vendored/packaging/_musllinux.py b/setuptools/_vendor/wheel/vendored/packaging/_musllinux.py
new file mode 100644
index 0000000000..eb4251b5c1
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/_musllinux.py
@@ -0,0 +1,83 @@
+"""PEP 656 support.
+
+This module implements logic to detect if the currently running Python is
+linked against musl, and what musl version is used.
+"""
+
+import functools
+import re
+import subprocess
+import sys
+from typing import Iterator, NamedTuple, Optional, Sequence
+
+from ._elffile import ELFFile
+
+
+class _MuslVersion(NamedTuple):
+    major: int
+    minor: int
+
+
+def _parse_musl_version(output: str) -> Optional[_MuslVersion]:
+    lines = [n for n in (n.strip() for n in output.splitlines()) if n]
+    if len(lines) < 2 or lines[0][:4] != "musl":
+        return None
+    m = re.match(r"Version (\d+)\.(\d+)", lines[1])
+    if not m:
+        return None
+    return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2)))
+
+
+@functools.lru_cache
+def _get_musl_version(executable: str) -> Optional[_MuslVersion]:
+    """Detect currently-running musl runtime version.
+
+    This is done by checking the specified executable's dynamic linking
+    information, and invoking the loader to parse its output for a version
+    string. If the loader is musl, the output would be something like::
+
+        musl libc (x86_64)
+        Version 1.2.2
+        Dynamic Program Loader
+    """
+    try:
+        with open(executable, "rb") as f:
+            ld = ELFFile(f).interpreter
+    except (OSError, TypeError, ValueError):
+        return None
+    if ld is None or "musl" not in ld:
+        return None
+    proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True)
+    return _parse_musl_version(proc.stderr)
+
+
+def platform_tags(archs: Sequence[str]) -> Iterator[str]:
+    """Generate musllinux tags compatible to the current platform.
+
+    :param archs: Sequence of compatible architectures.
+        The first one shall be the closest to the actual architecture and be the part of
+        platform tag after the ``linux_`` prefix, e.g. ``x86_64``.
+        The ``linux_`` prefix is assumed as a prerequisite for the current platform to
+        be musllinux-compatible.
+
+    :returns: An iterator of compatible musllinux tags.
+    """
+    sys_musl = _get_musl_version(sys.executable)
+    if sys_musl is None:  # Python not dynamically linked against musl.
+        return
+    for arch in archs:
+        for minor in range(sys_musl.minor, -1, -1):
+            yield f"musllinux_{sys_musl.major}_{minor}_{arch}"
+
+
+if __name__ == "__main__":  # pragma: no cover
+    import sysconfig
+
+    plat = sysconfig.get_platform()
+    assert plat.startswith("linux-"), "not linux"
+
+    print("plat:", plat)
+    print("musl:", _get_musl_version(sys.executable))
+    print("tags:", end=" ")
+    for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])):
+        print(t, end="\n      ")
diff --git a/setuptools/_vendor/wheel/vendored/packaging/_parser.py b/setuptools/_vendor/wheel/vendored/packaging/_parser.py
new file mode 100644
index 0000000000..513686a219
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/_parser.py
@@ -0,0 +1,356 @@
+"""Handwritten parser of dependency specifiers.
+
+The docstring for each __parse_* function contains EBNF-inspired grammar representing
+the implementation.
+"""
+
+import ast
+from typing import Any, List, NamedTuple, Optional, Tuple, Union
+
+from ._tokenizer import DEFAULT_RULES, Tokenizer
+
+
+class Node:
+    def __init__(self, value: str) -> None:
+        self.value = value
+
+    def __str__(self) -> str:
+        return self.value
+
+    def __repr__(self) -> str:
+        return f"<{self.__class__.__name__}('{self}')>"
+
+    def serialize(self) -> str:
+        raise NotImplementedError
+
+
+class Variable(Node):
+    def serialize(self) -> str:
+        return str(self)
+
+
+class Value(Node):
+    def serialize(self) -> str:
+        return f'"{self}"'
+
+
+class Op(Node):
+    def serialize(self) -> str:
+        return str(self)
+
+
+MarkerVar = Union[Variable, Value]
+MarkerItem = Tuple[MarkerVar, Op, MarkerVar]
+# MarkerAtom = Union[MarkerItem, List["MarkerAtom"]]
+# MarkerList = List[Union["MarkerList", MarkerAtom, str]]
+# mypy does not support recursive type definition
+# https://github.com/python/mypy/issues/731
+MarkerAtom = Any
+MarkerList = List[Any]
+
+
+class ParsedRequirement(NamedTuple):
+    name: str
+    url: str
+    extras: List[str]
+    specifier: str
+    marker: Optional[MarkerList]
+
+
+# --------------------------------------------------------------------------------------
+# Recursive descent parser for dependency specifier
+# --------------------------------------------------------------------------------------
+def parse_requirement(source: str) -> ParsedRequirement:
+    return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
+
+
+def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement:
+    """
+    requirement = WS? IDENTIFIER WS? extras WS? requirement_details
+    """
+    tokenizer.consume("WS")
+
+    name_token = tokenizer.expect(
+        "IDENTIFIER", expected="package name at the start of dependency specifier"
+    )
+    name = name_token.text
+    tokenizer.consume("WS")
+
+    extras = _parse_extras(tokenizer)
+    tokenizer.consume("WS")
+
+    url, specifier, marker = _parse_requirement_details(tokenizer)
+    tokenizer.expect("END", expected="end of dependency specifier")
+
+    return ParsedRequirement(name, url, extras, specifier, marker)
+
+
+def _parse_requirement_details(
+    tokenizer: Tokenizer,
+) -> Tuple[str, str, Optional[MarkerList]]:
+    """
+    requirement_details = AT URL (WS requirement_marker?)?
+                        | specifier WS? (requirement_marker)?
+    """
+
+    specifier = ""
+    url = ""
+    marker = None
+
+    if tokenizer.check("AT"):
+        tokenizer.read()
+        tokenizer.consume("WS")
+
+        url_start = tokenizer.position
+        url = tokenizer.expect("URL", expected="URL after @").text
+        if tokenizer.check("END", peek=True):
+            return (url, specifier, marker)
+
+        tokenizer.expect("WS", expected="whitespace after URL")
+
+        # The input might end after whitespace.
+        if tokenizer.check("END", peek=True):
+            return (url, specifier, marker)
+
+        marker = _parse_requirement_marker(
+            tokenizer, span_start=url_start, after="URL and whitespace"
+        )
+    else:
+        specifier_start = tokenizer.position
+        specifier = _parse_specifier(tokenizer)
+        tokenizer.consume("WS")
+
+        if tokenizer.check("END", peek=True):
+            return (url, specifier, marker)
+
+        marker = _parse_requirement_marker(
+            tokenizer,
+            span_start=specifier_start,
+            after=(
+                "version specifier"
+                if specifier
+                else "name and no valid version specifier"
+            ),
+        )
+
+    return (url, specifier, marker)
+
+
+def _parse_requirement_marker(
+    tokenizer: Tokenizer, *, span_start: int, after: str
+) -> MarkerList:
+    """
+    requirement_marker = SEMICOLON marker WS?
+    """
+
+    if not tokenizer.check("SEMICOLON"):
+        tokenizer.raise_syntax_error(
+            f"Expected end or semicolon (after {after})",
+            span_start=span_start,
+        )
+    tokenizer.read()
+
+    marker = _parse_marker(tokenizer)
+    tokenizer.consume("WS")
+
+    return marker
+
+
+def _parse_extras(tokenizer: Tokenizer) -> List[str]:
+    """
+    extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)?
+    """
+    if not tokenizer.check("LEFT_BRACKET", peek=True):
+        return []
+
+    with tokenizer.enclosing_tokens(
+        "LEFT_BRACKET",
+        "RIGHT_BRACKET",
+        around="extras",
+    ):
+        tokenizer.consume("WS")
+        extras = _parse_extras_list(tokenizer)
+        tokenizer.consume("WS")
+
+    return extras
+
+
+def _parse_extras_list(tokenizer: Tokenizer) -> List[str]:
+    """
+    extras_list = identifier (wsp* ',' wsp* identifier)*
+    """
+    extras: List[str] = []
+
+    if not tokenizer.check("IDENTIFIER"):
+        return extras
+
+    extras.append(tokenizer.read().text)
+
+    while True:
+        tokenizer.consume("WS")
+        if tokenizer.check("IDENTIFIER", peek=True):
+            tokenizer.raise_syntax_error("Expected comma between extra names")
+        elif not tokenizer.check("COMMA"):
+            break
+
+        tokenizer.read()
+        tokenizer.consume("WS")
+
+        extra_token = tokenizer.expect("IDENTIFIER", expected="extra name after comma")
+        extras.append(extra_token.text)
+
+    return extras
+
+
+def _parse_specifier(tokenizer: Tokenizer) -> str:
+    """
+    specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS
+              | WS? version_many WS?
+    """
+    with tokenizer.enclosing_tokens(
+        "LEFT_PARENTHESIS",
+        "RIGHT_PARENTHESIS",
+        around="version specifier",
+    ):
+        tokenizer.consume("WS")
+        parsed_specifiers = _parse_version_many(tokenizer)
+        tokenizer.consume("WS")
+
+    return parsed_specifiers
+
+
+def _parse_version_many(tokenizer: Tokenizer) -> str:
+    """
+    version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)?
+    """
+    parsed_specifiers = ""
+    while tokenizer.check("SPECIFIER"):
+        span_start = tokenizer.position
+        parsed_specifiers += tokenizer.read().text
+        if tokenizer.check("VERSION_PREFIX_TRAIL", peek=True):
+            tokenizer.raise_syntax_error(
+                ".* suffix can only be used with `==` or `!=` operators",
+                span_start=span_start,
+                span_end=tokenizer.position + 1,
+            )
+        if tokenizer.check("VERSION_LOCAL_LABEL_TRAIL", peek=True):
+            tokenizer.raise_syntax_error(
+                "Local version label can only be used with `==` or `!=` operators",
+                span_start=span_start,
+                span_end=tokenizer.position,
+            )
+        tokenizer.consume("WS")
+        if not tokenizer.check("COMMA"):
+            break
+        parsed_specifiers += tokenizer.read().text
+        tokenizer.consume("WS")
+
+    return parsed_specifiers
+
+
+# --------------------------------------------------------------------------------------
+# Recursive descent parser for marker expression
+# --------------------------------------------------------------------------------------
+def parse_marker(source: str) -> MarkerList:
+    return _parse_full_marker(Tokenizer(source, rules=DEFAULT_RULES))
+
+
+def _parse_full_marker(tokenizer: Tokenizer) -> MarkerList:
+    retval = _parse_marker(tokenizer)
+    tokenizer.expect("END", expected="end of marker expression")
+    return retval
+
+
+def _parse_marker(tokenizer: Tokenizer) -> MarkerList:
+    """
+    marker = marker_atom (BOOLOP marker_atom)+
+    """
+    expression = [_parse_marker_atom(tokenizer)]
+    while tokenizer.check("BOOLOP"):
+        token = tokenizer.read()
+        expr_right = _parse_marker_atom(tokenizer)
+        expression.extend((token.text, expr_right))
+    return expression
+
+
+def _parse_marker_atom(tokenizer: Tokenizer) -> MarkerAtom:
+    """
+    marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS?
+                | WS? marker_item WS?
+    """
+
+    tokenizer.consume("WS")
+    if tokenizer.check("LEFT_PARENTHESIS", peek=True):
+        with tokenizer.enclosing_tokens(
+            "LEFT_PARENTHESIS",
+            "RIGHT_PARENTHESIS",
+            around="marker expression",
+        ):
+            tokenizer.consume("WS")
+            marker: MarkerAtom = _parse_marker(tokenizer)
+            tokenizer.consume("WS")
+    else:
+        marker = _parse_marker_item(tokenizer)
+    tokenizer.consume("WS")
+    return marker
+
+
+def _parse_marker_item(tokenizer: Tokenizer) -> MarkerItem:
+    """
+    marker_item = WS? marker_var WS? marker_op WS? marker_var WS?
+    """
+    tokenizer.consume("WS")
+    marker_var_left = _parse_marker_var(tokenizer)
+    tokenizer.consume("WS")
+    marker_op = _parse_marker_op(tokenizer)
+    tokenizer.consume("WS")
+    marker_var_right = _parse_marker_var(tokenizer)
+    tokenizer.consume("WS")
+    return (marker_var_left, marker_op, marker_var_right)
+
+
+def _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar:
+    """
+    marker_var = VARIABLE | QUOTED_STRING
+    """
+    if tokenizer.check("VARIABLE"):
+        return process_env_var(tokenizer.read().text.replace(".", "_"))
+    elif tokenizer.check("QUOTED_STRING"):
+        return process_python_str(tokenizer.read().text)
+    else:
+        tokenizer.raise_syntax_error(
+            message="Expected a marker variable or quoted string"
+        )
+
+
+def process_env_var(env_var: str) -> Variable:
+    if env_var in ("platform_python_implementation", "python_implementation"):
+        return Variable("platform_python_implementation")
+    else:
+        return Variable(env_var)
+
+
+def process_python_str(python_str: str) -> Value:
+    value = ast.literal_eval(python_str)
+    return Value(str(value))
+
+
+def _parse_marker_op(tokenizer: Tokenizer) -> Op:
+    """
+    marker_op = IN | NOT IN | OP
+    """
+    if tokenizer.check("IN"):
+        tokenizer.read()
+        return Op("in")
+    elif tokenizer.check("NOT"):
+        tokenizer.read()
+        tokenizer.expect("WS", expected="whitespace after 'not'")
+        tokenizer.expect("IN", expected="'in' after 'not'")
+        return Op("not in")
+    elif tokenizer.check("OP"):
+        return Op(tokenizer.read().text)
+    else:
+        return tokenizer.raise_syntax_error(
+            "Expected marker operator, one of "
+            "<=, <, !=, ==, >=, >, ~=, ===, in, not in"
+        )
diff --git a/setuptools/_vendor/wheel/vendored/packaging/_structures.py b/setuptools/_vendor/wheel/vendored/packaging/_structures.py
new file mode 100644
index 0000000000..90a6465f96
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/_structures.py
@@ -0,0 +1,61 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+
+class InfinityType:
+    def __repr__(self) -> str:
+        return "Infinity"
+
+    def __hash__(self) -> int:
+        return hash(repr(self))
+
+    def __lt__(self, other: object) -> bool:
+        return False
+
+    def __le__(self, other: object) -> bool:
+        return False
+
+    def __eq__(self, other: object) -> bool:
+        return isinstance(other, self.__class__)
+
+    def __gt__(self, other: object) -> bool:
+        return True
+
+    def __ge__(self, other: object) -> bool:
+        return True
+
+    def __neg__(self: object) -> "NegativeInfinityType":
+        return NegativeInfinity
+
+
+Infinity = InfinityType()
+
+
+class NegativeInfinityType:
+    def __repr__(self) -> str:
+        return "-Infinity"
+
+    def __hash__(self) -> int:
+        return hash(repr(self))
+
+    def __lt__(self, other: object) -> bool:
+        return True
+
+    def __le__(self, other: object) -> bool:
+        return True
+
+    def __eq__(self, other: object) -> bool:
+        return isinstance(other, self.__class__)
+
+    def __gt__(self, other: object) -> bool:
+        return False
+
+    def __ge__(self, other: object) -> bool:
+        return False
+
+    def __neg__(self: object) -> InfinityType:
+        return Infinity
+
+
+NegativeInfinity = NegativeInfinityType()
diff --git a/setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py b/setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py
new file mode 100644
index 0000000000..dd0d648d49
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/_tokenizer.py
@@ -0,0 +1,192 @@
+import contextlib
+import re
+from dataclasses import dataclass
+from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union
+
+from .specifiers import Specifier
+
+
+@dataclass
+class Token:
+    name: str
+    text: str
+    position: int
+
+
+class ParserSyntaxError(Exception):
+    """The provided source text could not be parsed correctly."""
+
+    def __init__(
+        self,
+        message: str,
+        *,
+        source: str,
+        span: Tuple[int, int],
+    ) -> None:
+        self.span = span
+        self.message = message
+        self.source = source
+
+        super().__init__()
+
+    def __str__(self) -> str:
+        marker = " " * self.span[0] + "~" * (self.span[1] - self.span[0]) + "^"
+        return "\n    ".join([self.message, self.source, marker])
+
+
+DEFAULT_RULES: "Dict[str, Union[str, re.Pattern[str]]]" = {
+    "LEFT_PARENTHESIS": r"\(",
+    "RIGHT_PARENTHESIS": r"\)",
+    "LEFT_BRACKET": r"\[",
+    "RIGHT_BRACKET": r"\]",
+    "SEMICOLON": r";",
+    "COMMA": r",",
+    "QUOTED_STRING": re.compile(
+        r"""
+            (
+                ('[^']*')
+                |
+                ("[^"]*")
+            )
+        """,
+        re.VERBOSE,
+    ),
+    "OP": r"(===|==|~=|!=|<=|>=|<|>)",
+    "BOOLOP": r"\b(or|and)\b",
+    "IN": r"\bin\b",
+    "NOT": r"\bnot\b",
+    "VARIABLE": re.compile(
+        r"""
+            \b(
+                python_version
+                |python_full_version
+                |os[._]name
+                |sys[._]platform
+                |platform_(release|system)
+                |platform[._](version|machine|python_implementation)
+                |python_implementation
+                |implementation_(name|version)
+                |extra
+            )\b
+        """,
+        re.VERBOSE,
+    ),
+    "SPECIFIER": re.compile(
+        Specifier._operator_regex_str + Specifier._version_regex_str,
+        re.VERBOSE | re.IGNORECASE,
+    ),
+    "AT": r"\@",
+    "URL": r"[^ \t]+",
+    "IDENTIFIER": r"\b[a-zA-Z0-9][a-zA-Z0-9._-]*\b",
+    "VERSION_PREFIX_TRAIL": r"\.\*",
+    "VERSION_LOCAL_LABEL_TRAIL": r"\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*",
+    "WS": r"[ \t]+",
+    "END": r"$",
+}
+
+
+class Tokenizer:
+    """Context-sensitive token parsing.
+
+    Provides methods to examine the input stream to check whether the next token
+    matches.
+    """
+
+    def __init__(
+        self,
+        source: str,
+        *,
+        rules: "Dict[str, Union[str, re.Pattern[str]]]",
+    ) -> None:
+        self.source = source
+        self.rules: Dict[str, re.Pattern[str]] = {
+            name: re.compile(pattern) for name, pattern in rules.items()
+        }
+        self.next_token: Optional[Token] = None
+        self.position = 0
+
+    def consume(self, name: str) -> None:
+        """Move beyond provided token name, if at current position."""
+        if self.check(name):
+            self.read()
+
+    def check(self, name: str, *, peek: bool = False) -> bool:
+        """Check whether the next token has the provided name.
+
+        By default, if the check succeeds, the token *must* be read before
+        another check. If `peek` is set to `True`, the token is not loaded and
+        would need to be checked again.
+        """
+        assert (
+            self.next_token is None
+        ), f"Cannot check for {name!r}, already have {self.next_token!r}"
+        assert name in self.rules, f"Unknown token name: {name!r}"
+
+        expression = self.rules[name]
+
+        match = expression.match(self.source, self.position)
+        if match is None:
+            return False
+        if not peek:
+            self.next_token = Token(name, match[0], self.position)
+        return True
+
+    def expect(self, name: str, *, expected: str) -> Token:
+        """Expect a certain token name next, failing with a syntax error otherwise.
+
+        The token is *not* read.
+        """
+        if not self.check(name):
+            raise self.raise_syntax_error(f"Expected {expected}")
+        return self.read()
+
+    def read(self) -> Token:
+        """Consume the next token and return it."""
+        token = self.next_token
+        assert token is not None
+
+        self.position += len(token.text)
+        self.next_token = None
+
+        return token
+
+    def raise_syntax_error(
+        self,
+        message: str,
+        *,
+        span_start: Optional[int] = None,
+        span_end: Optional[int] = None,
+    ) -> NoReturn:
+        """Raise ParserSyntaxError at the given position."""
+        span = (
+            self.position if span_start is None else span_start,
+            self.position if span_end is None else span_end,
+        )
+        raise ParserSyntaxError(
+            message,
+            source=self.source,
+            span=span,
+        )
+
+    @contextlib.contextmanager
+    def enclosing_tokens(
+        self, open_token: str, close_token: str, *, around: str
+    ) -> Iterator[None]:
+        if self.check(open_token):
+            open_position = self.position
+            self.read()
+        else:
+            open_position = None
+
+        yield
+
+        if open_position is None:
+            return
+
+        if not self.check(close_token):
+            self.raise_syntax_error(
+                f"Expected matching {close_token} for {open_token}, after {around}",
+                span_start=open_position,
+            )
+
+        self.read()
diff --git a/setuptools/_vendor/wheel/vendored/packaging/markers.py b/setuptools/_vendor/wheel/vendored/packaging/markers.py
new file mode 100644
index 0000000000..c96d22a5a4
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/markers.py
@@ -0,0 +1,253 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+import operator
+import os
+import platform
+import sys
+from typing import Any, Callable, Dict, List, Optional, Tuple, Union
+
+from ._parser import (
+    MarkerAtom,
+    MarkerList,
+    Op,
+    Value,
+    Variable,
+)
+from ._parser import (
+    parse_marker as _parse_marker,
+)
+from ._tokenizer import ParserSyntaxError
+from .specifiers import InvalidSpecifier, Specifier
+from .utils import canonicalize_name
+
+__all__ = [
+    "InvalidMarker",
+    "UndefinedComparison",
+    "UndefinedEnvironmentName",
+    "Marker",
+    "default_environment",
+]
+
+Operator = Callable[[str, str], bool]
+
+
+class InvalidMarker(ValueError):
+    """
+    An invalid marker was found, users should refer to PEP 508.
+    """
+
+
+class UndefinedComparison(ValueError):
+    """
+    An invalid operation was attempted on a value that doesn't support it.
+    """
+
+
+class UndefinedEnvironmentName(ValueError):
+    """
+    A name was attempted to be used that does not exist inside of the
+    environment.
+    """
+
+
+def _normalize_extra_values(results: Any) -> Any:
+    """
+    Normalize extra values.
+    """
+    if isinstance(results[0], tuple):
+        lhs, op, rhs = results[0]
+        if isinstance(lhs, Variable) and lhs.value == "extra":
+            normalized_extra = canonicalize_name(rhs.value)
+            rhs = Value(normalized_extra)
+        elif isinstance(rhs, Variable) and rhs.value == "extra":
+            normalized_extra = canonicalize_name(lhs.value)
+            lhs = Value(normalized_extra)
+        results[0] = lhs, op, rhs
+    return results
+
+
+def _format_marker(
+    marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True
+) -> str:
+    assert isinstance(marker, (list, tuple, str))
+
+    # Sometimes we have a structure like [[...]] which is a single item list
+    # where the single item is itself it's own list. In that case we want skip
+    # the rest of this function so that we don't get extraneous () on the
+    # outside.
+    if (
+        isinstance(marker, list)
+        and len(marker) == 1
+        and isinstance(marker[0], (list, tuple))
+    ):
+        return _format_marker(marker[0])
+
+    if isinstance(marker, list):
+        inner = (_format_marker(m, first=False) for m in marker)
+        if first:
+            return " ".join(inner)
+        else:
+            return "(" + " ".join(inner) + ")"
+    elif isinstance(marker, tuple):
+        return " ".join([m.serialize() for m in marker])
+    else:
+        return marker
+
+
+_operators: Dict[str, Operator] = {
+    "in": lambda lhs, rhs: lhs in rhs,
+    "not in": lambda lhs, rhs: lhs not in rhs,
+    "<": operator.lt,
+    "<=": operator.le,
+    "==": operator.eq,
+    "!=": operator.ne,
+    ">=": operator.ge,
+    ">": operator.gt,
+}
+
+
+def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
+    try:
+        spec = Specifier("".join([op.serialize(), rhs]))
+    except InvalidSpecifier:
+        pass
+    else:
+        return spec.contains(lhs, prereleases=True)
+
+    oper: Optional[Operator] = _operators.get(op.serialize())
+    if oper is None:
+        raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.")
+
+    return oper(lhs, rhs)
+
+
+def _normalize(*values: str, key: str) -> Tuple[str, ...]:
+    # PEP 685 – Comparison of extra names for optional distribution dependencies
+    # https://peps.python.org/pep-0685/
+    # > When comparing extra names, tools MUST normalize the names being
+    # > compared using the semantics outlined in PEP 503 for names
+    if key == "extra":
+        return tuple(canonicalize_name(v) for v in values)
+
+    # other environment markers don't have such standards
+    return values
+
+
+def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool:
+    groups: List[List[bool]] = [[]]
+
+    for marker in markers:
+        assert isinstance(marker, (list, tuple, str))
+
+        if isinstance(marker, list):
+            groups[-1].append(_evaluate_markers(marker, environment))
+        elif isinstance(marker, tuple):
+            lhs, op, rhs = marker
+
+            if isinstance(lhs, Variable):
+                environment_key = lhs.value
+                lhs_value = environment[environment_key]
+                rhs_value = rhs.value
+            else:
+                lhs_value = lhs.value
+                environment_key = rhs.value
+                rhs_value = environment[environment_key]
+
+            lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key)
+            groups[-1].append(_eval_op(lhs_value, op, rhs_value))
+        else:
+            assert marker in ["and", "or"]
+            if marker == "or":
+                groups.append([])
+
+    return any(all(item) for item in groups)
+
+
+def format_full_version(info: "sys._version_info") -> str:
+    version = "{0.major}.{0.minor}.{0.micro}".format(info)
+    kind = info.releaselevel
+    if kind != "final":
+        version += kind[0] + str(info.serial)
+    return version
+
+
+def default_environment() -> Dict[str, str]:
+    iver = format_full_version(sys.implementation.version)
+    implementation_name = sys.implementation.name
+    return {
+        "implementation_name": implementation_name,
+        "implementation_version": iver,
+        "os_name": os.name,
+        "platform_machine": platform.machine(),
+        "platform_release": platform.release(),
+        "platform_system": platform.system(),
+        "platform_version": platform.version(),
+        "python_full_version": platform.python_version(),
+        "platform_python_implementation": platform.python_implementation(),
+        "python_version": ".".join(platform.python_version_tuple()[:2]),
+        "sys_platform": sys.platform,
+    }
+
+
+class Marker:
+    def __init__(self, marker: str) -> None:
+        # Note: We create a Marker object without calling this constructor in
+        #       packaging.requirements.Requirement. If any additional logic is
+        #       added here, make sure to mirror/adapt Requirement.
+        try:
+            self._markers = _normalize_extra_values(_parse_marker(marker))
+            # The attribute `_markers` can be described in terms of a recursive type:
+            # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]]
+            #
+            # For example, the following expression:
+            # python_version > "3.6" or (python_version == "3.6" and os_name == "unix")
+            #
+            # is parsed into:
+            # [
+            #     (, ')>, ),
+            #     'and',
+            #     [
+            #         (, , ),
+            #         'or',
+            #         (, , )
+            #     ]
+            # ]
+        except ParserSyntaxError as e:
+            raise InvalidMarker(str(e)) from e
+
+    def __str__(self) -> str:
+        return _format_marker(self._markers)
+
+    def __repr__(self) -> str:
+        return f""
+
+    def __hash__(self) -> int:
+        return hash((self.__class__.__name__, str(self)))
+
+    def __eq__(self, other: Any) -> bool:
+        if not isinstance(other, Marker):
+            return NotImplemented
+
+        return str(self) == str(other)
+
+    def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool:
+        """Evaluate a marker.
+
+        Return the boolean from evaluating the given marker against the
+        environment. environment is an optional argument to override all or
+        part of the determined environment.
+
+        The environment is determined from the current Python process.
+        """
+        current_environment = default_environment()
+        current_environment["extra"] = ""
+        if environment is not None:
+            current_environment.update(environment)
+            # The API used to allow setting extra to None. We need to handle this
+            # case for backwards compatibility.
+            if current_environment["extra"] is None:
+                current_environment["extra"] = ""
+
+        return _evaluate_markers(self._markers, current_environment)
diff --git a/setuptools/_vendor/wheel/vendored/packaging/requirements.py b/setuptools/_vendor/wheel/vendored/packaging/requirements.py
new file mode 100644
index 0000000000..bdc43a7e98
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/requirements.py
@@ -0,0 +1,90 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+from typing import Any, Iterator, Optional, Set
+
+from ._parser import parse_requirement as _parse_requirement
+from ._tokenizer import ParserSyntaxError
+from .markers import Marker, _normalize_extra_values
+from .specifiers import SpecifierSet
+from .utils import canonicalize_name
+
+
+class InvalidRequirement(ValueError):
+    """
+    An invalid requirement was found, users should refer to PEP 508.
+    """
+
+
+class Requirement:
+    """Parse a requirement.
+
+    Parse a given requirement string into its parts, such as name, specifier,
+    URL, and extras. Raises InvalidRequirement on a badly-formed requirement
+    string.
+    """
+
+    # TODO: Can we test whether something is contained within a requirement?
+    #       If so how do we do that? Do we need to test against the _name_ of
+    #       the thing as well as the version? What about the markers?
+    # TODO: Can we normalize the name and extra name?
+
+    def __init__(self, requirement_string: str) -> None:
+        try:
+            parsed = _parse_requirement(requirement_string)
+        except ParserSyntaxError as e:
+            raise InvalidRequirement(str(e)) from e
+
+        self.name: str = parsed.name
+        self.url: Optional[str] = parsed.url or None
+        self.extras: Set[str] = set(parsed.extras or [])
+        self.specifier: SpecifierSet = SpecifierSet(parsed.specifier)
+        self.marker: Optional[Marker] = None
+        if parsed.marker is not None:
+            self.marker = Marker.__new__(Marker)
+            self.marker._markers = _normalize_extra_values(parsed.marker)
+
+    def _iter_parts(self, name: str) -> Iterator[str]:
+        yield name
+
+        if self.extras:
+            formatted_extras = ",".join(sorted(self.extras))
+            yield f"[{formatted_extras}]"
+
+        if self.specifier:
+            yield str(self.specifier)
+
+        if self.url:
+            yield f"@ {self.url}"
+            if self.marker:
+                yield " "
+
+        if self.marker:
+            yield f"; {self.marker}"
+
+    def __str__(self) -> str:
+        return "".join(self._iter_parts(self.name))
+
+    def __repr__(self) -> str:
+        return f""
+
+    def __hash__(self) -> int:
+        return hash(
+            (
+                self.__class__.__name__,
+                *self._iter_parts(canonicalize_name(self.name)),
+            )
+        )
+
+    def __eq__(self, other: Any) -> bool:
+        if not isinstance(other, Requirement):
+            return NotImplemented
+
+        return (
+            canonicalize_name(self.name) == canonicalize_name(other.name)
+            and self.extras == other.extras
+            and self.specifier == other.specifier
+            and self.url == other.url
+            and self.marker == other.marker
+        )
diff --git a/setuptools/_vendor/wheel/vendored/packaging/specifiers.py b/setuptools/_vendor/wheel/vendored/packaging/specifiers.py
new file mode 100644
index 0000000000..6d4066ae27
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/specifiers.py
@@ -0,0 +1,1011 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+"""
+.. testsetup::
+
+    from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier
+    from packaging.version import Version
+"""
+
+import abc
+import itertools
+import re
+from typing import Callable, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union
+
+from .utils import canonicalize_version
+from .version import Version
+
+UnparsedVersion = Union[Version, str]
+UnparsedVersionVar = TypeVar("UnparsedVersionVar", bound=UnparsedVersion)
+CallableOperator = Callable[[Version, str], bool]
+
+
+def _coerce_version(version: UnparsedVersion) -> Version:
+    if not isinstance(version, Version):
+        version = Version(version)
+    return version
+
+
+class InvalidSpecifier(ValueError):
+    """
+    Raised when attempting to create a :class:`Specifier` with a specifier
+    string that is invalid.
+
+    >>> Specifier("lolwat")
+    Traceback (most recent call last):
+        ...
+    packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat'
+    """
+
+
+class BaseSpecifier(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def __str__(self) -> str:
+        """
+        Returns the str representation of this Specifier-like object. This
+        should be representative of the Specifier itself.
+        """
+
+    @abc.abstractmethod
+    def __hash__(self) -> int:
+        """
+        Returns a hash value for this Specifier-like object.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Returns a boolean representing whether or not the two Specifier-like
+        objects are equal.
+
+        :param other: The other object to check against.
+        """
+
+    @property
+    @abc.abstractmethod
+    def prereleases(self) -> Optional[bool]:
+        """Whether or not pre-releases as a whole are allowed.
+
+        This can be set to either ``True`` or ``False`` to explicitly enable or disable
+        prereleases or it can be set to ``None`` (the default) to use default semantics.
+        """
+
+    @prereleases.setter
+    def prereleases(self, value: bool) -> None:
+        """Setter for :attr:`prereleases`.
+
+        :param value: The value to set.
+        """
+
+    @abc.abstractmethod
+    def contains(self, item: str, prereleases: Optional[bool] = None) -> bool:
+        """
+        Determines if the given item is contained within this specifier.
+        """
+
+    @abc.abstractmethod
+    def filter(
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+    ) -> Iterator[UnparsedVersionVar]:
+        """
+        Takes an iterable of items and filters them so that only items which
+        are contained within this specifier are allowed in it.
+        """
+
+
+class Specifier(BaseSpecifier):
+    """This class abstracts handling of version specifiers.
+
+    .. tip::
+
+        It is generally not required to instantiate this manually. You should instead
+        prefer to work with :class:`SpecifierSet` instead, which can parse
+        comma-separated version specifiers (which is what package metadata contains).
+    """
+
+    _operator_regex_str = r"""
+        (?P(~=|==|!=|<=|>=|<|>|===))
+        """
+    _version_regex_str = r"""
+        (?P
+            (?:
+                # The identity operators allow for an escape hatch that will
+                # do an exact string match of the version you wish to install.
+                # This will not be parsed by PEP 440 and we cannot determine
+                # any semantic meaning from it. This operator is discouraged
+                # but included entirely as an escape hatch.
+                (?<====)  # Only match for the identity operator
+                \s*
+                [^\s;)]*  # The arbitrary version can be just about anything,
+                          # we match everything except for whitespace, a
+                          # semi-colon for marker support, and a closing paren
+                          # since versions can be enclosed in them.
+            )
+            |
+            (?:
+                # The (non)equality operators allow for wild card and local
+                # versions to be specified so we have to define these two
+                # operators separately to enable that.
+                (?<===|!=)            # Only match for equals and not equals
+
+                \s*
+                v?
+                (?:[0-9]+!)?          # epoch
+                [0-9]+(?:\.[0-9]+)*   # release
+
+                # You cannot use a wild card and a pre-release, post-release, a dev or
+                # local version together so group them with a | and make them optional.
+                (?:
+                    \.\*  # Wild card syntax of .*
+                    |
+                    (?:                                  # pre release
+                        [-_\.]?
+                        (alpha|beta|preview|pre|a|b|c|rc)
+                        [-_\.]?
+                        [0-9]*
+                    )?
+                    (?:                                  # post release
+                        (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
+                    )?
+                    (?:[-_\.]?dev[-_\.]?[0-9]*)?         # dev release
+                    (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local
+                )?
+            )
+            |
+            (?:
+                # The compatible operator requires at least two digits in the
+                # release segment.
+                (?<=~=)               # Only match for the compatible operator
+
+                \s*
+                v?
+                (?:[0-9]+!)?          # epoch
+                [0-9]+(?:\.[0-9]+)+   # release  (We have a + instead of a *)
+                (?:                   # pre release
+                    [-_\.]?
+                    (alpha|beta|preview|pre|a|b|c|rc)
+                    [-_\.]?
+                    [0-9]*
+                )?
+                (?:                                   # post release
+                    (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*)
+                )?
+                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
+            )
+            |
+            (?:
+                # All other operators only allow a sub set of what the
+                # (non)equality operators do. Specifically they do not allow
+                # local versions to be specified nor do they allow the prefix
+                # matching wild cards.
+                (?=": "greater_than_equal",
+        "<": "less_than",
+        ">": "greater_than",
+        "===": "arbitrary",
+    }
+
+    def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None:
+        """Initialize a Specifier instance.
+
+        :param spec:
+            The string representation of a specifier which will be parsed and
+            normalized before use.
+        :param prereleases:
+            This tells the specifier if it should accept prerelease versions if
+            applicable or not. The default of ``None`` will autodetect it from the
+            given specifiers.
+        :raises InvalidSpecifier:
+            If the given specifier is invalid (i.e. bad syntax).
+        """
+        match = self._regex.search(spec)
+        if not match:
+            raise InvalidSpecifier(f"Invalid specifier: '{spec}'")
+
+        self._spec: Tuple[str, str] = (
+            match.group("operator").strip(),
+            match.group("version").strip(),
+        )
+
+        # Store whether or not this Specifier should accept prereleases
+        self._prereleases = prereleases
+
+    # https://github.com/python/mypy/pull/13475#pullrequestreview-1079784515
+    @property  # type: ignore[override]
+    def prereleases(self) -> bool:
+        # If there is an explicit prereleases set for this, then we'll just
+        # blindly use that.
+        if self._prereleases is not None:
+            return self._prereleases
+
+        # Look at all of our specifiers and determine if they are inclusive
+        # operators, and if they are if they are including an explicit
+        # prerelease.
+        operator, version = self._spec
+        if operator in ["==", ">=", "<=", "~=", "==="]:
+            # The == specifier can include a trailing .*, if it does we
+            # want to remove before parsing.
+            if operator == "==" and version.endswith(".*"):
+                version = version[:-2]
+
+            # Parse the version, and if it is a pre-release than this
+            # specifier allows pre-releases.
+            if Version(version).is_prerelease:
+                return True
+
+        return False
+
+    @prereleases.setter
+    def prereleases(self, value: bool) -> None:
+        self._prereleases = value
+
+    @property
+    def operator(self) -> str:
+        """The operator of this specifier.
+
+        >>> Specifier("==1.2.3").operator
+        '=='
+        """
+        return self._spec[0]
+
+    @property
+    def version(self) -> str:
+        """The version of this specifier.
+
+        >>> Specifier("==1.2.3").version
+        '1.2.3'
+        """
+        return self._spec[1]
+
+    def __repr__(self) -> str:
+        """A representation of the Specifier that shows all internal state.
+
+        >>> Specifier('>=1.0.0')
+        =1.0.0')>
+        >>> Specifier('>=1.0.0', prereleases=False)
+        =1.0.0', prereleases=False)>
+        >>> Specifier('>=1.0.0', prereleases=True)
+        =1.0.0', prereleases=True)>
+        """
+        pre = (
+            f", prereleases={self.prereleases!r}"
+            if self._prereleases is not None
+            else ""
+        )
+
+        return f"<{self.__class__.__name__}({str(self)!r}{pre})>"
+
+    def __str__(self) -> str:
+        """A string representation of the Specifier that can be round-tripped.
+
+        >>> str(Specifier('>=1.0.0'))
+        '>=1.0.0'
+        >>> str(Specifier('>=1.0.0', prereleases=False))
+        '>=1.0.0'
+        """
+        return "{}{}".format(*self._spec)
+
+    @property
+    def _canonical_spec(self) -> Tuple[str, str]:
+        canonical_version = canonicalize_version(
+            self._spec[1],
+            strip_trailing_zero=(self._spec[0] != "~="),
+        )
+        return self._spec[0], canonical_version
+
+    def __hash__(self) -> int:
+        return hash(self._canonical_spec)
+
+    def __eq__(self, other: object) -> bool:
+        """Whether or not the two Specifier-like objects are equal.
+
+        :param other: The other object to check against.
+
+        The value of :attr:`prereleases` is ignored.
+
+        >>> Specifier("==1.2.3") == Specifier("== 1.2.3.0")
+        True
+        >>> (Specifier("==1.2.3", prereleases=False) ==
+        ...  Specifier("==1.2.3", prereleases=True))
+        True
+        >>> Specifier("==1.2.3") == "==1.2.3"
+        True
+        >>> Specifier("==1.2.3") == Specifier("==1.2.4")
+        False
+        >>> Specifier("==1.2.3") == Specifier("~=1.2.3")
+        False
+        """
+        if isinstance(other, str):
+            try:
+                other = self.__class__(str(other))
+            except InvalidSpecifier:
+                return NotImplemented
+        elif not isinstance(other, self.__class__):
+            return NotImplemented
+
+        return self._canonical_spec == other._canonical_spec
+
+    def _get_operator(self, op: str) -> CallableOperator:
+        operator_callable: CallableOperator = getattr(
+            self, f"_compare_{self._operators[op]}"
+        )
+        return operator_callable
+
+    def _compare_compatible(self, prospective: Version, spec: str) -> bool:
+        # Compatible releases have an equivalent combination of >= and ==. That
+        # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
+        # implement this in terms of the other specifiers instead of
+        # implementing it ourselves. The only thing we need to do is construct
+        # the other specifiers.
+
+        # We want everything but the last item in the version, but we want to
+        # ignore suffix segments.
+        prefix = _version_join(
+            list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1]
+        )
+
+        # Add the prefix notation to the end of our string
+        prefix += ".*"
+
+        return self._get_operator(">=")(prospective, spec) and self._get_operator("==")(
+            prospective, prefix
+        )
+
+    def _compare_equal(self, prospective: Version, spec: str) -> bool:
+        # We need special logic to handle prefix matching
+        if spec.endswith(".*"):
+            # In the case of prefix matching we want to ignore local segment.
+            normalized_prospective = canonicalize_version(
+                prospective.public, strip_trailing_zero=False
+            )
+            # Get the normalized version string ignoring the trailing .*
+            normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False)
+            # Split the spec out by bangs and dots, and pretend that there is
+            # an implicit dot in between a release segment and a pre-release segment.
+            split_spec = _version_split(normalized_spec)
+
+            # Split the prospective version out by bangs and dots, and pretend
+            # that there is an implicit dot in between a release segment and
+            # a pre-release segment.
+            split_prospective = _version_split(normalized_prospective)
+
+            # 0-pad the prospective version before shortening it to get the correct
+            # shortened version.
+            padded_prospective, _ = _pad_version(split_prospective, split_spec)
+
+            # Shorten the prospective version to be the same length as the spec
+            # so that we can determine if the specifier is a prefix of the
+            # prospective version or not.
+            shortened_prospective = padded_prospective[: len(split_spec)]
+
+            return shortened_prospective == split_spec
+        else:
+            # Convert our spec string into a Version
+            spec_version = Version(spec)
+
+            # If the specifier does not have a local segment, then we want to
+            # act as if the prospective version also does not have a local
+            # segment.
+            if not spec_version.local:
+                prospective = Version(prospective.public)
+
+            return prospective == spec_version
+
+    def _compare_not_equal(self, prospective: Version, spec: str) -> bool:
+        return not self._compare_equal(prospective, spec)
+
+    def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool:
+        # NB: Local version identifiers are NOT permitted in the version
+        # specifier, so local version labels can be universally removed from
+        # the prospective version.
+        return Version(prospective.public) <= Version(spec)
+
+    def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool:
+        # NB: Local version identifiers are NOT permitted in the version
+        # specifier, so local version labels can be universally removed from
+        # the prospective version.
+        return Version(prospective.public) >= Version(spec)
+
+    def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:
+        # Convert our spec to a Version instance, since we'll want to work with
+        # it as a version.
+        spec = Version(spec_str)
+
+        # Check to see if the prospective version is less than the spec
+        # version. If it's not we can short circuit and just return False now
+        # instead of doing extra unneeded work.
+        if not prospective < spec:
+            return False
+
+        # This special case is here so that, unless the specifier itself
+        # includes is a pre-release version, that we do not accept pre-release
+        # versions for the version mentioned in the specifier (e.g. <3.1 should
+        # not match 3.1.dev0, but should match 3.0.dev0).
+        if not spec.is_prerelease and prospective.is_prerelease:
+            if Version(prospective.base_version) == Version(spec.base_version):
+                return False
+
+        # If we've gotten to here, it means that prospective version is both
+        # less than the spec version *and* it's not a pre-release of the same
+        # version in the spec.
+        return True
+
+    def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:
+        # Convert our spec to a Version instance, since we'll want to work with
+        # it as a version.
+        spec = Version(spec_str)
+
+        # Check to see if the prospective version is greater than the spec
+        # version. If it's not we can short circuit and just return False now
+        # instead of doing extra unneeded work.
+        if not prospective > spec:
+            return False
+
+        # This special case is here so that, unless the specifier itself
+        # includes is a post-release version, that we do not accept
+        # post-release versions for the version mentioned in the specifier
+        # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0).
+        if not spec.is_postrelease and prospective.is_postrelease:
+            if Version(prospective.base_version) == Version(spec.base_version):
+                return False
+
+        # Ensure that we do not allow a local version of the version mentioned
+        # in the specifier, which is technically greater than, to match.
+        if prospective.local is not None:
+            if Version(prospective.base_version) == Version(spec.base_version):
+                return False
+
+        # If we've gotten to here, it means that prospective version is both
+        # greater than the spec version *and* it's not a pre-release of the
+        # same version in the spec.
+        return True
+
+    def _compare_arbitrary(self, prospective: Version, spec: str) -> bool:
+        return str(prospective).lower() == str(spec).lower()
+
+    def __contains__(self, item: Union[str, Version]) -> bool:
+        """Return whether or not the item is contained in this specifier.
+
+        :param item: The item to check for.
+
+        This is used for the ``in`` operator and behaves the same as
+        :meth:`contains` with no ``prereleases`` argument passed.
+
+        >>> "1.2.3" in Specifier(">=1.2.3")
+        True
+        >>> Version("1.2.3") in Specifier(">=1.2.3")
+        True
+        >>> "1.0.0" in Specifier(">=1.2.3")
+        False
+        >>> "1.3.0a1" in Specifier(">=1.2.3")
+        False
+        >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True)
+        True
+        """
+        return self.contains(item)
+
+    def contains(
+        self, item: UnparsedVersion, prereleases: Optional[bool] = None
+    ) -> bool:
+        """Return whether or not the item is contained in this specifier.
+
+        :param item:
+            The item to check for, which can be a version string or a
+            :class:`Version` instance.
+        :param prereleases:
+            Whether or not to match prereleases with this Specifier. If set to
+            ``None`` (the default), it uses :attr:`prereleases` to determine
+            whether or not prereleases are allowed.
+
+        >>> Specifier(">=1.2.3").contains("1.2.3")
+        True
+        >>> Specifier(">=1.2.3").contains(Version("1.2.3"))
+        True
+        >>> Specifier(">=1.2.3").contains("1.0.0")
+        False
+        >>> Specifier(">=1.2.3").contains("1.3.0a1")
+        False
+        >>> Specifier(">=1.2.3", prereleases=True).contains("1.3.0a1")
+        True
+        >>> Specifier(">=1.2.3").contains("1.3.0a1", prereleases=True)
+        True
+        """
+
+        # Determine if prereleases are to be allowed or not.
+        if prereleases is None:
+            prereleases = self.prereleases
+
+        # Normalize item to a Version, this allows us to have a shortcut for
+        # "2.0" in Specifier(">=2")
+        normalized_item = _coerce_version(item)
+
+        # Determine if we should be supporting prereleases in this specifier
+        # or not, if we do not support prereleases than we can short circuit
+        # logic if this version is a prereleases.
+        if normalized_item.is_prerelease and not prereleases:
+            return False
+
+        # Actually do the comparison to determine if this item is contained
+        # within this Specifier or not.
+        operator_callable: CallableOperator = self._get_operator(self.operator)
+        return operator_callable(normalized_item, self.version)
+
+    def filter(
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+    ) -> Iterator[UnparsedVersionVar]:
+        """Filter items in the given iterable, that match the specifier.
+
+        :param iterable:
+            An iterable that can contain version strings and :class:`Version` instances.
+            The items in the iterable will be filtered according to the specifier.
+        :param prereleases:
+            Whether or not to allow prereleases in the returned iterator. If set to
+            ``None`` (the default), it will be intelligently decide whether to allow
+            prereleases or not (based on the :attr:`prereleases` attribute, and
+            whether the only versions matching are prereleases).
+
+        This method is smarter than just ``filter(Specifier().contains, [...])``
+        because it implements the rule from :pep:`440` that a prerelease item
+        SHOULD be accepted if no other versions match the given specifier.
+
+        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"]))
+        ['1.3']
+        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")]))
+        ['1.2.3', '1.3', ]
+        >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"]))
+        ['1.5a1']
+        >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True))
+        ['1.3', '1.5a1']
+        >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"]))
+        ['1.3', '1.5a1']
+        """
+
+        yielded = False
+        found_prereleases = []
+
+        kw = {"prereleases": prereleases if prereleases is not None else True}
+
+        # Attempt to iterate over all the values in the iterable and if any of
+        # them match, yield them.
+        for version in iterable:
+            parsed_version = _coerce_version(version)
+
+            if self.contains(parsed_version, **kw):
+                # If our version is a prerelease, and we were not set to allow
+                # prereleases, then we'll store it for later in case nothing
+                # else matches this specifier.
+                if parsed_version.is_prerelease and not (
+                    prereleases or self.prereleases
+                ):
+                    found_prereleases.append(version)
+                # Either this is not a prerelease, or we should have been
+                # accepting prereleases from the beginning.
+                else:
+                    yielded = True
+                    yield version
+
+        # Now that we've iterated over everything, determine if we've yielded
+        # any values, and if we have not and we have any prereleases stored up
+        # then we will go ahead and yield the prereleases.
+        if not yielded and found_prereleases:
+            for version in found_prereleases:
+                yield version
+
+
+_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
+
+
+def _version_split(version: str) -> List[str]:
+    """Split version into components.
+
+    The split components are intended for version comparison. The logic does
+    not attempt to retain the original version string, so joining the
+    components back with :func:`_version_join` may not produce the original
+    version string.
+    """
+    result: List[str] = []
+
+    epoch, _, rest = version.rpartition("!")
+    result.append(epoch or "0")
+
+    for item in rest.split("."):
+        match = _prefix_regex.search(item)
+        if match:
+            result.extend(match.groups())
+        else:
+            result.append(item)
+    return result
+
+
+def _version_join(components: List[str]) -> str:
+    """Join split version components into a version string.
+
+    This function assumes the input came from :func:`_version_split`, where the
+    first component must be the epoch (either empty or numeric), and all other
+    components numeric.
+    """
+    epoch, *rest = components
+    return f"{epoch}!{'.'.join(rest)}"
+
+
+def _is_not_suffix(segment: str) -> bool:
+    return not any(
+        segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post")
+    )
+
+
+def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]:
+    left_split, right_split = [], []
+
+    # Get the release segment of our versions
+    left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left)))
+    right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right)))
+
+    # Get the rest of our versions
+    left_split.append(left[len(left_split[0]) :])
+    right_split.append(right[len(right_split[0]) :])
+
+    # Insert our padding
+    left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0])))
+    right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0])))
+
+    return (
+        list(itertools.chain.from_iterable(left_split)),
+        list(itertools.chain.from_iterable(right_split)),
+    )
+
+
+class SpecifierSet(BaseSpecifier):
+    """This class abstracts handling of a set of version specifiers.
+
+    It can be passed a single specifier (``>=3.0``), a comma-separated list of
+    specifiers (``>=3.0,!=3.1``), or no specifier at all.
+    """
+
+    def __init__(
+        self, specifiers: str = "", prereleases: Optional[bool] = None
+    ) -> None:
+        """Initialize a SpecifierSet instance.
+
+        :param specifiers:
+            The string representation of a specifier or a comma-separated list of
+            specifiers which will be parsed and normalized before use.
+        :param prereleases:
+            This tells the SpecifierSet if it should accept prerelease versions if
+            applicable or not. The default of ``None`` will autodetect it from the
+            given specifiers.
+
+        :raises InvalidSpecifier:
+            If the given ``specifiers`` are not parseable than this exception will be
+            raised.
+        """
+
+        # Split on `,` to break each individual specifier into it's own item, and
+        # strip each item to remove leading/trailing whitespace.
+        split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
+
+        # Make each individual specifier a Specifier and save in a frozen set for later.
+        self._specs = frozenset(map(Specifier, split_specifiers))
+
+        # Store our prereleases value so we can use it later to determine if
+        # we accept prereleases or not.
+        self._prereleases = prereleases
+
+    @property
+    def prereleases(self) -> Optional[bool]:
+        # If we have been given an explicit prerelease modifier, then we'll
+        # pass that through here.
+        if self._prereleases is not None:
+            return self._prereleases
+
+        # If we don't have any specifiers, and we don't have a forced value,
+        # then we'll just return None since we don't know if this should have
+        # pre-releases or not.
+        if not self._specs:
+            return None
+
+        # Otherwise we'll see if any of the given specifiers accept
+        # prereleases, if any of them do we'll return True, otherwise False.
+        return any(s.prereleases for s in self._specs)
+
+    @prereleases.setter
+    def prereleases(self, value: bool) -> None:
+        self._prereleases = value
+
+    def __repr__(self) -> str:
+        """A representation of the specifier set that shows all internal state.
+
+        Note that the ordering of the individual specifiers within the set may not
+        match the input string.
+
+        >>> SpecifierSet('>=1.0.0,!=2.0.0')
+        =1.0.0')>
+        >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False)
+        =1.0.0', prereleases=False)>
+        >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True)
+        =1.0.0', prereleases=True)>
+        """
+        pre = (
+            f", prereleases={self.prereleases!r}"
+            if self._prereleases is not None
+            else ""
+        )
+
+        return f""
+
+    def __str__(self) -> str:
+        """A string representation of the specifier set that can be round-tripped.
+
+        Note that the ordering of the individual specifiers within the set may not
+        match the input string.
+
+        >>> str(SpecifierSet(">=1.0.0,!=1.0.1"))
+        '!=1.0.1,>=1.0.0'
+        >>> str(SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False))
+        '!=1.0.1,>=1.0.0'
+        """
+        return ",".join(sorted(str(s) for s in self._specs))
+
+    def __hash__(self) -> int:
+        return hash(self._specs)
+
+    def __and__(self, other: Union["SpecifierSet", str]) -> "SpecifierSet":
+        """Return a SpecifierSet which is a combination of the two sets.
+
+        :param other: The other object to combine with.
+
+        >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1'
+        =1.0.0')>
+        >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1')
+        =1.0.0')>
+        """
+        if isinstance(other, str):
+            other = SpecifierSet(other)
+        elif not isinstance(other, SpecifierSet):
+            return NotImplemented
+
+        specifier = SpecifierSet()
+        specifier._specs = frozenset(self._specs | other._specs)
+
+        if self._prereleases is None and other._prereleases is not None:
+            specifier._prereleases = other._prereleases
+        elif self._prereleases is not None and other._prereleases is None:
+            specifier._prereleases = self._prereleases
+        elif self._prereleases == other._prereleases:
+            specifier._prereleases = self._prereleases
+        else:
+            raise ValueError(
+                "Cannot combine SpecifierSets with True and False prerelease "
+                "overrides."
+            )
+
+        return specifier
+
+    def __eq__(self, other: object) -> bool:
+        """Whether or not the two SpecifierSet-like objects are equal.
+
+        :param other: The other object to check against.
+
+        The value of :attr:`prereleases` is ignored.
+
+        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1")
+        True
+        >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) ==
+        ...  SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True))
+        True
+        >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1"
+        True
+        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0")
+        False
+        >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2")
+        False
+        """
+        if isinstance(other, (str, Specifier)):
+            other = SpecifierSet(str(other))
+        elif not isinstance(other, SpecifierSet):
+            return NotImplemented
+
+        return self._specs == other._specs
+
+    def __len__(self) -> int:
+        """Returns the number of specifiers in this specifier set."""
+        return len(self._specs)
+
+    def __iter__(self) -> Iterator[Specifier]:
+        """
+        Returns an iterator over all the underlying :class:`Specifier` instances
+        in this specifier set.
+
+        >>> sorted(SpecifierSet(">=1.0.0,!=1.0.1"), key=str)
+        [, =1.0.0')>]
+        """
+        return iter(self._specs)
+
+    def __contains__(self, item: UnparsedVersion) -> bool:
+        """Return whether or not the item is contained in this specifier.
+
+        :param item: The item to check for.
+
+        This is used for the ``in`` operator and behaves the same as
+        :meth:`contains` with no ``prereleases`` argument passed.
+
+        >>> "1.2.3" in SpecifierSet(">=1.0.0,!=1.0.1")
+        True
+        >>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1")
+        True
+        >>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1")
+        False
+        >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1")
+        False
+        >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)
+        True
+        """
+        return self.contains(item)
+
+    def contains(
+        self,
+        item: UnparsedVersion,
+        prereleases: Optional[bool] = None,
+        installed: Optional[bool] = None,
+    ) -> bool:
+        """Return whether or not the item is contained in this SpecifierSet.
+
+        :param item:
+            The item to check for, which can be a version string or a
+            :class:`Version` instance.
+        :param prereleases:
+            Whether or not to match prereleases with this SpecifierSet. If set to
+            ``None`` (the default), it uses :attr:`prereleases` to determine
+            whether or not prereleases are allowed.
+
+        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3")
+        True
+        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3"))
+        True
+        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1")
+        False
+        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1")
+        False
+        >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True).contains("1.3.0a1")
+        True
+        >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True)
+        True
+        """
+        # Ensure that our item is a Version instance.
+        if not isinstance(item, Version):
+            item = Version(item)
+
+        # Determine if we're forcing a prerelease or not, if we're not forcing
+        # one for this particular filter call, then we'll use whatever the
+        # SpecifierSet thinks for whether or not we should support prereleases.
+        if prereleases is None:
+            prereleases = self.prereleases
+
+        # We can determine if we're going to allow pre-releases by looking to
+        # see if any of the underlying items supports them. If none of them do
+        # and this item is a pre-release then we do not allow it and we can
+        # short circuit that here.
+        # Note: This means that 1.0.dev1 would not be contained in something
+        #       like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0
+        if not prereleases and item.is_prerelease:
+            return False
+
+        if installed and item.is_prerelease:
+            item = Version(item.base_version)
+
+        # We simply dispatch to the underlying specs here to make sure that the
+        # given version is contained within all of them.
+        # Note: This use of all() here means that an empty set of specifiers
+        #       will always return True, this is an explicit design decision.
+        return all(s.contains(item, prereleases=prereleases) for s in self._specs)
+
+    def filter(
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+    ) -> Iterator[UnparsedVersionVar]:
+        """Filter items in the given iterable, that match the specifiers in this set.
+
+        :param iterable:
+            An iterable that can contain version strings and :class:`Version` instances.
+            The items in the iterable will be filtered according to the specifier.
+        :param prereleases:
+            Whether or not to allow prereleases in the returned iterator. If set to
+            ``None`` (the default), it will be intelligently decide whether to allow
+            prereleases or not (based on the :attr:`prereleases` attribute, and
+            whether the only versions matching are prereleases).
+
+        This method is smarter than just ``filter(SpecifierSet(...).contains, [...])``
+        because it implements the rule from :pep:`440` that a prerelease item
+        SHOULD be accepted if no other versions match the given specifier.
+
+        >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", "1.5a1"]))
+        ['1.3']
+        >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", Version("1.4")]))
+        ['1.3', ]
+        >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.5a1"]))
+        []
+        >>> list(SpecifierSet(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True))
+        ['1.3', '1.5a1']
+        >>> list(SpecifierSet(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"]))
+        ['1.3', '1.5a1']
+
+        An "empty" SpecifierSet will filter items based on the presence of prerelease
+        versions in the set.
+
+        >>> list(SpecifierSet("").filter(["1.3", "1.5a1"]))
+        ['1.3']
+        >>> list(SpecifierSet("").filter(["1.5a1"]))
+        ['1.5a1']
+        >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"]))
+        ['1.3', '1.5a1']
+        >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True))
+        ['1.3', '1.5a1']
+        """
+        # Determine if we're forcing a prerelease or not, if we're not forcing
+        # one for this particular filter call, then we'll use whatever the
+        # SpecifierSet thinks for whether or not we should support prereleases.
+        if prereleases is None:
+            prereleases = self.prereleases
+
+        # If we have any specifiers, then we want to wrap our iterable in the
+        # filter method for each one, this will act as a logical AND amongst
+        # each specifier.
+        if self._specs:
+            for spec in self._specs:
+                iterable = spec.filter(iterable, prereleases=bool(prereleases))
+            return iter(iterable)
+        # If we do not have any specifiers, then we need to have a rough filter
+        # which will filter out any pre-releases, unless there are no final
+        # releases.
+        else:
+            filtered: List[UnparsedVersionVar] = []
+            found_prereleases: List[UnparsedVersionVar] = []
+
+            for item in iterable:
+                parsed_version = _coerce_version(item)
+
+                # Store any item which is a pre-release for later unless we've
+                # already found a final version or we are accepting prereleases
+                if parsed_version.is_prerelease and not prereleases:
+                    if not filtered:
+                        found_prereleases.append(item)
+                else:
+                    filtered.append(item)
+
+            # If we've found no items except for pre-releases, then we'll go
+            # ahead and use the pre-releases
+            if not filtered and found_prereleases and prereleases is None:
+                return iter(found_prereleases)
+
+            return iter(filtered)
diff --git a/setuptools/_vendor/wheel/vendored/packaging/tags.py b/setuptools/_vendor/wheel/vendored/packaging/tags.py
new file mode 100644
index 0000000000..89f1926137
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/tags.py
@@ -0,0 +1,571 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+import logging
+import platform
+import re
+import struct
+import subprocess
+import sys
+import sysconfig
+from importlib.machinery import EXTENSION_SUFFIXES
+from typing import (
+    Dict,
+    FrozenSet,
+    Iterable,
+    Iterator,
+    List,
+    Optional,
+    Sequence,
+    Tuple,
+    Union,
+    cast,
+)
+
+from . import _manylinux, _musllinux
+
+logger = logging.getLogger(__name__)
+
+PythonVersion = Sequence[int]
+MacVersion = Tuple[int, int]
+
+INTERPRETER_SHORT_NAMES: Dict[str, str] = {
+    "python": "py",  # Generic.
+    "cpython": "cp",
+    "pypy": "pp",
+    "ironpython": "ip",
+    "jython": "jy",
+}
+
+
+_32_BIT_INTERPRETER = struct.calcsize("P") == 4
+
+
+class Tag:
+    """
+    A representation of the tag triple for a wheel.
+
+    Instances are considered immutable and thus are hashable. Equality checking
+    is also supported.
+    """
+
+    __slots__ = ["_interpreter", "_abi", "_platform", "_hash"]
+
+    def __init__(self, interpreter: str, abi: str, platform: str) -> None:
+        self._interpreter = interpreter.lower()
+        self._abi = abi.lower()
+        self._platform = platform.lower()
+        # The __hash__ of every single element in a Set[Tag] will be evaluated each time
+        # that a set calls its `.disjoint()` method, which may be called hundreds of
+        # times when scanning a page of links for packages with tags matching that
+        # Set[Tag]. Pre-computing the value here produces significant speedups for
+        # downstream consumers.
+        self._hash = hash((self._interpreter, self._abi, self._platform))
+
+    @property
+    def interpreter(self) -> str:
+        return self._interpreter
+
+    @property
+    def abi(self) -> str:
+        return self._abi
+
+    @property
+    def platform(self) -> str:
+        return self._platform
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, Tag):
+            return NotImplemented
+
+        return (
+            (self._hash == other._hash)  # Short-circuit ASAP for perf reasons.
+            and (self._platform == other._platform)
+            and (self._abi == other._abi)
+            and (self._interpreter == other._interpreter)
+        )
+
+    def __hash__(self) -> int:
+        return self._hash
+
+    def __str__(self) -> str:
+        return f"{self._interpreter}-{self._abi}-{self._platform}"
+
+    def __repr__(self) -> str:
+        return f"<{self} @ {id(self)}>"
+
+
+def parse_tag(tag: str) -> FrozenSet[Tag]:
+    """
+    Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances.
+
+    Returning a set is required due to the possibility that the tag is a
+    compressed tag set.
+    """
+    tags = set()
+    interpreters, abis, platforms = tag.split("-")
+    for interpreter in interpreters.split("."):
+        for abi in abis.split("."):
+            for platform_ in platforms.split("."):
+                tags.add(Tag(interpreter, abi, platform_))
+    return frozenset(tags)
+
+
+def _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]:
+    value: Union[int, str, None] = sysconfig.get_config_var(name)
+    if value is None and warn:
+        logger.debug(
+            "Config variable '%s' is unset, Python ABI tag may be incorrect", name
+        )
+    return value
+
+
+def _normalize_string(string: str) -> str:
+    return string.replace(".", "_").replace("-", "_").replace(" ", "_")
+
+
+def _is_threaded_cpython(abis: List[str]) -> bool:
+    """
+    Determine if the ABI corresponds to a threaded (`--disable-gil`) build.
+
+    The threaded builds are indicated by a "t" in the abiflags.
+    """
+    if len(abis) == 0:
+        return False
+    # expect e.g., cp313
+    m = re.match(r"cp\d+(.*)", abis[0])
+    if not m:
+        return False
+    abiflags = m.group(1)
+    return "t" in abiflags
+
+
+def _abi3_applies(python_version: PythonVersion, threading: bool) -> bool:
+    """
+    Determine if the Python version supports abi3.
+
+    PEP 384 was first implemented in Python 3.2. The threaded (`--disable-gil`)
+    builds do not support abi3.
+    """
+    return len(python_version) > 1 and tuple(python_version) >= (3, 2) and not threading
+
+
+def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]:
+    py_version = tuple(py_version)  # To allow for version comparison.
+    abis = []
+    version = _version_nodot(py_version[:2])
+    threading = debug = pymalloc = ucs4 = ""
+    with_debug = _get_config_var("Py_DEBUG", warn)
+    has_refcount = hasattr(sys, "gettotalrefcount")
+    # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled
+    # extension modules is the best option.
+    # https://github.com/pypa/pip/issues/3383#issuecomment-173267692
+    has_ext = "_d.pyd" in EXTENSION_SUFFIXES
+    if with_debug or (with_debug is None and (has_refcount or has_ext)):
+        debug = "d"
+    if py_version >= (3, 13) and _get_config_var("Py_GIL_DISABLED", warn):
+        threading = "t"
+    if py_version < (3, 8):
+        with_pymalloc = _get_config_var("WITH_PYMALLOC", warn)
+        if with_pymalloc or with_pymalloc is None:
+            pymalloc = "m"
+        if py_version < (3, 3):
+            unicode_size = _get_config_var("Py_UNICODE_SIZE", warn)
+            if unicode_size == 4 or (
+                unicode_size is None and sys.maxunicode == 0x10FFFF
+            ):
+                ucs4 = "u"
+    elif debug:
+        # Debug builds can also load "normal" extension modules.
+        # We can also assume no UCS-4 or pymalloc requirement.
+        abis.append(f"cp{version}{threading}")
+    abis.insert(0, f"cp{version}{threading}{debug}{pymalloc}{ucs4}")
+    return abis
+
+
+def cpython_tags(
+    python_version: Optional[PythonVersion] = None,
+    abis: Optional[Iterable[str]] = None,
+    platforms: Optional[Iterable[str]] = None,
+    *,
+    warn: bool = False,
+) -> Iterator[Tag]:
+    """
+    Yields the tags for a CPython interpreter.
+
+    The tags consist of:
+    - cp--
+    - cp-abi3-
+    - cp-none-
+    - cp-abi3-  # Older Python versions down to 3.2.
+
+    If python_version only specifies a major version then user-provided ABIs and
+    the 'none' ABItag will be used.
+
+    If 'abi3' or 'none' are specified in 'abis' then they will be yielded at
+    their normal position and not at the beginning.
+    """
+    if not python_version:
+        python_version = sys.version_info[:2]
+
+    interpreter = f"cp{_version_nodot(python_version[:2])}"
+
+    if abis is None:
+        if len(python_version) > 1:
+            abis = _cpython_abis(python_version, warn)
+        else:
+            abis = []
+    abis = list(abis)
+    # 'abi3' and 'none' are explicitly handled later.
+    for explicit_abi in ("abi3", "none"):
+        try:
+            abis.remove(explicit_abi)
+        except ValueError:
+            pass
+
+    platforms = list(platforms or platform_tags())
+    for abi in abis:
+        for platform_ in platforms:
+            yield Tag(interpreter, abi, platform_)
+
+    threading = _is_threaded_cpython(abis)
+    use_abi3 = _abi3_applies(python_version, threading)
+    if use_abi3:
+        yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms)
+    yield from (Tag(interpreter, "none", platform_) for platform_ in platforms)
+
+    if use_abi3:
+        for minor_version in range(python_version[1] - 1, 1, -1):
+            for platform_ in platforms:
+                interpreter = "cp{version}".format(
+                    version=_version_nodot((python_version[0], minor_version))
+                )
+                yield Tag(interpreter, "abi3", platform_)
+
+
+def _generic_abi() -> List[str]:
+    """
+    Return the ABI tag based on EXT_SUFFIX.
+    """
+    # The following are examples of `EXT_SUFFIX`.
+    # We want to keep the parts which are related to the ABI and remove the
+    # parts which are related to the platform:
+    # - linux:   '.cpython-310-x86_64-linux-gnu.so' => cp310
+    # - mac:     '.cpython-310-darwin.so'           => cp310
+    # - win:     '.cp310-win_amd64.pyd'             => cp310
+    # - win:     '.pyd'                             => cp37 (uses _cpython_abis())
+    # - pypy:    '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73
+    # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'
+    #                                               => graalpy_38_native
+
+    ext_suffix = _get_config_var("EXT_SUFFIX", warn=True)
+    if not isinstance(ext_suffix, str) or ext_suffix[0] != ".":
+        raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")
+    parts = ext_suffix.split(".")
+    if len(parts) < 3:
+        # CPython3.7 and earlier uses ".pyd" on Windows.
+        return _cpython_abis(sys.version_info[:2])
+    soabi = parts[1]
+    if soabi.startswith("cpython"):
+        # non-windows
+        abi = "cp" + soabi.split("-")[1]
+    elif soabi.startswith("cp"):
+        # windows
+        abi = soabi.split("-")[0]
+    elif soabi.startswith("pypy"):
+        abi = "-".join(soabi.split("-")[:2])
+    elif soabi.startswith("graalpy"):
+        abi = "-".join(soabi.split("-")[:3])
+    elif soabi:
+        # pyston, ironpython, others?
+        abi = soabi
+    else:
+        return []
+    return [_normalize_string(abi)]
+
+
+def generic_tags(
+    interpreter: Optional[str] = None,
+    abis: Optional[Iterable[str]] = None,
+    platforms: Optional[Iterable[str]] = None,
+    *,
+    warn: bool = False,
+) -> Iterator[Tag]:
+    """
+    Yields the tags for a generic interpreter.
+
+    The tags consist of:
+    - --
+
+    The "none" ABI will be added if it was not explicitly provided.
+    """
+    if not interpreter:
+        interp_name = interpreter_name()
+        interp_version = interpreter_version(warn=warn)
+        interpreter = "".join([interp_name, interp_version])
+    if abis is None:
+        abis = _generic_abi()
+    else:
+        abis = list(abis)
+    platforms = list(platforms or platform_tags())
+    if "none" not in abis:
+        abis.append("none")
+    for abi in abis:
+        for platform_ in platforms:
+            yield Tag(interpreter, abi, platform_)
+
+
+def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]:
+    """
+    Yields Python versions in descending order.
+
+    After the latest version, the major-only version will be yielded, and then
+    all previous versions of that major version.
+    """
+    if len(py_version) > 1:
+        yield f"py{_version_nodot(py_version[:2])}"
+    yield f"py{py_version[0]}"
+    if len(py_version) > 1:
+        for minor in range(py_version[1] - 1, -1, -1):
+            yield f"py{_version_nodot((py_version[0], minor))}"
+
+
+def compatible_tags(
+    python_version: Optional[PythonVersion] = None,
+    interpreter: Optional[str] = None,
+    platforms: Optional[Iterable[str]] = None,
+) -> Iterator[Tag]:
+    """
+    Yields the sequence of tags that are compatible with a specific version of Python.
+
+    The tags consist of:
+    - py*-none-
+    - -none-any  # ... if `interpreter` is provided.
+    - py*-none-any
+    """
+    if not python_version:
+        python_version = sys.version_info[:2]
+    platforms = list(platforms or platform_tags())
+    for version in _py_interpreter_range(python_version):
+        for platform_ in platforms:
+            yield Tag(version, "none", platform_)
+    if interpreter:
+        yield Tag(interpreter, "none", "any")
+    for version in _py_interpreter_range(python_version):
+        yield Tag(version, "none", "any")
+
+
+def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str:
+    if not is_32bit:
+        return arch
+
+    if arch.startswith("ppc"):
+        return "ppc"
+
+    return "i386"
+
+
+def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]:
+    formats = [cpu_arch]
+    if cpu_arch == "x86_64":
+        if version < (10, 4):
+            return []
+        formats.extend(["intel", "fat64", "fat32"])
+
+    elif cpu_arch == "i386":
+        if version < (10, 4):
+            return []
+        formats.extend(["intel", "fat32", "fat"])
+
+    elif cpu_arch == "ppc64":
+        # TODO: Need to care about 32-bit PPC for ppc64 through 10.2?
+        if version > (10, 5) or version < (10, 4):
+            return []
+        formats.append("fat64")
+
+    elif cpu_arch == "ppc":
+        if version > (10, 6):
+            return []
+        formats.extend(["fat32", "fat"])
+
+    if cpu_arch in {"arm64", "x86_64"}:
+        formats.append("universal2")
+
+    if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}:
+        formats.append("universal")
+
+    return formats
+
+
+def mac_platforms(
+    version: Optional[MacVersion] = None, arch: Optional[str] = None
+) -> Iterator[str]:
+    """
+    Yields the platform tags for a macOS system.
+
+    The `version` parameter is a two-item tuple specifying the macOS version to
+    generate platform tags for. The `arch` parameter is the CPU architecture to
+    generate platform tags for. Both parameters default to the appropriate value
+    for the current system.
+    """
+    version_str, _, cpu_arch = platform.mac_ver()
+    if version is None:
+        version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2])))
+        if version == (10, 16):
+            # When built against an older macOS SDK, Python will report macOS 10.16
+            # instead of the real version.
+            version_str = subprocess.run(
+                [
+                    sys.executable,
+                    "-sS",
+                    "-c",
+                    "import platform; print(platform.mac_ver()[0])",
+                ],
+                check=True,
+                env={"SYSTEM_VERSION_COMPAT": "0"},
+                stdout=subprocess.PIPE,
+                text=True,
+            ).stdout
+            version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2])))
+    else:
+        version = version
+    if arch is None:
+        arch = _mac_arch(cpu_arch)
+    else:
+        arch = arch
+
+    if (10, 0) <= version and version < (11, 0):
+        # Prior to Mac OS 11, each yearly release of Mac OS bumped the
+        # "minor" version number.  The major version was always 10.
+        for minor_version in range(version[1], -1, -1):
+            compat_version = 10, minor_version
+            binary_formats = _mac_binary_formats(compat_version, arch)
+            for binary_format in binary_formats:
+                yield "macosx_{major}_{minor}_{binary_format}".format(
+                    major=10, minor=minor_version, binary_format=binary_format
+                )
+
+    if version >= (11, 0):
+        # Starting with Mac OS 11, each yearly release bumps the major version
+        # number.   The minor versions are now the midyear updates.
+        for major_version in range(version[0], 10, -1):
+            compat_version = major_version, 0
+            binary_formats = _mac_binary_formats(compat_version, arch)
+            for binary_format in binary_formats:
+                yield "macosx_{major}_{minor}_{binary_format}".format(
+                    major=major_version, minor=0, binary_format=binary_format
+                )
+
+    if version >= (11, 0):
+        # Mac OS 11 on x86_64 is compatible with binaries from previous releases.
+        # Arm64 support was introduced in 11.0, so no Arm binaries from previous
+        # releases exist.
+        #
+        # However, the "universal2" binary format can have a
+        # macOS version earlier than 11.0 when the x86_64 part of the binary supports
+        # that version of macOS.
+        if arch == "x86_64":
+            for minor_version in range(16, 3, -1):
+                compat_version = 10, minor_version
+                binary_formats = _mac_binary_formats(compat_version, arch)
+                for binary_format in binary_formats:
+                    yield "macosx_{major}_{minor}_{binary_format}".format(
+                        major=compat_version[0],
+                        minor=compat_version[1],
+                        binary_format=binary_format,
+                    )
+        else:
+            for minor_version in range(16, 3, -1):
+                compat_version = 10, minor_version
+                binary_format = "universal2"
+                yield "macosx_{major}_{minor}_{binary_format}".format(
+                    major=compat_version[0],
+                    minor=compat_version[1],
+                    binary_format=binary_format,
+                )
+
+
+def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]:
+    linux = _normalize_string(sysconfig.get_platform())
+    if not linux.startswith("linux_"):
+        # we should never be here, just yield the sysconfig one and return
+        yield linux
+        return
+    if is_32bit:
+        if linux == "linux_x86_64":
+            linux = "linux_i686"
+        elif linux == "linux_aarch64":
+            linux = "linux_armv8l"
+    _, arch = linux.split("_", 1)
+    archs = {"armv8l": ["armv8l", "armv7l"]}.get(arch, [arch])
+    yield from _manylinux.platform_tags(archs)
+    yield from _musllinux.platform_tags(archs)
+    for arch in archs:
+        yield f"linux_{arch}"
+
+
+def _generic_platforms() -> Iterator[str]:
+    yield _normalize_string(sysconfig.get_platform())
+
+
+def platform_tags() -> Iterator[str]:
+    """
+    Provides the platform tags for this installation.
+    """
+    if platform.system() == "Darwin":
+        return mac_platforms()
+    elif platform.system() == "Linux":
+        return _linux_platforms()
+    else:
+        return _generic_platforms()
+
+
+def interpreter_name() -> str:
+    """
+    Returns the name of the running interpreter.
+
+    Some implementations have a reserved, two-letter abbreviation which will
+    be returned when appropriate.
+    """
+    name = sys.implementation.name
+    return INTERPRETER_SHORT_NAMES.get(name) or name
+
+
+def interpreter_version(*, warn: bool = False) -> str:
+    """
+    Returns the version of the running interpreter.
+    """
+    version = _get_config_var("py_version_nodot", warn=warn)
+    if version:
+        version = str(version)
+    else:
+        version = _version_nodot(sys.version_info[:2])
+    return version
+
+
+def _version_nodot(version: PythonVersion) -> str:
+    return "".join(map(str, version))
+
+
+def sys_tags(*, warn: bool = False) -> Iterator[Tag]:
+    """
+    Returns the sequence of tag triples for the running interpreter.
+
+    The order of the sequence corresponds to priority order for the
+    interpreter, from most to least important.
+    """
+
+    interp_name = interpreter_name()
+    if interp_name == "cp":
+        yield from cpython_tags(warn=warn)
+    else:
+        yield from generic_tags()
+
+    if interp_name == "pp":
+        interp = "pp3"
+    elif interp_name == "cp":
+        interp = "cp" + interpreter_version(warn=warn)
+    else:
+        interp = None
+    yield from compatible_tags(interpreter=interp)
diff --git a/setuptools/_vendor/wheel/vendored/packaging/utils.py b/setuptools/_vendor/wheel/vendored/packaging/utils.py
new file mode 100644
index 0000000000..c2c2f75aa8
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/utils.py
@@ -0,0 +1,172 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+import re
+from typing import FrozenSet, NewType, Tuple, Union, cast
+
+from .tags import Tag, parse_tag
+from .version import InvalidVersion, Version
+
+BuildTag = Union[Tuple[()], Tuple[int, str]]
+NormalizedName = NewType("NormalizedName", str)
+
+
+class InvalidName(ValueError):
+    """
+    An invalid distribution name; users should refer to the packaging user guide.
+    """
+
+
+class InvalidWheelFilename(ValueError):
+    """
+    An invalid wheel filename was found, users should refer to PEP 427.
+    """
+
+
+class InvalidSdistFilename(ValueError):
+    """
+    An invalid sdist filename was found, users should refer to the packaging user guide.
+    """
+
+
+# Core metadata spec for `Name`
+_validate_regex = re.compile(
+    r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE
+)
+_canonicalize_regex = re.compile(r"[-_.]+")
+_normalized_regex = re.compile(r"^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$")
+# PEP 427: The build number must start with a digit.
+_build_tag_regex = re.compile(r"(\d+)(.*)")
+
+
+def canonicalize_name(name: str, *, validate: bool = False) -> NormalizedName:
+    if validate and not _validate_regex.match(name):
+        raise InvalidName(f"name is invalid: {name!r}")
+    # This is taken from PEP 503.
+    value = _canonicalize_regex.sub("-", name).lower()
+    return cast(NormalizedName, value)
+
+
+def is_normalized_name(name: str) -> bool:
+    return _normalized_regex.match(name) is not None
+
+
+def canonicalize_version(
+    version: Union[Version, str], *, strip_trailing_zero: bool = True
+) -> str:
+    """
+    This is very similar to Version.__str__, but has one subtle difference
+    with the way it handles the release segment.
+    """
+    if isinstance(version, str):
+        try:
+            parsed = Version(version)
+        except InvalidVersion:
+            # Legacy versions cannot be normalized
+            return version
+    else:
+        parsed = version
+
+    parts = []
+
+    # Epoch
+    if parsed.epoch != 0:
+        parts.append(f"{parsed.epoch}!")
+
+    # Release segment
+    release_segment = ".".join(str(x) for x in parsed.release)
+    if strip_trailing_zero:
+        # NB: This strips trailing '.0's to normalize
+        release_segment = re.sub(r"(\.0)+$", "", release_segment)
+    parts.append(release_segment)
+
+    # Pre-release
+    if parsed.pre is not None:
+        parts.append("".join(str(x) for x in parsed.pre))
+
+    # Post-release
+    if parsed.post is not None:
+        parts.append(f".post{parsed.post}")
+
+    # Development release
+    if parsed.dev is not None:
+        parts.append(f".dev{parsed.dev}")
+
+    # Local version segment
+    if parsed.local is not None:
+        parts.append(f"+{parsed.local}")
+
+    return "".join(parts)
+
+
+def parse_wheel_filename(
+    filename: str,
+) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]:
+    if not filename.endswith(".whl"):
+        raise InvalidWheelFilename(
+            f"Invalid wheel filename (extension must be '.whl'): {filename}"
+        )
+
+    filename = filename[:-4]
+    dashes = filename.count("-")
+    if dashes not in (4, 5):
+        raise InvalidWheelFilename(
+            f"Invalid wheel filename (wrong number of parts): {filename}"
+        )
+
+    parts = filename.split("-", dashes - 2)
+    name_part = parts[0]
+    # See PEP 427 for the rules on escaping the project name.
+    if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is None:
+        raise InvalidWheelFilename(f"Invalid project name: {filename}")
+    name = canonicalize_name(name_part)
+
+    try:
+        version = Version(parts[1])
+    except InvalidVersion as e:
+        raise InvalidWheelFilename(
+            f"Invalid wheel filename (invalid version): {filename}"
+        ) from e
+
+    if dashes == 5:
+        build_part = parts[2]
+        build_match = _build_tag_regex.match(build_part)
+        if build_match is None:
+            raise InvalidWheelFilename(
+                f"Invalid build number: {build_part} in '{filename}'"
+            )
+        build = cast(BuildTag, (int(build_match.group(1)), build_match.group(2)))
+    else:
+        build = ()
+    tags = parse_tag(parts[-1])
+    return (name, version, build, tags)
+
+
+def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]:
+    if filename.endswith(".tar.gz"):
+        file_stem = filename[: -len(".tar.gz")]
+    elif filename.endswith(".zip"):
+        file_stem = filename[: -len(".zip")]
+    else:
+        raise InvalidSdistFilename(
+            f"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):"
+            f" {filename}"
+        )
+
+    # We are requiring a PEP 440 version, which cannot contain dashes,
+    # so we split on the last dash.
+    name_part, sep, version_part = file_stem.rpartition("-")
+    if not sep:
+        raise InvalidSdistFilename(f"Invalid sdist filename: {filename}")
+
+    name = canonicalize_name(name_part)
+
+    try:
+        version = Version(version_part)
+    except InvalidVersion as e:
+        raise InvalidSdistFilename(
+            f"Invalid sdist filename (invalid version): {filename}"
+        ) from e
+
+    return (name, version)
diff --git a/setuptools/_vendor/wheel/vendored/packaging/version.py b/setuptools/_vendor/wheel/vendored/packaging/version.py
new file mode 100644
index 0000000000..cda8e99935
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/packaging/version.py
@@ -0,0 +1,561 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+"""
+.. testsetup::
+
+    from packaging.version import parse, Version
+"""
+
+import itertools
+import re
+from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union
+
+from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType
+
+__all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"]
+
+LocalType = Tuple[Union[int, str], ...]
+
+CmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]]
+CmpLocalType = Union[
+    NegativeInfinityType,
+    Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...],
+]
+CmpKey = Tuple[
+    int,
+    Tuple[int, ...],
+    CmpPrePostDevType,
+    CmpPrePostDevType,
+    CmpPrePostDevType,
+    CmpLocalType,
+]
+VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool]
+
+
+class _Version(NamedTuple):
+    epoch: int
+    release: Tuple[int, ...]
+    dev: Optional[Tuple[str, int]]
+    pre: Optional[Tuple[str, int]]
+    post: Optional[Tuple[str, int]]
+    local: Optional[LocalType]
+
+
+def parse(version: str) -> "Version":
+    """Parse the given version string.
+
+    >>> parse('1.0.dev1')
+    
+
+    :param version: The version string to parse.
+    :raises InvalidVersion: When the version string is not a valid version.
+    """
+    return Version(version)
+
+
+class InvalidVersion(ValueError):
+    """Raised when a version string is not a valid version.
+
+    >>> Version("invalid")
+    Traceback (most recent call last):
+        ...
+    packaging.version.InvalidVersion: Invalid version: 'invalid'
+    """
+
+
+class _BaseVersion:
+    _key: Tuple[Any, ...]
+
+    def __hash__(self) -> int:
+        return hash(self._key)
+
+    # Please keep the duplicated `isinstance` check
+    # in the six comparisons hereunder
+    # unless you find a way to avoid adding overhead function calls.
+    def __lt__(self, other: "_BaseVersion") -> bool:
+        if not isinstance(other, _BaseVersion):
+            return NotImplemented
+
+        return self._key < other._key
+
+    def __le__(self, other: "_BaseVersion") -> bool:
+        if not isinstance(other, _BaseVersion):
+            return NotImplemented
+
+        return self._key <= other._key
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, _BaseVersion):
+            return NotImplemented
+
+        return self._key == other._key
+
+    def __ge__(self, other: "_BaseVersion") -> bool:
+        if not isinstance(other, _BaseVersion):
+            return NotImplemented
+
+        return self._key >= other._key
+
+    def __gt__(self, other: "_BaseVersion") -> bool:
+        if not isinstance(other, _BaseVersion):
+            return NotImplemented
+
+        return self._key > other._key
+
+    def __ne__(self, other: object) -> bool:
+        if not isinstance(other, _BaseVersion):
+            return NotImplemented
+
+        return self._key != other._key
+
+
+# Deliberately not anchored to the start and end of the string, to make it
+# easier for 3rd party code to reuse
+_VERSION_PATTERN = r"""
+    v?
+    (?:
+        (?:(?P[0-9]+)!)?                           # epoch
+        (?P[0-9]+(?:\.[0-9]+)*)                  # release segment
+        (?P
                                          # pre-release
+            [-_\.]?
+            (?Palpha|a|beta|b|preview|pre|c|rc)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+        (?P                                         # post release
+            (?:-(?P[0-9]+))
+            |
+            (?:
+                [-_\.]?
+                (?Ppost|rev|r)
+                [-_\.]?
+                (?P[0-9]+)?
+            )
+        )?
+        (?P                                          # dev release
+            [-_\.]?
+            (?Pdev)
+            [-_\.]?
+            (?P[0-9]+)?
+        )?
+    )
+    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
+"""
+
+VERSION_PATTERN = _VERSION_PATTERN
+"""
+A string containing the regular expression used to match a valid version.
+
+The pattern is not anchored at either end, and is intended for embedding in larger
+expressions (for example, matching a version number as part of a file name). The
+regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
+flags set.
+
+:meta hide-value:
+"""
+
+
+class Version(_BaseVersion):
+    """This class abstracts handling of a project's versions.
+
+    A :class:`Version` instance is comparison aware and can be compared and
+    sorted using the standard Python interfaces.
+
+    >>> v1 = Version("1.0a5")
+    >>> v2 = Version("1.0")
+    >>> v1
+    
+    >>> v2
+    
+    >>> v1 < v2
+    True
+    >>> v1 == v2
+    False
+    >>> v1 > v2
+    False
+    >>> v1 >= v2
+    False
+    >>> v1 <= v2
+    True
+    """
+
+    _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
+    _key: CmpKey
+
+    def __init__(self, version: str) -> None:
+        """Initialize a Version object.
+
+        :param version:
+            The string representation of a version which will be parsed and normalized
+            before use.
+        :raises InvalidVersion:
+            If the ``version`` does not conform to PEP 440 in any way then this
+            exception will be raised.
+        """
+
+        # Validate the version and parse it into pieces
+        match = self._regex.search(version)
+        if not match:
+            raise InvalidVersion(f"Invalid version: '{version}'")
+
+        # Store the parsed out pieces of the version
+        self._version = _Version(
+            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
+            release=tuple(int(i) for i in match.group("release").split(".")),
+            pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
+            post=_parse_letter_version(
+                match.group("post_l"), match.group("post_n1") or match.group("post_n2")
+            ),
+            dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
+            local=_parse_local_version(match.group("local")),
+        )
+
+        # Generate a key which will be used for sorting
+        self._key = _cmpkey(
+            self._version.epoch,
+            self._version.release,
+            self._version.pre,
+            self._version.post,
+            self._version.dev,
+            self._version.local,
+        )
+
+    def __repr__(self) -> str:
+        """A representation of the Version that shows all internal state.
+
+        >>> Version('1.0.0')
+        
+        """
+        return f""
+
+    def __str__(self) -> str:
+        """A string representation of the version that can be rounded-tripped.
+
+        >>> str(Version("1.0a5"))
+        '1.0a5'
+        """
+        parts = []
+
+        # Epoch
+        if self.epoch != 0:
+            parts.append(f"{self.epoch}!")
+
+        # Release segment
+        parts.append(".".join(str(x) for x in self.release))
+
+        # Pre-release
+        if self.pre is not None:
+            parts.append("".join(str(x) for x in self.pre))
+
+        # Post-release
+        if self.post is not None:
+            parts.append(f".post{self.post}")
+
+        # Development release
+        if self.dev is not None:
+            parts.append(f".dev{self.dev}")
+
+        # Local version segment
+        if self.local is not None:
+            parts.append(f"+{self.local}")
+
+        return "".join(parts)
+
+    @property
+    def epoch(self) -> int:
+        """The epoch of the version.
+
+        >>> Version("2.0.0").epoch
+        0
+        >>> Version("1!2.0.0").epoch
+        1
+        """
+        return self._version.epoch
+
+    @property
+    def release(self) -> Tuple[int, ...]:
+        """The components of the "release" segment of the version.
+
+        >>> Version("1.2.3").release
+        (1, 2, 3)
+        >>> Version("2.0.0").release
+        (2, 0, 0)
+        >>> Version("1!2.0.0.post0").release
+        (2, 0, 0)
+
+        Includes trailing zeroes but not the epoch or any pre-release / development /
+        post-release suffixes.
+        """
+        return self._version.release
+
+    @property
+    def pre(self) -> Optional[Tuple[str, int]]:
+        """The pre-release segment of the version.
+
+        >>> print(Version("1.2.3").pre)
+        None
+        >>> Version("1.2.3a1").pre
+        ('a', 1)
+        >>> Version("1.2.3b1").pre
+        ('b', 1)
+        >>> Version("1.2.3rc1").pre
+        ('rc', 1)
+        """
+        return self._version.pre
+
+    @property
+    def post(self) -> Optional[int]:
+        """The post-release number of the version.
+
+        >>> print(Version("1.2.3").post)
+        None
+        >>> Version("1.2.3.post1").post
+        1
+        """
+        return self._version.post[1] if self._version.post else None
+
+    @property
+    def dev(self) -> Optional[int]:
+        """The development number of the version.
+
+        >>> print(Version("1.2.3").dev)
+        None
+        >>> Version("1.2.3.dev1").dev
+        1
+        """
+        return self._version.dev[1] if self._version.dev else None
+
+    @property
+    def local(self) -> Optional[str]:
+        """The local version segment of the version.
+
+        >>> print(Version("1.2.3").local)
+        None
+        >>> Version("1.2.3+abc").local
+        'abc'
+        """
+        if self._version.local:
+            return ".".join(str(x) for x in self._version.local)
+        else:
+            return None
+
+    @property
+    def public(self) -> str:
+        """The public portion of the version.
+
+        >>> Version("1.2.3").public
+        '1.2.3'
+        >>> Version("1.2.3+abc").public
+        '1.2.3'
+        >>> Version("1.2.3+abc.dev1").public
+        '1.2.3'
+        """
+        return str(self).split("+", 1)[0]
+
+    @property
+    def base_version(self) -> str:
+        """The "base version" of the version.
+
+        >>> Version("1.2.3").base_version
+        '1.2.3'
+        >>> Version("1.2.3+abc").base_version
+        '1.2.3'
+        >>> Version("1!1.2.3+abc.dev1").base_version
+        '1!1.2.3'
+
+        The "base version" is the public version of the project without any pre or post
+        release markers.
+        """
+        parts = []
+
+        # Epoch
+        if self.epoch != 0:
+            parts.append(f"{self.epoch}!")
+
+        # Release segment
+        parts.append(".".join(str(x) for x in self.release))
+
+        return "".join(parts)
+
+    @property
+    def is_prerelease(self) -> bool:
+        """Whether this version is a pre-release.
+
+        >>> Version("1.2.3").is_prerelease
+        False
+        >>> Version("1.2.3a1").is_prerelease
+        True
+        >>> Version("1.2.3b1").is_prerelease
+        True
+        >>> Version("1.2.3rc1").is_prerelease
+        True
+        >>> Version("1.2.3dev1").is_prerelease
+        True
+        """
+        return self.dev is not None or self.pre is not None
+
+    @property
+    def is_postrelease(self) -> bool:
+        """Whether this version is a post-release.
+
+        >>> Version("1.2.3").is_postrelease
+        False
+        >>> Version("1.2.3.post1").is_postrelease
+        True
+        """
+        return self.post is not None
+
+    @property
+    def is_devrelease(self) -> bool:
+        """Whether this version is a development release.
+
+        >>> Version("1.2.3").is_devrelease
+        False
+        >>> Version("1.2.3.dev1").is_devrelease
+        True
+        """
+        return self.dev is not None
+
+    @property
+    def major(self) -> int:
+        """The first item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").major
+        1
+        """
+        return self.release[0] if len(self.release) >= 1 else 0
+
+    @property
+    def minor(self) -> int:
+        """The second item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").minor
+        2
+        >>> Version("1").minor
+        0
+        """
+        return self.release[1] if len(self.release) >= 2 else 0
+
+    @property
+    def micro(self) -> int:
+        """The third item of :attr:`release` or ``0`` if unavailable.
+
+        >>> Version("1.2.3").micro
+        3
+        >>> Version("1").micro
+        0
+        """
+        return self.release[2] if len(self.release) >= 3 else 0
+
+
+def _parse_letter_version(
+    letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
+) -> Optional[Tuple[str, int]]:
+    if letter:
+        # We consider there to be an implicit 0 in a pre-release if there is
+        # not a numeral associated with it.
+        if number is None:
+            number = 0
+
+        # We normalize any letters to their lower case form
+        letter = letter.lower()
+
+        # We consider some words to be alternate spellings of other words and
+        # in those cases we want to normalize the spellings to our preferred
+        # spelling.
+        if letter == "alpha":
+            letter = "a"
+        elif letter == "beta":
+            letter = "b"
+        elif letter in ["c", "pre", "preview"]:
+            letter = "rc"
+        elif letter in ["rev", "r"]:
+            letter = "post"
+
+        return letter, int(number)
+    if not letter and number:
+        # We assume if we are given a number, but we are not given a letter
+        # then this is using the implicit post release syntax (e.g. 1.0-1)
+        letter = "post"
+
+        return letter, int(number)
+
+    return None
+
+
+_local_version_separators = re.compile(r"[\._-]")
+
+
+def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
+    """
+    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
+    """
+    if local is not None:
+        return tuple(
+            part.lower() if not part.isdigit() else int(part)
+            for part in _local_version_separators.split(local)
+        )
+    return None
+
+
+def _cmpkey(
+    epoch: int,
+    release: Tuple[int, ...],
+    pre: Optional[Tuple[str, int]],
+    post: Optional[Tuple[str, int]],
+    dev: Optional[Tuple[str, int]],
+    local: Optional[LocalType],
+) -> CmpKey:
+    # When we compare a release version, we want to compare it with all of the
+    # trailing zeros removed. So we'll use a reverse the list, drop all the now
+    # leading zeros until we come to something non zero, then take the rest
+    # re-reverse it back into the correct order and make it a tuple and use
+    # that for our sorting key.
+    _release = tuple(
+        reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
+    )
+
+    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
+    # We'll do this by abusing the pre segment, but we _only_ want to do this
+    # if there is not a pre or a post segment. If we have one of those then
+    # the normal sorting rules will handle this case correctly.
+    if pre is None and post is None and dev is not None:
+        _pre: CmpPrePostDevType = NegativeInfinity
+    # Versions without a pre-release (except as noted above) should sort after
+    # those with one.
+    elif pre is None:
+        _pre = Infinity
+    else:
+        _pre = pre
+
+    # Versions without a post segment should sort before those with one.
+    if post is None:
+        _post: CmpPrePostDevType = NegativeInfinity
+
+    else:
+        _post = post
+
+    # Versions without a development segment should sort after those with one.
+    if dev is None:
+        _dev: CmpPrePostDevType = Infinity
+
+    else:
+        _dev = dev
+
+    if local is None:
+        # Versions without a local segment should sort before those with one.
+        _local: CmpLocalType = NegativeInfinity
+    else:
+        # Versions with a local segment need that segment parsed to implement
+        # the sorting rules in PEP440.
+        # - Alpha numeric segments sort before numeric segments
+        # - Alpha numeric segments sort lexicographically
+        # - Numeric segments sort numerically
+        # - Shorter versions sort before longer versions when the prefixes
+        #   match exactly
+        _local = tuple(
+            (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
+        )
+
+    return epoch, _release, _pre, _post, _dev, _local
diff --git a/setuptools/_vendor/wheel/vendored/vendor.txt b/setuptools/_vendor/wheel/vendored/vendor.txt
new file mode 100644
index 0000000000..14666103a8
--- /dev/null
+++ b/setuptools/_vendor/wheel/vendored/vendor.txt
@@ -0,0 +1 @@
+packaging==24.0
diff --git a/setuptools/_vendor/wheel/wheelfile.py b/setuptools/_vendor/wheel/wheelfile.py
index 83a31772bd..6440e90ade 100644
--- a/setuptools/_vendor/wheel/wheelfile.py
+++ b/setuptools/_vendor/wheel/wheelfile.py
@@ -9,7 +9,8 @@
 from io import StringIO, TextIOWrapper
 from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo
 
-from .util import log, urlsafe_b64decode, urlsafe_b64encode
+from wheel.cli import WheelError
+from wheel.util import log, urlsafe_b64decode, urlsafe_b64encode
 
 # Non-greedy matching of an optional build number may be too clever (more
 # invalid wheel filenames will match). Separate regex for .dist-info?
@@ -193,7 +194,3 @@ def close(self):
             self.writestr(self.record_path, data.getvalue())
 
         ZipFile.close(self)
-
-
-class WheelError(Exception):
-    pass
diff --git a/setuptools/_vendor/zipp-3.19.2.dist-info/INSTALLER b/setuptools/_vendor/zipp-3.19.2.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/setuptools/_vendor/zipp-3.19.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/setuptools/_vendor/ordered_set-3.1.1.dist-info/MIT-LICENSE b/setuptools/_vendor/zipp-3.19.2.dist-info/LICENSE
similarity index 58%
rename from setuptools/_vendor/ordered_set-3.1.1.dist-info/MIT-LICENSE
rename to setuptools/_vendor/zipp-3.19.2.dist-info/LICENSE
index 25117ef4f1..1bb5a44356 100644
--- a/setuptools/_vendor/ordered_set-3.1.1.dist-info/MIT-LICENSE
+++ b/setuptools/_vendor/zipp-3.19.2.dist-info/LICENSE
@@ -1,11 +1,9 @@
-Copyright (c) 2018 Luminoso Technologies, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
+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.
@@ -15,5 +13,5 @@ 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.
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/setuptools/_vendor/zipp-3.19.2.dist-info/METADATA b/setuptools/_vendor/zipp-3.19.2.dist-info/METADATA
new file mode 100644
index 0000000000..1399281717
--- /dev/null
+++ b/setuptools/_vendor/zipp-3.19.2.dist-info/METADATA
@@ -0,0 +1,102 @@
+Metadata-Version: 2.1
+Name: zipp
+Version: 3.19.2
+Summary: Backport of pathlib-compatible object wrapper for zip files
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/zipp
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: jaraco.itertools ; extra == 'test'
+Requires-Dist: jaraco.functools ; extra == 'test'
+Requires-Dist: more-itertools ; extra == 'test'
+Requires-Dist: big-O ; extra == 'test'
+Requires-Dist: pytest-ignore-flaky ; extra == 'test'
+Requires-Dist: jaraco.test ; extra == 'test'
+Requires-Dist: importlib-resources ; (python_version < "3.9") and extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/zipp.svg
+   :target: https://pypi.org/project/zipp
+
+.. image:: https://img.shields.io/pypi/pyversions/zipp.svg
+
+.. image:: https://github.com/jaraco/zipp/actions/workflows/main.yml/badge.svg
+   :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22tests%22
+   :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
+
+.. .. image:: https://readthedocs.org/projects/PROJECT_RTD/badge/?version=latest
+..    :target: https://PROJECT_RTD.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+   :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/zipp
+   :target: https://tidelift.com/subscription/pkg/pypi-zipp?utm_source=pypi-zipp&utm_medium=readme
+
+
+A pathlib-compatible Zipfile object wrapper. Official backport of the standard library
+`Path object `_.
+
+
+Compatibility
+=============
+
+New features are introduced in this third-party library and later merged
+into CPython. The following table indicates which versions of this library
+were contributed to different versions in the standard library:
+
+.. list-table::
+   :header-rows: 1
+
+   * - zipp
+     - stdlib
+   * - 3.18
+     - 3.13
+   * - 3.16
+     - 3.12
+   * - 3.5
+     - 3.11
+   * - 3.2
+     - 3.10
+   * - 3.3 ??
+     - 3.9
+   * - 1.0
+     - 3.8
+
+
+Usage
+=====
+
+Use ``zipp.Path`` in place of ``zipfile.Path`` on any Python.
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/setuptools/_vendor/zipp-3.19.2.dist-info/RECORD b/setuptools/_vendor/zipp-3.19.2.dist-info/RECORD
new file mode 100644
index 0000000000..77c02835d8
--- /dev/null
+++ b/setuptools/_vendor/zipp-3.19.2.dist-info/RECORD
@@ -0,0 +1,15 @@
+zipp-3.19.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+zipp-3.19.2.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+zipp-3.19.2.dist-info/METADATA,sha256=UIrk_kMIHGSwsKKChYizqMw0MMZpPRZ2ZiVpQAsN_bE,3575
+zipp-3.19.2.dist-info/RECORD,,
+zipp-3.19.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+zipp-3.19.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+zipp-3.19.2.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5
+zipp/__init__.py,sha256=QuI1g00G4fRAcGt-HqbV0oWIkmSgedCGGYsHHYzNa8A,13412
+zipp/__pycache__/__init__.cpython-312.pyc,,
+zipp/__pycache__/glob.cpython-312.pyc,,
+zipp/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+zipp/compat/__pycache__/__init__.cpython-312.pyc,,
+zipp/compat/__pycache__/py310.cpython-312.pyc,,
+zipp/compat/py310.py,sha256=eZpkW0zRtunkhEh8jjX3gCGe22emoKCBJw72Zt4RkhA,219
+zipp/glob.py,sha256=etWpnfEoRyfUvrUsi6sTiGmErvPwe6HzY6pT8jg_lUI,3082
diff --git a/setuptools/_vendor/zipp-3.19.2.dist-info/REQUESTED b/setuptools/_vendor/zipp-3.19.2.dist-info/REQUESTED
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/zipp-3.19.2.dist-info/WHEEL b/setuptools/_vendor/zipp-3.19.2.dist-info/WHEEL
new file mode 100644
index 0000000000..bab98d6758
--- /dev/null
+++ b/setuptools/_vendor/zipp-3.19.2.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/setuptools/_vendor/zipp-3.7.0.dist-info/top_level.txt b/setuptools/_vendor/zipp-3.19.2.dist-info/top_level.txt
similarity index 100%
rename from setuptools/_vendor/zipp-3.7.0.dist-info/top_level.txt
rename to setuptools/_vendor/zipp-3.19.2.dist-info/top_level.txt
diff --git a/setuptools/_vendor/zipp-3.7.0.dist-info/METADATA b/setuptools/_vendor/zipp-3.7.0.dist-info/METADATA
deleted file mode 100644
index b1308b5f6e..0000000000
--- a/setuptools/_vendor/zipp-3.7.0.dist-info/METADATA
+++ /dev/null
@@ -1,58 +0,0 @@
-Metadata-Version: 2.1
-Name: zipp
-Version: 3.7.0
-Summary: Backport of pathlib-compatible object wrapper for zip files
-Home-page: https://github.com/jaraco/zipp
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
-License: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.7
-License-File: LICENSE
-Provides-Extra: docs
-Requires-Dist: sphinx ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=8.2) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest (>=6) ; extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
-Requires-Dist: pytest-flake8 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler (>=1.0.1) ; extra == 'testing'
-Requires-Dist: jaraco.itertools ; extra == 'testing'
-Requires-Dist: func-timeout ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/zipp.svg
-   :target: `PyPI link`_
-
-.. image:: https://img.shields.io/pypi/pyversions/zipp.svg
-   :target: `PyPI link`_
-
-.. _PyPI link: https://pypi.org/project/zipp
-
-.. image:: https://github.com/jaraco/zipp/workflows/tests/badge.svg
-   :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
-
-.. .. image:: https://readthedocs.org/projects/skeleton/badge/?version=latest
-..    :target: https://skeleton.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2021-informational
-   :target: https://blog.jaraco.com/skeleton
-
-
-A pathlib-compatible Zipfile object wrapper. Official backport of the standard library
-`Path object `_.
-
-
diff --git a/setuptools/_vendor/zipp-3.7.0.dist-info/RECORD b/setuptools/_vendor/zipp-3.7.0.dist-info/RECORD
deleted file mode 100644
index adc797bc2e..0000000000
--- a/setuptools/_vendor/zipp-3.7.0.dist-info/RECORD
+++ /dev/null
@@ -1,9 +0,0 @@
-__pycache__/zipp.cpython-312.pyc,,
-zipp-3.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-zipp-3.7.0.dist-info/LICENSE,sha256=2z8CRrH5J48VhFuZ_sR4uLUG63ZIeZNyL4xuJUKF-vg,1050
-zipp-3.7.0.dist-info/METADATA,sha256=ZLzgaXTyZX_MxTU0lcGfhdPY4CjFrT_3vyQ2Fo49pl8,2261
-zipp-3.7.0.dist-info/RECORD,,
-zipp-3.7.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-zipp-3.7.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
-zipp-3.7.0.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5
-zipp.py,sha256=ajztOH-9I7KA_4wqDYygtHa6xUBVZgFpmZ8FE74HHHI,8425
diff --git a/setuptools/_vendor/zipp-3.7.0.dist-info/WHEEL b/setuptools/_vendor/zipp-3.7.0.dist-info/WHEEL
deleted file mode 100644
index becc9a66ea..0000000000
--- a/setuptools/_vendor/zipp-3.7.0.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.37.1)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/setuptools/_vendor/zipp.py b/setuptools/_vendor/zipp/__init__.py
similarity index 52%
rename from setuptools/_vendor/zipp.py
rename to setuptools/_vendor/zipp/__init__.py
index 26b723c1fd..d65297b835 100644
--- a/setuptools/_vendor/zipp.py
+++ b/setuptools/_vendor/zipp/__init__.py
@@ -3,13 +3,13 @@
 import zipfile
 import itertools
 import contextlib
-import sys
 import pathlib
+import re
+import stat
+import sys
 
-if sys.version_info < (3, 7):
-    from collections import OrderedDict
-else:
-    OrderedDict = dict
+from .compat.py310 import text_encoding
+from .glob import Translator
 
 
 __all__ = ['Path']
@@ -56,7 +56,7 @@ def _ancestry(path):
         path, tail = posixpath.split(path)
 
 
-_dedupe = OrderedDict.fromkeys
+_dedupe = dict.fromkeys
 """Deduplicate an iterable in original order"""
 
 
@@ -68,10 +68,95 @@ def _difference(minuend, subtrahend):
     return itertools.filterfalse(set(subtrahend).__contains__, minuend)
 
 
-class CompleteDirs(zipfile.ZipFile):
+class InitializedState:
+    """
+    Mix-in to save the initialization state for pickling.
+    """
+
+    def __init__(self, *args, **kwargs):
+        self.__args = args
+        self.__kwargs = kwargs
+        super().__init__(*args, **kwargs)
+
+    def __getstate__(self):
+        return self.__args, self.__kwargs
+
+    def __setstate__(self, state):
+        args, kwargs = state
+        super().__init__(*args, **kwargs)
+
+
+class SanitizedNames:
+    """
+    ZipFile mix-in to ensure names are sanitized.
+    """
+
+    def namelist(self):
+        return list(map(self._sanitize, super().namelist()))
+
+    @staticmethod
+    def _sanitize(name):
+        r"""
+        Ensure a relative path with posix separators and no dot names.
+
+        Modeled after
+        https://github.com/python/cpython/blob/bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c/Lib/zipfile/__init__.py#L1799-L1813
+        but provides consistent cross-platform behavior.
+
+        >>> san = SanitizedNames._sanitize
+        >>> san('/foo/bar')
+        'foo/bar'
+        >>> san('//foo.txt')
+        'foo.txt'
+        >>> san('foo/.././bar.txt')
+        'foo/bar.txt'
+        >>> san('foo../.bar.txt')
+        'foo../.bar.txt'
+        >>> san('\\foo\\bar.txt')
+        'foo/bar.txt'
+        >>> san('D:\\foo.txt')
+        'D/foo.txt'
+        >>> san('\\\\server\\share\\file.txt')
+        'server/share/file.txt'
+        >>> san('\\\\?\\GLOBALROOT\\Volume3')
+        '?/GLOBALROOT/Volume3'
+        >>> san('\\\\.\\PhysicalDrive1\\root')
+        'PhysicalDrive1/root'
+
+        Retain any trailing slash.
+        >>> san('abc/')
+        'abc/'
+
+        Raises a ValueError if the result is empty.
+        >>> san('../..')
+        Traceback (most recent call last):
+        ...
+        ValueError: Empty filename
+        """
+
+        def allowed(part):
+            return part and part not in {'..', '.'}
+
+        # Remove the drive letter.
+        # Don't use ntpath.splitdrive, because that also strips UNC paths
+        bare = re.sub('^([A-Z]):', r'\1', name, flags=re.IGNORECASE)
+        clean = bare.replace('\\', '/')
+        parts = clean.split('/')
+        joined = '/'.join(filter(allowed, parts))
+        if not joined:
+            raise ValueError("Empty filename")
+        return joined + '/' * name.endswith('/')
+
+
+class CompleteDirs(InitializedState, SanitizedNames, zipfile.ZipFile):
     """
     A ZipFile subclass that ensures that implied directories
     are always included in the namelist.
+
+    >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt']))
+    ['foo/', 'foo/bar/']
+    >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt', 'foo/bar/']))
+    ['foo/']
     """
 
     @staticmethod
@@ -81,7 +166,7 @@ def _implied_dirs(names):
         return _dedupe(_difference(as_dirs, names))
 
     def namelist(self):
-        names = super(CompleteDirs, self).namelist()
+        names = super().namelist()
         return names + list(self._implied_dirs(names))
 
     def _name_set(self):
@@ -97,6 +182,17 @@ def resolve_dir(self, name):
         dir_match = name not in names and dirname in names
         return dirname if dir_match else name
 
+    def getinfo(self, name):
+        """
+        Supplement getinfo for implied dirs.
+        """
+        try:
+            return super().getinfo(name)
+        except KeyError:
+            if not name.endswith('/') or name not in self._name_set():
+                raise
+            return zipfile.ZipInfo(filename=name)
+
     @classmethod
     def make(cls, source):
         """
@@ -107,7 +203,7 @@ def make(cls, source):
             return source
 
         if not isinstance(source, zipfile.ZipFile):
-            return cls(_pathlib_compat(source))
+            return cls(source)
 
         # Only allow for FastLookup when supplied zipfile is read-only
         if 'r' not in source.mode:
@@ -116,6 +212,16 @@ def make(cls, source):
         source.__class__ = cls
         return source
 
+    @classmethod
+    def inject(cls, zf: zipfile.ZipFile) -> zipfile.ZipFile:
+        """
+        Given a writable zip file zf, inject directory entries for
+        any directories implied by the presence of children.
+        """
+        for name in cls._implied_dirs(zf.namelist()):
+            zf.writestr(name, b"")
+        return zf
+
 
 class FastLookup(CompleteDirs):
     """
@@ -126,30 +232,29 @@ class FastLookup(CompleteDirs):
     def namelist(self):
         with contextlib.suppress(AttributeError):
             return self.__names
-        self.__names = super(FastLookup, self).namelist()
+        self.__names = super().namelist()
         return self.__names
 
     def _name_set(self):
         with contextlib.suppress(AttributeError):
             return self.__lookup
-        self.__lookup = super(FastLookup, self)._name_set()
+        self.__lookup = super()._name_set()
         return self.__lookup
 
 
-def _pathlib_compat(path):
-    """
-    For path-like objects, convert to a filename for compatibility
-    on Python 3.6.1 and earlier.
-    """
-    try:
-        return path.__fspath__()
-    except AttributeError:
-        return str(path)
+def _extract_text_encoding(encoding=None, *args, **kwargs):
+    # compute stack level so that the caller of the caller sees any warning.
+    is_pypy = sys.implementation.name == 'pypy'
+    stack_level = 3 + is_pypy
+    return text_encoding(encoding, stack_level), args, kwargs
 
 
 class Path:
     """
-    A pathlib-compatible interface for zip files.
+    A :class:`importlib.resources.abc.Traversable` interface for zip files.
+
+    Implements many of the features users enjoy from
+    :class:`pathlib.Path`.
 
     Consider a zip file with this structure::
 
@@ -169,13 +274,13 @@ class Path:
 
     Path accepts the zipfile object itself or a filename
 
-    >>> root = Path(zf)
+    >>> path = Path(zf)
 
     From there, several path operations are available.
 
     Directory iteration (including the zip file itself):
 
-    >>> a, b = root.iterdir()
+    >>> a, b = path.iterdir()
     >>> a
     Path('mem/abcde.zip', 'a.txt')
     >>> b
@@ -196,7 +301,7 @@ class Path:
 
     Read text:
 
-    >>> c.read_text()
+    >>> c.read_text(encoding='utf-8')
     'content of c'
 
     existence:
@@ -213,16 +318,38 @@ class Path:
     'mem/abcde.zip/b/c.txt'
 
     At the root, ``name``, ``filename``, and ``parent``
-    resolve to the zipfile. Note these attributes are not
-    valid and will raise a ``ValueError`` if the zipfile
-    has no filename.
+    resolve to the zipfile.
 
-    >>> root.name
+    >>> str(path)
+    'mem/abcde.zip/'
+    >>> path.name
     'abcde.zip'
-    >>> str(root.filename).replace(os.sep, posixpath.sep)
-    'mem/abcde.zip'
-    >>> str(root.parent)
+    >>> path.filename == pathlib.Path('mem/abcde.zip')
+    True
+    >>> str(path.parent)
     'mem'
+
+    If the zipfile has no filename, such attributes are not
+    valid and accessing them will raise an Exception.
+
+    >>> zf.filename = None
+    >>> path.name
+    Traceback (most recent call last):
+    ...
+    TypeError: ...
+
+    >>> path.filename
+    Traceback (most recent call last):
+    ...
+    TypeError: ...
+
+    >>> path.parent
+    Traceback (most recent call last):
+    ...
+    TypeError: ...
+
+    # workaround python/cpython#106763
+    >>> pass
     """
 
     __repr = "{self.__class__.__name__}({self.root.filename!r}, {self.at!r})"
@@ -240,6 +367,18 @@ def __init__(self, root, at=""):
         self.root = FastLookup.make(root)
         self.at = at
 
+    def __eq__(self, other):
+        """
+        >>> Path(zipfile.ZipFile(io.BytesIO(), 'w')) == 'foo'
+        False
+        """
+        if self.__class__ is not other.__class__:
+            return NotImplemented
+        return (self.root, self.at) == (other.root, other.at)
+
+    def __hash__(self):
+        return hash((self.root, self.at))
+
     def open(self, mode='r', *args, pwd=None, **kwargs):
         """
         Open this entry as text or binary following the semantics
@@ -256,30 +395,36 @@ def open(self, mode='r', *args, pwd=None, **kwargs):
             if args or kwargs:
                 raise ValueError("encoding args invalid for binary operation")
             return stream
-        return io.TextIOWrapper(stream, *args, **kwargs)
+        # Text mode:
+        encoding, args, kwargs = _extract_text_encoding(*args, **kwargs)
+        return io.TextIOWrapper(stream, encoding, *args, **kwargs)
+
+    def _base(self):
+        return pathlib.PurePosixPath(self.at or self.root.filename)
 
     @property
     def name(self):
-        return pathlib.Path(self.at).name or self.filename.name
+        return self._base().name
 
     @property
     def suffix(self):
-        return pathlib.Path(self.at).suffix or self.filename.suffix
+        return self._base().suffix
 
     @property
     def suffixes(self):
-        return pathlib.Path(self.at).suffixes or self.filename.suffixes
+        return self._base().suffixes
 
     @property
     def stem(self):
-        return pathlib.Path(self.at).stem or self.filename.stem
+        return self._base().stem
 
     @property
     def filename(self):
         return pathlib.Path(self.root.filename).joinpath(self.at)
 
     def read_text(self, *args, **kwargs):
-        with self.open('r', *args, **kwargs) as strm:
+        encoding, args, kwargs = _extract_text_encoding(*args, **kwargs)
+        with self.open('r', encoding, *args, **kwargs) as strm:
             return strm.read()
 
     def read_bytes(self):
@@ -307,6 +452,33 @@ def iterdir(self):
         subs = map(self._next, self.root.namelist())
         return filter(self._is_child, subs)
 
+    def match(self, path_pattern):
+        return pathlib.PurePosixPath(self.at).match(path_pattern)
+
+    def is_symlink(self):
+        """
+        Return whether this path is a symlink.
+        """
+        info = self.root.getinfo(self.at)
+        mode = info.external_attr >> 16
+        return stat.S_ISLNK(mode)
+
+    def glob(self, pattern):
+        if not pattern:
+            raise ValueError(f"Unacceptable pattern: {pattern!r}")
+
+        prefix = re.escape(self.at)
+        tr = Translator(seps='/')
+        matches = re.compile(prefix + tr.translate(pattern)).fullmatch
+        names = (data.filename for data in self.root.filelist)
+        return map(self._next, filter(matches, names))
+
+    def rglob(self, pattern):
+        return self.glob(f'**/{pattern}')
+
+    def relative_to(self, other, *extra):
+        return posixpath.relpath(str(self), str(other.joinpath(*extra)))
+
     def __str__(self):
         return posixpath.join(self.root.filename, self.at)
 
@@ -314,7 +486,7 @@ def __repr__(self):
         return self.__repr.format(self=self)
 
     def joinpath(self, *other):
-        next = posixpath.join(self.at, *map(_pathlib_compat, other))
+        next = posixpath.join(self.at, *other)
         return self._next(self.root.resolve_dir(next))
 
     __truediv__ = joinpath
diff --git a/setuptools/_vendor/zipp/compat/__init__.py b/setuptools/_vendor/zipp/compat/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/zipp/compat/py310.py b/setuptools/_vendor/zipp/compat/py310.py
new file mode 100644
index 0000000000..d5ca53e037
--- /dev/null
+++ b/setuptools/_vendor/zipp/compat/py310.py
@@ -0,0 +1,11 @@
+import sys
+import io
+
+
+def _text_encoding(encoding, stacklevel=2, /):  # pragma: no cover
+    return encoding
+
+
+text_encoding = (
+    io.text_encoding if sys.version_info > (3, 10) else _text_encoding  # type: ignore
+)
diff --git a/setuptools/_vendor/zipp/glob.py b/setuptools/_vendor/zipp/glob.py
new file mode 100644
index 0000000000..69c41d77c3
--- /dev/null
+++ b/setuptools/_vendor/zipp/glob.py
@@ -0,0 +1,106 @@
+import os
+import re
+
+
+_default_seps = os.sep + str(os.altsep) * bool(os.altsep)
+
+
+class Translator:
+    """
+    >>> Translator('xyz')
+    Traceback (most recent call last):
+    ...
+    AssertionError: Invalid separators
+
+    >>> Translator('')
+    Traceback (most recent call last):
+    ...
+    AssertionError: Invalid separators
+    """
+
+    seps: str
+
+    def __init__(self, seps: str = _default_seps):
+        assert seps and set(seps) <= set(_default_seps), "Invalid separators"
+        self.seps = seps
+
+    def translate(self, pattern):
+        """
+        Given a glob pattern, produce a regex that matches it.
+        """
+        return self.extend(self.translate_core(pattern))
+
+    def extend(self, pattern):
+        r"""
+        Extend regex for pattern-wide concerns.
+
+        Apply '(?s:)' to create a non-matching group that
+        matches newlines (valid on Unix).
+
+        Append '\Z' to imply fullmatch even when match is used.
+        """
+        return rf'(?s:{pattern})\Z'
+
+    def translate_core(self, pattern):
+        r"""
+        Given a glob pattern, produce a regex that matches it.
+
+        >>> t = Translator()
+        >>> t.translate_core('*.txt').replace('\\\\', '')
+        '[^/]*\\.txt'
+        >>> t.translate_core('a?txt')
+        'a[^/]txt'
+        >>> t.translate_core('**/*').replace('\\\\', '')
+        '.*/[^/][^/]*'
+        """
+        self.restrict_rglob(pattern)
+        return ''.join(map(self.replace, separate(self.star_not_empty(pattern))))
+
+    def replace(self, match):
+        """
+        Perform the replacements for a match from :func:`separate`.
+        """
+        return match.group('set') or (
+            re.escape(match.group(0))
+            .replace('\\*\\*', r'.*')
+            .replace('\\*', rf'[^{re.escape(self.seps)}]*')
+            .replace('\\?', r'[^/]')
+        )
+
+    def restrict_rglob(self, pattern):
+        """
+        Raise ValueError if ** appears in anything but a full path segment.
+
+        >>> Translator().translate('**foo')
+        Traceback (most recent call last):
+        ...
+        ValueError: ** must appear alone in a path segment
+        """
+        seps_pattern = rf'[{re.escape(self.seps)}]+'
+        segments = re.split(seps_pattern, pattern)
+        if any('**' in segment and segment != '**' for segment in segments):
+            raise ValueError("** must appear alone in a path segment")
+
+    def star_not_empty(self, pattern):
+        """
+        Ensure that * will not match an empty segment.
+        """
+
+        def handle_segment(match):
+            segment = match.group(0)
+            return '?*' if segment == '*' else segment
+
+        not_seps_pattern = rf'[^{re.escape(self.seps)}]+'
+        return re.sub(not_seps_pattern, handle_segment, pattern)
+
+
+def separate(pattern):
+    """
+    Separate out character sets to avoid translating their contents.
+
+    >>> [m.group(0) for m in separate('*.txt')]
+    ['*.txt']
+    >>> [m.group(0) for m in separate('a[?]txt')]
+    ['a', '[?]', 'txt']
+    """
+    return re.finditer(r'([^\[]+)|(?P[\[].*?[\]])|([\[][^\]]*$)', pattern)
diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py
index 18ca1e2428..cf73039f6d 100644
--- a/setuptools/extern/__init__.py
+++ b/setuptools/extern/__init__.py
@@ -78,6 +78,7 @@ def install(self):
 # ]]]
 names = (
     'autocommand',
+    'backports',
     'importlib_metadata',
     'importlib_resources',
     'inflect',

From 3ed7e2708c957ba9e513ad202d3044d8f5d45632 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 20:02:44 -0400
Subject: [PATCH 115/151] Remove importlib_metadata workaround.

---
 setuptools/_importlib.py | 40 +---------------------------------------
 1 file changed, 1 insertion(+), 39 deletions(-)

diff --git a/setuptools/_importlib.py b/setuptools/_importlib.py
index ff3288102a..14384bef5d 100644
--- a/setuptools/_importlib.py
+++ b/setuptools/_importlib.py
@@ -1,48 +1,10 @@
 import sys
 
 
-def disable_importlib_metadata_finder(metadata):
-    """
-    Ensure importlib_metadata doesn't provide older, incompatible
-    Distributions.
-
-    Workaround for #3102.
-    """
-    try:
-        import importlib_metadata
-    except ImportError:
-        return
-    except AttributeError:
-        from .warnings import SetuptoolsWarning
-
-        SetuptoolsWarning.emit(
-            "Incompatibility problem.",
-            """
-            `importlib-metadata` version is incompatible with `setuptools`.
-            This problem is likely to be solved by installing an updated version of
-            `importlib-metadata`.
-            """,
-            see_url="https://github.com/python/importlib_metadata/issues/396",
-        )  # Ensure a descriptive message is shown.
-        raise  # This exception can be suppressed by _distutils_hack
-
-    if importlib_metadata is metadata:
-        return
-    to_remove = [
-        ob
-        for ob in sys.meta_path
-        if isinstance(ob, importlib_metadata.MetadataPathFinder)
-    ]
-    for item in to_remove:
-        sys.meta_path.remove(item)
-
-
 if sys.version_info < (3, 10):
     import importlib_metadata as metadata
-
-    disable_importlib_metadata_finder(metadata)
 else:
-    import importlib.metadata as metadata
+    import importlib.metadata as metadata  # noqa: F401
 
 
 if sys.version_info < (3, 9):

From f21bcab30b04843f362dfc450609f3df05be703f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 20:34:21 -0400
Subject: [PATCH 116/151] Remove setuptools.extern

---
 setuptools/extern/__init__.py | 96 -----------------------------------
 1 file changed, 96 deletions(-)
 delete mode 100644 setuptools/extern/__init__.py

diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py
deleted file mode 100644
index cf73039f6d..0000000000
--- a/setuptools/extern/__init__.py
+++ /dev/null
@@ -1,96 +0,0 @@
-import importlib.util
-import sys
-
-
-class VendorImporter:
-    """
-    A PEP 302 meta path importer for finding optionally-vendored
-    or otherwise naturally-installed packages from root_name.
-    """
-
-    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
-        self.root_name = root_name
-        self.vendored_names = set(vendored_names)
-        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')
-
-    @property
-    def search_path(self):
-        """
-        Search first the vendor package then as a natural package.
-        """
-        yield self.vendor_pkg + '.'
-        yield ''
-
-    def _module_matches_namespace(self, fullname):
-        """Figure out if the target module is vendored."""
-        root, base, target = fullname.partition(self.root_name + '.')
-        return not root and any(map(target.startswith, self.vendored_names))
-
-    def load_module(self, fullname):
-        """
-        Iterate over the search path to locate and load fullname.
-        """
-        root, base, target = fullname.partition(self.root_name + '.')
-        for prefix in self.search_path:
-            extant = prefix + target
-            try:
-                __import__(extant)
-            except ImportError:
-                continue
-            mod = sys.modules[extant]
-            sys.modules[fullname] = mod
-            return mod
-        else:
-            raise ImportError(
-                "The '{target}' package is required; "
-                "normally this is bundled with this package so if you get "
-                "this warning, consult the packager of your "
-                "distribution.".format(**locals())
-            )
-
-    def create_module(self, spec):
-        return self.load_module(spec.name)
-
-    def exec_module(self, module):
-        pass
-
-    def find_spec(self, fullname, path=None, target=None):
-        """Return a module spec for vendored names."""
-        return (
-            importlib.util.spec_from_loader(fullname, self)
-            if self._module_matches_namespace(fullname)
-            else None
-        )
-
-    def install(self):
-        """
-        Install this importer into sys.meta_path if not already present.
-        """
-        if self not in sys.meta_path:
-            sys.meta_path.append(self)
-
-
-# [[[cog
-# import cog
-# from tools.vendored import yield_top_level
-# names = "\n".join(f"    {x!r}," for x in yield_top_level('setuptools'))
-# cog.outl(f"names = (\n{names}\n)")
-# ]]]
-names = (
-    'autocommand',
-    'backports',
-    'importlib_metadata',
-    'importlib_resources',
-    'inflect',
-    'jaraco',
-    'more_itertools',
-    'ordered_set',
-    'packaging',
-    'tomli',
-    'typeguard',
-    'typing_extensions',
-    'wheel',
-    'zipp',
-)
-# [[[end]]]
-VendorImporter(__name__, names, 'setuptools._vendor').install()

From bd5cf0003173c74f44fd53a3cca3ab07af3be8f4 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 20:34:51 -0400
Subject: [PATCH 117/151] Remove check-extern env in tox.

---
 .github/workflows/main.yml |  1 -
 tools/vendored.py          | 21 ---------------------
 tox.ini                    |  6 +-----
 3 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b8bbc750cc..b9ecc51412 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -129,7 +129,6 @@ jobs:
         job:
         - diffcov
         - docs
-        - check-extern
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v4
diff --git a/tools/vendored.py b/tools/vendored.py
index 63d8c577cf..36180a9c5e 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -246,25 +246,4 @@ def update_setuptools():
     install_deps(deps, vendor)
 
 
-def yield_top_level(name):
-    """Iterate over all modules and (top level) packages vendored
-    >>> roots = set(yield_top_level("setuptools"))
-    >>> examples = roots & {"jaraco", "backports", "zipp"}
-    >>> list(sorted(examples))
-    ['backports', 'jaraco', 'zipp']
-    >>> 'bin' in examples
-    False
-    """
-    vendor = Path(f"{name}/_vendor")
-    ignore = {"__pycache__", "__init__.py", ".ruff_cache", "bin"}
-
-    for item in sorted(vendor.iterdir()):
-        if item.name in ignore:
-            continue
-        if item.is_dir() and item.suffix != ".dist-info":
-            yield str(item.name)
-        if item.is_file() and item.suffix == ".py":
-            yield str(item.stem)
-
-
 __name__ == '__main__' and update_vendored()
diff --git a/tox.ini b/tox.ini
index 9ff4488cd3..8a3f6260b7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -69,19 +69,15 @@ pass_env = *
 commands =
 	python tools/finalize.py
 
-[testenv:{vendor,check-extern}]
+[testenv:vendor]
 skip_install = True
-allowlist_externals = git, sh
 deps =
 	path
-	cogapp
 	jaraco.packaging
 	# workaround for pypa/pyproject-hooks#192
 	pyproject-hooks<1.1
 commands =
 	vendor: python -m tools.vendored
-	sh -c "git grep -l -F '\[\[\[cog' | xargs -t cog -I {toxinidir} -r"  # update `*.extern`
-	check-extern: git diff --exit-code
 
 [testenv:generate-validation-code]
 skip_install = True

From 9234fc35f37bd74a32501f22c698f6a8af26ffed Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 20:46:18 -0400
Subject: [PATCH 118/151] Update vendoring routine for pkg_resources to simply
 install the dependencies to the _vendor folder.

---
 pkg_resources/_vendor/vendored.txt | 13 -------------
 pyproject.toml                     |  3 +++
 tools/vendored.py                  | 25 ++++++++++++++-----------
 3 files changed, 17 insertions(+), 24 deletions(-)
 delete mode 100644 pkg_resources/_vendor/vendored.txt

diff --git a/pkg_resources/_vendor/vendored.txt b/pkg_resources/_vendor/vendored.txt
deleted file mode 100644
index 0c8fdc3823..0000000000
--- a/pkg_resources/_vendor/vendored.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-packaging==24
-
-platformdirs==2.6.2
-
-jaraco.text==3.7.0
-# required for jaraco.text on older Pythons
-importlib_resources==5.10.2
-# required for importlib_resources on older Pythons
-zipp==3.7.0
-# required for jaraco.functools
-more_itertools==10.2.0
-# required for jaraco.context on older Pythons
-backports.tarfile
diff --git a/pyproject.toml b/pyproject.toml
index 0709c0b143..7c517943a4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -33,6 +33,9 @@ dependencies = [
 	"importlib_metadata>=6",
 	"tomli>=2.0.1",
 	"wheel>=0.43.0",
+
+	# pkg_resources
+	"platformdirs >= 2.6.2",
 ]
 
 [project.urls]
diff --git a/tools/vendored.py b/tools/vendored.py
index 36180a9c5e..208aab8eb1 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -14,7 +14,7 @@ def remove_all(paths):
 
 
 def update_vendored():
-    # update_pkg_resources()
+    update_pkg_resources()
     update_setuptools()
 
 
@@ -195,17 +195,20 @@ def install(vendor):
 
 
 def update_pkg_resources():
+    deps = [
+        'packaging >= 24',
+        'platformdirs >= 2.6.2',
+        'jaraco.text >= 3.7',
+    ]
+    # workaround for https://github.com/pypa/pip/issues/12770
+    deps += [
+        'importlib_resources >= 5.10.2',
+        'zipp >= 3.7',
+        'backports.tarfile',
+    ]
     vendor = Path('pkg_resources/_vendor')
-    install(vendor)
-    rewrite_packaging(vendor / 'packaging', 'pkg_resources.extern')
-    repair_namespace(vendor / 'jaraco')
-    repair_namespace(vendor / 'backports')
-    rewrite_jaraco_text(vendor / 'jaraco/text', 'pkg_resources.extern')
-    rewrite_jaraco_functools(vendor / 'jaraco/functools', 'pkg_resources.extern')
-    rewrite_jaraco_context(vendor / 'jaraco', 'pkg_resources.extern')
-    rewrite_importlib_resources(vendor / 'importlib_resources', 'pkg_resources.extern')
-    rewrite_more_itertools(vendor / "more_itertools")
-    rewrite_platformdirs(vendor / "platformdirs")
+    clean(vendor)
+    install_deps(deps, vendor)
 
 
 def load_deps():

From d03cd0e6e21067e2802d811d5a4535f69da80788 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 20:51:30 -0400
Subject: [PATCH 119/151] Import dependencies naturally and ensure they're
 available by appending the vendor dir to sys.path.

---
 pkg_resources/__init__.py             | 14 ++++++++------
 pkg_resources/tests/test_resources.py |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index d47df3f3c5..4b7887e9f4 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -74,6 +74,8 @@
 
 import _imp
 
+sys.path.append(os.path.dirname(__file__) + '/_vendor')
+
 # capture these to bypass sandboxing
 from os import utime
 from os import open as os_open
@@ -87,16 +89,16 @@
     # no write support, probably under GAE
     WRITE_SUPPORT = False
 
-from pkg_resources.extern.jaraco.text import (
+from jaraco.text import (
     yield_lines,
     drop_comment,
     join_continuation,
 )
-from pkg_resources.extern.packaging import markers as _packaging_markers
-from pkg_resources.extern.packaging import requirements as _packaging_requirements
-from pkg_resources.extern.packaging import utils as _packaging_utils
-from pkg_resources.extern.packaging import version as _packaging_version
-from pkg_resources.extern.platformdirs import user_cache_dir as _user_cache_dir
+from packaging import markers as _packaging_markers
+from packaging import requirements as _packaging_requirements
+from packaging import utils as _packaging_utils
+from packaging import version as _packaging_version
+from platformdirs import user_cache_dir as _user_cache_dir
 
 if TYPE_CHECKING:
     from _typeshed import BytesPath, StrPath, StrOrBytesPath
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 826d691b83..9837c2719d 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -5,7 +5,7 @@
 import itertools
 
 import pytest
-from pkg_resources.extern.packaging.specifiers import SpecifierSet
+from packaging.specifiers import SpecifierSet
 
 import pkg_resources
 from pkg_resources import (

From c6913bf59da16669de5097825ec0a02903ea1926 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 21:00:39 -0400
Subject: [PATCH 120/151] Re-vendor pkg_resources packages.

---
 .../INSTALLER                                 |    0
 .../autocommand-2.2.2.dist-info/LICENSE       |  166 +
 .../autocommand-2.2.2.dist-info/METADATA      |  420 ++
 .../autocommand-2.2.2.dist-info/RECORD        |   18 +
 .../WHEEL                                     |    0
 .../autocommand-2.2.2.dist-info/top_level.txt |    1 +
 pkg_resources/_vendor/autocommand/__init__.py |   27 +
 .../_vendor/autocommand/autoasync.py          |  142 +
 .../_vendor/autocommand/autocommand.py        |   70 +
 pkg_resources/_vendor/autocommand/automain.py |   59 +
 .../_vendor/autocommand/autoparse.py          |  333 ++
 pkg_resources/_vendor/autocommand/errors.py   |   23 +
 .../backports.tarfile-1.0.0.dist-info/RECORD  |    9 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../METADATA                                  |   12 +-
 .../backports.tarfile-1.2.0.dist-info/RECORD  |   17 +
 .../REQUESTED                                 |    0
 .../WHEEL                                     |    0
 .../top_level.txt                             |    0
 pkg_resources/_vendor/backports/__init__.py   |    1 +
 .../{tarfile.py => tarfile/__init__.py}       |  129 +-
 .../_vendor/backports/tarfile/__main__.py     |    5 +
 .../tarfile/compat}/__init__.py               |    0
 .../_vendor/backports/tarfile/compat/py38.py  |   24 +
 .../RECORD                                    |   77 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../METADATA                                  |   52 +-
 .../RECORD                                    |   89 +
 .../REQUESTED                                 |    0
 .../WHEEL                                     |    2 +-
 .../top_level.txt                             |    0
 .../_vendor/importlib_resources/__init__.py   |   14 +-
 .../_vendor/importlib_resources/_adapters.py  |    4 +-
 .../_vendor/importlib_resources/_common.py    |    7 +-
 .../_vendor/importlib_resources/_compat.py    |  108 -
 .../_vendor/importlib_resources/_itertools.py |   69 +-
 .../_vendor/importlib_resources/_legacy.py    |  120 -
 .../_vendor/importlib_resources/abc.py        |    3 +-
 .../{tests/zipdata01 => compat}/__init__.py   |    0
 .../importlib_resources/compat/py38.py        |   11 +
 .../importlib_resources/compat/py39.py        |   10 +
 .../_vendor/importlib_resources/functional.py |   81 +
 .../{tests/zipdata02 => future}/__init__.py   |    0
 .../importlib_resources/future/adapters.py    |   95 +
 .../_vendor/importlib_resources/readers.py    |   90 +-
 .../_vendor/importlib_resources/simple.py     |    2 +-
 .../importlib_resources/tests/_compat.py      |   32 -
 .../importlib_resources/tests/_path.py        |   18 +-
 .../tests/compat}/__init__.py                 |    0
 .../importlib_resources/tests/compat/py312.py |   18 +
 .../importlib_resources/tests/compat/py39.py  |   10 +
 .../tests/data01/subdirectory/binary.file     |  Bin 4 -> 4 bytes
 .../subdirectory/subsubdir/resource.txt       |    1 +
 .../namespacedata01/subdirectory/binary.file  |    1 +
 .../tests/test_compatibilty_files.py          |    6 +-
 .../tests/test_contents.py                    |    2 +-
 .../importlib_resources/tests/test_custom.py  |   47 +
 .../importlib_resources/tests/test_files.py   |   23 +-
 .../tests/test_functional.py                  |  242 +
 .../importlib_resources/tests/test_open.py    |   20 +-
 .../importlib_resources/tests/test_path.py    |   19 +-
 .../importlib_resources/tests/test_read.py    |   41 +-
 .../importlib_resources/tests/test_reader.py  |   34 +-
 .../tests/test_resource.py                    |  155 +-
 .../importlib_resources/tests/update-zips.py  |   53 -
 .../_vendor/importlib_resources/tests/util.py |   79 +-
 .../_vendor/importlib_resources/tests/zip.py  |   32 +
 .../tests/zipdata01/ziptestdata.zip           |  Bin 876 -> 0 bytes
 .../tests/zipdata02/ziptestdata.zip           |  Bin 698 -> 0 bytes
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../_vendor/inflect-7.3.1.dist-info/METADATA  |  591 +++
 .../_vendor/inflect-7.3.1.dist-info/RECORD    |   13 +
 .../WHEEL                                     |    2 +-
 .../inflect-7.3.1.dist-info/top_level.txt     |    1 +
 pkg_resources/_vendor/inflect/__init__.py     | 3986 +++++++++++++++++
 .../REQUESTED => inflect/compat/__init__.py}  |    0
 pkg_resources/_vendor/inflect/compat/py38.py  |    7 +
 .../REQUESTED => inflect/py.typed}            |    0
 .../jaraco.functools-4.0.0.dist-info/RECORD   |   10 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    2 -
 .../METADATA                                  |   21 +-
 .../jaraco.functools-4.0.1.dist-info/RECORD   |   10 +
 .../WHEEL                                     |    2 +-
 .../top_level.txt                             |    0
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    2 -
 .../jaraco.text-3.12.1.dist-info/METADATA     |   95 +
 .../jaraco.text-3.12.1.dist-info/RECORD       |   20 +
 .../REQUESTED                                 |    0
 .../jaraco.text-3.12.1.dist-info/WHEEL        |    5 +
 .../top_level.txt                             |    0
 .../jaraco.text-3.7.0.dist-info/METADATA      |   55 -
 .../jaraco.text-3.7.0.dist-info/RECORD        |   10 -
 pkg_resources/_vendor/jaraco/context.py       |    2 +-
 .../_vendor/jaraco/functools/__init__.py      |    6 +-
 .../_vendor/jaraco/functools/__init__.pyi     |    3 -
 pkg_resources/_vendor/jaraco/text/__init__.py |   61 +-
 pkg_resources/_vendor/jaraco/text/layouts.py  |   25 +
 .../_vendor/jaraco/text/show-newlines.py      |   33 +
 .../_vendor/jaraco/text/strip-prefix.py       |   21 +
 .../_vendor/jaraco/text/to-dvorak.py          |    6 +
 .../_vendor/jaraco/text/to-qwerty.py          |    6 +
 .../more_itertools-10.2.0.dist-info/RECORD    |   15 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../METADATA                                  |   29 +-
 .../more_itertools-10.3.0.dist-info/RECORD    |   15 +
 .../WHEEL                                     |    0
 .../_vendor/more_itertools/__init__.py        |    2 +-
 pkg_resources/_vendor/more_itertools/more.py  |  379 +-
 pkg_resources/_vendor/more_itertools/more.pyi |   14 +
 .../_vendor/more_itertools/recipes.py         |   76 +-
 .../_vendor/more_itertools/recipes.pyi        |   10 +-
 .../_vendor/packaging-24.0.dist-info/RECORD   |   37 -
 .../INSTALLER                                 |    0
 .../LICENSE                                   |    0
 .../LICENSE.APACHE                            |    0
 .../LICENSE.BSD                               |    0
 .../METADATA                                  |    6 +-
 .../_vendor/packaging-24.1.dist-info/RECORD   |   37 +
 .../REQUESTED                                 |    0
 .../WHEEL                                     |    0
 pkg_resources/_vendor/packaging/__init__.py   |    2 +-
 pkg_resources/_vendor/packaging/_elffile.py   |    8 +-
 pkg_resources/_vendor/packaging/_manylinux.py |   22 +-
 pkg_resources/_vendor/packaging/_musllinux.py |   10 +-
 pkg_resources/_vendor/packaging/_parser.py    |   26 +-
 pkg_resources/_vendor/packaging/_tokenizer.py |   18 +-
 pkg_resources/_vendor/packaging/markers.py    |  115 +-
 pkg_resources/_vendor/packaging/metadata.py   |  153 +-
 .../_vendor/packaging/requirements.py         |    9 +-
 pkg_resources/_vendor/packaging/specifiers.py |   56 +-
 pkg_resources/_vendor/packaging/tags.py       |   43 +-
 pkg_resources/_vendor/packaging/utils.py      |   10 +-
 pkg_resources/_vendor/packaging/version.py    |   54 +-
 .../platformdirs-2.6.2.dist-info/RECORD       |   23 -
 .../platformdirs-4.2.2.dist-info/INSTALLER    |    1 +
 .../METADATA                                  |  106 +-
 .../platformdirs-4.2.2.dist-info/RECORD       |   23 +
 .../platformdirs-4.2.2.dist-info/REQUESTED    |    0
 .../WHEEL                                     |    2 +-
 .../licenses/LICENSE                          |    0
 .../_vendor/platformdirs/__init__.py          |  437 +-
 .../_vendor/platformdirs/__main__.py          |   27 +-
 pkg_resources/_vendor/platformdirs/android.py |  181 +-
 pkg_resources/_vendor/platformdirs/api.py     |  182 +-
 pkg_resources/_vendor/platformdirs/macos.py   |   98 +-
 pkg_resources/_vendor/platformdirs/unix.py    |  212 +-
 pkg_resources/_vendor/platformdirs/version.py |   16 +-
 pkg_resources/_vendor/platformdirs/windows.py |  158 +-
 .../typeguard-4.3.0.dist-info/INSTALLER       |    1 +
 .../_vendor/typeguard-4.3.0.dist-info/LICENSE |   19 +
 .../typeguard-4.3.0.dist-info/METADATA        |   81 +
 .../_vendor/typeguard-4.3.0.dist-info/RECORD  |   34 +
 .../_vendor/typeguard-4.3.0.dist-info/WHEEL   |    5 +
 .../entry_points.txt                          |    2 +
 .../typeguard-4.3.0.dist-info/top_level.txt   |    1 +
 pkg_resources/_vendor/typeguard/__init__.py   |   48 +
 pkg_resources/_vendor/typeguard/_checkers.py  |  993 ++++
 pkg_resources/_vendor/typeguard/_config.py    |  108 +
 .../_vendor/typeguard/_decorators.py          |  235 +
 .../_vendor/typeguard/_exceptions.py          |   42 +
 pkg_resources/_vendor/typeguard/_functions.py |  308 ++
 .../_vendor/typeguard/_importhook.py          |  213 +
 pkg_resources/_vendor/typeguard/_memo.py      |   48 +
 .../_vendor/typeguard/_pytest_plugin.py       |  127 +
 .../_vendor/typeguard/_suppression.py         |   86 +
 .../_vendor/typeguard/_transformer.py         | 1229 +++++
 .../_vendor/typeguard/_union_transformer.py   |   55 +
 pkg_resources/_vendor/typeguard/_utils.py     |  173 +
 pkg_resources/_vendor/typeguard/py.typed      |    0
 .../INSTALLER                                 |    1 +
 .../LICENSE                                   |  279 ++
 .../METADATA                                  |   67 +
 .../typing_extensions-4.12.2.dist-info/RECORD |    7 +
 .../typing_extensions-4.12.2.dist-info/WHEEL  |    4 +
 pkg_resources/_vendor/typing_extensions.py    | 3641 +++++++++++++++
 .../_vendor/zipp-3.19.2.dist-info/INSTALLER   |    1 +
 .../_vendor/zipp-3.19.2.dist-info/LICENSE     |   17 +
 .../_vendor/zipp-3.19.2.dist-info/METADATA    |  102 +
 .../_vendor/zipp-3.19.2.dist-info/RECORD      |   15 +
 .../_vendor/zipp-3.19.2.dist-info/REQUESTED   |    0
 .../_vendor/zipp-3.19.2.dist-info/WHEEL       |    5 +
 .../top_level.txt                             |    0
 .../_vendor/zipp-3.7.0.dist-info/METADATA     |   58 -
 .../_vendor/zipp-3.7.0.dist-info/RECORD       |    9 -
 .../_vendor/{zipp.py => zipp/__init__.py}     |  248 +-
 pkg_resources/_vendor/zipp/compat/__init__.py |    0
 pkg_resources/_vendor/zipp/compat/py310.py    |   11 +
 pkg_resources/_vendor/zipp/glob.py            |  106 +
 194 files changed, 17438 insertions(+), 1671 deletions(-)
 rename pkg_resources/_vendor/{backports.tarfile-1.0.0.dist-info => autocommand-2.2.2.dist-info}/INSTALLER (100%)
 create mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE
 create mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA
 create mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD
 rename pkg_resources/_vendor/{importlib_resources-5.10.2.dist-info => autocommand-2.2.2.dist-info}/WHEEL (100%)
 create mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt
 create mode 100644 pkg_resources/_vendor/autocommand/__init__.py
 create mode 100644 pkg_resources/_vendor/autocommand/autoasync.py
 create mode 100644 pkg_resources/_vendor/autocommand/autocommand.py
 create mode 100644 pkg_resources/_vendor/autocommand/automain.py
 create mode 100644 pkg_resources/_vendor/autocommand/autoparse.py
 create mode 100644 pkg_resources/_vendor/autocommand/errors.py
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/RECORD
 rename pkg_resources/_vendor/{importlib_resources-5.10.2.dist-info => backports.tarfile-1.2.0.dist-info}/INSTALLER (100%)
 rename pkg_resources/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/LICENSE (100%)
 rename pkg_resources/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/METADATA (83%)
 create mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
 rename pkg_resources/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/REQUESTED (100%)
 rename pkg_resources/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/WHEEL (100%)
 rename pkg_resources/_vendor/{backports.tarfile-1.0.0.dist-info => backports.tarfile-1.2.0.dist-info}/top_level.txt (100%)
 rename pkg_resources/_vendor/backports/{tarfile.py => tarfile/__init__.py} (96%)
 create mode 100644 pkg_resources/_vendor/backports/tarfile/__main__.py
 rename pkg_resources/_vendor/{ => backports/tarfile/compat}/__init__.py (100%)
 create mode 100644 pkg_resources/_vendor/backports/tarfile/compat/py38.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/RECORD
 rename pkg_resources/_vendor/{jaraco.functools-4.0.0.dist-info => importlib_resources-6.4.0.dist-info}/INSTALLER (100%)
 rename pkg_resources/_vendor/{importlib_resources-5.10.2.dist-info => importlib_resources-6.4.0.dist-info}/LICENSE (100%)
 rename pkg_resources/_vendor/{importlib_resources-5.10.2.dist-info => importlib_resources-6.4.0.dist-info}/METADATA (67%)
 create mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD
 rename pkg_resources/_vendor/{importlib_resources-5.10.2.dist-info => importlib_resources-6.4.0.dist-info}/REQUESTED (100%)
 rename pkg_resources/_vendor/{jaraco.functools-4.0.0.dist-info => importlib_resources-6.4.0.dist-info}/WHEEL (65%)
 rename pkg_resources/_vendor/{importlib_resources-5.10.2.dist-info => importlib_resources-6.4.0.dist-info}/top_level.txt (100%)
 delete mode 100644 pkg_resources/_vendor/importlib_resources/_compat.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/_legacy.py
 rename pkg_resources/_vendor/importlib_resources/{tests/zipdata01 => compat}/__init__.py (100%)
 create mode 100644 pkg_resources/_vendor/importlib_resources/compat/py38.py
 create mode 100644 pkg_resources/_vendor/importlib_resources/compat/py39.py
 create mode 100644 pkg_resources/_vendor/importlib_resources/functional.py
 rename pkg_resources/_vendor/importlib_resources/{tests/zipdata02 => future}/__init__.py (100%)
 create mode 100644 pkg_resources/_vendor/importlib_resources/future/adapters.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/_compat.py
 rename pkg_resources/_vendor/{jaraco => importlib_resources/tests/compat}/__init__.py (100%)
 create mode 100644 pkg_resources/_vendor/importlib_resources/tests/compat/py312.py
 create mode 100644 pkg_resources/_vendor/importlib_resources/tests/compat/py39.py
 create mode 100644 pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
 create mode 100644 pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
 create mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_custom.py
 create mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_functional.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/update-zips.py
 create mode 100644 pkg_resources/_vendor/importlib_resources/tests/zip.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/zipdata01/ziptestdata.zip
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/zipdata02/ziptestdata.zip
 rename pkg_resources/_vendor/{jaraco.text-3.7.0.dist-info => inflect-7.3.1.dist-info}/INSTALLER (100%)
 rename pkg_resources/_vendor/{jaraco.functools-4.0.0.dist-info => inflect-7.3.1.dist-info}/LICENSE (100%)
 create mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA
 create mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD
 rename pkg_resources/_vendor/{jaraco.text-3.7.0.dist-info => inflect-7.3.1.dist-info}/WHEEL (65%)
 create mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt
 create mode 100644 pkg_resources/_vendor/inflect/__init__.py
 rename pkg_resources/_vendor/{jaraco.text-3.7.0.dist-info/REQUESTED => inflect/compat/__init__.py} (100%)
 create mode 100644 pkg_resources/_vendor/inflect/compat/py38.py
 rename pkg_resources/_vendor/{packaging-24.0.dist-info/REQUESTED => inflect/py.typed} (100%)
 delete mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/RECORD
 rename pkg_resources/_vendor/{more_itertools-10.2.0.dist-info => jaraco.functools-4.0.1.dist-info}/INSTALLER (100%)
 rename pkg_resources/_vendor/{zipp-3.7.0.dist-info => jaraco.functools-4.0.1.dist-info}/LICENSE (97%)
 rename pkg_resources/_vendor/{jaraco.functools-4.0.0.dist-info => jaraco.functools-4.0.1.dist-info}/METADATA (78%)
 create mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
 rename pkg_resources/_vendor/{zipp-3.7.0.dist-info => jaraco.functools-4.0.1.dist-info}/WHEEL (65%)
 rename pkg_resources/_vendor/{jaraco.functools-4.0.0.dist-info => jaraco.functools-4.0.1.dist-info}/top_level.txt (100%)
 rename pkg_resources/_vendor/{packaging-24.0.dist-info => jaraco.text-3.12.1.dist-info}/INSTALLER (100%)
 rename pkg_resources/_vendor/{jaraco.text-3.7.0.dist-info => jaraco.text-3.12.1.dist-info}/LICENSE (97%)
 create mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA
 create mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD
 rename pkg_resources/_vendor/{platformdirs-2.6.2.dist-info => jaraco.text-3.12.1.dist-info}/REQUESTED (100%)
 create mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
 rename pkg_resources/_vendor/{jaraco.text-3.7.0.dist-info => jaraco.text-3.12.1.dist-info}/top_level.txt (100%)
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/RECORD
 create mode 100644 pkg_resources/_vendor/jaraco/text/layouts.py
 create mode 100644 pkg_resources/_vendor/jaraco/text/show-newlines.py
 create mode 100644 pkg_resources/_vendor/jaraco/text/strip-prefix.py
 create mode 100644 pkg_resources/_vendor/jaraco/text/to-dvorak.py
 create mode 100644 pkg_resources/_vendor/jaraco/text/to-qwerty.py
 delete mode 100644 pkg_resources/_vendor/more_itertools-10.2.0.dist-info/RECORD
 rename pkg_resources/_vendor/{platformdirs-2.6.2.dist-info => more_itertools-10.3.0.dist-info}/INSTALLER (100%)
 rename pkg_resources/_vendor/{more_itertools-10.2.0.dist-info => more_itertools-10.3.0.dist-info}/LICENSE (100%)
 rename pkg_resources/_vendor/{more_itertools-10.2.0.dist-info => more_itertools-10.3.0.dist-info}/METADATA (95%)
 create mode 100644 pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD
 rename pkg_resources/_vendor/{more_itertools-10.2.0.dist-info => more_itertools-10.3.0.dist-info}/WHEEL (100%)
 delete mode 100644 pkg_resources/_vendor/packaging-24.0.dist-info/RECORD
 rename pkg_resources/_vendor/{zipp-3.7.0.dist-info => packaging-24.1.dist-info}/INSTALLER (100%)
 rename pkg_resources/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/LICENSE (100%)
 rename pkg_resources/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/LICENSE.APACHE (100%)
 rename pkg_resources/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/LICENSE.BSD (100%)
 rename pkg_resources/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/METADATA (97%)
 create mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/RECORD
 rename pkg_resources/_vendor/{zipp-3.7.0.dist-info => packaging-24.1.dist-info}/REQUESTED (100%)
 rename pkg_resources/_vendor/{packaging-24.0.dist-info => packaging-24.1.dist-info}/WHEEL (100%)
 delete mode 100644 pkg_resources/_vendor/platformdirs-2.6.2.dist-info/RECORD
 create mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
 rename pkg_resources/_vendor/{platformdirs-2.6.2.dist-info => platformdirs-4.2.2.dist-info}/METADATA (75%)
 create mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD
 create mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/REQUESTED
 rename pkg_resources/_vendor/{platformdirs-2.6.2.dist-info => platformdirs-4.2.2.dist-info}/WHEEL (67%)
 rename pkg_resources/_vendor/{platformdirs-2.6.2.dist-info => platformdirs-4.2.2.dist-info}/licenses/LICENSE (100%)
 create mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER
 create mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE
 create mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA
 create mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD
 create mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL
 create mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
 create mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt
 create mode 100644 pkg_resources/_vendor/typeguard/__init__.py
 create mode 100644 pkg_resources/_vendor/typeguard/_checkers.py
 create mode 100644 pkg_resources/_vendor/typeguard/_config.py
 create mode 100644 pkg_resources/_vendor/typeguard/_decorators.py
 create mode 100644 pkg_resources/_vendor/typeguard/_exceptions.py
 create mode 100644 pkg_resources/_vendor/typeguard/_functions.py
 create mode 100644 pkg_resources/_vendor/typeguard/_importhook.py
 create mode 100644 pkg_resources/_vendor/typeguard/_memo.py
 create mode 100644 pkg_resources/_vendor/typeguard/_pytest_plugin.py
 create mode 100644 pkg_resources/_vendor/typeguard/_suppression.py
 create mode 100644 pkg_resources/_vendor/typeguard/_transformer.py
 create mode 100644 pkg_resources/_vendor/typeguard/_union_transformer.py
 create mode 100644 pkg_resources/_vendor/typeguard/_utils.py
 create mode 100644 pkg_resources/_vendor/typeguard/py.typed
 create mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
 create mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
 create mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA
 create mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD
 create mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/WHEEL
 create mode 100644 pkg_resources/_vendor/typing_extensions.py
 create mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER
 create mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE
 create mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA
 create mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD
 create mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/REQUESTED
 create mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL
 rename pkg_resources/_vendor/{zipp-3.7.0.dist-info => zipp-3.19.2.dist-info}/top_level.txt (100%)
 delete mode 100644 pkg_resources/_vendor/zipp-3.7.0.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/zipp-3.7.0.dist-info/RECORD
 rename pkg_resources/_vendor/{zipp.py => zipp/__init__.py} (52%)
 create mode 100644 pkg_resources/_vendor/zipp/compat/__init__.py
 create mode 100644 pkg_resources/_vendor/zipp/compat/py310.py
 create mode 100644 pkg_resources/_vendor/zipp/glob.py

diff --git a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/INSTALLER b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/INSTALLER
rename to pkg_resources/_vendor/autocommand-2.2.2.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE
new file mode 100644
index 0000000000..b49c3af060
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE
@@ -0,0 +1,166 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. 
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA
new file mode 100644
index 0000000000..32214fb440
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA
@@ -0,0 +1,420 @@
+Metadata-Version: 2.1
+Name: autocommand
+Version: 2.2.2
+Summary: A library to create a command-line program from a function
+Home-page: https://github.com/Lucretiel/autocommand
+Author: Nathan West
+License: LGPLv3
+Project-URL: Homepage, https://github.com/Lucretiel/autocommand
+Project-URL: Bug Tracker, https://github.com/Lucretiel/autocommand/issues
+Platform: any
+Classifier: Development Status :: 6 - Mature
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >=3.7
+Description-Content-Type: text/markdown
+License-File: LICENSE
+
+[![PyPI version](https://badge.fury.io/py/autocommand.svg)](https://badge.fury.io/py/autocommand)
+
+# autocommand
+
+A library to automatically generate and run simple argparse parsers from function signatures.
+
+## Installation
+
+Autocommand is installed via pip:
+
+```
+$ pip install autocommand
+```
+
+## Usage
+
+Autocommand turns a function into a command-line program. It converts the function's parameter signature into command-line arguments, and automatically runs the function if the module was called as `__main__`. In effect, it lets your create a smart main function.
+
+```python
+from autocommand import autocommand
+
+# This program takes exactly one argument and echos it.
+@autocommand(__name__)
+def echo(thing):
+    print(thing)
+```
+
+```
+$ python echo.py hello
+hello
+$ python echo.py -h
+usage: echo [-h] thing
+
+positional arguments:
+  thing
+
+optional arguments:
+  -h, --help  show this help message and exit
+$ python echo.py hello world  # too many arguments
+usage: echo.py [-h] thing
+echo.py: error: unrecognized arguments: world
+```
+
+As you can see, autocommand converts the signature of the function into an argument spec. When you run the file as a program, autocommand collects the command-line arguments and turns them into function arguments. The function is executed with these arguments, and then the program exits with the return value of the function, via `sys.exit`. Autocommand also automatically creates a usage message, which can be invoked with `-h` or `--help`, and automatically prints an error message when provided with invalid arguments.
+
+### Types
+
+You can use a type annotation to give an argument a type. Any type (or in fact any callable) that returns an object when given a string argument can be used, though there are a few special cases that are described later.
+
+```python
+@autocommand(__name__)
+def net_client(host, port: int):
+    ...
+```
+
+Autocommand will catch `TypeErrors` raised by the type during argument parsing, so you can supply a callable and do some basic argument validation as well.
+
+### Trailing Arguments
+
+You can add a `*args` parameter to your function to give it trailing arguments. The command will collect 0 or more trailing arguments and supply them to `args` as a tuple. If a type annotation is supplied, the type is applied to each argument.
+
+```python
+# Write the contents of each file, one by one
+@autocommand(__name__)
+def cat(*files):
+    for filename in files:
+        with open(filename) as file:
+            for line in file:
+                print(line.rstrip())
+```
+
+```
+$ python cat.py -h
+usage: ipython [-h] [file [file ...]]
+
+positional arguments:
+  file
+
+optional arguments:
+  -h, --help  show this help message and exit
+```
+
+### Options
+
+To create `--option` switches, just assign a default. Autocommand will automatically create `--long` and `-s`hort switches.
+
+```python
+@autocommand(__name__)
+def do_with_config(argument, config='~/foo.conf'):
+    pass
+```
+
+```
+$ python example.py -h
+usage: example.py [-h] [-c CONFIG] argument
+
+positional arguments:
+  argument
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -c CONFIG, --config CONFIG
+```
+
+The option's type is automatically deduced from the default, unless one is explicitly given in an annotation:
+
+```python
+@autocommand(__name__)
+def http_connect(host, port=80):
+    print('{}:{}'.format(host, port))
+```
+
+```
+$ python http.py -h
+usage: http.py [-h] [-p PORT] host
+
+positional arguments:
+  host
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -p PORT, --port PORT
+$ python http.py localhost
+localhost:80
+$ python http.py localhost -p 8080
+localhost:8080
+$ python http.py localhost -p blah
+usage: http.py [-h] [-p PORT] host
+http.py: error: argument -p/--port: invalid int value: 'blah'
+```
+
+#### None
+
+If an option is given a default value of `None`, it reads in a value as normal, but supplies `None` if the option isn't provided.
+
+#### Switches
+
+If an argument is given a default value of `True` or `False`, or
+given an explicit `bool` type, it becomes an option switch.
+
+```python
+    @autocommand(__name__)
+    def example(verbose=False, quiet=False):
+        pass
+```
+
+```
+$ python example.py -h
+usage: example.py [-h] [-v] [-q]
+
+optional arguments:
+  -h, --help     show this help message and exit
+  -v, --verbose
+  -q, --quiet
+```
+
+Autocommand attempts to do the "correct thing" in these cases- if the default is `True`, then supplying the switch makes the argument `False`; if the type is `bool` and the default is some other `True` value, then supplying the switch makes the argument `False`, while not supplying the switch makes the argument the default value.
+
+Autocommand also supports the creation of switch inverters. Pass `add_nos=True` to `autocommand` to enable this.
+
+```
+    @autocommand(__name__, add_nos=True)
+    def example(verbose=False):
+        pass
+```
+
+```
+$ python example.py -h
+usage: ipython [-h] [-v] [--no-verbose]
+
+optional arguments:
+  -h, --help     show this help message and exit
+  -v, --verbose
+  --no-verbose
+```
+
+Using the `--no-` version of a switch will pass the opposite value in as a function argument. If multiple switches are present, the last one takes precedence.
+
+#### Files
+
+If the default value is a file object, such as `sys.stdout`, then autocommand just looks for a string, for a file path. It doesn't do any special checking on the string, though (such as checking if the file exists); it's better to let the client decide how to handle errors in this case. Instead, it provides a special context manager called `smart_open`, which behaves exactly like `open` if a filename or other openable type is provided, but also lets you use already open files:
+
+```python
+from autocommand import autocommand, smart_open
+import sys
+
+# Write the contents of stdin, or a file, to stdout
+@autocommand(__name__)
+def write_out(infile=sys.stdin):
+    with smart_open(infile) as f:
+        for line in f:
+            print(line.rstrip())
+    # If a file was opened, it is closed here. If it was just stdin, it is untouched.
+```
+
+```
+$ echo "Hello World!" | python write_out.py | tee hello.txt
+Hello World!
+$ python write_out.py --infile hello.txt
+Hello World!
+```
+
+### Descriptions and docstrings
+
+The `autocommand` decorator accepts `description` and `epilog` kwargs, corresponding to the `description `_ and `epilog `_ of the `ArgumentParser`. If no description is given, but the decorated function has a docstring, then it is taken as the `description` for the `ArgumentParser`. You can also provide both the description and epilog in the docstring by splitting it into two sections with 4 or more - characters.
+
+```python
+@autocommand(__name__)
+def copy(infile=sys.stdin, outfile=sys.stdout):
+    '''
+    Copy an the contents of a file (or stdin) to another file (or stdout)
+    ----------
+    Some extra documentation in the epilog
+    '''
+    with smart_open(infile) as istr:
+        with smart_open(outfile, 'w') as ostr:
+            for line in istr:
+                ostr.write(line)
+```
+
+```
+$ python copy.py -h
+usage: copy.py [-h] [-i INFILE] [-o OUTFILE]
+
+Copy an the contents of a file (or stdin) to another file (or stdout)
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -i INFILE, --infile INFILE
+  -o OUTFILE, --outfile OUTFILE
+
+Some extra documentation in the epilog
+$ echo "Hello World" | python copy.py --outfile hello.txt
+$ python copy.py --infile hello.txt --outfile hello2.txt
+$ python copy.py --infile hello2.txt
+Hello World
+```
+
+### Parameter descriptions
+
+You can also attach description text to individual parameters in the annotation. To attach both a type and a description, supply them both in any order in a tuple
+
+```python
+@autocommand(__name__)
+def copy_net(
+    infile: 'The name of the file to send',
+    host: 'The host to send the file to',
+    port: (int, 'The port to connect to')):
+
+    '''
+    Copy a file over raw TCP to a remote destination.
+    '''
+    # Left as an exercise to the reader
+```
+
+### Decorators and wrappers
+
+Autocommand automatically follows wrapper chains created by `@functools.wraps`. This means that you can apply other wrapping decorators to your main function, and autocommand will still correctly detect the signature.
+
+```python
+from functools import wraps
+from autocommand import autocommand
+
+def print_yielded(func):
+    '''
+    Convert a generator into a function that prints all yielded elements
+    '''
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        for thing in func(*args, **kwargs):
+            print(thing)
+    return wrapper
+
+@autocommand(__name__,
+    description= 'Print all the values from START to STOP, inclusive, in steps of STEP',
+    epilog=      'STOP and STEP default to 1')
+@print_yielded
+def seq(stop, start=1, step=1):
+    for i in range(start, stop + 1, step):
+        yield i
+```
+
+```
+$ seq.py -h
+usage: seq.py [-h] [-s START] [-S STEP] stop
+
+Print all the values from START to STOP, inclusive, in steps of STEP
+
+positional arguments:
+  stop
+
+optional arguments:
+  -h, --help            show this help message and exit
+  -s START, --start START
+  -S STEP, --step STEP
+
+STOP and STEP default to 1
+```
+
+Even though autocommand is being applied to the `wrapper` returned by `print_yielded`, it still retreives the signature of the underlying `seq` function to create the argument parsing.
+
+### Custom Parser
+
+While autocommand's automatic parser generator is a powerful convenience, it doesn't cover all of the different features that argparse provides. If you need these features, you can provide your own parser as a kwarg to `autocommand`:
+
+```python
+from argparse import ArgumentParser
+from autocommand import autocommand
+
+parser = ArgumentParser()
+# autocommand can't do optional positonal parameters
+parser.add_argument('arg', nargs='?')
+# or mutually exclusive options
+group = parser.add_mutually_exclusive_group()
+group.add_argument('-v', '--verbose', action='store_true')
+group.add_argument('-q', '--quiet', action='store_true')
+
+@autocommand(__name__, parser=parser)
+def main(arg, verbose, quiet):
+    print(arg, verbose, quiet)
+```
+
+```
+$ python parser.py -h
+usage: write_file.py [-h] [-v | -q] [arg]
+
+positional arguments:
+  arg
+
+optional arguments:
+  -h, --help     show this help message and exit
+  -v, --verbose
+  -q, --quiet
+$ python parser.py
+None False False
+$ python parser.py hello
+hello False False
+$ python parser.py -v
+None True False
+$ python parser.py -q
+None False True
+$ python parser.py -vq
+usage: parser.py [-h] [-v | -q] [arg]
+parser.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
+```
+
+Any parser should work fine, so long as each of the parser's arguments has a corresponding parameter in the decorated main function. The order of parameters doesn't matter, as long as they are all present. Note that when using a custom parser, autocommand doesn't modify the parser or the retrieved arguments. This means that no description/epilog will be added, and the function's type annotations and defaults (if present) will be ignored.
+
+## Testing and Library use
+
+The decorated function is only called and exited from if the first argument to `autocommand` is `'__main__'` or `True`. If it is neither of these values, or no argument is given, then a new main function is created by the decorator. This function has the signature `main(argv=None)`, and is intended to be called with arguments as if via `main(sys.argv[1:])`. The function has the attributes `parser` and `main`, which are the generated `ArgumentParser` and the original main function that was decorated. This is to facilitate testing and library use of your main. Calling the function triggers a `parse_args()` with the supplied arguments, and returns the result of the main function. Note that, while it returns instead of calling `sys.exit`, the `parse_args()` function will raise a `SystemExit` in the event of a parsing error or `-h/--help` argument.
+
+```python
+    @autocommand()
+    def test_prog(arg1, arg2: int, quiet=False, verbose=False):
+        if not quiet:
+            print(arg1, arg2)
+            if verbose:
+                print("LOUD NOISES")
+
+        return 0
+
+    print(test_prog(['-v', 'hello', '80']))
+```
+
+```
+$ python test_prog.py
+hello 80
+LOUD NOISES
+0
+```
+
+If the function is called with no arguments, `sys.argv[1:]` is used. This is to allow the autocommand function to be used as a setuptools entry point.
+
+## Exceptions and limitations
+
+- There are a few possible exceptions that `autocommand` can raise. All of them derive from `autocommand.AutocommandError`.
+
+  - If an invalid annotation is given (that is, it isn't a `type`, `str`, `(type, str)`, or `(str, type)`, an `AnnotationError` is raised. The `type` may be any callable, as described in the `Types`_ section.
+  - If the function has a `**kwargs` parameter, a `KWargError` is raised.
+  - If, somehow, the function has a positional-only parameter, a `PositionalArgError` is raised. This means that the argument doesn't have a name, which is currently not possible with a plain `def` or `lambda`, though many built-in functions have this kind of parameter.
+
+- There are a few argparse features that are not supported by autocommand.
+
+  - It isn't possible to have an optional positional argument (as opposed to a `--option`). POSIX thinks this is bad form anyway.
+  - It isn't possible to have mutually exclusive arguments or options
+  - It isn't possible to have subcommands or subparsers, though I'm working on a few solutions involving classes or nested function definitions to allow this.
+
+## Development
+
+Autocommand cannot be important from the project root; this is to enforce separation of concerns and prevent accidental importing of `setup.py` or tests. To develop, install the project in editable mode:
+
+```
+$ python setup.py develop
+```
+
+This will create a link to the source files in the deployment directory, so that any source changes are reflected when it is imported.
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD
new file mode 100644
index 0000000000..e6e12ea51e
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD
@@ -0,0 +1,18 @@
+autocommand-2.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634
+autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006
+autocommand-2.2.2.dist-info/RECORD,,
+autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
+autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12
+autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037
+autocommand/__pycache__/__init__.cpython-312.pyc,,
+autocommand/__pycache__/autoasync.cpython-312.pyc,,
+autocommand/__pycache__/autocommand.cpython-312.pyc,,
+autocommand/__pycache__/automain.cpython-312.pyc,,
+autocommand/__pycache__/autoparse.cpython-312.pyc,,
+autocommand/__pycache__/errors.cpython-312.pyc,,
+autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680
+autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505
+autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076
+autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642
+autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886
diff --git a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/WHEEL b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/WHEEL
similarity index 100%
rename from pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/WHEEL
rename to pkg_resources/_vendor/autocommand-2.2.2.dist-info/WHEEL
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt
new file mode 100644
index 0000000000..dda5158ff6
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt
@@ -0,0 +1 @@
+autocommand
diff --git a/pkg_resources/_vendor/autocommand/__init__.py b/pkg_resources/_vendor/autocommand/__init__.py
new file mode 100644
index 0000000000..73fbfca6b3
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2014-2016 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+# flake8 flags all these imports as unused, hence the NOQAs everywhere.
+
+from .automain import automain  # NOQA
+from .autoparse import autoparse, smart_open  # NOQA
+from .autocommand import autocommand  # NOQA
+
+try:
+    from .autoasync import autoasync  # NOQA
+except ImportError:  # pragma: no cover
+    pass
diff --git a/pkg_resources/_vendor/autocommand/autoasync.py b/pkg_resources/_vendor/autocommand/autoasync.py
new file mode 100644
index 0000000000..688f7e0554
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand/autoasync.py
@@ -0,0 +1,142 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+from asyncio import get_event_loop, iscoroutine
+from functools import wraps
+from inspect import signature
+
+
+async def _run_forever_coro(coro, args, kwargs, loop):
+    '''
+    This helper function launches an async main function that was tagged with
+    forever=True. There are two possibilities:
+
+    - The function is a normal function, which handles initializing the event
+      loop, which is then run forever
+    - The function is a coroutine, which needs to be scheduled in the event
+      loop, which is then run forever
+      - There is also the possibility that the function is a normal function
+        wrapping a coroutine function
+
+    The function is therefore called unconditionally and scheduled in the event
+    loop if the return value is a coroutine object.
+
+    The reason this is a separate function is to make absolutely sure that all
+    the objects created are garbage collected after all is said and done; we
+    do this to ensure that any exceptions raised in the tasks are collected
+    ASAP.
+    '''
+
+    # Personal note: I consider this an antipattern, as it relies on the use of
+    # unowned resources. The setup function dumps some stuff into the event
+    # loop where it just whirls in the ether without a well defined owner or
+    # lifetime. For this reason, there's a good chance I'll remove the
+    # forever=True feature from autoasync at some point in the future.
+    thing = coro(*args, **kwargs)
+    if iscoroutine(thing):
+        await thing
+
+
+def autoasync(coro=None, *, loop=None, forever=False, pass_loop=False):
+    '''
+    Convert an asyncio coroutine into a function which, when called, is
+    evaluted in an event loop, and the return value returned. This is intented
+    to make it easy to write entry points into asyncio coroutines, which
+    otherwise need to be explictly evaluted with an event loop's
+    run_until_complete.
+
+    If `loop` is given, it is used as the event loop to run the coro in. If it
+    is None (the default), the loop is retreived using asyncio.get_event_loop.
+    This call is defered until the decorated function is called, so that
+    callers can install custom event loops or event loop policies after
+    @autoasync is applied.
+
+    If `forever` is True, the loop is run forever after the decorated coroutine
+    is finished. Use this for servers created with asyncio.start_server and the
+    like.
+
+    If `pass_loop` is True, the event loop object is passed into the coroutine
+    as the `loop` kwarg when the wrapper function is called. In this case, the
+    wrapper function's __signature__ is updated to remove this parameter, so
+    that autoparse can still be used on it without generating a parameter for
+    `loop`.
+
+    This coroutine can be called with ( @autoasync(...) ) or without
+    ( @autoasync ) arguments.
+
+    Examples:
+
+    @autoasync
+    def get_file(host, port):
+        reader, writer = yield from asyncio.open_connection(host, port)
+        data = reader.read()
+        sys.stdout.write(data.decode())
+
+    get_file(host, port)
+
+    @autoasync(forever=True, pass_loop=True)
+    def server(host, port, loop):
+        yield_from loop.create_server(Proto, host, port)
+
+    server('localhost', 8899)
+
+    '''
+    if coro is None:
+        return lambda c: autoasync(
+            c, loop=loop,
+            forever=forever,
+            pass_loop=pass_loop)
+
+    # The old and new signatures are required to correctly bind the loop
+    # parameter in 100% of cases, even if it's a positional parameter.
+    # NOTE: A future release will probably require the loop parameter to be
+    # a kwonly parameter.
+    if pass_loop:
+        old_sig = signature(coro)
+        new_sig = old_sig.replace(parameters=(
+            param for name, param in old_sig.parameters.items()
+            if name != "loop"))
+
+    @wraps(coro)
+    def autoasync_wrapper(*args, **kwargs):
+        # Defer the call to get_event_loop so that, if a custom policy is
+        # installed after the autoasync decorator, it is respected at call time
+        local_loop = get_event_loop() if loop is None else loop
+
+        # Inject the 'loop' argument. We have to use this signature binding to
+        # ensure it's injected in the correct place (positional, keyword, etc)
+        if pass_loop:
+            bound_args = old_sig.bind_partial()
+            bound_args.arguments.update(
+                loop=local_loop,
+                **new_sig.bind(*args, **kwargs).arguments)
+            args, kwargs = bound_args.args, bound_args.kwargs
+
+        if forever:
+            local_loop.create_task(_run_forever_coro(
+                coro, args, kwargs, local_loop
+            ))
+            local_loop.run_forever()
+        else:
+            return local_loop.run_until_complete(coro(*args, **kwargs))
+
+    # Attach the updated signature. This allows 'pass_loop' to be used with
+    # autoparse
+    if pass_loop:
+        autoasync_wrapper.__signature__ = new_sig
+
+    return autoasync_wrapper
diff --git a/pkg_resources/_vendor/autocommand/autocommand.py b/pkg_resources/_vendor/autocommand/autocommand.py
new file mode 100644
index 0000000000..097e86de07
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand/autocommand.py
@@ -0,0 +1,70 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+from .autoparse import autoparse
+from .automain import automain
+try:
+    from .autoasync import autoasync
+except ImportError:  # pragma: no cover
+    pass
+
+
+def autocommand(
+        module, *,
+        description=None,
+        epilog=None,
+        add_nos=False,
+        parser=None,
+        loop=None,
+        forever=False,
+        pass_loop=False):
+
+    if callable(module):
+        raise TypeError('autocommand requires a module name argument')
+
+    def autocommand_decorator(func):
+        # Step 1: if requested, run it all in an asyncio event loop. autoasync
+        # patches the __signature__ of the decorated function, so that in the
+        # event that pass_loop is True, the `loop` parameter of the original
+        # function will *not* be interpreted as a command-line argument by
+        # autoparse
+        if loop is not None or forever or pass_loop:
+            func = autoasync(
+                func,
+                loop=None if loop is True else loop,
+                pass_loop=pass_loop,
+                forever=forever)
+
+        # Step 2: create parser. We do this second so that the arguments are
+        # parsed and passed *before* entering the asyncio event loop, if it
+        # exists. This simplifies the stack trace and ensures errors are
+        # reported earlier. It also ensures that errors raised during parsing &
+        # passing are still raised if `forever` is True.
+        func = autoparse(
+            func,
+            description=description,
+            epilog=epilog,
+            add_nos=add_nos,
+            parser=parser)
+
+        # Step 3: call the function automatically if __name__ == '__main__' (or
+        # if True was provided)
+        func = automain(module)(func)
+
+        return func
+
+    return autocommand_decorator
diff --git a/pkg_resources/_vendor/autocommand/automain.py b/pkg_resources/_vendor/autocommand/automain.py
new file mode 100644
index 0000000000..6cc45db66a
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand/automain.py
@@ -0,0 +1,59 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+import sys
+from .errors import AutocommandError
+
+
+class AutomainRequiresModuleError(AutocommandError, TypeError):
+    pass
+
+
+def automain(module, *, args=(), kwargs=None):
+    '''
+    This decorator automatically invokes a function if the module is being run
+    as the "__main__" module. Optionally, provide args or kwargs with which to
+    call the function. If `module` is "__main__", the function is called, and
+    the program is `sys.exit`ed with the return value. You can also pass `True`
+    to cause the function to be called unconditionally. If the function is not
+    called, it is returned unchanged by the decorator.
+
+    Usage:
+
+    @automain(__name__)  # Pass __name__ to check __name__=="__main__"
+    def main():
+        ...
+
+    If __name__ is "__main__" here, the main function is called, and then
+    sys.exit called with the return value.
+    '''
+
+    # Check that @automain(...) was called, rather than @automain
+    if callable(module):
+        raise AutomainRequiresModuleError(module)
+
+    if module == '__main__' or module is True:
+        if kwargs is None:
+            kwargs = {}
+
+        # Use a function definition instead of a lambda for a neater traceback
+        def automain_decorator(main):
+            sys.exit(main(*args, **kwargs))
+
+        return automain_decorator
+    else:
+        return lambda main: main
diff --git a/pkg_resources/_vendor/autocommand/autoparse.py b/pkg_resources/_vendor/autocommand/autoparse.py
new file mode 100644
index 0000000000..0276a3fae1
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand/autoparse.py
@@ -0,0 +1,333 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+import sys
+from re import compile as compile_regex
+from inspect import signature, getdoc, Parameter
+from argparse import ArgumentParser
+from contextlib import contextmanager
+from functools import wraps
+from io import IOBase
+from autocommand.errors import AutocommandError
+
+
+_empty = Parameter.empty
+
+
+class AnnotationError(AutocommandError):
+    '''Annotation error: annotation must be a string, type, or tuple of both'''
+
+
+class PositionalArgError(AutocommandError):
+    '''
+    Postional Arg Error: autocommand can't handle postional-only parameters
+    '''
+
+
+class KWArgError(AutocommandError):
+    '''kwarg Error: autocommand can't handle a **kwargs parameter'''
+
+
+class DocstringError(AutocommandError):
+    '''Docstring error'''
+
+
+class TooManySplitsError(DocstringError):
+    '''
+    The docstring had too many ---- section splits. Currently we only support
+    using up to a single split, to split the docstring into description and
+    epilog parts.
+    '''
+
+
+def _get_type_description(annotation):
+    '''
+    Given an annotation, return the (type, description) for the parameter.
+    If you provide an annotation that is somehow both a string and a callable,
+    the behavior is undefined.
+    '''
+    if annotation is _empty:
+        return None, None
+    elif callable(annotation):
+        return annotation, None
+    elif isinstance(annotation, str):
+        return None, annotation
+    elif isinstance(annotation, tuple):
+        try:
+            arg1, arg2 = annotation
+        except ValueError as e:
+            raise AnnotationError(annotation) from e
+        else:
+            if callable(arg1) and isinstance(arg2, str):
+                return arg1, arg2
+            elif isinstance(arg1, str) and callable(arg2):
+                return arg2, arg1
+
+    raise AnnotationError(annotation)
+
+
+def _add_arguments(param, parser, used_char_args, add_nos):
+    '''
+    Add the argument(s) to an ArgumentParser (using add_argument) for a given
+    parameter. used_char_args is the set of -short options currently already in
+    use, and is updated (if necessary) by this function. If add_nos is True,
+    this will also add an inverse switch for all boolean options. For
+    instance, for the boolean parameter "verbose", this will create --verbose
+    and --no-verbose.
+    '''
+
+    # Impl note: This function is kept separate from make_parser because it's
+    # already very long and I wanted to separate out as much as possible into
+    # its own call scope, to prevent even the possibility of suble mutation
+    # bugs.
+    if param.kind is param.POSITIONAL_ONLY:
+        raise PositionalArgError(param)
+    elif param.kind is param.VAR_KEYWORD:
+        raise KWArgError(param)
+
+    # These are the kwargs for the add_argument function.
+    arg_spec = {}
+    is_option = False
+
+    # Get the type and default from the annotation.
+    arg_type, description = _get_type_description(param.annotation)
+
+    # Get the default value
+    default = param.default
+
+    # If there is no explicit type, and the default is present and not None,
+    # infer the type from the default.
+    if arg_type is None and default not in {_empty, None}:
+        arg_type = type(default)
+
+    # Add default. The presence of a default means this is an option, not an
+    # argument.
+    if default is not _empty:
+        arg_spec['default'] = default
+        is_option = True
+
+    # Add the type
+    if arg_type is not None:
+        # Special case for bool: make it just a --switch
+        if arg_type is bool:
+            if not default or default is _empty:
+                arg_spec['action'] = 'store_true'
+            else:
+                arg_spec['action'] = 'store_false'
+
+            # Switches are always options
+            is_option = True
+
+        # Special case for file types: make it a string type, for filename
+        elif isinstance(default, IOBase):
+            arg_spec['type'] = str
+
+        # TODO: special case for list type.
+        #   - How to specificy type of list members?
+        #       - param: [int]
+        #       - param: int =[]
+        #   - action='append' vs nargs='*'
+
+        else:
+            arg_spec['type'] = arg_type
+
+    # nargs: if the signature includes *args, collect them as trailing CLI
+    # arguments in a list. *args can't have a default value, so it can never be
+    # an option.
+    if param.kind is param.VAR_POSITIONAL:
+        # TODO: consider depluralizing metavar/name here.
+        arg_spec['nargs'] = '*'
+
+    # Add description.
+    if description is not None:
+        arg_spec['help'] = description
+
+    # Get the --flags
+    flags = []
+    name = param.name
+
+    if is_option:
+        # Add the first letter as a -short option.
+        for letter in name[0], name[0].swapcase():
+            if letter not in used_char_args:
+                used_char_args.add(letter)
+                flags.append('-{}'.format(letter))
+                break
+
+        # If the parameter is a --long option, or is a -short option that
+        # somehow failed to get a flag, add it.
+        if len(name) > 1 or not flags:
+            flags.append('--{}'.format(name))
+
+        arg_spec['dest'] = name
+    else:
+        flags.append(name)
+
+    parser.add_argument(*flags, **arg_spec)
+
+    # Create the --no- version for boolean switches
+    if add_nos and arg_type is bool:
+        parser.add_argument(
+            '--no-{}'.format(name),
+            action='store_const',
+            dest=name,
+            const=default if default is not _empty else False)
+
+
+def make_parser(func_sig, description, epilog, add_nos):
+    '''
+    Given the signature of a function, create an ArgumentParser
+    '''
+    parser = ArgumentParser(description=description, epilog=epilog)
+
+    used_char_args = {'h'}
+
+    # Arange the params so that single-character arguments are first. This
+    # esnures they don't have to get --long versions. sorted is stable, so the
+    # parameters will otherwise still be in relative order.
+    params = sorted(
+        func_sig.parameters.values(),
+        key=lambda param: len(param.name) > 1)
+
+    for param in params:
+        _add_arguments(param, parser, used_char_args, add_nos)
+
+    return parser
+
+
+_DOCSTRING_SPLIT = compile_regex(r'\n\s*-{4,}\s*\n')
+
+
+def parse_docstring(docstring):
+    '''
+    Given a docstring, parse it into a description and epilog part
+    '''
+    if docstring is None:
+        return '', ''
+
+    parts = _DOCSTRING_SPLIT.split(docstring)
+
+    if len(parts) == 1:
+        return docstring, ''
+    elif len(parts) == 2:
+        return parts[0], parts[1]
+    else:
+        raise TooManySplitsError()
+
+
+def autoparse(
+        func=None, *,
+        description=None,
+        epilog=None,
+        add_nos=False,
+        parser=None):
+    '''
+    This decorator converts a function that takes normal arguments into a
+    function which takes a single optional argument, argv, parses it using an
+    argparse.ArgumentParser, and calls the underlying function with the parsed
+    arguments. If it is not given, sys.argv[1:] is used. This is so that the
+    function can be used as a setuptools entry point, as well as a normal main
+    function. sys.argv[1:] is not evaluated until the function is called, to
+    allow injecting different arguments for testing.
+
+    It uses the argument signature of the function to create an
+    ArgumentParser. Parameters without defaults become positional parameters,
+    while parameters *with* defaults become --options. Use annotations to set
+    the type of the parameter.
+
+    The `desctiption` and `epilog` parameters corrospond to the same respective
+    argparse parameters. If no description is given, it defaults to the
+    decorated functions's docstring, if present.
+
+    If add_nos is True, every boolean option (that is, every parameter with a
+    default of True/False or a type of bool) will have a --no- version created
+    as well, which inverts the option. For instance, the --verbose option will
+    have a --no-verbose counterpart. These are not mutually exclusive-
+    whichever one appears last in the argument list will have precedence.
+
+    If a parser is given, it is used instead of one generated from the function
+    signature. In this case, no parser is created; instead, the given parser is
+    used to parse the argv argument. The parser's results' argument names must
+    match up with the parameter names of the decorated function.
+
+    The decorated function is attached to the result as the `func` attribute,
+    and the parser is attached as the `parser` attribute.
+    '''
+
+    # If @autoparse(...) is used instead of @autoparse
+    if func is None:
+        return lambda f: autoparse(
+            f, description=description,
+            epilog=epilog,
+            add_nos=add_nos,
+            parser=parser)
+
+    func_sig = signature(func)
+
+    docstr_description, docstr_epilog = parse_docstring(getdoc(func))
+
+    if parser is None:
+        parser = make_parser(
+            func_sig,
+            description or docstr_description,
+            epilog or docstr_epilog,
+            add_nos)
+
+    @wraps(func)
+    def autoparse_wrapper(argv=None):
+        if argv is None:
+            argv = sys.argv[1:]
+
+        # Get empty argument binding, to fill with parsed arguments. This
+        # object does all the heavy lifting of turning named arguments into
+        # into correctly bound *args and **kwargs.
+        parsed_args = func_sig.bind_partial()
+        parsed_args.arguments.update(vars(parser.parse_args(argv)))
+
+        return func(*parsed_args.args, **parsed_args.kwargs)
+
+    # TODO: attach an updated __signature__ to autoparse_wrapper, just in case.
+
+    # Attach the wrapped function and parser, and return the wrapper.
+    autoparse_wrapper.func = func
+    autoparse_wrapper.parser = parser
+    return autoparse_wrapper
+
+
+@contextmanager
+def smart_open(filename_or_file, *args, **kwargs):
+    '''
+    This context manager allows you to open a filename, if you want to default
+    some already-existing file object, like sys.stdout, which shouldn't be
+    closed at the end of the context. If the filename argument is a str, bytes,
+    or int, the file object is created via a call to open with the given *args
+    and **kwargs, sent to the context, and closed at the end of the context,
+    just like "with open(filename) as f:". If it isn't one of the openable
+    types, the object simply sent to the context unchanged, and left unclosed
+    at the end of the context. Example:
+
+        def work_with_file(name=sys.stdout):
+            with smart_open(name) as f:
+                # Works correctly if name is a str filename or sys.stdout
+                print("Some stuff", file=f)
+                # If it was a filename, f is closed at the end here.
+    '''
+    if isinstance(filename_or_file, (str, bytes, int)):
+        with open(filename_or_file, *args, **kwargs) as file:
+            yield file
+    else:
+        yield filename_or_file
diff --git a/pkg_resources/_vendor/autocommand/errors.py b/pkg_resources/_vendor/autocommand/errors.py
new file mode 100644
index 0000000000..2570607399
--- /dev/null
+++ b/pkg_resources/_vendor/autocommand/errors.py
@@ -0,0 +1,23 @@
+# Copyright 2014-2016 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand.  If not, see .
+
+
+class AutocommandError(Exception):
+    '''Base class for autocommand exceptions'''
+    pass
+
+# Individual modules will define errors specific to that module.
diff --git a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/RECORD b/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/RECORD
deleted file mode 100644
index a6a44d8fcc..0000000000
--- a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/RECORD
+++ /dev/null
@@ -1,9 +0,0 @@
-backports.tarfile-1.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-backports.tarfile-1.0.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-backports.tarfile-1.0.0.dist-info/METADATA,sha256=XlT7JAFR04zDMIjs-EFhqc0CkkVyeh-SiVUoKXONXJ0,1876
-backports.tarfile-1.0.0.dist-info/RECORD,,
-backports.tarfile-1.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-backports.tarfile-1.0.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-backports.tarfile-1.0.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
-backports/__pycache__/tarfile.cpython-312.pyc,,
-backports/tarfile.py,sha256=IO3YX_ZYqn13VOi-3QLM0lnktn102U4d9wUrHc230LY,106920
diff --git a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/INSTALLER b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/INSTALLER
rename to pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/LICENSE b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
similarity index 100%
rename from pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/LICENSE
rename to pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
diff --git a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/METADATA b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
similarity index 83%
rename from pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/METADATA
rename to pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
index e7b64c87f8..db0a2dcdbe 100644
--- a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/METADATA
+++ b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
@@ -1,16 +1,16 @@
 Metadata-Version: 2.1
 Name: backports.tarfile
-Version: 1.0.0
+Version: 1.2.0
 Summary: Backport of CPython tarfile module
-Home-page: https://github.com/jaraco/backports.tarfile
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/backports.tarfile
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
 Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
 License-File: LICENSE
 Provides-Extra: docs
 Requires-Dist: sphinx >=3.5 ; extra == 'docs'
@@ -19,10 +19,12 @@ Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
 Requires-Dist: furo ; extra == 'docs'
 Requires-Dist: sphinx-lint ; extra == 'docs'
 Provides-Extra: testing
-Requires-Dist: pytest !=8.1.1,>=6 ; extra == 'testing'
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'testing'
 Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
 Requires-Dist: pytest-cov ; extra == 'testing'
 Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
+Requires-Dist: jaraco.test ; extra == 'testing'
+Requires-Dist: pytest !=8.0.* ; extra == 'testing'
 
 .. image:: https://img.shields.io/pypi/v/backports.tarfile.svg
    :target: https://pypi.org/project/backports.tarfile
diff --git a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
new file mode 100644
index 0000000000..536dc2f09e
--- /dev/null
+++ b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
@@ -0,0 +1,17 @@
+backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020
+backports.tarfile-1.2.0.dist-info/RECORD,,
+backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
+backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81
+backports/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491
+backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59
+backports/tarfile/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/__pycache__/__main__.cpython-312.pyc,,
+backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+backports/tarfile/compat/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/compat/__pycache__/py38.cpython-312.pyc,,
+backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568
diff --git a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/REQUESTED b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
similarity index 100%
rename from pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/REQUESTED
rename to pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
diff --git a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/WHEEL b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
similarity index 100%
rename from pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/WHEEL
rename to pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
diff --git a/pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/top_level.txt b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
similarity index 100%
rename from pkg_resources/_vendor/backports.tarfile-1.0.0.dist-info/top_level.txt
rename to pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
diff --git a/pkg_resources/_vendor/backports/__init__.py b/pkg_resources/_vendor/backports/__init__.py
index e69de29bb2..0d1f7edf5d 100644
--- a/pkg_resources/_vendor/backports/__init__.py
+++ b/pkg_resources/_vendor/backports/__init__.py
@@ -0,0 +1 @@
+__path__ = __import__('pkgutil').extend_path(__path__, __name__)  # type: ignore
diff --git a/pkg_resources/_vendor/backports/tarfile.py b/pkg_resources/_vendor/backports/tarfile/__init__.py
similarity index 96%
rename from pkg_resources/_vendor/backports/tarfile.py
rename to pkg_resources/_vendor/backports/tarfile/__init__.py
index a7a9a6e7b9..8c16881cb3 100644
--- a/pkg_resources/_vendor/backports/tarfile.py
+++ b/pkg_resources/_vendor/backports/tarfile/__init__.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3
 #-------------------------------------------------------------------
 # tarfile.py
 #-------------------------------------------------------------------
@@ -46,7 +45,8 @@
 import struct
 import copy
 import re
-import warnings
+
+from .compat.py38 import removesuffix
 
 try:
     import pwd
@@ -637,6 +637,10 @@ def __init__(self, fileobj, offset, size, name, blockinfo=None):
     def flush(self):
         pass
 
+    @property
+    def mode(self):
+        return 'rb'
+
     def readable(self):
         return True
 
@@ -873,7 +877,7 @@ class TarInfo(object):
         pax_headers = ('A dictionary containing key-value pairs of an '
                        'associated pax extended header.'),
         sparse = 'Sparse member information.',
-        tarfile = None,
+        _tarfile = None,
         _sparse_structs = None,
         _link_target = None,
         )
@@ -902,6 +906,24 @@ def __init__(self, name=""):
         self.sparse = None      # sparse member information
         self.pax_headers = {}   # pax header information
 
+    @property
+    def tarfile(self):
+        import warnings
+        warnings.warn(
+            'The undocumented "tarfile" attribute of TarInfo objects '
+            + 'is deprecated and will be removed in Python 3.16',
+            DeprecationWarning, stacklevel=2)
+        return self._tarfile
+
+    @tarfile.setter
+    def tarfile(self, tarfile):
+        import warnings
+        warnings.warn(
+            'The undocumented "tarfile" attribute of TarInfo objects '
+            + 'is deprecated and will be removed in Python 3.16',
+            DeprecationWarning, stacklevel=2)
+        self._tarfile = tarfile
+
     @property
     def path(self):
         'In pax headers, "name" is called "path".'
@@ -1196,7 +1218,7 @@ def _create_pax_generic_header(cls, pax_headers, type, encoding):
         for keyword, value in pax_headers.items():
             keyword = keyword.encode("utf-8")
             if binary:
-                # Try to restore the original byte representation of `value'.
+                # Try to restore the original byte representation of 'value'.
                 # Needless to say, that the encoding must match the string.
                 value = value.encode(encoding, "surrogateescape")
             else:
@@ -1365,7 +1387,7 @@ def _proc_gnulong(self, tarfile):
         # Remove redundant slashes from directories. This is to be consistent
         # with frombuf().
         if next.isdir():
-            next.name = next.name.removesuffix("/")
+            next.name = removesuffix(next.name, "/")
 
         return next
 
@@ -1641,14 +1663,14 @@ class TarFile(object):
     def __init__(self, name=None, mode="r", fileobj=None, format=None,
             tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
             errors="surrogateescape", pax_headers=None, debug=None,
-            errorlevel=None, copybufsize=None):
-        """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
+            errorlevel=None, copybufsize=None, stream=False):
+        """Open an (uncompressed) tar archive 'name'. 'mode' is either 'r' to
            read from an existing archive, 'a' to append data to an existing
-           file or 'w' to create a new file overwriting an existing one. `mode'
+           file or 'w' to create a new file overwriting an existing one. 'mode'
            defaults to 'r'.
-           If `fileobj' is given, it is used for reading or writing data. If it
-           can be determined, `mode' is overridden by `fileobj's mode.
-           `fileobj' is not closed, when TarFile is closed.
+           If 'fileobj' is given, it is used for reading or writing data. If it
+           can be determined, 'mode' is overridden by 'fileobj's mode.
+           'fileobj' is not closed, when TarFile is closed.
         """
         modes = {"r": "rb", "a": "r+b", "w": "wb", "x": "xb"}
         if mode not in modes:
@@ -1673,6 +1695,8 @@ def __init__(self, name=None, mode="r", fileobj=None, format=None,
         self.name = os.path.abspath(name) if name else None
         self.fileobj = fileobj
 
+        self.stream = stream
+
         # Init attributes.
         if format is not None:
             self.format = format
@@ -1975,7 +1999,7 @@ def close(self):
                 self.fileobj.close()
 
     def getmember(self, name):
-        """Return a TarInfo object for member ``name``. If ``name`` can not be
+        """Return a TarInfo object for member 'name'. If 'name' can not be
            found in the archive, KeyError is raised. If a member occurs more
            than once in the archive, its last occurrence is assumed to be the
            most up-to-date version.
@@ -2003,9 +2027,9 @@ def getnames(self):
 
     def gettarinfo(self, name=None, arcname=None, fileobj=None):
         """Create a TarInfo object from the result of os.stat or equivalent
-           on an existing file. The file is either named by ``name``, or
-           specified as a file object ``fileobj`` with a file descriptor. If
-           given, ``arcname`` specifies an alternative name for the file in the
+           on an existing file. The file is either named by 'name', or
+           specified as a file object 'fileobj' with a file descriptor. If
+           given, 'arcname' specifies an alternative name for the file in the
            archive, otherwise, the name is taken from the 'name' attribute of
            'fileobj', or the 'name' argument. The name should be a text
            string.
@@ -2029,7 +2053,7 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
         # Now, fill the TarInfo object with
         # information specific for the file.
         tarinfo = self.tarinfo()
-        tarinfo.tarfile = self  # Not needed
+        tarinfo._tarfile = self  # To be removed in 3.16.
 
         # Use os.stat or os.lstat, depending on if symlinks shall be resolved.
         if fileobj is None:
@@ -2101,11 +2125,15 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
         return tarinfo
 
     def list(self, verbose=True, *, members=None):
-        """Print a table of contents to sys.stdout. If ``verbose`` is False, only
-           the names of the members are printed. If it is True, an `ls -l'-like
-           output is produced. ``members`` is optional and must be a subset of the
+        """Print a table of contents to sys.stdout. If 'verbose' is False, only
+           the names of the members are printed. If it is True, an 'ls -l'-like
+           output is produced. 'members' is optional and must be a subset of the
            list returned by getmembers().
         """
+        # Convert tarinfo type to stat type.
+        type2mode = {REGTYPE: stat.S_IFREG, SYMTYPE: stat.S_IFLNK,
+                     FIFOTYPE: stat.S_IFIFO, CHRTYPE: stat.S_IFCHR,
+                     DIRTYPE: stat.S_IFDIR, BLKTYPE: stat.S_IFBLK}
         self._check()
 
         if members is None:
@@ -2115,7 +2143,8 @@ def list(self, verbose=True, *, members=None):
                 if tarinfo.mode is None:
                     _safe_print("??????????")
                 else:
-                    _safe_print(stat.filemode(tarinfo.mode))
+                    modetype = type2mode.get(tarinfo.type, 0)
+                    _safe_print(stat.filemode(modetype | tarinfo.mode))
                 _safe_print("%s/%s" % (tarinfo.uname or tarinfo.uid,
                                        tarinfo.gname or tarinfo.gid))
                 if tarinfo.ischr() or tarinfo.isblk():
@@ -2139,11 +2168,11 @@ def list(self, verbose=True, *, members=None):
             print()
 
     def add(self, name, arcname=None, recursive=True, *, filter=None):
-        """Add the file ``name`` to the archive. ``name`` may be any type of file
-           (directory, fifo, symbolic link, etc.). If given, ``arcname``
+        """Add the file 'name' to the archive. 'name' may be any type of file
+           (directory, fifo, symbolic link, etc.). If given, 'arcname'
            specifies an alternative name for the file in the archive.
            Directories are added recursively by default. This can be avoided by
-           setting ``recursive`` to False. ``filter`` is a function
+           setting 'recursive' to False. 'filter' is a function
            that expects a TarInfo object argument and returns the changed
            TarInfo object, if it returns None the TarInfo object will be
            excluded from the archive.
@@ -2190,13 +2219,16 @@ def add(self, name, arcname=None, recursive=True, *, filter=None):
             self.addfile(tarinfo)
 
     def addfile(self, tarinfo, fileobj=None):
-        """Add the TarInfo object ``tarinfo`` to the archive. If ``fileobj`` is
-           given, it should be a binary file, and tarinfo.size bytes are read
-           from it and added to the archive. You can create TarInfo objects
-           directly, or by using gettarinfo().
+        """Add the TarInfo object 'tarinfo' to the archive. If 'tarinfo' represents
+           a non zero-size regular file, the 'fileobj' argument should be a binary file,
+           and tarinfo.size bytes are read from it and added to the archive.
+           You can create TarInfo objects directly, or by using gettarinfo().
         """
         self._check("awx")
 
+        if fileobj is None and tarinfo.isreg() and tarinfo.size != 0:
+            raise ValueError("fileobj not provided for non zero-size regular file")
+
         tarinfo = copy.copy(tarinfo)
 
         buf = tarinfo.tobuf(self.format, self.encoding, self.errors)
@@ -2218,11 +2250,12 @@ def _get_filter_function(self, filter):
         if filter is None:
             filter = self.extraction_filter
             if filter is None:
+                import warnings
                 warnings.warn(
                     'Python 3.14 will, by default, filter extracted tar '
                     + 'archives and reject files or modify their metadata. '
                     + 'Use the filter argument to control this behavior.',
-                    DeprecationWarning)
+                    DeprecationWarning, stacklevel=3)
                 return fully_trusted_filter
             if isinstance(filter, str):
                 raise TypeError(
@@ -2241,12 +2274,12 @@ def extractall(self, path=".", members=None, *, numeric_owner=False,
                    filter=None):
         """Extract all members from the archive to the current working
            directory and set owner, modification time and permissions on
-           directories afterwards. `path' specifies a different directory
-           to extract to. `members' is optional and must be a subset of the
-           list returned by getmembers(). If `numeric_owner` is True, only
+           directories afterwards. 'path' specifies a different directory
+           to extract to. 'members' is optional and must be a subset of the
+           list returned by getmembers(). If 'numeric_owner' is True, only
            the numbers for user/group names are used and not the names.
 
-           The `filter` function will be called on each member just
+           The 'filter' function will be called on each member just
            before extraction.
            It can return a changed TarInfo or None to skip the member.
            String names of common filters are accepted.
@@ -2286,13 +2319,13 @@ def extract(self, member, path="", set_attrs=True, *, numeric_owner=False,
                 filter=None):
         """Extract a member from the archive to the current working directory,
            using its full name. Its file information is extracted as accurately
-           as possible. `member' may be a filename or a TarInfo object. You can
-           specify a different directory using `path'. File attributes (owner,
-           mtime, mode) are set unless `set_attrs' is False. If `numeric_owner`
+           as possible. 'member' may be a filename or a TarInfo object. You can
+           specify a different directory using 'path'. File attributes (owner,
+           mtime, mode) are set unless 'set_attrs' is False. If 'numeric_owner'
            is True, only the numbers for user/group names are used and not
            the names.
 
-           The `filter` function will be called before extraction.
+           The 'filter' function will be called before extraction.
            It can return a changed TarInfo or None to skip the member.
            String names of common filters are accepted.
         """
@@ -2357,10 +2390,10 @@ def _handle_fatal_error(self, e):
             self._dbg(1, "tarfile: %s %s" % (type(e).__name__, e))
 
     def extractfile(self, member):
-        """Extract a member from the archive as a file object. ``member`` may be
-           a filename or a TarInfo object. If ``member`` is a regular file or
+        """Extract a member from the archive as a file object. 'member' may be
+           a filename or a TarInfo object. If 'member' is a regular file or
            a link, an io.BufferedReader object is returned. For all other
-           existing members, None is returned. If ``member`` does not appear
+           existing members, None is returned. If 'member' does not appear
            in the archive, KeyError is raised.
         """
         self._check("r")
@@ -2404,7 +2437,7 @@ def _extract_member(self, tarinfo, targetpath, set_attrs=True,
         if upperdirs and not os.path.exists(upperdirs):
             # Create directories that are not part of the archive with
             # default permissions.
-            os.makedirs(upperdirs)
+            os.makedirs(upperdirs, exist_ok=True)
 
         if tarinfo.islnk() or tarinfo.issym():
             self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname))
@@ -2557,7 +2590,8 @@ def chown(self, tarinfo, targetpath, numeric_owner):
                     os.lchown(targetpath, u, g)
                 else:
                     os.chown(targetpath, u, g)
-            except OSError as e:
+            except (OSError, OverflowError) as e:
+                # OverflowError can be raised if an ID doesn't fit in 'id_t'
                 raise ExtractError("could not change owner") from e
 
     def chmod(self, tarinfo, targetpath):
@@ -2640,7 +2674,9 @@ def next(self):
             break
 
         if tarinfo is not None:
-            self.members.append(tarinfo)
+            # if streaming the file we do not want to cache the tarinfo
+            if not self.stream:
+                self.members.append(tarinfo)
         else:
             self._loaded = True
 
@@ -2691,11 +2727,12 @@ def _getmember(self, name, tarinfo=None, normalize=False):
 
     def _load(self):
         """Read through the entire archive file and look for readable
-           members.
+           members. This should not run if the file is set to stream.
         """
-        while self.next() is not None:
-            pass
-        self._loaded = True
+        if not self.stream:
+            while self.next() is not None:
+                pass
+            self._loaded = True
 
     def _check(self, mode=None):
         """Check if TarFile is still open, and if the operation's mode
diff --git a/pkg_resources/_vendor/backports/tarfile/__main__.py b/pkg_resources/_vendor/backports/tarfile/__main__.py
new file mode 100644
index 0000000000..daf5509086
--- /dev/null
+++ b/pkg_resources/_vendor/backports/tarfile/__main__.py
@@ -0,0 +1,5 @@
+from . import main
+
+
+if __name__ == '__main__':
+    main()
diff --git a/pkg_resources/_vendor/__init__.py b/pkg_resources/_vendor/backports/tarfile/compat/__init__.py
similarity index 100%
rename from pkg_resources/_vendor/__init__.py
rename to pkg_resources/_vendor/backports/tarfile/compat/__init__.py
diff --git a/pkg_resources/_vendor/backports/tarfile/compat/py38.py b/pkg_resources/_vendor/backports/tarfile/compat/py38.py
new file mode 100644
index 0000000000..20fbbfc1c0
--- /dev/null
+++ b/pkg_resources/_vendor/backports/tarfile/compat/py38.py
@@ -0,0 +1,24 @@
+import sys
+
+
+if sys.version_info < (3, 9):
+
+    def removesuffix(self, suffix):
+        # suffix='' should not call self[:-0].
+        if suffix and self.endswith(suffix):
+            return self[: -len(suffix)]
+        else:
+            return self[:]
+
+    def removeprefix(self, prefix):
+        if self.startswith(prefix):
+            return self[len(prefix) :]
+        else:
+            return self[:]
+else:
+
+    def removesuffix(self, suffix):
+        return self.removesuffix(suffix)
+
+    def removeprefix(self, prefix):
+        return self.removeprefix(prefix)
diff --git a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/RECORD b/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/RECORD
deleted file mode 100644
index ba764991ee..0000000000
--- a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/RECORD
+++ /dev/null
@@ -1,77 +0,0 @@
-importlib_resources-5.10.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-importlib_resources-5.10.2.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
-importlib_resources-5.10.2.dist-info/METADATA,sha256=Xo5ntATvDYUxdmW8tr8kxtfdiOC9889mOk-LE1LtZfI,4111
-importlib_resources-5.10.2.dist-info/RECORD,,
-importlib_resources-5.10.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources-5.10.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
-importlib_resources-5.10.2.dist-info/top_level.txt,sha256=fHIjHU1GZwAjvcydpmUnUrTnbvdiWjG4OEVZK8by0TQ,20
-importlib_resources/__init__.py,sha256=evPm12kLgYqTm-pbzm60bOuumumT8IpBNWFp0uMyrzE,506
-importlib_resources/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/__pycache__/_adapters.cpython-312.pyc,,
-importlib_resources/__pycache__/_common.cpython-312.pyc,,
-importlib_resources/__pycache__/_compat.cpython-312.pyc,,
-importlib_resources/__pycache__/_itertools.cpython-312.pyc,,
-importlib_resources/__pycache__/_legacy.cpython-312.pyc,,
-importlib_resources/__pycache__/abc.cpython-312.pyc,,
-importlib_resources/__pycache__/readers.cpython-312.pyc,,
-importlib_resources/__pycache__/simple.cpython-312.pyc,,
-importlib_resources/_adapters.py,sha256=o51tP2hpVtohP33gSYyAkGNpLfYDBqxxYsadyiRZi1E,4504
-importlib_resources/_common.py,sha256=jSC4xfLdcMNbtbWHtpzbFkNa0W7kvf__nsYn14C_AEU,5457
-importlib_resources/_compat.py,sha256=dSadF6WPt8MwOqSm_NIOQPhw4x0iaMYTWxi-XS93p7M,2923
-importlib_resources/_itertools.py,sha256=WCdJ1Gs_kNFwKENyIG7TO0Y434IWCu0zjVVSsSbZwU8,884
-importlib_resources/_legacy.py,sha256=0TKdZixxLWA-xwtAZw4HcpqJmj4Xprx1Zkcty0gTRZY,3481
-importlib_resources/abc.py,sha256=Icr2IJ2QtH7vvAB9vC5WRJ9KBoaDyJa7KUs8McuROzo,5140
-importlib_resources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/readers.py,sha256=PZsi5qacr2Qn3KHw4qw3Gm1MzrBblPHoTdjqjH7EKWw,3581
-importlib_resources/simple.py,sha256=0__2TQBTQoqkajYmNPt1HxERcReAT6boVKJA328pr04,2576
-importlib_resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/_compat.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/_path.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_compatibilty_files.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_contents.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_files.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_open.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_path.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_read.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_reader.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_resource.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/update-zips.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/util.cpython-312.pyc,,
-importlib_resources/tests/_compat.py,sha256=YTSB0U1R9oADnh6GrQcOCgojxcF_N6H1LklymEWf9SQ,708
-importlib_resources/tests/_path.py,sha256=yZyWsQzJZQ1Z8ARAxWkjAdaVVsjlzyqxO0qjBUofJ8M,1039
-importlib_resources/tests/data01/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data01/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/data01/subdirectory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data01/subdirectory/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data01/subdirectory/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/data01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
-importlib_resources/tests/data01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
-importlib_resources/tests/data02/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/one/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/one/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/one/resource1.txt,sha256=10flKac7c-XXFzJ3t-AB5MJjlBy__dSZvPE_dOm2q6U,13
-importlib_resources/tests/data02/two/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/two/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/two/resource2.txt,sha256=lt2jbN3TMn9QiFKM832X39bU_62UptDdUkoYzkvEbl0,13
-importlib_resources/tests/namespacedata01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/namespacedata01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
-importlib_resources/tests/namespacedata01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
-importlib_resources/tests/test_compatibilty_files.py,sha256=NWkbIsylI8Wz3Dwsxo1quT4ZI6ToXFA2mojCG6Dzuxw,3260
-importlib_resources/tests/test_contents.py,sha256=V1Xfk3lqTDdvUsZuV18Kndf0CT_tkM2oEIwk9Vv0rhg,968
-importlib_resources/tests/test_files.py,sha256=1Y8da-g0xOQLzuREDYUiRc_qhWlvFNeydW_mUH7l15w,3251
-importlib_resources/tests/test_open.py,sha256=pmEgdrSFdM83L6FxtR8U_RT9BfI3JZ4snGmM_ZZIegY,2565
-importlib_resources/tests/test_path.py,sha256=xvPteNA-UKavDhKgLgrQuXSxKWYH7Q4nSNDVfBX95Gs,2103
-importlib_resources/tests/test_read.py,sha256=EyYvpHJ_7F4LuX2EU_c5EerIBQfRhOFmiIR7LOc5Y5E,2408
-importlib_resources/tests/test_reader.py,sha256=nPhldbYPq3fXoQs0ZAub4atjhp2lgNyLNv2G1pg6Agw,4480
-importlib_resources/tests/test_resource.py,sha256=EMoarxTEHcrq8R41LQDsndIG8Idtm4I_LpN8DYpHtT0,8478
-importlib_resources/tests/update-zips.py,sha256=x-SrO5v87iLLUMXyefxDwAd3imAs_slI94sLWvJ6N40,1417
-importlib_resources/tests/util.py,sha256=ARAlxZ47wC-lgR7PGlmgBoi4HnhzcykD5Is2-TAwY0I,4873
-importlib_resources/tests/zipdata01/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/zipdata01/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/zipdata01/ziptestdata.zip,sha256=z5Of4dsv3T0t-46B0MsVhxlhsPGMz28aUhJDWpj3_oY,876
-importlib_resources/tests/zipdata02/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/zipdata02/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/zipdata02/ziptestdata.zip,sha256=ydI-_j-xgQ7tDxqBp9cjOqXBGxUp6ZBbwVJu6Xj-nrY,698
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/INSTALLER b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/INSTALLER
rename to pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/LICENSE b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/LICENSE
similarity index 100%
rename from pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/LICENSE
rename to pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/LICENSE
diff --git a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/METADATA b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/METADATA
similarity index 67%
rename from pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/METADATA
rename to pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/METADATA
index a9995f09a3..b088e721d2 100644
--- a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/METADATA
+++ b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/METADATA
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
-Name: importlib-resources
-Version: 5.10.2
+Name: importlib_resources
+Version: 6.4.0
 Summary: Read resources from Python packages
 Home-page: https://github.com/python/importlib_resources
 Author: Barry Warsaw
@@ -11,43 +11,44 @@ Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.7
+Requires-Python: >=3.8
 License-File: LICENSE
-Requires-Dist: zipp (>=3.1.0) ; python_version < "3.10"
+Requires-Dist: zipp >=3.1.0 ; python_version < "3.10"
 Provides-Extra: docs
-Requires-Dist: sphinx (>=3.5) ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=9) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
+Requires-Dist: sphinx >=3.5 ; extra == 'docs'
+Requires-Dist: sphinx <7.2.5 ; extra == 'docs'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
+Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
 Requires-Dist: furo ; extra == 'docs'
 Requires-Dist: sphinx-lint ; extra == 'docs'
-Requires-Dist: jaraco.tidelift (>=1.4) ; extra == 'docs'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'docs'
 Provides-Extra: testing
-Requires-Dist: pytest (>=6) ; extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
-Requires-Dist: flake8 (<5) ; extra == 'testing'
+Requires-Dist: pytest >=6 ; extra == 'testing'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
 Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler (>=1.3) ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy (>=0.9.1) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-flake8 ; (python_version < "3.12") and extra == 'testing'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
+Requires-Dist: zipp >=3.17 ; extra == 'testing'
+Requires-Dist: jaraco.test >=5.4 ; extra == 'testing'
+Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
 
 .. image:: https://img.shields.io/pypi/v/importlib_resources.svg
    :target: https://pypi.org/project/importlib_resources
 
 .. image:: https://img.shields.io/pypi/pyversions/importlib_resources.svg
 
-.. image:: https://github.com/python/importlib_resources/workflows/tests/badge.svg
+.. image:: https://github.com/python/importlib_resources/actions/workflows/main.yml/badge.svg
    :target: https://github.com/python/importlib_resources/actions?query=workflow%3A%22tests%22
    :alt: tests
 
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
 
 .. image:: https://readthedocs.org/projects/importlib-resources/badge/?version=latest
    :target: https://importlib-resources.readthedocs.io/en/latest/?badge=latest
 
-.. image:: https://img.shields.io/badge/skeleton-2022-informational
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
    :target: https://blog.jaraco.com/skeleton
 
 .. image:: https://tidelift.com/badges/package/pypi/importlib-resources
@@ -76,7 +77,9 @@ were contributed to different versions in the standard library:
 
    * - importlib_resources
      - stdlib
-   * - 5.9
+   * - 6.0
+     - 3.13
+   * - 5.12
      - 3.12
    * - 5.7
      - 3.11
@@ -95,10 +98,3 @@ Available as part of the Tidelift Subscription.
 This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
 
 `Learn more `_.
-
-Security Contact
-================
-
-To report a security vulnerability, please use the
-`Tidelift security contact `_.
-Tidelift will coordinate the fix and disclosure.
diff --git a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD
new file mode 100644
index 0000000000..18888dea71
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD
@@ -0,0 +1,89 @@
+importlib_resources-6.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+importlib_resources-6.4.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
+importlib_resources-6.4.0.dist-info/METADATA,sha256=g4eM2LuL0OiZcUVND0qwDJUpE29gOvtO3BSPXTbO9Fk,3944
+importlib_resources-6.4.0.dist-info/RECORD,,
+importlib_resources-6.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources-6.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+importlib_resources-6.4.0.dist-info/top_level.txt,sha256=fHIjHU1GZwAjvcydpmUnUrTnbvdiWjG4OEVZK8by0TQ,20
+importlib_resources/__init__.py,sha256=uyp1kzYR6SawQBsqlyaXXfIxJx4Z2mM8MjmZn8qq2Gk,505
+importlib_resources/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/__pycache__/_adapters.cpython-312.pyc,,
+importlib_resources/__pycache__/_common.cpython-312.pyc,,
+importlib_resources/__pycache__/_itertools.cpython-312.pyc,,
+importlib_resources/__pycache__/abc.cpython-312.pyc,,
+importlib_resources/__pycache__/functional.cpython-312.pyc,,
+importlib_resources/__pycache__/readers.cpython-312.pyc,,
+importlib_resources/__pycache__/simple.cpython-312.pyc,,
+importlib_resources/_adapters.py,sha256=vprJGbUeHbajX6XCuMP6J3lMrqCi-P_MTlziJUR7jfk,4482
+importlib_resources/_common.py,sha256=blt4-ZtHnbUPzQQyPP7jLGgl_86btIW5ZhIsEhclhoA,5571
+importlib_resources/_itertools.py,sha256=eDisV6RqiNZOogLSXf6LOGHOYc79FGgPrKNLzFLmCrU,1277
+importlib_resources/abc.py,sha256=UKNU9ncEDkZRB3txcGb3WLxsL2iju9JbaLTI-dfLE_4,5162
+importlib_resources/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/compat/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/compat/__pycache__/py38.cpython-312.pyc,,
+importlib_resources/compat/__pycache__/py39.cpython-312.pyc,,
+importlib_resources/compat/py38.py,sha256=MWhut3XsAJwBYUaa5Qb2AoCrZNqcQjVThP-P1uBoE_4,230
+importlib_resources/compat/py39.py,sha256=Wfln4uQUShNz1XdCG-toG6_Y0WrlUmO9JzpvtcfQ-Cw,184
+importlib_resources/functional.py,sha256=mLU4DwSlh8_2IXWqwKOfPVxyRqAEpB3B4XTfRxr3X3M,2651
+importlib_resources/future/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/future/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/future/__pycache__/adapters.cpython-312.pyc,,
+importlib_resources/future/adapters.py,sha256=1-MF2VRcCButhcC1OMfZILU9o3kwZ4nXB2lurXpaIAw,2940
+importlib_resources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/readers.py,sha256=WNKurBHHVu9EVtUhWkOj2fxH50HP7uanNFuupAqH2S8,5863
+importlib_resources/simple.py,sha256=CQ3TiIMFiJs_80o-7xJL1EpbUUVna4-NGDrSTQ3HW2Y,2584
+importlib_resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/_path.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_compatibilty_files.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_contents.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_custom.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_files.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_functional.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_open.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_path.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_read.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_reader.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/test_resource.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/util.cpython-312.pyc,,
+importlib_resources/tests/__pycache__/zip.cpython-312.pyc,,
+importlib_resources/tests/_path.py,sha256=nkv3ek7D1U898v921rYbldDCtKri2oyYOi3EJqGjEGU,1289
+importlib_resources/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/compat/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/compat/__pycache__/py312.cpython-312.pyc,,
+importlib_resources/tests/compat/__pycache__/py39.cpython-312.pyc,,
+importlib_resources/tests/compat/py312.py,sha256=qcWjpZhQo2oEsdwIlRRQHrsMGDltkFTnETeG7fLdUS8,364
+importlib_resources/tests/compat/py39.py,sha256=lRTk0RWAOEb9RzAgvdRnqJUGCBLc3qoFQwzuJSa_zP4,329
+importlib_resources/tests/data01/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data01/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
+importlib_resources/tests/data01/subdirectory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data01/subdirectory/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data01/subdirectory/binary.file,sha256=xtRM9Bj2EOP-nh2SlP9D3vgcbNytbLsYIM_0jTqkNV0,4
+importlib_resources/tests/data01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
+importlib_resources/tests/data01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
+importlib_resources/tests/data02/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data02/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data02/one/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data02/one/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data02/one/resource1.txt,sha256=10flKac7c-XXFzJ3t-AB5MJjlBy__dSZvPE_dOm2q6U,13
+importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt,sha256=jnrBBztxYrtQck7cmVnc4xQVO4-agzAZDGSFkAWtlFw,10
+importlib_resources/tests/data02/two/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_resources/tests/data02/two/__pycache__/__init__.cpython-312.pyc,,
+importlib_resources/tests/data02/two/resource2.txt,sha256=lt2jbN3TMn9QiFKM832X39bU_62UptDdUkoYzkvEbl0,13
+importlib_resources/tests/namespacedata01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
+importlib_resources/tests/namespacedata01/subdirectory/binary.file,sha256=cbkhEL8TXIVYHIoSj2oZwPasp1KwxskeNXGJnPCbFF0,4
+importlib_resources/tests/namespacedata01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
+importlib_resources/tests/namespacedata01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
+importlib_resources/tests/test_compatibilty_files.py,sha256=95N_R7aik8cvnE6sBJpsxmP0K5plOWRIJDgbalD-Hpw,3314
+importlib_resources/tests/test_contents.py,sha256=70HW3mL_hv05Emv-OgdmwoLhXxjtuVxiWVaUpgRaRWA,930
+importlib_resources/tests/test_custom.py,sha256=QrHZqIWl0e-fsQRfm0ych8stOlKJOsAIU3rK6QOcyN0,1221
+importlib_resources/tests/test_files.py,sha256=OcShYu33kCcyXlDyZSVPkJNE08h-N_4bQOLV2QaSqX0,3472
+importlib_resources/tests/test_functional.py,sha256=ByCVViAwb2PIlKvDNJEqTZ0aLZGpFl5qa7CMCX-7HKM,8591
+importlib_resources/tests/test_open.py,sha256=ccmzbOeEa6zTd4ymZZ8yISrecfuYV0jhon-Vddqysu4,2778
+importlib_resources/tests/test_path.py,sha256=x8r2gJxG3hFM9xCOFNkgmHYXxsMldMLTSW_AZYf1l-A,2009
+importlib_resources/tests/test_read.py,sha256=7tsILQ2NoqVGFQxhHqxBwc5hWcN8b_3idojCsszTNfQ,3112
+importlib_resources/tests/test_reader.py,sha256=IcIUXaiPAtuahGV4_ZT4YXFLMMsJmcM1iOxqdIH2Aa4,5001
+importlib_resources/tests/test_resource.py,sha256=fcF8WgZ6rDCTRFnxtAUbdiaNe4G23yGovT1nb2dc7ls,7823
+importlib_resources/tests/util.py,sha256=vjVzEyX0X2RkTN-wGiQiplayp9sZom4JDjJinTNewos,4745
+importlib_resources/tests/zip.py,sha256=2MKmF8-osXBJSnqcUTuAUek_-tSB3iKmIT9qPhcsOsM,783
diff --git a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/REQUESTED b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/REQUESTED
similarity index 100%
rename from pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/REQUESTED
rename to pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/REQUESTED
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/WHEEL b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
similarity index 65%
rename from pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/WHEEL
rename to pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
index ba48cbcf92..bab98d6758 100644
--- a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/WHEEL
+++ b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
@@ -1,5 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.41.3)
+Generator: bdist_wheel (0.43.0)
 Root-Is-Purelib: true
 Tag: py3-none-any
 
diff --git a/pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/top_level.txt b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt
similarity index 100%
rename from pkg_resources/_vendor/importlib_resources-5.10.2.dist-info/top_level.txt
rename to pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt
diff --git a/pkg_resources/_vendor/importlib_resources/__init__.py b/pkg_resources/_vendor/importlib_resources/__init__.py
index 34e3a9950c..0d029abd63 100644
--- a/pkg_resources/_vendor/importlib_resources/__init__.py
+++ b/pkg_resources/_vendor/importlib_resources/__init__.py
@@ -4,17 +4,17 @@
     as_file,
     files,
     Package,
+    Anchor,
 )
 
-from ._legacy import (
+from .functional import (
     contents,
+    is_resource,
     open_binary,
-    read_binary,
     open_text,
-    read_text,
-    is_resource,
     path,
-    Resource,
+    read_binary,
+    read_text,
 )
 
 from .abc import ResourceReader
@@ -22,11 +22,11 @@
 
 __all__ = [
     'Package',
-    'Resource',
+    'Anchor',
     'ResourceReader',
     'as_file',
-    'contents',
     'files',
+    'contents',
     'is_resource',
     'open_binary',
     'open_text',
diff --git a/pkg_resources/_vendor/importlib_resources/_adapters.py b/pkg_resources/_vendor/importlib_resources/_adapters.py
index ea363d86a5..50688fbb66 100644
--- a/pkg_resources/_vendor/importlib_resources/_adapters.py
+++ b/pkg_resources/_vendor/importlib_resources/_adapters.py
@@ -34,9 +34,7 @@ def _io_wrapper(file, mode='r', *args, **kwargs):
         return TextIOWrapper(file, *args, **kwargs)
     elif mode == 'rb':
         return file
-    raise ValueError(
-        "Invalid mode value '{}', only 'r' and 'rb' are supported".format(mode)
-    )
+    raise ValueError(f"Invalid mode value '{mode}', only 'r' and 'rb' are supported")
 
 
 class CompatibilityFiles:
diff --git a/pkg_resources/_vendor/importlib_resources/_common.py b/pkg_resources/_vendor/importlib_resources/_common.py
index 3c6de1cfb2..8df6b39e41 100644
--- a/pkg_resources/_vendor/importlib_resources/_common.py
+++ b/pkg_resources/_vendor/importlib_resources/_common.py
@@ -12,8 +12,6 @@
 from typing import Union, Optional, cast
 from .abc import ResourceReader, Traversable
 
-from ._compat import wrap_spec
-
 Package = Union[types.ModuleType, str]
 Anchor = Package
 
@@ -27,6 +25,8 @@ def package_to_anchor(func):
     >>> files('a', 'b')
     Traceback (most recent call last):
     TypeError: files() takes from 0 to 1 positional arguments but 2 were given
+
+    Remove this compatibility in Python 3.14.
     """
     undefined = object()
 
@@ -109,6 +109,9 @@ def from_package(package: types.ModuleType):
     Return a Traversable object for the given package.
 
     """
+    # deferred for performance (python/cpython#109829)
+    from .future.adapters import wrap_spec
+
     spec = wrap_spec(package)
     reader = spec.loader.get_resource_reader(spec.name)
     return reader.files()
diff --git a/pkg_resources/_vendor/importlib_resources/_compat.py b/pkg_resources/_vendor/importlib_resources/_compat.py
deleted file mode 100644
index 8b5b1d280f..0000000000
--- a/pkg_resources/_vendor/importlib_resources/_compat.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# flake8: noqa
-
-import abc
-import os
-import sys
-import pathlib
-from contextlib import suppress
-from typing import Union
-
-
-if sys.version_info >= (3, 10):
-    from zipfile import Path as ZipPath  # type: ignore
-else:
-    from ..zipp import Path as ZipPath  # type: ignore
-
-
-try:
-    from typing import runtime_checkable  # type: ignore
-except ImportError:
-
-    def runtime_checkable(cls):  # type: ignore
-        return cls
-
-
-try:
-    from typing import Protocol  # type: ignore
-except ImportError:
-    Protocol = abc.ABC  # type: ignore
-
-
-class TraversableResourcesLoader:
-    """
-    Adapt loaders to provide TraversableResources and other
-    compatibility.
-
-    Used primarily for Python 3.9 and earlier where the native
-    loaders do not yet implement TraversableResources.
-    """
-
-    def __init__(self, spec):
-        self.spec = spec
-
-    @property
-    def path(self):
-        return self.spec.origin
-
-    def get_resource_reader(self, name):
-        from . import readers, _adapters
-
-        def _zip_reader(spec):
-            with suppress(AttributeError):
-                return readers.ZipReader(spec.loader, spec.name)
-
-        def _namespace_reader(spec):
-            with suppress(AttributeError, ValueError):
-                return readers.NamespaceReader(spec.submodule_search_locations)
-
-        def _available_reader(spec):
-            with suppress(AttributeError):
-                return spec.loader.get_resource_reader(spec.name)
-
-        def _native_reader(spec):
-            reader = _available_reader(spec)
-            return reader if hasattr(reader, 'files') else None
-
-        def _file_reader(spec):
-            try:
-                path = pathlib.Path(self.path)
-            except TypeError:
-                return None
-            if path.exists():
-                return readers.FileReader(self)
-
-        return (
-            # native reader if it supplies 'files'
-            _native_reader(self.spec)
-            or
-            # local ZipReader if a zip module
-            _zip_reader(self.spec)
-            or
-            # local NamespaceReader if a namespace module
-            _namespace_reader(self.spec)
-            or
-            # local FileReader
-            _file_reader(self.spec)
-            # fallback - adapt the spec ResourceReader to TraversableReader
-            or _adapters.CompatibilityFiles(self.spec)
-        )
-
-
-def wrap_spec(package):
-    """
-    Construct a package spec with traversable compatibility
-    on the spec/loader/reader.
-
-    Supersedes _adapters.wrap_spec to use TraversableResourcesLoader
-    from above for older Python compatibility (<3.10).
-    """
-    from . import _adapters
-
-    return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
-
-
-if sys.version_info >= (3, 9):
-    StrPath = Union[str, os.PathLike[str]]
-else:
-    # PathLike is only subscriptable at runtime in 3.9+
-    StrPath = Union[str, "os.PathLike[str]"]
diff --git a/pkg_resources/_vendor/importlib_resources/_itertools.py b/pkg_resources/_vendor/importlib_resources/_itertools.py
index cce05582ff..7b775ef5ae 100644
--- a/pkg_resources/_vendor/importlib_resources/_itertools.py
+++ b/pkg_resources/_vendor/importlib_resources/_itertools.py
@@ -1,35 +1,38 @@
-from itertools import filterfalse
+# from more_itertools 9.0
+def only(iterable, default=None, too_long=None):
+    """If *iterable* has only one item, return it.
+    If it has zero items, return *default*.
+    If it has more than one item, raise the exception given by *too_long*,
+    which is ``ValueError`` by default.
+    >>> only([], default='missing')
+    'missing'
+    >>> only([1])
+    1
+    >>> only([1, 2])  # doctest: +IGNORE_EXCEPTION_DETAIL
+    Traceback (most recent call last):
+    ...
+    ValueError: Expected exactly one item in iterable, but got 1, 2,
+     and perhaps more.'
+    >>> only([1, 2], too_long=TypeError)  # doctest: +IGNORE_EXCEPTION_DETAIL
+    Traceback (most recent call last):
+    ...
+    TypeError
+    Note that :func:`only` attempts to advance *iterable* twice to ensure there
+    is only one item.  See :func:`spy` or :func:`peekable` to check
+    iterable contents less destructively.
+    """
+    it = iter(iterable)
+    first_value = next(it, default)
 
-from typing import (
-    Callable,
-    Iterable,
-    Iterator,
-    Optional,
-    Set,
-    TypeVar,
-    Union,
-)
-
-# Type and type variable definitions
-_T = TypeVar('_T')
-_U = TypeVar('_U')
-
-
-def unique_everseen(
-    iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = None
-) -> Iterator[_T]:
-    "List unique elements, preserving order. Remember all elements ever seen."
-    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
-    # unique_everseen('ABBCcAD', str.lower) --> A B C D
-    seen: Set[Union[_T, _U]] = set()
-    seen_add = seen.add
-    if key is None:
-        for element in filterfalse(seen.__contains__, iterable):
-            seen_add(element)
-            yield element
+    try:
+        second_value = next(it)
+    except StopIteration:
+        pass
     else:
-        for element in iterable:
-            k = key(element)
-            if k not in seen:
-                seen_add(k)
-                yield element
+        msg = (
+            'Expected exactly one item in iterable, but got {!r}, {!r}, '
+            'and perhaps more.'.format(first_value, second_value)
+        )
+        raise too_long or ValueError(msg)
+
+    return first_value
diff --git a/pkg_resources/_vendor/importlib_resources/_legacy.py b/pkg_resources/_vendor/importlib_resources/_legacy.py
deleted file mode 100644
index b1ea8105da..0000000000
--- a/pkg_resources/_vendor/importlib_resources/_legacy.py
+++ /dev/null
@@ -1,120 +0,0 @@
-import functools
-import os
-import pathlib
-import types
-import warnings
-
-from typing import Union, Iterable, ContextManager, BinaryIO, TextIO, Any
-
-from . import _common
-
-Package = Union[types.ModuleType, str]
-Resource = str
-
-
-def deprecated(func):
-    @functools.wraps(func)
-    def wrapper(*args, **kwargs):
-        warnings.warn(
-            f"{func.__name__} is deprecated. Use files() instead. "
-            "Refer to https://importlib-resources.readthedocs.io"
-            "/en/latest/using.html#migrating-from-legacy for migration advice.",
-            DeprecationWarning,
-            stacklevel=2,
-        )
-        return func(*args, **kwargs)
-
-    return wrapper
-
-
-def normalize_path(path: Any) -> str:
-    """Normalize a path by ensuring it is a string.
-
-    If the resulting string contains path separators, an exception is raised.
-    """
-    str_path = str(path)
-    parent, file_name = os.path.split(str_path)
-    if parent:
-        raise ValueError(f'{path!r} must be only a file name')
-    return file_name
-
-
-@deprecated
-def open_binary(package: Package, resource: Resource) -> BinaryIO:
-    """Return a file-like object opened for binary reading of the resource."""
-    return (_common.files(package) / normalize_path(resource)).open('rb')
-
-
-@deprecated
-def read_binary(package: Package, resource: Resource) -> bytes:
-    """Return the binary contents of the resource."""
-    return (_common.files(package) / normalize_path(resource)).read_bytes()
-
-
-@deprecated
-def open_text(
-    package: Package,
-    resource: Resource,
-    encoding: str = 'utf-8',
-    errors: str = 'strict',
-) -> TextIO:
-    """Return a file-like object opened for text reading of the resource."""
-    return (_common.files(package) / normalize_path(resource)).open(
-        'r', encoding=encoding, errors=errors
-    )
-
-
-@deprecated
-def read_text(
-    package: Package,
-    resource: Resource,
-    encoding: str = 'utf-8',
-    errors: str = 'strict',
-) -> str:
-    """Return the decoded string of the resource.
-
-    The decoding-related arguments have the same semantics as those of
-    bytes.decode().
-    """
-    with open_text(package, resource, encoding, errors) as fp:
-        return fp.read()
-
-
-@deprecated
-def contents(package: Package) -> Iterable[str]:
-    """Return an iterable of entries in `package`.
-
-    Note that not all entries are resources.  Specifically, directories are
-    not considered resources.  Use `is_resource()` on each entry returned here
-    to check if it is a resource or not.
-    """
-    return [path.name for path in _common.files(package).iterdir()]
-
-
-@deprecated
-def is_resource(package: Package, name: str) -> bool:
-    """True if `name` is a resource inside `package`.
-
-    Directories are *not* resources.
-    """
-    resource = normalize_path(name)
-    return any(
-        traversable.name == resource and traversable.is_file()
-        for traversable in _common.files(package).iterdir()
-    )
-
-
-@deprecated
-def path(
-    package: Package,
-    resource: Resource,
-) -> ContextManager[pathlib.Path]:
-    """A context manager providing a file path object to the resource.
-
-    If the resource does not already exist on its own on the file system,
-    a temporary file will be created. If the file was created, the file
-    will be deleted upon exiting the context manager (no exception is
-    raised if the file was deleted prior to the context manager
-    exiting).
-    """
-    return _common.as_file(_common.files(package) / normalize_path(resource))
diff --git a/pkg_resources/_vendor/importlib_resources/abc.py b/pkg_resources/_vendor/importlib_resources/abc.py
index 23b6aeafe4..7a58dd2f96 100644
--- a/pkg_resources/_vendor/importlib_resources/abc.py
+++ b/pkg_resources/_vendor/importlib_resources/abc.py
@@ -3,8 +3,9 @@
 import itertools
 import pathlib
 from typing import Any, BinaryIO, Iterable, Iterator, NoReturn, Text, Optional
+from typing import runtime_checkable, Protocol
 
-from ._compat import runtime_checkable, Protocol, StrPath
+from .compat.py38 import StrPath
 
 
 __all__ = ["ResourceReader", "Traversable", "TraversableResources"]
diff --git a/pkg_resources/_vendor/importlib_resources/tests/zipdata01/__init__.py b/pkg_resources/_vendor/importlib_resources/compat/__init__.py
similarity index 100%
rename from pkg_resources/_vendor/importlib_resources/tests/zipdata01/__init__.py
rename to pkg_resources/_vendor/importlib_resources/compat/__init__.py
diff --git a/pkg_resources/_vendor/importlib_resources/compat/py38.py b/pkg_resources/_vendor/importlib_resources/compat/py38.py
new file mode 100644
index 0000000000..4d548257f8
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/compat/py38.py
@@ -0,0 +1,11 @@
+import os
+import sys
+
+from typing import Union
+
+
+if sys.version_info >= (3, 9):
+    StrPath = Union[str, os.PathLike[str]]
+else:
+    # PathLike is only subscriptable at runtime in 3.9+
+    StrPath = Union[str, "os.PathLike[str]"]
diff --git a/pkg_resources/_vendor/importlib_resources/compat/py39.py b/pkg_resources/_vendor/importlib_resources/compat/py39.py
new file mode 100644
index 0000000000..ab87b9dc14
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/compat/py39.py
@@ -0,0 +1,10 @@
+import sys
+
+
+__all__ = ['ZipPath']
+
+
+if sys.version_info >= (3, 10):
+    from zipfile import Path as ZipPath  # type: ignore
+else:
+    from zipp import Path as ZipPath  # type: ignore
diff --git a/pkg_resources/_vendor/importlib_resources/functional.py b/pkg_resources/_vendor/importlib_resources/functional.py
new file mode 100644
index 0000000000..f59416f2dd
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/functional.py
@@ -0,0 +1,81 @@
+"""Simplified function-based API for importlib.resources"""
+
+import warnings
+
+from ._common import files, as_file
+
+
+_MISSING = object()
+
+
+def open_binary(anchor, *path_names):
+    """Open for binary reading the *resource* within *package*."""
+    return _get_resource(anchor, path_names).open('rb')
+
+
+def open_text(anchor, *path_names, encoding=_MISSING, errors='strict'):
+    """Open for text reading the *resource* within *package*."""
+    encoding = _get_encoding_arg(path_names, encoding)
+    resource = _get_resource(anchor, path_names)
+    return resource.open('r', encoding=encoding, errors=errors)
+
+
+def read_binary(anchor, *path_names):
+    """Read and return contents of *resource* within *package* as bytes."""
+    return _get_resource(anchor, path_names).read_bytes()
+
+
+def read_text(anchor, *path_names, encoding=_MISSING, errors='strict'):
+    """Read and return contents of *resource* within *package* as str."""
+    encoding = _get_encoding_arg(path_names, encoding)
+    resource = _get_resource(anchor, path_names)
+    return resource.read_text(encoding=encoding, errors=errors)
+
+
+def path(anchor, *path_names):
+    """Return the path to the *resource* as an actual file system path."""
+    return as_file(_get_resource(anchor, path_names))
+
+
+def is_resource(anchor, *path_names):
+    """Return ``True`` if there is a resource named *name* in the package,
+
+    Otherwise returns ``False``.
+    """
+    return _get_resource(anchor, path_names).is_file()
+
+
+def contents(anchor, *path_names):
+    """Return an iterable over the named resources within the package.
+
+    The iterable returns :class:`str` resources (e.g. files).
+    The iterable does not recurse into subdirectories.
+    """
+    warnings.warn(
+        "importlib.resources.contents is deprecated. "
+        "Use files(anchor).iterdir() instead.",
+        DeprecationWarning,
+        stacklevel=1,
+    )
+    return (resource.name for resource in _get_resource(anchor, path_names).iterdir())
+
+
+def _get_encoding_arg(path_names, encoding):
+    # For compatibility with versions where *encoding* was a positional
+    # argument, it needs to be given explicitly when there are multiple
+    # *path_names*.
+    # This limitation can be removed in Python 3.15.
+    if encoding is _MISSING:
+        if len(path_names) > 1:
+            raise TypeError(
+                "'encoding' argument required with multiple path names",
+            )
+        else:
+            return 'utf-8'
+    return encoding
+
+
+def _get_resource(anchor, path_names):
+    if anchor is None:
+        raise TypeError("anchor must be module or string, got None")
+    return files(anchor).joinpath(*path_names)
diff --git a/pkg_resources/_vendor/importlib_resources/tests/zipdata02/__init__.py b/pkg_resources/_vendor/importlib_resources/future/__init__.py
similarity index 100%
rename from pkg_resources/_vendor/importlib_resources/tests/zipdata02/__init__.py
rename to pkg_resources/_vendor/importlib_resources/future/__init__.py
diff --git a/pkg_resources/_vendor/importlib_resources/future/adapters.py b/pkg_resources/_vendor/importlib_resources/future/adapters.py
new file mode 100644
index 0000000000..0e9764bae8
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/future/adapters.py
@@ -0,0 +1,95 @@
+import functools
+import pathlib
+from contextlib import suppress
+from types import SimpleNamespace
+
+from .. import readers, _adapters
+
+
+def _block_standard(reader_getter):
+    """
+    Wrap _adapters.TraversableResourcesLoader.get_resource_reader
+    and intercept any standard library readers.
+    """
+
+    @functools.wraps(reader_getter)
+    def wrapper(*args, **kwargs):
+        """
+        If the reader is from the standard library, return None to allow
+        allow likely newer implementations in this library to take precedence.
+        """
+        try:
+            reader = reader_getter(*args, **kwargs)
+        except NotADirectoryError:
+            # MultiplexedPath may fail on zip subdirectory
+            return
+        # Python 3.10+
+        mod_name = reader.__class__.__module__
+        if mod_name.startswith('importlib.') and mod_name.endswith('readers'):
+            return
+        # Python 3.8, 3.9
+        if isinstance(reader, _adapters.CompatibilityFiles) and (
+            reader.spec.loader.__class__.__module__.startswith('zipimport')
+            or reader.spec.loader.__class__.__module__.startswith(
+                '_frozen_importlib_external'
+            )
+        ):
+            return
+        return reader
+
+    return wrapper
+
+
+def _skip_degenerate(reader):
+    """
+    Mask any degenerate reader. Ref #298.
+    """
+    is_degenerate = (
+        isinstance(reader, _adapters.CompatibilityFiles) and not reader._reader
+    )
+    return reader if not is_degenerate else None
+
+
+class TraversableResourcesLoader(_adapters.TraversableResourcesLoader):
+    """
+    Adapt loaders to provide TraversableResources and other
+    compatibility.
+
+    Ensures the readers from importlib_resources are preferred
+    over stdlib readers.
+    """
+
+    def get_resource_reader(self, name):
+        return (
+            _skip_degenerate(_block_standard(super().get_resource_reader)(name))
+            or self._standard_reader()
+            or super().get_resource_reader(name)
+        )
+
+    def _standard_reader(self):
+        return self._zip_reader() or self._namespace_reader() or self._file_reader()
+
+    def _zip_reader(self):
+        with suppress(AttributeError):
+            return readers.ZipReader(self.spec.loader, self.spec.name)
+
+    def _namespace_reader(self):
+        with suppress(AttributeError, ValueError):
+            return readers.NamespaceReader(self.spec.submodule_search_locations)
+
+    def _file_reader(self):
+        try:
+            path = pathlib.Path(self.spec.origin)
+        except TypeError:
+            return None
+        if path.exists():
+            return readers.FileReader(SimpleNamespace(path=path))
+
+
+def wrap_spec(package):
+    """
+    Override _adapters.wrap_spec to use TraversableResourcesLoader
+    from above. Ensures that future behavior is always available on older
+    Pythons.
+    """
+    return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
diff --git a/pkg_resources/_vendor/importlib_resources/readers.py b/pkg_resources/_vendor/importlib_resources/readers.py
index ab34db7409..4a80a774aa 100644
--- a/pkg_resources/_vendor/importlib_resources/readers.py
+++ b/pkg_resources/_vendor/importlib_resources/readers.py
@@ -1,11 +1,15 @@
 import collections
+import contextlib
+import itertools
 import pathlib
 import operator
+import re
+import warnings
 
 from . import abc
 
-from ._itertools import unique_everseen
-from ._compat import ZipPath
+from ._itertools import only
+from .compat.py39 import ZipPath
 
 
 def remove_duplicates(items):
@@ -41,8 +45,10 @@ def open_resource(self, resource):
             raise FileNotFoundError(exc.args[0])
 
     def is_resource(self, path):
-        # workaround for `zipfile.Path.is_file` returning true
-        # for non-existent paths.
+        """
+        Workaround for `zipfile.Path.is_file` returning true
+        for non-existent paths.
+        """
         target = self.files().joinpath(path)
         return target.is_file() and target.exists()
 
@@ -59,7 +65,7 @@ class MultiplexedPath(abc.Traversable):
     """
 
     def __init__(self, *paths):
-        self._paths = list(map(pathlib.Path, remove_duplicates(paths)))
+        self._paths = list(map(_ensure_traversable, remove_duplicates(paths)))
         if not self._paths:
             message = 'MultiplexedPath must contain at least one path'
             raise FileNotFoundError(message)
@@ -67,8 +73,10 @@ def __init__(self, *paths):
             raise NotADirectoryError('MultiplexedPath only supports directories')
 
     def iterdir(self):
-        files = (file for path in self._paths for file in path.iterdir())
-        return unique_everseen(files, key=operator.attrgetter('name'))
+        children = (child for path in self._paths for child in path.iterdir())
+        by_name = operator.attrgetter('name')
+        groups = itertools.groupby(sorted(children, key=by_name), key=by_name)
+        return map(self._follow, (locs for name, locs in groups))
 
     def read_bytes(self):
         raise FileNotFoundError(f'{self} is not a file')
@@ -90,6 +98,25 @@ def joinpath(self, *descendants):
             # Just return something that will not exist.
             return self._paths[0].joinpath(*descendants)
 
+    @classmethod
+    def _follow(cls, children):
+        """
+        Construct a MultiplexedPath if needed.
+
+        If children contains a sole element, return it.
+        Otherwise, return a MultiplexedPath of the items.
+        Unless one of the items is not a Directory, then return the first.
+        """
+        subdirs, one_dir, one_file = itertools.tee(children, 3)
+
+        try:
+            return only(one_dir)
+        except ValueError:
+            try:
+                return cls(*subdirs)
+            except NotADirectoryError:
+                return next(one_file)
+
     def open(self, *args, **kwargs):
         raise FileNotFoundError(f'{self} is not a file')
 
@@ -106,7 +133,36 @@ class NamespaceReader(abc.TraversableResources):
     def __init__(self, namespace_path):
         if 'NamespacePath' not in str(namespace_path):
             raise ValueError('Invalid path')
-        self.path = MultiplexedPath(*list(namespace_path))
+        self.path = MultiplexedPath(*map(self._resolve, namespace_path))
+
+    @classmethod
+    def _resolve(cls, path_str) -> abc.Traversable:
+        r"""
+        Given an item from a namespace path, resolve it to a Traversable.
+
+        path_str might be a directory on the filesystem or a path to a
+        zipfile plus the path within the zipfile, e.g. ``/foo/bar`` or
+        ``/foo/baz.zip/inner_dir`` or ``foo\baz.zip\inner_dir\sub``.
+        """
+        (dir,) = (cand for cand in cls._candidate_paths(path_str) if cand.is_dir())
+        return dir
+
+    @classmethod
+    def _candidate_paths(cls, path_str):
+        yield pathlib.Path(path_str)
+        yield from cls._resolve_zip_path(path_str)
+
+    @staticmethod
+    def _resolve_zip_path(path_str):
+        for match in reversed(list(re.finditer(r'[\\/]', path_str))):
+            with contextlib.suppress(
+                FileNotFoundError,
+                IsADirectoryError,
+                NotADirectoryError,
+                PermissionError,
+            ):
+                inner = path_str[match.end() :].replace('\\', '/') + '/'
+                yield ZipPath(path_str[: match.start()], inner.lstrip('/'))
 
     def resource_path(self, resource):
         """
@@ -118,3 +174,21 @@ def resource_path(self, resource):
 
     def files(self):
         return self.path
+
+
+def _ensure_traversable(path):
+    """
+    Convert deprecated string arguments to traversables (pathlib.Path).
+
+    Remove with Python 3.15.
+    """
+    if not isinstance(path, str):
+        return path
+
+    warnings.warn(
+        "String arguments are deprecated. Pass a Traversable instead.",
+        DeprecationWarning,
+        stacklevel=3,
+    )
+
+    return pathlib.Path(path)
diff --git a/pkg_resources/_vendor/importlib_resources/simple.py b/pkg_resources/_vendor/importlib_resources/simple.py
index 7770c922c8..96f117fec6 100644
--- a/pkg_resources/_vendor/importlib_resources/simple.py
+++ b/pkg_resources/_vendor/importlib_resources/simple.py
@@ -88,7 +88,7 @@ def is_dir(self):
     def open(self, mode='r', *args, **kwargs):
         stream = self.parent.reader.open_binary(self.name)
         if 'b' not in mode:
-            stream = io.TextIOWrapper(*args, **kwargs)
+            stream = io.TextIOWrapper(stream, *args, **kwargs)
         return stream
 
     def joinpath(self, name):
diff --git a/pkg_resources/_vendor/importlib_resources/tests/_compat.py b/pkg_resources/_vendor/importlib_resources/tests/_compat.py
deleted file mode 100644
index e7bf06dd4e..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/_compat.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import os
-
-
-try:
-    from test.support import import_helper  # type: ignore
-except ImportError:
-    # Python 3.9 and earlier
-    class import_helper:  # type: ignore
-        from test.support import (
-            modules_setup,
-            modules_cleanup,
-            DirsOnSysPath,
-            CleanImport,
-        )
-
-
-try:
-    from test.support import os_helper  # type: ignore
-except ImportError:
-    # Python 3.9 compat
-    class os_helper:  # type:ignore
-        from test.support import temp_dir
-
-
-try:
-    # Python 3.10
-    from test.support.os_helper import unlink
-except ImportError:
-    from test.support import unlink as _unlink
-
-    def unlink(target):
-        return _unlink(os.fspath(target))
diff --git a/pkg_resources/_vendor/importlib_resources/tests/_path.py b/pkg_resources/_vendor/importlib_resources/tests/_path.py
index c630e4d3d3..1f97c96146 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/_path.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/_path.py
@@ -1,12 +1,16 @@
 import pathlib
 import functools
 
+from typing import Dict, Union
+
 
 ####
-# from jaraco.path 3.4
+# from jaraco.path 3.4.1
+
+FilesSpec = Dict[str, Union[str, bytes, 'FilesSpec']]  # type: ignore
 
 
-def build(spec, prefix=pathlib.Path()):
+def build(spec: FilesSpec, prefix=pathlib.Path()):
     """
     Build a set of files/directories, as described by the spec.
 
@@ -23,15 +27,17 @@ def build(spec, prefix=pathlib.Path()):
     ...         "baz.py": "# Some code",
     ...     }
     ... }
-    >>> tmpdir = getfixture('tmpdir')
-    >>> build(spec, tmpdir)
+    >>> target = getfixture('tmp_path')
+    >>> build(spec, target)
+    >>> target.joinpath('foo/baz.py').read_text(encoding='utf-8')
+    '# Some code'
     """
     for name, contents in spec.items():
         create(contents, pathlib.Path(prefix) / name)
 
 
 @functools.singledispatch
-def create(content, path):
+def create(content: Union[str, bytes, FilesSpec], path):
     path.mkdir(exist_ok=True)
     build(content, prefix=path)  # type: ignore
 
@@ -43,7 +49,7 @@ def _(content: bytes, path):
 
 @create.register
 def _(content: str, path):
-    path.write_text(content)
+    path.write_text(content, encoding='utf-8')
 
 
 # end from jaraco.path
diff --git a/pkg_resources/_vendor/jaraco/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/compat/__init__.py
similarity index 100%
rename from pkg_resources/_vendor/jaraco/__init__.py
rename to pkg_resources/_vendor/importlib_resources/tests/compat/__init__.py
diff --git a/pkg_resources/_vendor/importlib_resources/tests/compat/py312.py b/pkg_resources/_vendor/importlib_resources/tests/compat/py312.py
new file mode 100644
index 0000000000..ea9a58ba2e
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/tests/compat/py312.py
@@ -0,0 +1,18 @@
+import contextlib
+
+from .py39 import import_helper
+
+
+@contextlib.contextmanager
+def isolated_modules():
+    """
+    Save modules on entry and cleanup on exit.
+    """
+    (saved,) = import_helper.modules_setup()
+    try:
+        yield
+    finally:
+        import_helper.modules_cleanup(saved)
+
+
+vars(import_helper).setdefault('isolated_modules', isolated_modules)
diff --git a/pkg_resources/_vendor/importlib_resources/tests/compat/py39.py b/pkg_resources/_vendor/importlib_resources/tests/compat/py39.py
new file mode 100644
index 0000000000..e158eb85d3
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/tests/compat/py39.py
@@ -0,0 +1,10 @@
+"""
+Backward-compatability shims to support Python 3.9 and earlier.
+"""
+
+from jaraco.test.cpython import from_test_support, try_import
+
+import_helper = try_import('import_helper') or from_test_support(
+    'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
+)
+os_helper = try_import('os_helper') or from_test_support('temp_dir')
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/binary.file b/pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/binary.file
index eaf36c1daccfdf325514461cd1a2ffbc139b5464..5bd8bb897b13225c93a1d26baa88c96b7bd5d817 100644
GIT binary patch
literal 4
LcmZQ!Wn%{b05$*@

literal 4
LcmZQzWMT#Y01f~L

diff --git a/pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt b/pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
new file mode 100644
index 0000000000..48f587a2d0
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
@@ -0,0 +1 @@
+a resource
\ No newline at end of file
diff --git a/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file b/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
new file mode 100644
index 0000000000..100f50643d
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
@@ -0,0 +1 @@
+

\ No newline at end of file
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py b/pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py
index d92c7c56c9..13ad0dfb21 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py
@@ -64,11 +64,13 @@ def test_orphan_path_name(self):
 
     def test_spec_path_open(self):
         self.assertEqual(self.files.read_bytes(), b'Hello, world!')
-        self.assertEqual(self.files.read_text(), 'Hello, world!')
+        self.assertEqual(self.files.read_text(encoding='utf-8'), 'Hello, world!')
 
     def test_child_path_open(self):
         self.assertEqual((self.files / 'a').read_bytes(), b'Hello, world!')
-        self.assertEqual((self.files / 'a').read_text(), 'Hello, world!')
+        self.assertEqual(
+            (self.files / 'a').read_text(encoding='utf-8'), 'Hello, world!'
+        )
 
     def test_orphan_path_open(self):
         with self.assertRaises(FileNotFoundError):
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_contents.py b/pkg_resources/_vendor/importlib_resources/tests/test_contents.py
index 525568e8c9..7dc3b0a619 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_contents.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_contents.py
@@ -31,8 +31,8 @@ class ContentsZipTests(ContentsTests, util.ZipSetup, unittest.TestCase):
 class ContentsNamespaceTests(ContentsTests, unittest.TestCase):
     expected = {
         # no __init__ because of namespace design
-        # no subdirectory as incidental difference in fixture
         'binary.file',
+        'subdirectory',
         'utf-16.file',
         'utf-8.file',
     }
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_custom.py b/pkg_resources/_vendor/importlib_resources/tests/test_custom.py
new file mode 100644
index 0000000000..86c65676f1
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_custom.py
@@ -0,0 +1,47 @@
+import unittest
+import contextlib
+import pathlib
+
+import importlib_resources as resources
+from .. import abc
+from ..abc import TraversableResources, ResourceReader
+from . import util
+from .compat.py39 import os_helper
+
+
+class SimpleLoader:
+    """
+    A simple loader that only implements a resource reader.
+    """
+
+    def __init__(self, reader: ResourceReader):
+        self.reader = reader
+
+    def get_resource_reader(self, package):
+        return self.reader
+
+
+class MagicResources(TraversableResources):
+    """
+    Magically returns the resources at path.
+    """
+
+    def __init__(self, path: pathlib.Path):
+        self.path = path
+
+    def files(self):
+        return self.path
+
+
+class CustomTraversableResourcesTests(unittest.TestCase):
+    def setUp(self):
+        self.fixtures = contextlib.ExitStack()
+        self.addCleanup(self.fixtures.close)
+
+    def test_custom_loader(self):
+        temp_dir = pathlib.Path(self.fixtures.enter_context(os_helper.temp_dir()))
+        loader = SimpleLoader(MagicResources(temp_dir))
+        pkg = util.create_package_from_loader(loader)
+        files = resources.files(pkg)
+        assert isinstance(files, abc.Traversable)
+        assert list(files.iterdir()) == []
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_files.py b/pkg_resources/_vendor/importlib_resources/tests/test_files.py
index d258fb5f0f..3e86ec64bc 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_files.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_files.py
@@ -1,4 +1,3 @@
-import typing
 import textwrap
 import unittest
 import warnings
@@ -10,7 +9,8 @@
 from . import data01
 from . import util
 from . import _path
-from ._compat import os_helper, import_helper
+from .compat.py39 import os_helper
+from .compat.py312 import import_helper
 
 
 @contextlib.contextmanager
@@ -31,13 +31,14 @@ def test_read_text(self):
         actual = files.joinpath('utf-8.file').read_text(encoding='utf-8')
         assert actual == 'Hello, UTF-8 world!\n'
 
-    @unittest.skipUnless(
-        hasattr(typing, 'runtime_checkable'),
-        "Only suitable when typing supports runtime_checkable",
-    )
     def test_traversable(self):
         assert isinstance(resources.files(self.data), Traversable)
 
+    def test_joinpath_with_multiple_args(self):
+        files = resources.files(self.data)
+        binfile = files.joinpath('subdirectory', 'binary.file')
+        self.assertTrue(binfile.is_file())
+
     def test_old_parameter(self):
         """
         Files used to take a 'package' parameter. Make sure anyone
@@ -63,13 +64,17 @@ def setUp(self):
         self.data = namespacedata01
 
 
+class OpenNamespaceZipTests(FilesTests, util.ZipSetup, unittest.TestCase):
+    ZIP_MODULE = 'namespacedata01'
+
+
 class SiteDir:
     def setUp(self):
         self.fixtures = contextlib.ExitStack()
         self.addCleanup(self.fixtures.close)
         self.site_dir = self.fixtures.enter_context(os_helper.temp_dir())
         self.fixtures.enter_context(import_helper.DirsOnSysPath(self.site_dir))
-        self.fixtures.enter_context(import_helper.CleanImport())
+        self.fixtures.enter_context(import_helper.isolated_modules())
 
 
 class ModulesFilesTests(SiteDir, unittest.TestCase):
@@ -84,7 +89,7 @@ def test_module_resources(self):
         _path.build(spec, self.site_dir)
         import mod
 
-        actual = resources.files(mod).joinpath('res.txt').read_text()
+        actual = resources.files(mod).joinpath('res.txt').read_text(encoding='utf-8')
         assert actual == spec['res.txt']
 
 
@@ -98,7 +103,7 @@ def test_implicit_files(self):
                 '__init__.py': textwrap.dedent(
                     """
                     import importlib_resources as res
-                    val = res.files().joinpath('res.txt').read_text()
+                    val = res.files().joinpath('res.txt').read_text(encoding='utf-8')
                     """
                 ),
                 'res.txt': 'resources are the best',
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_functional.py b/pkg_resources/_vendor/importlib_resources/tests/test_functional.py
new file mode 100644
index 0000000000..69706cf7be
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_functional.py
@@ -0,0 +1,242 @@
+import unittest
+import os
+import contextlib
+
+try:
+    from test.support.warnings_helper import ignore_warnings, check_warnings
+except ImportError:
+    # older Python versions
+    from test.support import ignore_warnings, check_warnings
+
+import importlib_resources as resources
+
+# Since the functional API forwards to Traversable, we only test
+# filesystem resources here -- not zip files, namespace packages etc.
+# We do test for two kinds of Anchor, though.
+
+
+class StringAnchorMixin:
+    anchor01 = 'importlib_resources.tests.data01'
+    anchor02 = 'importlib_resources.tests.data02'
+
+
+class ModuleAnchorMixin:
+    from . import data01 as anchor01
+    from . import data02 as anchor02
+
+
+class FunctionalAPIBase:
+    def _gen_resourcetxt_path_parts(self):
+        """Yield various names of a text file in anchor02, each in a subTest"""
+        for path_parts in (
+            ('subdirectory', 'subsubdir', 'resource.txt'),
+            ('subdirectory/subsubdir/resource.txt',),
+            ('subdirectory/subsubdir', 'resource.txt'),
+        ):
+            with self.subTest(path_parts=path_parts):
+                yield path_parts
+
+    def test_read_text(self):
+        self.assertEqual(
+            resources.read_text(self.anchor01, 'utf-8.file'),
+            'Hello, UTF-8 world!\n',
+        )
+        self.assertEqual(
+            resources.read_text(
+                self.anchor02,
+                'subdirectory',
+                'subsubdir',
+                'resource.txt',
+                encoding='utf-8',
+            ),
+            'a resource',
+        )
+        for path_parts in self._gen_resourcetxt_path_parts():
+            self.assertEqual(
+                resources.read_text(
+                    self.anchor02,
+                    *path_parts,
+                    encoding='utf-8',
+                ),
+                'a resource',
+            )
+        # Use generic OSError, since e.g. attempting to read a directory can
+        # fail with PermissionError rather than IsADirectoryError
+        with self.assertRaises(OSError):
+            resources.read_text(self.anchor01)
+        with self.assertRaises(OSError):
+            resources.read_text(self.anchor01, 'no-such-file')
+        with self.assertRaises(UnicodeDecodeError):
+            resources.read_text(self.anchor01, 'utf-16.file')
+        self.assertEqual(
+            resources.read_text(
+                self.anchor01,
+                'binary.file',
+                encoding='latin1',
+            ),
+            '\x00\x01\x02\x03',
+        )
+        self.assertEqual(
+            resources.read_text(
+                self.anchor01,
+                'utf-16.file',
+                errors='backslashreplace',
+            ),
+            'Hello, UTF-16 world!\n'.encode('utf-16').decode(
+                errors='backslashreplace',
+            ),
+        )
+
+    def test_read_binary(self):
+        self.assertEqual(
+            resources.read_binary(self.anchor01, 'utf-8.file'),
+            b'Hello, UTF-8 world!\n',
+        )
+        for path_parts in self._gen_resourcetxt_path_parts():
+            self.assertEqual(
+                resources.read_binary(self.anchor02, *path_parts),
+                b'a resource',
+            )
+
+    def test_open_text(self):
+        with resources.open_text(self.anchor01, 'utf-8.file') as f:
+            self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
+        for path_parts in self._gen_resourcetxt_path_parts():
+            with resources.open_text(
+                self.anchor02,
+                *path_parts,
+                encoding='utf-8',
+            ) as f:
+                self.assertEqual(f.read(), 'a resource')
+        # Use generic OSError, since e.g. attempting to read a directory can
+        # fail with PermissionError rather than IsADirectoryError
+        with self.assertRaises(OSError):
+            resources.open_text(self.anchor01)
+        with self.assertRaises(OSError):
+            resources.open_text(self.anchor01, 'no-such-file')
+        with resources.open_text(self.anchor01, 'utf-16.file') as f:
+            with self.assertRaises(UnicodeDecodeError):
+                f.read()
+        with resources.open_text(
+            self.anchor01,
+            'binary.file',
+            encoding='latin1',
+        ) as f:
+            self.assertEqual(f.read(), '\x00\x01\x02\x03')
+        with resources.open_text(
+            self.anchor01,
+            'utf-16.file',
+            errors='backslashreplace',
+        ) as f:
+            self.assertEqual(
+                f.read(),
+                'Hello, UTF-16 world!\n'.encode('utf-16').decode(
+                    errors='backslashreplace',
+                ),
+            )
+
+    def test_open_binary(self):
+        with resources.open_binary(self.anchor01, 'utf-8.file') as f:
+            self.assertEqual(f.read(), b'Hello, UTF-8 world!\n')
+        for path_parts in self._gen_resourcetxt_path_parts():
+            with resources.open_binary(
+                self.anchor02,
+                *path_parts,
+            ) as f:
+                self.assertEqual(f.read(), b'a resource')
+
+    def test_path(self):
+        with resources.path(self.anchor01, 'utf-8.file') as path:
+            with open(str(path), encoding='utf-8') as f:
+                self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
+        with resources.path(self.anchor01) as path:
+            with open(os.path.join(path, 'utf-8.file'), encoding='utf-8') as f:
+                self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
+
+    def test_is_resource(self):
+        is_resource = resources.is_resource
+        self.assertTrue(is_resource(self.anchor01, 'utf-8.file'))
+        self.assertFalse(is_resource(self.anchor01, 'no_such_file'))
+        self.assertFalse(is_resource(self.anchor01))
+        self.assertFalse(is_resource(self.anchor01, 'subdirectory'))
+        for path_parts in self._gen_resourcetxt_path_parts():
+            self.assertTrue(is_resource(self.anchor02, *path_parts))
+
+    def test_contents(self):
+        with check_warnings((".*contents.*", DeprecationWarning)):
+            c = resources.contents(self.anchor01)
+        self.assertGreaterEqual(
+            set(c),
+            {'utf-8.file', 'utf-16.file', 'binary.file', 'subdirectory'},
+        )
+        with contextlib.ExitStack() as cm:
+            cm.enter_context(self.assertRaises(OSError))
+            cm.enter_context(check_warnings((".*contents.*", DeprecationWarning)))
+
+            list(resources.contents(self.anchor01, 'utf-8.file'))
+
+        for path_parts in self._gen_resourcetxt_path_parts():
+            with contextlib.ExitStack() as cm:
+                cm.enter_context(self.assertRaises(OSError))
+                cm.enter_context(check_warnings((".*contents.*", DeprecationWarning)))
+
+                list(resources.contents(self.anchor01, *path_parts))
+        with check_warnings((".*contents.*", DeprecationWarning)):
+            c = resources.contents(self.anchor01, 'subdirectory')
+        self.assertGreaterEqual(
+            set(c),
+            {'binary.file'},
+        )
+
+    @ignore_warnings(category=DeprecationWarning)
+    def test_common_errors(self):
+        for func in (
+            resources.read_text,
+            resources.read_binary,
+            resources.open_text,
+            resources.open_binary,
+            resources.path,
+            resources.is_resource,
+            resources.contents,
+        ):
+            with self.subTest(func=func):
+                # Rejecting None anchor
+                with self.assertRaises(TypeError):
+                    func(None)
+                # Rejecting invalid anchor type
+                with self.assertRaises((TypeError, AttributeError)):
+                    func(1234)
+                # Unknown module
+                with self.assertRaises(ModuleNotFoundError):
+                    func('$missing module$')
+
+    def test_text_errors(self):
+        for func in (
+            resources.read_text,
+            resources.open_text,
+        ):
+            with self.subTest(func=func):
+                # Multiple path arguments need explicit encoding argument.
+                with self.assertRaises(TypeError):
+                    func(
+                        self.anchor02,
+                        'subdirectory',
+                        'subsubdir',
+                        'resource.txt',
+                    )
+
+
+class FunctionalAPITest_StringAnchor(
+    unittest.TestCase,
+    FunctionalAPIBase,
+    StringAnchorMixin,
+):
+    pass
+
+
+class FunctionalAPITest_ModuleAnchor(
+    unittest.TestCase,
+    FunctionalAPIBase,
+    ModuleAnchorMixin,
+):
+    pass
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_open.py b/pkg_resources/_vendor/importlib_resources/tests/test_open.py
index 87b42c3d39..44f1018af3 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_open.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_open.py
@@ -15,7 +15,7 @@ def execute(self, package, path):
 class CommonTextTests(util.CommonTests, unittest.TestCase):
     def execute(self, package, path):
         target = resources.files(package).joinpath(path)
-        with target.open():
+        with target.open(encoding='utf-8'):
             pass
 
 
@@ -24,11 +24,11 @@ def test_open_binary(self):
         target = resources.files(self.data) / 'binary.file'
         with target.open('rb') as fp:
             result = fp.read()
-            self.assertEqual(result, b'\x00\x01\x02\x03')
+            self.assertEqual(result, bytes(range(4)))
 
     def test_open_text_default_encoding(self):
         target = resources.files(self.data) / 'utf-8.file'
-        with target.open() as fp:
+        with target.open(encoding='utf-8') as fp:
             result = fp.read()
             self.assertEqual(result, 'Hello, UTF-8 world!\n')
 
@@ -39,7 +39,9 @@ def test_open_text_given_encoding(self):
         self.assertEqual(result, 'Hello, UTF-16 world!\n')
 
     def test_open_text_with_errors(self):
-        # Raises UnicodeError without the 'errors' argument.
+        """
+        Raises UnicodeError without the 'errors' argument.
+        """
         target = resources.files(self.data) / 'utf-16.file'
         with target.open(encoding='utf-8', errors='strict') as fp:
             self.assertRaises(UnicodeError, fp.read)
@@ -54,11 +56,13 @@ def test_open_text_with_errors(self):
 
     def test_open_binary_FileNotFoundError(self):
         target = resources.files(self.data) / 'does-not-exist'
-        self.assertRaises(FileNotFoundError, target.open, 'rb')
+        with self.assertRaises(FileNotFoundError):
+            target.open('rb')
 
     def test_open_text_FileNotFoundError(self):
         target = resources.files(self.data) / 'does-not-exist'
-        self.assertRaises(FileNotFoundError, target.open)
+        with self.assertRaises(FileNotFoundError):
+            target.open(encoding='utf-8')
 
 
 class OpenDiskTests(OpenTests, unittest.TestCase):
@@ -77,5 +81,9 @@ class OpenZipTests(OpenTests, util.ZipSetup, unittest.TestCase):
     pass
 
 
+class OpenNamespaceZipTests(OpenTests, util.ZipSetup, unittest.TestCase):
+    ZIP_MODULE = 'namespacedata01'
+
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_path.py b/pkg_resources/_vendor/importlib_resources/tests/test_path.py
index 4f4d3943bb..c3e1cbb4ed 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_path.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_path.py
@@ -1,4 +1,5 @@
 import io
+import pathlib
 import unittest
 
 import importlib_resources as resources
@@ -14,16 +15,14 @@ def execute(self, package, path):
 
 class PathTests:
     def test_reading(self):
-        # Path should be readable.
-        # Test also implicitly verifies the returned object is a pathlib.Path
-        # instance.
+        """
+        Path should be readable and a pathlib.Path instance.
+        """
         target = resources.files(self.data) / 'utf-8.file'
         with resources.as_file(target) as path:
+            self.assertIsInstance(path, pathlib.Path)
             self.assertTrue(path.name.endswith("utf-8.file"), repr(path))
-            # pathlib.Path.read_text() was introduced in Python 3.5.
-            with path.open('r', encoding='utf-8') as file:
-                text = file.read()
-            self.assertEqual('Hello, UTF-8 world!\n', text)
+            self.assertEqual('Hello, UTF-8 world!\n', path.read_text(encoding='utf-8'))
 
 
 class PathDiskTests(PathTests, unittest.TestCase):
@@ -53,8 +52,10 @@ def setUp(self):
 
 class PathZipTests(PathTests, util.ZipSetup, unittest.TestCase):
     def test_remove_in_context_manager(self):
-        # It is not an error if the file that was temporarily stashed on the
-        # file system is removed inside the `with` stanza.
+        """
+        It is not an error if the file that was temporarily stashed on the
+        file system is removed inside the `with` stanza.
+        """
         target = resources.files(self.data) / 'utf-8.file'
         with resources.as_file(target) as path:
             path.unlink()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_read.py b/pkg_resources/_vendor/importlib_resources/tests/test_read.py
index 41dd6db5f3..97d90128cf 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_read.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_read.py
@@ -13,16 +13,20 @@ def execute(self, package, path):
 
 class CommonTextTests(util.CommonTests, unittest.TestCase):
     def execute(self, package, path):
-        resources.files(package).joinpath(path).read_text()
+        resources.files(package).joinpath(path).read_text(encoding='utf-8')
 
 
 class ReadTests:
     def test_read_bytes(self):
         result = resources.files(self.data).joinpath('binary.file').read_bytes()
-        self.assertEqual(result, b'\0\1\2\3')
+        self.assertEqual(result, bytes(range(4)))
 
     def test_read_text_default_encoding(self):
-        result = resources.files(self.data).joinpath('utf-8.file').read_text()
+        result = (
+            resources.files(self.data)
+            .joinpath('utf-8.file')
+            .read_text(encoding='utf-8')
+        )
         self.assertEqual(result, 'Hello, UTF-8 world!\n')
 
     def test_read_text_given_encoding(self):
@@ -34,7 +38,9 @@ def test_read_text_given_encoding(self):
         self.assertEqual(result, 'Hello, UTF-16 world!\n')
 
     def test_read_text_with_errors(self):
-        # Raises UnicodeError without the 'errors' argument.
+        """
+        Raises UnicodeError without the 'errors' argument.
+        """
         target = resources.files(self.data) / 'utf-16.file'
         self.assertRaises(UnicodeError, target.read_text, encoding='utf-8')
         result = target.read_text(encoding='utf-8', errors='ignore')
@@ -52,17 +58,15 @@ class ReadDiskTests(ReadTests, unittest.TestCase):
 
 class ReadZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
     def test_read_submodule_resource(self):
-        submodule = import_module('ziptestdata.subdirectory')
+        submodule = import_module('data01.subdirectory')
         result = resources.files(submodule).joinpath('binary.file').read_bytes()
-        self.assertEqual(result, b'\0\1\2\3')
+        self.assertEqual(result, bytes(range(4, 8)))
 
     def test_read_submodule_resource_by_name(self):
         result = (
-            resources.files('ziptestdata.subdirectory')
-            .joinpath('binary.file')
-            .read_bytes()
+            resources.files('data01.subdirectory').joinpath('binary.file').read_bytes()
         )
-        self.assertEqual(result, b'\0\1\2\3')
+        self.assertEqual(result, bytes(range(4, 8)))
 
 
 class ReadNamespaceTests(ReadTests, unittest.TestCase):
@@ -72,5 +76,22 @@ def setUp(self):
         self.data = namespacedata01
 
 
+class ReadNamespaceZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
+    ZIP_MODULE = 'namespacedata01'
+
+    def test_read_submodule_resource(self):
+        submodule = import_module('namespacedata01.subdirectory')
+        result = resources.files(submodule).joinpath('binary.file').read_bytes()
+        self.assertEqual(result, bytes(range(12, 16)))
+
+    def test_read_submodule_resource_by_name(self):
+        result = (
+            resources.files('namespacedata01.subdirectory')
+            .joinpath('binary.file')
+            .read_bytes()
+        )
+        self.assertEqual(result, bytes(range(12, 16)))
+
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_reader.py b/pkg_resources/_vendor/importlib_resources/tests/test_reader.py
index 1c8ebeeb13..95c2fc85a4 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_reader.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_reader.py
@@ -10,8 +10,7 @@
 class MultiplexedPathTest(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
-        path = pathlib.Path(__file__).parent / 'namespacedata01'
-        cls.folder = str(path)
+        cls.folder = pathlib.Path(__file__).parent / 'namespacedata01'
 
     def test_init_no_paths(self):
         with self.assertRaises(FileNotFoundError):
@@ -19,7 +18,7 @@ def test_init_no_paths(self):
 
     def test_init_file(self):
         with self.assertRaises(NotADirectoryError):
-            MultiplexedPath(os.path.join(self.folder, 'binary.file'))
+            MultiplexedPath(self.folder / 'binary.file')
 
     def test_iterdir(self):
         contents = {path.name for path in MultiplexedPath(self.folder).iterdir()}
@@ -27,10 +26,12 @@ def test_iterdir(self):
             contents.remove('__pycache__')
         except (KeyError, ValueError):
             pass
-        self.assertEqual(contents, {'binary.file', 'utf-16.file', 'utf-8.file'})
+        self.assertEqual(
+            contents, {'subdirectory', 'binary.file', 'utf-16.file', 'utf-8.file'}
+        )
 
     def test_iterdir_duplicate(self):
-        data01 = os.path.abspath(os.path.join(__file__, '..', 'data01'))
+        data01 = pathlib.Path(__file__).parent.joinpath('data01')
         contents = {
             path.name for path in MultiplexedPath(self.folder, data01).iterdir()
         }
@@ -60,17 +61,17 @@ def test_open_file(self):
             path.open()
 
     def test_join_path(self):
-        prefix = os.path.abspath(os.path.join(__file__, '..'))
-        data01 = os.path.join(prefix, 'data01')
+        data01 = pathlib.Path(__file__).parent.joinpath('data01')
+        prefix = str(data01.parent)
         path = MultiplexedPath(self.folder, data01)
         self.assertEqual(
             str(path.joinpath('binary.file'))[len(prefix) + 1 :],
             os.path.join('namespacedata01', 'binary.file'),
         )
-        self.assertEqual(
-            str(path.joinpath('subdirectory'))[len(prefix) + 1 :],
-            os.path.join('data01', 'subdirectory'),
-        )
+        sub = path.joinpath('subdirectory')
+        assert isinstance(sub, MultiplexedPath)
+        assert 'namespacedata01' in str(sub)
+        assert 'data01' in str(sub)
         self.assertEqual(
             str(path.joinpath('imaginary'))[len(prefix) + 1 :],
             os.path.join('namespacedata01', 'imaginary'),
@@ -81,6 +82,17 @@ def test_join_path_compound(self):
         path = MultiplexedPath(self.folder)
         assert not path.joinpath('imaginary/foo.py').exists()
 
+    def test_join_path_common_subdir(self):
+        data01 = pathlib.Path(__file__).parent.joinpath('data01')
+        data02 = pathlib.Path(__file__).parent.joinpath('data02')
+        prefix = str(data01.parent)
+        path = MultiplexedPath(data01, data02)
+        self.assertIsInstance(path.joinpath('subdirectory'), MultiplexedPath)
+        self.assertEqual(
+            str(path.joinpath('subdirectory', 'subsubdir'))[len(prefix) + 1 :],
+            os.path.join('data02', 'subdirectory', 'subsubdir'),
+        )
+
     def test_repr(self):
         self.assertEqual(
             repr(MultiplexedPath(self.folder)),
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_resource.py b/pkg_resources/_vendor/importlib_resources/tests/test_resource.py
index 8239027167..dc2a108cde 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/test_resource.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/test_resource.py
@@ -1,14 +1,11 @@
 import sys
 import unittest
 import importlib_resources as resources
-import uuid
 import pathlib
 
 from . import data01
-from . import zipdata01, zipdata02
 from . import util
 from importlib import import_module
-from ._compat import import_helper, unlink
 
 
 class ResourceTests:
@@ -69,10 +66,12 @@ def test_resource_missing(self):
 
 class ResourceCornerCaseTests(unittest.TestCase):
     def test_package_has_no_reader_fallback(self):
-        # Test odd ball packages which:
+        """
+        Test odd ball packages which:
         # 1. Do not have a ResourceReader as a loader
         # 2. Are not on the file system
         # 3. Are not in a zip file
+        """
         module = util.create_package(
             file=data01, path=data01.__file__, contents=['A', 'B', 'C']
         )
@@ -86,34 +85,32 @@ def test_package_has_no_reader_fallback(self):
 
 
 class ResourceFromZipsTest01(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = zipdata01  # type: ignore
+    ZIP_MODULE = 'data01'
 
     def test_is_submodule_resource(self):
-        submodule = import_module('ziptestdata.subdirectory')
+        submodule = import_module('data01.subdirectory')
         self.assertTrue(resources.files(submodule).joinpath('binary.file').is_file())
 
     def test_read_submodule_resource_by_name(self):
         self.assertTrue(
-            resources.files('ziptestdata.subdirectory')
-            .joinpath('binary.file')
-            .is_file()
+            resources.files('data01.subdirectory').joinpath('binary.file').is_file()
         )
 
     def test_submodule_contents(self):
-        submodule = import_module('ziptestdata.subdirectory')
+        submodule = import_module('data01.subdirectory')
         self.assertEqual(
             names(resources.files(submodule)), {'__init__.py', 'binary.file'}
         )
 
     def test_submodule_contents_by_name(self):
         self.assertEqual(
-            names(resources.files('ziptestdata.subdirectory')),
+            names(resources.files('data01.subdirectory')),
             {'__init__.py', 'binary.file'},
         )
 
     def test_as_file_directory(self):
-        with resources.as_file(resources.files('ziptestdata')) as data:
-            assert data.name == 'ziptestdata'
+        with resources.as_file(resources.files('data01')) as data:
+            assert data.name == 'data01'
             assert data.is_dir()
             assert data.joinpath('subdirectory').is_dir()
             assert len(list(data.iterdir()))
@@ -121,7 +118,7 @@ def test_as_file_directory(self):
 
 
 class ResourceFromZipsTest02(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = zipdata02  # type: ignore
+    ZIP_MODULE = 'data02'
 
     def test_unrelated_contents(self):
         """
@@ -129,104 +126,48 @@ def test_unrelated_contents(self):
         distinct resources. Ref python/importlib_resources#44.
         """
         self.assertEqual(
-            names(resources.files('ziptestdata.one')),
+            names(resources.files('data02.one')),
             {'__init__.py', 'resource1.txt'},
         )
         self.assertEqual(
-            names(resources.files('ziptestdata.two')),
+            names(resources.files('data02.two')),
             {'__init__.py', 'resource2.txt'},
         )
 
 
-class DeletingZipsTest(unittest.TestCase):
+class DeletingZipsTest(util.ZipSetupBase, unittest.TestCase):
     """Having accessed resources in a zip file should not keep an open
     reference to the zip.
     """
 
-    ZIP_MODULE = zipdata01
-
-    def setUp(self):
-        modules = import_helper.modules_setup()
-        self.addCleanup(import_helper.modules_cleanup, *modules)
-
-        data_path = pathlib.Path(self.ZIP_MODULE.__file__)
-        data_dir = data_path.parent
-        self.source_zip_path = data_dir / 'ziptestdata.zip'
-        self.zip_path = pathlib.Path(f'{uuid.uuid4()}.zip').absolute()
-        self.zip_path.write_bytes(self.source_zip_path.read_bytes())
-        sys.path.append(str(self.zip_path))
-        self.data = import_module('ziptestdata')
-
-    def tearDown(self):
-        try:
-            sys.path.remove(str(self.zip_path))
-        except ValueError:
-            pass
-
-        try:
-            del sys.path_importer_cache[str(self.zip_path)]
-            del sys.modules[self.data.__name__]
-        except KeyError:
-            pass
-
-        try:
-            unlink(self.zip_path)
-        except OSError:
-            # If the test fails, this will probably fail too
-            pass
-
     def test_iterdir_does_not_keep_open(self):
-        c = [item.name for item in resources.files('ziptestdata').iterdir()]
-        self.zip_path.unlink()
-        del c
+        [item.name for item in resources.files('data01').iterdir()]
 
     def test_is_file_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('binary.file').is_file()
-        self.zip_path.unlink()
-        del c
+        resources.files('data01').joinpath('binary.file').is_file()
 
     def test_is_file_failure_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('not-present').is_file()
-        self.zip_path.unlink()
-        del c
+        resources.files('data01').joinpath('not-present').is_file()
 
     @unittest.skip("Desired but not supported.")
     def test_as_file_does_not_keep_open(self):  # pragma: no cover
-        c = resources.as_file(resources.files('ziptestdata') / 'binary.file')
-        self.zip_path.unlink()
-        del c
+        resources.as_file(resources.files('data01') / 'binary.file')
 
     def test_entered_path_does_not_keep_open(self):
-        # This is what certifi does on import to make its bundle
-        # available for the process duration.
-        c = resources.as_file(
-            resources.files('ziptestdata') / 'binary.file'
-        ).__enter__()
-        self.zip_path.unlink()
-        del c
+        """
+        Mimic what certifi does on import to make its bundle
+        available for the process duration.
+        """
+        resources.as_file(resources.files('data01') / 'binary.file').__enter__()
 
     def test_read_binary_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('binary.file').read_bytes()
-        self.zip_path.unlink()
-        del c
+        resources.files('data01').joinpath('binary.file').read_bytes()
 
     def test_read_text_does_not_keep_open(self):
-        c = resources.files('ziptestdata').joinpath('utf-8.file').read_text()
-        self.zip_path.unlink()
-        del c
-
-
-class ResourceFromNamespaceTest01(unittest.TestCase):
-    site_dir = str(pathlib.Path(__file__).parent)
+        resources.files('data01').joinpath('utf-8.file').read_text(encoding='utf-8')
 
-    @classmethod
-    def setUpClass(cls):
-        sys.path.append(cls.site_dir)
-
-    @classmethod
-    def tearDownClass(cls):
-        sys.path.remove(cls.site_dir)
 
+class ResourceFromNamespaceTests:
     def test_is_submodule_resource(self):
         self.assertTrue(
             resources.files(import_module('namespacedata01'))
@@ -245,7 +186,9 @@ def test_submodule_contents(self):
             contents.remove('__pycache__')
         except KeyError:
             pass
-        self.assertEqual(contents, {'binary.file', 'utf-8.file', 'utf-16.file'})
+        self.assertEqual(
+            contents, {'subdirectory', 'binary.file', 'utf-8.file', 'utf-16.file'}
+        )
 
     def test_submodule_contents_by_name(self):
         contents = names(resources.files('namespacedata01'))
@@ -253,7 +196,45 @@ def test_submodule_contents_by_name(self):
             contents.remove('__pycache__')
         except KeyError:
             pass
-        self.assertEqual(contents, {'binary.file', 'utf-8.file', 'utf-16.file'})
+        self.assertEqual(
+            contents, {'subdirectory', 'binary.file', 'utf-8.file', 'utf-16.file'}
+        )
+
+    def test_submodule_sub_contents(self):
+        contents = names(resources.files(import_module('namespacedata01.subdirectory')))
+        try:
+            contents.remove('__pycache__')
+        except KeyError:
+            pass
+        self.assertEqual(contents, {'binary.file'})
+
+    def test_submodule_sub_contents_by_name(self):
+        contents = names(resources.files('namespacedata01.subdirectory'))
+        try:
+            contents.remove('__pycache__')
+        except KeyError:
+            pass
+        self.assertEqual(contents, {'binary.file'})
+
+
+class ResourceFromNamespaceDiskTests(ResourceFromNamespaceTests, unittest.TestCase):
+    site_dir = str(pathlib.Path(__file__).parent)
+
+    @classmethod
+    def setUpClass(cls):
+        sys.path.append(cls.site_dir)
+
+    @classmethod
+    def tearDownClass(cls):
+        sys.path.remove(cls.site_dir)
+
+
+class ResourceFromNamespaceZipTests(
+    util.ZipSetupBase,
+    ResourceFromNamespaceTests,
+    unittest.TestCase,
+):
+    ZIP_MODULE = 'namespacedata01'
 
 
 if __name__ == '__main__':
diff --git a/pkg_resources/_vendor/importlib_resources/tests/update-zips.py b/pkg_resources/_vendor/importlib_resources/tests/update-zips.py
deleted file mode 100644
index 231334aa7e..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/update-zips.py
+++ /dev/null
@@ -1,53 +0,0 @@
-"""
-Generate the zip test data files.
-
-Run to build the tests/zipdataNN/ziptestdata.zip files from
-files in tests/dataNN.
-
-Replaces the file with the working copy, but does commit anything
-to the source repo.
-"""
-
-import contextlib
-import os
-import pathlib
-import zipfile
-
-
-def main():
-    """
-    >>> from unittest import mock
-    >>> monkeypatch = getfixture('monkeypatch')
-    >>> monkeypatch.setattr(zipfile, 'ZipFile', mock.MagicMock())
-    >>> print(); main()  # print workaround for bpo-32509
-    
-    ...data01... -> ziptestdata/...
-    ...
-    ...data02... -> ziptestdata/...
-    ...
-    """
-    suffixes = '01', '02'
-    tuple(map(generate, suffixes))
-
-
-def generate(suffix):
-    root = pathlib.Path(__file__).parent.relative_to(os.getcwd())
-    zfpath = root / f'zipdata{suffix}/ziptestdata.zip'
-    with zipfile.ZipFile(zfpath, 'w') as zf:
-        for src, rel in walk(root / f'data{suffix}'):
-            dst = 'ziptestdata' / pathlib.PurePosixPath(rel.as_posix())
-            print(src, '->', dst)
-            zf.write(src, dst)
-
-
-def walk(datapath):
-    for dirpath, dirnames, filenames in os.walk(datapath):
-        with contextlib.suppress(ValueError):
-            dirnames.remove('__pycache__')
-        for filename in filenames:
-            res = pathlib.Path(dirpath) / filename
-            rel = res.relative_to(datapath)
-            yield res, rel
-
-
-__name__ == '__main__' and main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/util.py b/pkg_resources/_vendor/importlib_resources/tests/util.py
index b596c0ce4f..fb827d2fa0 100644
--- a/pkg_resources/_vendor/importlib_resources/tests/util.py
+++ b/pkg_resources/_vendor/importlib_resources/tests/util.py
@@ -4,11 +4,12 @@
 import sys
 import types
 import pathlib
+import contextlib
 
 from . import data01
-from . import zipdata01
 from ..abc import ResourceReader
-from ._compat import import_helper
+from .compat.py39 import import_helper, os_helper
+from . import zip as zip_
 
 
 from importlib.machinery import ModuleSpec
@@ -80,32 +81,44 @@ def execute(self, package, path):
         """
 
     def test_package_name(self):
-        # Passing in the package name should succeed.
+        """
+        Passing in the package name should succeed.
+        """
         self.execute(data01.__name__, 'utf-8.file')
 
     def test_package_object(self):
-        # Passing in the package itself should succeed.
+        """
+        Passing in the package itself should succeed.
+        """
         self.execute(data01, 'utf-8.file')
 
     def test_string_path(self):
-        # Passing in a string for the path should succeed.
+        """
+        Passing in a string for the path should succeed.
+        """
         path = 'utf-8.file'
         self.execute(data01, path)
 
     def test_pathlib_path(self):
-        # Passing in a pathlib.PurePath object for the path should succeed.
+        """
+        Passing in a pathlib.PurePath object for the path should succeed.
+        """
         path = pathlib.PurePath('utf-8.file')
         self.execute(data01, path)
 
     def test_importing_module_as_side_effect(self):
-        # The anchor package can already be imported.
+        """
+        The anchor package can already be imported.
+        """
         del sys.modules[data01.__name__]
         self.execute(data01.__name__, 'utf-8.file')
 
     def test_missing_path(self):
-        # Attempting to open or read or request the path for a
-        # non-existent path should succeed if open_resource
-        # can return a viable data stream.
+        """
+        Attempting to open or read or request the path for a
+        non-existent path should succeed if open_resource
+        can return a viable data stream.
+        """
         bytes_data = io.BytesIO(b'Hello, world!')
         package = create_package(file=bytes_data, path=FileNotFoundError())
         self.execute(package, 'utf-8.file')
@@ -129,39 +142,23 @@ def test_useless_loader(self):
 
 
 class ZipSetupBase:
-    ZIP_MODULE = None
-
-    @classmethod
-    def setUpClass(cls):
-        data_path = pathlib.Path(cls.ZIP_MODULE.__file__)
-        data_dir = data_path.parent
-        cls._zip_path = str(data_dir / 'ziptestdata.zip')
-        sys.path.append(cls._zip_path)
-        cls.data = importlib.import_module('ziptestdata')
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            sys.path.remove(cls._zip_path)
-        except ValueError:
-            pass
-
-        try:
-            del sys.path_importer_cache[cls._zip_path]
-            del sys.modules[cls.data.__name__]
-        except KeyError:
-            pass
-
-        try:
-            del cls.data
-            del cls._zip_path
-        except AttributeError:
-            pass
+    ZIP_MODULE = 'data01'
 
     def setUp(self):
-        modules = import_helper.modules_setup()
-        self.addCleanup(import_helper.modules_cleanup, *modules)
+        self.fixtures = contextlib.ExitStack()
+        self.addCleanup(self.fixtures.close)
+
+        self.fixtures.enter_context(import_helper.isolated_modules())
+
+        temp_dir = self.fixtures.enter_context(os_helper.temp_dir())
+        modules = pathlib.Path(temp_dir) / 'zipped modules.zip'
+        src_path = pathlib.Path(__file__).parent.joinpath(self.ZIP_MODULE)
+        self.fixtures.enter_context(
+            import_helper.DirsOnSysPath(str(zip_.make_zip_file(src_path, modules)))
+        )
+
+        self.data = importlib.import_module(self.ZIP_MODULE)
 
 
 class ZipSetup(ZipSetupBase):
-    ZIP_MODULE = zipdata01  # type: ignore
+    pass
diff --git a/pkg_resources/_vendor/importlib_resources/tests/zip.py b/pkg_resources/_vendor/importlib_resources/tests/zip.py
new file mode 100644
index 0000000000..962195a901
--- /dev/null
+++ b/pkg_resources/_vendor/importlib_resources/tests/zip.py
@@ -0,0 +1,32 @@
+"""
+Generate zip test data files.
+"""
+
+import contextlib
+import os
+import pathlib
+import zipfile
+
+import zipp
+
+
+def make_zip_file(src, dst):
+    """
+    Zip the files in src into a new zipfile at dst.
+    """
+    with zipfile.ZipFile(dst, 'w') as zf:
+        for src_path, rel in walk(src):
+            dst_name = src.name / pathlib.PurePosixPath(rel.as_posix())
+            zf.write(src_path, dst_name)
+        zipp.CompleteDirs.inject(zf)
+    return dst
+
+
+def walk(datapath):
+    for dirpath, dirnames, filenames in os.walk(datapath):
+        with contextlib.suppress(ValueError):
+            dirnames.remove('__pycache__')
+        for filename in filenames:
+            res = pathlib.Path(dirpath) / filename
+            rel = res.relative_to(datapath)
+            yield res, rel
diff --git a/pkg_resources/_vendor/importlib_resources/tests/zipdata01/ziptestdata.zip b/pkg_resources/_vendor/importlib_resources/tests/zipdata01/ziptestdata.zip
deleted file mode 100644
index 9a3bb0739f87e97c1084b94d7d153680f6727738..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 876
zcmWIWW@Zs#00HOCX@Q%&m27l?Y!DU);;PJolGNgol*E!m{nC;&T|+ayw9K5;|NlG~
zQWMD
z9;rDw`8o=rA#S=B3g!7lIVp-}COK17UPc
zNtt;*xhM-3R!jMEPhCreO-3*u>5Df}T7+BJ{639e$2uhfsIs`pJ5Qf}C
xGXyDE@VNvOv@o!wQJfLgCAgysx3f@9jKpUmiW^zkK<;1z!tFpk^MROw0RS~O%0&PG

diff --git a/pkg_resources/_vendor/importlib_resources/tests/zipdata02/ziptestdata.zip b/pkg_resources/_vendor/importlib_resources/tests/zipdata02/ziptestdata.zip
deleted file mode 100644
index d63ff512d2807ef2fd259455283b81b02e0e45fb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 698
zcmWIWW@Zs#00HOCX@Ot{ln@8fRhb1Psl_EJi6x2p@$s2?nI-Y@dIgmMI5kP5Y0A$_
z#jWw|&p#`9ff_(q7K_HB)Z+ZoqU2OVy^@L&ph*fa0WRVlP*R?c+X1opI-R&20MZDv
z&j{oIpa8N17@0(vaR(gGH(;=&5k%n(M%;#g0ulz6G@1gL$cA79E2=^00gEsw4~s!C
zUxI@ZWaIMqz|BszK;s4KsL2<9jRy!Q2E6`2cTLHjr{wAk1ZCU@!+_
G1_l6Bc%f?m

diff --git a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/INSTALLER b/pkg_resources/_vendor/inflect-7.3.1.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/INSTALLER
rename to pkg_resources/_vendor/inflect-7.3.1.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/LICENSE b/pkg_resources/_vendor/inflect-7.3.1.dist-info/LICENSE
similarity index 100%
rename from pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/LICENSE
rename to pkg_resources/_vendor/inflect-7.3.1.dist-info/LICENSE
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA b/pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA
new file mode 100644
index 0000000000..9a2097a54a
--- /dev/null
+++ b/pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA
@@ -0,0 +1,591 @@
+Metadata-Version: 2.1
+Name: inflect
+Version: 7.3.1
+Summary: Correctly generate plurals, singular nouns, ordinals, indefinite articles
+Author-email: Paul Dyson 
+Maintainer-email: "Jason R. Coombs" 
+Project-URL: Source, https://github.com/jaraco/inflect
+Keywords: plural,inflect,participle
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Natural Language :: English
+Classifier: Operating System :: OS Independent
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Text Processing :: Linguistic
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: more-itertools >=8.5.0
+Requires-Dist: typeguard >=4.0.1
+Requires-Dist: typing-extensions ; python_version < "3.9"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: pygments ; extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/inflect.svg
+   :target: https://pypi.org/project/inflect
+
+.. image:: https://img.shields.io/pypi/pyversions/inflect.svg
+
+.. image:: https://github.com/jaraco/inflect/actions/workflows/main.yml/badge.svg
+   :target: https://github.com/jaraco/inflect/actions?query=workflow%3A%22tests%22
+   :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/inflect/badge/?version=latest
+   :target: https://inflect.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+   :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/inflect
+   :target: https://tidelift.com/subscription/pkg/pypi-inflect?utm_source=pypi-inflect&utm_medium=readme
+
+NAME
+====
+
+inflect.py - Correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words.
+
+SYNOPSIS
+========
+
+.. code-block:: python
+
+    import inflect
+
+    p = inflect.engine()
+
+    # METHODS:
+
+    # plural plural_noun plural_verb plural_adj singular_noun no num
+    # compare compare_nouns compare_nouns compare_adjs
+    # a an
+    # present_participle
+    # ordinal number_to_words
+    # join
+    # inflect classical gender
+    # defnoun defverb defadj defa defan
+
+
+    # UNCONDITIONALLY FORM THE PLURAL
+
+    print("The plural of ", word, " is ", p.plural(word))
+
+
+    # CONDITIONALLY FORM THE PLURAL
+
+    print("I saw", cat_count, p.plural("cat", cat_count))
+
+
+    # FORM PLURALS FOR SPECIFIC PARTS OF SPEECH
+
+    print(
+        p.plural_noun("I", N1),
+        p.plural_verb("saw", N1),
+        p.plural_adj("my", N2),
+        p.plural_noun("saw", N2),
+    )
+
+
+    # FORM THE SINGULAR OF PLURAL NOUNS
+
+    print("The singular of ", word, " is ", p.singular_noun(word))
+
+    # SELECT THE GENDER OF SINGULAR PRONOUNS
+
+    print(p.singular_noun("they"))  # 'it'
+    p.gender("feminine")
+    print(p.singular_noun("they"))  # 'she'
+
+
+    # DEAL WITH "0/1/N" -> "no/1/N" TRANSLATION:
+
+    print("There ", p.plural_verb("was", errors), p.no(" error", errors))
+
+
+    # USE DEFAULT COUNTS:
+
+    print(
+        p.num(N1, ""),
+        p.plural("I"),
+        p.plural_verb(" saw"),
+        p.num(N2),
+        p.plural_noun(" saw"),
+    )
+    print("There ", p.num(errors, ""), p.plural_verb("was"), p.no(" error"))
+
+
+    # COMPARE TWO WORDS "NUMBER-INSENSITIVELY":
+
+    if p.compare(word1, word2):
+        print("same")
+    if p.compare_nouns(word1, word2):
+        print("same noun")
+    if p.compare_verbs(word1, word2):
+        print("same verb")
+    if p.compare_adjs(word1, word2):
+        print("same adj.")
+
+
+    # ADD CORRECT "a" OR "an" FOR A GIVEN WORD:
+
+    print("Did you want ", p.a(thing), " or ", p.an(idea))
+
+
+    # CONVERT NUMERALS INTO ORDINALS (i.e. 1->1st, 2->2nd, 3->3rd, etc.)
+
+    print("It was", p.ordinal(position), " from the left\n")
+
+    # CONVERT NUMERALS TO WORDS (i.e. 1->"one", 101->"one hundred and one", etc.)
+    # RETURNS A SINGLE STRING...
+
+    words = p.number_to_words(1234)
+    # "one thousand, two hundred and thirty-four"
+    words = p.number_to_words(p.ordinal(1234))
+    # "one thousand, two hundred and thirty-fourth"
+
+
+    # GET BACK A LIST OF STRINGS, ONE FOR EACH "CHUNK"...
+
+    words = p.number_to_words(1234, wantlist=True)
+    # ("one thousand","two hundred and thirty-four")
+
+
+    # OPTIONAL PARAMETERS CHANGE TRANSLATION:
+
+    words = p.number_to_words(12345, group=1)
+    # "one, two, three, four, five"
+
+    words = p.number_to_words(12345, group=2)
+    # "twelve, thirty-four, five"
+
+    words = p.number_to_words(12345, group=3)
+    # "one twenty-three, forty-five"
+
+    words = p.number_to_words(1234, andword="")
+    # "one thousand, two hundred thirty-four"
+
+    words = p.number_to_words(1234, andword=", plus")
+    # "one thousand, two hundred, plus thirty-four"
+    # TODO: I get no comma before plus: check perl
+
+    words = p.number_to_words(555_1202, group=1, zero="oh")
+    # "five, five, five, one, two, oh, two"
+
+    words = p.number_to_words(555_1202, group=1, one="unity")
+    # "five, five, five, unity, two, oh, two"
+
+    words = p.number_to_words(123.456, group=1, decimal="mark")
+    # "one two three mark four five six"
+    # TODO: DOCBUG: perl gives commas here as do I
+
+    # LITERAL STYLE ONLY NAMES NUMBERS LESS THAN A CERTAIN THRESHOLD...
+
+    words = p.number_to_words(9, threshold=10)  # "nine"
+    words = p.number_to_words(10, threshold=10)  # "ten"
+    words = p.number_to_words(11, threshold=10)  # "11"
+    words = p.number_to_words(1000, threshold=10)  # "1,000"
+
+    # JOIN WORDS INTO A LIST:
+
+    mylist = p.join(("apple", "banana", "carrot"))
+    # "apple, banana, and carrot"
+
+    mylist = p.join(("apple", "banana"))
+    # "apple and banana"
+
+    mylist = p.join(("apple", "banana", "carrot"), final_sep="")
+    # "apple, banana and carrot"
+
+
+    # REQUIRE "CLASSICAL" PLURALS (EG: "focus"->"foci", "cherub"->"cherubim")
+
+    p.classical()  # USE ALL CLASSICAL PLURALS
+
+    p.classical(all=True)  # USE ALL CLASSICAL PLURALS
+    p.classical(all=False)  # SWITCH OFF CLASSICAL MODE
+
+    p.classical(zero=True)  #  "no error" INSTEAD OF "no errors"
+    p.classical(zero=False)  #  "no errors" INSTEAD OF "no error"
+
+    p.classical(herd=True)  #  "2 buffalo" INSTEAD OF "2 buffalos"
+    p.classical(herd=False)  #  "2 buffalos" INSTEAD OF "2 buffalo"
+
+    p.classical(persons=True)  # "2 chairpersons" INSTEAD OF "2 chairpeople"
+    p.classical(persons=False)  # "2 chairpeople" INSTEAD OF "2 chairpersons"
+
+    p.classical(ancient=True)  # "2 formulae" INSTEAD OF "2 formulas"
+    p.classical(ancient=False)  # "2 formulas" INSTEAD OF "2 formulae"
+
+
+    # INTERPOLATE "plural()", "plural_noun()", "plural_verb()", "plural_adj()", "singular_noun()",
+    # a()", "an()", "num()" AND "ordinal()" WITHIN STRINGS:
+
+    print(p.inflect("The plural of {0} is plural('{0}')".format(word)))
+    print(p.inflect("The singular of {0} is singular_noun('{0}')".format(word)))
+    print(p.inflect("I saw {0} plural('cat',{0})".format(cat_count)))
+    print(
+        p.inflect(
+            "plural('I',{0}) "
+            "plural_verb('saw',{0}) "
+            "plural('a',{1}) "
+            "plural_noun('saw',{1})".format(N1, N2)
+        )
+    )
+    print(
+        p.inflect(
+            "num({0}, False)plural('I') "
+            "plural_verb('saw') "
+            "num({1}, False)plural('a') "
+            "plural_noun('saw')".format(N1, N2)
+        )
+    )
+    print(p.inflect("I saw num({0}) plural('cat')\nnum()".format(cat_count)))
+    print(p.inflect("There plural_verb('was',{0}) no('error',{0})".format(errors)))
+    print(p.inflect("There num({0}, False)plural_verb('was') no('error')".format(errors)))
+    print(p.inflect("Did you want a('{0}') or an('{1}')".format(thing, idea)))
+    print(p.inflect("It was ordinal('{0}') from the left".format(position)))
+
+
+    # ADD USER-DEFINED INFLECTIONS (OVERRIDING INBUILT RULES):
+
+    p.defnoun("VAX", "VAXen")  # SINGULAR => PLURAL
+
+    p.defverb(
+        "will",  # 1ST PERSON SINGULAR
+        "shall",  # 1ST PERSON PLURAL
+        "will",  # 2ND PERSON SINGULAR
+        "will",  # 2ND PERSON PLURAL
+        "will",  # 3RD PERSON SINGULAR
+        "will",  # 3RD PERSON PLURAL
+    )
+
+    p.defadj("hir", "their")  # SINGULAR => PLURAL
+
+    p.defa("h")  # "AY HALWAYS SEZ 'HAITCH'!"
+
+    p.defan("horrendous.*")  # "AN HORRENDOUS AFFECTATION"
+
+
+DESCRIPTION
+===========
+
+The methods of the class ``engine`` in module ``inflect.py`` provide plural
+inflections, singular noun inflections, "a"/"an" selection for English words,
+and manipulation of numbers as words.
+
+Plural forms of all nouns, most verbs, and some adjectives are
+provided. Where appropriate, "classical" variants (for example: "brother" ->
+"brethren", "dogma" -> "dogmata", etc.) are also provided.
+
+Single forms of nouns are also provided. The gender of singular pronouns
+can be chosen (for example "they" -> "it" or "she" or "he" or "they").
+
+Pronunciation-based "a"/"an" selection is provided for all English
+words, and most initialisms.
+
+It is also possible to inflect numerals (1,2,3) to ordinals (1st, 2nd, 3rd)
+and to English words ("one", "two", "three").
+
+In generating these inflections, ``inflect.py`` follows the Oxford
+English Dictionary and the guidelines in Fowler's Modern English
+Usage, preferring the former where the two disagree.
+
+The module is built around standard British spelling, but is designed
+to cope with common American variants as well. Slang, jargon, and
+other English dialects are *not* explicitly catered for.
+
+Where two or more inflected forms exist for a single word (typically a
+"classical" form and a "modern" form), ``inflect.py`` prefers the
+more common form (typically the "modern" one), unless "classical"
+processing has been specified
+(see `MODERN VS CLASSICAL INFLECTIONS`).
+
+FORMING PLURALS AND SINGULARS
+=============================
+
+Inflecting Plurals and Singulars
+--------------------------------
+
+All of the ``plural...`` plural inflection methods take the word to be
+inflected as their first argument and return the corresponding inflection.
+Note that all such methods expect the *singular* form of the word. The
+results of passing a plural form are undefined (and unlikely to be correct).
+Similarly, the ``si...`` singular inflection method expects the *plural*
+form of the word.
+
+The ``plural...`` methods also take an optional second argument,
+which indicates the grammatical "number" of the word (or of another word
+with which the word being inflected must agree). If the "number" argument is
+supplied and is not ``1`` (or ``"one"`` or ``"a"``, or some other adjective that
+implies the singular), the plural form of the word is returned. If the
+"number" argument *does* indicate singularity, the (uninflected) word
+itself is returned. If the number argument is omitted, the plural form
+is returned unconditionally.
+
+The ``si...`` method takes a second argument in a similar fashion. If it is
+some form of the number ``1``, or is omitted, the singular form is returned.
+Otherwise the plural is returned unaltered.
+
+
+The various methods of ``inflect.engine`` are:
+
+
+
+``plural_noun(word, count=None)``
+
+ The method ``plural_noun()`` takes a *singular* English noun or
+ pronoun and returns its plural. Pronouns in the nominative ("I" ->
+ "we") and accusative ("me" -> "us") cases are handled, as are
+ possessive pronouns ("mine" -> "ours").
+
+
+``plural_verb(word, count=None)``
+
+ The method ``plural_verb()`` takes the *singular* form of a
+ conjugated verb (that is, one which is already in the correct "person"
+ and "mood") and returns the corresponding plural conjugation.
+
+
+``plural_adj(word, count=None)``
+
+ The method ``plural_adj()`` takes the *singular* form of
+ certain types of adjectives and returns the corresponding plural form.
+ Adjectives that are correctly handled include: "numerical" adjectives
+ ("a" -> "some"), demonstrative adjectives ("this" -> "these", "that" ->
+ "those"), and possessives ("my" -> "our", "cat's" -> "cats'", "child's"
+ -> "childrens'", etc.)
+
+
+``plural(word, count=None)``
+
+ The method ``plural()`` takes a *singular* English noun,
+ pronoun, verb, or adjective and returns its plural form. Where a word
+ has more than one inflection depending on its part of speech (for
+ example, the noun "thought" inflects to "thoughts", the verb "thought"
+ to "thought"), the (singular) noun sense is preferred to the (singular)
+ verb sense.
+
+ Hence ``plural("knife")`` will return "knives" ("knife" having been treated
+ as a singular noun), whereas ``plural("knifes")`` will return "knife"
+ ("knifes" having been treated as a 3rd person singular verb).
+
+ The inherent ambiguity of such cases suggests that,
+ where the part of speech is known, ``plural_noun``, ``plural_verb``, and
+ ``plural_adj`` should be used in preference to ``plural``.
+
+
+``singular_noun(word, count=None)``
+
+ The method ``singular_noun()`` takes a *plural* English noun or
+ pronoun and returns its singular. Pronouns in the nominative ("we" ->
+ "I") and accusative ("us" -> "me") cases are handled, as are
+ possessive pronouns ("ours" -> "mine"). When third person
+ singular pronouns are returned they take the neuter gender by default
+ ("they" -> "it"), not ("they"-> "she") nor ("they" -> "he"). This can be
+ changed with ``gender()``.
+
+Note that all these methods ignore any whitespace surrounding the
+word being inflected, but preserve that whitespace when the result is
+returned. For example, ``plural(" cat  ")`` returns " cats  ".
+
+
+``gender(genderletter)``
+
+ The third person plural pronoun takes the same form for the female, male and
+ neuter (e.g. "they"). The singular however, depends upon gender (e.g. "she",
+ "he", "it" and "they" -- "they" being the gender neutral form.) By default
+ ``singular_noun`` returns the neuter form, however, the gender can be selected with
+ the ``gender`` method. Pass the first letter of the gender to
+ ``gender`` to return the f(eminine), m(asculine), n(euter) or t(hey)
+ form of the singular. e.g.
+ gender('f') followed by singular_noun('themselves') returns 'herself'.
+
+Numbered plurals
+----------------
+
+The ``plural...`` methods return only the inflected word, not the count that
+was used to inflect it. Thus, in order to produce "I saw 3 ducks", it
+is necessary to use:
+
+.. code-block:: python
+
+    print("I saw", N, p.plural_noun(animal, N))
+
+Since the usual purpose of producing a plural is to make it agree with
+a preceding count, inflect.py provides a method
+(``no(word, count)``) which, given a word and a(n optional) count, returns the
+count followed by the correctly inflected word. Hence the previous
+example can be rewritten:
+
+.. code-block:: python
+
+    print("I saw ", p.no(animal, N))
+
+In addition, if the count is zero (or some other term which implies
+zero, such as ``"zero"``, ``"nil"``, etc.) the count is replaced by the
+word "no". Hence, if ``N`` had the value zero, the previous example
+would print (the somewhat more elegant)::
+
+    I saw no animals
+
+rather than::
+
+    I saw 0 animals
+
+Note that the name of the method is a pun: the method
+returns either a number (a *No.*) or a ``"no"``, in front of the
+inflected word.
+
+
+Reducing the number of counts required
+--------------------------------------
+
+In some contexts, the need to supply an explicit count to the various
+``plural...`` methods makes for tiresome repetition. For example:
+
+.. code-block:: python
+
+    print(
+        plural_adj("This", errors),
+        plural_noun(" error", errors),
+        plural_verb(" was", errors),
+        " fatal.",
+    )
+
+inflect.py therefore provides a method
+(``num(count=None, show=None)``) which may be used to set a persistent "default number"
+value. If such a value is set, it is subsequently used whenever an
+optional second "number" argument is omitted. The default value thus set
+can subsequently be removed by calling ``num()`` with no arguments.
+Hence we could rewrite the previous example:
+
+.. code-block:: python
+
+    p.num(errors)
+    print(p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal.")
+    p.num()
+
+Normally, ``num()`` returns its first argument, so that it may also
+be "inlined" in contexts like:
+
+.. code-block:: python
+
+    print(p.num(errors), p.plural_noun(" error"), p.plural_verb(" was"), " detected.")
+    if severity > 1:
+        print(
+            p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
+        )
+
+However, in certain contexts (see `INTERPOLATING INFLECTIONS IN STRINGS`)
+it is preferable that ``num()`` return an empty string. Hence ``num()``
+provides an optional second argument. If that argument is supplied (that is, if
+it is defined) and evaluates to false, ``num`` returns an empty string
+instead of its first argument. For example:
+
+.. code-block:: python
+
+    print(p.num(errors, 0), p.no("error"), p.plural_verb(" was"), " detected.")
+    if severity > 1:
+        print(
+            p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
+        )
+
+
+
+Number-insensitive equality
+---------------------------
+
+inflect.py also provides a solution to the problem
+of comparing words of differing plurality through the methods
+``compare(word1, word2)``, ``compare_nouns(word1, word2)``,
+``compare_verbs(word1, word2)``, and ``compare_adjs(word1, word2)``.
+Each  of these methods takes two strings, and  compares them
+using the corresponding plural-inflection method (``plural()``, ``plural_noun()``,
+``plural_verb()``, and ``plural_adj()`` respectively).
+
+The comparison returns true if:
+
+- the strings are equal, or
+- one string is equal to a plural form of the other, or
+- the strings are two different plural forms of the one word.
+
+
+Hence all of the following return true:
+
+.. code-block:: python
+
+    p.compare("index", "index")  # RETURNS "eq"
+    p.compare("index", "indexes")  # RETURNS "s:p"
+    p.compare("index", "indices")  # RETURNS "s:p"
+    p.compare("indexes", "index")  # RETURNS "p:s"
+    p.compare("indices", "index")  # RETURNS "p:s"
+    p.compare("indices", "indexes")  # RETURNS "p:p"
+    p.compare("indexes", "indices")  # RETURNS "p:p"
+    p.compare("indices", "indices")  # RETURNS "eq"
+
+As indicated by the comments in the previous example, the actual value
+returned by the various ``compare`` methods encodes which of the
+three equality rules succeeded: "eq" is returned if the strings were
+identical, "s:p" if the strings were singular and plural respectively,
+"p:s" for plural and singular, and "p:p" for two distinct plurals.
+Inequality is indicated by returning an empty string.
+
+It should be noted that two distinct singular words which happen to take
+the same plural form are *not* considered equal, nor are cases where
+one (singular) word's plural is the other (plural) word's singular.
+Hence all of the following return false:
+
+.. code-block:: python
+
+    p.compare("base", "basis")  # ALTHOUGH BOTH -> "bases"
+    p.compare("syrinx", "syringe")  # ALTHOUGH BOTH -> "syringes"
+    p.compare("she", "he")  # ALTHOUGH BOTH -> "they"
+
+    p.compare("opus", "operas")  # ALTHOUGH "opus" -> "opera" -> "operas"
+    p.compare("taxi", "taxes")  # ALTHOUGH "taxi" -> "taxis" -> "taxes"
+
+Note too that, although the comparison is "number-insensitive" it is *not*
+case-insensitive (that is, ``plural("time","Times")`` returns false. To obtain
+both number and case insensitivity, use the ``lower()`` method on both strings
+(that is, ``plural("time".lower(), "Times".lower())`` returns true).
+
+Related Functionality
+=====================
+
+Shout out to these libraries that provide related functionality:
+
+* `WordSet `_
+  parses identifiers like variable names into sets of words suitable for re-assembling
+  in another form.
+
+* `word2number `_ converts words to
+  a number.
+
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD b/pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD
new file mode 100644
index 0000000000..73ff576be5
--- /dev/null
+++ b/pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD
@@ -0,0 +1,13 @@
+inflect-7.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+inflect-7.3.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+inflect-7.3.1.dist-info/METADATA,sha256=ZgMNY0WAZRs-U8wZiV2SMfjSKqBrMngXyDMs_CAwMwg,21079
+inflect-7.3.1.dist-info/RECORD,,
+inflect-7.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
+inflect-7.3.1.dist-info/top_level.txt,sha256=m52ujdp10CqT6jh1XQxZT6kEntcnv-7Tl7UiGNTzWZA,8
+inflect/__init__.py,sha256=Jxy1HJXZiZ85kHeLAhkmvz6EMTdFqBe-duvt34R6IOc,103796
+inflect/__pycache__/__init__.cpython-312.pyc,,
+inflect/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+inflect/compat/__pycache__/__init__.cpython-312.pyc,,
+inflect/compat/__pycache__/py38.cpython-312.pyc,,
+inflect/compat/py38.py,sha256=oObVfVnWX9_OpnOuEJn1mFbJxVhwyR5epbiTNXDDaso,160
+inflect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/WHEEL b/pkg_resources/_vendor/inflect-7.3.1.dist-info/WHEEL
similarity index 65%
rename from pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/WHEEL
rename to pkg_resources/_vendor/inflect-7.3.1.dist-info/WHEEL
index becc9a66ea..564c6724e4 100644
--- a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/WHEEL
+++ b/pkg_resources/_vendor/inflect-7.3.1.dist-info/WHEEL
@@ -1,5 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.37.1)
+Generator: setuptools (70.2.0)
 Root-Is-Purelib: true
 Tag: py3-none-any
 
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt b/pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt
new file mode 100644
index 0000000000..0fd75fab3e
--- /dev/null
+++ b/pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+inflect
diff --git a/pkg_resources/_vendor/inflect/__init__.py b/pkg_resources/_vendor/inflect/__init__.py
new file mode 100644
index 0000000000..3eec27f4c6
--- /dev/null
+++ b/pkg_resources/_vendor/inflect/__init__.py
@@ -0,0 +1,3986 @@
+"""
+inflect: english language inflection
+ - correctly generate plurals, ordinals, indefinite articles
+ - convert numbers to words
+
+Copyright (C) 2010 Paul Dyson
+
+Based upon the Perl module
+`Lingua::EN::Inflect `_.
+
+methods:
+    classical inflect
+    plural plural_noun plural_verb plural_adj singular_noun no num a an
+    compare compare_nouns compare_verbs compare_adjs
+    present_participle
+    ordinal
+    number_to_words
+    join
+    defnoun defverb defadj defa defan
+
+INFLECTIONS:
+    classical inflect
+    plural plural_noun plural_verb plural_adj singular_noun compare
+    no num a an present_participle
+
+PLURALS:
+    classical inflect
+    plural plural_noun plural_verb plural_adj singular_noun no num
+    compare compare_nouns compare_verbs compare_adjs
+
+COMPARISONS:
+    classical
+    compare compare_nouns compare_verbs compare_adjs
+
+ARTICLES:
+    classical inflect num a an
+
+NUMERICAL:
+    ordinal number_to_words
+
+USER_DEFINED:
+    defnoun defverb defadj defa defan
+
+Exceptions:
+ UnknownClassicalModeError
+ BadNumValueError
+ BadChunkingOptionError
+ NumOutOfRangeError
+ BadUserDefinedPatternError
+ BadRcFileError
+ BadGenderError
+
+"""
+
+from __future__ import annotations
+
+import ast
+import collections
+import contextlib
+import functools
+import itertools
+import re
+from numbers import Number
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Callable,
+    Dict,
+    Iterable,
+    List,
+    Literal,
+    Match,
+    Optional,
+    Sequence,
+    Tuple,
+    Union,
+    cast,
+)
+
+from more_itertools import windowed_complete
+from typeguard import typechecked
+
+from .compat.py38 import Annotated
+
+
+class UnknownClassicalModeError(Exception):
+    pass
+
+
+class BadNumValueError(Exception):
+    pass
+
+
+class BadChunkingOptionError(Exception):
+    pass
+
+
+class NumOutOfRangeError(Exception):
+    pass
+
+
+class BadUserDefinedPatternError(Exception):
+    pass
+
+
+class BadRcFileError(Exception):
+    pass
+
+
+class BadGenderError(Exception):
+    pass
+
+
+def enclose(s: str) -> str:
+    return f"(?:{s})"
+
+
+def joinstem(cutpoint: Optional[int] = 0, words: Optional[Iterable[str]] = None) -> str:
+    """
+    Join stem of each word in words into a string for regex.
+
+    Each word is truncated at cutpoint.
+
+    Cutpoint is usually negative indicating the number of letters to remove
+    from the end of each word.
+
+    >>> joinstem(-2, ["ephemeris", "iris", ".*itis"])
+    '(?:ephemer|ir|.*it)'
+
+    >>> joinstem(None, ["ephemeris"])
+    '(?:ephemeris)'
+
+    >>> joinstem(5, None)
+    '(?:)'
+    """
+    return enclose("|".join(w[:cutpoint] for w in words or []))
+
+
+def bysize(words: Iterable[str]) -> Dict[int, set]:
+    """
+    From a list of words, return a dict of sets sorted by word length.
+
+    >>> words = ['ant', 'cat', 'dog', 'pig', 'frog', 'goat', 'horse', 'elephant']
+    >>> ret = bysize(words)
+    >>> sorted(ret[3])
+    ['ant', 'cat', 'dog', 'pig']
+    >>> ret[5]
+    {'horse'}
+    """
+    res: Dict[int, set] = collections.defaultdict(set)
+    for w in words:
+        res[len(w)].add(w)
+    return res
+
+
+def make_pl_si_lists(
+    lst: Iterable[str],
+    plending: str,
+    siendingsize: Optional[int],
+    dojoinstem: bool = True,
+):
+    """
+    given a list of singular words: lst
+
+    an ending to append to make the plural: plending
+
+    the number of characters to remove from the singular
+    before appending plending: siendingsize
+
+    a flag whether to create a joinstem: dojoinstem
+
+    return:
+    a list of pluralised words: si_list (called si because this is what you need to
+    look for to make the singular)
+
+    the pluralised words as a dict of sets sorted by word length: si_bysize
+    the singular words as a dict of sets sorted by word length: pl_bysize
+    if dojoinstem is True: a regular expression that matches any of the stems: stem
+    """
+    if siendingsize is not None:
+        siendingsize = -siendingsize
+    si_list = [w[:siendingsize] + plending for w in lst]
+    pl_bysize = bysize(lst)
+    si_bysize = bysize(si_list)
+    if dojoinstem:
+        stem = joinstem(siendingsize, lst)
+        return si_list, si_bysize, pl_bysize, stem
+    else:
+        return si_list, si_bysize, pl_bysize
+
+
+# 1. PLURALS
+
+pl_sb_irregular_s = {
+    "corpus": "corpuses|corpora",
+    "opus": "opuses|opera",
+    "genus": "genera",
+    "mythos": "mythoi",
+    "penis": "penises|penes",
+    "testis": "testes",
+    "atlas": "atlases|atlantes",
+    "yes": "yeses",
+}
+
+pl_sb_irregular = {
+    "child": "children",
+    "chili": "chilis|chilies",
+    "brother": "brothers|brethren",
+    "infinity": "infinities|infinity",
+    "loaf": "loaves",
+    "lore": "lores|lore",
+    "hoof": "hoofs|hooves",
+    "beef": "beefs|beeves",
+    "thief": "thiefs|thieves",
+    "money": "monies",
+    "mongoose": "mongooses",
+    "ox": "oxen",
+    "cow": "cows|kine",
+    "graffito": "graffiti",
+    "octopus": "octopuses|octopodes",
+    "genie": "genies|genii",
+    "ganglion": "ganglions|ganglia",
+    "trilby": "trilbys",
+    "turf": "turfs|turves",
+    "numen": "numina",
+    "atman": "atmas",
+    "occiput": "occiputs|occipita",
+    "sabretooth": "sabretooths",
+    "sabertooth": "sabertooths",
+    "lowlife": "lowlifes",
+    "flatfoot": "flatfoots",
+    "tenderfoot": "tenderfoots",
+    "romany": "romanies",
+    "jerry": "jerries",
+    "mary": "maries",
+    "talouse": "talouses",
+    "rom": "roma",
+    "carmen": "carmina",
+}
+
+pl_sb_irregular.update(pl_sb_irregular_s)
+# pl_sb_irregular_keys = enclose('|'.join(pl_sb_irregular.keys()))
+
+pl_sb_irregular_caps = {
+    "Romany": "Romanies",
+    "Jerry": "Jerrys",
+    "Mary": "Marys",
+    "Rom": "Roma",
+}
+
+pl_sb_irregular_compound = {"prima donna": "prima donnas|prime donne"}
+
+si_sb_irregular = {v: k for (k, v) in pl_sb_irregular.items()}
+for k in list(si_sb_irregular):
+    if "|" in k:
+        k1, k2 = k.split("|")
+        si_sb_irregular[k1] = si_sb_irregular[k2] = si_sb_irregular[k]
+        del si_sb_irregular[k]
+si_sb_irregular_caps = {v: k for (k, v) in pl_sb_irregular_caps.items()}
+si_sb_irregular_compound = {v: k for (k, v) in pl_sb_irregular_compound.items()}
+for k in list(si_sb_irregular_compound):
+    if "|" in k:
+        k1, k2 = k.split("|")
+        si_sb_irregular_compound[k1] = si_sb_irregular_compound[k2] = (
+            si_sb_irregular_compound[k]
+        )
+        del si_sb_irregular_compound[k]
+
+# si_sb_irregular_keys = enclose('|'.join(si_sb_irregular.keys()))
+
+# Z's that don't double
+
+pl_sb_z_zes_list = ("quartz", "topaz")
+pl_sb_z_zes_bysize = bysize(pl_sb_z_zes_list)
+
+pl_sb_ze_zes_list = ("snooze",)
+pl_sb_ze_zes_bysize = bysize(pl_sb_ze_zes_list)
+
+
+# CLASSICAL "..is" -> "..ides"
+
+pl_sb_C_is_ides_complete = [
+    # GENERAL WORDS...
+    "ephemeris",
+    "iris",
+    "clitoris",
+    "chrysalis",
+    "epididymis",
+]
+
+pl_sb_C_is_ides_endings = [
+    # INFLAMATIONS...
+    "itis"
+]
+
+pl_sb_C_is_ides = joinstem(
+    -2, pl_sb_C_is_ides_complete + [f".*{w}" for w in pl_sb_C_is_ides_endings]
+)
+
+pl_sb_C_is_ides_list = pl_sb_C_is_ides_complete + pl_sb_C_is_ides_endings
+
+(
+    si_sb_C_is_ides_list,
+    si_sb_C_is_ides_bysize,
+    pl_sb_C_is_ides_bysize,
+) = make_pl_si_lists(pl_sb_C_is_ides_list, "ides", 2, dojoinstem=False)
+
+
+# CLASSICAL "..a" -> "..ata"
+
+pl_sb_C_a_ata_list = (
+    "anathema",
+    "bema",
+    "carcinoma",
+    "charisma",
+    "diploma",
+    "dogma",
+    "drama",
+    "edema",
+    "enema",
+    "enigma",
+    "lemma",
+    "lymphoma",
+    "magma",
+    "melisma",
+    "miasma",
+    "oedema",
+    "sarcoma",
+    "schema",
+    "soma",
+    "stigma",
+    "stoma",
+    "trauma",
+    "gumma",
+    "pragma",
+)
+
+(
+    si_sb_C_a_ata_list,
+    si_sb_C_a_ata_bysize,
+    pl_sb_C_a_ata_bysize,
+    pl_sb_C_a_ata,
+) = make_pl_si_lists(pl_sb_C_a_ata_list, "ata", 1)
+
+# UNCONDITIONAL "..a" -> "..ae"
+
+pl_sb_U_a_ae_list = (
+    "alumna",
+    "alga",
+    "vertebra",
+    "persona",
+    "vita",
+)
+(
+    si_sb_U_a_ae_list,
+    si_sb_U_a_ae_bysize,
+    pl_sb_U_a_ae_bysize,
+    pl_sb_U_a_ae,
+) = make_pl_si_lists(pl_sb_U_a_ae_list, "e", None)
+
+# CLASSICAL "..a" -> "..ae"
+
+pl_sb_C_a_ae_list = (
+    "amoeba",
+    "antenna",
+    "formula",
+    "hyperbola",
+    "medusa",
+    "nebula",
+    "parabola",
+    "abscissa",
+    "hydra",
+    "nova",
+    "lacuna",
+    "aurora",
+    "umbra",
+    "flora",
+    "fauna",
+)
+(
+    si_sb_C_a_ae_list,
+    si_sb_C_a_ae_bysize,
+    pl_sb_C_a_ae_bysize,
+    pl_sb_C_a_ae,
+) = make_pl_si_lists(pl_sb_C_a_ae_list, "e", None)
+
+
+# CLASSICAL "..en" -> "..ina"
+
+pl_sb_C_en_ina_list = ("stamen", "foramen", "lumen")
+
+(
+    si_sb_C_en_ina_list,
+    si_sb_C_en_ina_bysize,
+    pl_sb_C_en_ina_bysize,
+    pl_sb_C_en_ina,
+) = make_pl_si_lists(pl_sb_C_en_ina_list, "ina", 2)
+
+
+# UNCONDITIONAL "..um" -> "..a"
+
+pl_sb_U_um_a_list = (
+    "bacterium",
+    "agendum",
+    "desideratum",
+    "erratum",
+    "stratum",
+    "datum",
+    "ovum",
+    "extremum",
+    "candelabrum",
+)
+(
+    si_sb_U_um_a_list,
+    si_sb_U_um_a_bysize,
+    pl_sb_U_um_a_bysize,
+    pl_sb_U_um_a,
+) = make_pl_si_lists(pl_sb_U_um_a_list, "a", 2)
+
+# CLASSICAL "..um" -> "..a"
+
+pl_sb_C_um_a_list = (
+    "maximum",
+    "minimum",
+    "momentum",
+    "optimum",
+    "quantum",
+    "cranium",
+    "curriculum",
+    "dictum",
+    "phylum",
+    "aquarium",
+    "compendium",
+    "emporium",
+    "encomium",
+    "gymnasium",
+    "honorarium",
+    "interregnum",
+    "lustrum",
+    "memorandum",
+    "millennium",
+    "rostrum",
+    "spectrum",
+    "speculum",
+    "stadium",
+    "trapezium",
+    "ultimatum",
+    "medium",
+    "vacuum",
+    "velum",
+    "consortium",
+    "arboretum",
+)
+
+(
+    si_sb_C_um_a_list,
+    si_sb_C_um_a_bysize,
+    pl_sb_C_um_a_bysize,
+    pl_sb_C_um_a,
+) = make_pl_si_lists(pl_sb_C_um_a_list, "a", 2)
+
+
+# UNCONDITIONAL "..us" -> "i"
+
+pl_sb_U_us_i_list = (
+    "alumnus",
+    "alveolus",
+    "bacillus",
+    "bronchus",
+    "locus",
+    "nucleus",
+    "stimulus",
+    "meniscus",
+    "sarcophagus",
+)
+(
+    si_sb_U_us_i_list,
+    si_sb_U_us_i_bysize,
+    pl_sb_U_us_i_bysize,
+    pl_sb_U_us_i,
+) = make_pl_si_lists(pl_sb_U_us_i_list, "i", 2)
+
+# CLASSICAL "..us" -> "..i"
+
+pl_sb_C_us_i_list = (
+    "focus",
+    "radius",
+    "genius",
+    "incubus",
+    "succubus",
+    "nimbus",
+    "fungus",
+    "nucleolus",
+    "stylus",
+    "torus",
+    "umbilicus",
+    "uterus",
+    "hippopotamus",
+    "cactus",
+)
+
+(
+    si_sb_C_us_i_list,
+    si_sb_C_us_i_bysize,
+    pl_sb_C_us_i_bysize,
+    pl_sb_C_us_i,
+) = make_pl_si_lists(pl_sb_C_us_i_list, "i", 2)
+
+
+# CLASSICAL "..us" -> "..us"  (ASSIMILATED 4TH DECLENSION LATIN NOUNS)
+
+pl_sb_C_us_us = (
+    "status",
+    "apparatus",
+    "prospectus",
+    "sinus",
+    "hiatus",
+    "impetus",
+    "plexus",
+)
+pl_sb_C_us_us_bysize = bysize(pl_sb_C_us_us)
+
+# UNCONDITIONAL "..on" -> "a"
+
+pl_sb_U_on_a_list = (
+    "criterion",
+    "perihelion",
+    "aphelion",
+    "phenomenon",
+    "prolegomenon",
+    "noumenon",
+    "organon",
+    "asyndeton",
+    "hyperbaton",
+)
+(
+    si_sb_U_on_a_list,
+    si_sb_U_on_a_bysize,
+    pl_sb_U_on_a_bysize,
+    pl_sb_U_on_a,
+) = make_pl_si_lists(pl_sb_U_on_a_list, "a", 2)
+
+# CLASSICAL "..on" -> "..a"
+
+pl_sb_C_on_a_list = ("oxymoron",)
+
+(
+    si_sb_C_on_a_list,
+    si_sb_C_on_a_bysize,
+    pl_sb_C_on_a_bysize,
+    pl_sb_C_on_a,
+) = make_pl_si_lists(pl_sb_C_on_a_list, "a", 2)
+
+
+# CLASSICAL "..o" -> "..i"  (BUT NORMALLY -> "..os")
+
+pl_sb_C_o_i = [
+    "solo",
+    "soprano",
+    "basso",
+    "alto",
+    "contralto",
+    "tempo",
+    "piano",
+    "virtuoso",
+]  # list not tuple so can concat for pl_sb_U_o_os
+
+pl_sb_C_o_i_bysize = bysize(pl_sb_C_o_i)
+si_sb_C_o_i_bysize = bysize([f"{w[:-1]}i" for w in pl_sb_C_o_i])
+
+pl_sb_C_o_i_stems = joinstem(-1, pl_sb_C_o_i)
+
+# ALWAYS "..o" -> "..os"
+
+pl_sb_U_o_os_complete = {"ado", "ISO", "NATO", "NCO", "NGO", "oto"}
+si_sb_U_o_os_complete = {f"{w}s" for w in pl_sb_U_o_os_complete}
+
+
+pl_sb_U_o_os_endings = [
+    "aficionado",
+    "aggro",
+    "albino",
+    "allegro",
+    "ammo",
+    "Antananarivo",
+    "archipelago",
+    "armadillo",
+    "auto",
+    "avocado",
+    "Bamako",
+    "Barquisimeto",
+    "bimbo",
+    "bingo",
+    "Biro",
+    "bolero",
+    "Bolzano",
+    "bongo",
+    "Boto",
+    "burro",
+    "Cairo",
+    "canto",
+    "cappuccino",
+    "casino",
+    "cello",
+    "Chicago",
+    "Chimango",
+    "cilantro",
+    "cochito",
+    "coco",
+    "Colombo",
+    "Colorado",
+    "commando",
+    "concertino",
+    "contango",
+    "credo",
+    "crescendo",
+    "cyano",
+    "demo",
+    "ditto",
+    "Draco",
+    "dynamo",
+    "embryo",
+    "Esperanto",
+    "espresso",
+    "euro",
+    "falsetto",
+    "Faro",
+    "fiasco",
+    "Filipino",
+    "flamenco",
+    "furioso",
+    "generalissimo",
+    "Gestapo",
+    "ghetto",
+    "gigolo",
+    "gizmo",
+    "Greensboro",
+    "gringo",
+    "Guaiabero",
+    "guano",
+    "gumbo",
+    "gyro",
+    "hairdo",
+    "hippo",
+    "Idaho",
+    "impetigo",
+    "inferno",
+    "info",
+    "intermezzo",
+    "intertrigo",
+    "Iquico",
+    "jumbo",
+    "junto",
+    "Kakapo",
+    "kilo",
+    "Kinkimavo",
+    "Kokako",
+    "Kosovo",
+    "Lesotho",
+    "libero",
+    "libido",
+    "libretto",
+    "lido",
+    "Lilo",
+    "limbo",
+    "limo",
+    "lineno",
+    "lingo",
+    "lino",
+    "livedo",
+    "loco",
+    "logo",
+    "lumbago",
+    "macho",
+    "macro",
+    "mafioso",
+    "magneto",
+    "magnifico",
+    "Majuro",
+    "Malabo",
+    "manifesto",
+    "Maputo",
+    "Maracaibo",
+    "medico",
+    "memo",
+    "metro",
+    "Mexico",
+    "micro",
+    "Milano",
+    "Monaco",
+    "mono",
+    "Montenegro",
+    "Morocco",
+    "Muqdisho",
+    "myo",
+    "neutrino",
+    "Ningbo",
+    "octavo",
+    "oregano",
+    "Orinoco",
+    "Orlando",
+    "Oslo",
+    "panto",
+    "Paramaribo",
+    "Pardusco",
+    "pedalo",
+    "photo",
+    "pimento",
+    "pinto",
+    "pleco",
+    "Pluto",
+    "pogo",
+    "polo",
+    "poncho",
+    "Porto-Novo",
+    "Porto",
+    "pro",
+    "psycho",
+    "pueblo",
+    "quarto",
+    "Quito",
+    "repo",
+    "rhino",
+    "risotto",
+    "rococo",
+    "rondo",
+    "Sacramento",
+    "saddo",
+    "sago",
+    "salvo",
+    "Santiago",
+    "Sapporo",
+    "Sarajevo",
+    "scherzando",
+    "scherzo",
+    "silo",
+    "sirocco",
+    "sombrero",
+    "staccato",
+    "sterno",
+    "stucco",
+    "stylo",
+    "sumo",
+    "Taiko",
+    "techno",
+    "terrazzo",
+    "testudo",
+    "timpano",
+    "tiro",
+    "tobacco",
+    "Togo",
+    "Tokyo",
+    "torero",
+    "Torino",
+    "Toronto",
+    "torso",
+    "tremolo",
+    "typo",
+    "tyro",
+    "ufo",
+    "UNESCO",
+    "vaquero",
+    "vermicello",
+    "verso",
+    "vibrato",
+    "violoncello",
+    "Virgo",
+    "weirdo",
+    "WHO",
+    "WTO",
+    "Yamoussoukro",
+    "yo-yo",
+    "zero",
+    "Zibo",
+] + pl_sb_C_o_i
+
+pl_sb_U_o_os_bysize = bysize(pl_sb_U_o_os_endings)
+si_sb_U_o_os_bysize = bysize([f"{w}s" for w in pl_sb_U_o_os_endings])
+
+
+# UNCONDITIONAL "..ch" -> "..chs"
+
+pl_sb_U_ch_chs_list = ("czech", "eunuch", "stomach")
+
+(
+    si_sb_U_ch_chs_list,
+    si_sb_U_ch_chs_bysize,
+    pl_sb_U_ch_chs_bysize,
+    pl_sb_U_ch_chs,
+) = make_pl_si_lists(pl_sb_U_ch_chs_list, "s", None)
+
+
+# UNCONDITIONAL "..[ei]x" -> "..ices"
+
+pl_sb_U_ex_ices_list = ("codex", "murex", "silex")
+(
+    si_sb_U_ex_ices_list,
+    si_sb_U_ex_ices_bysize,
+    pl_sb_U_ex_ices_bysize,
+    pl_sb_U_ex_ices,
+) = make_pl_si_lists(pl_sb_U_ex_ices_list, "ices", 2)
+
+pl_sb_U_ix_ices_list = ("radix", "helix")
+(
+    si_sb_U_ix_ices_list,
+    si_sb_U_ix_ices_bysize,
+    pl_sb_U_ix_ices_bysize,
+    pl_sb_U_ix_ices,
+) = make_pl_si_lists(pl_sb_U_ix_ices_list, "ices", 2)
+
+# CLASSICAL "..[ei]x" -> "..ices"
+
+pl_sb_C_ex_ices_list = (
+    "vortex",
+    "vertex",
+    "cortex",
+    "latex",
+    "pontifex",
+    "apex",
+    "index",
+    "simplex",
+)
+
+(
+    si_sb_C_ex_ices_list,
+    si_sb_C_ex_ices_bysize,
+    pl_sb_C_ex_ices_bysize,
+    pl_sb_C_ex_ices,
+) = make_pl_si_lists(pl_sb_C_ex_ices_list, "ices", 2)
+
+
+pl_sb_C_ix_ices_list = ("appendix",)
+
+(
+    si_sb_C_ix_ices_list,
+    si_sb_C_ix_ices_bysize,
+    pl_sb_C_ix_ices_bysize,
+    pl_sb_C_ix_ices,
+) = make_pl_si_lists(pl_sb_C_ix_ices_list, "ices", 2)
+
+
+# ARABIC: ".." -> "..i"
+
+pl_sb_C_i_list = ("afrit", "afreet", "efreet")
+
+(si_sb_C_i_list, si_sb_C_i_bysize, pl_sb_C_i_bysize, pl_sb_C_i) = make_pl_si_lists(
+    pl_sb_C_i_list, "i", None
+)
+
+
+# HEBREW: ".." -> "..im"
+
+pl_sb_C_im_list = ("goy", "seraph", "cherub")
+
+(si_sb_C_im_list, si_sb_C_im_bysize, pl_sb_C_im_bysize, pl_sb_C_im) = make_pl_si_lists(
+    pl_sb_C_im_list, "im", None
+)
+
+
+# UNCONDITIONAL "..man" -> "..mans"
+
+pl_sb_U_man_mans_list = """
+    ataman caiman cayman ceriman
+    desman dolman farman harman hetman
+    human leman ottoman shaman talisman
+""".split()
+pl_sb_U_man_mans_caps_list = """
+    Alabaman Bahaman Burman German
+    Hiroshiman Liman Nakayaman Norman Oklahoman
+    Panaman Roman Selman Sonaman Tacoman Yakiman
+    Yokohaman Yuman
+""".split()
+
+(
+    si_sb_U_man_mans_list,
+    si_sb_U_man_mans_bysize,
+    pl_sb_U_man_mans_bysize,
+) = make_pl_si_lists(pl_sb_U_man_mans_list, "s", None, dojoinstem=False)
+(
+    si_sb_U_man_mans_caps_list,
+    si_sb_U_man_mans_caps_bysize,
+    pl_sb_U_man_mans_caps_bysize,
+) = make_pl_si_lists(pl_sb_U_man_mans_caps_list, "s", None, dojoinstem=False)
+
+# UNCONDITIONAL "..louse" -> "..lice"
+pl_sb_U_louse_lice_list = ("booklouse", "grapelouse", "louse", "woodlouse")
+
+(
+    si_sb_U_louse_lice_list,
+    si_sb_U_louse_lice_bysize,
+    pl_sb_U_louse_lice_bysize,
+) = make_pl_si_lists(pl_sb_U_louse_lice_list, "lice", 5, dojoinstem=False)
+
+pl_sb_uninflected_s_complete = [
+    # PAIRS OR GROUPS SUBSUMED TO A SINGULAR...
+    "breeches",
+    "britches",
+    "pajamas",
+    "pyjamas",
+    "clippers",
+    "gallows",
+    "hijinks",
+    "headquarters",
+    "pliers",
+    "scissors",
+    "testes",
+    "herpes",
+    "pincers",
+    "shears",
+    "proceedings",
+    "trousers",
+    # UNASSIMILATED LATIN 4th DECLENSION
+    "cantus",
+    "coitus",
+    "nexus",
+    # RECENT IMPORTS...
+    "contretemps",
+    "corps",
+    "debris",
+    "siemens",
+    # DISEASES
+    "mumps",
+    # MISCELLANEOUS OTHERS...
+    "diabetes",
+    "jackanapes",
+    "series",
+    "species",
+    "subspecies",
+    "rabies",
+    "chassis",
+    "innings",
+    "news",
+    "mews",
+    "haggis",
+]
+
+pl_sb_uninflected_s_endings = [
+    # RECENT IMPORTS...
+    "ois",
+    # DISEASES
+    "measles",
+]
+
+pl_sb_uninflected_s = pl_sb_uninflected_s_complete + [
+    f".*{w}" for w in pl_sb_uninflected_s_endings
+]
+
+pl_sb_uninflected_herd = (
+    # DON'T INFLECT IN CLASSICAL MODE, OTHERWISE NORMAL INFLECTION
+    "wildebeest",
+    "swine",
+    "eland",
+    "bison",
+    "buffalo",
+    "cattle",
+    "elk",
+    "rhinoceros",
+    "zucchini",
+    "caribou",
+    "dace",
+    "grouse",
+    "guinea fowl",
+    "guinea-fowl",
+    "haddock",
+    "hake",
+    "halibut",
+    "herring",
+    "mackerel",
+    "pickerel",
+    "pike",
+    "roe",
+    "seed",
+    "shad",
+    "snipe",
+    "teal",
+    "turbot",
+    "water fowl",
+    "water-fowl",
+)
+
+pl_sb_uninflected_complete = [
+    # SOME FISH AND HERD ANIMALS
+    "tuna",
+    "salmon",
+    "mackerel",
+    "trout",
+    "bream",
+    "sea-bass",
+    "sea bass",
+    "carp",
+    "cod",
+    "flounder",
+    "whiting",
+    "moose",
+    # OTHER ODDITIES
+    "graffiti",
+    "djinn",
+    "samuri",
+    "offspring",
+    "pence",
+    "quid",
+    "hertz",
+] + pl_sb_uninflected_s_complete
+# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
+
+pl_sb_uninflected_caps = [
+    # ALL NATIONALS ENDING IN -ese
+    "Portuguese",
+    "Amoyese",
+    "Borghese",
+    "Congoese",
+    "Faroese",
+    "Foochowese",
+    "Genevese",
+    "Genoese",
+    "Gilbertese",
+    "Hottentotese",
+    "Kiplingese",
+    "Kongoese",
+    "Lucchese",
+    "Maltese",
+    "Nankingese",
+    "Niasese",
+    "Pekingese",
+    "Piedmontese",
+    "Pistoiese",
+    "Sarawakese",
+    "Shavese",
+    "Vermontese",
+    "Wenchowese",
+    "Yengeese",
+]
+
+
+pl_sb_uninflected_endings = [
+    # UNCOUNTABLE NOUNS
+    "butter",
+    "cash",
+    "furniture",
+    "information",
+    # SOME FISH AND HERD ANIMALS
+    "fish",
+    "deer",
+    "sheep",
+    # ALL NATIONALS ENDING IN -ese
+    "nese",
+    "rese",
+    "lese",
+    "mese",
+    # DISEASES
+    "pox",
+    # OTHER ODDITIES
+    "craft",
+] + pl_sb_uninflected_s_endings
+# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
+
+
+pl_sb_uninflected_bysize = bysize(pl_sb_uninflected_endings)
+
+
+# SINGULAR WORDS ENDING IN ...s (ALL INFLECT WITH ...es)
+
+pl_sb_singular_s_complete = [
+    "acropolis",
+    "aegis",
+    "alias",
+    "asbestos",
+    "bathos",
+    "bias",
+    "bronchitis",
+    "bursitis",
+    "caddis",
+    "cannabis",
+    "canvas",
+    "chaos",
+    "cosmos",
+    "dais",
+    "digitalis",
+    "epidermis",
+    "ethos",
+    "eyas",
+    "gas",
+    "glottis",
+    "hubris",
+    "ibis",
+    "lens",
+    "mantis",
+    "marquis",
+    "metropolis",
+    "pathos",
+    "pelvis",
+    "polis",
+    "rhinoceros",
+    "sassafras",
+    "trellis",
+] + pl_sb_C_is_ides_complete
+
+
+pl_sb_singular_s_endings = ["ss", "us"] + pl_sb_C_is_ides_endings
+
+pl_sb_singular_s_bysize = bysize(pl_sb_singular_s_endings)
+
+si_sb_singular_s_complete = [f"{w}es" for w in pl_sb_singular_s_complete]
+si_sb_singular_s_endings = [f"{w}es" for w in pl_sb_singular_s_endings]
+si_sb_singular_s_bysize = bysize(si_sb_singular_s_endings)
+
+pl_sb_singular_s_es = ["[A-Z].*es"]
+
+pl_sb_singular_s = enclose(
+    "|".join(
+        pl_sb_singular_s_complete
+        + [f".*{w}" for w in pl_sb_singular_s_endings]
+        + pl_sb_singular_s_es
+    )
+)
+
+
+# PLURALS ENDING IN uses -> use
+
+
+si_sb_ois_oi_case = ("Bolshois", "Hanois")
+
+si_sb_uses_use_case = ("Betelgeuses", "Duses", "Meuses", "Syracuses", "Toulouses")
+
+si_sb_uses_use = (
+    "abuses",
+    "applauses",
+    "blouses",
+    "carouses",
+    "causes",
+    "chartreuses",
+    "clauses",
+    "contuses",
+    "douses",
+    "excuses",
+    "fuses",
+    "grouses",
+    "hypotenuses",
+    "masseuses",
+    "menopauses",
+    "misuses",
+    "muses",
+    "overuses",
+    "pauses",
+    "peruses",
+    "profuses",
+    "recluses",
+    "reuses",
+    "ruses",
+    "souses",
+    "spouses",
+    "suffuses",
+    "transfuses",
+    "uses",
+)
+
+si_sb_ies_ie_case = (
+    "Addies",
+    "Aggies",
+    "Allies",
+    "Amies",
+    "Angies",
+    "Annies",
+    "Annmaries",
+    "Archies",
+    "Arties",
+    "Aussies",
+    "Barbies",
+    "Barries",
+    "Basies",
+    "Bennies",
+    "Bernies",
+    "Berties",
+    "Bessies",
+    "Betties",
+    "Billies",
+    "Blondies",
+    "Bobbies",
+    "Bonnies",
+    "Bowies",
+    "Brandies",
+    "Bries",
+    "Brownies",
+    "Callies",
+    "Carnegies",
+    "Carries",
+    "Cassies",
+    "Charlies",
+    "Cheries",
+    "Christies",
+    "Connies",
+    "Curies",
+    "Dannies",
+    "Debbies",
+    "Dixies",
+    "Dollies",
+    "Donnies",
+    "Drambuies",
+    "Eddies",
+    "Effies",
+    "Ellies",
+    "Elsies",
+    "Eries",
+    "Ernies",
+    "Essies",
+    "Eugenies",
+    "Fannies",
+    "Flossies",
+    "Frankies",
+    "Freddies",
+    "Gillespies",
+    "Goldies",
+    "Gracies",
+    "Guthries",
+    "Hallies",
+    "Hatties",
+    "Hetties",
+    "Hollies",
+    "Jackies",
+    "Jamies",
+    "Janies",
+    "Jannies",
+    "Jeanies",
+    "Jeannies",
+    "Jennies",
+    "Jessies",
+    "Jimmies",
+    "Jodies",
+    "Johnies",
+    "Johnnies",
+    "Josies",
+    "Julies",
+    "Kalgoorlies",
+    "Kathies",
+    "Katies",
+    "Kellies",
+    "Kewpies",
+    "Kristies",
+    "Laramies",
+    "Lassies",
+    "Lauries",
+    "Leslies",
+    "Lessies",
+    "Lillies",
+    "Lizzies",
+    "Lonnies",
+    "Lories",
+    "Lorries",
+    "Lotties",
+    "Louies",
+    "Mackenzies",
+    "Maggies",
+    "Maisies",
+    "Mamies",
+    "Marcies",
+    "Margies",
+    "Maries",
+    "Marjories",
+    "Matties",
+    "McKenzies",
+    "Melanies",
+    "Mickies",
+    "Millies",
+    "Minnies",
+    "Mollies",
+    "Mounties",
+    "Nannies",
+    "Natalies",
+    "Nellies",
+    "Netties",
+    "Ollies",
+    "Ozzies",
+    "Pearlies",
+    "Pottawatomies",
+    "Reggies",
+    "Richies",
+    "Rickies",
+    "Robbies",
+    "Ronnies",
+    "Rosalies",
+    "Rosemaries",
+    "Rosies",
+    "Roxies",
+    "Rushdies",
+    "Ruthies",
+    "Sadies",
+    "Sallies",
+    "Sammies",
+    "Scotties",
+    "Selassies",
+    "Sherries",
+    "Sophies",
+    "Stacies",
+    "Stefanies",
+    "Stephanies",
+    "Stevies",
+    "Susies",
+    "Sylvies",
+    "Tammies",
+    "Terries",
+    "Tessies",
+    "Tommies",
+    "Tracies",
+    "Trekkies",
+    "Valaries",
+    "Valeries",
+    "Valkyries",
+    "Vickies",
+    "Virgies",
+    "Willies",
+    "Winnies",
+    "Wylies",
+    "Yorkies",
+)
+
+si_sb_ies_ie = (
+    "aeries",
+    "baggies",
+    "belies",
+    "biggies",
+    "birdies",
+    "bogies",
+    "bonnies",
+    "boogies",
+    "bookies",
+    "bourgeoisies",
+    "brownies",
+    "budgies",
+    "caddies",
+    "calories",
+    "camaraderies",
+    "cockamamies",
+    "collies",
+    "cookies",
+    "coolies",
+    "cooties",
+    "coteries",
+    "crappies",
+    "curies",
+    "cutesies",
+    "dogies",
+    "eyries",
+    "floozies",
+    "footsies",
+    "freebies",
+    "genies",
+    "goalies",
+    "groupies",
+    "hies",
+    "jalousies",
+    "junkies",
+    "kiddies",
+    "laddies",
+    "lassies",
+    "lies",
+    "lingeries",
+    "magpies",
+    "menageries",
+    "mommies",
+    "movies",
+    "neckties",
+    "newbies",
+    "nighties",
+    "oldies",
+    "organdies",
+    "overlies",
+    "pies",
+    "pinkies",
+    "pixies",
+    "potpies",
+    "prairies",
+    "quickies",
+    "reveries",
+    "rookies",
+    "rotisseries",
+    "softies",
+    "sorties",
+    "species",
+    "stymies",
+    "sweeties",
+    "ties",
+    "underlies",
+    "unties",
+    "veggies",
+    "vies",
+    "yuppies",
+    "zombies",
+)
+
+
+si_sb_oes_oe_case = (
+    "Chloes",
+    "Crusoes",
+    "Defoes",
+    "Faeroes",
+    "Ivanhoes",
+    "Joes",
+    "McEnroes",
+    "Moes",
+    "Monroes",
+    "Noes",
+    "Poes",
+    "Roscoes",
+    "Tahoes",
+    "Tippecanoes",
+    "Zoes",
+)
+
+si_sb_oes_oe = (
+    "aloes",
+    "backhoes",
+    "canoes",
+    "does",
+    "floes",
+    "foes",
+    "hoes",
+    "mistletoes",
+    "oboes",
+    "pekoes",
+    "roes",
+    "sloes",
+    "throes",
+    "tiptoes",
+    "toes",
+    "woes",
+)
+
+si_sb_z_zes = ("quartzes", "topazes")
+
+si_sb_zzes_zz = ("buzzes", "fizzes", "frizzes", "razzes")
+
+si_sb_ches_che_case = (
+    "Andromaches",
+    "Apaches",
+    "Blanches",
+    "Comanches",
+    "Nietzsches",
+    "Porsches",
+    "Roches",
+)
+
+si_sb_ches_che = (
+    "aches",
+    "avalanches",
+    "backaches",
+    "bellyaches",
+    "caches",
+    "cloches",
+    "creches",
+    "douches",
+    "earaches",
+    "fiches",
+    "headaches",
+    "heartaches",
+    "microfiches",
+    "niches",
+    "pastiches",
+    "psyches",
+    "quiches",
+    "stomachaches",
+    "toothaches",
+    "tranches",
+)
+
+si_sb_xes_xe = ("annexes", "axes", "deluxes", "pickaxes")
+
+si_sb_sses_sse_case = ("Hesses", "Jesses", "Larousses", "Matisses")
+si_sb_sses_sse = (
+    "bouillabaisses",
+    "crevasses",
+    "demitasses",
+    "impasses",
+    "mousses",
+    "posses",
+)
+
+si_sb_ves_ve_case = (
+    # *[nwl]ives -> [nwl]live
+    "Clives",
+    "Palmolives",
+)
+si_sb_ves_ve = (
+    # *[^d]eaves -> eave
+    "interweaves",
+    "weaves",
+    # *[nwl]ives -> [nwl]live
+    "olives",
+    # *[eoa]lves -> [eoa]lve
+    "bivalves",
+    "dissolves",
+    "resolves",
+    "salves",
+    "twelves",
+    "valves",
+)
+
+
+plverb_special_s = enclose(
+    "|".join(
+        [pl_sb_singular_s]
+        + pl_sb_uninflected_s
+        + list(pl_sb_irregular_s)
+        + ["(.*[csx])is", "(.*)ceps", "[A-Z].*s"]
+    )
+)
+
+_pl_sb_postfix_adj_defn = (
+    ("general", enclose(r"(?!major|lieutenant|brigadier|adjutant|.*star)\S+")),
+    ("martial", enclose("court")),
+    ("force", enclose("pound")),
+)
+
+pl_sb_postfix_adj: Iterable[str] = (
+    enclose(val + f"(?=(?:-|\\s+){key})") for key, val in _pl_sb_postfix_adj_defn
+)
+
+pl_sb_postfix_adj_stems = f"({'|'.join(pl_sb_postfix_adj)})(.*)"
+
+
+# PLURAL WORDS ENDING IS es GO TO SINGULAR is
+
+si_sb_es_is = (
+    "amanuenses",
+    "amniocenteses",
+    "analyses",
+    "antitheses",
+    "apotheoses",
+    "arterioscleroses",
+    "atheroscleroses",
+    "axes",
+    # 'bases', # bases -> basis
+    "catalyses",
+    "catharses",
+    "chasses",
+    "cirrhoses",
+    "cocces",
+    "crises",
+    "diagnoses",
+    "dialyses",
+    "diereses",
+    "electrolyses",
+    "emphases",
+    "exegeses",
+    "geneses",
+    "halitoses",
+    "hydrolyses",
+    "hypnoses",
+    "hypotheses",
+    "hystereses",
+    "metamorphoses",
+    "metastases",
+    "misdiagnoses",
+    "mitoses",
+    "mononucleoses",
+    "narcoses",
+    "necroses",
+    "nemeses",
+    "neuroses",
+    "oases",
+    "osmoses",
+    "osteoporoses",
+    "paralyses",
+    "parentheses",
+    "parthenogeneses",
+    "periphrases",
+    "photosyntheses",
+    "probosces",
+    "prognoses",
+    "prophylaxes",
+    "prostheses",
+    "preces",
+    "psoriases",
+    "psychoanalyses",
+    "psychokineses",
+    "psychoses",
+    "scleroses",
+    "scolioses",
+    "sepses",
+    "silicoses",
+    "symbioses",
+    "synopses",
+    "syntheses",
+    "taxes",
+    "telekineses",
+    "theses",
+    "thromboses",
+    "tuberculoses",
+    "urinalyses",
+)
+
+pl_prep_list = """
+    about above across after among around at athwart before behind
+    below beneath beside besides between betwixt beyond but by
+    during except for from in into near of off on onto out over
+    since till to under until unto upon with""".split()
+
+pl_prep_list_da = pl_prep_list + ["de", "du", "da"]
+
+pl_prep_bysize = bysize(pl_prep_list_da)
+
+pl_prep = enclose("|".join(pl_prep_list_da))
+
+pl_sb_prep_dual_compound = rf"(.*?)((?:-|\s+)(?:{pl_prep})(?:-|\s+))a(?:-|\s+)(.*)"
+
+
+singular_pronoun_genders = {
+    "neuter",
+    "feminine",
+    "masculine",
+    "gender-neutral",
+    "feminine or masculine",
+    "masculine or feminine",
+}
+
+pl_pron_nom = {
+    # NOMINATIVE    REFLEXIVE
+    "i": "we",
+    "myself": "ourselves",
+    "you": "you",
+    "yourself": "yourselves",
+    "she": "they",
+    "herself": "themselves",
+    "he": "they",
+    "himself": "themselves",
+    "it": "they",
+    "itself": "themselves",
+    "they": "they",
+    "themself": "themselves",
+    #   POSSESSIVE
+    "mine": "ours",
+    "yours": "yours",
+    "hers": "theirs",
+    "his": "theirs",
+    "its": "theirs",
+    "theirs": "theirs",
+}
+
+si_pron: Dict[str, Dict[str, Union[str, Dict[str, str]]]] = {
+    "nom": {v: k for (k, v) in pl_pron_nom.items()}
+}
+si_pron["nom"]["we"] = "I"
+
+
+pl_pron_acc = {
+    # ACCUSATIVE    REFLEXIVE
+    "me": "us",
+    "myself": "ourselves",
+    "you": "you",
+    "yourself": "yourselves",
+    "her": "them",
+    "herself": "themselves",
+    "him": "them",
+    "himself": "themselves",
+    "it": "them",
+    "itself": "themselves",
+    "them": "them",
+    "themself": "themselves",
+}
+
+pl_pron_acc_keys = enclose("|".join(pl_pron_acc))
+pl_pron_acc_keys_bysize = bysize(pl_pron_acc)
+
+si_pron["acc"] = {v: k for (k, v) in pl_pron_acc.items()}
+
+for _thecase, _plur, _gend, _sing in (
+    ("nom", "they", "neuter", "it"),
+    ("nom", "they", "feminine", "she"),
+    ("nom", "they", "masculine", "he"),
+    ("nom", "they", "gender-neutral", "they"),
+    ("nom", "they", "feminine or masculine", "she or he"),
+    ("nom", "they", "masculine or feminine", "he or she"),
+    ("nom", "themselves", "neuter", "itself"),
+    ("nom", "themselves", "feminine", "herself"),
+    ("nom", "themselves", "masculine", "himself"),
+    ("nom", "themselves", "gender-neutral", "themself"),
+    ("nom", "themselves", "feminine or masculine", "herself or himself"),
+    ("nom", "themselves", "masculine or feminine", "himself or herself"),
+    ("nom", "theirs", "neuter", "its"),
+    ("nom", "theirs", "feminine", "hers"),
+    ("nom", "theirs", "masculine", "his"),
+    ("nom", "theirs", "gender-neutral", "theirs"),
+    ("nom", "theirs", "feminine or masculine", "hers or his"),
+    ("nom", "theirs", "masculine or feminine", "his or hers"),
+    ("acc", "them", "neuter", "it"),
+    ("acc", "them", "feminine", "her"),
+    ("acc", "them", "masculine", "him"),
+    ("acc", "them", "gender-neutral", "them"),
+    ("acc", "them", "feminine or masculine", "her or him"),
+    ("acc", "them", "masculine or feminine", "him or her"),
+    ("acc", "themselves", "neuter", "itself"),
+    ("acc", "themselves", "feminine", "herself"),
+    ("acc", "themselves", "masculine", "himself"),
+    ("acc", "themselves", "gender-neutral", "themself"),
+    ("acc", "themselves", "feminine or masculine", "herself or himself"),
+    ("acc", "themselves", "masculine or feminine", "himself or herself"),
+):
+    try:
+        si_pron[_thecase][_plur][_gend] = _sing  # type: ignore
+    except TypeError:
+        si_pron[_thecase][_plur] = {}
+        si_pron[_thecase][_plur][_gend] = _sing  # type: ignore
+
+
+si_pron_acc_keys = enclose("|".join(si_pron["acc"]))
+si_pron_acc_keys_bysize = bysize(si_pron["acc"])
+
+
+def get_si_pron(thecase, word, gender) -> str:
+    try:
+        sing = si_pron[thecase][word]
+    except KeyError:
+        raise  # not a pronoun
+    try:
+        return sing[gender]  # has several types due to gender
+    except TypeError:
+        return cast(str, sing)  # answer independent of gender
+
+
+# These dictionaries group verbs by first, second and third person
+# conjugations.
+
+plverb_irregular_pres = {
+    "am": "are",
+    "are": "are",
+    "is": "are",
+    "was": "were",
+    "were": "were",
+    "have": "have",
+    "has": "have",
+    "do": "do",
+    "does": "do",
+}
+
+plverb_ambiguous_pres = {
+    "act": "act",
+    "acts": "act",
+    "blame": "blame",
+    "blames": "blame",
+    "can": "can",
+    "must": "must",
+    "fly": "fly",
+    "flies": "fly",
+    "copy": "copy",
+    "copies": "copy",
+    "drink": "drink",
+    "drinks": "drink",
+    "fight": "fight",
+    "fights": "fight",
+    "fire": "fire",
+    "fires": "fire",
+    "like": "like",
+    "likes": "like",
+    "look": "look",
+    "looks": "look",
+    "make": "make",
+    "makes": "make",
+    "reach": "reach",
+    "reaches": "reach",
+    "run": "run",
+    "runs": "run",
+    "sink": "sink",
+    "sinks": "sink",
+    "sleep": "sleep",
+    "sleeps": "sleep",
+    "view": "view",
+    "views": "view",
+}
+
+plverb_ambiguous_pres_keys = re.compile(
+    rf"^({enclose('|'.join(plverb_ambiguous_pres))})((\s.*)?)$", re.IGNORECASE
+)
+
+
+plverb_irregular_non_pres = (
+    "did",
+    "had",
+    "ate",
+    "made",
+    "put",
+    "spent",
+    "fought",
+    "sank",
+    "gave",
+    "sought",
+    "shall",
+    "could",
+    "ought",
+    "should",
+)
+
+plverb_ambiguous_non_pres = re.compile(
+    r"^((?:thought|saw|bent|will|might|cut))((\s.*)?)$", re.IGNORECASE
+)
+
+# "..oes" -> "..oe" (the rest are "..oes" -> "o")
+
+pl_v_oes_oe = ("canoes", "floes", "oboes", "roes", "throes", "woes")
+pl_v_oes_oe_endings_size4 = ("hoes", "toes")
+pl_v_oes_oe_endings_size5 = ("shoes",)
+
+
+pl_count_zero = ("0", "no", "zero", "nil")
+
+
+pl_count_one = ("1", "a", "an", "one", "each", "every", "this", "that")
+
+pl_adj_special = {"a": "some", "an": "some", "this": "these", "that": "those"}
+
+pl_adj_special_keys = re.compile(
+    rf"^({enclose('|'.join(pl_adj_special))})$", re.IGNORECASE
+)
+
+pl_adj_poss = {
+    "my": "our",
+    "your": "your",
+    "its": "their",
+    "her": "their",
+    "his": "their",
+    "their": "their",
+}
+
+pl_adj_poss_keys = re.compile(rf"^({enclose('|'.join(pl_adj_poss))})$", re.IGNORECASE)
+
+
+# 2. INDEFINITE ARTICLES
+
+# THIS PATTERN MATCHES STRINGS OF CAPITALS STARTING WITH A "VOWEL-SOUND"
+# CONSONANT FOLLOWED BY ANOTHER CONSONANT, AND WHICH ARE NOT LIKELY
+# TO BE REAL WORDS (OH, ALL RIGHT THEN, IT'S JUST MAGIC!)
+
+A_abbrev = re.compile(
+    r"""
+^(?! FJO | [HLMNS]Y.  | RY[EO] | SQU
+  | ( F[LR]? | [HL] | MN? | N | RH? | S[CHKLMNPTVW]? | X(YL)?) [AEIOU])
+[FHLMNRSX][A-Z]
+""",
+    re.VERBOSE,
+)
+
+# THIS PATTERN CODES THE BEGINNINGS OF ALL ENGLISH WORDS BEGINING WITH A
+# 'y' FOLLOWED BY A CONSONANT. ANY OTHER Y-CONSONANT PREFIX THEREFORE
+# IMPLIES AN ABBREVIATION.
+
+A_y_cons = re.compile(r"^(y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt))", re.IGNORECASE)
+
+# EXCEPTIONS TO EXCEPTIONS
+
+A_explicit_a = re.compile(r"^((?:unabomber|unanimous|US))", re.IGNORECASE)
+
+A_explicit_an = re.compile(
+    r"^((?:euler|hour(?!i)|heir|honest|hono[ur]|mpeg))", re.IGNORECASE
+)
+
+A_ordinal_an = re.compile(r"^([aefhilmnorsx]-?th)", re.IGNORECASE)
+
+A_ordinal_a = re.compile(r"^([bcdgjkpqtuvwyz]-?th)", re.IGNORECASE)
+
+
+# NUMERICAL INFLECTIONS
+
+nth = {
+    0: "th",
+    1: "st",
+    2: "nd",
+    3: "rd",
+    4: "th",
+    5: "th",
+    6: "th",
+    7: "th",
+    8: "th",
+    9: "th",
+    11: "th",
+    12: "th",
+    13: "th",
+}
+nth_suff = set(nth.values())
+
+ordinal = dict(
+    ty="tieth",
+    one="first",
+    two="second",
+    three="third",
+    five="fifth",
+    eight="eighth",
+    nine="ninth",
+    twelve="twelfth",
+)
+
+ordinal_suff = re.compile(rf"({'|'.join(ordinal)})\Z")
+
+
+# NUMBERS
+
+unit = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
+teen = [
+    "ten",
+    "eleven",
+    "twelve",
+    "thirteen",
+    "fourteen",
+    "fifteen",
+    "sixteen",
+    "seventeen",
+    "eighteen",
+    "nineteen",
+]
+ten = [
+    "",
+    "",
+    "twenty",
+    "thirty",
+    "forty",
+    "fifty",
+    "sixty",
+    "seventy",
+    "eighty",
+    "ninety",
+]
+mill = [
+    " ",
+    " thousand",
+    " million",
+    " billion",
+    " trillion",
+    " quadrillion",
+    " quintillion",
+    " sextillion",
+    " septillion",
+    " octillion",
+    " nonillion",
+    " decillion",
+]
+
+
+# SUPPORT CLASSICAL PLURALIZATIONS
+
+def_classical = dict(
+    all=False, zero=False, herd=False, names=True, persons=False, ancient=False
+)
+
+all_classical = {k: True for k in def_classical}
+no_classical = {k: False for k in def_classical}
+
+
+# Maps strings to built-in constant types
+string_to_constant = {"True": True, "False": False, "None": None}
+
+
+# Pre-compiled regular expression objects
+DOLLAR_DIGITS = re.compile(r"\$(\d+)")
+FUNCTION_CALL = re.compile(r"((\w+)\([^)]*\)*)", re.IGNORECASE)
+PARTITION_WORD = re.compile(r"\A(\s*)(.+?)(\s*)\Z")
+PL_SB_POSTFIX_ADJ_STEMS_RE = re.compile(
+    rf"^(?:{pl_sb_postfix_adj_stems})$", re.IGNORECASE
+)
+PL_SB_PREP_DUAL_COMPOUND_RE = re.compile(
+    rf"^(?:{pl_sb_prep_dual_compound})$", re.IGNORECASE
+)
+DENOMINATOR = re.compile(r"(?P.+)( (per|a) .+)")
+PLVERB_SPECIAL_S_RE = re.compile(rf"^({plverb_special_s})$")
+WHITESPACE = re.compile(r"\s")
+ENDS_WITH_S = re.compile(r"^(.*[^s])s$", re.IGNORECASE)
+ENDS_WITH_APOSTROPHE_S = re.compile(r"^(.*)'s?$")
+INDEFINITE_ARTICLE_TEST = re.compile(r"\A(\s*)(?:an?\s+)?(.+?)(\s*)\Z", re.IGNORECASE)
+SPECIAL_AN = re.compile(r"^[aefhilmnorsx]$", re.IGNORECASE)
+SPECIAL_A = re.compile(r"^[bcdgjkpqtuvwyz]$", re.IGNORECASE)
+SPECIAL_ABBREV_AN = re.compile(r"^[aefhilmnorsx][.-]", re.IGNORECASE)
+SPECIAL_ABBREV_A = re.compile(r"^[a-z][.-]", re.IGNORECASE)
+CONSONANTS = re.compile(r"^[^aeiouy]", re.IGNORECASE)
+ARTICLE_SPECIAL_EU = re.compile(r"^e[uw]", re.IGNORECASE)
+ARTICLE_SPECIAL_ONCE = re.compile(r"^onc?e\b", re.IGNORECASE)
+ARTICLE_SPECIAL_ONETIME = re.compile(r"^onetime\b", re.IGNORECASE)
+ARTICLE_SPECIAL_UNIT = re.compile(r"^uni([^nmd]|mo)", re.IGNORECASE)
+ARTICLE_SPECIAL_UBA = re.compile(r"^u[bcfghjkqrst][aeiou]", re.IGNORECASE)
+ARTICLE_SPECIAL_UKR = re.compile(r"^ukr", re.IGNORECASE)
+SPECIAL_CAPITALS = re.compile(r"^U[NK][AIEO]?")
+VOWELS = re.compile(r"^[aeiou]", re.IGNORECASE)
+
+DIGIT_GROUP = re.compile(r"(\d)")
+TWO_DIGITS = re.compile(r"(\d)(\d)")
+THREE_DIGITS = re.compile(r"(\d)(\d)(\d)")
+THREE_DIGITS_WORD = re.compile(r"(\d)(\d)(\d)(?=\D*\Z)")
+TWO_DIGITS_WORD = re.compile(r"(\d)(\d)(?=\D*\Z)")
+ONE_DIGIT_WORD = re.compile(r"(\d)(?=\D*\Z)")
+
+FOUR_DIGIT_COMMA = re.compile(r"(\d)(\d{3}(?:,|\Z))")
+NON_DIGIT = re.compile(r"\D")
+WHITESPACES_COMMA = re.compile(r"\s+,")
+COMMA_WORD = re.compile(r", (\S+)\s+\Z")
+WHITESPACES = re.compile(r"\s+")
+
+
+PRESENT_PARTICIPLE_REPLACEMENTS = (
+    (re.compile(r"ie$"), r"y"),
+    (
+        re.compile(r"ue$"),
+        r"u",
+    ),  # TODO: isn't ue$ -> u encompassed in the following rule?
+    (re.compile(r"([auy])e$"), r"\g<1>"),
+    (re.compile(r"ski$"), r"ski"),
+    (re.compile(r"[^b]i$"), r""),
+    (re.compile(r"^(are|were)$"), r"be"),
+    (re.compile(r"^(had)$"), r"hav"),
+    (re.compile(r"^(hoe)$"), r"\g<1>"),
+    (re.compile(r"([^e])e$"), r"\g<1>"),
+    (re.compile(r"er$"), r"er"),
+    (re.compile(r"([^aeiou][aeiouy]([bdgmnprst]))$"), r"\g<1>\g<2>"),
+)
+
+DIGIT = re.compile(r"\d")
+
+
+class Words(str):
+    lowered: str
+    split_: List[str]
+    first: str
+    last: str
+
+    def __init__(self, orig) -> None:
+        self.lowered = self.lower()
+        self.split_ = self.split()
+        self.first = self.split_[0]
+        self.last = self.split_[-1]
+
+
+Falsish = Any  # ideally, falsish would only validate on bool(value) is False
+
+
+_STATIC_TYPE_CHECKING = TYPE_CHECKING
+# ^-- Workaround for typeguard AST manipulation:
+#     https://github.com/agronholm/typeguard/issues/353#issuecomment-1556306554
+
+if _STATIC_TYPE_CHECKING:  # pragma: no cover
+    Word = Annotated[str, "String with at least 1 character"]
+else:
+
+    class _WordMeta(type):  # Too dynamic to be supported by mypy...
+        def __instancecheck__(self, instance: Any) -> bool:
+            return isinstance(instance, str) and len(instance) >= 1
+
+    class Word(metaclass=_WordMeta):  # type: ignore[no-redef]
+        """String with at least 1 character"""
+
+
+class engine:
+    def __init__(self) -> None:
+        self.classical_dict = def_classical.copy()
+        self.persistent_count: Optional[int] = None
+        self.mill_count = 0
+        self.pl_sb_user_defined: List[Optional[Word]] = []
+        self.pl_v_user_defined: List[Optional[Word]] = []
+        self.pl_adj_user_defined: List[Optional[Word]] = []
+        self.si_sb_user_defined: List[Optional[Word]] = []
+        self.A_a_user_defined: List[Optional[Word]] = []
+        self.thegender = "neuter"
+        self.__number_args: Optional[Dict[str, str]] = None
+
+    @property
+    def _number_args(self):
+        return cast(Dict[str, str], self.__number_args)
+
+    @_number_args.setter
+    def _number_args(self, val):
+        self.__number_args = val
+
+    @typechecked
+    def defnoun(self, singular: Optional[Word], plural: Optional[Word]) -> int:
+        """
+        Set the noun plural of singular to plural.
+
+        """
+        self.checkpat(singular)
+        self.checkpatplural(plural)
+        self.pl_sb_user_defined.extend((singular, plural))
+        self.si_sb_user_defined.extend((plural, singular))
+        return 1
+
+    @typechecked
+    def defverb(
+        self,
+        s1: Optional[Word],
+        p1: Optional[Word],
+        s2: Optional[Word],
+        p2: Optional[Word],
+        s3: Optional[Word],
+        p3: Optional[Word],
+    ) -> int:
+        """
+        Set the verb plurals for s1, s2 and s3 to p1, p2 and p3 respectively.
+
+        Where 1, 2 and 3 represent the 1st, 2nd and 3rd person forms of the verb.
+
+        """
+        self.checkpat(s1)
+        self.checkpat(s2)
+        self.checkpat(s3)
+        self.checkpatplural(p1)
+        self.checkpatplural(p2)
+        self.checkpatplural(p3)
+        self.pl_v_user_defined.extend((s1, p1, s2, p2, s3, p3))
+        return 1
+
+    @typechecked
+    def defadj(self, singular: Optional[Word], plural: Optional[Word]) -> int:
+        """
+        Set the adjective plural of singular to plural.
+
+        """
+        self.checkpat(singular)
+        self.checkpatplural(plural)
+        self.pl_adj_user_defined.extend((singular, plural))
+        return 1
+
+    @typechecked
+    def defa(self, pattern: Optional[Word]) -> int:
+        """
+        Define the indefinite article as 'a' for words matching pattern.
+
+        """
+        self.checkpat(pattern)
+        self.A_a_user_defined.extend((pattern, "a"))
+        return 1
+
+    @typechecked
+    def defan(self, pattern: Optional[Word]) -> int:
+        """
+        Define the indefinite article as 'an' for words matching pattern.
+
+        """
+        self.checkpat(pattern)
+        self.A_a_user_defined.extend((pattern, "an"))
+        return 1
+
+    def checkpat(self, pattern: Optional[Word]) -> None:
+        """
+        check for errors in a regex pattern
+        """
+        if pattern is None:
+            return
+        try:
+            re.match(pattern, "")
+        except re.error as err:
+            raise BadUserDefinedPatternError(pattern) from err
+
+    def checkpatplural(self, pattern: Optional[Word]) -> None:
+        """
+        check for errors in a regex replace pattern
+        """
+        return
+
+    @typechecked
+    def ud_match(self, word: Word, wordlist: Sequence[Optional[Word]]) -> Optional[str]:
+        for i in range(len(wordlist) - 2, -2, -2):  # backwards through even elements
+            mo = re.search(rf"^{wordlist[i]}$", word, re.IGNORECASE)
+            if mo:
+                if wordlist[i + 1] is None:
+                    return None
+                pl = DOLLAR_DIGITS.sub(
+                    r"\\1", cast(Word, wordlist[i + 1])
+                )  # change $n to \n for expand
+                return mo.expand(pl)
+        return None
+
+    def classical(self, **kwargs) -> None:
+        """
+        turn classical mode on and off for various categories
+
+        turn on all classical modes:
+        classical()
+        classical(all=True)
+
+        turn on or off specific claassical modes:
+        e.g.
+        classical(herd=True)
+        classical(names=False)
+
+        By default all classical modes are off except names.
+
+        unknown value in args or key in kwargs raises
+        exception: UnknownClasicalModeError
+
+        """
+        if not kwargs:
+            self.classical_dict = all_classical.copy()
+            return
+        if "all" in kwargs:
+            if kwargs["all"]:
+                self.classical_dict = all_classical.copy()
+            else:
+                self.classical_dict = no_classical.copy()
+
+        for k, v in kwargs.items():
+            if k in def_classical:
+                self.classical_dict[k] = v
+            else:
+                raise UnknownClassicalModeError
+
+    def num(
+        self, count: Optional[int] = None, show: Optional[int] = None
+    ) -> str:  # (;$count,$show)
+        """
+        Set the number to be used in other method calls.
+
+        Returns count.
+
+        Set show to False to return '' instead.
+
+        """
+        if count is not None:
+            try:
+                self.persistent_count = int(count)
+            except ValueError as err:
+                raise BadNumValueError from err
+            if (show is None) or show:
+                return str(count)
+        else:
+            self.persistent_count = None
+        return ""
+
+    def gender(self, gender: str) -> None:
+        """
+        set the gender for the singular of plural pronouns
+
+        can be one of:
+        'neuter'                ('they' -> 'it')
+        'feminine'              ('they' -> 'she')
+        'masculine'             ('they' -> 'he')
+        'gender-neutral'        ('they' -> 'they')
+        'feminine or masculine' ('they' -> 'she or he')
+        'masculine or feminine' ('they' -> 'he or she')
+        """
+        if gender in singular_pronoun_genders:
+            self.thegender = gender
+        else:
+            raise BadGenderError
+
+    def _get_value_from_ast(self, obj):
+        """
+        Return the value of the ast object.
+        """
+        if isinstance(obj, ast.Num):
+            return obj.n
+        elif isinstance(obj, ast.Str):
+            return obj.s
+        elif isinstance(obj, ast.List):
+            return [self._get_value_from_ast(e) for e in obj.elts]
+        elif isinstance(obj, ast.Tuple):
+            return tuple([self._get_value_from_ast(e) for e in obj.elts])
+
+        # None, True and False are NameConstants in Py3.4 and above.
+        elif isinstance(obj, ast.NameConstant):
+            return obj.value
+
+        # Probably passed a variable name.
+        # Or passed a single word without wrapping it in quotes as an argument
+        # ex: p.inflect("I plural(see)") instead of p.inflect("I plural('see')")
+        raise NameError(f"name '{obj.id}' is not defined")
+
+    def _string_to_substitute(
+        self, mo: Match, methods_dict: Dict[str, Callable]
+    ) -> str:
+        """
+        Return the string to be substituted for the match.
+        """
+        matched_text, f_name = mo.groups()
+        # matched_text is the complete match string. e.g. plural_noun(cat)
+        # f_name is the function name. e.g. plural_noun
+
+        # Return matched_text if function name is not in methods_dict
+        if f_name not in methods_dict:
+            return matched_text
+
+        # Parse the matched text
+        a_tree = ast.parse(matched_text)
+
+        # get the args and kwargs from ast objects
+        args_list = [
+            self._get_value_from_ast(a)
+            for a in a_tree.body[0].value.args  # type: ignore[attr-defined]
+        ]
+        kwargs_list = {
+            kw.arg: self._get_value_from_ast(kw.value)
+            for kw in a_tree.body[0].value.keywords  # type: ignore[attr-defined]
+        }
+
+        # Call the corresponding function
+        return methods_dict[f_name](*args_list, **kwargs_list)
+
+    # 0. PERFORM GENERAL INFLECTIONS IN A STRING
+
+    @typechecked
+    def inflect(self, text: Word) -> str:
+        """
+        Perform inflections in a string.
+
+        e.g. inflect('The plural of cat is plural(cat)') returns
+        'The plural of cat is cats'
+
+        can use plural, plural_noun, plural_verb, plural_adj,
+        singular_noun, a, an, no, ordinal, number_to_words,
+        and prespart
+
+        """
+        save_persistent_count = self.persistent_count
+
+        # Dictionary of allowed methods
+        methods_dict: Dict[str, Callable] = {
+            "plural": self.plural,
+            "plural_adj": self.plural_adj,
+            "plural_noun": self.plural_noun,
+            "plural_verb": self.plural_verb,
+            "singular_noun": self.singular_noun,
+            "a": self.a,
+            "an": self.a,
+            "no": self.no,
+            "ordinal": self.ordinal,
+            "number_to_words": self.number_to_words,
+            "present_participle": self.present_participle,
+            "num": self.num,
+        }
+
+        # Regular expression to find Python's function call syntax
+        output = FUNCTION_CALL.sub(
+            lambda mo: self._string_to_substitute(mo, methods_dict), text
+        )
+        self.persistent_count = save_persistent_count
+        return output
+
+    # ## PLURAL SUBROUTINES
+
+    def postprocess(self, orig: str, inflected) -> str:
+        inflected = str(inflected)
+        if "|" in inflected:
+            word_options = inflected.split("|")
+            # When two parts of a noun need to be pluralized
+            if len(word_options[0].split(" ")) == len(word_options[1].split(" ")):
+                result = inflected.split("|")[self.classical_dict["all"]].split(" ")
+            # When only the last part of the noun needs to be pluralized
+            else:
+                result = inflected.split(" ")
+                for index, word in enumerate(result):
+                    if "|" in word:
+                        result[index] = word.split("|")[self.classical_dict["all"]]
+        else:
+            result = inflected.split(" ")
+
+        # Try to fix word wise capitalization
+        for index, word in enumerate(orig.split(" ")):
+            if word == "I":
+                # Is this the only word for exceptions like this
+                # Where the original is fully capitalized
+                # without 'meaning' capitalization?
+                # Also this fails to handle a capitalizaion in context
+                continue
+            if word.capitalize() == word:
+                result[index] = result[index].capitalize()
+            if word == word.upper():
+                result[index] = result[index].upper()
+        return " ".join(result)
+
+    def partition_word(self, text: str) -> Tuple[str, str, str]:
+        mo = PARTITION_WORD.search(text)
+        if mo:
+            return mo.group(1), mo.group(2), mo.group(3)
+        else:
+            return "", "", ""
+
+    @typechecked
+    def plural(self, text: Word, count: Optional[Union[str, int, Any]] = None) -> str:
+        """
+        Return the plural of text.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(
+            word,
+            self._pl_special_adjective(word, count)
+            or self._pl_special_verb(word, count)
+            or self._plnoun(word, count),
+        )
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def plural_noun(
+        self, text: Word, count: Optional[Union[str, int, Any]] = None
+    ) -> str:
+        """
+        Return the plural of text, where text is a noun.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(word, self._plnoun(word, count))
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def plural_verb(
+        self, text: Word, count: Optional[Union[str, int, Any]] = None
+    ) -> str:
+        """
+        Return the plural of text, where text is a verb.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(
+            word,
+            self._pl_special_verb(word, count) or self._pl_general_verb(word, count),
+        )
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def plural_adj(
+        self, text: Word, count: Optional[Union[str, int, Any]] = None
+    ) -> str:
+        """
+        Return the plural of text, where text is an adjective.
+
+        If count supplied, then return text if count is one of:
+            1, a, an, one, each, every, this, that
+
+        otherwise return the plural.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        plural = self.postprocess(word, self._pl_special_adjective(word, count) or word)
+        return f"{pre}{plural}{post}"
+
+    @typechecked
+    def compare(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        >>> compare = engine().compare
+        >>> compare("egg", "eggs")
+        's:p'
+        >>> compare('egg', 'egg')
+        'eq'
+
+        Words should not be empty.
+
+        >>> compare('egg', '')
+        Traceback (most recent call last):
+        ...
+        typeguard.TypeCheckError:...is not an instance of inflect.Word
+        """
+        norms = self.plural_noun, self.plural_verb, self.plural_adj
+        results = (self._plequal(word1, word2, norm) for norm in norms)
+        return next(filter(None, results), False)
+
+    @typechecked
+    def compare_nouns(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+        word1 and word2 are to be treated as nouns
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        """
+        return self._plequal(word1, word2, self.plural_noun)
+
+    @typechecked
+    def compare_verbs(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+        word1 and word2 are to be treated as verbs
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        """
+        return self._plequal(word1, word2, self.plural_verb)
+
+    @typechecked
+    def compare_adjs(self, word1: Word, word2: Word) -> Union[str, bool]:
+        """
+        compare word1 and word2 for equality regardless of plurality
+        word1 and word2 are to be treated as adjectives
+
+        return values:
+        eq - the strings are equal
+        p:s - word1 is the plural of word2
+        s:p - word2 is the plural of word1
+        p:p - word1 and word2 are two different plural forms of the one word
+        False - otherwise
+
+        """
+        return self._plequal(word1, word2, self.plural_adj)
+
+    @typechecked
+    def singular_noun(
+        self,
+        text: Word,
+        count: Optional[Union[int, str, Any]] = None,
+        gender: Optional[str] = None,
+    ) -> Union[str, Literal[False]]:
+        """
+        Return the singular of text, where text is a plural noun.
+
+        If count supplied, then return the singular if count is one of:
+            1, a, an, one, each, every, this, that or if count is None
+
+        otherwise return text unchanged.
+
+        Whitespace at the start and end is preserved.
+
+        >>> p = engine()
+        >>> p.singular_noun('horses')
+        'horse'
+        >>> p.singular_noun('knights')
+        'knight'
+
+        Returns False when a singular noun is passed.
+
+        >>> p.singular_noun('horse')
+        False
+        >>> p.singular_noun('knight')
+        False
+        >>> p.singular_noun('soldier')
+        False
+
+        """
+        pre, word, post = self.partition_word(text)
+        if not word:
+            return text
+        sing = self._sinoun(word, count=count, gender=gender)
+        if sing is not False:
+            plural = self.postprocess(word, sing)
+            return f"{pre}{plural}{post}"
+        return False
+
+    def _plequal(self, word1: str, word2: str, pl) -> Union[str, bool]:  # noqa: C901
+        classval = self.classical_dict.copy()
+        self.classical_dict = all_classical.copy()
+        if word1 == word2:
+            return "eq"
+        if word1 == pl(word2):
+            return "p:s"
+        if pl(word1) == word2:
+            return "s:p"
+        self.classical_dict = no_classical.copy()
+        if word1 == pl(word2):
+            return "p:s"
+        if pl(word1) == word2:
+            return "s:p"
+        self.classical_dict = classval.copy()
+
+        if pl == self.plural or pl == self.plural_noun:
+            if self._pl_check_plurals_N(word1, word2):
+                return "p:p"
+            if self._pl_check_plurals_N(word2, word1):
+                return "p:p"
+        if pl == self.plural or pl == self.plural_adj:
+            if self._pl_check_plurals_adj(word1, word2):
+                return "p:p"
+        return False
+
+    def _pl_reg_plurals(self, pair: str, stems: str, end1: str, end2: str) -> bool:
+        pattern = rf"({stems})({end1}\|\1{end2}|{end2}\|\1{end1})"
+        return bool(re.search(pattern, pair))
+
+    def _pl_check_plurals_N(self, word1: str, word2: str) -> bool:
+        stem_endings = (
+            (pl_sb_C_a_ata, "as", "ata"),
+            (pl_sb_C_is_ides, "is", "ides"),
+            (pl_sb_C_a_ae, "s", "e"),
+            (pl_sb_C_en_ina, "ens", "ina"),
+            (pl_sb_C_um_a, "ums", "a"),
+            (pl_sb_C_us_i, "uses", "i"),
+            (pl_sb_C_on_a, "ons", "a"),
+            (pl_sb_C_o_i_stems, "os", "i"),
+            (pl_sb_C_ex_ices, "exes", "ices"),
+            (pl_sb_C_ix_ices, "ixes", "ices"),
+            (pl_sb_C_i, "s", "i"),
+            (pl_sb_C_im, "s", "im"),
+            (".*eau", "s", "x"),
+            (".*ieu", "s", "x"),
+            (".*tri", "xes", "ces"),
+            (".{2,}[yia]n", "xes", "ges"),
+        )
+
+        words = map(Words, (word1, word2))
+        pair = "|".join(word.last for word in words)
+
+        return (
+            pair in pl_sb_irregular_s.values()
+            or pair in pl_sb_irregular.values()
+            or pair in pl_sb_irregular_caps.values()
+            or any(
+                self._pl_reg_plurals(pair, stems, end1, end2)
+                for stems, end1, end2 in stem_endings
+            )
+        )
+
+    def _pl_check_plurals_adj(self, word1: str, word2: str) -> bool:
+        word1a = word1[: word1.rfind("'")] if word1.endswith(("'s", "'")) else ""
+        word2a = word2[: word2.rfind("'")] if word2.endswith(("'s", "'")) else ""
+
+        return (
+            bool(word1a)
+            and bool(word2a)
+            and (
+                self._pl_check_plurals_N(word1a, word2a)
+                or self._pl_check_plurals_N(word2a, word1a)
+            )
+        )
+
+    def get_count(self, count: Optional[Union[str, int]] = None) -> Union[str, int]:
+        if count is None and self.persistent_count is not None:
+            count = self.persistent_count
+
+        if count is not None:
+            count = (
+                1
+                if (
+                    (str(count) in pl_count_one)
+                    or (
+                        self.classical_dict["zero"]
+                        and str(count).lower() in pl_count_zero
+                    )
+                )
+                else 2
+            )
+        else:
+            count = ""
+        return count
+
+    # @profile
+    def _plnoun(  # noqa: C901
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> str:
+        count = self.get_count(count)
+
+        # DEFAULT TO PLURAL
+
+        if count == 1:
+            return word
+
+        # HANDLE USER-DEFINED NOUNS
+
+        value = self.ud_match(word, self.pl_sb_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
+
+        if word == "":
+            return word
+
+        word = Words(word)
+
+        if word.last.lower() in pl_sb_uninflected_complete:
+            if len(word.split_) >= 3:
+                return self._handle_long_compounds(word, count=2) or word
+            return word
+
+        if word in pl_sb_uninflected_caps:
+            return word
+
+        for k, v in pl_sb_uninflected_bysize.items():
+            if word.lowered[-k:] in v:
+                return word
+
+        if self.classical_dict["herd"] and word.last.lower() in pl_sb_uninflected_herd:
+            return word
+
+        # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
+
+        mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
+        if mo and mo.group(2) != "":
+            return f"{self._plnoun(mo.group(1), 2)}{mo.group(2)}"
+
+        if " a " in word.lowered or "-a-" in word.lowered:
+            mo = PL_SB_PREP_DUAL_COMPOUND_RE.search(word)
+            if mo and mo.group(2) != "" and mo.group(3) != "":
+                return (
+                    f"{self._plnoun(mo.group(1), 2)}"
+                    f"{mo.group(2)}"
+                    f"{self._plnoun(mo.group(3))}"
+                )
+
+        if len(word.split_) >= 3:
+            handled_words = self._handle_long_compounds(word, count=2)
+            if handled_words is not None:
+                return handled_words
+
+        # only pluralize denominators in units
+        mo = DENOMINATOR.search(word.lowered)
+        if mo:
+            index = len(mo.group("denominator"))
+            return f"{self._plnoun(word[:index])}{word[index:]}"
+
+        # handle units given in degrees (only accept if
+        # there is no more than one word following)
+        # degree Celsius => degrees Celsius but degree
+        # fahrenheit hour => degree fahrenheit hours
+        if len(word.split_) >= 2 and word.split_[-2] == "degree":
+            return " ".join([self._plnoun(word.first)] + word.split_[1:])
+
+        with contextlib.suppress(ValueError):
+            return self._handle_prepositional_phrase(
+                word.lowered,
+                functools.partial(self._plnoun, count=2),
+                '-',
+            )
+
+        # HANDLE PRONOUNS
+
+        for k, v in pl_pron_acc_keys_bysize.items():
+            if word.lowered[-k:] in v:  # ends with accusative pronoun
+                for pk, pv in pl_prep_bysize.items():
+                    if word.lowered[:pk] in pv:  # starts with a prep
+                        if word.lowered.split() == [
+                            word.lowered[:pk],
+                            word.lowered[-k:],
+                        ]:
+                            # only whitespace in between
+                            return word.lowered[:-k] + pl_pron_acc[word.lowered[-k:]]
+
+        try:
+            return pl_pron_nom[word.lowered]
+        except KeyError:
+            pass
+
+        try:
+            return pl_pron_acc[word.lowered]
+        except KeyError:
+            pass
+
+        # HANDLE ISOLATED IRREGULAR PLURALS
+
+        if word.last in pl_sb_irregular_caps:
+            llen = len(word.last)
+            return f"{word[:-llen]}{pl_sb_irregular_caps[word.last]}"
+
+        lowered_last = word.last.lower()
+        if lowered_last in pl_sb_irregular:
+            llen = len(lowered_last)
+            return f"{word[:-llen]}{pl_sb_irregular[lowered_last]}"
+
+        dash_split = word.lowered.split('-')
+        if (" ".join(dash_split[-2:])).lower() in pl_sb_irregular_compound:
+            llen = len(
+                " ".join(dash_split[-2:])
+            )  # TODO: what if 2 spaces between these words?
+            return (
+                f"{word[:-llen]}"
+                f"{pl_sb_irregular_compound[(' '.join(dash_split[-2:])).lower()]}"
+            )
+
+        if word.lowered[-3:] == "quy":
+            return f"{word[:-1]}ies"
+
+        if word.lowered[-6:] == "person":
+            if self.classical_dict["persons"]:
+                return f"{word}s"
+            else:
+                return f"{word[:-4]}ople"
+
+        # HANDLE FAMILIES OF IRREGULAR PLURALS
+
+        if word.lowered[-3:] == "man":
+            for k, v in pl_sb_U_man_mans_bysize.items():
+                if word.lowered[-k:] in v:
+                    return f"{word}s"
+            for k, v in pl_sb_U_man_mans_caps_bysize.items():
+                if word[-k:] in v:
+                    return f"{word}s"
+            return f"{word[:-3]}men"
+        if word.lowered[-5:] == "mouse":
+            return f"{word[:-5]}mice"
+        if word.lowered[-5:] == "louse":
+            v = pl_sb_U_louse_lice_bysize.get(len(word))
+            if v and word.lowered in v:
+                return f"{word[:-5]}lice"
+            return f"{word}s"
+        if word.lowered[-5:] == "goose":
+            return f"{word[:-5]}geese"
+        if word.lowered[-5:] == "tooth":
+            return f"{word[:-5]}teeth"
+        if word.lowered[-4:] == "foot":
+            return f"{word[:-4]}feet"
+        if word.lowered[-4:] == "taco":
+            return f"{word[:-5]}tacos"
+
+        if word.lowered == "die":
+            return "dice"
+
+        # HANDLE UNASSIMILATED IMPORTS
+
+        if word.lowered[-4:] == "ceps":
+            return word
+        if word.lowered[-4:] == "zoon":
+            return f"{word[:-2]}a"
+        if word.lowered[-3:] in ("cis", "sis", "xis"):
+            return f"{word[:-2]}es"
+
+        for lastlet, d, numend, post in (
+            ("h", pl_sb_U_ch_chs_bysize, None, "s"),
+            ("x", pl_sb_U_ex_ices_bysize, -2, "ices"),
+            ("x", pl_sb_U_ix_ices_bysize, -2, "ices"),
+            ("m", pl_sb_U_um_a_bysize, -2, "a"),
+            ("s", pl_sb_U_us_i_bysize, -2, "i"),
+            ("n", pl_sb_U_on_a_bysize, -2, "a"),
+            ("a", pl_sb_U_a_ae_bysize, None, "e"),
+        ):
+            if word.lowered[-1] == lastlet:  # this test to add speed
+                for k, v in d.items():
+                    if word.lowered[-k:] in v:
+                        return word[:numend] + post
+
+        # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
+
+        if self.classical_dict["ancient"]:
+            if word.lowered[-4:] == "trix":
+                return f"{word[:-1]}ces"
+            if word.lowered[-3:] in ("eau", "ieu"):
+                return f"{word}x"
+            if word.lowered[-3:] in ("ynx", "inx", "anx") and len(word) > 4:
+                return f"{word[:-1]}ges"
+
+            for lastlet, d, numend, post in (
+                ("n", pl_sb_C_en_ina_bysize, -2, "ina"),
+                ("x", pl_sb_C_ex_ices_bysize, -2, "ices"),
+                ("x", pl_sb_C_ix_ices_bysize, -2, "ices"),
+                ("m", pl_sb_C_um_a_bysize, -2, "a"),
+                ("s", pl_sb_C_us_i_bysize, -2, "i"),
+                ("s", pl_sb_C_us_us_bysize, None, ""),
+                ("a", pl_sb_C_a_ae_bysize, None, "e"),
+                ("a", pl_sb_C_a_ata_bysize, None, "ta"),
+                ("s", pl_sb_C_is_ides_bysize, -1, "des"),
+                ("o", pl_sb_C_o_i_bysize, -1, "i"),
+                ("n", pl_sb_C_on_a_bysize, -2, "a"),
+            ):
+                if word.lowered[-1] == lastlet:  # this test to add speed
+                    for k, v in d.items():
+                        if word.lowered[-k:] in v:
+                            return word[:numend] + post
+
+            for d, numend, post in (
+                (pl_sb_C_i_bysize, None, "i"),
+                (pl_sb_C_im_bysize, None, "im"),
+            ):
+                for k, v in d.items():
+                    if word.lowered[-k:] in v:
+                        return word[:numend] + post
+
+        # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
+
+        if lowered_last in pl_sb_singular_s_complete:
+            return f"{word}es"
+
+        for k, v in pl_sb_singular_s_bysize.items():
+            if word.lowered[-k:] in v:
+                return f"{word}es"
+
+        if word.lowered[-2:] == "es" and word[0] == word[0].upper():
+            return f"{word}es"
+
+        if word.lowered[-1] == "z":
+            for k, v in pl_sb_z_zes_bysize.items():
+                if word.lowered[-k:] in v:
+                    return f"{word}es"
+
+            if word.lowered[-2:-1] != "z":
+                return f"{word}zes"
+
+        if word.lowered[-2:] == "ze":
+            for k, v in pl_sb_ze_zes_bysize.items():
+                if word.lowered[-k:] in v:
+                    return f"{word}s"
+
+        if word.lowered[-2:] in ("ch", "sh", "zz", "ss") or word.lowered[-1] == "x":
+            return f"{word}es"
+
+        # HANDLE ...f -> ...ves
+
+        if word.lowered[-3:] in ("elf", "alf", "olf"):
+            return f"{word[:-1]}ves"
+        if word.lowered[-3:] == "eaf" and word.lowered[-4:-3] != "d":
+            return f"{word[:-1]}ves"
+        if word.lowered[-4:] in ("nife", "life", "wife"):
+            return f"{word[:-2]}ves"
+        if word.lowered[-3:] == "arf":
+            return f"{word[:-1]}ves"
+
+        # HANDLE ...y
+
+        if word.lowered[-1] == "y":
+            if word.lowered[-2:-1] in "aeiou" or len(word) == 1:
+                return f"{word}s"
+
+            if self.classical_dict["names"]:
+                if word.lowered[-1] == "y" and word[0] == word[0].upper():
+                    return f"{word}s"
+
+            return f"{word[:-1]}ies"
+
+        # HANDLE ...o
+
+        if lowered_last in pl_sb_U_o_os_complete:
+            return f"{word}s"
+
+        for k, v in pl_sb_U_o_os_bysize.items():
+            if word.lowered[-k:] in v:
+                return f"{word}s"
+
+        if word.lowered[-2:] in ("ao", "eo", "io", "oo", "uo"):
+            return f"{word}s"
+
+        if word.lowered[-1] == "o":
+            return f"{word}es"
+
+        # OTHERWISE JUST ADD ...s
+
+        return f"{word}s"
+
+    @classmethod
+    def _handle_prepositional_phrase(cls, phrase, transform, sep):
+        """
+        Given a word or phrase possibly separated by sep, parse out
+        the prepositional phrase and apply the transform to the word
+        preceding the prepositional phrase.
+
+        Raise ValueError if the pivot is not found or if at least two
+        separators are not found.
+
+        >>> engine._handle_prepositional_phrase("man-of-war", str.upper, '-')
+        'MAN-of-war'
+        >>> engine._handle_prepositional_phrase("man of war", str.upper, ' ')
+        'MAN of war'
+        """
+        parts = phrase.split(sep)
+        if len(parts) < 3:
+            raise ValueError("Cannot handle words with fewer than two separators")
+
+        pivot = cls._find_pivot(parts, pl_prep_list_da)
+
+        transformed = transform(parts[pivot - 1]) or parts[pivot - 1]
+        return " ".join(
+            parts[: pivot - 1] + [sep.join([transformed, parts[pivot], ''])]
+        ) + " ".join(parts[(pivot + 1) :])
+
+    def _handle_long_compounds(self, word: Words, count: int) -> Union[str, None]:
+        """
+        Handles the plural and singular for compound `Words` that
+        have three or more words, based on the given count.
+
+        >>> engine()._handle_long_compounds(Words("pair of scissors"), 2)
+        'pairs of scissors'
+        >>> engine()._handle_long_compounds(Words("men beyond hills"), 1)
+        'man beyond hills'
+        """
+        inflection = self._sinoun if count == 1 else self._plnoun
+        solutions = (  # type: ignore
+            " ".join(
+                itertools.chain(
+                    leader,
+                    [inflection(cand, count), prep],  # type: ignore
+                    trailer,
+                )
+            )
+            for leader, (cand, prep), trailer in windowed_complete(word.split_, 2)
+            if prep in pl_prep_list_da  # type: ignore
+        )
+        return next(solutions, None)
+
+    @staticmethod
+    def _find_pivot(words, candidates):
+        pivots = (
+            index for index in range(1, len(words) - 1) if words[index] in candidates
+        )
+        try:
+            return next(pivots)
+        except StopIteration:
+            raise ValueError("No pivot found") from None
+
+    def _pl_special_verb(  # noqa: C901
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> Union[str, bool]:
+        if self.classical_dict["zero"] and str(count).lower() in pl_count_zero:
+            return False
+        count = self.get_count(count)
+
+        if count == 1:
+            return word
+
+        # HANDLE USER-DEFINED VERBS
+
+        value = self.ud_match(word, self.pl_v_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE IRREGULAR PRESENT TENSE (SIMPLE AND COMPOUND)
+
+        try:
+            words = Words(word)
+        except IndexError:
+            return False  # word is ''
+
+        if words.first in plverb_irregular_pres:
+            return f"{plverb_irregular_pres[words.first]}{words[len(words.first) :]}"
+
+        # HANDLE IRREGULAR FUTURE, PRETERITE AND PERFECT TENSES
+
+        if words.first in plverb_irregular_non_pres:
+            return word
+
+        # HANDLE PRESENT NEGATIONS (SIMPLE AND COMPOUND)
+
+        if words.first.endswith("n't") and words.first[:-3] in plverb_irregular_pres:
+            return (
+                f"{plverb_irregular_pres[words.first[:-3]]}n't"
+                f"{words[len(words.first) :]}"
+            )
+
+        if words.first.endswith("n't"):
+            return word
+
+        # HANDLE SPECIAL CASES
+
+        mo = PLVERB_SPECIAL_S_RE.search(word)
+        if mo:
+            return False
+        if WHITESPACE.search(word):
+            return False
+
+        if words.lowered == "quizzes":
+            return "quiz"
+
+        # HANDLE STANDARD 3RD PERSON (CHOP THE ...(e)s OFF SINGLE WORDS)
+
+        if (
+            words.lowered[-4:] in ("ches", "shes", "zzes", "sses")
+            or words.lowered[-3:] == "xes"
+        ):
+            return words[:-2]
+
+        if words.lowered[-3:] == "ies" and len(words) > 3:
+            return words.lowered[:-3] + "y"
+
+        if (
+            words.last.lower() in pl_v_oes_oe
+            or words.lowered[-4:] in pl_v_oes_oe_endings_size4
+            or words.lowered[-5:] in pl_v_oes_oe_endings_size5
+        ):
+            return words[:-1]
+
+        if words.lowered.endswith("oes") and len(words) > 3:
+            return words.lowered[:-2]
+
+        mo = ENDS_WITH_S.search(words)
+        if mo:
+            return mo.group(1)
+
+        # OTHERWISE, A REGULAR VERB (HANDLE ELSEWHERE)
+
+        return False
+
+    def _pl_general_verb(
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> str:
+        count = self.get_count(count)
+
+        if count == 1:
+            return word
+
+        # HANDLE AMBIGUOUS PRESENT TENSES  (SIMPLE AND COMPOUND)
+
+        mo = plverb_ambiguous_pres_keys.search(word)
+        if mo:
+            return f"{plverb_ambiguous_pres[mo.group(1).lower()]}{mo.group(2)}"
+
+        # HANDLE AMBIGUOUS PRETERITE AND PERFECT TENSES
+
+        mo = plverb_ambiguous_non_pres.search(word)
+        if mo:
+            return word
+
+        # OTHERWISE, 1st OR 2ND PERSON IS UNINFLECTED
+
+        return word
+
+    def _pl_special_adjective(
+        self, word: str, count: Optional[Union[str, int]] = None
+    ) -> Union[str, bool]:
+        count = self.get_count(count)
+
+        if count == 1:
+            return word
+
+        # HANDLE USER-DEFINED ADJECTIVES
+
+        value = self.ud_match(word, self.pl_adj_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE KNOWN CASES
+
+        mo = pl_adj_special_keys.search(word)
+        if mo:
+            return pl_adj_special[mo.group(1).lower()]
+
+        # HANDLE POSSESSIVES
+
+        mo = pl_adj_poss_keys.search(word)
+        if mo:
+            return pl_adj_poss[mo.group(1).lower()]
+
+        mo = ENDS_WITH_APOSTROPHE_S.search(word)
+        if mo:
+            pl = self.plural_noun(mo.group(1))
+            trailing_s = "" if pl[-1] == "s" else "s"
+            return f"{pl}'{trailing_s}"
+
+        # OTHERWISE, NO IDEA
+
+        return False
+
+    # @profile
+    def _sinoun(  # noqa: C901
+        self,
+        word: str,
+        count: Optional[Union[str, int]] = None,
+        gender: Optional[str] = None,
+    ) -> Union[str, bool]:
+        count = self.get_count(count)
+
+        # DEFAULT TO PLURAL
+
+        if count == 2:
+            return word
+
+        # SET THE GENDER
+
+        try:
+            if gender is None:
+                gender = self.thegender
+            elif gender not in singular_pronoun_genders:
+                raise BadGenderError
+        except (TypeError, IndexError) as err:
+            raise BadGenderError from err
+
+        # HANDLE USER-DEFINED NOUNS
+
+        value = self.ud_match(word, self.si_sb_user_defined)
+        if value is not None:
+            return value
+
+        # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
+
+        if word == "":
+            return word
+
+        if word in si_sb_ois_oi_case:
+            return word[:-1]
+
+        words = Words(word)
+
+        if words.last.lower() in pl_sb_uninflected_complete:
+            if len(words.split_) >= 3:
+                return self._handle_long_compounds(words, count=1) or word
+            return word
+
+        if word in pl_sb_uninflected_caps:
+            return word
+
+        for k, v in pl_sb_uninflected_bysize.items():
+            if words.lowered[-k:] in v:
+                return word
+
+        if self.classical_dict["herd"] and words.last.lower() in pl_sb_uninflected_herd:
+            return word
+
+        if words.last.lower() in pl_sb_C_us_us:
+            return word if self.classical_dict["ancient"] else False
+
+        # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
+
+        mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
+        if mo and mo.group(2) != "":
+            return f"{self._sinoun(mo.group(1), 1, gender=gender)}{mo.group(2)}"
+
+        with contextlib.suppress(ValueError):
+            return self._handle_prepositional_phrase(
+                words.lowered,
+                functools.partial(self._sinoun, count=1, gender=gender),
+                ' ',
+            )
+
+        with contextlib.suppress(ValueError):
+            return self._handle_prepositional_phrase(
+                words.lowered,
+                functools.partial(self._sinoun, count=1, gender=gender),
+                '-',
+            )
+
+        # HANDLE PRONOUNS
+
+        for k, v in si_pron_acc_keys_bysize.items():
+            if words.lowered[-k:] in v:  # ends with accusative pronoun
+                for pk, pv in pl_prep_bysize.items():
+                    if words.lowered[:pk] in pv:  # starts with a prep
+                        if words.lowered.split() == [
+                            words.lowered[:pk],
+                            words.lowered[-k:],
+                        ]:
+                            # only whitespace in between
+                            return words.lowered[:-k] + get_si_pron(
+                                "acc", words.lowered[-k:], gender
+                            )
+
+        try:
+            return get_si_pron("nom", words.lowered, gender)
+        except KeyError:
+            pass
+
+        try:
+            return get_si_pron("acc", words.lowered, gender)
+        except KeyError:
+            pass
+
+        # HANDLE ISOLATED IRREGULAR PLURALS
+
+        if words.last in si_sb_irregular_caps:
+            llen = len(words.last)
+            return f"{word[:-llen]}{si_sb_irregular_caps[words.last]}"
+
+        if words.last.lower() in si_sb_irregular:
+            llen = len(words.last.lower())
+            return f"{word[:-llen]}{si_sb_irregular[words.last.lower()]}"
+
+        dash_split = words.lowered.split("-")
+        if (" ".join(dash_split[-2:])).lower() in si_sb_irregular_compound:
+            llen = len(
+                " ".join(dash_split[-2:])
+            )  # TODO: what if 2 spaces between these words?
+            return "{}{}".format(
+                word[:-llen],
+                si_sb_irregular_compound[(" ".join(dash_split[-2:])).lower()],
+            )
+
+        if words.lowered[-5:] == "quies":
+            return word[:-3] + "y"
+
+        if words.lowered[-7:] == "persons":
+            return word[:-1]
+        if words.lowered[-6:] == "people":
+            return word[:-4] + "rson"
+
+        # HANDLE FAMILIES OF IRREGULAR PLURALS
+
+        if words.lowered[-4:] == "mans":
+            for k, v in si_sb_U_man_mans_bysize.items():
+                if words.lowered[-k:] in v:
+                    return word[:-1]
+            for k, v in si_sb_U_man_mans_caps_bysize.items():
+                if word[-k:] in v:
+                    return word[:-1]
+        if words.lowered[-3:] == "men":
+            return word[:-3] + "man"
+        if words.lowered[-4:] == "mice":
+            return word[:-4] + "mouse"
+        if words.lowered[-4:] == "lice":
+            v = si_sb_U_louse_lice_bysize.get(len(word))
+            if v and words.lowered in v:
+                return word[:-4] + "louse"
+        if words.lowered[-5:] == "geese":
+            return word[:-5] + "goose"
+        if words.lowered[-5:] == "teeth":
+            return word[:-5] + "tooth"
+        if words.lowered[-4:] == "feet":
+            return word[:-4] + "foot"
+
+        if words.lowered == "dice":
+            return "die"
+
+        # HANDLE UNASSIMILATED IMPORTS
+
+        if words.lowered[-4:] == "ceps":
+            return word
+        if words.lowered[-3:] == "zoa":
+            return word[:-1] + "on"
+
+        for lastlet, d, unass_numend, post in (
+            ("s", si_sb_U_ch_chs_bysize, -1, ""),
+            ("s", si_sb_U_ex_ices_bysize, -4, "ex"),
+            ("s", si_sb_U_ix_ices_bysize, -4, "ix"),
+            ("a", si_sb_U_um_a_bysize, -1, "um"),
+            ("i", si_sb_U_us_i_bysize, -1, "us"),
+            ("a", si_sb_U_on_a_bysize, -1, "on"),
+            ("e", si_sb_U_a_ae_bysize, -1, ""),
+        ):
+            if words.lowered[-1] == lastlet:  # this test to add speed
+                for k, v in d.items():
+                    if words.lowered[-k:] in v:
+                        return word[:unass_numend] + post
+
+        # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
+
+        if self.classical_dict["ancient"]:
+            if words.lowered[-6:] == "trices":
+                return word[:-3] + "x"
+            if words.lowered[-4:] in ("eaux", "ieux"):
+                return word[:-1]
+            if words.lowered[-5:] in ("ynges", "inges", "anges") and len(word) > 6:
+                return word[:-3] + "x"
+
+            for lastlet, d, class_numend, post in (
+                ("a", si_sb_C_en_ina_bysize, -3, "en"),
+                ("s", si_sb_C_ex_ices_bysize, -4, "ex"),
+                ("s", si_sb_C_ix_ices_bysize, -4, "ix"),
+                ("a", si_sb_C_um_a_bysize, -1, "um"),
+                ("i", si_sb_C_us_i_bysize, -1, "us"),
+                ("s", pl_sb_C_us_us_bysize, None, ""),
+                ("e", si_sb_C_a_ae_bysize, -1, ""),
+                ("a", si_sb_C_a_ata_bysize, -2, ""),
+                ("s", si_sb_C_is_ides_bysize, -3, "s"),
+                ("i", si_sb_C_o_i_bysize, -1, "o"),
+                ("a", si_sb_C_on_a_bysize, -1, "on"),
+                ("m", si_sb_C_im_bysize, -2, ""),
+                ("i", si_sb_C_i_bysize, -1, ""),
+            ):
+                if words.lowered[-1] == lastlet:  # this test to add speed
+                    for k, v in d.items():
+                        if words.lowered[-k:] in v:
+                            return word[:class_numend] + post
+
+        # HANDLE PLURLS ENDING IN uses -> use
+
+        if (
+            words.lowered[-6:] == "houses"
+            or word in si_sb_uses_use_case
+            or words.last.lower() in si_sb_uses_use
+        ):
+            return word[:-1]
+
+        # HANDLE PLURLS ENDING IN ies -> ie
+
+        if word in si_sb_ies_ie_case or words.last.lower() in si_sb_ies_ie:
+            return word[:-1]
+
+        # HANDLE PLURLS ENDING IN oes -> oe
+
+        if (
+            words.lowered[-5:] == "shoes"
+            or word in si_sb_oes_oe_case
+            or words.last.lower() in si_sb_oes_oe
+        ):
+            return word[:-1]
+
+        # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
+
+        if word in si_sb_sses_sse_case or words.last.lower() in si_sb_sses_sse:
+            return word[:-1]
+
+        if words.last.lower() in si_sb_singular_s_complete:
+            return word[:-2]
+
+        for k, v in si_sb_singular_s_bysize.items():
+            if words.lowered[-k:] in v:
+                return word[:-2]
+
+        if words.lowered[-4:] == "eses" and word[0] == word[0].upper():
+            return word[:-2]
+
+        if words.last.lower() in si_sb_z_zes:
+            return word[:-2]
+
+        if words.last.lower() in si_sb_zzes_zz:
+            return word[:-2]
+
+        if words.lowered[-4:] == "zzes":
+            return word[:-3]
+
+        if word in si_sb_ches_che_case or words.last.lower() in si_sb_ches_che:
+            return word[:-1]
+
+        if words.lowered[-4:] in ("ches", "shes"):
+            return word[:-2]
+
+        if words.last.lower() in si_sb_xes_xe:
+            return word[:-1]
+
+        if words.lowered[-3:] == "xes":
+            return word[:-2]
+
+        # HANDLE ...f -> ...ves
+
+        if word in si_sb_ves_ve_case or words.last.lower() in si_sb_ves_ve:
+            return word[:-1]
+
+        if words.lowered[-3:] == "ves":
+            if words.lowered[-5:-3] in ("el", "al", "ol"):
+                return word[:-3] + "f"
+            if words.lowered[-5:-3] == "ea" and word[-6:-5] != "d":
+                return word[:-3] + "f"
+            if words.lowered[-5:-3] in ("ni", "li", "wi"):
+                return word[:-3] + "fe"
+            if words.lowered[-5:-3] == "ar":
+                return word[:-3] + "f"
+
+        # HANDLE ...y
+
+        if words.lowered[-2:] == "ys":
+            if len(words.lowered) > 2 and words.lowered[-3] in "aeiou":
+                return word[:-1]
+
+            if self.classical_dict["names"]:
+                if words.lowered[-2:] == "ys" and word[0] == word[0].upper():
+                    return word[:-1]
+
+        if words.lowered[-3:] == "ies":
+            return word[:-3] + "y"
+
+        # HANDLE ...o
+
+        if words.lowered[-2:] == "os":
+            if words.last.lower() in si_sb_U_o_os_complete:
+                return word[:-1]
+
+            for k, v in si_sb_U_o_os_bysize.items():
+                if words.lowered[-k:] in v:
+                    return word[:-1]
+
+            if words.lowered[-3:] in ("aos", "eos", "ios", "oos", "uos"):
+                return word[:-1]
+
+        if words.lowered[-3:] == "oes":
+            return word[:-2]
+
+        # UNASSIMILATED IMPORTS FINAL RULE
+
+        if word in si_sb_es_is:
+            return word[:-2] + "is"
+
+        # OTHERWISE JUST REMOVE ...s
+
+        if words.lowered[-1] == "s":
+            return word[:-1]
+
+        # COULD NOT FIND SINGULAR
+
+        return False
+
+    # ADJECTIVES
+
+    @typechecked
+    def a(self, text: Word, count: Optional[Union[int, str, Any]] = 1) -> str:
+        """
+        Return the appropriate indefinite article followed by text.
+
+        The indefinite article is either 'a' or 'an'.
+
+        If count is not one, then return count followed by text
+        instead of 'a' or 'an'.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        mo = INDEFINITE_ARTICLE_TEST.search(text)
+        if mo:
+            word = mo.group(2)
+            if not word:
+                return text
+            pre = mo.group(1)
+            post = mo.group(3)
+            result = self._indef_article(word, count)
+            return f"{pre}{result}{post}"
+        return ""
+
+    an = a
+
+    _indef_article_cases = (
+        # HANDLE ORDINAL FORMS
+        (A_ordinal_a, "a"),
+        (A_ordinal_an, "an"),
+        # HANDLE SPECIAL CASES
+        (A_explicit_an, "an"),
+        (SPECIAL_AN, "an"),
+        (SPECIAL_A, "a"),
+        # HANDLE ABBREVIATIONS
+        (A_abbrev, "an"),
+        (SPECIAL_ABBREV_AN, "an"),
+        (SPECIAL_ABBREV_A, "a"),
+        # HANDLE CONSONANTS
+        (CONSONANTS, "a"),
+        # HANDLE SPECIAL VOWEL-FORMS
+        (ARTICLE_SPECIAL_EU, "a"),
+        (ARTICLE_SPECIAL_ONCE, "a"),
+        (ARTICLE_SPECIAL_ONETIME, "a"),
+        (ARTICLE_SPECIAL_UNIT, "a"),
+        (ARTICLE_SPECIAL_UBA, "a"),
+        (ARTICLE_SPECIAL_UKR, "a"),
+        (A_explicit_a, "a"),
+        # HANDLE SPECIAL CAPITALS
+        (SPECIAL_CAPITALS, "a"),
+        # HANDLE VOWELS
+        (VOWELS, "an"),
+        # HANDLE y...
+        # (BEFORE CERTAIN CONSONANTS IMPLIES (UNNATURALIZED) "i.." SOUND)
+        (A_y_cons, "an"),
+    )
+
+    def _indef_article(self, word: str, count: Union[int, str, Any]) -> str:
+        mycount = self.get_count(count)
+
+        if mycount != 1:
+            return f"{count} {word}"
+
+        # HANDLE USER-DEFINED VARIANTS
+
+        value = self.ud_match(word, self.A_a_user_defined)
+        if value is not None:
+            return f"{value} {word}"
+
+        matches = (
+            f'{article} {word}'
+            for regexen, article in self._indef_article_cases
+            if regexen.search(word)
+        )
+
+        # OTHERWISE, GUESS "a"
+        fallback = f'a {word}'
+        return next(matches, fallback)
+
+    # 2. TRANSLATE ZERO-QUANTIFIED $word TO "no plural($word)"
+
+    @typechecked
+    def no(self, text: Word, count: Optional[Union[int, str]] = None) -> str:
+        """
+        If count is 0, no, zero or nil, return 'no' followed by the plural
+        of text.
+
+        If count is one of:
+            1, a, an, one, each, every, this, that
+            return count followed by text.
+
+        Otherwise return count follow by the plural of text.
+
+        In the return value count is always followed by a space.
+
+        Whitespace at the start and end is preserved.
+
+        """
+        if count is None and self.persistent_count is not None:
+            count = self.persistent_count
+
+        if count is None:
+            count = 0
+        mo = PARTITION_WORD.search(text)
+        if mo:
+            pre = mo.group(1)
+            word = mo.group(2)
+            post = mo.group(3)
+        else:
+            pre = ""
+            word = ""
+            post = ""
+
+        if str(count).lower() in pl_count_zero:
+            count = 'no'
+        return f"{pre}{count} {self.plural(word, count)}{post}"
+
+    # PARTICIPLES
+
+    @typechecked
+    def present_participle(self, word: Word) -> str:
+        """
+        Return the present participle for word.
+
+        word is the 3rd person singular verb.
+
+        """
+        plv = self.plural_verb(word, 2)
+        ans = plv
+
+        for regexen, repl in PRESENT_PARTICIPLE_REPLACEMENTS:
+            ans, num = regexen.subn(repl, plv)
+            if num:
+                return f"{ans}ing"
+        return f"{ans}ing"
+
+    # NUMERICAL INFLECTIONS
+
+    @typechecked
+    def ordinal(self, num: Union[Number, Word]) -> str:
+        """
+        Return the ordinal of num.
+
+        >>> ordinal = engine().ordinal
+        >>> ordinal(1)
+        '1st'
+        >>> ordinal('one')
+        'first'
+        """
+        if DIGIT.match(str(num)):
+            if isinstance(num, (float, int)) and int(num) == num:
+                n = int(num)
+            else:
+                if "." in str(num):
+                    try:
+                        # numbers after decimal,
+                        # so only need last one for ordinal
+                        n = int(str(num)[-1])
+
+                    except ValueError:  # ends with '.', so need to use whole string
+                        n = int(str(num)[:-1])
+                else:
+                    n = int(num)  # type: ignore
+            try:
+                post = nth[n % 100]
+            except KeyError:
+                post = nth[n % 10]
+            return f"{num}{post}"
+        else:
+            return self._sub_ord(num)
+
+    def millfn(self, ind: int = 0) -> str:
+        if ind > len(mill) - 1:
+            raise NumOutOfRangeError
+        return mill[ind]
+
+    def unitfn(self, units: int, mindex: int = 0) -> str:
+        return f"{unit[units]}{self.millfn(mindex)}"
+
+    def tenfn(self, tens, units, mindex=0) -> str:
+        if tens != 1:
+            tens_part = ten[tens]
+            if tens and units:
+                hyphen = "-"
+            else:
+                hyphen = ""
+            unit_part = unit[units]
+            mill_part = self.millfn(mindex)
+            return f"{tens_part}{hyphen}{unit_part}{mill_part}"
+        return f"{teen[units]}{mill[mindex]}"
+
+    def hundfn(self, hundreds: int, tens: int, units: int, mindex: int) -> str:
+        if hundreds:
+            andword = f" {self._number_args['andword']} " if tens or units else ""
+            # use unit not unitfn as simpler
+            return (
+                f"{unit[hundreds]} hundred{andword}"
+                f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
+            )
+        if tens or units:
+            return f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
+        return ""
+
+    def group1sub(self, mo: Match) -> str:
+        units = int(mo.group(1))
+        if units == 1:
+            return f" {self._number_args['one']}, "
+        elif units:
+            return f"{unit[units]}, "
+        else:
+            return f" {self._number_args['zero']}, "
+
+    def group1bsub(self, mo: Match) -> str:
+        units = int(mo.group(1))
+        if units:
+            return f"{unit[units]}, "
+        else:
+            return f" {self._number_args['zero']}, "
+
+    def group2sub(self, mo: Match) -> str:
+        tens = int(mo.group(1))
+        units = int(mo.group(2))
+        if tens:
+            return f"{self.tenfn(tens, units)}, "
+        if units:
+            return f" {self._number_args['zero']} {unit[units]}, "
+        return f" {self._number_args['zero']} {self._number_args['zero']}, "
+
+    def group3sub(self, mo: Match) -> str:
+        hundreds = int(mo.group(1))
+        tens = int(mo.group(2))
+        units = int(mo.group(3))
+        if hundreds == 1:
+            hunword = f" {self._number_args['one']}"
+        elif hundreds:
+            hunword = str(unit[hundreds])
+        else:
+            hunword = f" {self._number_args['zero']}"
+        if tens:
+            tenword = self.tenfn(tens, units)
+        elif units:
+            tenword = f" {self._number_args['zero']} {unit[units]}"
+        else:
+            tenword = f" {self._number_args['zero']} {self._number_args['zero']}"
+        return f"{hunword} {tenword}, "
+
+    def hundsub(self, mo: Match) -> str:
+        ret = self.hundfn(
+            int(mo.group(1)), int(mo.group(2)), int(mo.group(3)), self.mill_count
+        )
+        self.mill_count += 1
+        return ret
+
+    def tensub(self, mo: Match) -> str:
+        return f"{self.tenfn(int(mo.group(1)), int(mo.group(2)), self.mill_count)}, "
+
+    def unitsub(self, mo: Match) -> str:
+        return f"{self.unitfn(int(mo.group(1)), self.mill_count)}, "
+
+    def enword(self, num: str, group: int) -> str:
+        # import pdb
+        # pdb.set_trace()
+
+        if group == 1:
+            num = DIGIT_GROUP.sub(self.group1sub, num)
+        elif group == 2:
+            num = TWO_DIGITS.sub(self.group2sub, num)
+            num = DIGIT_GROUP.sub(self.group1bsub, num, 1)
+        elif group == 3:
+            num = THREE_DIGITS.sub(self.group3sub, num)
+            num = TWO_DIGITS.sub(self.group2sub, num, 1)
+            num = DIGIT_GROUP.sub(self.group1sub, num, 1)
+        elif int(num) == 0:
+            num = self._number_args["zero"]
+        elif int(num) == 1:
+            num = self._number_args["one"]
+        else:
+            num = num.lstrip().lstrip("0")
+            self.mill_count = 0
+            # surely there's a better way to do the next bit
+            mo = THREE_DIGITS_WORD.search(num)
+            while mo:
+                num = THREE_DIGITS_WORD.sub(self.hundsub, num, 1)
+                mo = THREE_DIGITS_WORD.search(num)
+            num = TWO_DIGITS_WORD.sub(self.tensub, num, 1)
+            num = ONE_DIGIT_WORD.sub(self.unitsub, num, 1)
+        return num
+
+    @staticmethod
+    def _sub_ord(val):
+        new = ordinal_suff.sub(lambda match: ordinal[match.group(1)], val)
+        return new + "th" * (new == val)
+
+    @classmethod
+    def _chunk_num(cls, num, decimal, group):
+        if decimal:
+            max_split = -1 if group != 0 else 1
+            chunks = num.split(".", max_split)
+        else:
+            chunks = [num]
+        return cls._remove_last_blank(chunks)
+
+    @staticmethod
+    def _remove_last_blank(chunks):
+        """
+        Remove the last item from chunks if it's a blank string.
+
+        Return the resultant chunks and whether the last item was removed.
+        """
+        removed = chunks[-1] == ""
+        result = chunks[:-1] if removed else chunks
+        return result, removed
+
+    @staticmethod
+    def _get_sign(num):
+        return {'+': 'plus', '-': 'minus'}.get(num.lstrip()[0], '')
+
+    @typechecked
+    def number_to_words(  # noqa: C901
+        self,
+        num: Union[Number, Word],
+        wantlist: bool = False,
+        group: int = 0,
+        comma: Union[Falsish, str] = ",",
+        andword: str = "and",
+        zero: str = "zero",
+        one: str = "one",
+        decimal: Union[Falsish, str] = "point",
+        threshold: Optional[int] = None,
+    ) -> Union[str, List[str]]:
+        """
+        Return a number in words.
+
+        group = 1, 2 or 3 to group numbers before turning into words
+        comma: define comma
+
+        andword:
+            word for 'and'. Can be set to ''.
+            e.g. "one hundred and one" vs "one hundred one"
+
+        zero: word for '0'
+        one: word for '1'
+        decimal: word for decimal point
+        threshold: numbers above threshold not turned into words
+
+        parameters not remembered from last call. Departure from Perl version.
+        """
+        self._number_args = {"andword": andword, "zero": zero, "one": one}
+        num = str(num)
+
+        # Handle "stylistic" conversions (up to a given threshold)...
+        if threshold is not None and float(num) > threshold:
+            spnum = num.split(".", 1)
+            while comma:
+                (spnum[0], n) = FOUR_DIGIT_COMMA.subn(r"\1,\2", spnum[0])
+                if n == 0:
+                    break
+            try:
+                return f"{spnum[0]}.{spnum[1]}"
+            except IndexError:
+                return str(spnum[0])
+
+        if group < 0 or group > 3:
+            raise BadChunkingOptionError
+
+        sign = self._get_sign(num)
+
+        if num in nth_suff:
+            num = zero
+
+        myord = num[-2:] in nth_suff
+        if myord:
+            num = num[:-2]
+
+        chunks, finalpoint = self._chunk_num(num, decimal, group)
+
+        loopstart = chunks[0] == ""
+        first: bool | None = not loopstart
+
+        def _handle_chunk(chunk):
+            nonlocal first
+
+            # remove all non numeric \D
+            chunk = NON_DIGIT.sub("", chunk)
+            if chunk == "":
+                chunk = "0"
+
+            if group == 0 and not first:
+                chunk = self.enword(chunk, 1)
+            else:
+                chunk = self.enword(chunk, group)
+
+            if chunk[-2:] == ", ":
+                chunk = chunk[:-2]
+            chunk = WHITESPACES_COMMA.sub(",", chunk)
+
+            if group == 0 and first:
+                chunk = COMMA_WORD.sub(f" {andword} \\1", chunk)
+            chunk = WHITESPACES.sub(" ", chunk)
+            # chunk = re.sub(r"(\A\s|\s\Z)", self.blankfn, chunk)
+            chunk = chunk.strip()
+            if first:
+                first = None
+            return chunk
+
+        chunks[loopstart:] = map(_handle_chunk, chunks[loopstart:])
+
+        numchunks = []
+        if first != 0:
+            numchunks = chunks[0].split(f"{comma} ")
+
+        if myord and numchunks:
+            numchunks[-1] = self._sub_ord(numchunks[-1])
+
+        for chunk in chunks[1:]:
+            numchunks.append(decimal)
+            numchunks.extend(chunk.split(f"{comma} "))
+
+        if finalpoint:
+            numchunks.append(decimal)
+
+        if wantlist:
+            return [sign] * bool(sign) + numchunks
+
+        signout = f"{sign} " if sign else ""
+        valout = (
+            ', '.join(numchunks)
+            if group
+            else ''.join(self._render(numchunks, decimal, comma))
+        )
+        return signout + valout
+
+    @staticmethod
+    def _render(chunks, decimal, comma):
+        first_item = chunks.pop(0)
+        yield first_item
+        first = decimal is None or not first_item.endswith(decimal)
+        for nc in chunks:
+            if nc == decimal:
+                first = False
+            elif first:
+                yield comma
+            yield f" {nc}"
+
+    @typechecked
+    def join(
+        self,
+        words: Optional[Sequence[Word]],
+        sep: Optional[str] = None,
+        sep_spaced: bool = True,
+        final_sep: Optional[str] = None,
+        conj: str = "and",
+        conj_spaced: bool = True,
+    ) -> str:
+        """
+        Join words into a list.
+
+        e.g. join(['ant', 'bee', 'fly']) returns 'ant, bee, and fly'
+
+        options:
+        conj: replacement for 'and'
+        sep: separator. default ',', unless ',' is in the list then ';'
+        final_sep: final separator. default ',', unless ',' is in the list then ';'
+        conj_spaced: boolean. Should conj have spaces around it
+
+        """
+        if not words:
+            return ""
+        if len(words) == 1:
+            return words[0]
+
+        if conj_spaced:
+            if conj == "":
+                conj = " "
+            else:
+                conj = f" {conj} "
+
+        if len(words) == 2:
+            return f"{words[0]}{conj}{words[1]}"
+
+        if sep is None:
+            if "," in "".join(words):
+                sep = ";"
+            else:
+                sep = ","
+        if final_sep is None:
+            final_sep = sep
+
+        final_sep = f"{final_sep}{conj}"
+
+        if sep_spaced:
+            sep += " "
+
+        return f"{sep.join(words[0:-1])}{final_sep}{words[-1]}"
diff --git a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/REQUESTED b/pkg_resources/_vendor/inflect/compat/__init__.py
similarity index 100%
rename from pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/REQUESTED
rename to pkg_resources/_vendor/inflect/compat/__init__.py
diff --git a/pkg_resources/_vendor/inflect/compat/py38.py b/pkg_resources/_vendor/inflect/compat/py38.py
new file mode 100644
index 0000000000..a2d01bd98f
--- /dev/null
+++ b/pkg_resources/_vendor/inflect/compat/py38.py
@@ -0,0 +1,7 @@
+import sys
+
+
+if sys.version_info > (3, 9):
+    from typing import Annotated
+else:  # pragma: no cover
+    from typing_extensions import Annotated  # noqa: F401
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/REQUESTED b/pkg_resources/_vendor/inflect/py.typed
similarity index 100%
rename from pkg_resources/_vendor/packaging-24.0.dist-info/REQUESTED
rename to pkg_resources/_vendor/inflect/py.typed
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/RECORD b/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/RECORD
deleted file mode 100644
index 783aa7d2b9..0000000000
--- a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/RECORD
+++ /dev/null
@@ -1,10 +0,0 @@
-jaraco.functools-4.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-jaraco.functools-4.0.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-jaraco.functools-4.0.0.dist-info/METADATA,sha256=nVOe_vWvaN2iWJ2aBVkhKvmvH-gFksNCXHwCNvcj65I,3078
-jaraco.functools-4.0.0.dist-info/RECORD,,
-jaraco.functools-4.0.0.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
-jaraco.functools-4.0.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
-jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642
-jaraco/functools/__init__.pyi,sha256=N4lLbdhMtrmwiK3UuMGhYsiOLLZx69CUNOdmFPSVh6Q,3982
-jaraco/functools/__pycache__/__init__.cpython-312.pyc,,
-jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/INSTALLER b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/more_itertools-10.2.0.dist-info/INSTALLER
rename to pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/zipp-3.7.0.dist-info/LICENSE b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
similarity index 97%
rename from pkg_resources/_vendor/zipp-3.7.0.dist-info/LICENSE
rename to pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
index 353924be0e..1bb5a44356 100644
--- a/pkg_resources/_vendor/zipp-3.7.0.dist-info/LICENSE
+++ b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
@@ -1,5 +1,3 @@
-Copyright Jason R. Coombs
-
 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
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/METADATA b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
similarity index 78%
rename from pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/METADATA
rename to pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
index 581b308378..c865140ab2 100644
--- a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/METADATA
+++ b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
@@ -1,16 +1,16 @@
 Metadata-Version: 2.1
 Name: jaraco.functools
-Version: 4.0.0
+Version: 4.0.1
 Summary: Functools like those found in stdlib
-Home-page: https://github.com/jaraco/jaraco.functools
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/jaraco.functools
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
 Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
 License-File: LICENSE
 Requires-Dist: more-itertools
 Provides-Extra: docs
@@ -26,17 +26,16 @@ Requires-Dist: pytest >=6 ; extra == 'testing'
 Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
 Requires-Dist: pytest-cov ; extra == 'testing'
 Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
-Requires-Dist: pytest-ruff ; extra == 'testing'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
 Requires-Dist: jaraco.classes ; extra == 'testing'
-Requires-Dist: pytest-black >=0.3.7 ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy >=0.9.1 ; (platform_python_implementation != "PyPy") and extra == 'testing'
+Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
 
 .. image:: https://img.shields.io/pypi/v/jaraco.functools.svg
    :target: https://pypi.org/project/jaraco.functools
 
 .. image:: https://img.shields.io/pypi/pyversions/jaraco.functools.svg
 
-.. image:: https://github.com/jaraco/jaraco.functools/workflows/tests/badge.svg
+.. image:: https://github.com/jaraco/jaraco.functools/actions/workflows/main.yml/badge.svg
    :target: https://github.com/jaraco/jaraco.functools/actions?query=workflow%3A%22tests%22
    :alt: tests
 
@@ -44,14 +43,10 @@ Requires-Dist: pytest-mypy >=0.9.1 ; (platform_python_implementation != "PyPy")
     :target: https://github.com/astral-sh/ruff
     :alt: Ruff
 
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
-
 .. image:: https://readthedocs.org/projects/jaracofunctools/badge/?version=latest
    :target: https://jaracofunctools.readthedocs.io/en/latest/?badge=latest
 
-.. image:: https://img.shields.io/badge/skeleton-2023-informational
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
    :target: https://blog.jaraco.com/skeleton
 
 .. image:: https://tidelift.com/badges/package/pypi/jaraco.functools
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
new file mode 100644
index 0000000000..ef3bc21e92
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
@@ -0,0 +1,10 @@
+jaraco.functools-4.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.functools-4.0.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.functools-4.0.1.dist-info/METADATA,sha256=i4aUaQDX-jjdEQK5wevhegyx8JyLfin2HyvaSk3FHso,2891
+jaraco.functools-4.0.1.dist-info/RECORD,,
+jaraco.functools-4.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+jaraco.functools-4.0.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642
+jaraco/functools/__init__.pyi,sha256=gk3dsgHzo5F_U74HzAvpNivFAPCkPJ1b2-yCd62dfnw,3878
+jaraco/functools/__pycache__/__init__.cpython-312.pyc,,
+jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/pkg_resources/_vendor/zipp-3.7.0.dist-info/WHEEL b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
similarity index 65%
rename from pkg_resources/_vendor/zipp-3.7.0.dist-info/WHEEL
rename to pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
index becc9a66ea..bab98d6758 100644
--- a/pkg_resources/_vendor/zipp-3.7.0.dist-info/WHEEL
+++ b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
@@ -1,5 +1,5 @@
 Wheel-Version: 1.0
-Generator: bdist_wheel (0.37.1)
+Generator: bdist_wheel (0.43.0)
 Root-Is-Purelib: true
 Tag: py3-none-any
 
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/top_level.txt b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
similarity index 100%
rename from pkg_resources/_vendor/jaraco.functools-4.0.0.dist-info/top_level.txt
rename to pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/INSTALLER b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/packaging-24.0.dist-info/INSTALLER
rename to pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/LICENSE b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
similarity index 97%
rename from pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/LICENSE
rename to pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
index 353924be0e..1bb5a44356 100644
--- a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/LICENSE
+++ b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
@@ -1,5 +1,3 @@
-Copyright Jason R. Coombs
-
 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
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA
new file mode 100644
index 0000000000..0258a380f4
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA
@@ -0,0 +1,95 @@
+Metadata-Version: 2.1
+Name: jaraco.text
+Version: 3.12.1
+Summary: Module for text manipulation
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/jaraco.text
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: jaraco.functools
+Requires-Dist: jaraco.context >=4.1
+Requires-Dist: autocommand
+Requires-Dist: inflect
+Requires-Dist: more-itertools
+Requires-Dist: importlib-resources ; python_version < "3.9"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: pathlib2 ; (python_version < "3.10") and extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/jaraco.text.svg
+   :target: https://pypi.org/project/jaraco.text
+
+.. image:: https://img.shields.io/pypi/pyversions/jaraco.text.svg
+
+.. image:: https://github.com/jaraco/jaraco.text/actions/workflows/main.yml/badge.svg
+   :target: https://github.com/jaraco/jaraco.text/actions?query=workflow%3A%22tests%22
+   :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/jaracotext/badge/?version=latest
+   :target: https://jaracotext.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+   :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/jaraco.text
+   :target: https://tidelift.com/subscription/pkg/pypi-jaraco.text?utm_source=pypi-jaraco.text&utm_medium=readme
+
+
+This package provides handy routines for dealing with text, such as
+wrapping, substitution, trimming, stripping, prefix and suffix removal,
+line continuation, indentation, comment processing, identifier processing,
+values parsing, case insensitive comparison, and more. See the docs
+(linked in the badge above) for the detailed documentation and examples.
+
+Layouts
+=======
+
+One of the features of this package is the layouts module, which
+provides a simple example of translating keystrokes from one keyboard
+layout to another::
+
+    echo qwerty | python -m jaraco.text.to-dvorak
+    ',.pyf
+    echo  "',.pyf" | python -m jaraco.text.to-qwerty
+    qwerty
+
+Newline Reporting
+=================
+
+Need to know what newlines appear in a file?
+
+::
+
+    $ python -m jaraco.text.show-newlines README.rst
+    newline is '\n'
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD
new file mode 100644
index 0000000000..19e2d8402a
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD
@@ -0,0 +1,20 @@
+jaraco.text-3.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.text-3.12.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.text-3.12.1.dist-info/METADATA,sha256=AzWdm6ViMfDOPoQMfLWn2zgBQSGJScyqeN29TcuWXVI,3658
+jaraco.text-3.12.1.dist-info/RECORD,,
+jaraco.text-3.12.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+jaraco.text-3.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+jaraco.text-3.12.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
+jaraco/text/__init__.py,sha256=Y2YUqXR_orUoDaY4SkPRe6ZZhb5HUHB_Ah9RCNsVyho,16250
+jaraco/text/__pycache__/__init__.cpython-312.pyc,,
+jaraco/text/__pycache__/layouts.cpython-312.pyc,,
+jaraco/text/__pycache__/show-newlines.cpython-312.pyc,,
+jaraco/text/__pycache__/strip-prefix.cpython-312.pyc,,
+jaraco/text/__pycache__/to-dvorak.cpython-312.pyc,,
+jaraco/text/__pycache__/to-qwerty.cpython-312.pyc,,
+jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643
+jaraco/text/show-newlines.py,sha256=WGQa65e8lyhb92LUOLqVn6KaCtoeVgVws6WtSRmLk6w,904
+jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412
+jaraco/text/to-dvorak.py,sha256=1SNcbSsvISpXXg-LnybIHHY-RUFOQr36zcHkY1pWFqw,119
+jaraco/text/to-qwerty.py,sha256=s4UMQUnPwFn_dB5uZC27BurHOQcYondBfzIpVL5pEzw,119
diff --git a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/REQUESTED b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED
similarity index 100%
rename from pkg_resources/_vendor/platformdirs-2.6.2.dist-info/REQUESTED
rename to pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
new file mode 100644
index 0000000000..bab98d6758
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/top_level.txt b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
similarity index 100%
rename from pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/top_level.txt
rename to pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
diff --git a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/METADATA b/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/METADATA
deleted file mode 100644
index 615a50a4ae..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/METADATA
+++ /dev/null
@@ -1,55 +0,0 @@
-Metadata-Version: 2.1
-Name: jaraco.text
-Version: 3.7.0
-Summary: Module for text manipulation
-Home-page: https://github.com/jaraco/jaraco.text
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
-License: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.6
-License-File: LICENSE
-Requires-Dist: jaraco.functools
-Requires-Dist: jaraco.context (>=4.1)
-Requires-Dist: importlib-resources ; python_version < "3.9"
-Provides-Extra: docs
-Requires-Dist: sphinx ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=8.2) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest (>=6) ; extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
-Requires-Dist: pytest-flake8 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler (>=1.0.1) ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/jaraco.text.svg
-   :target: `PyPI link`_
-
-.. image:: https://img.shields.io/pypi/pyversions/jaraco.text.svg
-   :target: `PyPI link`_
-
-.. _PyPI link: https://pypi.org/project/jaraco.text
-
-.. image:: https://github.com/jaraco/jaraco.text/workflows/tests/badge.svg
-   :target: https://github.com/jaraco/jaraco.text/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
-
-.. image:: https://readthedocs.org/projects/jaracotext/badge/?version=latest
-   :target: https://jaracotext.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2021-informational
-   :target: https://blog.jaraco.com/skeleton
-
-
diff --git a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/RECORD b/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/RECORD
deleted file mode 100644
index c698101cb4..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.7.0.dist-info/RECORD
+++ /dev/null
@@ -1,10 +0,0 @@
-jaraco.text-3.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-jaraco.text-3.7.0.dist-info/LICENSE,sha256=2z8CRrH5J48VhFuZ_sR4uLUG63ZIeZNyL4xuJUKF-vg,1050
-jaraco.text-3.7.0.dist-info/METADATA,sha256=5mcR1dY0cJNrM-VIkAFkpjOgvgzmq6nM1GfD0gwTIhs,2136
-jaraco.text-3.7.0.dist-info/RECORD,,
-jaraco.text-3.7.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-jaraco.text-3.7.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
-jaraco.text-3.7.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
-jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
-jaraco/text/__init__.py,sha256=I56MW2ZFwPrYXIxzqxMBe2A1t-T4uZBgEgAKe9-JoqM,15538
-jaraco/text/__pycache__/__init__.cpython-312.pyc,,
diff --git a/pkg_resources/_vendor/jaraco/context.py b/pkg_resources/_vendor/jaraco/context.py
index c42f6135d5..61b27135df 100644
--- a/pkg_resources/_vendor/jaraco/context.py
+++ b/pkg_resources/_vendor/jaraco/context.py
@@ -14,7 +14,7 @@
 
 
 if sys.version_info < (3, 12):
-    from pkg_resources.extern.backports import tarfile
+    from backports import tarfile
 else:
     import tarfile
 
diff --git a/pkg_resources/_vendor/jaraco/functools/__init__.py b/pkg_resources/_vendor/jaraco/functools/__init__.py
index f523099c72..ca6c22fa9b 100644
--- a/pkg_resources/_vendor/jaraco/functools/__init__.py
+++ b/pkg_resources/_vendor/jaraco/functools/__init__.py
@@ -7,7 +7,7 @@
 import types
 import warnings
 
-import pkg_resources.extern.more_itertools
+import more_itertools
 
 
 def compose(*funcs):
@@ -603,10 +603,10 @@ def splat(func):
     simple ``map``.
 
     >>> pairs = [(-1, 1), (0, 2)]
-    >>> pkg_resources.extern.more_itertools.consume(itertools.starmap(print, pairs))
+    >>> more_itertools.consume(itertools.starmap(print, pairs))
     -1 1
     0 2
-    >>> pkg_resources.extern.more_itertools.consume(map(splat(print), pairs))
+    >>> more_itertools.consume(map(splat(print), pairs))
     -1 1
     0 2
 
diff --git a/pkg_resources/_vendor/jaraco/functools/__init__.pyi b/pkg_resources/_vendor/jaraco/functools/__init__.pyi
index c2b9ab1757..19191bf93e 100644
--- a/pkg_resources/_vendor/jaraco/functools/__init__.pyi
+++ b/pkg_resources/_vendor/jaraco/functools/__init__.pyi
@@ -74,9 +74,6 @@ def result_invoke(
 def invoke(
     f: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs
 ) -> Callable[_P, _R]: ...
-def call_aside(
-    f: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs
-) -> Callable[_P, _R]: ...
 
 class Throttler(Generic[_R]):
     last_called: float
diff --git a/pkg_resources/_vendor/jaraco/text/__init__.py b/pkg_resources/_vendor/jaraco/text/__init__.py
index c466378ceb..0fabd0c3f0 100644
--- a/pkg_resources/_vendor/jaraco/text/__init__.py
+++ b/pkg_resources/_vendor/jaraco/text/__init__.py
@@ -6,10 +6,10 @@
 try:
     from importlib.resources import files  # type: ignore
 except ImportError:  # pragma: nocover
-    from pkg_resources.extern.importlib_resources import files  # type: ignore
+    from importlib_resources import files  # type: ignore
 
-from pkg_resources.extern.jaraco.functools import compose, method_cache
-from pkg_resources.extern.jaraco.context import ExceptionTrap
+from jaraco.functools import compose, method_cache
+from jaraco.context import ExceptionTrap
 
 
 def substitution(old, new):
@@ -66,7 +66,7 @@ class FoldedCase(str):
     >>> s in ["Hello World"]
     True
 
-    You may test for set inclusion, but candidate and elements
+    Allows testing for set inclusion, but candidate and elements
     must both be folded.
 
     >>> FoldedCase("Hello World") in {s}
@@ -92,37 +92,40 @@ class FoldedCase(str):
 
     >>> FoldedCase('hello') > FoldedCase('Hello')
     False
+
+    >>> FoldedCase('ß') == FoldedCase('ss')
+    True
     """
 
     def __lt__(self, other):
-        return self.lower() < other.lower()
+        return self.casefold() < other.casefold()
 
     def __gt__(self, other):
-        return self.lower() > other.lower()
+        return self.casefold() > other.casefold()
 
     def __eq__(self, other):
-        return self.lower() == other.lower()
+        return self.casefold() == other.casefold()
 
     def __ne__(self, other):
-        return self.lower() != other.lower()
+        return self.casefold() != other.casefold()
 
     def __hash__(self):
-        return hash(self.lower())
+        return hash(self.casefold())
 
     def __contains__(self, other):
-        return super().lower().__contains__(other.lower())
+        return super().casefold().__contains__(other.casefold())
 
     def in_(self, other):
         "Does self appear in other?"
         return self in FoldedCase(other)
 
-    # cache lower since it's likely to be called frequently.
+    # cache casefold since it's likely to be called frequently.
     @method_cache
-    def lower(self):
-        return super().lower()
+    def casefold(self):
+        return super().casefold()
 
     def index(self, sub):
-        return self.lower().index(sub.lower())
+        return self.casefold().index(sub.casefold())
 
     def split(self, splitter=' ', maxsplit=0):
         pattern = re.compile(re.escape(splitter), re.I)
@@ -224,9 +227,12 @@ def unwrap(s):
     return '\n'.join(cleaned)
 
 
+lorem_ipsum: str = (
+    files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
+)
 
 
-class Splitter(object):
+class Splitter:
     """object that will split a string with the given arguments for each call
 
     >>> s = Splitter(',')
@@ -276,7 +282,7 @@ class WordSet(tuple):
     >>> WordSet.parse("myABCClass")
     ('my', 'ABC', 'Class')
 
-    The result is a WordSet, so you can get the form you need.
+    The result is a WordSet, providing access to other forms.
 
     >>> WordSet.parse("myABCClass").underscore_separated()
     'my_ABC_Class'
@@ -363,7 +369,7 @@ def trim(self, item):
         return self.trim_left(item).trim_right(item)
 
     def __getitem__(self, item):
-        result = super(WordSet, self).__getitem__(item)
+        result = super().__getitem__(item)
         if isinstance(item, slice):
             result = WordSet(result)
         return result
@@ -578,7 +584,7 @@ def join_continuation(lines):
     ['foobarbaz']
 
     Not sure why, but...
-    The character preceeding the backslash is also elided.
+    The character preceding the backslash is also elided.
 
     >>> list(join_continuation(['goo\\', 'dly']))
     ['godly']
@@ -597,3 +603,22 @@ def join_continuation(lines):
             except StopIteration:
                 return
         yield item
+
+
+def read_newlines(filename, limit=1024):
+    r"""
+    >>> tmp_path = getfixture('tmp_path')
+    >>> filename = tmp_path / 'out.txt'
+    >>> _ = filename.write_text('foo\n', newline='', encoding='utf-8')
+    >>> read_newlines(filename)
+    '\n'
+    >>> _ = filename.write_text('foo\r\n', newline='', encoding='utf-8')
+    >>> read_newlines(filename)
+    '\r\n'
+    >>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='', encoding='utf-8')
+    >>> read_newlines(filename)
+    ('\r', '\n', '\r\n')
+    """
+    with open(filename, encoding='utf-8') as fp:
+        fp.read(limit)
+    return fp.newlines
diff --git a/pkg_resources/_vendor/jaraco/text/layouts.py b/pkg_resources/_vendor/jaraco/text/layouts.py
new file mode 100644
index 0000000000..9636f0f7b5
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco/text/layouts.py
@@ -0,0 +1,25 @@
+qwerty = "-=qwertyuiop[]asdfghjkl;'zxcvbnm,./_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"
+dvorak = "[]',.pyfgcrl/=aoeuidhtns-;qjkxbmwvz{}\"<>PYFGCRL?+AOEUIDHTNS_:QJKXBMWVZ"
+
+
+to_dvorak = str.maketrans(qwerty, dvorak)
+to_qwerty = str.maketrans(dvorak, qwerty)
+
+
+def translate(input, translation):
+    """
+    >>> translate('dvorak', to_dvorak)
+    'ekrpat'
+    >>> translate('qwerty', to_qwerty)
+    'x,dokt'
+    """
+    return input.translate(translation)
+
+
+def _translate_stream(stream, translation):
+    """
+    >>> import io
+    >>> _translate_stream(io.StringIO('foo'), to_dvorak)
+    urr
+    """
+    print(translate(stream.read(), translation))
diff --git a/pkg_resources/_vendor/jaraco/text/show-newlines.py b/pkg_resources/_vendor/jaraco/text/show-newlines.py
new file mode 100644
index 0000000000..e11d1ba428
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco/text/show-newlines.py
@@ -0,0 +1,33 @@
+import autocommand
+import inflect
+
+from more_itertools import always_iterable
+
+import jaraco.text
+
+
+def report_newlines(filename):
+    r"""
+    Report the newlines in the indicated file.
+
+    >>> tmp_path = getfixture('tmp_path')
+    >>> filename = tmp_path / 'out.txt'
+    >>> _ = filename.write_text('foo\nbar\n', newline='', encoding='utf-8')
+    >>> report_newlines(filename)
+    newline is '\n'
+    >>> filename = tmp_path / 'out.txt'
+    >>> _ = filename.write_text('foo\nbar\r\n', newline='', encoding='utf-8')
+    >>> report_newlines(filename)
+    newlines are ('\n', '\r\n')
+    """
+    newlines = jaraco.text.read_newlines(filename)
+    count = len(tuple(always_iterable(newlines)))
+    engine = inflect.engine()
+    print(
+        engine.plural_noun("newline", count),
+        engine.plural_verb("is", count),
+        repr(newlines),
+    )
+
+
+autocommand.autocommand(__name__)(report_newlines)
diff --git a/pkg_resources/_vendor/jaraco/text/strip-prefix.py b/pkg_resources/_vendor/jaraco/text/strip-prefix.py
new file mode 100644
index 0000000000..761717a9b9
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco/text/strip-prefix.py
@@ -0,0 +1,21 @@
+import sys
+
+import autocommand
+
+from jaraco.text import Stripper
+
+
+def strip_prefix():
+    r"""
+    Strip any common prefix from stdin.
+
+    >>> import io, pytest
+    >>> getfixture('monkeypatch').setattr('sys.stdin', io.StringIO('abcdef\nabc123'))
+    >>> strip_prefix()
+    def
+    123
+    """
+    sys.stdout.writelines(Stripper.strip_prefix(sys.stdin).lines)
+
+
+autocommand.autocommand(__name__)(strip_prefix)
diff --git a/pkg_resources/_vendor/jaraco/text/to-dvorak.py b/pkg_resources/_vendor/jaraco/text/to-dvorak.py
new file mode 100644
index 0000000000..a6d5da80b3
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco/text/to-dvorak.py
@@ -0,0 +1,6 @@
+import sys
+
+from . import layouts
+
+
+__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_dvorak)
diff --git a/pkg_resources/_vendor/jaraco/text/to-qwerty.py b/pkg_resources/_vendor/jaraco/text/to-qwerty.py
new file mode 100644
index 0000000000..abe2728662
--- /dev/null
+++ b/pkg_resources/_vendor/jaraco/text/to-qwerty.py
@@ -0,0 +1,6 @@
+import sys
+
+from . import layouts
+
+
+__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_qwerty)
diff --git a/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/RECORD b/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/RECORD
deleted file mode 100644
index 2ce6e4a6f5..0000000000
--- a/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/RECORD
+++ /dev/null
@@ -1,15 +0,0 @@
-more_itertools-10.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-more_itertools-10.2.0.dist-info/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053
-more_itertools-10.2.0.dist-info/METADATA,sha256=lTIPxfD4IiP6aHzPjP4dXmzRRUmiXicAB6qnY82T-Gs,34886
-more_itertools-10.2.0.dist-info/RECORD,,
-more_itertools-10.2.0.dist-info/WHEEL,sha256=rSgq_JpHF9fHR1lx53qwg_1-2LypZE_qmcuXbVUq948,81
-more_itertools/__init__.py,sha256=VodgFyRJvpnHbAMgseYRiP7r928FFOAakmQrl6J88os,149
-more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43
-more_itertools/__pycache__/__init__.cpython-312.pyc,,
-more_itertools/__pycache__/more.cpython-312.pyc,,
-more_itertools/__pycache__/recipes.cpython-312.pyc,,
-more_itertools/more.py,sha256=jYdpbgXHf8yZDByPrhluxpe0D_IXRk2tfQnyfOFMi74,143045
-more_itertools/more.pyi,sha256=KTHYeqr0rFbn1GWRnv0jY64JRNnKKT0kA3kmsah8DYQ,21044
-more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-more_itertools/recipes.py,sha256=Rb3OhzJTCn2biutDEUSImbuY-8NDS1lkHt0My-uCOf4,27548
-more_itertools/recipes.pyi,sha256=T1IuEVXCqw2NeJJNW036MtWi8BVfR8Ilpf7cBmvhBaQ,4436
diff --git a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/INSTALLER b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/platformdirs-2.6.2.dist-info/INSTALLER
rename to pkg_resources/_vendor/more_itertools-10.3.0.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/LICENSE b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/LICENSE
similarity index 100%
rename from pkg_resources/_vendor/more_itertools-10.2.0.dist-info/LICENSE
rename to pkg_resources/_vendor/more_itertools-10.3.0.dist-info/LICENSE
diff --git a/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/METADATA b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/METADATA
similarity index 95%
rename from pkg_resources/_vendor/more_itertools-10.2.0.dist-info/METADATA
rename to pkg_resources/_vendor/more_itertools-10.3.0.dist-info/METADATA
index f54f1ff279..fb41b0cfe6 100644
--- a/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/METADATA
+++ b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/METADATA
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: more-itertools
-Version: 10.2.0
+Version: 10.3.0
 Summary: More routines for operating on iterables, beyond itertools
 Keywords: itertools,iterator,iteration,filter,peek,peekable,chunk,chunked
 Author-email: Erik Rose 
@@ -87,8 +87,6 @@ Python iterables.
 |                        | `zip_offset `_,                                                                         |
 |                        | `zip_equal `_,                                                                           |
 |                        | `zip_broadcast `_,                                                                   |
-|                        | `dotproduct `_,                                                                         |
-|                        | `convolve `_,                                                                             |
 |                        | `flatten `_,                                                                               |
 |                        | `roundrobin `_,                                                                         |
 |                        | `prepend `_,                                                                               |
@@ -101,6 +99,7 @@ Python iterables.
 |                        | `consecutive_groups `_,                                                         |
 |                        | `run_length `_,                                                                         |
 |                        | `map_reduce `_,                                                                         |
+|                        | `join_mappings `_,                                                                   |
 |                        | `exactly_n `_,                                                                           |
 |                        | `is_sorted `_,                                                                           |
 |                        | `all_equal `_,                                                                           |
@@ -131,12 +130,26 @@ Python iterables.
 |                        | `tail `_,                                                                                     |
 |                        | `unique_everseen `_,                                                               |
 |                        | `unique_justseen `_,                                                               |
+|                        | `unique `_,                                                                                 |
 |                        | `duplicates_everseen `_,                                                       |
 |                        | `duplicates_justseen `_,                                                       |
 |                        | `classify_unique `_,                                                               |
 |                        | `longest_common_prefix `_,                                                   |
 |                        | `takewhile_inclusive `_                                                        |
 +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Math                   | `dft `_,                                                                                       |
+|                        | `idft `_,                                                                                     |
+|                        | `convolve `_,                                                                             |
+|                        | `dotproduct `_,                                                                         |
+|                        | `factor `_,                                                                                 |
+|                        | `matmul `_,                                                                                 |
+|                        | `polynomial_from_roots `_,                                                   |
+|                        | `polynomial_derivative `_,                                                   |
+|                        | `polynomial_eval `_,                                                               |
+|                        | `sieve `_,                                                                                   |
+|                        | `sum_of_squares `_,                                                                 |
+|                        | `totient `_                                                                                |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | Combinatorics          | `distinct_permutations `_,                                                   |
 |                        | `distinct_combinations `_,                                                   |
 |                        | `circular_shifts `_,                                                               |
@@ -149,6 +162,7 @@ Python iterables.
 |                        | `gray_product  `_,                                                                    |
 |                        | `outer_product  `_,                                                                  |
 |                        | `powerset `_,                                                                             |
+|                        | `powerset_of_sets `_,                                                             |
 |                        | `random_product `_,                                                                 |
 |                        | `random_permutation `_,                                                         |
 |                        | `random_combination `_,                                                         |
@@ -180,15 +194,8 @@ Python iterables.
 |                        | `consume `_,                                                                               |
 |                        | `tabulate `_,                                                                             |
 |                        | `repeatfunc `_,                                                                         |
-|                        | `polynomial_from_roots `_,                                                   |
-|                        | `polynomial_eval `_,                                                               |
-|                        | `polynomial_derivative `_,                                                   |
-|                        | `sieve `_,                                                                                   |
-|                        | `factor `_,                                                                                 |
-|                        | `matmul `_,                                                                                 |
-|                        | `sum_of_squares `_,                                                                 |
-|                        | `totient `_,                                                                               |
 |                        | `reshape `_                                                                                |
+|                        | `doublestarmap `_                                                                    |
 +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
 
diff --git a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD
new file mode 100644
index 0000000000..53183bfb30
--- /dev/null
+++ b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD
@@ -0,0 +1,15 @@
+more_itertools-10.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+more_itertools-10.3.0.dist-info/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053
+more_itertools-10.3.0.dist-info/METADATA,sha256=BFO90O-fLNiVQMpj7oIS5ztzgJUUQZ3TA32P5HH3N-A,36293
+more_itertools-10.3.0.dist-info/RECORD,,
+more_itertools-10.3.0.dist-info/WHEEL,sha256=rSgq_JpHF9fHR1lx53qwg_1-2LypZE_qmcuXbVUq948,81
+more_itertools/__init__.py,sha256=dtAbGjTDmn_ghiU5YXfhyDy0phAlXVdt5klZA5fUa-Q,149
+more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43
+more_itertools/__pycache__/__init__.cpython-312.pyc,,
+more_itertools/__pycache__/more.cpython-312.pyc,,
+more_itertools/__pycache__/recipes.cpython-312.pyc,,
+more_itertools/more.py,sha256=1E5kzFncRKTDw0cYv1yRXMgDdunstLQd1QStcnL6U90,148370
+more_itertools/more.pyi,sha256=iXXeqt48Nxe8VGmIWpkVXuKpR2FYNuu2DU8nQLWCCu0,21484
+more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+more_itertools/recipes.py,sha256=WedhhfhGVgr6zii8fIbGJVmRTw0ZKRiLKnYBDGJv4nY,28591
+more_itertools/recipes.pyi,sha256=T_mdGpcFdfrP3JSWbwzYP9JyNV-Go-7RPfpxfftAWlA,4617
diff --git a/pkg_resources/_vendor/more_itertools-10.2.0.dist-info/WHEEL b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/WHEEL
similarity index 100%
rename from pkg_resources/_vendor/more_itertools-10.2.0.dist-info/WHEEL
rename to pkg_resources/_vendor/more_itertools-10.3.0.dist-info/WHEEL
diff --git a/pkg_resources/_vendor/more_itertools/__init__.py b/pkg_resources/_vendor/more_itertools/__init__.py
index aff94a9abd..9c4662fc31 100644
--- a/pkg_resources/_vendor/more_itertools/__init__.py
+++ b/pkg_resources/_vendor/more_itertools/__init__.py
@@ -3,4 +3,4 @@
 from .more import *  # noqa
 from .recipes import *  # noqa
 
-__version__ = '10.2.0'
+__version__ = '10.3.0'
diff --git a/pkg_resources/_vendor/more_itertools/more.py b/pkg_resources/_vendor/more_itertools/more.py
index d0957681f5..7b481907da 100755
--- a/pkg_resources/_vendor/more_itertools/more.py
+++ b/pkg_resources/_vendor/more_itertools/more.py
@@ -1,3 +1,4 @@
+import math
 import warnings
 
 from collections import Counter, defaultdict, deque, abc
@@ -6,6 +7,7 @@
 from heapq import heapify, heapreplace, heappop
 from itertools import (
     chain,
+    combinations,
     compress,
     count,
     cycle,
@@ -19,7 +21,7 @@
     zip_longest,
     product,
 )
-from math import exp, factorial, floor, log, perm, comb
+from math import comb, e, exp, factorial, floor, fsum, log, perm, tau
 from queue import Empty, Queue
 from random import random, randrange, uniform
 from operator import itemgetter, mul, sub, gt, lt, ge, le
@@ -61,11 +63,13 @@
     'consumer',
     'count_cycle',
     'countable',
+    'dft',
     'difference',
     'distinct_combinations',
     'distinct_permutations',
     'distribute',
     'divide',
+    'doublestarmap',
     'duplicates_everseen',
     'duplicates_justseen',
     'classify_unique',
@@ -77,6 +81,7 @@
     'groupby_transform',
     'ichunked',
     'iequals',
+    'idft',
     'ilen',
     'interleave',
     'interleave_evenly',
@@ -86,6 +91,7 @@
     'islice_extended',
     'iterate',
     'iter_suppress',
+    'join_mappings',
     'last',
     'locate',
     'longest_common_prefix',
@@ -109,6 +115,7 @@
     'partitions',
     'peekable',
     'permutation_index',
+    'powerset_of_sets',
     'product_index',
     'raise_',
     'repeat_each',
@@ -148,6 +155,9 @@
     'zip_offset',
 ]
 
+# math.sumprod is available for Python 3.12+
+_fsumprod = getattr(math, 'sumprod', lambda x, y: fsum(map(mul, x, y)))
+
 
 def chunked(iterable, n, strict=False):
     """Break *iterable* into lists of length *n*:
@@ -550,10 +560,10 @@ def one(iterable, too_short=None, too_long=None):
 
     try:
         first_value = next(it)
-    except StopIteration as e:
+    except StopIteration as exc:
         raise (
             too_short or ValueError('too few items in iterable (expected 1)')
-        ) from e
+        ) from exc
 
     try:
         second_value = next(it)
@@ -840,26 +850,31 @@ def windowed(seq, n, fillvalue=None, step=1):
     if n < 0:
         raise ValueError('n must be >= 0')
     if n == 0:
-        yield tuple()
+        yield ()
         return
     if step < 1:
         raise ValueError('step must be >= 1')
 
-    window = deque(maxlen=n)
-    i = n
-    for _ in map(window.append, seq):
-        i -= 1
-        if not i:
-            i = step
-            yield tuple(window)
-
-    size = len(window)
-    if size == 0:
+    iterable = iter(seq)
+
+    # Generate first window
+    window = deque(islice(iterable, n), maxlen=n)
+
+    # Deal with the first window not being full
+    if not window:
+        return
+    if len(window) < n:
+        yield tuple(window) + ((fillvalue,) * (n - len(window)))
         return
-    elif size < n:
-        yield tuple(chain(window, repeat(fillvalue, n - size)))
-    elif 0 < i < min(step, n):
-        window += (fillvalue,) * i
+    yield tuple(window)
+
+    # Create the filler for the next windows. The padding ensures
+    # we have just enough elements to fill the last window.
+    padding = (fillvalue,) * (n - 1 if step >= n else step - 1)
+    filler = map(window.append, chain(iterable, padding))
+
+    # Generate the rest of the windows
+    for _ in islice(filler, step - 1, None, step):
         yield tuple(window)
 
 
@@ -1151,8 +1166,8 @@ def interleave_evenly(iterables, lengths=None):
 
         # those iterables for which the error is negative are yielded
         # ("diagonal step" in Bresenham)
-        for i, e in enumerate(errors):
-            if e < 0:
+        for i, e_ in enumerate(errors):
+            if e_ < 0:
                 yield next(iters_secondary[i])
                 to_yield -= 1
                 errors[i] += delta_primary
@@ -1184,26 +1199,38 @@ def collapse(iterable, base_type=None, levels=None):
     ['a', ['b'], 'c', ['d']]
 
     """
+    stack = deque()
+    # Add our first node group, treat the iterable as a single node
+    stack.appendleft((0, repeat(iterable, 1)))
 
-    def walk(node, level):
-        if (
-            ((levels is not None) and (level > levels))
-            or isinstance(node, (str, bytes))
-            or ((base_type is not None) and isinstance(node, base_type))
-        ):
-            yield node
-            return
+    while stack:
+        node_group = stack.popleft()
+        level, nodes = node_group
 
-        try:
-            tree = iter(node)
-        except TypeError:
-            yield node
-            return
-        else:
-            for child in tree:
-                yield from walk(child, level + 1)
+        # Check if beyond max level
+        if levels is not None and level > levels:
+            yield from nodes
+            continue
 
-    yield from walk(iterable, 0)
+        for node in nodes:
+            # Check if done iterating
+            if isinstance(node, (str, bytes)) or (
+                (base_type is not None) and isinstance(node, base_type)
+            ):
+                yield node
+            # Otherwise try to create child nodes
+            else:
+                try:
+                    tree = iter(node)
+                except TypeError:
+                    yield node
+                else:
+                    # Save our current location
+                    stack.appendleft(node_group)
+                    # Append the new child node
+                    stack.appendleft((level + 1, tree))
+                    # Break to process child node
+                    break
 
 
 def side_effect(func, iterable, chunk_size=None, before=None, after=None):
@@ -1516,28 +1543,41 @@ def padded(iterable, fillvalue=None, n=None, next_multiple=False):
         [1, 2, 3, '?', '?']
 
     If *next_multiple* is ``True``, *fillvalue* will be emitted until the
-    number of items emitted is a multiple of *n*::
+    number of items emitted is a multiple of *n*:
 
         >>> list(padded([1, 2, 3, 4], n=3, next_multiple=True))
         [1, 2, 3, 4, None, None]
 
     If *n* is ``None``, *fillvalue* will be emitted indefinitely.
 
+    To create an *iterable* of exactly size *n*, you can truncate with
+    :func:`islice`.
+
+        >>> list(islice(padded([1, 2, 3], '?'), 5))
+        [1, 2, 3, '?', '?']
+        >>> list(islice(padded([1, 2, 3, 4, 5, 6, 7, 8], '?'), 5))
+        [1, 2, 3, 4, 5]
+
     """
-    it = iter(iterable)
+    iterable = iter(iterable)
+    iterable_with_repeat = chain(iterable, repeat(fillvalue))
+
     if n is None:
-        yield from chain(it, repeat(fillvalue))
+        return iterable_with_repeat
     elif n < 1:
         raise ValueError('n must be at least 1')
-    else:
-        item_count = 0
-        for item in it:
-            yield item
-            item_count += 1
+    elif next_multiple:
 
-        remaining = (n - item_count) % n if next_multiple else n - item_count
-        for _ in range(remaining):
-            yield fillvalue
+        def slice_generator():
+            for first in iterable:
+                yield (first,)
+                yield islice(iterable_with_repeat, n - 1)
+
+        # While elements exist produce slices of size n
+        return chain.from_iterable(slice_generator())
+    else:
+        # Ensure the first batch is at least size n then iterate
+        return chain(islice(iterable_with_repeat, n), iterable)
 
 
 def repeat_each(iterable, n=2):
@@ -1592,7 +1632,9 @@ def distribute(n, iterable):
         [[1], [2], [3], [], []]
 
     This function uses :func:`itertools.tee` and may require significant
-    storage. If you need the order items in the smaller iterables to match the
+    storage.
+
+    If you need the order items in the smaller iterables to match the
     original iterable, see :func:`divide`.
 
     """
@@ -1840,9 +1882,9 @@ def divide(n, iterable):
         >>> [list(c) for c in children]
         [[1], [2], [3], [], []]
 
-    This function will exhaust the iterable before returning and may require
-    significant storage. If order is not important, see :func:`distribute`,
-    which does not first pull the iterable into memory.
+    This function will exhaust the iterable before returning.
+    If order is not important, see :func:`distribute`, which does not first
+    pull the iterable into memory.
 
     """
     if n < 1:
@@ -3296,25 +3338,38 @@ def only(iterable, default=None, too_long=None):
     return first_value
 
 
-class _IChunk:
-    def __init__(self, iterable, n):
-        self._it = islice(iterable, n)
-        self._cache = deque()
+def _ichunk(iterable, n):
+    cache = deque()
+    chunk = islice(iterable, n)
+
+    def generator():
+        while True:
+            if cache:
+                yield cache.popleft()
+            else:
+                try:
+                    item = next(chunk)
+                except StopIteration:
+                    return
+                else:
+                    yield item
 
-    def fill_cache(self):
-        self._cache.extend(self._it)
+    def materialize_next(n=1):
+        # if n not specified materialize everything
+        if n is None:
+            cache.extend(chunk)
+            return len(cache)
 
-    def __iter__(self):
-        return self
+        to_cache = n - len(cache)
 
-    def __next__(self):
-        try:
-            return next(self._it)
-        except StopIteration:
-            if self._cache:
-                return self._cache.popleft()
-            else:
-                raise
+        # materialize up to n
+        if to_cache > 0:
+            cache.extend(islice(chunk, to_cache))
+
+        # return number materialized up to n
+        return min(n, len(cache))
+
+    return (generator(), materialize_next)
 
 
 def ichunked(iterable, n):
@@ -3338,19 +3393,19 @@ def ichunked(iterable, n):
     [8, 9, 10, 11]
 
     """
-    source = peekable(iter(iterable))
-    ichunk_marker = object()
+    iterable = iter(iterable)
     while True:
+        # Create new chunk
+        chunk, materialize_next = _ichunk(iterable, n)
+
         # Check to see whether we're at the end of the source iterable
-        item = source.peek(ichunk_marker)
-        if item is ichunk_marker:
+        if not materialize_next():
             return
 
-        chunk = _IChunk(source, n)
         yield chunk
 
-        # Advance the source iterable and fill previous chunk's cache
-        chunk.fill_cache()
+        # Fill previous chunk's cache
+        materialize_next(None)
 
 
 def iequals(*iterables):
@@ -3666,7 +3721,8 @@ def __init__(self, func, callback_kwd='callback', wait_seconds=0.1):
         self._wait_seconds = wait_seconds
         # Lazily import concurrent.future
         self._executor = __import__(
-        ).futures.__import__("concurrent.futures").futures.ThreadPoolExecutor(max_workers=1)
+            'concurrent.futures'
+        ).futures.ThreadPoolExecutor(max_workers=1)
         self._iterator = self._reader()
 
     def __enter__(self):
@@ -3863,6 +3919,7 @@ def nth_permutation(iterable, r, index):
         raise ValueError
     else:
         c = perm(n, r)
+    assert c > 0  # factortial(n)>0, and r>> list(value_chain('12', '34', ['56', '78']))
         ['12', '34', '56', '78']
 
+    Pre- or postpend a single element to an iterable:
+
+        >>> list(value_chain(1, [2, 3, 4, 5, 6]))
+        [1, 2, 3, 4, 5, 6]
+        >>> list(value_chain([1, 2, 3, 4, 5], 6))
+        [1, 2, 3, 4, 5, 6]
 
     Multiple levels of nesting are not flattened.
 
@@ -4153,53 +4213,41 @@ def chunked_even(iterable, n):
     [[1, 2, 3], [4, 5, 6], [7]]
 
     """
+    iterable = iter(iterable)
 
-    len_method = getattr(iterable, '__len__', None)
-
-    if len_method is None:
-        return _chunked_even_online(iterable, n)
-    else:
-        return _chunked_even_finite(iterable, len_method(), n)
-
-
-def _chunked_even_online(iterable, n):
-    buffer = []
-    maxbuf = n + (n - 2) * (n - 1)
-    for x in iterable:
-        buffer.append(x)
-        if len(buffer) == maxbuf:
-            yield buffer[:n]
-            buffer = buffer[n:]
-    yield from _chunked_even_finite(buffer, len(buffer), n)
+    # Initialize a buffer to process the chunks while keeping
+    # some back to fill any underfilled chunks
+    min_buffer = (n - 1) * (n - 2)
+    buffer = list(islice(iterable, min_buffer))
 
+    # Append items until we have a completed chunk
+    for _ in islice(map(buffer.append, iterable), n, None, n):
+        yield buffer[:n]
+        del buffer[:n]
 
-def _chunked_even_finite(iterable, N, n):
-    if N < 1:
+    # Check if any chunks need addition processing
+    if not buffer:
         return
+    length = len(buffer)
 
-    # Lists are either size `full_size <= n` or `partial_size = full_size - 1`
-    q, r = divmod(N, n)
+    # Chunks are either size `full_size <= n` or `partial_size = full_size - 1`
+    q, r = divmod(length, n)
     num_lists = q + (1 if r > 0 else 0)
-    q, r = divmod(N, num_lists)
+    q, r = divmod(length, num_lists)
     full_size = q + (1 if r > 0 else 0)
     partial_size = full_size - 1
-    num_full = N - partial_size * num_lists
-    num_partial = num_lists - num_full
+    num_full = length - partial_size * num_lists
 
-    # Yield num_full lists of full_size
+    # Yield chunks of full size
     partial_start_idx = num_full * full_size
     if full_size > 0:
         for i in range(0, partial_start_idx, full_size):
-            yield list(islice(iterable, i, i + full_size))
+            yield buffer[i : i + full_size]
 
-    # Yield num_partial lists of partial_size
+    # Yield chunks of partial size
     if partial_size > 0:
-        for i in range(
-            partial_start_idx,
-            partial_start_idx + (num_partial * partial_size),
-            partial_size,
-        ):
-            yield list(islice(iterable, i, i + partial_size))
+        for i in range(partial_start_idx, length, partial_size):
+            yield buffer[i : i + partial_size]
 
 
 def zip_broadcast(*objects, scalar_types=(str, bytes), strict=False):
@@ -4418,12 +4466,12 @@ def minmax(iterable_or_value, *others, key=None, default=_marker):
 
     try:
         lo = hi = next(it)
-    except StopIteration as e:
+    except StopIteration as exc:
         if default is _marker:
             raise ValueError(
                 '`minmax()` argument is an empty iterable. '
                 'Provide a `default` value to suppress this error.'
-            ) from e
+            ) from exc
         return default
 
     # Different branches depending on the presence of key. This saves a lot
@@ -4653,3 +4701,106 @@ def filter_map(func, iterable):
         y = func(x)
         if y is not None:
             yield y
+
+
+def powerset_of_sets(iterable):
+    """Yields all possible subsets of the iterable.
+
+        >>> list(powerset_of_sets([1, 2, 3]))  # doctest: +SKIP
+        [set(), {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}]
+        >>> list(powerset_of_sets([1, 1, 0]))  # doctest: +SKIP
+        [set(), {1}, {0}, {0, 1}]
+
+    :func:`powerset_of_sets` takes care to minimize the number
+    of hash operations performed.
+    """
+    sets = tuple(map(set, dict.fromkeys(map(frozenset, zip(iterable)))))
+    for r in range(len(sets) + 1):
+        yield from starmap(set().union, combinations(sets, r))
+
+
+def join_mappings(**field_to_map):
+    """
+    Joins multiple mappings together using their common keys.
+
+    >>> user_scores = {'elliot': 50, 'claris': 60}
+    >>> user_times = {'elliot': 30, 'claris': 40}
+    >>> join_mappings(score=user_scores, time=user_times)
+    {'elliot': {'score': 50, 'time': 30}, 'claris': {'score': 60, 'time': 40}}
+    """
+    ret = defaultdict(dict)
+
+    for field_name, mapping in field_to_map.items():
+        for key, value in mapping.items():
+            ret[key][field_name] = value
+
+    return dict(ret)
+
+
+def _complex_sumprod(v1, v2):
+    """High precision sumprod() for complex numbers.
+    Used by :func:`dft` and :func:`idft`.
+    """
+
+    r1 = chain((p.real for p in v1), (-p.imag for p in v1))
+    r2 = chain((q.real for q in v2), (q.imag for q in v2))
+    i1 = chain((p.real for p in v1), (p.imag for p in v1))
+    i2 = chain((q.imag for q in v2), (q.real for q in v2))
+    return complex(_fsumprod(r1, r2), _fsumprod(i1, i2))
+
+
+def dft(xarr):
+    """Discrete Fourier Tranform. *xarr* is a sequence of complex numbers.
+    Yields the components of the corresponding transformed output vector.
+
+    >>> import cmath
+    >>> xarr = [1, 2-1j, -1j, -1+2j]
+    >>> Xarr = [2, -2-2j, -2j, 4+4j]
+    >>> all(map(cmath.isclose, dft(xarr), Xarr))
+    True
+
+    See :func:`idft` for the inverse Discrete Fourier Transform.
+    """
+    N = len(xarr)
+    roots_of_unity = [e ** (n / N * tau * -1j) for n in range(N)]
+    for k in range(N):
+        coeffs = [roots_of_unity[k * n % N] for n in range(N)]
+        yield _complex_sumprod(xarr, coeffs)
+
+
+def idft(Xarr):
+    """Inverse Discrete Fourier Tranform. *Xarr* is a sequence of
+    complex numbers. Yields the components of the corresponding
+    inverse-transformed output vector.
+
+    >>> import cmath
+    >>> xarr = [1, 2-1j, -1j, -1+2j]
+    >>> Xarr = [2, -2-2j, -2j, 4+4j]
+    >>> all(map(cmath.isclose, idft(Xarr), xarr))
+    True
+
+    See :func:`dft` for the Discrete Fourier Transform.
+    """
+    N = len(Xarr)
+    roots_of_unity = [e ** (n / N * tau * 1j) for n in range(N)]
+    for k in range(N):
+        coeffs = [roots_of_unity[k * n % N] for n in range(N)]
+        yield _complex_sumprod(Xarr, coeffs) / N
+
+
+def doublestarmap(func, iterable):
+    """Apply *func* to every item of *iterable* by dictionary unpacking
+    the item into *func*.
+
+    The difference between :func:`itertools.starmap` and :func:`doublestarmap`
+    parallels the distinction between ``func(*a)`` and ``func(**a)``.
+
+    >>> iterable = [{'a': 1, 'b': 2}, {'a': 40, 'b': 60}]
+    >>> list(doublestarmap(lambda a, b: a + b, iterable))
+    [3, 100]
+
+    ``TypeError`` will be raised if *func*'s signature doesn't match the
+    mapping contained in *iterable* or if *iterable* does not contain mappings.
+    """
+    for item in iterable:
+        yield func(**item)
diff --git a/pkg_resources/_vendor/more_itertools/more.pyi b/pkg_resources/_vendor/more_itertools/more.pyi
index 9a5fc911a3..e946023259 100644
--- a/pkg_resources/_vendor/more_itertools/more.pyi
+++ b/pkg_resources/_vendor/more_itertools/more.pyi
@@ -1,4 +1,5 @@
 """Stubs for more_itertools.more"""
+
 from __future__ import annotations
 
 from types import TracebackType
@@ -9,8 +10,10 @@ from typing import (
     ContextManager,
     Generic,
     Hashable,
+    Mapping,
     Iterable,
     Iterator,
+    Mapping,
     overload,
     Reversible,
     Sequence,
@@ -602,6 +605,7 @@ class countable(Generic[_T], Iterator[_T]):
     def __init__(self, iterable: Iterable[_T]) -> None: ...
     def __iter__(self) -> countable[_T]: ...
     def __next__(self) -> _T: ...
+    items_seen: int
 
 def chunked_even(iterable: Iterable[_T], n: int) -> Iterator[list[_T]]: ...
 def zip_broadcast(
@@ -693,3 +697,13 @@ def filter_map(
     func: Callable[[_T], _V | None],
     iterable: Iterable[_T],
 ) -> Iterator[_V]: ...
+def powerset_of_sets(iterable: Iterable[_T]) -> Iterator[set[_T]]: ...
+def join_mappings(
+    **field_to_map: Mapping[_T, _V]
+) -> dict[_T, dict[str, _V]]: ...
+def doublestarmap(
+    func: Callable[..., _T],
+    iterable: Iterable[Mapping[str, Any]],
+) -> Iterator[_T]: ...
+def dft(xarr: Sequence[complex]) -> Iterator[complex]: ...
+def idft(Xarr: Sequence[complex]) -> Iterator[complex]: ...
diff --git a/pkg_resources/_vendor/more_itertools/recipes.py b/pkg_resources/_vendor/more_itertools/recipes.py
index 145e3cb5bd..b32fa95533 100644
--- a/pkg_resources/_vendor/more_itertools/recipes.py
+++ b/pkg_resources/_vendor/more_itertools/recipes.py
@@ -7,6 +7,7 @@
 .. [1] http://docs.python.org/library/itertools.html#recipes
 
 """
+
 import math
 import operator
 
@@ -74,6 +75,7 @@
     'totient',
     'transpose',
     'triplewise',
+    'unique',
     'unique_everseen',
     'unique_justseen',
 ]
@@ -198,7 +200,7 @@ def nth(iterable, n, default=None):
     return next(islice(iterable, n, None), default)
 
 
-def all_equal(iterable):
+def all_equal(iterable, key=None):
     """
     Returns ``True`` if all the elements are equal to each other.
 
@@ -207,9 +209,16 @@ def all_equal(iterable):
         >>> all_equal('aaab')
         False
 
+    A function that accepts a single argument and returns a transformed version
+    of each input item can be specified with *key*:
+
+        >>> all_equal('AaaA', key=str.casefold)
+        True
+        >>> all_equal([1, 2, 3], key=lambda x: x < 10)
+        True
+
     """
-    g = groupby(iterable)
-    return next(g, True) and not next(g, False)
+    return len(list(islice(groupby(iterable, key), 2))) <= 1
 
 
 def quantify(iterable, pred=bool):
@@ -410,16 +419,11 @@ def roundrobin(*iterables):
     iterables is small).
 
     """
-    # Recipe credited to George Sakkis
-    pending = len(iterables)
-    nexts = cycle(iter(it).__next__ for it in iterables)
-    while pending:
-        try:
-            for next in nexts:
-                yield next()
-        except StopIteration:
-            pending -= 1
-            nexts = cycle(islice(nexts, pending))
+    # Algorithm credited to George Sakkis
+    iterators = map(iter, iterables)
+    for num_active in range(len(iterables), 0, -1):
+        iterators = cycle(islice(iterators, num_active))
+        yield from map(next, iterators)
 
 
 def partition(pred, iterable):
@@ -458,16 +462,14 @@ def powerset(iterable):
 
     :func:`powerset` will operate on iterables that aren't :class:`set`
     instances, so repeated elements in the input will produce repeated elements
-    in the output. Use :func:`unique_everseen` on the input to avoid generating
-    duplicates:
+    in the output.
 
         >>> seq = [1, 1, 0]
         >>> list(powerset(seq))
         [(), (1,), (1,), (0,), (1, 1), (1, 0), (1, 0), (1, 1, 0)]
-        >>> from more_itertools import unique_everseen
-        >>> list(powerset(unique_everseen(seq)))
-        [(), (1,), (0,), (1, 0)]
 
+    For a variant that efficiently yields actual :class:`set` instances, see
+    :func:`powerset_of_sets`.
     """
     s = list(iterable)
     return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
@@ -533,6 +535,25 @@ def unique_justseen(iterable, key=None):
     return map(next, map(operator.itemgetter(1), groupby(iterable, key)))
 
 
+def unique(iterable, key=None, reverse=False):
+    """Yields unique elements in sorted order.
+
+    >>> list(unique([[1, 2], [3, 4], [1, 2]]))
+    [[1, 2], [3, 4]]
+
+    *key* and *reverse* are passed to :func:`sorted`.
+
+    >>> list(unique('ABBcCAD', str.casefold))
+    ['A', 'B', 'c', 'D']
+    >>> list(unique('ABBcCAD', str.casefold, reverse=True))
+    ['D', 'c', 'B', 'A']
+
+    The elements in *iterable* need not be hashable, but they must be
+    comparable for sorting to work.
+    """
+    return unique_justseen(sorted(iterable, key=key, reverse=reverse), key=key)
+
+
 def iter_except(func, exception, first=None):
     """Yields results from a function repeatedly until an exception is raised.
 
@@ -827,8 +848,6 @@ def iter_index(iterable, value, start=0, stop=None):
     """Yield the index of each place in *iterable* that *value* occurs,
     beginning with index *start* and ending before index *stop*.
 
-    See :func:`locate` for a more general means of finding the indexes
-    associated with particular values.
 
     >>> list(iter_index('AABCADEAF', 'A'))
     [0, 1, 4, 7]
@@ -836,6 +855,19 @@ def iter_index(iterable, value, start=0, stop=None):
     [1, 4, 7]
     >>> list(iter_index('AABCADEAF', 'A', 1, 7))  # stop index is not inclusive
     [1, 4]
+
+    The behavior for non-scalar *values* matches the built-in Python types.
+
+    >>> list(iter_index('ABCDABCD', 'AB'))
+    [0, 4]
+    >>> list(iter_index([0, 1, 2, 3, 0, 1, 2, 3], [0, 1]))
+    []
+    >>> list(iter_index([[0, 1], [2, 3], [0, 1], [2, 3]], [0, 1]))
+    [0, 2]
+
+    See :func:`locate` for a more general means of finding the indexes
+    associated with particular values.
+
     """
     seq_index = getattr(iterable, 'index', None)
     if seq_index is None:
@@ -1006,7 +1038,9 @@ def totient(n):
     >>> totient(12)
     4
     """
-    for p in unique_justseen(factor(n)):
+    # The itertools docs use unique_justseen instead of set; see
+    # https://github.com/more-itertools/more-itertools/issues/823
+    for p in set(factor(n)):
         n = n // p * (p - 1)
 
     return n
diff --git a/pkg_resources/_vendor/more_itertools/recipes.pyi b/pkg_resources/_vendor/more_itertools/recipes.pyi
index ed4c19db49..739acec05f 100644
--- a/pkg_resources/_vendor/more_itertools/recipes.pyi
+++ b/pkg_resources/_vendor/more_itertools/recipes.pyi
@@ -1,4 +1,5 @@
 """Stubs for more_itertools.recipes"""
+
 from __future__ import annotations
 
 from typing import (
@@ -28,7 +29,9 @@ def consume(iterator: Iterable[_T], n: int | None = ...) -> None: ...
 def nth(iterable: Iterable[_T], n: int) -> _T | None: ...
 @overload
 def nth(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ...
-def all_equal(iterable: Iterable[_T]) -> bool: ...
+def all_equal(
+    iterable: Iterable[_T], key: Callable[[_T], _U] | None = ...
+) -> bool: ...
 def quantify(
     iterable: Iterable[_T], pred: Callable[[_T], bool] = ...
 ) -> int: ...
@@ -58,6 +61,11 @@ def unique_everseen(
 def unique_justseen(
     iterable: Iterable[_T], key: Callable[[_T], object] | None = ...
 ) -> Iterator[_T]: ...
+def unique(
+    iterable: Iterable[_T],
+    key: Callable[[_T], object] | None = ...,
+    reverse: bool = False,
+) -> Iterator[_T]: ...
 @overload
 def iter_except(
     func: Callable[[], _T],
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/RECORD b/pkg_resources/_vendor/packaging-24.0.dist-info/RECORD
deleted file mode 100644
index bcf796c2f4..0000000000
--- a/pkg_resources/_vendor/packaging-24.0.dist-info/RECORD
+++ /dev/null
@@ -1,37 +0,0 @@
-packaging-24.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-packaging-24.0.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197
-packaging-24.0.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
-packaging-24.0.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344
-packaging-24.0.dist-info/METADATA,sha256=0dESdhY_wHValuOrbgdebiEw04EbX4dkujlxPdEsFus,3203
-packaging-24.0.dist-info/RECORD,,
-packaging-24.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-packaging-24.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
-packaging/__init__.py,sha256=UzotcV07p8vcJzd80S-W0srhgY8NMVD_XvJcZ7JN-tA,496
-packaging/__pycache__/__init__.cpython-312.pyc,,
-packaging/__pycache__/_elffile.cpython-312.pyc,,
-packaging/__pycache__/_manylinux.cpython-312.pyc,,
-packaging/__pycache__/_musllinux.cpython-312.pyc,,
-packaging/__pycache__/_parser.cpython-312.pyc,,
-packaging/__pycache__/_structures.cpython-312.pyc,,
-packaging/__pycache__/_tokenizer.cpython-312.pyc,,
-packaging/__pycache__/markers.cpython-312.pyc,,
-packaging/__pycache__/metadata.cpython-312.pyc,,
-packaging/__pycache__/requirements.cpython-312.pyc,,
-packaging/__pycache__/specifiers.cpython-312.pyc,,
-packaging/__pycache__/tags.cpython-312.pyc,,
-packaging/__pycache__/utils.cpython-312.pyc,,
-packaging/__pycache__/version.cpython-312.pyc,,
-packaging/_elffile.py,sha256=hbmK8OD6Z7fY6hwinHEUcD1by7czkGiNYu7ShnFEk2k,3266
-packaging/_manylinux.py,sha256=1ng_TqyH49hY6s3W_zVHyoJIaogbJqbIF1jJ0fAehc4,9590
-packaging/_musllinux.py,sha256=kgmBGLFybpy8609-KTvzmt2zChCPWYvhp5BWP4JX7dE,2676
-packaging/_parser.py,sha256=zlsFB1FpMRjkUdQb6WLq7xON52ruQadxFpYsDXWhLb4,10347
-packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
-packaging/_tokenizer.py,sha256=alCtbwXhOFAmFGZ6BQ-wCTSFoRAJ2z-ysIf7__MTJ_k,5292
-packaging/markers.py,sha256=eH-txS2zq1HdNpTd9LcZUcVIwewAiNU0grmq5wjKnOk,8208
-packaging/metadata.py,sha256=w7jPEg6mDf1FTZMn79aFxFuk4SKtynUJtxr2InTxlV4,33036
-packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-packaging/requirements.py,sha256=dgoBeVprPu2YE6Q8nGfwOPTjATHbRa_ZGLyXhFEln6Q,2933
-packaging/specifiers.py,sha256=dB2DwbmvSbEuVilEyiIQ382YfW5JfwzXTfRRPVtaENY,39784
-packaging/tags.py,sha256=fedHXiOHkBxNZTXotXv8uXPmMFU9ae-TKBujgYHigcA,18950
-packaging/utils.py,sha256=XgdmP3yx9-wQEFjO7OvMj9RjEf5JlR5HFFR69v7SQ9E,5268
-packaging/version.py,sha256=XjRBLNK17UMDgLeP8UHnqwiY3TdSi03xFQURtec211A,16236
diff --git a/pkg_resources/_vendor/zipp-3.7.0.dist-info/INSTALLER b/pkg_resources/_vendor/packaging-24.1.dist-info/INSTALLER
similarity index 100%
rename from pkg_resources/_vendor/zipp-3.7.0.dist-info/INSTALLER
rename to pkg_resources/_vendor/packaging-24.1.dist-info/INSTALLER
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/LICENSE b/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE
similarity index 100%
rename from pkg_resources/_vendor/packaging-24.0.dist-info/LICENSE
rename to pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/LICENSE.APACHE b/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.APACHE
similarity index 100%
rename from pkg_resources/_vendor/packaging-24.0.dist-info/LICENSE.APACHE
rename to pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.APACHE
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/LICENSE.BSD b/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.BSD
similarity index 100%
rename from pkg_resources/_vendor/packaging-24.0.dist-info/LICENSE.BSD
rename to pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.BSD
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/METADATA b/pkg_resources/_vendor/packaging-24.1.dist-info/METADATA
similarity index 97%
rename from pkg_resources/_vendor/packaging-24.0.dist-info/METADATA
rename to pkg_resources/_vendor/packaging-24.1.dist-info/METADATA
index 10ab4390a9..255dc46e0e 100644
--- a/pkg_resources/_vendor/packaging-24.0.dist-info/METADATA
+++ b/pkg_resources/_vendor/packaging-24.1.dist-info/METADATA
@@ -1,9 +1,9 @@
 Metadata-Version: 2.1
 Name: packaging
-Version: 24.0
+Version: 24.1
 Summary: Core utilities for Python packages
 Author-email: Donald Stufft 
-Requires-Python: >=3.7
+Requires-Python: >=3.8
 Description-Content-Type: text/x-rst
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
@@ -12,12 +12,12 @@ Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: 3.11
 Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Typing :: Typed
diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/RECORD b/pkg_resources/_vendor/packaging-24.1.dist-info/RECORD
new file mode 100644
index 0000000000..2b1e6bd4db
--- /dev/null
+++ b/pkg_resources/_vendor/packaging-24.1.dist-info/RECORD
@@ -0,0 +1,37 @@
+packaging-24.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+packaging-24.1.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197
+packaging-24.1.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
+packaging-24.1.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344
+packaging-24.1.dist-info/METADATA,sha256=X3ooO3WnCfzNSBrqQjefCD1POAF1M2WSLmsHMgQlFdk,3204
+packaging-24.1.dist-info/RECORD,,
+packaging-24.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+packaging-24.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
+packaging/__init__.py,sha256=dtw2bNmWCQ9WnMoK3bk_elL1svSlikXtLpZhCFIB9SE,496
+packaging/__pycache__/__init__.cpython-312.pyc,,
+packaging/__pycache__/_elffile.cpython-312.pyc,,
+packaging/__pycache__/_manylinux.cpython-312.pyc,,
+packaging/__pycache__/_musllinux.cpython-312.pyc,,
+packaging/__pycache__/_parser.cpython-312.pyc,,
+packaging/__pycache__/_structures.cpython-312.pyc,,
+packaging/__pycache__/_tokenizer.cpython-312.pyc,,
+packaging/__pycache__/markers.cpython-312.pyc,,
+packaging/__pycache__/metadata.cpython-312.pyc,,
+packaging/__pycache__/requirements.cpython-312.pyc,,
+packaging/__pycache__/specifiers.cpython-312.pyc,,
+packaging/__pycache__/tags.cpython-312.pyc,,
+packaging/__pycache__/utils.cpython-312.pyc,,
+packaging/__pycache__/version.cpython-312.pyc,,
+packaging/_elffile.py,sha256=_LcJW4YNKywYsl4169B2ukKRqwxjxst_8H0FRVQKlz8,3282
+packaging/_manylinux.py,sha256=Xo4V0PZz8sbuVCbTni0t1CR0AHeir_7ib4lTmV8scD4,9586
+packaging/_musllinux.py,sha256=p9ZqNYiOItGee8KcZFeHF_YcdhVwGHdK6r-8lgixvGQ,2694
+packaging/_parser.py,sha256=s_TvTvDNK0NrM2QB3VKThdWFM4Nc0P6JnkObkl3MjpM,10236
+packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
+packaging/_tokenizer.py,sha256=J6v5H7Jzvb-g81xp_2QACKwO7LxHQA6ikryMU7zXwN8,5273
+packaging/markers.py,sha256=dWKSqn5Sp-jDmOG-W3GfLHKjwhf1IsznbT71VlBoB5M,10671
+packaging/metadata.py,sha256=KINuSkJ12u-SyoKNTy_pHNGAfMUtxNvZ53qA1zAKcKI,32349
+packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+packaging/requirements.py,sha256=gYyRSAdbrIyKDY66ugIDUQjRMvxkH2ALioTmX3tnL6o,2947
+packaging/specifiers.py,sha256=rjpc3hoJuunRIT6DdH7gLTnQ5j5QKSuWjoTC5sdHtHI,39714
+packaging/tags.py,sha256=y8EbheOu9WS7s-MebaXMcHMF-jzsA_C1Lz5XRTiSy4w,18883
+packaging/utils.py,sha256=NAdYUwnlAOpkat_RthavX8a07YuVxgGL_vwrx73GSDM,5287
+packaging/version.py,sha256=V0H3SOj_8werrvorrb6QDLRhlcqSErNTTkCvvfszhDI,16198
diff --git a/pkg_resources/_vendor/zipp-3.7.0.dist-info/REQUESTED b/pkg_resources/_vendor/packaging-24.1.dist-info/REQUESTED
similarity index 100%
rename from pkg_resources/_vendor/zipp-3.7.0.dist-info/REQUESTED
rename to pkg_resources/_vendor/packaging-24.1.dist-info/REQUESTED
diff --git a/pkg_resources/_vendor/packaging-24.0.dist-info/WHEEL b/pkg_resources/_vendor/packaging-24.1.dist-info/WHEEL
similarity index 100%
rename from pkg_resources/_vendor/packaging-24.0.dist-info/WHEEL
rename to pkg_resources/_vendor/packaging-24.1.dist-info/WHEEL
diff --git a/pkg_resources/_vendor/packaging/__init__.py b/pkg_resources/_vendor/packaging/__init__.py
index e7c0aa12ca..9ba41d8357 100644
--- a/pkg_resources/_vendor/packaging/__init__.py
+++ b/pkg_resources/_vendor/packaging/__init__.py
@@ -6,7 +6,7 @@
 __summary__ = "Core utilities for Python packages"
 __uri__ = "https://github.com/pypa/packaging"
 
-__version__ = "24.0"
+__version__ = "24.1"
 
 __author__ = "Donald Stufft and individual contributors"
 __email__ = "donald@stufft.io"
diff --git a/pkg_resources/_vendor/packaging/_elffile.py b/pkg_resources/_vendor/packaging/_elffile.py
index 6fb19b30bb..f7a02180bf 100644
--- a/pkg_resources/_vendor/packaging/_elffile.py
+++ b/pkg_resources/_vendor/packaging/_elffile.py
@@ -8,10 +8,12 @@
 ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
 """
 
+from __future__ import annotations
+
 import enum
 import os
 import struct
-from typing import IO, Optional, Tuple
+from typing import IO
 
 
 class ELFInvalid(ValueError):
@@ -87,11 +89,11 @@ def __init__(self, f: IO[bytes]) -> None:
         except struct.error as e:
             raise ELFInvalid("unable to parse machine and section information") from e
 
-    def _read(self, fmt: str) -> Tuple[int, ...]:
+    def _read(self, fmt: str) -> tuple[int, ...]:
         return struct.unpack(fmt, self._f.read(struct.calcsize(fmt)))
 
     @property
-    def interpreter(self) -> Optional[str]:
+    def interpreter(self) -> str | None:
         """
         The path recorded in the ``PT_INTERP`` section header.
         """
diff --git a/pkg_resources/_vendor/packaging/_manylinux.py b/pkg_resources/_vendor/packaging/_manylinux.py
index ad62505f3f..08f651fbd8 100644
--- a/pkg_resources/_vendor/packaging/_manylinux.py
+++ b/pkg_resources/_vendor/packaging/_manylinux.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 import collections
 import contextlib
 import functools
@@ -5,7 +7,7 @@
 import re
 import sys
 import warnings
-from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple
+from typing import Generator, Iterator, NamedTuple, Sequence
 
 from ._elffile import EIClass, EIData, ELFFile, EMachine
 
@@ -17,7 +19,7 @@
 # `os.PathLike` not a generic type until Python 3.9, so sticking with `str`
 # as the type for `path` until then.
 @contextlib.contextmanager
-def _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]:
+def _parse_elf(path: str) -> Generator[ELFFile | None, None, None]:
     try:
         with open(path, "rb") as f:
             yield ELFFile(f)
@@ -72,7 +74,7 @@ def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool:
 # For now, guess what the highest minor version might be, assume it will
 # be 50 for testing. Once this actually happens, update the dictionary
 # with the actual value.
-_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50)
+_LAST_GLIBC_MINOR: dict[int, int] = collections.defaultdict(lambda: 50)
 
 
 class _GLibCVersion(NamedTuple):
@@ -80,7 +82,7 @@ class _GLibCVersion(NamedTuple):
     minor: int
 
 
-def _glibc_version_string_confstr() -> Optional[str]:
+def _glibc_version_string_confstr() -> str | None:
     """
     Primary implementation of glibc_version_string using os.confstr.
     """
@@ -90,7 +92,7 @@ def _glibc_version_string_confstr() -> Optional[str]:
     # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183
     try:
         # Should be a string like "glibc 2.17".
-        version_string: Optional[str] = os.confstr("CS_GNU_LIBC_VERSION")
+        version_string: str | None = os.confstr("CS_GNU_LIBC_VERSION")
         assert version_string is not None
         _, version = version_string.rsplit()
     except (AssertionError, AttributeError, OSError, ValueError):
@@ -99,7 +101,7 @@ def _glibc_version_string_confstr() -> Optional[str]:
     return version
 
 
-def _glibc_version_string_ctypes() -> Optional[str]:
+def _glibc_version_string_ctypes() -> str | None:
     """
     Fallback implementation of glibc_version_string using ctypes.
     """
@@ -143,12 +145,12 @@ def _glibc_version_string_ctypes() -> Optional[str]:
     return version_str
 
 
-def _glibc_version_string() -> Optional[str]:
+def _glibc_version_string() -> str | None:
     """Returns glibc version string, or None if not using glibc."""
     return _glibc_version_string_confstr() or _glibc_version_string_ctypes()
 
 
-def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
+def _parse_glibc_version(version_str: str) -> tuple[int, int]:
     """Parse glibc version.
 
     We use a regexp instead of str.split because we want to discard any
@@ -167,8 +169,8 @@ def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
     return int(m.group("major")), int(m.group("minor"))
 
 
-@functools.lru_cache()
-def _get_glibc_version() -> Tuple[int, int]:
+@functools.lru_cache
+def _get_glibc_version() -> tuple[int, int]:
     version_str = _glibc_version_string()
     if version_str is None:
         return (-1, -1)
diff --git a/pkg_resources/_vendor/packaging/_musllinux.py b/pkg_resources/_vendor/packaging/_musllinux.py
index 86419df9d7..d2bf30b563 100644
--- a/pkg_resources/_vendor/packaging/_musllinux.py
+++ b/pkg_resources/_vendor/packaging/_musllinux.py
@@ -4,11 +4,13 @@
 linked against musl, and what musl version is used.
 """
 
+from __future__ import annotations
+
 import functools
 import re
 import subprocess
 import sys
-from typing import Iterator, NamedTuple, Optional, Sequence
+from typing import Iterator, NamedTuple, Sequence
 
 from ._elffile import ELFFile
 
@@ -18,7 +20,7 @@ class _MuslVersion(NamedTuple):
     minor: int
 
 
-def _parse_musl_version(output: str) -> Optional[_MuslVersion]:
+def _parse_musl_version(output: str) -> _MuslVersion | None:
     lines = [n for n in (n.strip() for n in output.splitlines()) if n]
     if len(lines) < 2 or lines[0][:4] != "musl":
         return None
@@ -28,8 +30,8 @@ def _parse_musl_version(output: str) -> Optional[_MuslVersion]:
     return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2)))
 
 
-@functools.lru_cache()
-def _get_musl_version(executable: str) -> Optional[_MuslVersion]:
+@functools.lru_cache
+def _get_musl_version(executable: str) -> _MuslVersion | None:
     """Detect currently-running musl runtime version.
 
     This is done by checking the specified executable's dynamic linking
diff --git a/pkg_resources/_vendor/packaging/_parser.py b/pkg_resources/_vendor/packaging/_parser.py
index 684df75457..c1238c06ea 100644
--- a/pkg_resources/_vendor/packaging/_parser.py
+++ b/pkg_resources/_vendor/packaging/_parser.py
@@ -1,11 +1,13 @@
 """Handwritten parser of dependency specifiers.
 
-The docstring for each __parse_* function contains ENBF-inspired grammar representing
+The docstring for each __parse_* function contains EBNF-inspired grammar representing
 the implementation.
 """
 
+from __future__ import annotations
+
 import ast
-from typing import Any, List, NamedTuple, Optional, Tuple, Union
+from typing import NamedTuple, Sequence, Tuple, Union
 
 from ._tokenizer import DEFAULT_RULES, Tokenizer
 
@@ -41,20 +43,16 @@ def serialize(self) -> str:
 
 MarkerVar = Union[Variable, Value]
 MarkerItem = Tuple[MarkerVar, Op, MarkerVar]
-# MarkerAtom = Union[MarkerItem, List["MarkerAtom"]]
-# MarkerList = List[Union["MarkerList", MarkerAtom, str]]
-# mypy does not support recursive type definition
-# https://github.com/python/mypy/issues/731
-MarkerAtom = Any
-MarkerList = List[Any]
+MarkerAtom = Union[MarkerItem, Sequence["MarkerAtom"]]
+MarkerList = Sequence[Union["MarkerList", MarkerAtom, str]]
 
 
 class ParsedRequirement(NamedTuple):
     name: str
     url: str
-    extras: List[str]
+    extras: list[str]
     specifier: str
-    marker: Optional[MarkerList]
+    marker: MarkerList | None
 
 
 # --------------------------------------------------------------------------------------
@@ -87,7 +85,7 @@ def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement:
 
 def _parse_requirement_details(
     tokenizer: Tokenizer,
-) -> Tuple[str, str, Optional[MarkerList]]:
+) -> tuple[str, str, MarkerList | None]:
     """
     requirement_details = AT URL (WS requirement_marker?)?
                         | specifier WS? (requirement_marker)?
@@ -156,7 +154,7 @@ def _parse_requirement_marker(
     return marker
 
 
-def _parse_extras(tokenizer: Tokenizer) -> List[str]:
+def _parse_extras(tokenizer: Tokenizer) -> list[str]:
     """
     extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)?
     """
@@ -175,11 +173,11 @@ def _parse_extras(tokenizer: Tokenizer) -> List[str]:
     return extras
 
 
-def _parse_extras_list(tokenizer: Tokenizer) -> List[str]:
+def _parse_extras_list(tokenizer: Tokenizer) -> list[str]:
     """
     extras_list = identifier (wsp* ',' wsp* identifier)*
     """
-    extras: List[str] = []
+    extras: list[str] = []
 
     if not tokenizer.check("IDENTIFIER"):
         return extras
diff --git a/pkg_resources/_vendor/packaging/_tokenizer.py b/pkg_resources/_vendor/packaging/_tokenizer.py
index dd0d648d49..89d041605c 100644
--- a/pkg_resources/_vendor/packaging/_tokenizer.py
+++ b/pkg_resources/_vendor/packaging/_tokenizer.py
@@ -1,7 +1,9 @@
+from __future__ import annotations
+
 import contextlib
 import re
 from dataclasses import dataclass
-from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union
+from typing import Iterator, NoReturn
 
 from .specifiers import Specifier
 
@@ -21,7 +23,7 @@ def __init__(
         message: str,
         *,
         source: str,
-        span: Tuple[int, int],
+        span: tuple[int, int],
     ) -> None:
         self.span = span
         self.message = message
@@ -34,7 +36,7 @@ def __str__(self) -> str:
         return "\n    ".join([self.message, self.source, marker])
 
 
-DEFAULT_RULES: "Dict[str, Union[str, re.Pattern[str]]]" = {
+DEFAULT_RULES: dict[str, str | re.Pattern[str]] = {
     "LEFT_PARENTHESIS": r"\(",
     "RIGHT_PARENTHESIS": r"\)",
     "LEFT_BRACKET": r"\[",
@@ -96,13 +98,13 @@ def __init__(
         self,
         source: str,
         *,
-        rules: "Dict[str, Union[str, re.Pattern[str]]]",
+        rules: dict[str, str | re.Pattern[str]],
     ) -> None:
         self.source = source
-        self.rules: Dict[str, re.Pattern[str]] = {
+        self.rules: dict[str, re.Pattern[str]] = {
             name: re.compile(pattern) for name, pattern in rules.items()
         }
-        self.next_token: Optional[Token] = None
+        self.next_token: Token | None = None
         self.position = 0
 
     def consume(self, name: str) -> None:
@@ -154,8 +156,8 @@ def raise_syntax_error(
         self,
         message: str,
         *,
-        span_start: Optional[int] = None,
-        span_end: Optional[int] = None,
+        span_start: int | None = None,
+        span_end: int | None = None,
     ) -> NoReturn:
         """Raise ParserSyntaxError at the given position."""
         span = (
diff --git a/pkg_resources/_vendor/packaging/markers.py b/pkg_resources/_vendor/packaging/markers.py
index 8b98fca723..7ac7bb69a5 100644
--- a/pkg_resources/_vendor/packaging/markers.py
+++ b/pkg_resources/_vendor/packaging/markers.py
@@ -2,20 +2,16 @@
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
 
+from __future__ import annotations
+
 import operator
 import os
 import platform
 import sys
-from typing import Any, Callable, Dict, List, Optional, Tuple, Union
-
-from ._parser import (
-    MarkerAtom,
-    MarkerList,
-    Op,
-    Value,
-    Variable,
-    parse_marker as _parse_marker,
-)
+from typing import Any, Callable, TypedDict, cast
+
+from ._parser import MarkerAtom, MarkerList, Op, Value, Variable
+from ._parser import parse_marker as _parse_marker
 from ._tokenizer import ParserSyntaxError
 from .specifiers import InvalidSpecifier, Specifier
 from .utils import canonicalize_name
@@ -50,6 +46,78 @@ class UndefinedEnvironmentName(ValueError):
     """
 
 
+class Environment(TypedDict):
+    implementation_name: str
+    """The implementation's identifier, e.g. ``'cpython'``."""
+
+    implementation_version: str
+    """
+    The implementation's version, e.g. ``'3.13.0a2'`` for CPython 3.13.0a2, or
+    ``'7.3.13'`` for PyPy3.10 v7.3.13.
+    """
+
+    os_name: str
+    """
+    The value of :py:data:`os.name`. The name of the operating system dependent module
+    imported, e.g. ``'posix'``.
+    """
+
+    platform_machine: str
+    """
+    Returns the machine type, e.g. ``'i386'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    platform_release: str
+    """
+    The system's release, e.g. ``'2.2.0'`` or ``'NT'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    platform_system: str
+    """
+    The system/OS name, e.g. ``'Linux'``, ``'Windows'`` or ``'Java'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    platform_version: str
+    """
+    The system's release version, e.g. ``'#3 on degas'``.
+
+    An empty string if the value cannot be determined.
+    """
+
+    python_full_version: str
+    """
+    The Python version as string ``'major.minor.patchlevel'``.
+
+    Note that unlike the Python :py:data:`sys.version`, this value will always include
+    the patchlevel (it defaults to 0).
+    """
+
+    platform_python_implementation: str
+    """
+    A string identifying the Python implementation, e.g. ``'CPython'``.
+    """
+
+    python_version: str
+    """The Python version as string ``'major.minor'``."""
+
+    sys_platform: str
+    """
+    This string contains a platform identifier that can be used to append
+    platform-specific components to :py:data:`sys.path`, for instance.
+
+    For Unix systems, except on Linux and AIX, this is the lowercased OS name as
+    returned by ``uname -s`` with the first part of the version as returned by
+    ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, at the time when Python
+    was built.
+    """
+
+
 def _normalize_extra_values(results: Any) -> Any:
     """
     Normalize extra values.
@@ -67,9 +135,8 @@ def _normalize_extra_values(results: Any) -> Any:
 
 
 def _format_marker(
-    marker: Union[List[str], MarkerAtom, str], first: Optional[bool] = True
+    marker: list[str] | MarkerAtom | str, first: bool | None = True
 ) -> str:
-
     assert isinstance(marker, (list, tuple, str))
 
     # Sometimes we have a structure like [[...]] which is a single item list
@@ -95,7 +162,7 @@ def _format_marker(
         return marker
 
 
-_operators: Dict[str, Operator] = {
+_operators: dict[str, Operator] = {
     "in": lambda lhs, rhs: lhs in rhs,
     "not in": lambda lhs, rhs: lhs not in rhs,
     "<": operator.lt,
@@ -115,14 +182,14 @@ def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
     else:
         return spec.contains(lhs, prereleases=True)
 
-    oper: Optional[Operator] = _operators.get(op.serialize())
+    oper: Operator | None = _operators.get(op.serialize())
     if oper is None:
         raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.")
 
     return oper(lhs, rhs)
 
 
-def _normalize(*values: str, key: str) -> Tuple[str, ...]:
+def _normalize(*values: str, key: str) -> tuple[str, ...]:
     # PEP 685 – Comparison of extra names for optional distribution dependencies
     # https://peps.python.org/pep-0685/
     # > When comparing extra names, tools MUST normalize the names being
@@ -134,8 +201,8 @@ def _normalize(*values: str, key: str) -> Tuple[str, ...]:
     return values
 
 
-def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool:
-    groups: List[List[bool]] = [[]]
+def _evaluate_markers(markers: MarkerList, environment: dict[str, str]) -> bool:
+    groups: list[list[bool]] = [[]]
 
     for marker in markers:
         assert isinstance(marker, (list, tuple, str))
@@ -164,7 +231,7 @@ def _evaluate_markers(markers: MarkerList, environment: Dict[str, str]) -> bool:
     return any(all(item) for item in groups)
 
 
-def format_full_version(info: "sys._version_info") -> str:
+def format_full_version(info: sys._version_info) -> str:
     version = "{0.major}.{0.minor}.{0.micro}".format(info)
     kind = info.releaselevel
     if kind != "final":
@@ -172,7 +239,7 @@ def format_full_version(info: "sys._version_info") -> str:
     return version
 
 
-def default_environment() -> Dict[str, str]:
+def default_environment() -> Environment:
     iver = format_full_version(sys.implementation.version)
     implementation_name = sys.implementation.name
     return {
@@ -231,7 +298,7 @@ def __eq__(self, other: Any) -> bool:
 
         return str(self) == str(other)
 
-    def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool:
+    def evaluate(self, environment: dict[str, str] | None = None) -> bool:
         """Evaluate a marker.
 
         Return the boolean from evaluating the given marker against the
@@ -240,8 +307,14 @@ def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool:
 
         The environment is determined from the current Python process.
         """
-        current_environment = default_environment()
+        current_environment = cast("dict[str, str]", default_environment())
         current_environment["extra"] = ""
+        # Work around platform.python_version() returning something that is not PEP 440
+        # compliant for non-tagged Python builds. We preserve default_environment()'s
+        # behavior of returning platform.python_version() verbatim, and leave it to the
+        # caller to provide a syntactically valid version if they want to override it.
+        if current_environment["python_full_version"].endswith("+"):
+            current_environment["python_full_version"] += "local"
         if environment is not None:
             current_environment.update(environment)
             # The API used to allow setting extra to None. We need to handle this
diff --git a/pkg_resources/_vendor/packaging/metadata.py b/pkg_resources/_vendor/packaging/metadata.py
index fb27493079..eb8dc844d2 100644
--- a/pkg_resources/_vendor/packaging/metadata.py
+++ b/pkg_resources/_vendor/packaging/metadata.py
@@ -1,50 +1,31 @@
+from __future__ import annotations
+
 import email.feedparser
 import email.header
 import email.message
 import email.parser
 import email.policy
-import sys
 import typing
 from typing import (
     Any,
     Callable,
-    Dict,
     Generic,
-    List,
-    Optional,
-    Tuple,
-    Type,
-    Union,
+    Literal,
+    TypedDict,
     cast,
 )
 
-from . import requirements, specifiers, utils, version as version_module
+from . import requirements, specifiers, utils
+from . import version as version_module
 
 T = typing.TypeVar("T")
-if sys.version_info[:2] >= (3, 8):  # pragma: no cover
-    from typing import Literal, TypedDict
-else:  # pragma: no cover
-    if typing.TYPE_CHECKING:
-        from typing_extensions import Literal, TypedDict
-    else:
-        try:
-            from typing_extensions import Literal, TypedDict
-        except ImportError:
-
-            class Literal:
-                def __init_subclass__(*_args, **_kwargs):
-                    pass
-
-            class TypedDict:
-                def __init_subclass__(*_args, **_kwargs):
-                    pass
 
 
 try:
     ExceptionGroup
 except NameError:  # pragma: no cover
 
-    class ExceptionGroup(Exception):  # noqa: N818
+    class ExceptionGroup(Exception):
         """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11.
 
         If :external:exc:`ExceptionGroup` is already defined by Python itself,
@@ -52,9 +33,9 @@ class ExceptionGroup(Exception):  # noqa: N818
         """
 
         message: str
-        exceptions: List[Exception]
+        exceptions: list[Exception]
 
-        def __init__(self, message: str, exceptions: List[Exception]) -> None:
+        def __init__(self, message: str, exceptions: list[Exception]) -> None:
             self.message = message
             self.exceptions = exceptions
 
@@ -100,32 +81,32 @@ class RawMetadata(TypedDict, total=False):
     metadata_version: str
     name: str
     version: str
-    platforms: List[str]
+    platforms: list[str]
     summary: str
     description: str
-    keywords: List[str]
+    keywords: list[str]
     home_page: str
     author: str
     author_email: str
     license: str
 
     # Metadata 1.1 - PEP 314
-    supported_platforms: List[str]
+    supported_platforms: list[str]
     download_url: str
-    classifiers: List[str]
-    requires: List[str]
-    provides: List[str]
-    obsoletes: List[str]
+    classifiers: list[str]
+    requires: list[str]
+    provides: list[str]
+    obsoletes: list[str]
 
     # Metadata 1.2 - PEP 345
     maintainer: str
     maintainer_email: str
-    requires_dist: List[str]
-    provides_dist: List[str]
-    obsoletes_dist: List[str]
+    requires_dist: list[str]
+    provides_dist: list[str]
+    obsoletes_dist: list[str]
     requires_python: str
-    requires_external: List[str]
-    project_urls: Dict[str, str]
+    requires_external: list[str]
+    project_urls: dict[str, str]
 
     # Metadata 2.0
     # PEP 426 attempted to completely revamp the metadata format
@@ -138,10 +119,10 @@ class RawMetadata(TypedDict, total=False):
 
     # Metadata 2.1 - PEP 566
     description_content_type: str
-    provides_extra: List[str]
+    provides_extra: list[str]
 
     # Metadata 2.2 - PEP 643
-    dynamic: List[str]
+    dynamic: list[str]
 
     # Metadata 2.3 - PEP 685
     # No new fields were added in PEP 685, just some edge case were
@@ -185,12 +166,12 @@ class RawMetadata(TypedDict, total=False):
 }
 
 
-def _parse_keywords(data: str) -> List[str]:
+def _parse_keywords(data: str) -> list[str]:
     """Split a string of comma-separate keyboards into a list of keywords."""
     return [k.strip() for k in data.split(",")]
 
 
-def _parse_project_urls(data: List[str]) -> Dict[str, str]:
+def _parse_project_urls(data: list[str]) -> dict[str, str]:
     """Parse a list of label/URL string pairings separated by a comma."""
     urls = {}
     for pair in data:
@@ -230,7 +211,7 @@ def _parse_project_urls(data: List[str]) -> Dict[str, str]:
     return urls
 
 
-def _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str:
+def _get_payload(msg: email.message.Message, source: bytes | str) -> str:
     """Get the body of the message."""
     # If our source is a str, then our caller has managed encodings for us,
     # and we don't need to deal with it.
@@ -292,7 +273,7 @@ def _get_payload(msg: email.message.Message, source: Union[bytes, str]) -> str:
 _RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()}
 
 
-def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[str]]]:
+def parse_email(data: bytes | str) -> tuple[RawMetadata, dict[str, list[str]]]:
     """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``).
 
     This function returns a two-item tuple of dicts. The first dict is of
@@ -308,8 +289,8 @@ def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[st
     included in this dict.
 
     """
-    raw: Dict[str, Union[str, List[str], Dict[str, str]]] = {}
-    unparsed: Dict[str, List[str]] = {}
+    raw: dict[str, str | list[str] | dict[str, str]] = {}
+    unparsed: dict[str, list[str]] = {}
 
     if isinstance(data, str):
         parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data)
@@ -357,7 +338,7 @@ def parse_email(data: Union[bytes, str]) -> Tuple[RawMetadata, Dict[str, List[st
                 # The Header object stores it's data as chunks, and each chunk
                 # can be independently encoded, so we'll need to check each
                 # of them.
-                chunks: List[Tuple[bytes, Optional[str]]] = []
+                chunks: list[tuple[bytes, str | None]] = []
                 for bin, encoding in email.header.decode_header(h):
                     try:
                         bin.decode("utf8", "strict")
@@ -499,11 +480,11 @@ def __init__(
     ) -> None:
         self.added = added
 
-    def __set_name__(self, _owner: "Metadata", name: str) -> None:
+    def __set_name__(self, _owner: Metadata, name: str) -> None:
         self.name = name
         self.raw_name = _RAW_TO_EMAIL_MAPPING[name]
 
-    def __get__(self, instance: "Metadata", _owner: Type["Metadata"]) -> T:
+    def __get__(self, instance: Metadata, _owner: type[Metadata]) -> T:
         # With Python 3.8, the caching can be replaced with functools.cached_property().
         # No need to check the cache as attribute lookup will resolve into the
         # instance's __dict__ before __get__ is called.
@@ -531,7 +512,7 @@ def __get__(self, instance: "Metadata", _owner: Type["Metadata"]) -> T:
         return cast(T, value)
 
     def _invalid_metadata(
-        self, msg: str, cause: Optional[Exception] = None
+        self, msg: str, cause: Exception | None = None
     ) -> InvalidMetadata:
         exc = InvalidMetadata(
             self.raw_name, msg.format_map({"field": repr(self.raw_name)})
@@ -606,7 +587,7 @@ def _process_description_content_type(self, value: str) -> str:
             )
         return value
 
-    def _process_dynamic(self, value: List[str]) -> List[str]:
+    def _process_dynamic(self, value: list[str]) -> list[str]:
         for dynamic_field in map(str.lower, value):
             if dynamic_field in {"name", "version", "metadata-version"}:
                 raise self._invalid_metadata(
@@ -618,8 +599,8 @@ def _process_dynamic(self, value: List[str]) -> List[str]:
 
     def _process_provides_extra(
         self,
-        value: List[str],
-    ) -> List[utils.NormalizedName]:
+        value: list[str],
+    ) -> list[utils.NormalizedName]:
         normalized_names = []
         try:
             for name in value:
@@ -641,8 +622,8 @@ def _process_requires_python(self, value: str) -> specifiers.SpecifierSet:
 
     def _process_requires_dist(
         self,
-        value: List[str],
-    ) -> List[requirements.Requirement]:
+        value: list[str],
+    ) -> list[requirements.Requirement]:
         reqs = []
         try:
             for req in value:
@@ -665,7 +646,7 @@ class Metadata:
     _raw: RawMetadata
 
     @classmethod
-    def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata":
+    def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> Metadata:
         """Create an instance from :class:`RawMetadata`.
 
         If *validate* is true, all metadata will be validated. All exceptions
@@ -675,7 +656,7 @@ def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata":
         ins._raw = data.copy()  # Mutations occur due to caching enriched values.
 
         if validate:
-            exceptions: List[Exception] = []
+            exceptions: list[Exception] = []
             try:
                 metadata_version = ins.metadata_version
                 metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version)
@@ -722,9 +703,7 @@ def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> "Metadata":
         return ins
 
     @classmethod
-    def from_email(
-        cls, data: Union[bytes, str], *, validate: bool = True
-    ) -> "Metadata":
+    def from_email(cls, data: bytes | str, *, validate: bool = True) -> Metadata:
         """Parse metadata from email headers.
 
         If *validate* is true, the metadata will be validated. All exceptions
@@ -760,66 +739,66 @@ def from_email(
     *validate* parameter)"""
     version: _Validator[version_module.Version] = _Validator()
     """:external:ref:`core-metadata-version` (required)"""
-    dynamic: _Validator[Optional[List[str]]] = _Validator(
+    dynamic: _Validator[list[str] | None] = _Validator(
         added="2.2",
     )
     """:external:ref:`core-metadata-dynamic`
     (validated against core metadata field names and lowercased)"""
-    platforms: _Validator[Optional[List[str]]] = _Validator()
+    platforms: _Validator[list[str] | None] = _Validator()
     """:external:ref:`core-metadata-platform`"""
-    supported_platforms: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    supported_platforms: _Validator[list[str] | None] = _Validator(added="1.1")
     """:external:ref:`core-metadata-supported-platform`"""
-    summary: _Validator[Optional[str]] = _Validator()
+    summary: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-summary` (validated to contain no newlines)"""
-    description: _Validator[Optional[str]] = _Validator()  # TODO 2.1: can be in body
+    description: _Validator[str | None] = _Validator()  # TODO 2.1: can be in body
     """:external:ref:`core-metadata-description`"""
-    description_content_type: _Validator[Optional[str]] = _Validator(added="2.1")
+    description_content_type: _Validator[str | None] = _Validator(added="2.1")
     """:external:ref:`core-metadata-description-content-type` (validated)"""
-    keywords: _Validator[Optional[List[str]]] = _Validator()
+    keywords: _Validator[list[str] | None] = _Validator()
     """:external:ref:`core-metadata-keywords`"""
-    home_page: _Validator[Optional[str]] = _Validator()
+    home_page: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-home-page`"""
-    download_url: _Validator[Optional[str]] = _Validator(added="1.1")
+    download_url: _Validator[str | None] = _Validator(added="1.1")
     """:external:ref:`core-metadata-download-url`"""
-    author: _Validator[Optional[str]] = _Validator()
+    author: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-author`"""
-    author_email: _Validator[Optional[str]] = _Validator()
+    author_email: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-author-email`"""
-    maintainer: _Validator[Optional[str]] = _Validator(added="1.2")
+    maintainer: _Validator[str | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-maintainer`"""
-    maintainer_email: _Validator[Optional[str]] = _Validator(added="1.2")
+    maintainer_email: _Validator[str | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-maintainer-email`"""
-    license: _Validator[Optional[str]] = _Validator()
+    license: _Validator[str | None] = _Validator()
     """:external:ref:`core-metadata-license`"""
-    classifiers: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    classifiers: _Validator[list[str] | None] = _Validator(added="1.1")
     """:external:ref:`core-metadata-classifier`"""
-    requires_dist: _Validator[Optional[List[requirements.Requirement]]] = _Validator(
+    requires_dist: _Validator[list[requirements.Requirement] | None] = _Validator(
         added="1.2"
     )
     """:external:ref:`core-metadata-requires-dist`"""
-    requires_python: _Validator[Optional[specifiers.SpecifierSet]] = _Validator(
+    requires_python: _Validator[specifiers.SpecifierSet | None] = _Validator(
         added="1.2"
     )
     """:external:ref:`core-metadata-requires-python`"""
     # Because `Requires-External` allows for non-PEP 440 version specifiers, we
     # don't do any processing on the values.
-    requires_external: _Validator[Optional[List[str]]] = _Validator(added="1.2")
+    requires_external: _Validator[list[str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-requires-external`"""
-    project_urls: _Validator[Optional[Dict[str, str]]] = _Validator(added="1.2")
+    project_urls: _Validator[dict[str, str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-project-url`"""
     # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation
     # regardless of metadata version.
-    provides_extra: _Validator[Optional[List[utils.NormalizedName]]] = _Validator(
+    provides_extra: _Validator[list[utils.NormalizedName] | None] = _Validator(
         added="2.1",
     )
     """:external:ref:`core-metadata-provides-extra`"""
-    provides_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2")
+    provides_dist: _Validator[list[str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-provides-dist`"""
-    obsoletes_dist: _Validator[Optional[List[str]]] = _Validator(added="1.2")
+    obsoletes_dist: _Validator[list[str] | None] = _Validator(added="1.2")
     """:external:ref:`core-metadata-obsoletes-dist`"""
-    requires: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    requires: _Validator[list[str] | None] = _Validator(added="1.1")
     """``Requires`` (deprecated)"""
-    provides: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    provides: _Validator[list[str] | None] = _Validator(added="1.1")
     """``Provides`` (deprecated)"""
-    obsoletes: _Validator[Optional[List[str]]] = _Validator(added="1.1")
+    obsoletes: _Validator[list[str] | None] = _Validator(added="1.1")
     """``Obsoletes`` (deprecated)"""
diff --git a/pkg_resources/_vendor/packaging/requirements.py b/pkg_resources/_vendor/packaging/requirements.py
index bdc43a7e98..4e068c9567 100644
--- a/pkg_resources/_vendor/packaging/requirements.py
+++ b/pkg_resources/_vendor/packaging/requirements.py
@@ -1,8 +1,9 @@
 # This file is dual licensed under the terms of the Apache License, Version
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
+from __future__ import annotations
 
-from typing import Any, Iterator, Optional, Set
+from typing import Any, Iterator
 
 from ._parser import parse_requirement as _parse_requirement
 from ._tokenizer import ParserSyntaxError
@@ -37,10 +38,10 @@ def __init__(self, requirement_string: str) -> None:
             raise InvalidRequirement(str(e)) from e
 
         self.name: str = parsed.name
-        self.url: Optional[str] = parsed.url or None
-        self.extras: Set[str] = set(parsed.extras or [])
+        self.url: str | None = parsed.url or None
+        self.extras: set[str] = set(parsed.extras or [])
         self.specifier: SpecifierSet = SpecifierSet(parsed.specifier)
-        self.marker: Optional[Marker] = None
+        self.marker: Marker | None = None
         if parsed.marker is not None:
             self.marker = Marker.__new__(Marker)
             self.marker._markers = _normalize_extra_values(parsed.marker)
diff --git a/pkg_resources/_vendor/packaging/specifiers.py b/pkg_resources/_vendor/packaging/specifiers.py
index 2d015bab59..2fa75f7abb 100644
--- a/pkg_resources/_vendor/packaging/specifiers.py
+++ b/pkg_resources/_vendor/packaging/specifiers.py
@@ -8,10 +8,12 @@
     from packaging.version import Version
 """
 
+from __future__ import annotations
+
 import abc
 import itertools
 import re
-from typing import Callable, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union
+from typing import Callable, Iterable, Iterator, TypeVar, Union
 
 from .utils import canonicalize_version
 from .version import Version
@@ -64,7 +66,7 @@ def __eq__(self, other: object) -> bool:
 
     @property
     @abc.abstractmethod
-    def prereleases(self) -> Optional[bool]:
+    def prereleases(self) -> bool | None:
         """Whether or not pre-releases as a whole are allowed.
 
         This can be set to either ``True`` or ``False`` to explicitly enable or disable
@@ -79,14 +81,14 @@ def prereleases(self, value: bool) -> None:
         """
 
     @abc.abstractmethod
-    def contains(self, item: str, prereleases: Optional[bool] = None) -> bool:
+    def contains(self, item: str, prereleases: bool | None = None) -> bool:
         """
         Determines if the given item is contained within this specifier.
         """
 
     @abc.abstractmethod
     def filter(
-        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None
     ) -> Iterator[UnparsedVersionVar]:
         """
         Takes an iterable of items and filters them so that only items which
@@ -217,7 +219,7 @@ class Specifier(BaseSpecifier):
         "===": "arbitrary",
     }
 
-    def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None:
+    def __init__(self, spec: str = "", prereleases: bool | None = None) -> None:
         """Initialize a Specifier instance.
 
         :param spec:
@@ -234,7 +236,7 @@ def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None:
         if not match:
             raise InvalidSpecifier(f"Invalid specifier: '{spec}'")
 
-        self._spec: Tuple[str, str] = (
+        self._spec: tuple[str, str] = (
             match.group("operator").strip(),
             match.group("version").strip(),
         )
@@ -318,7 +320,7 @@ def __str__(self) -> str:
         return "{}{}".format(*self._spec)
 
     @property
-    def _canonical_spec(self) -> Tuple[str, str]:
+    def _canonical_spec(self) -> tuple[str, str]:
         canonical_version = canonicalize_version(
             self._spec[1],
             strip_trailing_zero=(self._spec[0] != "~="),
@@ -364,7 +366,6 @@ def _get_operator(self, op: str) -> CallableOperator:
         return operator_callable
 
     def _compare_compatible(self, prospective: Version, spec: str) -> bool:
-
         # Compatible releases have an equivalent combination of >= and ==. That
         # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to
         # implement this in terms of the other specifiers instead of
@@ -385,7 +386,6 @@ def _compare_compatible(self, prospective: Version, spec: str) -> bool:
         )
 
     def _compare_equal(self, prospective: Version, spec: str) -> bool:
-
         # We need special logic to handle prefix matching
         if spec.endswith(".*"):
             # In the case of prefix matching we want to ignore local segment.
@@ -429,21 +429,18 @@ def _compare_not_equal(self, prospective: Version, spec: str) -> bool:
         return not self._compare_equal(prospective, spec)
 
     def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool:
-
         # NB: Local version identifiers are NOT permitted in the version
         # specifier, so local version labels can be universally removed from
         # the prospective version.
         return Version(prospective.public) <= Version(spec)
 
     def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool:
-
         # NB: Local version identifiers are NOT permitted in the version
         # specifier, so local version labels can be universally removed from
         # the prospective version.
         return Version(prospective.public) >= Version(spec)
 
     def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:
-
         # Convert our spec to a Version instance, since we'll want to work with
         # it as a version.
         spec = Version(spec_str)
@@ -468,7 +465,6 @@ def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:
         return True
 
     def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:
-
         # Convert our spec to a Version instance, since we'll want to work with
         # it as a version.
         spec = Version(spec_str)
@@ -501,7 +497,7 @@ def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:
     def _compare_arbitrary(self, prospective: Version, spec: str) -> bool:
         return str(prospective).lower() == str(spec).lower()
 
-    def __contains__(self, item: Union[str, Version]) -> bool:
+    def __contains__(self, item: str | Version) -> bool:
         """Return whether or not the item is contained in this specifier.
 
         :param item: The item to check for.
@@ -522,9 +518,7 @@ def __contains__(self, item: Union[str, Version]) -> bool:
         """
         return self.contains(item)
 
-    def contains(
-        self, item: UnparsedVersion, prereleases: Optional[bool] = None
-    ) -> bool:
+    def contains(self, item: UnparsedVersion, prereleases: bool | None = None) -> bool:
         """Return whether or not the item is contained in this specifier.
 
         :param item:
@@ -569,7 +563,7 @@ def contains(
         return operator_callable(normalized_item, self.version)
 
     def filter(
-        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None
     ) -> Iterator[UnparsedVersionVar]:
         """Filter items in the given iterable, that match the specifier.
 
@@ -633,7 +627,7 @@ def filter(
 _prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
 
 
-def _version_split(version: str) -> List[str]:
+def _version_split(version: str) -> list[str]:
     """Split version into components.
 
     The split components are intended for version comparison. The logic does
@@ -641,7 +635,7 @@ def _version_split(version: str) -> List[str]:
     components back with :func:`_version_join` may not produce the original
     version string.
     """
-    result: List[str] = []
+    result: list[str] = []
 
     epoch, _, rest = version.rpartition("!")
     result.append(epoch or "0")
@@ -655,7 +649,7 @@ def _version_split(version: str) -> List[str]:
     return result
 
 
-def _version_join(components: List[str]) -> str:
+def _version_join(components: list[str]) -> str:
     """Join split version components into a version string.
 
     This function assumes the input came from :func:`_version_split`, where the
@@ -672,7 +666,7 @@ def _is_not_suffix(segment: str) -> bool:
     )
 
 
-def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str]]:
+def _pad_version(left: list[str], right: list[str]) -> tuple[list[str], list[str]]:
     left_split, right_split = [], []
 
     # Get the release segment of our versions
@@ -700,9 +694,7 @@ class SpecifierSet(BaseSpecifier):
     specifiers (``>=3.0,!=3.1``), or no specifier at all.
     """
 
-    def __init__(
-        self, specifiers: str = "", prereleases: Optional[bool] = None
-    ) -> None:
+    def __init__(self, specifiers: str = "", prereleases: bool | None = None) -> None:
         """Initialize a SpecifierSet instance.
 
         :param specifiers:
@@ -730,7 +722,7 @@ def __init__(
         self._prereleases = prereleases
 
     @property
-    def prereleases(self) -> Optional[bool]:
+    def prereleases(self) -> bool | None:
         # If we have been given an explicit prerelease modifier, then we'll
         # pass that through here.
         if self._prereleases is not None:
@@ -787,7 +779,7 @@ def __str__(self) -> str:
     def __hash__(self) -> int:
         return hash(self._specs)
 
-    def __and__(self, other: Union["SpecifierSet", str]) -> "SpecifierSet":
+    def __and__(self, other: SpecifierSet | str) -> SpecifierSet:
         """Return a SpecifierSet which is a combination of the two sets.
 
         :param other: The other object to combine with.
@@ -883,8 +875,8 @@ def __contains__(self, item: UnparsedVersion) -> bool:
     def contains(
         self,
         item: UnparsedVersion,
-        prereleases: Optional[bool] = None,
-        installed: Optional[bool] = None,
+        prereleases: bool | None = None,
+        installed: bool | None = None,
     ) -> bool:
         """Return whether or not the item is contained in this SpecifierSet.
 
@@ -938,7 +930,7 @@ def contains(
         return all(s.contains(item, prereleases=prereleases) for s in self._specs)
 
     def filter(
-        self, iterable: Iterable[UnparsedVersionVar], prereleases: Optional[bool] = None
+        self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None
     ) -> Iterator[UnparsedVersionVar]:
         """Filter items in the given iterable, that match the specifiers in this set.
 
@@ -995,8 +987,8 @@ def filter(
         # which will filter out any pre-releases, unless there are no final
         # releases.
         else:
-            filtered: List[UnparsedVersionVar] = []
-            found_prereleases: List[UnparsedVersionVar] = []
+            filtered: list[UnparsedVersionVar] = []
+            found_prereleases: list[UnparsedVersionVar] = []
 
             for item in iterable:
                 parsed_version = _coerce_version(item)
diff --git a/pkg_resources/_vendor/packaging/tags.py b/pkg_resources/_vendor/packaging/tags.py
index 89f1926137..6667d29908 100644
--- a/pkg_resources/_vendor/packaging/tags.py
+++ b/pkg_resources/_vendor/packaging/tags.py
@@ -2,6 +2,8 @@
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
 
+from __future__ import annotations
+
 import logging
 import platform
 import re
@@ -11,15 +13,10 @@
 import sysconfig
 from importlib.machinery import EXTENSION_SUFFIXES
 from typing import (
-    Dict,
-    FrozenSet,
     Iterable,
     Iterator,
-    List,
-    Optional,
     Sequence,
     Tuple,
-    Union,
     cast,
 )
 
@@ -30,7 +27,7 @@
 PythonVersion = Sequence[int]
 MacVersion = Tuple[int, int]
 
-INTERPRETER_SHORT_NAMES: Dict[str, str] = {
+INTERPRETER_SHORT_NAMES: dict[str, str] = {
     "python": "py",  # Generic.
     "cpython": "cp",
     "pypy": "pp",
@@ -96,7 +93,7 @@ def __repr__(self) -> str:
         return f"<{self} @ {id(self)}>"
 
 
-def parse_tag(tag: str) -> FrozenSet[Tag]:
+def parse_tag(tag: str) -> frozenset[Tag]:
     """
     Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances.
 
@@ -112,8 +109,8 @@ def parse_tag(tag: str) -> FrozenSet[Tag]:
     return frozenset(tags)
 
 
-def _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]:
-    value: Union[int, str, None] = sysconfig.get_config_var(name)
+def _get_config_var(name: str, warn: bool = False) -> int | str | None:
+    value: int | str | None = sysconfig.get_config_var(name)
     if value is None and warn:
         logger.debug(
             "Config variable '%s' is unset, Python ABI tag may be incorrect", name
@@ -125,7 +122,7 @@ def _normalize_string(string: str) -> str:
     return string.replace(".", "_").replace("-", "_").replace(" ", "_")
 
 
-def _is_threaded_cpython(abis: List[str]) -> bool:
+def _is_threaded_cpython(abis: list[str]) -> bool:
     """
     Determine if the ABI corresponds to a threaded (`--disable-gil`) build.
 
@@ -151,7 +148,7 @@ def _abi3_applies(python_version: PythonVersion, threading: bool) -> bool:
     return len(python_version) > 1 and tuple(python_version) >= (3, 2) and not threading
 
 
-def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]:
+def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> list[str]:
     py_version = tuple(py_version)  # To allow for version comparison.
     abis = []
     version = _version_nodot(py_version[:2])
@@ -185,9 +182,9 @@ def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]:
 
 
 def cpython_tags(
-    python_version: Optional[PythonVersion] = None,
-    abis: Optional[Iterable[str]] = None,
-    platforms: Optional[Iterable[str]] = None,
+    python_version: PythonVersion | None = None,
+    abis: Iterable[str] | None = None,
+    platforms: Iterable[str] | None = None,
     *,
     warn: bool = False,
 ) -> Iterator[Tag]:
@@ -244,7 +241,7 @@ def cpython_tags(
                 yield Tag(interpreter, "abi3", platform_)
 
 
-def _generic_abi() -> List[str]:
+def _generic_abi() -> list[str]:
     """
     Return the ABI tag based on EXT_SUFFIX.
     """
@@ -286,9 +283,9 @@ def _generic_abi() -> List[str]:
 
 
 def generic_tags(
-    interpreter: Optional[str] = None,
-    abis: Optional[Iterable[str]] = None,
-    platforms: Optional[Iterable[str]] = None,
+    interpreter: str | None = None,
+    abis: Iterable[str] | None = None,
+    platforms: Iterable[str] | None = None,
     *,
     warn: bool = False,
 ) -> Iterator[Tag]:
@@ -332,9 +329,9 @@ def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]:
 
 
 def compatible_tags(
-    python_version: Optional[PythonVersion] = None,
-    interpreter: Optional[str] = None,
-    platforms: Optional[Iterable[str]] = None,
+    python_version: PythonVersion | None = None,
+    interpreter: str | None = None,
+    platforms: Iterable[str] | None = None,
 ) -> Iterator[Tag]:
     """
     Yields the sequence of tags that are compatible with a specific version of Python.
@@ -366,7 +363,7 @@ def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str:
     return "i386"
 
 
-def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]:
+def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> list[str]:
     formats = [cpu_arch]
     if cpu_arch == "x86_64":
         if version < (10, 4):
@@ -399,7 +396,7 @@ def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]:
 
 
 def mac_platforms(
-    version: Optional[MacVersion] = None, arch: Optional[str] = None
+    version: MacVersion | None = None, arch: str | None = None
 ) -> Iterator[str]:
     """
     Yields the platform tags for a macOS system.
diff --git a/pkg_resources/_vendor/packaging/utils.py b/pkg_resources/_vendor/packaging/utils.py
index c2c2f75aa8..d33da5bb8b 100644
--- a/pkg_resources/_vendor/packaging/utils.py
+++ b/pkg_resources/_vendor/packaging/utils.py
@@ -2,8 +2,10 @@
 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
 # for complete details.
 
+from __future__ import annotations
+
 import re
-from typing import FrozenSet, NewType, Tuple, Union, cast
+from typing import NewType, Tuple, Union, cast
 
 from .tags import Tag, parse_tag
 from .version import InvalidVersion, Version
@@ -53,7 +55,7 @@ def is_normalized_name(name: str) -> bool:
 
 
 def canonicalize_version(
-    version: Union[Version, str], *, strip_trailing_zero: bool = True
+    version: Version | str, *, strip_trailing_zero: bool = True
 ) -> str:
     """
     This is very similar to Version.__str__, but has one subtle difference
@@ -102,7 +104,7 @@ def canonicalize_version(
 
 def parse_wheel_filename(
     filename: str,
-) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]:
+) -> tuple[NormalizedName, Version, BuildTag, frozenset[Tag]]:
     if not filename.endswith(".whl"):
         raise InvalidWheelFilename(
             f"Invalid wheel filename (extension must be '.whl'): {filename}"
@@ -143,7 +145,7 @@ def parse_wheel_filename(
     return (name, version, build, tags)
 
 
-def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]:
+def parse_sdist_filename(filename: str) -> tuple[NormalizedName, Version]:
     if filename.endswith(".tar.gz"):
         file_stem = filename[: -len(".tar.gz")]
     elif filename.endswith(".zip"):
diff --git a/pkg_resources/_vendor/packaging/version.py b/pkg_resources/_vendor/packaging/version.py
index 5faab9bd0d..46bc261308 100644
--- a/pkg_resources/_vendor/packaging/version.py
+++ b/pkg_resources/_vendor/packaging/version.py
@@ -7,9 +7,11 @@
     from packaging.version import parse, Version
 """
 
+from __future__ import annotations
+
 import itertools
 import re
-from typing import Any, Callable, NamedTuple, Optional, SupportsInt, Tuple, Union
+from typing import Any, Callable, NamedTuple, SupportsInt, Tuple, Union
 
 from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType
 
@@ -35,14 +37,14 @@
 
 class _Version(NamedTuple):
     epoch: int
-    release: Tuple[int, ...]
-    dev: Optional[Tuple[str, int]]
-    pre: Optional[Tuple[str, int]]
-    post: Optional[Tuple[str, int]]
-    local: Optional[LocalType]
+    release: tuple[int, ...]
+    dev: tuple[str, int] | None
+    pre: tuple[str, int] | None
+    post: tuple[str, int] | None
+    local: LocalType | None
 
 
-def parse(version: str) -> "Version":
+def parse(version: str) -> Version:
     """Parse the given version string.
 
     >>> parse('1.0.dev1')
@@ -65,7 +67,7 @@ class InvalidVersion(ValueError):
 
 
 class _BaseVersion:
-    _key: Tuple[Any, ...]
+    _key: tuple[Any, ...]
 
     def __hash__(self) -> int:
         return hash(self._key)
@@ -73,13 +75,13 @@ def __hash__(self) -> int:
     # Please keep the duplicated `isinstance` check
     # in the six comparisons hereunder
     # unless you find a way to avoid adding overhead function calls.
-    def __lt__(self, other: "_BaseVersion") -> bool:
+    def __lt__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
         return self._key < other._key
 
-    def __le__(self, other: "_BaseVersion") -> bool:
+    def __le__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
@@ -91,13 +93,13 @@ def __eq__(self, other: object) -> bool:
 
         return self._key == other._key
 
-    def __ge__(self, other: "_BaseVersion") -> bool:
+    def __ge__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
         return self._key >= other._key
 
-    def __gt__(self, other: "_BaseVersion") -> bool:
+    def __gt__(self, other: _BaseVersion) -> bool:
         if not isinstance(other, _BaseVersion):
             return NotImplemented
 
@@ -274,7 +276,7 @@ def epoch(self) -> int:
         return self._version.epoch
 
     @property
-    def release(self) -> Tuple[int, ...]:
+    def release(self) -> tuple[int, ...]:
         """The components of the "release" segment of the version.
 
         >>> Version("1.2.3").release
@@ -290,7 +292,7 @@ def release(self) -> Tuple[int, ...]:
         return self._version.release
 
     @property
-    def pre(self) -> Optional[Tuple[str, int]]:
+    def pre(self) -> tuple[str, int] | None:
         """The pre-release segment of the version.
 
         >>> print(Version("1.2.3").pre)
@@ -305,7 +307,7 @@ def pre(self) -> Optional[Tuple[str, int]]:
         return self._version.pre
 
     @property
-    def post(self) -> Optional[int]:
+    def post(self) -> int | None:
         """The post-release number of the version.
 
         >>> print(Version("1.2.3").post)
@@ -316,7 +318,7 @@ def post(self) -> Optional[int]:
         return self._version.post[1] if self._version.post else None
 
     @property
-    def dev(self) -> Optional[int]:
+    def dev(self) -> int | None:
         """The development number of the version.
 
         >>> print(Version("1.2.3").dev)
@@ -327,7 +329,7 @@ def dev(self) -> Optional[int]:
         return self._version.dev[1] if self._version.dev else None
 
     @property
-    def local(self) -> Optional[str]:
+    def local(self) -> str | None:
         """The local version segment of the version.
 
         >>> print(Version("1.2.3").local)
@@ -450,9 +452,8 @@ def micro(self) -> int:
 
 
 def _parse_letter_version(
-    letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
-) -> Optional[Tuple[str, int]]:
-
+    letter: str | None, number: str | bytes | SupportsInt | None
+) -> tuple[str, int] | None:
     if letter:
         # We consider there to be an implicit 0 in a pre-release if there is
         # not a numeral associated with it.
@@ -488,7 +489,7 @@ def _parse_letter_version(
 _local_version_separators = re.compile(r"[\._-]")
 
 
-def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
+def _parse_local_version(local: str | None) -> LocalType | None:
     """
     Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
     """
@@ -502,13 +503,12 @@ def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
 
 def _cmpkey(
     epoch: int,
-    release: Tuple[int, ...],
-    pre: Optional[Tuple[str, int]],
-    post: Optional[Tuple[str, int]],
-    dev: Optional[Tuple[str, int]],
-    local: Optional[LocalType],
+    release: tuple[int, ...],
+    pre: tuple[str, int] | None,
+    post: tuple[str, int] | None,
+    dev: tuple[str, int] | None,
+    local: LocalType | None,
 ) -> CmpKey:
-
     # When we compare a release version, we want to compare it with all of the
     # trailing zeros removed. So we'll use a reverse the list, drop all the now
     # leading zeros until we come to something non zero, then take the rest
diff --git a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/RECORD b/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/RECORD
deleted file mode 100644
index a721322694..0000000000
--- a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/RECORD
+++ /dev/null
@@ -1,23 +0,0 @@
-platformdirs-2.6.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-platformdirs-2.6.2.dist-info/METADATA,sha256=rDoFsb9-2tVym02IIeYCoKgGaCpY2v8xw8WWXywxhIM,9502
-platformdirs-2.6.2.dist-info/RECORD,,
-platformdirs-2.6.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-platformdirs-2.6.2.dist-info/WHEEL,sha256=NaLmgHHW_f9jTvv_wRh9vcK7c7EK9o5fwsIXMOzoGgM,87
-platformdirs-2.6.2.dist-info/licenses/LICENSE,sha256=KeD9YukphQ6G6yjD_czwzv30-pSHkBHP-z0NS-1tTbY,1089
-platformdirs/__init__.py,sha256=td0a-fHENmnG8ess2WRoysKv9ud5j6TQ-p_iUM_uE18,12864
-platformdirs/__main__.py,sha256=VsC0t5m-6f0YVr96PVks93G3EDF8MSNY4KpUMvPahDA,1164
-platformdirs/__pycache__/__init__.cpython-312.pyc,,
-platformdirs/__pycache__/__main__.cpython-312.pyc,,
-platformdirs/__pycache__/android.cpython-312.pyc,,
-platformdirs/__pycache__/api.cpython-312.pyc,,
-platformdirs/__pycache__/macos.cpython-312.pyc,,
-platformdirs/__pycache__/unix.cpython-312.pyc,,
-platformdirs/__pycache__/version.cpython-312.pyc,,
-platformdirs/__pycache__/windows.cpython-312.pyc,,
-platformdirs/android.py,sha256=GKizhyS7ESRiU67u8UnBJLm46goau9937EchXWbPBlk,4068
-platformdirs/api.py,sha256=MXKHXOL3eh_-trSok-JUTjAR_zjmmKF3rjREVABjP8s,4910
-platformdirs/macos.py,sha256=-3UXQewbT0yMhMdkzRXfXGAntmLIH7Qt4a9Hlf8I5_Y,2655
-platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-platformdirs/unix.py,sha256=P-WQjSSieE38DXjMDa1t4XHnKJQ5idEaKT0PyXwm8KQ,6911
-platformdirs/version.py,sha256=qaN-fw_htIgKUVXoAuAEVgKxQu3tZ9qE2eiKkWIS7LA,160
-platformdirs/windows.py,sha256=LOrXLgI0CjQldDo2zhOZYGYZ6g4e_cJOCB_pF9aMRWQ,6596
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/METADATA b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/METADATA
similarity index 75%
rename from pkg_resources/_vendor/platformdirs-2.6.2.dist-info/METADATA
rename to pkg_resources/_vendor/platformdirs-4.2.2.dist-info/METADATA
index 608afde321..ab51ef36ad 100644
--- a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/METADATA
+++ b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/METADATA
@@ -1,49 +1,50 @@
-Metadata-Version: 2.1
+Metadata-Version: 2.3
 Name: platformdirs
-Version: 2.6.2
-Summary: A small Python package for determining appropriate platform-specific dirs, e.g. a "user data dir".
+Version: 4.2.2
+Summary: A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`.
 Project-URL: Documentation, https://platformdirs.readthedocs.io
 Project-URL: Homepage, https://github.com/platformdirs/platformdirs
 Project-URL: Source, https://github.com/platformdirs/platformdirs
 Project-URL: Tracker, https://github.com/platformdirs/platformdirs/issues
 Maintainer-email: Bernát Gábor , Julian Berman , Ofek Lev , Ronny Pfannschmidt 
+License-Expression: MIT
 License-File: LICENSE
-Keywords: application,cache,directory,log,user
+Keywords: appdirs,application,cache,directory,log,user
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
 Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=3.7
-Requires-Dist: typing-extensions>=4.4; python_version < '3.8'
+Requires-Python: >=3.8
 Provides-Extra: docs
-Requires-Dist: furo>=2022.12.7; extra == 'docs'
+Requires-Dist: furo>=2023.9.10; extra == 'docs'
 Requires-Dist: proselint>=0.13; extra == 'docs'
-Requires-Dist: sphinx-autodoc-typehints>=1.19.5; extra == 'docs'
-Requires-Dist: sphinx>=5.3; extra == 'docs'
+Requires-Dist: sphinx-autodoc-typehints>=1.25.2; extra == 'docs'
+Requires-Dist: sphinx>=7.2.6; extra == 'docs'
 Provides-Extra: test
 Requires-Dist: appdirs==1.4.4; extra == 'test'
-Requires-Dist: covdefaults>=2.2.2; extra == 'test'
-Requires-Dist: pytest-cov>=4; extra == 'test'
-Requires-Dist: pytest-mock>=3.10; extra == 'test'
-Requires-Dist: pytest>=7.2; extra == 'test'
+Requires-Dist: covdefaults>=2.3; extra == 'test'
+Requires-Dist: pytest-cov>=4.1; extra == 'test'
+Requires-Dist: pytest-mock>=3.12; extra == 'test'
+Requires-Dist: pytest>=7.4.3; extra == 'test'
+Provides-Extra: type
+Requires-Dist: mypy>=1.8; extra == 'type'
 Description-Content-Type: text/x-rst
 
 The problem
 ===========
 
-.. image:: https://github.com/platformdirs/platformdirs/workflows/Test/badge.svg
-   :target: https://github.com/platformdirs/platformdirs/actions?query=workflow%3ATest
+.. image:: https://github.com/platformdirs/platformdirs/actions/workflows/check.yml/badge.svg
+   :target: https://github.com/platformdirs/platformdirs/actions
 
 When writing desktop application, finding the right location to store user data
 and configuration varies per platform. Even for single-platform apps, there
@@ -53,7 +54,7 @@ For example, if running on macOS, you should use::
 
     ~/Library/Application Support/
 
-If on Windows (at least English Win XP) that should be::
+If on Windows (at least English Win) that should be::
 
     C:\Documents and Settings\\Application Data\Local Settings\\
 
@@ -82,6 +83,11 @@ This kind of thing is what the ``platformdirs`` package is for.
 - site config dir (``site_config_dir``)
 - user log dir (``user_log_dir``)
 - user documents dir (``user_documents_dir``)
+- user downloads dir (``user_downloads_dir``)
+- user pictures dir (``user_pictures_dir``)
+- user videos dir (``user_videos_dir``)
+- user music dir (``user_music_dir``)
+- user desktop dir (``user_desktop_dir``)
 - user runtime dir (``user_runtime_dir``)
 
 And also:
@@ -109,10 +115,20 @@ On macOS:
     '/Users/trentm/Library/Logs/SuperApp'
     >>> user_documents_dir()
     '/Users/trentm/Documents'
+    >>> user_downloads_dir()
+    '/Users/trentm/Downloads'
+    >>> user_pictures_dir()
+    '/Users/trentm/Pictures'
+    >>> user_videos_dir()
+    '/Users/trentm/Movies'
+    >>> user_music_dir()
+    '/Users/trentm/Music'
+    >>> user_desktop_dir()
+    '/Users/trentm/Desktop'
     >>> user_runtime_dir(appname, appauthor)
     '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
 
-On Windows 7:
+On Windows:
 
 .. code-block:: pycon
 
@@ -129,6 +145,16 @@ On Windows 7:
     'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs'
     >>> user_documents_dir()
     'C:\\Users\\trentm\\Documents'
+    >>> user_downloads_dir()
+    'C:\\Users\\trentm\\Downloads'
+    >>> user_pictures_dir()
+    'C:\\Users\\trentm\\Pictures'
+    >>> user_videos_dir()
+    'C:\\Users\\trentm\\Videos'
+    >>> user_music_dir()
+    'C:\\Users\\trentm\\Music'
+    >>> user_desktop_dir()
+    'C:\\Users\\trentm\\Desktop'
     >>> user_runtime_dir(appname, appauthor)
     'C:\\Users\\trentm\\AppData\\Local\\Temp\\Acme\\SuperApp'
 
@@ -148,11 +174,21 @@ On Linux:
     >>> user_cache_dir(appname, appauthor)
     '/home/trentm/.cache/SuperApp'
     >>> user_log_dir(appname, appauthor)
-    '/home/trentm/.cache/SuperApp/log'
+    '/home/trentm/.local/state/SuperApp/log'
     >>> user_config_dir(appname)
     '/home/trentm/.config/SuperApp'
     >>> user_documents_dir()
     '/home/trentm/Documents'
+    >>> user_downloads_dir()
+    '/home/trentm/Downloads'
+    >>> user_pictures_dir()
+    '/home/trentm/Pictures'
+    >>> user_videos_dir()
+    '/home/trentm/Videos'
+    >>> user_music_dir()
+    '/home/trentm/Music'
+    >>> user_desktop_dir()
+    '/home/trentm/Desktop'
     >>> user_runtime_dir(appname, appauthor)
     '/run/user/{os.getuid()}/SuperApp'
     >>> site_config_dir(appname)
@@ -176,6 +212,16 @@ On Android::
     '/data/data/com.myApp/shared_prefs/SuperApp'
     >>> user_documents_dir()
     '/storage/emulated/0/Documents'
+    >>> user_downloads_dir()
+    '/storage/emulated/0/Downloads'
+    >>> user_pictures_dir()
+    '/storage/emulated/0/Pictures'
+    >>> user_videos_dir()
+    '/storage/emulated/0/DCIM/Camera'
+    >>> user_music_dir()
+    '/storage/emulated/0/Music'
+    >>> user_desktop_dir()
+    '/storage/emulated/0/Desktop'
     >>> user_runtime_dir(appname, appauthor)
     '/data/data/com.myApp/cache/SuperApp/tmp'
 
@@ -203,6 +249,16 @@ apps also support ``XDG_*`` environment variables.
     '/Users/trentm/Library/Logs/SuperApp'
     >>> dirs.user_documents_dir
     '/Users/trentm/Documents'
+    >>> dirs.user_downloads_dir
+    '/Users/trentm/Downloads'
+    >>> dirs.user_pictures_dir
+    '/Users/trentm/Pictures'
+    >>> dirs.user_videos_dir
+    '/Users/trentm/Movies'
+    >>> dirs.user_music_dir
+    '/Users/trentm/Music'
+    >>> dirs.user_desktop_dir
+    '/Users/trentm/Desktop'
     >>> dirs.user_runtime_dir
     '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
 
@@ -225,6 +281,16 @@ dirs::
     '/Users/trentm/Library/Logs/SuperApp/1.0'
     >>> dirs.user_documents_dir
     '/Users/trentm/Documents'
+    >>> dirs.user_downloads_dir
+    '/Users/trentm/Downloads'
+    >>> dirs.user_pictures_dir
+    '/Users/trentm/Pictures'
+    >>> dirs.user_videos_dir
+    '/Users/trentm/Movies'
+    >>> dirs.user_music_dir
+    '/Users/trentm/Music'
+    >>> dirs.user_desktop_dir
+    '/Users/trentm/Desktop'
     >>> dirs.user_runtime_dir
     '/Users/trentm/Library/Caches/TemporaryItems/SuperApp/1.0'
 
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD
new file mode 100644
index 0000000000..64c0c8ea2e
--- /dev/null
+++ b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD
@@ -0,0 +1,23 @@
+platformdirs-4.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+platformdirs-4.2.2.dist-info/METADATA,sha256=zmsie01G1MtXR0wgIv5XpVeTO7idr0WWvfmxKsKWuGk,11429
+platformdirs-4.2.2.dist-info/RECORD,,
+platformdirs-4.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+platformdirs-4.2.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
+platformdirs-4.2.2.dist-info/licenses/LICENSE,sha256=KeD9YukphQ6G6yjD_czwzv30-pSHkBHP-z0NS-1tTbY,1089
+platformdirs/__init__.py,sha256=EMGE8qeHRR9CzDFr8kL3tA8hdZZniYjXBVZd0UGTWK0,22225
+platformdirs/__main__.py,sha256=HnsUQHpiBaiTxwcmwVw-nFaPdVNZtQIdi1eWDtI-MzI,1493
+platformdirs/__pycache__/__init__.cpython-312.pyc,,
+platformdirs/__pycache__/__main__.cpython-312.pyc,,
+platformdirs/__pycache__/android.cpython-312.pyc,,
+platformdirs/__pycache__/api.cpython-312.pyc,,
+platformdirs/__pycache__/macos.cpython-312.pyc,,
+platformdirs/__pycache__/unix.cpython-312.pyc,,
+platformdirs/__pycache__/version.cpython-312.pyc,,
+platformdirs/__pycache__/windows.cpython-312.pyc,,
+platformdirs/android.py,sha256=xZXY9Jd46WOsxT2U6-5HsNtDZ-IQqxcEUrBLl3hYk4o,9016
+platformdirs/api.py,sha256=QBYdUac2eC521ek_y53uD1Dcq-lJX8IgSRVd4InC6uc,8996
+platformdirs/macos.py,sha256=wftsbsvq6nZ0WORXSiCrZNkRHz_WKuktl0a6mC7MFkI,5580
+platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+platformdirs/unix.py,sha256=Cci9Wqt35dAMsg6HT9nRGHSBW5obb0pR3AE1JJnsCXg,10643
+platformdirs/version.py,sha256=r7F76tZRjgQKzrpx_I0_ZMQOMU-PS7eGnHD7zEK3KB0,411
+platformdirs/windows.py,sha256=IFpiohUBwxPtCzlyKwNtxyW4Jk8haa6W8o59mfrDXVo,10125
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/REQUESTED b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/REQUESTED
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/WHEEL b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/WHEEL
similarity index 67%
rename from pkg_resources/_vendor/platformdirs-2.6.2.dist-info/WHEEL
rename to pkg_resources/_vendor/platformdirs-4.2.2.dist-info/WHEEL
index 6d803659b7..516596c767 100644
--- a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/WHEEL
+++ b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/WHEEL
@@ -1,4 +1,4 @@
 Wheel-Version: 1.0
-Generator: hatchling 1.11.1
+Generator: hatchling 1.24.2
 Root-Is-Purelib: true
 Tag: py3-none-any
diff --git a/pkg_resources/_vendor/platformdirs-2.6.2.dist-info/licenses/LICENSE b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
similarity index 100%
rename from pkg_resources/_vendor/platformdirs-2.6.2.dist-info/licenses/LICENSE
rename to pkg_resources/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
diff --git a/pkg_resources/_vendor/platformdirs/__init__.py b/pkg_resources/_vendor/platformdirs/__init__.py
index aef2821b83..3f7d9490d1 100644
--- a/pkg_resources/_vendor/platformdirs/__init__.py
+++ b/pkg_resources/_vendor/platformdirs/__init__.py
@@ -1,42 +1,43 @@
 """
-Utilities for determining application-specific dirs. See  for details and
-usage.
+Utilities for determining application-specific dirs.
+
+See  for details and usage.
+
 """
+
 from __future__ import annotations
 
 import os
 import sys
-from pathlib import Path
-
-if sys.version_info >= (3, 8):  # pragma: no cover (py38+)
-    from typing import Literal
-else:  # pragma: no cover (py38+)
-    from ..typing_extensions import Literal
+from typing import TYPE_CHECKING
 
 from .api import PlatformDirsABC
 from .version import __version__
 from .version import __version_tuple__ as __version_info__
 
+if TYPE_CHECKING:
+    from pathlib import Path
+    from typing import Literal
+
 
 def _set_platform_dir_class() -> type[PlatformDirsABC]:
     if sys.platform == "win32":
-        from .windows import Windows as Result
+        from platformdirs.windows import Windows as Result  # noqa: PLC0415
     elif sys.platform == "darwin":
-        from .macos import MacOS as Result
+        from platformdirs.macos import MacOS as Result  # noqa: PLC0415
     else:
-        from .unix import Unix as Result
+        from platformdirs.unix import Unix as Result  # noqa: PLC0415
 
     if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
-
         if os.getenv("SHELL") or os.getenv("PREFIX"):
             return Result
 
-        from .android import _android_folder
+        from platformdirs.android import _android_folder  # noqa: PLC0415
 
         if _android_folder() is not None:
-            from .android import Android
+            from platformdirs.android import Android  # noqa: PLC0415
 
-            return Android  # return to avoid redefinition of result
+            return Android  # return to avoid redefinition of a result
 
     return Result
 
@@ -49,294 +50,578 @@ def user_data_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    roaming: bool = False,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
-    :param roaming: See `roaming `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: data directory tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_data_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_data_dir
 
 
 def site_data_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    multipath: bool = False,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param multipath: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: data directory shared by users
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_data_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_data_dir
 
 
 def user_config_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    roaming: bool = False,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
-    :param roaming: See `roaming `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: config directory tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_config_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_config_dir
 
 
 def site_config_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    multipath: bool = False,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param multipath: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: config directory shared by the users
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_config_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_config_dir
 
 
 def user_cache_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    opinion: bool = True,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: cache directory tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_cache_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_cache_dir
+
+
+def site_cache_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: cache directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_cache_dir
 
 
 def user_state_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    roaming: bool = False,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
-    :param roaming: See `roaming `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: state directory tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_state_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_state_dir
 
 
 def user_log_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    opinion: bool = True,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: log directory tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_log_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_log_dir
 
 
 def user_documents_dir() -> str:
-    """
-    :returns: documents directory tied to the user
-    """
+    """:returns: documents directory tied to the user"""
     return PlatformDirs().user_documents_dir
 
 
+def user_downloads_dir() -> str:
+    """:returns: downloads directory tied to the user"""
+    return PlatformDirs().user_downloads_dir
+
+
+def user_pictures_dir() -> str:
+    """:returns: pictures directory tied to the user"""
+    return PlatformDirs().user_pictures_dir
+
+
+def user_videos_dir() -> str:
+    """:returns: videos directory tied to the user"""
+    return PlatformDirs().user_videos_dir
+
+
+def user_music_dir() -> str:
+    """:returns: music directory tied to the user"""
+    return PlatformDirs().user_music_dir
+
+
+def user_desktop_dir() -> str:
+    """:returns: desktop directory tied to the user"""
+    return PlatformDirs().user_desktop_dir
+
+
 def user_runtime_dir(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    opinion: bool = True,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> str:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: runtime directory tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_runtime_dir
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_runtime_dir
+
+
+def site_runtime_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: runtime directory shared by users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_runtime_dir
 
 
 def user_data_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    roaming: bool = False,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
-    :param roaming: See `roaming `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: data path tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_data_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_data_path
 
 
 def site_data_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    multipath: bool = False,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param multipath: See `multipath `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: data path shared by users
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_data_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_data_path
 
 
 def user_config_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    roaming: bool = False,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
-    :param roaming: See `roaming `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: config path tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_config_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_config_path
 
 
 def site_config_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    multipath: bool = False,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param multipath: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: config path shared by the users
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_config_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_config_path
+
+
+def site_cache_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: cache directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_cache_path
 
 
 def user_cache_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    opinion: bool = True,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: cache path tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_cache_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_cache_path
 
 
 def user_state_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    roaming: bool = False,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
-    :param roaming: See `roaming `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: state path tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_state_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_state_path
 
 
 def user_log_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    opinion: bool = True,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: log path tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_log_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_log_path
 
 
 def user_documents_path() -> Path:
-    """
-    :returns: documents path tied to the user
-    """
+    """:returns: documents a path tied to the user"""
     return PlatformDirs().user_documents_path
 
 
+def user_downloads_path() -> Path:
+    """:returns: downloads path tied to the user"""
+    return PlatformDirs().user_downloads_path
+
+
+def user_pictures_path() -> Path:
+    """:returns: pictures path tied to the user"""
+    return PlatformDirs().user_pictures_path
+
+
+def user_videos_path() -> Path:
+    """:returns: videos path tied to the user"""
+    return PlatformDirs().user_videos_path
+
+
+def user_music_path() -> Path:
+    """:returns: music path tied to the user"""
+    return PlatformDirs().user_music_path
+
+
+def user_desktop_path() -> Path:
+    """:returns: desktop path tied to the user"""
+    return PlatformDirs().user_desktop_path
+
+
 def user_runtime_path(
     appname: str | None = None,
     appauthor: str | None | Literal[False] = None,
     version: str | None = None,
-    opinion: bool = True,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
 ) -> Path:
     """
     :param appname: See `appname `.
     :param appauthor: See `appauthor `.
     :param version: See `version `.
     :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
     :returns: runtime path tied to the user
     """
-    return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_runtime_path
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_runtime_path
+
+
+def site_runtime_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: runtime path shared by users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_runtime_path
 
 
 __all__ = [
-    "__version__",
-    "__version_info__",
-    "PlatformDirs",
     "AppDirs",
+    "PlatformDirs",
     "PlatformDirsABC",
-    "user_data_dir",
-    "user_config_dir",
-    "user_cache_dir",
-    "user_state_dir",
-    "user_log_dir",
-    "user_documents_dir",
-    "user_runtime_dir",
-    "site_data_dir",
+    "__version__",
+    "__version_info__",
+    "site_cache_dir",
+    "site_cache_path",
     "site_config_dir",
-    "user_data_path",
-    "user_config_path",
+    "site_config_path",
+    "site_data_dir",
+    "site_data_path",
+    "site_runtime_dir",
+    "site_runtime_path",
+    "user_cache_dir",
     "user_cache_path",
-    "user_state_path",
-    "user_log_path",
+    "user_config_dir",
+    "user_config_path",
+    "user_data_dir",
+    "user_data_path",
+    "user_desktop_dir",
+    "user_desktop_path",
+    "user_documents_dir",
     "user_documents_path",
+    "user_downloads_dir",
+    "user_downloads_path",
+    "user_log_dir",
+    "user_log_path",
+    "user_music_dir",
+    "user_music_path",
+    "user_pictures_dir",
+    "user_pictures_path",
+    "user_runtime_dir",
     "user_runtime_path",
-    "site_data_path",
-    "site_config_path",
+    "user_state_dir",
+    "user_state_path",
+    "user_videos_dir",
+    "user_videos_path",
 ]
diff --git a/pkg_resources/_vendor/platformdirs/__main__.py b/pkg_resources/_vendor/platformdirs/__main__.py
index 0fc1edd59c..922c521358 100644
--- a/pkg_resources/_vendor/platformdirs/__main__.py
+++ b/pkg_resources/_vendor/platformdirs/__main__.py
@@ -1,3 +1,5 @@
+"""Main entry point."""
+
 from __future__ import annotations
 
 from platformdirs import PlatformDirs, __version__
@@ -9,37 +11,44 @@
     "user_state_dir",
     "user_log_dir",
     "user_documents_dir",
+    "user_downloads_dir",
+    "user_pictures_dir",
+    "user_videos_dir",
+    "user_music_dir",
     "user_runtime_dir",
     "site_data_dir",
     "site_config_dir",
+    "site_cache_dir",
+    "site_runtime_dir",
 )
 
 
 def main() -> None:
+    """Run the main entry point."""
     app_name = "MyApp"
     app_author = "MyCompany"
 
-    print(f"-- platformdirs {__version__} --")
+    print(f"-- platformdirs {__version__} --")  # noqa: T201
 
-    print("-- app dirs (with optional 'version')")
+    print("-- app dirs (with optional 'version')")  # noqa: T201
     dirs = PlatformDirs(app_name, app_author, version="1.0")
     for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
 
-    print("\n-- app dirs (without optional 'version')")
+    print("\n-- app dirs (without optional 'version')")  # noqa: T201
     dirs = PlatformDirs(app_name, app_author)
     for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
 
-    print("\n-- app dirs (without optional 'appauthor')")
+    print("\n-- app dirs (without optional 'appauthor')")  # noqa: T201
     dirs = PlatformDirs(app_name)
     for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
 
-    print("\n-- app dirs (with disabled 'appauthor')")
+    print("\n-- app dirs (with disabled 'appauthor')")  # noqa: T201
     dirs = PlatformDirs(app_name, appauthor=False)
     for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
 
 
 if __name__ == "__main__":
diff --git a/pkg_resources/_vendor/platformdirs/android.py b/pkg_resources/_vendor/platformdirs/android.py
index eda8093512..afd3141c72 100644
--- a/pkg_resources/_vendor/platformdirs/android.py
+++ b/pkg_resources/_vendor/platformdirs/android.py
@@ -1,19 +1,23 @@
+"""Android."""
+
 from __future__ import annotations
 
 import os
 import re
 import sys
 from functools import lru_cache
-from typing import cast
+from typing import TYPE_CHECKING, cast
 
 from .api import PlatformDirsABC
 
 
 class Android(PlatformDirsABC):
     """
-    Follows the guidance `from here `_. Makes use of the
-    `appname ` and
-    `version `.
+    Follows the guidance `from here `_.
+
+    Makes use of the `appname `, `version
+    `, `ensure_exists `.
+
     """
 
     @property
@@ -29,7 +33,8 @@ def site_data_dir(self) -> str:
     @property
     def user_config_dir(self) -> str:
         """
-        :return: config directory tied to the user, e.g. ``/data/user///shared_prefs/``
+        :return: config directory tied to the user, e.g. \
+        ``/data/user///shared_prefs/``
         """
         return self._append_app_name_and_version(cast(str, _android_folder()), "shared_prefs")
 
@@ -40,9 +45,14 @@ def site_config_dir(self) -> str:
 
     @property
     def user_cache_dir(self) -> str:
-        """:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``"""
+        """:return: cache directory tied to the user, e.g.,``/data/user///cache/``"""
         return self._append_app_name_and_version(cast(str, _android_folder()), "cache")
 
+    @property
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users, same as `user_cache_dir`"""
+        return self.user_cache_dir
+
     @property
     def user_state_dir(self) -> str:
         """:return: state directory tied to the user, same as `user_data_dir`"""
@@ -56,16 +66,39 @@ def user_log_dir(self) -> str:
         """
         path = self.user_cache_dir
         if self.opinion:
-            path = os.path.join(path, "log")
+            path = os.path.join(path, "log")  # noqa: PTH118
         return path
 
     @property
     def user_documents_dir(self) -> str:
-        """
-        :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``
-        """
+        """:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``"""
         return _android_documents_folder()
 
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``"""
+        return _android_downloads_folder()
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``"""
+        return _android_pictures_folder()
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``"""
+        return _android_videos_folder()
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``"""
+        return _android_music_folder()
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user e.g. ``/storage/emulated/0/Desktop``"""
+        return "/storage/emulated/0/Desktop"
+
     @property
     def user_runtime_dir(self) -> str:
         """
@@ -74,21 +107,43 @@ def user_runtime_dir(self) -> str:
         """
         path = self.user_cache_dir
         if self.opinion:
-            path = os.path.join(path, "tmp")
+            path = os.path.join(path, "tmp")  # noqa: PTH118
         return path
 
+    @property
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
+        return self.user_runtime_dir
 
-@lru_cache(maxsize=1)
-def _android_folder() -> str | None:
-    """:return: base folder for the Android OS or None if cannot be found"""
-    try:
-        # First try to get path to android app via pyjnius
-        from jnius import autoclass
 
-        Context = autoclass("android.content.Context")  # noqa: N806
-        result: str | None = Context.getFilesDir().getParentFile().getAbsolutePath()
-    except Exception:
-        # if fails find an android folder looking path on the sys.path
+@lru_cache(maxsize=1)
+def _android_folder() -> str | None:  # noqa: C901, PLR0912
+    """:return: base folder for the Android OS or None if it cannot be found"""
+    result: str | None = None
+    # type checker isn't happy with our "import android", just don't do this when type checking see
+    # https://stackoverflow.com/a/61394121
+    if not TYPE_CHECKING:
+        try:
+            # First try to get a path to android app using python4android (if available)...
+            from android import mActivity  # noqa: PLC0415
+
+            context = cast("android.content.Context", mActivity.getApplicationContext())  # noqa: F821
+            result = context.getFilesDir().getParentFile().getAbsolutePath()
+        except Exception:  # noqa: BLE001
+            result = None
+    if result is None:
+        try:
+            # ...and fall back to using plain pyjnius, if python4android isn't available or doesn't deliver any useful
+            # result...
+            from jnius import autoclass  # noqa: PLC0415
+
+            context = autoclass("android.content.Context")
+            result = context.getFilesDir().getParentFile().getAbsolutePath()
+        except Exception:  # noqa: BLE001
+            result = None
+    if result is None:
+        # and if that fails, too, find an android folder looking at path on the sys.path
+        # warning: only works for apps installed under /data, not adopted storage etc.
         pattern = re.compile(r"/data/(data|user/\d+)/(.+)/files")
         for path in sys.path:
             if pattern.match(path):
@@ -96,6 +151,16 @@ def _android_folder() -> str | None:
                 break
         else:
             result = None
+    if result is None:
+        # one last try: find an android folder looking at path on the sys.path taking adopted storage paths into
+        # account
+        pattern = re.compile(r"/mnt/expand/[a-fA-F0-9-]{36}/(data|user/\d+)/(.+)/files")
+        for path in sys.path:
+            if pattern.match(path):
+                result = path.split("/files")[0]
+                break
+        else:
+            result = None
     return result
 
 
@@ -104,17 +169,81 @@ def _android_documents_folder() -> str:
     """:return: documents folder for the Android OS"""
     # Get directories with pyjnius
     try:
-        from jnius import autoclass
+        from jnius import autoclass  # noqa: PLC0415
 
-        Context = autoclass("android.content.Context")  # noqa: N806
-        Environment = autoclass("android.os.Environment")  # noqa: N806
-        documents_dir: str = Context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath()
-    except Exception:
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        documents_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOCUMENTS).getAbsolutePath()
+    except Exception:  # noqa: BLE001
         documents_dir = "/storage/emulated/0/Documents"
 
     return documents_dir
 
 
+@lru_cache(maxsize=1)
+def _android_downloads_folder() -> str:
+    """:return: downloads folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        downloads_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOWNLOADS).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        downloads_dir = "/storage/emulated/0/Downloads"
+
+    return downloads_dir
+
+
+@lru_cache(maxsize=1)
+def _android_pictures_folder() -> str:
+    """:return: pictures folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        pictures_dir: str = context.getExternalFilesDir(environment.DIRECTORY_PICTURES).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        pictures_dir = "/storage/emulated/0/Pictures"
+
+    return pictures_dir
+
+
+@lru_cache(maxsize=1)
+def _android_videos_folder() -> str:
+    """:return: videos folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        videos_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DCIM).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        videos_dir = "/storage/emulated/0/DCIM/Camera"
+
+    return videos_dir
+
+
+@lru_cache(maxsize=1)
+def _android_music_folder() -> str:
+    """:return: music folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        music_dir: str = context.getExternalFilesDir(environment.DIRECTORY_MUSIC).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        music_dir = "/storage/emulated/0/Music"
+
+    return music_dir
+
+
 __all__ = [
     "Android",
 ]
diff --git a/pkg_resources/_vendor/platformdirs/api.py b/pkg_resources/_vendor/platformdirs/api.py
index 6f6e2c2c69..c50caa648a 100644
--- a/pkg_resources/_vendor/platformdirs/api.py
+++ b/pkg_resources/_vendor/platformdirs/api.py
@@ -1,28 +1,29 @@
+"""Base API."""
+
 from __future__ import annotations
 
 import os
-import sys
 from abc import ABC, abstractmethod
 from pathlib import Path
+from typing import TYPE_CHECKING
 
-if sys.version_info >= (3, 8):  # pragma: no branch
-    from typing import Literal  # pragma: no cover
+if TYPE_CHECKING:
+    from typing import Iterator, Literal
 
 
-class PlatformDirsABC(ABC):
-    """
-    Abstract base class for platform directories.
-    """
+class PlatformDirsABC(ABC):  # noqa: PLR0904
+    """Abstract base class for platform directories."""
 
-    def __init__(
+    def __init__(  # noqa: PLR0913, PLR0917
         self,
         appname: str | None = None,
         appauthor: str | None | Literal[False] = None,
         version: str | None = None,
-        roaming: bool = False,
-        multipath: bool = False,
-        opinion: bool = True,
-    ):
+        roaming: bool = False,  # noqa: FBT001, FBT002
+        multipath: bool = False,  # noqa: FBT001, FBT002
+        opinion: bool = True,  # noqa: FBT001, FBT002
+        ensure_exists: bool = False,  # noqa: FBT001, FBT002
+    ) -> None:
         """
         Create a new platform directory.
 
@@ -32,30 +33,49 @@ def __init__(
         :param roaming: See `roaming`.
         :param multipath: See `multipath`.
         :param opinion: See `opinion`.
+        :param ensure_exists: See `ensure_exists`.
+
         """
         self.appname = appname  #: The name of application.
         self.appauthor = appauthor
         """
-        The name of the app author or distributing body for this application. Typically, it is the owning company name.
-        Defaults to `appname`. You may pass ``False`` to disable it.
+        The name of the app author or distributing body for this application.
+
+        Typically, it is the owning company name. Defaults to `appname`. You may pass ``False`` to disable it.
+
         """
         self.version = version
         """
-        An optional version path element to append to the path. You might want to use this if you want multiple versions
-        of your app to be able to run independently. If used, this would typically be ``.``.
+        An optional version path element to append to the path.
+
+        You might want to use this if you want multiple versions of your app to be able to run independently. If used,
+        this would typically be ``.``.
+
         """
         self.roaming = roaming
         """
-        Whether to use the roaming appdata directory on Windows. That means that for users on a Windows network setup
-        for roaming profiles, this user data will be synced on login (see
-        `here `_).
+        Whether to use the roaming appdata directory on Windows.
+
+        That means that for users on a Windows network setup for roaming profiles, this user data will be synced on
+        login (see
+        `here `_).
+
         """
         self.multipath = multipath
         """
-        An optional parameter only applicable to Unix/Linux which indicates that the entire list of data dirs should be
-        returned. By default, the first item would only be returned.
+        An optional parameter which indicates that the entire list of data dirs should be returned.
+
+        By default, the first item would only be returned.
+
         """
         self.opinion = opinion  #: A flag to indicating to use opinionated values.
+        self.ensure_exists = ensure_exists
+        """
+        Optionally create the directory (and any missing parents) upon access if it does not exist.
+
+        By default, no directories are created.
+
+        """
 
     def _append_app_name_and_version(self, *base: str) -> str:
         params = list(base[1:])
@@ -63,7 +83,13 @@ def _append_app_name_and_version(self, *base: str) -> str:
             params.append(self.appname)
             if self.version:
                 params.append(self.version)
-        return os.path.join(base[0], *params)
+        path = os.path.join(base[0], *params)  # noqa: PTH118
+        self._optionally_create_directory(path)
+        return path
+
+    def _optionally_create_directory(self, path: str) -> None:
+        if self.ensure_exists:
+            Path(path).mkdir(parents=True, exist_ok=True)
 
     @property
     @abstractmethod
@@ -90,6 +116,11 @@ def site_config_dir(self) -> str:
     def user_cache_dir(self) -> str:
         """:return: cache directory tied to the user"""
 
+    @property
+    @abstractmethod
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users"""
+
     @property
     @abstractmethod
     def user_state_dir(self) -> str:
@@ -105,11 +136,41 @@ def user_log_dir(self) -> str:
     def user_documents_dir(self) -> str:
         """:return: documents directory tied to the user"""
 
+    @property
+    @abstractmethod
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user"""
+
     @property
     @abstractmethod
     def user_runtime_dir(self) -> str:
         """:return: runtime directory tied to the user"""
 
+    @property
+    @abstractmethod
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users"""
+
     @property
     def user_data_path(self) -> Path:
         """:return: data path tied to the user"""
@@ -135,6 +196,11 @@ def user_cache_path(self) -> Path:
         """:return: cache path tied to the user"""
         return Path(self.user_cache_dir)
 
+    @property
+    def site_cache_path(self) -> Path:
+        """:return: cache path shared by users"""
+        return Path(self.site_cache_dir)
+
     @property
     def user_state_path(self) -> Path:
         """:return: state path tied to the user"""
@@ -147,10 +213,80 @@ def user_log_path(self) -> Path:
 
     @property
     def user_documents_path(self) -> Path:
-        """:return: documents path tied to the user"""
+        """:return: documents a path tied to the user"""
         return Path(self.user_documents_dir)
 
+    @property
+    def user_downloads_path(self) -> Path:
+        """:return: downloads path tied to the user"""
+        return Path(self.user_downloads_dir)
+
+    @property
+    def user_pictures_path(self) -> Path:
+        """:return: pictures path tied to the user"""
+        return Path(self.user_pictures_dir)
+
+    @property
+    def user_videos_path(self) -> Path:
+        """:return: videos path tied to the user"""
+        return Path(self.user_videos_dir)
+
+    @property
+    def user_music_path(self) -> Path:
+        """:return: music path tied to the user"""
+        return Path(self.user_music_dir)
+
+    @property
+    def user_desktop_path(self) -> Path:
+        """:return: desktop path tied to the user"""
+        return Path(self.user_desktop_dir)
+
     @property
     def user_runtime_path(self) -> Path:
         """:return: runtime path tied to the user"""
         return Path(self.user_runtime_dir)
+
+    @property
+    def site_runtime_path(self) -> Path:
+        """:return: runtime path shared by users"""
+        return Path(self.site_runtime_dir)
+
+    def iter_config_dirs(self) -> Iterator[str]:
+        """:yield: all user and site configuration directories."""
+        yield self.user_config_dir
+        yield self.site_config_dir
+
+    def iter_data_dirs(self) -> Iterator[str]:
+        """:yield: all user and site data directories."""
+        yield self.user_data_dir
+        yield self.site_data_dir
+
+    def iter_cache_dirs(self) -> Iterator[str]:
+        """:yield: all user and site cache directories."""
+        yield self.user_cache_dir
+        yield self.site_cache_dir
+
+    def iter_runtime_dirs(self) -> Iterator[str]:
+        """:yield: all user and site runtime directories."""
+        yield self.user_runtime_dir
+        yield self.site_runtime_dir
+
+    def iter_config_paths(self) -> Iterator[Path]:
+        """:yield: all user and site configuration paths."""
+        for path in self.iter_config_dirs():
+            yield Path(path)
+
+    def iter_data_paths(self) -> Iterator[Path]:
+        """:yield: all user and site data paths."""
+        for path in self.iter_data_dirs():
+            yield Path(path)
+
+    def iter_cache_paths(self) -> Iterator[Path]:
+        """:yield: all user and site cache paths."""
+        for path in self.iter_cache_dirs():
+            yield Path(path)
+
+    def iter_runtime_paths(self) -> Iterator[Path]:
+        """:yield: all user and site runtime paths."""
+        for path in self.iter_runtime_dirs():
+            yield Path(path)
diff --git a/pkg_resources/_vendor/platformdirs/macos.py b/pkg_resources/_vendor/platformdirs/macos.py
index a01337c776..eb1ba5df1d 100644
--- a/pkg_resources/_vendor/platformdirs/macos.py
+++ b/pkg_resources/_vendor/platformdirs/macos.py
@@ -1,42 +1,78 @@
+"""macOS."""
+
 from __future__ import annotations
 
-import os
+import os.path
+import sys
 
 from .api import PlatformDirsABC
 
 
 class MacOS(PlatformDirsABC):
     """
-    Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
-    `_.
-    Makes use of the `appname ` and
-    `version `.
+    Platform directories for the macOS operating system.
+
+    Follows the guidance from
+    `Apple documentation `_.
+    Makes use of the `appname `,
+    `version `,
+    `ensure_exists `.
+
     """
 
     @property
     def user_data_dir(self) -> str:
         """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support/"))
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support"))  # noqa: PTH111
 
     @property
     def site_data_dir(self) -> str:
-        """:return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``"""
-        return self._append_app_name_and_version("/Library/Application Support")
+        """
+        :return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``.
+          If we're using a Python binary managed by `Homebrew `_, the directory
+          will be under the Homebrew prefix, e.g. ``/opt/homebrew/share/$appname/$version``.
+          If `multipath ` is enabled, and we're in Homebrew,
+          the response is a multi-path string separated by ":", e.g.
+          ``/opt/homebrew/share/$appname/$version:/Library/Application Support/$appname/$version``
+        """
+        is_homebrew = sys.prefix.startswith("/opt/homebrew")
+        path_list = [self._append_app_name_and_version("/opt/homebrew/share")] if is_homebrew else []
+        path_list.append(self._append_app_name_and_version("/Library/Application Support"))
+        if self.multipath:
+            return os.pathsep.join(path_list)
+        return path_list[0]
 
     @property
     def user_config_dir(self) -> str:
-        """:return: config directory tied to the user, e.g. ``~/Library/Preferences/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Preferences/"))
+        """:return: config directory tied to the user, same as `user_data_dir`"""
+        return self.user_data_dir
 
     @property
     def site_config_dir(self) -> str:
-        """:return: config directory shared by the users, e.g. ``/Library/Preferences/$appname``"""
-        return self._append_app_name_and_version("/Library/Preferences")
+        """:return: config directory shared by the users, same as `site_data_dir`"""
+        return self.site_data_dir
 
     @property
     def user_cache_dir(self) -> str:
         """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))  # noqa: PTH111
+
+    @property
+    def site_cache_dir(self) -> str:
+        """
+        :return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``.
+          If we're using a Python binary managed by `Homebrew `_, the directory
+          will be under the Homebrew prefix, e.g. ``/opt/homebrew/var/cache/$appname/$version``.
+          If `multipath ` is enabled, and we're in Homebrew,
+          the response is a multi-path string separated by ":", e.g.
+          ``/opt/homebrew/var/cache/$appname/$version:/Library/Caches/$appname/$version``
+        """
+        is_homebrew = sys.prefix.startswith("/opt/homebrew")
+        path_list = [self._append_app_name_and_version("/opt/homebrew/var/cache")] if is_homebrew else []
+        path_list.append(self._append_app_name_and_version("/Library/Caches"))
+        if self.multipath:
+            return os.pathsep.join(path_list)
+        return path_list[0]
 
     @property
     def user_state_dir(self) -> str:
@@ -46,17 +82,47 @@ def user_state_dir(self) -> str:
     @property
     def user_log_dir(self) -> str:
         """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))  # noqa: PTH111
 
     @property
     def user_documents_dir(self) -> str:
         """:return: documents directory tied to the user, e.g. ``~/Documents``"""
-        return os.path.expanduser("~/Documents")
+        return os.path.expanduser("~/Documents")  # noqa: PTH111
+
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
+        return os.path.expanduser("~/Downloads")  # noqa: PTH111
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
+        return os.path.expanduser("~/Pictures")  # noqa: PTH111
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user, e.g. ``~/Movies``"""
+        return os.path.expanduser("~/Movies")  # noqa: PTH111
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user, e.g. ``~/Music``"""
+        return os.path.expanduser("~/Music")  # noqa: PTH111
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
+        return os.path.expanduser("~/Desktop")  # noqa: PTH111
 
     @property
     def user_runtime_dir(self) -> str:
         """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))  # noqa: PTH111
+
+    @property
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
+        return self.user_runtime_dir
 
 
 __all__ = [
diff --git a/pkg_resources/_vendor/platformdirs/unix.py b/pkg_resources/_vendor/platformdirs/unix.py
index 9aca5a0305..9500ade614 100644
--- a/pkg_resources/_vendor/platformdirs/unix.py
+++ b/pkg_resources/_vendor/platformdirs/unix.py
@@ -1,30 +1,36 @@
+"""Unix."""
+
 from __future__ import annotations
 
 import os
 import sys
 from configparser import ConfigParser
 from pathlib import Path
+from typing import Iterator, NoReturn
 
 from .api import PlatformDirsABC
 
-if sys.platform.startswith("linux"):  # pragma: no branch # no op check, only to please the type checker
-    from os import getuid
-else:
+if sys.platform == "win32":
+
+    def getuid() -> NoReturn:
+        msg = "should only be used on Unix"
+        raise RuntimeError(msg)
 
-    def getuid() -> int:
-        raise RuntimeError("should only be used on Linux")
+else:
+    from os import getuid
 
 
-class Unix(PlatformDirsABC):
+class Unix(PlatformDirsABC):  # noqa: PLR0904
     """
-    On Unix/Linux, we follow the
-    `XDG Basedir Spec `_. The spec allows
-    overriding directories with environment variables. The examples show are the default values, alongside the name of
-    the environment variable that overrides them. Makes use of the
-    `appname `,
-    `version `,
-    `multipath `,
-    `opinion `.
+    On Unix/Linux, we follow the `XDG Basedir Spec `_.
+
+    The spec allows overriding directories with environment variables. The examples shown are the default values,
+    alongside the name of the environment variable that overrides them. Makes use of the `appname
+    `, `version `, `multipath
+    `, `opinion `, `ensure_exists
+    `.
+
     """
 
     @property
@@ -35,28 +41,28 @@ def user_data_dir(self) -> str:
         """
         path = os.environ.get("XDG_DATA_HOME", "")
         if not path.strip():
-            path = os.path.expanduser("~/.local/share")
+            path = os.path.expanduser("~/.local/share")  # noqa: PTH111
         return self._append_app_name_and_version(path)
 
+    @property
+    def _site_data_dirs(self) -> list[str]:
+        path = os.environ.get("XDG_DATA_DIRS", "")
+        if not path.strip():
+            path = f"/usr/local/share{os.pathsep}/usr/share"
+        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]
+
     @property
     def site_data_dir(self) -> str:
         """
         :return: data directories shared by users (if `multipath ` is
-         enabled and ``XDG_DATA_DIR`` is set and a multi path the response is also a multi path separated by the OS
-         path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
+         enabled and ``XDG_DATA_DIRS`` is set and a multi path the response is also a multi path separated by the
+         OS path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
         """
         # XDG default for $XDG_DATA_DIRS; only first, if multipath is False
-        path = os.environ.get("XDG_DATA_DIRS", "")
-        if not path.strip():
-            path = f"/usr/local/share{os.pathsep}/usr/share"
-        return self._with_multi_path(path)
-
-    def _with_multi_path(self, path: str) -> str:
-        path_list = path.split(os.pathsep)
+        dirs = self._site_data_dirs
         if not self.multipath:
-            path_list = path_list[0:1]
-        path_list = [self._append_app_name_and_version(os.path.expanduser(p)) for p in path_list]
-        return os.pathsep.join(path_list)
+            return dirs[0]
+        return os.pathsep.join(dirs)
 
     @property
     def user_config_dir(self) -> str:
@@ -66,21 +72,28 @@ def user_config_dir(self) -> str:
         """
         path = os.environ.get("XDG_CONFIG_HOME", "")
         if not path.strip():
-            path = os.path.expanduser("~/.config")
+            path = os.path.expanduser("~/.config")  # noqa: PTH111
         return self._append_app_name_and_version(path)
 
+    @property
+    def _site_config_dirs(self) -> list[str]:
+        path = os.environ.get("XDG_CONFIG_DIRS", "")
+        if not path.strip():
+            path = "/etc/xdg"
+        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]
+
     @property
     def site_config_dir(self) -> str:
         """
         :return: config directories shared by users (if `multipath `
-         is enabled and ``XDG_DATA_DIR`` is set and a multi path the response is also a multi path separated by the OS
-         path separator), e.g. ``/etc/xdg/$appname/$version``
+         is enabled and ``XDG_CONFIG_DIRS`` is set and a multi path the response is also a multi path separated by
+         the OS path separator), e.g. ``/etc/xdg/$appname/$version``
         """
         # XDG default for $XDG_CONFIG_DIRS only first, if multipath is False
-        path = os.environ.get("XDG_CONFIG_DIRS", "")
-        if not path.strip():
-            path = "/etc/xdg"
-        return self._with_multi_path(path)
+        dirs = self._site_config_dirs
+        if not self.multipath:
+            return dirs[0]
+        return os.pathsep.join(dirs)
 
     @property
     def user_cache_dir(self) -> str:
@@ -90,9 +103,14 @@ def user_cache_dir(self) -> str:
         """
         path = os.environ.get("XDG_CACHE_HOME", "")
         if not path.strip():
-            path = os.path.expanduser("~/.cache")
+            path = os.path.expanduser("~/.cache")  # noqa: PTH111
         return self._append_app_name_and_version(path)
 
+    @property
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``"""
+        return self._append_app_name_and_version("/var/cache")
+
     @property
     def user_state_dir(self) -> str:
         """
@@ -101,67 +119,144 @@ def user_state_dir(self) -> str:
         """
         path = os.environ.get("XDG_STATE_HOME", "")
         if not path.strip():
-            path = os.path.expanduser("~/.local/state")
+            path = os.path.expanduser("~/.local/state")  # noqa: PTH111
         return self._append_app_name_and_version(path)
 
     @property
     def user_log_dir(self) -> str:
-        """
-        :return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it
-        """
+        """:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it"""
         path = self.user_state_dir
         if self.opinion:
-            path = os.path.join(path, "log")
+            path = os.path.join(path, "log")  # noqa: PTH118
+            self._optionally_create_directory(path)
         return path
 
     @property
     def user_documents_dir(self) -> str:
-        """
-        :return: documents directory tied to the user, e.g. ``~/Documents``
-        """
-        documents_dir = _get_user_dirs_folder("XDG_DOCUMENTS_DIR")
-        if documents_dir is None:
-            documents_dir = os.environ.get("XDG_DOCUMENTS_DIR", "").strip()
-            if not documents_dir:
-                documents_dir = os.path.expanduser("~/Documents")
+        """:return: documents directory tied to the user, e.g. ``~/Documents``"""
+        return _get_user_media_dir("XDG_DOCUMENTS_DIR", "~/Documents")
 
-        return documents_dir
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
+        return _get_user_media_dir("XDG_DOWNLOAD_DIR", "~/Downloads")
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
+        return _get_user_media_dir("XDG_PICTURES_DIR", "~/Pictures")
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user, e.g. ``~/Videos``"""
+        return _get_user_media_dir("XDG_VIDEOS_DIR", "~/Videos")
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user, e.g. ``~/Music``"""
+        return _get_user_media_dir("XDG_MUSIC_DIR", "~/Music")
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
+        return _get_user_media_dir("XDG_DESKTOP_DIR", "~/Desktop")
 
     @property
     def user_runtime_dir(self) -> str:
         """
         :return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or
-         ``$XDG_RUNTIME_DIR/$appname/$version``
+         ``$XDG_RUNTIME_DIR/$appname/$version``.
+
+         For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/user/$(id -u)/$appname/$version`` if
+         exists, otherwise ``/tmp/runtime-$(id -u)/$appname/$version``, if``$XDG_RUNTIME_DIR``
+         is not set.
+        """
+        path = os.environ.get("XDG_RUNTIME_DIR", "")
+        if not path.strip():
+            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
+                path = f"/var/run/user/{getuid()}"
+                if not Path(path).exists():
+                    path = f"/tmp/runtime-{getuid()}"  # noqa: S108
+            else:
+                path = f"/run/user/{getuid()}"
+        return self._append_app_name_and_version(path)
+
+    @property
+    def site_runtime_dir(self) -> str:
+        """
+        :return: runtime directory shared by users, e.g. ``/run/$appname/$version`` or \
+        ``$XDG_RUNTIME_DIR/$appname/$version``.
+
+        Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will
+        fall back to paths associated to the root user instead of a regular logged-in user if it's not set.
+
+        If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir`
+        instead.
+
+        For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set.
         """
         path = os.environ.get("XDG_RUNTIME_DIR", "")
         if not path.strip():
-            path = f"/run/user/{getuid()}"
+            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
+                path = "/var/run"
+            else:
+                path = "/run"
         return self._append_app_name_and_version(path)
 
     @property
     def site_data_path(self) -> Path:
-        """:return: data path shared by users. Only return first item, even if ``multipath`` is set to ``True``"""
+        """:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
         return self._first_item_as_path_if_multipath(self.site_data_dir)
 
     @property
     def site_config_path(self) -> Path:
-        """:return: config path shared by the users. Only return first item, even if ``multipath`` is set to ``True``"""
+        """:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``"""
         return self._first_item_as_path_if_multipath(self.site_config_dir)
 
+    @property
+    def site_cache_path(self) -> Path:
+        """:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
+        return self._first_item_as_path_if_multipath(self.site_cache_dir)
+
     def _first_item_as_path_if_multipath(self, directory: str) -> Path:
         if self.multipath:
             # If multipath is True, the first path is returned.
             directory = directory.split(os.pathsep)[0]
         return Path(directory)
 
+    def iter_config_dirs(self) -> Iterator[str]:
+        """:yield: all user and site configuration directories."""
+        yield self.user_config_dir
+        yield from self._site_config_dirs
+
+    def iter_data_dirs(self) -> Iterator[str]:
+        """:yield: all user and site data directories."""
+        yield self.user_data_dir
+        yield from self._site_data_dirs
+
+
+def _get_user_media_dir(env_var: str, fallback_tilde_path: str) -> str:
+    media_dir = _get_user_dirs_folder(env_var)
+    if media_dir is None:
+        media_dir = os.environ.get(env_var, "").strip()
+        if not media_dir:
+            media_dir = os.path.expanduser(fallback_tilde_path)  # noqa: PTH111
+
+    return media_dir
+
 
 def _get_user_dirs_folder(key: str) -> str | None:
-    """Return directory from user-dirs.dirs config file. See https://freedesktop.org/wiki/Software/xdg-user-dirs/"""
-    user_dirs_config_path = os.path.join(Unix().user_config_dir, "user-dirs.dirs")
-    if os.path.exists(user_dirs_config_path):
+    """
+    Return directory from user-dirs.dirs config file.
+
+    See https://freedesktop.org/wiki/Software/xdg-user-dirs/.
+
+    """
+    user_dirs_config_path = Path(Unix().user_config_dir) / "user-dirs.dirs"
+    if user_dirs_config_path.exists():
         parser = ConfigParser()
 
-        with open(user_dirs_config_path) as stream:
+        with user_dirs_config_path.open() as stream:
             # Add fake section header, so ConfigParser doesn't complain
             parser.read_string(f"[top]\n{stream.read()}")
 
@@ -170,8 +265,7 @@ def _get_user_dirs_folder(key: str) -> str | None:
 
         path = parser["top"][key].strip('"')
         # Handle relative home paths
-        path = path.replace("$HOME", os.path.expanduser("~"))
-        return path
+        return path.replace("$HOME", os.path.expanduser("~"))  # noqa: PTH111
 
     return None
 
diff --git a/pkg_resources/_vendor/platformdirs/version.py b/pkg_resources/_vendor/platformdirs/version.py
index 9f6eb98e8f..6483ddce0b 100644
--- a/pkg_resources/_vendor/platformdirs/version.py
+++ b/pkg_resources/_vendor/platformdirs/version.py
@@ -1,4 +1,16 @@
 # file generated by setuptools_scm
 # don't change, don't track in version control
-__version__ = version = '2.6.2'
-__version_tuple__ = version_tuple = (2, 6, 2)
+TYPE_CHECKING = False
+if TYPE_CHECKING:
+    from typing import Tuple, Union
+    VERSION_TUPLE = Tuple[Union[int, str], ...]
+else:
+    VERSION_TUPLE = object
+
+version: str
+__version__: str
+__version_tuple__: VERSION_TUPLE
+version_tuple: VERSION_TUPLE
+
+__version__ = version = '4.2.2'
+__version_tuple__ = version_tuple = (4, 2, 2)
diff --git a/pkg_resources/_vendor/platformdirs/windows.py b/pkg_resources/_vendor/platformdirs/windows.py
index d5c27b3414..d7bc96091a 100644
--- a/pkg_resources/_vendor/platformdirs/windows.py
+++ b/pkg_resources/_vendor/platformdirs/windows.py
@@ -1,23 +1,28 @@
+"""Windows."""
+
 from __future__ import annotations
 
-import ctypes
 import os
 import sys
 from functools import lru_cache
-from typing import Callable
+from typing import TYPE_CHECKING
 
 from .api import PlatformDirsABC
 
+if TYPE_CHECKING:
+    from collections.abc import Callable
+
 
 class Windows(PlatformDirsABC):
-    """`MSDN on where to store app data files
-    `_.
-    Makes use of the
-    `appname `,
-    `appauthor `,
-    `version `,
-    `roaming `,
-    `opinion `."""
+    """
+    `MSDN on where to store app data files `_.
+
+    Makes use of the `appname `, `appauthor
+    `, `version `, `roaming
+    `, `opinion `, `ensure_exists
+    `.
+
+    """
 
     @property
     def user_data_dir(self) -> str:
@@ -41,7 +46,9 @@ def _append_parts(self, path: str, *, opinion_value: str | None = None) -> str:
                 params.append(opinion_value)
             if self.version:
                 params.append(self.version)
-        return os.path.join(path, *params)
+        path = os.path.join(path, *params)  # noqa: PTH118
+        self._optionally_create_directory(path)
+        return path
 
     @property
     def site_data_dir(self) -> str:
@@ -68,6 +75,12 @@ def user_cache_dir(self) -> str:
         path = os.path.normpath(get_win_folder("CSIDL_LOCAL_APPDATA"))
         return self._append_parts(path, opinion_value="Cache")
 
+    @property
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname\\Cache\\$version``"""
+        path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
+        return self._append_parts(path, opinion_value="Cache")
+
     @property
     def user_state_dir(self) -> str:
         """:return: state directory tied to the user, same as `user_data_dir`"""
@@ -75,35 +88,63 @@ def user_state_dir(self) -> str:
 
     @property
     def user_log_dir(self) -> str:
-        """
-        :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it
-        """
+        """:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it"""
         path = self.user_data_dir
         if self.opinion:
-            path = os.path.join(path, "Logs")
+            path = os.path.join(path, "Logs")  # noqa: PTH118
+            self._optionally_create_directory(path)
         return path
 
     @property
     def user_documents_dir(self) -> str:
-        """
-        :return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``
-        """
+        """:return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``"""
         return os.path.normpath(get_win_folder("CSIDL_PERSONAL"))
 
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user e.g. ``%USERPROFILE%\\Downloads``"""
+        return os.path.normpath(get_win_folder("CSIDL_DOWNLOADS"))
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user e.g. ``%USERPROFILE%\\Pictures``"""
+        return os.path.normpath(get_win_folder("CSIDL_MYPICTURES"))
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user e.g. ``%USERPROFILE%\\Videos``"""
+        return os.path.normpath(get_win_folder("CSIDL_MYVIDEO"))
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user e.g. ``%USERPROFILE%\\Music``"""
+        return os.path.normpath(get_win_folder("CSIDL_MYMUSIC"))
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\\Desktop``"""
+        return os.path.normpath(get_win_folder("CSIDL_DESKTOPDIRECTORY"))
+
     @property
     def user_runtime_dir(self) -> str:
         """
         :return: runtime directory tied to the user, e.g.
          ``%USERPROFILE%\\AppData\\Local\\Temp\\$appauthor\\$appname``
         """
-        path = os.path.normpath(os.path.join(get_win_folder("CSIDL_LOCAL_APPDATA"), "Temp"))
+        path = os.path.normpath(os.path.join(get_win_folder("CSIDL_LOCAL_APPDATA"), "Temp"))  # noqa: PTH118
         return self._append_parts(path)
 
+    @property
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
+        return self.user_runtime_dir
+
 
 def get_win_folder_from_env_vars(csidl_name: str) -> str:
     """Get folder from environment variables."""
-    if csidl_name == "CSIDL_PERSONAL":  # does not have an environment name
-        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Documents")
+    result = get_win_folder_if_csidl_name_not_env_var(csidl_name)
+    if result is not None:
+        return result
 
     env_var_name = {
         "CSIDL_APPDATA": "APPDATA",
@@ -111,31 +152,58 @@ def get_win_folder_from_env_vars(csidl_name: str) -> str:
         "CSIDL_LOCAL_APPDATA": "LOCALAPPDATA",
     }.get(csidl_name)
     if env_var_name is None:
-        raise ValueError(f"Unknown CSIDL name: {csidl_name}")
+        msg = f"Unknown CSIDL name: {csidl_name}"
+        raise ValueError(msg)
     result = os.environ.get(env_var_name)
     if result is None:
-        raise ValueError(f"Unset environment variable: {env_var_name}")
+        msg = f"Unset environment variable: {env_var_name}"
+        raise ValueError(msg)
     return result
 
 
+def get_win_folder_if_csidl_name_not_env_var(csidl_name: str) -> str | None:
+    """Get a folder for a CSIDL name that does not exist as an environment variable."""
+    if csidl_name == "CSIDL_PERSONAL":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Documents")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_DOWNLOADS":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Downloads")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_MYPICTURES":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Pictures")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_MYVIDEO":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Videos")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_MYMUSIC":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Music")  # noqa: PTH118
+    return None
+
+
 def get_win_folder_from_registry(csidl_name: str) -> str:
-    """Get folder from the registry.
+    """
+    Get folder from the registry.
+
+    This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer
+    for all CSIDL_* names.
 
-    This is a fallback technique at best. I'm not sure if using the
-    registry for this guarantees us the correct answer for all CSIDL_*
-    names.
     """
     shell_folder_name = {
         "CSIDL_APPDATA": "AppData",
         "CSIDL_COMMON_APPDATA": "Common AppData",
         "CSIDL_LOCAL_APPDATA": "Local AppData",
         "CSIDL_PERSONAL": "Personal",
+        "CSIDL_DOWNLOADS": "{374DE290-123F-4565-9164-39C4925E467B}",
+        "CSIDL_MYPICTURES": "My Pictures",
+        "CSIDL_MYVIDEO": "My Video",
+        "CSIDL_MYMUSIC": "My Music",
     }.get(csidl_name)
     if shell_folder_name is None:
-        raise ValueError(f"Unknown CSIDL name: {csidl_name}")
+        msg = f"Unknown CSIDL name: {csidl_name}"
+        raise ValueError(msg)
     if sys.platform != "win32":  # only needed for mypy type checker to know that this code runs only on Windows
         raise NotImplementedError
-    import winreg
+    import winreg  # noqa: PLC0415
 
     key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
     directory, _ = winreg.QueryValueEx(key, shell_folder_name)
@@ -144,33 +212,53 @@ def get_win_folder_from_registry(csidl_name: str) -> str:
 
 def get_win_folder_via_ctypes(csidl_name: str) -> str:
     """Get folder with ctypes."""
+    # There is no 'CSIDL_DOWNLOADS'.
+    # Use 'CSIDL_PROFILE' (40) and append the default folder 'Downloads' instead.
+    # https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid
+
+    import ctypes  # noqa: PLC0415
+
     csidl_const = {
         "CSIDL_APPDATA": 26,
         "CSIDL_COMMON_APPDATA": 35,
         "CSIDL_LOCAL_APPDATA": 28,
         "CSIDL_PERSONAL": 5,
+        "CSIDL_MYPICTURES": 39,
+        "CSIDL_MYVIDEO": 14,
+        "CSIDL_MYMUSIC": 13,
+        "CSIDL_DOWNLOADS": 40,
+        "CSIDL_DESKTOPDIRECTORY": 16,
     }.get(csidl_name)
     if csidl_const is None:
-        raise ValueError(f"Unknown CSIDL name: {csidl_name}")
+        msg = f"Unknown CSIDL name: {csidl_name}"
+        raise ValueError(msg)
 
     buf = ctypes.create_unicode_buffer(1024)
     windll = getattr(ctypes, "windll")  # noqa: B009 # using getattr to avoid false positive with mypy type checker
     windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
 
-    # Downgrade to short path name if it has highbit chars.
-    if any(ord(c) > 255 for c in buf):
+    # Downgrade to short path name if it has high-bit chars.
+    if any(ord(c) > 255 for c in buf):  # noqa: PLR2004
         buf2 = ctypes.create_unicode_buffer(1024)
         if windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
             buf = buf2
 
+    if csidl_name == "CSIDL_DOWNLOADS":
+        return os.path.join(buf.value, "Downloads")  # noqa: PTH118
+
     return buf.value
 
 
 def _pick_get_win_folder() -> Callable[[str], str]:
-    if hasattr(ctypes, "windll"):
-        return get_win_folder_via_ctypes
     try:
-        import winreg  # noqa: F401
+        import ctypes  # noqa: PLC0415
+    except ImportError:
+        pass
+    else:
+        if hasattr(ctypes, "windll"):
+            return get_win_folder_via_ctypes
+    try:
+        import winreg  # noqa: PLC0415, F401
     except ImportError:
         return get_win_folder_from_env_vars
     else:
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE
new file mode 100644
index 0000000000..07806f8af9
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE
@@ -0,0 +1,19 @@
+This is the MIT license: http://www.opensource.org/licenses/mit-license.php
+
+Copyright (c) Alex Grönholm
+
+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/pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA
new file mode 100644
index 0000000000..6e5750b485
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA
@@ -0,0 +1,81 @@
+Metadata-Version: 2.1
+Name: typeguard
+Version: 4.3.0
+Summary: Run-time type checker for Python
+Author-email: Alex Grönholm 
+License: MIT
+Project-URL: Documentation, https://typeguard.readthedocs.io/en/latest/
+Project-URL: Change log, https://typeguard.readthedocs.io/en/latest/versionhistory.html
+Project-URL: Source code, https://github.com/agronholm/typeguard
+Project-URL: Issue tracker, https://github.com/agronholm/typeguard/issues
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+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
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: typing-extensions >=4.10.0
+Requires-Dist: importlib-metadata >=3.6 ; python_version < "3.10"
+Provides-Extra: doc
+Requires-Dist: packaging ; extra == 'doc'
+Requires-Dist: Sphinx >=7 ; extra == 'doc'
+Requires-Dist: sphinx-autodoc-typehints >=1.2.0 ; extra == 'doc'
+Requires-Dist: sphinx-rtd-theme >=1.3.0 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: coverage[toml] >=7 ; extra == 'test'
+Requires-Dist: pytest >=7 ; extra == 'test'
+Requires-Dist: mypy >=1.2.0 ; (platform_python_implementation != "PyPy") and extra == 'test'
+
+.. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg
+  :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml
+  :alt: Build Status
+.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github
+  :target: https://coveralls.io/github/agronholm/typeguard?branch=master
+  :alt: Code Coverage
+.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest
+  :target: https://typeguard.readthedocs.io/en/latest/?badge=latest
+  :alt: Documentation
+
+This library provides run-time type checking for functions defined with
+`PEP 484 `_ argument (and return) type
+annotations, and any arbitrary objects. It can be used together with static type
+checkers as an additional layer of type safety, to catch type violations that could only
+be detected at run time.
+
+Two principal ways to do type checking are provided:
+
+#. The ``check_type`` function:
+
+   * like ``isinstance()``, but supports arbitrary type annotations (within limits)
+   * can be used as a ``cast()`` replacement, but with actual checking of the value
+#. Code instrumentation:
+
+   * entire modules, or individual functions (via ``@typechecked``) are recompiled, with
+     type checking code injected into them
+   * automatically checks function arguments, return values and assignments to annotated
+     local variables
+   * for generator functions (regular and async), checks yield and send values
+   * requires the original source code of the instrumented module(s) to be accessible
+
+Two options are provided for code instrumentation:
+
+#. the ``@typechecked`` function:
+
+   * can be applied to functions individually
+#. the import hook (``typeguard.install_import_hook()``):
+
+   * automatically instruments targeted modules on import
+   * no manual code changes required in the target modules
+   * requires the import hook to be installed before the targeted modules are imported
+   * may clash with other import hooks
+
+See the documentation_ for further information.
+
+.. _documentation: https://typeguard.readthedocs.io/en/latest/
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD
new file mode 100644
index 0000000000..801e73347c
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD
@@ -0,0 +1,34 @@
+typeguard-4.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+typeguard-4.3.0.dist-info/LICENSE,sha256=YWP3mH37ONa8MgzitwsvArhivEESZRbVUu8c1DJH51g,1130
+typeguard-4.3.0.dist-info/METADATA,sha256=z2dcHAp0TwhYCFU5Deh8x31nazElgujUz9tbuP0pjSE,3717
+typeguard-4.3.0.dist-info/RECORD,,
+typeguard-4.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+typeguard-4.3.0.dist-info/entry_points.txt,sha256=qp7NQ1aLtiSgMQqo6gWlfGpy0IIXzoMJmeQTLpzqFZQ,48
+typeguard-4.3.0.dist-info/top_level.txt,sha256=4z28AhuDodwRS_c1J_l8H51t5QuwfTseskYzlxp6grs,10
+typeguard/__init__.py,sha256=Onh4w38elPCjtlcU3JY9k3h70NjsxXIkAflmQn-Z0FY,2071
+typeguard/__pycache__/__init__.cpython-312.pyc,,
+typeguard/__pycache__/_checkers.cpython-312.pyc,,
+typeguard/__pycache__/_config.cpython-312.pyc,,
+typeguard/__pycache__/_decorators.cpython-312.pyc,,
+typeguard/__pycache__/_exceptions.cpython-312.pyc,,
+typeguard/__pycache__/_functions.cpython-312.pyc,,
+typeguard/__pycache__/_importhook.cpython-312.pyc,,
+typeguard/__pycache__/_memo.cpython-312.pyc,,
+typeguard/__pycache__/_pytest_plugin.cpython-312.pyc,,
+typeguard/__pycache__/_suppression.cpython-312.pyc,,
+typeguard/__pycache__/_transformer.cpython-312.pyc,,
+typeguard/__pycache__/_union_transformer.cpython-312.pyc,,
+typeguard/__pycache__/_utils.cpython-312.pyc,,
+typeguard/_checkers.py,sha256=JRrgKicdOEfIBoNEtegYCEIlhpad-a1u1Em7GCj0WCI,31360
+typeguard/_config.py,sha256=nIz8QwDa-oFO3L9O8_6srzlmd99pSby2wOM4Wb7F_B0,2846
+typeguard/_decorators.py,sha256=v6dsIeWvPhExGLP_wXF-RmDUyjZf_Ak28g7gBJ_v0-0,9033
+typeguard/_exceptions.py,sha256=ZIPeiV-FBd5Emw2EaWd2Fvlsrwi4ocwT2fVGBIAtHcQ,1121
+typeguard/_functions.py,sha256=ibgSAKa5ptIm1eR9ARG0BSozAFJPFNASZqhPVyQeqig,10393
+typeguard/_importhook.py,sha256=ugjCDvFcdWMU7UugqlJG91IpVNpEIxtRr-99s0h1k7M,6389
+typeguard/_memo.py,sha256=1juQV_vxnD2JYKbSrebiQuj4oKHz6n67v9pYA-CCISg,1303
+typeguard/_pytest_plugin.py,sha256=-fcSqkv54rIfIF8pDavY5YQPkj4OX8GMt_lL7CQSD4I,4416
+typeguard/_suppression.py,sha256=VQfzxcwIbu3if0f7VBkKM7hkYOA7tNFw9a7jMBsmMg4,2266
+typeguard/_transformer.py,sha256=9Ha7_QhdwoUni_6hvdY-hZbuEergowHrNL2vzHIakFY,44937
+typeguard/_union_transformer.py,sha256=v_42r7-6HuRX2SoFwnyJ-E5PlxXpVeUJPJR1-HU9qSo,1354
+typeguard/_utils.py,sha256=5HhO1rPn5f1M6ymkVAEv7Xmlz1cX-j0OnTMlyHqqrR8,5270
+typeguard/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL
new file mode 100644
index 0000000000..bab98d6758
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
new file mode 100644
index 0000000000..47c9d0bd91
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
@@ -0,0 +1,2 @@
+[pytest11]
+typeguard = typeguard._pytest_plugin
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt
new file mode 100644
index 0000000000..be5ec23ea2
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+typeguard
diff --git a/pkg_resources/_vendor/typeguard/__init__.py b/pkg_resources/_vendor/typeguard/__init__.py
new file mode 100644
index 0000000000..6781cad094
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/__init__.py
@@ -0,0 +1,48 @@
+import os
+from typing import Any
+
+from ._checkers import TypeCheckerCallable as TypeCheckerCallable
+from ._checkers import TypeCheckLookupCallback as TypeCheckLookupCallback
+from ._checkers import check_type_internal as check_type_internal
+from ._checkers import checker_lookup_functions as checker_lookup_functions
+from ._checkers import load_plugins as load_plugins
+from ._config import CollectionCheckStrategy as CollectionCheckStrategy
+from ._config import ForwardRefPolicy as ForwardRefPolicy
+from ._config import TypeCheckConfiguration as TypeCheckConfiguration
+from ._decorators import typechecked as typechecked
+from ._decorators import typeguard_ignore as typeguard_ignore
+from ._exceptions import InstrumentationWarning as InstrumentationWarning
+from ._exceptions import TypeCheckError as TypeCheckError
+from ._exceptions import TypeCheckWarning as TypeCheckWarning
+from ._exceptions import TypeHintWarning as TypeHintWarning
+from ._functions import TypeCheckFailCallback as TypeCheckFailCallback
+from ._functions import check_type as check_type
+from ._functions import warn_on_error as warn_on_error
+from ._importhook import ImportHookManager as ImportHookManager
+from ._importhook import TypeguardFinder as TypeguardFinder
+from ._importhook import install_import_hook as install_import_hook
+from ._memo import TypeCheckMemo as TypeCheckMemo
+from ._suppression import suppress_type_checks as suppress_type_checks
+from ._utils import Unset as Unset
+
+# Re-export imports so they look like they live directly in this package
+for value in list(locals().values()):
+    if getattr(value, "__module__", "").startswith(f"{__name__}."):
+        value.__module__ = __name__
+
+
+config: TypeCheckConfiguration
+
+
+def __getattr__(name: str) -> Any:
+    if name == "config":
+        from ._config import global_config
+
+        return global_config
+
+    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
+
+# Automatically load checker lookup functions unless explicitly disabled
+if "TYPEGUARD_DISABLE_PLUGIN_AUTOLOAD" not in os.environ:
+    load_plugins()
diff --git a/pkg_resources/_vendor/typeguard/_checkers.py b/pkg_resources/_vendor/typeguard/_checkers.py
new file mode 100644
index 0000000000..67dd5ad4dc
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_checkers.py
@@ -0,0 +1,993 @@
+from __future__ import annotations
+
+import collections.abc
+import inspect
+import sys
+import types
+import typing
+import warnings
+from enum import Enum
+from inspect import Parameter, isclass, isfunction
+from io import BufferedIOBase, IOBase, RawIOBase, TextIOBase
+from textwrap import indent
+from typing import (
+    IO,
+    AbstractSet,
+    Any,
+    BinaryIO,
+    Callable,
+    Dict,
+    ForwardRef,
+    List,
+    Mapping,
+    MutableMapping,
+    NewType,
+    Optional,
+    Sequence,
+    Set,
+    TextIO,
+    Tuple,
+    Type,
+    TypeVar,
+    Union,
+)
+from unittest.mock import Mock
+from weakref import WeakKeyDictionary
+
+try:
+    import typing_extensions
+except ImportError:
+    typing_extensions = None  # type: ignore[assignment]
+
+# Must use this because typing.is_typeddict does not recognize
+# TypedDict from typing_extensions, and as of version 4.12.0
+# typing_extensions.TypedDict is different from typing.TypedDict
+# on all versions.
+from typing_extensions import is_typeddict
+
+from ._config import ForwardRefPolicy
+from ._exceptions import TypeCheckError, TypeHintWarning
+from ._memo import TypeCheckMemo
+from ._utils import evaluate_forwardref, get_stacklevel, get_type_name, qualified_name
+
+if sys.version_info >= (3, 11):
+    from typing import (
+        Annotated,
+        NotRequired,
+        TypeAlias,
+        get_args,
+        get_origin,
+    )
+
+    SubclassableAny = Any
+else:
+    from typing_extensions import (
+        Annotated,
+        NotRequired,
+        TypeAlias,
+        get_args,
+        get_origin,
+    )
+    from typing_extensions import Any as SubclassableAny
+
+if sys.version_info >= (3, 10):
+    from importlib.metadata import entry_points
+    from typing import ParamSpec
+else:
+    from importlib_metadata import entry_points
+    from typing_extensions import ParamSpec
+
+TypeCheckerCallable: TypeAlias = Callable[
+    [Any, Any, Tuple[Any, ...], TypeCheckMemo], Any
+]
+TypeCheckLookupCallback: TypeAlias = Callable[
+    [Any, Tuple[Any, ...], Tuple[Any, ...]], Optional[TypeCheckerCallable]
+]
+
+checker_lookup_functions: list[TypeCheckLookupCallback] = []
+generic_alias_types: tuple[type, ...] = (type(List), type(List[Any]))
+if sys.version_info >= (3, 9):
+    generic_alias_types += (types.GenericAlias,)
+
+protocol_check_cache: WeakKeyDictionary[
+    type[Any], dict[type[Any], TypeCheckError | None]
+] = WeakKeyDictionary()
+
+# Sentinel
+_missing = object()
+
+# Lifted from mypy.sharedparse
+BINARY_MAGIC_METHODS = {
+    "__add__",
+    "__and__",
+    "__cmp__",
+    "__divmod__",
+    "__div__",
+    "__eq__",
+    "__floordiv__",
+    "__ge__",
+    "__gt__",
+    "__iadd__",
+    "__iand__",
+    "__idiv__",
+    "__ifloordiv__",
+    "__ilshift__",
+    "__imatmul__",
+    "__imod__",
+    "__imul__",
+    "__ior__",
+    "__ipow__",
+    "__irshift__",
+    "__isub__",
+    "__itruediv__",
+    "__ixor__",
+    "__le__",
+    "__lshift__",
+    "__lt__",
+    "__matmul__",
+    "__mod__",
+    "__mul__",
+    "__ne__",
+    "__or__",
+    "__pow__",
+    "__radd__",
+    "__rand__",
+    "__rdiv__",
+    "__rfloordiv__",
+    "__rlshift__",
+    "__rmatmul__",
+    "__rmod__",
+    "__rmul__",
+    "__ror__",
+    "__rpow__",
+    "__rrshift__",
+    "__rshift__",
+    "__rsub__",
+    "__rtruediv__",
+    "__rxor__",
+    "__sub__",
+    "__truediv__",
+    "__xor__",
+}
+
+
+def check_callable(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not callable(value):
+        raise TypeCheckError("is not callable")
+
+    if args:
+        try:
+            signature = inspect.signature(value)
+        except (TypeError, ValueError):
+            return
+
+        argument_types = args[0]
+        if isinstance(argument_types, list) and not any(
+            type(item) is ParamSpec for item in argument_types
+        ):
+            # The callable must not have keyword-only arguments without defaults
+            unfulfilled_kwonlyargs = [
+                param.name
+                for param in signature.parameters.values()
+                if param.kind == Parameter.KEYWORD_ONLY
+                and param.default == Parameter.empty
+            ]
+            if unfulfilled_kwonlyargs:
+                raise TypeCheckError(
+                    f"has mandatory keyword-only arguments in its declaration: "
+                    f'{", ".join(unfulfilled_kwonlyargs)}'
+                )
+
+            num_positional_args = num_mandatory_pos_args = 0
+            has_varargs = False
+            for param in signature.parameters.values():
+                if param.kind in (
+                    Parameter.POSITIONAL_ONLY,
+                    Parameter.POSITIONAL_OR_KEYWORD,
+                ):
+                    num_positional_args += 1
+                    if param.default is Parameter.empty:
+                        num_mandatory_pos_args += 1
+                elif param.kind == Parameter.VAR_POSITIONAL:
+                    has_varargs = True
+
+            if num_mandatory_pos_args > len(argument_types):
+                raise TypeCheckError(
+                    f"has too many mandatory positional arguments in its declaration; "
+                    f"expected {len(argument_types)} but {num_mandatory_pos_args} "
+                    f"mandatory positional argument(s) declared"
+                )
+            elif not has_varargs and num_positional_args < len(argument_types):
+                raise TypeCheckError(
+                    f"has too few arguments in its declaration; expected "
+                    f"{len(argument_types)} but {num_positional_args} argument(s) "
+                    f"declared"
+                )
+
+
+def check_mapping(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is Dict or origin_type is dict:
+        if not isinstance(value, dict):
+            raise TypeCheckError("is not a dict")
+    if origin_type is MutableMapping or origin_type is collections.abc.MutableMapping:
+        if not isinstance(value, collections.abc.MutableMapping):
+            raise TypeCheckError("is not a mutable mapping")
+    elif not isinstance(value, collections.abc.Mapping):
+        raise TypeCheckError("is not a mapping")
+
+    if args:
+        key_type, value_type = args
+        if key_type is not Any or value_type is not Any:
+            samples = memo.config.collection_check_strategy.iterate_samples(
+                value.items()
+            )
+            for k, v in samples:
+                try:
+                    check_type_internal(k, key_type, memo)
+                except TypeCheckError as exc:
+                    exc.append_path_element(f"key {k!r}")
+                    raise
+
+                try:
+                    check_type_internal(v, value_type, memo)
+                except TypeCheckError as exc:
+                    exc.append_path_element(f"value of key {k!r}")
+                    raise
+
+
+def check_typed_dict(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, dict):
+        raise TypeCheckError("is not a dict")
+
+    declared_keys = frozenset(origin_type.__annotations__)
+    if hasattr(origin_type, "__required_keys__"):
+        required_keys = set(origin_type.__required_keys__)
+    else:  # py3.8 and lower
+        required_keys = set(declared_keys) if origin_type.__total__ else set()
+
+    existing_keys = set(value)
+    extra_keys = existing_keys - declared_keys
+    if extra_keys:
+        keys_formatted = ", ".join(f'"{key}"' for key in sorted(extra_keys, key=repr))
+        raise TypeCheckError(f"has unexpected extra key(s): {keys_formatted}")
+
+    # Detect NotRequired fields which are hidden by get_type_hints()
+    type_hints: dict[str, type] = {}
+    for key, annotation in origin_type.__annotations__.items():
+        if isinstance(annotation, ForwardRef):
+            annotation = evaluate_forwardref(annotation, memo)
+            if get_origin(annotation) is NotRequired:
+                required_keys.discard(key)
+                annotation = get_args(annotation)[0]
+
+        type_hints[key] = annotation
+
+    missing_keys = required_keys - existing_keys
+    if missing_keys:
+        keys_formatted = ", ".join(f'"{key}"' for key in sorted(missing_keys, key=repr))
+        raise TypeCheckError(f"is missing required key(s): {keys_formatted}")
+
+    for key, argtype in type_hints.items():
+        argvalue = value.get(key, _missing)
+        if argvalue is not _missing:
+            try:
+                check_type_internal(argvalue, argtype, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"value of key {key!r}")
+                raise
+
+
+def check_list(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, list):
+        raise TypeCheckError("is not a list")
+
+    if args and args != (Any,):
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for i, v in enumerate(samples):
+            try:
+                check_type_internal(v, args[0], memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+
+
+def check_sequence(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, collections.abc.Sequence):
+        raise TypeCheckError("is not a sequence")
+
+    if args and args != (Any,):
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for i, v in enumerate(samples):
+            try:
+                check_type_internal(v, args[0], memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+
+
+def check_set(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is frozenset:
+        if not isinstance(value, frozenset):
+            raise TypeCheckError("is not a frozenset")
+    elif not isinstance(value, AbstractSet):
+        raise TypeCheckError("is not a set")
+
+    if args and args != (Any,):
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for v in samples:
+            try:
+                check_type_internal(v, args[0], memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"[{v}]")
+                raise
+
+
+def check_tuple(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    # Specialized check for NamedTuples
+    if field_types := getattr(origin_type, "__annotations__", None):
+        if not isinstance(value, origin_type):
+            raise TypeCheckError(
+                f"is not a named tuple of type {qualified_name(origin_type)}"
+            )
+
+        for name, field_type in field_types.items():
+            try:
+                check_type_internal(getattr(value, name), field_type, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"attribute {name!r}")
+                raise
+
+        return
+    elif not isinstance(value, tuple):
+        raise TypeCheckError("is not a tuple")
+
+    if args:
+        use_ellipsis = args[-1] is Ellipsis
+        tuple_params = args[: -1 if use_ellipsis else None]
+    else:
+        # Unparametrized Tuple or plain tuple
+        return
+
+    if use_ellipsis:
+        element_type = tuple_params[0]
+        samples = memo.config.collection_check_strategy.iterate_samples(value)
+        for i, element in enumerate(samples):
+            try:
+                check_type_internal(element, element_type, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+    elif tuple_params == ((),):
+        if value != ():
+            raise TypeCheckError("is not an empty tuple")
+    else:
+        if len(value) != len(tuple_params):
+            raise TypeCheckError(
+                f"has wrong number of elements (expected {len(tuple_params)}, got "
+                f"{len(value)} instead)"
+            )
+
+        for i, (element, element_type) in enumerate(zip(value, tuple_params)):
+            try:
+                check_type_internal(element, element_type, memo)
+            except TypeCheckError as exc:
+                exc.append_path_element(f"item {i}")
+                raise
+
+
+def check_union(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    errors: dict[str, TypeCheckError] = {}
+    try:
+        for type_ in args:
+            try:
+                check_type_internal(value, type_, memo)
+                return
+            except TypeCheckError as exc:
+                errors[get_type_name(type_)] = exc
+
+        formatted_errors = indent(
+            "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
+        )
+    finally:
+        del errors  # avoid creating ref cycle
+    raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
+
+
+def check_uniontype(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    errors: dict[str, TypeCheckError] = {}
+    for type_ in args:
+        try:
+            check_type_internal(value, type_, memo)
+            return
+        except TypeCheckError as exc:
+            errors[get_type_name(type_)] = exc
+
+    formatted_errors = indent(
+        "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
+    )
+    raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
+
+
+def check_class(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isclass(value) and not isinstance(value, generic_alias_types):
+        raise TypeCheckError("is not a class")
+
+    if not args:
+        return
+
+    if isinstance(args[0], ForwardRef):
+        expected_class = evaluate_forwardref(args[0], memo)
+    else:
+        expected_class = args[0]
+
+    if expected_class is Any:
+        return
+    elif getattr(expected_class, "_is_protocol", False):
+        check_protocol(value, expected_class, (), memo)
+    elif isinstance(expected_class, TypeVar):
+        check_typevar(value, expected_class, (), memo, subclass_check=True)
+    elif get_origin(expected_class) is Union:
+        errors: dict[str, TypeCheckError] = {}
+        for arg in get_args(expected_class):
+            if arg is Any:
+                return
+
+            try:
+                check_class(value, type, (arg,), memo)
+                return
+            except TypeCheckError as exc:
+                errors[get_type_name(arg)] = exc
+        else:
+            formatted_errors = indent(
+                "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
+            )
+            raise TypeCheckError(
+                f"did not match any element in the union:\n{formatted_errors}"
+            )
+    elif not issubclass(value, expected_class):  # type: ignore[arg-type]
+        raise TypeCheckError(f"is not a subclass of {qualified_name(expected_class)}")
+
+
+def check_newtype(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    check_type_internal(value, origin_type.__supertype__, memo)
+
+
+def check_instance(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, origin_type):
+        raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
+
+
+def check_typevar(
+    value: Any,
+    origin_type: TypeVar,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+    *,
+    subclass_check: bool = False,
+) -> None:
+    if origin_type.__bound__ is not None:
+        annotation = (
+            Type[origin_type.__bound__] if subclass_check else origin_type.__bound__
+        )
+        check_type_internal(value, annotation, memo)
+    elif origin_type.__constraints__:
+        for constraint in origin_type.__constraints__:
+            annotation = Type[constraint] if subclass_check else constraint
+            try:
+                check_type_internal(value, annotation, memo)
+            except TypeCheckError:
+                pass
+            else:
+                break
+        else:
+            formatted_constraints = ", ".join(
+                get_type_name(constraint) for constraint in origin_type.__constraints__
+            )
+            raise TypeCheckError(
+                f"does not match any of the constraints " f"({formatted_constraints})"
+            )
+
+
+if typing_extensions is None:
+
+    def _is_literal_type(typ: object) -> bool:
+        return typ is typing.Literal
+
+else:
+
+    def _is_literal_type(typ: object) -> bool:
+        return typ is typing.Literal or typ is typing_extensions.Literal
+
+
+def check_literal(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    def get_literal_args(literal_args: tuple[Any, ...]) -> tuple[Any, ...]:
+        retval: list[Any] = []
+        for arg in literal_args:
+            if _is_literal_type(get_origin(arg)):
+                retval.extend(get_literal_args(arg.__args__))
+            elif arg is None or isinstance(arg, (int, str, bytes, bool, Enum)):
+                retval.append(arg)
+            else:
+                raise TypeError(
+                    f"Illegal literal value: {arg}"
+                )  # TypeError here is deliberate
+
+        return tuple(retval)
+
+    final_args = tuple(get_literal_args(args))
+    try:
+        index = final_args.index(value)
+    except ValueError:
+        pass
+    else:
+        if type(final_args[index]) is type(value):
+            return
+
+    formatted_args = ", ".join(repr(arg) for arg in final_args)
+    raise TypeCheckError(f"is not any of ({formatted_args})") from None
+
+
+def check_literal_string(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    check_type_internal(value, str, memo)
+
+
+def check_typeguard(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    check_type_internal(value, bool, memo)
+
+
+def check_none(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if value is not None:
+        raise TypeCheckError("is not None")
+
+
+def check_number(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is complex and not isinstance(value, (complex, float, int)):
+        raise TypeCheckError("is neither complex, float or int")
+    elif origin_type is float and not isinstance(value, (float, int)):
+        raise TypeCheckError("is neither float or int")
+
+
+def check_io(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if origin_type is TextIO or (origin_type is IO and args == (str,)):
+        if not isinstance(value, TextIOBase):
+            raise TypeCheckError("is not a text based I/O object")
+    elif origin_type is BinaryIO or (origin_type is IO and args == (bytes,)):
+        if not isinstance(value, (RawIOBase, BufferedIOBase)):
+            raise TypeCheckError("is not a binary I/O object")
+    elif not isinstance(value, IOBase):
+        raise TypeCheckError("is not an I/O object")
+
+
+def check_protocol(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    subject: type[Any] = value if isclass(value) else type(value)
+
+    if subject in protocol_check_cache:
+        result_map = protocol_check_cache[subject]
+        if origin_type in result_map:
+            if exc := result_map[origin_type]:
+                raise exc
+            else:
+                return
+
+    # Collect a set of methods and non-method attributes present in the protocol
+    ignored_attrs = set(dir(typing.Protocol)) | {
+        "__annotations__",
+        "__non_callable_proto_members__",
+    }
+    expected_methods: dict[str, tuple[Any, Any]] = {}
+    expected_noncallable_members: dict[str, Any] = {}
+    for attrname in dir(origin_type):
+        # Skip attributes present in typing.Protocol
+        if attrname in ignored_attrs:
+            continue
+
+        member = getattr(origin_type, attrname)
+        if callable(member):
+            signature = inspect.signature(member)
+            argtypes = [
+                (p.annotation if p.annotation is not Parameter.empty else Any)
+                for p in signature.parameters.values()
+                if p.kind is not Parameter.KEYWORD_ONLY
+            ] or Ellipsis
+            return_annotation = (
+                signature.return_annotation
+                if signature.return_annotation is not Parameter.empty
+                else Any
+            )
+            expected_methods[attrname] = argtypes, return_annotation
+        else:
+            expected_noncallable_members[attrname] = member
+
+    for attrname, annotation in typing.get_type_hints(origin_type).items():
+        expected_noncallable_members[attrname] = annotation
+
+    subject_annotations = typing.get_type_hints(subject)
+
+    # Check that all required methods are present and their signatures are compatible
+    result_map = protocol_check_cache.setdefault(subject, {})
+    try:
+        for attrname, callable_args in expected_methods.items():
+            try:
+                method = getattr(subject, attrname)
+            except AttributeError:
+                if attrname in subject_annotations:
+                    raise TypeCheckError(
+                        f"is not compatible with the {origin_type.__qualname__} protocol "
+                        f"because its {attrname!r} attribute is not a method"
+                    ) from None
+                else:
+                    raise TypeCheckError(
+                        f"is not compatible with the {origin_type.__qualname__} protocol "
+                        f"because it has no method named {attrname!r}"
+                    ) from None
+
+            if not callable(method):
+                raise TypeCheckError(
+                    f"is not compatible with the {origin_type.__qualname__} protocol "
+                    f"because its {attrname!r} attribute is not a callable"
+                )
+
+            # TODO: raise exception on added keyword-only arguments without defaults
+            try:
+                check_callable(method, Callable, callable_args, memo)
+            except TypeCheckError as exc:
+                raise TypeCheckError(
+                    f"is not compatible with the {origin_type.__qualname__} protocol "
+                    f"because its {attrname!r} method {exc}"
+                ) from None
+
+        # Check that all required non-callable members are present
+        for attrname in expected_noncallable_members:
+            # TODO: implement assignability checks for non-callable members
+            if attrname not in subject_annotations and not hasattr(subject, attrname):
+                raise TypeCheckError(
+                    f"is not compatible with the {origin_type.__qualname__} protocol "
+                    f"because it has no attribute named {attrname!r}"
+                )
+    except TypeCheckError as exc:
+        result_map[origin_type] = exc
+        raise
+    else:
+        result_map[origin_type] = None
+
+
+def check_byteslike(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, (bytearray, bytes, memoryview)):
+        raise TypeCheckError("is not bytes-like")
+
+
+def check_self(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if memo.self_type is None:
+        raise TypeCheckError("cannot be checked against Self outside of a method call")
+
+    if isclass(value):
+        if not issubclass(value, memo.self_type):
+            raise TypeCheckError(
+                f"is not an instance of the self type "
+                f"({qualified_name(memo.self_type)})"
+            )
+    elif not isinstance(value, memo.self_type):
+        raise TypeCheckError(
+            f"is not an instance of the self type ({qualified_name(memo.self_type)})"
+        )
+
+
+def check_paramspec(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    pass  # No-op for now
+
+
+def check_instanceof(
+    value: Any,
+    origin_type: Any,
+    args: tuple[Any, ...],
+    memo: TypeCheckMemo,
+) -> None:
+    if not isinstance(value, origin_type):
+        raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
+
+
+def check_type_internal(
+    value: Any,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> None:
+    """
+    Check that the given object is compatible with the given type annotation.
+
+    This function should only be used by type checker callables. Applications should use
+    :func:`~.check_type` instead.
+
+    :param value: the value to check
+    :param annotation: the type annotation to check against
+    :param memo: a memo object containing configuration and information necessary for
+        looking up forward references
+    """
+
+    if isinstance(annotation, ForwardRef):
+        try:
+            annotation = evaluate_forwardref(annotation, memo)
+        except NameError:
+            if memo.config.forward_ref_policy is ForwardRefPolicy.ERROR:
+                raise
+            elif memo.config.forward_ref_policy is ForwardRefPolicy.WARN:
+                warnings.warn(
+                    f"Cannot resolve forward reference {annotation.__forward_arg__!r}",
+                    TypeHintWarning,
+                    stacklevel=get_stacklevel(),
+                )
+
+            return
+
+    if annotation is Any or annotation is SubclassableAny or isinstance(value, Mock):
+        return
+
+    # Skip type checks if value is an instance of a class that inherits from Any
+    if not isclass(value) and SubclassableAny in type(value).__bases__:
+        return
+
+    extras: tuple[Any, ...]
+    origin_type = get_origin(annotation)
+    if origin_type is Annotated:
+        annotation, *extras_ = get_args(annotation)
+        extras = tuple(extras_)
+        origin_type = get_origin(annotation)
+    else:
+        extras = ()
+
+    if origin_type is not None:
+        args = get_args(annotation)
+
+        # Compatibility hack to distinguish between unparametrized and empty tuple
+        # (tuple[()]), necessary due to https://github.com/python/cpython/issues/91137
+        if origin_type in (tuple, Tuple) and annotation is not Tuple and not args:
+            args = ((),)
+    else:
+        origin_type = annotation
+        args = ()
+
+    for lookup_func in checker_lookup_functions:
+        checker = lookup_func(origin_type, args, extras)
+        if checker:
+            checker(value, origin_type, args, memo)
+            return
+
+    if isclass(origin_type):
+        if not isinstance(value, origin_type):
+            raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
+    elif type(origin_type) is str:  # noqa: E721
+        warnings.warn(
+            f"Skipping type check against {origin_type!r}; this looks like a "
+            f"string-form forward reference imported from another module",
+            TypeHintWarning,
+            stacklevel=get_stacklevel(),
+        )
+
+
+# Equality checks are applied to these
+origin_type_checkers = {
+    bytes: check_byteslike,
+    AbstractSet: check_set,
+    BinaryIO: check_io,
+    Callable: check_callable,
+    collections.abc.Callable: check_callable,
+    complex: check_number,
+    dict: check_mapping,
+    Dict: check_mapping,
+    float: check_number,
+    frozenset: check_set,
+    IO: check_io,
+    list: check_list,
+    List: check_list,
+    typing.Literal: check_literal,
+    Mapping: check_mapping,
+    MutableMapping: check_mapping,
+    None: check_none,
+    collections.abc.Mapping: check_mapping,
+    collections.abc.MutableMapping: check_mapping,
+    Sequence: check_sequence,
+    collections.abc.Sequence: check_sequence,
+    collections.abc.Set: check_set,
+    set: check_set,
+    Set: check_set,
+    TextIO: check_io,
+    tuple: check_tuple,
+    Tuple: check_tuple,
+    type: check_class,
+    Type: check_class,
+    Union: check_union,
+}
+if sys.version_info >= (3, 10):
+    origin_type_checkers[types.UnionType] = check_uniontype
+    origin_type_checkers[typing.TypeGuard] = check_typeguard
+if sys.version_info >= (3, 11):
+    origin_type_checkers.update(
+        {typing.LiteralString: check_literal_string, typing.Self: check_self}
+    )
+if typing_extensions is not None:
+    # On some Python versions, these may simply be re-exports from typing,
+    # but exactly which Python versions is subject to change,
+    # so it's best to err on the safe side
+    # and update the dictionary on all Python versions
+    # if typing_extensions is installed
+    origin_type_checkers[typing_extensions.Literal] = check_literal
+    origin_type_checkers[typing_extensions.LiteralString] = check_literal_string
+    origin_type_checkers[typing_extensions.Self] = check_self
+    origin_type_checkers[typing_extensions.TypeGuard] = check_typeguard
+
+
+def builtin_checker_lookup(
+    origin_type: Any, args: tuple[Any, ...], extras: tuple[Any, ...]
+) -> TypeCheckerCallable | None:
+    checker = origin_type_checkers.get(origin_type)
+    if checker is not None:
+        return checker
+    elif is_typeddict(origin_type):
+        return check_typed_dict
+    elif isclass(origin_type) and issubclass(
+        origin_type,
+        Tuple,  # type: ignore[arg-type]
+    ):
+        # NamedTuple
+        return check_tuple
+    elif getattr(origin_type, "_is_protocol", False):
+        return check_protocol
+    elif isinstance(origin_type, ParamSpec):
+        return check_paramspec
+    elif isinstance(origin_type, TypeVar):
+        return check_typevar
+    elif origin_type.__class__ is NewType:
+        # typing.NewType on Python 3.10+
+        return check_newtype
+    elif (
+        isfunction(origin_type)
+        and getattr(origin_type, "__module__", None) == "typing"
+        and getattr(origin_type, "__qualname__", "").startswith("NewType.")
+        and hasattr(origin_type, "__supertype__")
+    ):
+        # typing.NewType on Python 3.9 and below
+        return check_newtype
+
+    return None
+
+
+checker_lookup_functions.append(builtin_checker_lookup)
+
+
+def load_plugins() -> None:
+    """
+    Load all type checker lookup functions from entry points.
+
+    All entry points from the ``typeguard.checker_lookup`` group are loaded, and the
+    returned lookup functions are added to :data:`typeguard.checker_lookup_functions`.
+
+    .. note:: This function is called implicitly on import, unless the
+        ``TYPEGUARD_DISABLE_PLUGIN_AUTOLOAD`` environment variable is present.
+    """
+
+    for ep in entry_points(group="typeguard.checker_lookup"):
+        try:
+            plugin = ep.load()
+        except Exception as exc:
+            warnings.warn(
+                f"Failed to load plugin {ep.name!r}: " f"{qualified_name(exc)}: {exc}",
+                stacklevel=2,
+            )
+            continue
+
+        if not callable(plugin):
+            warnings.warn(
+                f"Plugin {ep} returned a non-callable object: {plugin!r}", stacklevel=2
+            )
+            continue
+
+        checker_lookup_functions.insert(0, plugin)
diff --git a/pkg_resources/_vendor/typeguard/_config.py b/pkg_resources/_vendor/typeguard/_config.py
new file mode 100644
index 0000000000..36efad5396
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_config.py
@@ -0,0 +1,108 @@
+from __future__ import annotations
+
+from collections.abc import Iterable
+from dataclasses import dataclass
+from enum import Enum, auto
+from typing import TYPE_CHECKING, TypeVar
+
+if TYPE_CHECKING:
+    from ._functions import TypeCheckFailCallback
+
+T = TypeVar("T")
+
+
+class ForwardRefPolicy(Enum):
+    """
+    Defines how unresolved forward references are handled.
+
+    Members:
+
+    * ``ERROR``: propagate the :exc:`NameError` when the forward reference lookup fails
+    * ``WARN``: emit a :class:`~.TypeHintWarning` if the forward reference lookup fails
+    * ``IGNORE``: silently skip checks for unresolveable forward references
+    """
+
+    ERROR = auto()
+    WARN = auto()
+    IGNORE = auto()
+
+
+class CollectionCheckStrategy(Enum):
+    """
+    Specifies how thoroughly the contents of collections are type checked.
+
+    This has an effect on the following built-in checkers:
+
+    * ``AbstractSet``
+    * ``Dict``
+    * ``List``
+    * ``Mapping``
+    * ``Set``
+    * ``Tuple[, ...]`` (arbitrarily sized tuples)
+
+    Members:
+
+    * ``FIRST_ITEM``: check only the first item
+    * ``ALL_ITEMS``: check all items
+    """
+
+    FIRST_ITEM = auto()
+    ALL_ITEMS = auto()
+
+    def iterate_samples(self, collection: Iterable[T]) -> Iterable[T]:
+        if self is CollectionCheckStrategy.FIRST_ITEM:
+            try:
+                return [next(iter(collection))]
+            except StopIteration:
+                return ()
+        else:
+            return collection
+
+
+@dataclass
+class TypeCheckConfiguration:
+    """
+     You can change Typeguard's behavior with these settings.
+
+    .. attribute:: typecheck_fail_callback
+       :type: Callable[[TypeCheckError, TypeCheckMemo], Any]
+
+         Callable that is called when type checking fails.
+
+         Default: ``None`` (the :exc:`~.TypeCheckError` is raised directly)
+
+    .. attribute:: forward_ref_policy
+       :type: ForwardRefPolicy
+
+         Specifies what to do when a forward reference fails to resolve.
+
+         Default: ``WARN``
+
+    .. attribute:: collection_check_strategy
+       :type: CollectionCheckStrategy
+
+         Specifies how thoroughly the contents of collections (list, dict, etc.) are
+         type checked.
+
+         Default: ``FIRST_ITEM``
+
+    .. attribute:: debug_instrumentation
+       :type: bool
+
+         If set to ``True``, the code of modules or functions instrumented by typeguard
+         is printed to ``sys.stderr`` after the instrumentation is done
+
+         Requires Python 3.9 or newer.
+
+         Default: ``False``
+    """
+
+    forward_ref_policy: ForwardRefPolicy = ForwardRefPolicy.WARN
+    typecheck_fail_callback: TypeCheckFailCallback | None = None
+    collection_check_strategy: CollectionCheckStrategy = (
+        CollectionCheckStrategy.FIRST_ITEM
+    )
+    debug_instrumentation: bool = False
+
+
+global_config = TypeCheckConfiguration()
diff --git a/pkg_resources/_vendor/typeguard/_decorators.py b/pkg_resources/_vendor/typeguard/_decorators.py
new file mode 100644
index 0000000000..cf3253351f
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_decorators.py
@@ -0,0 +1,235 @@
+from __future__ import annotations
+
+import ast
+import inspect
+import sys
+from collections.abc import Sequence
+from functools import partial
+from inspect import isclass, isfunction
+from types import CodeType, FrameType, FunctionType
+from typing import TYPE_CHECKING, Any, Callable, ForwardRef, TypeVar, cast, overload
+from warnings import warn
+
+from ._config import CollectionCheckStrategy, ForwardRefPolicy, global_config
+from ._exceptions import InstrumentationWarning
+from ._functions import TypeCheckFailCallback
+from ._transformer import TypeguardTransformer
+from ._utils import Unset, function_name, get_stacklevel, is_method_of, unset
+
+if TYPE_CHECKING:
+    from typeshed.stdlib.types import _Cell
+
+    _F = TypeVar("_F")
+
+    def typeguard_ignore(f: _F) -> _F:
+        """This decorator is a noop during static type-checking."""
+        return f
+
+else:
+    from typing import no_type_check as typeguard_ignore  # noqa: F401
+
+T_CallableOrType = TypeVar("T_CallableOrType", bound=Callable[..., Any])
+
+
+def make_cell(value: object) -> _Cell:
+    return (lambda: value).__closure__[0]  # type: ignore[index]
+
+
+def find_target_function(
+    new_code: CodeType, target_path: Sequence[str], firstlineno: int
+) -> CodeType | None:
+    target_name = target_path[0]
+    for const in new_code.co_consts:
+        if isinstance(const, CodeType):
+            if const.co_name == target_name:
+                if const.co_firstlineno == firstlineno:
+                    return const
+                elif len(target_path) > 1:
+                    target_code = find_target_function(
+                        const, target_path[1:], firstlineno
+                    )
+                    if target_code:
+                        return target_code
+
+    return None
+
+
+def instrument(f: T_CallableOrType) -> FunctionType | str:
+    if not getattr(f, "__code__", None):
+        return "no code associated"
+    elif not getattr(f, "__module__", None):
+        return "__module__ attribute is not set"
+    elif f.__code__.co_filename == "":
+        return "cannot instrument functions defined in a REPL"
+    elif hasattr(f, "__wrapped__"):
+        return (
+            "@typechecked only supports instrumenting functions wrapped with "
+            "@classmethod, @staticmethod or @property"
+        )
+
+    target_path = [item for item in f.__qualname__.split(".") if item != ""]
+    module_source = inspect.getsource(sys.modules[f.__module__])
+    module_ast = ast.parse(module_source)
+    instrumentor = TypeguardTransformer(target_path, f.__code__.co_firstlineno)
+    instrumentor.visit(module_ast)
+
+    if not instrumentor.target_node or instrumentor.target_lineno is None:
+        return "instrumentor did not find the target function"
+
+    module_code = compile(module_ast, f.__code__.co_filename, "exec", dont_inherit=True)
+    new_code = find_target_function(
+        module_code, target_path, instrumentor.target_lineno
+    )
+    if not new_code:
+        return "cannot find the target function in the AST"
+
+    if global_config.debug_instrumentation and sys.version_info >= (3, 9):
+        # Find the matching AST node, then unparse it to source and print to stdout
+        print(
+            f"Source code of {f.__qualname__}() after instrumentation:"
+            "\n----------------------------------------------",
+            file=sys.stderr,
+        )
+        print(ast.unparse(instrumentor.target_node), file=sys.stderr)
+        print(
+            "----------------------------------------------",
+            file=sys.stderr,
+        )
+
+    closure = f.__closure__
+    if new_code.co_freevars != f.__code__.co_freevars:
+        # Create a new closure and find values for the new free variables
+        frame = cast(FrameType, inspect.currentframe())
+        frame = cast(FrameType, frame.f_back)
+        frame_locals = cast(FrameType, frame.f_back).f_locals
+        cells: list[_Cell] = []
+        for key in new_code.co_freevars:
+            if key in instrumentor.names_used_in_annotations:
+                # Find the value and make a new cell from it
+                value = frame_locals.get(key) or ForwardRef(key)
+                cells.append(make_cell(value))
+            else:
+                # Reuse the cell from the existing closure
+                assert f.__closure__
+                cells.append(f.__closure__[f.__code__.co_freevars.index(key)])
+
+        closure = tuple(cells)
+
+    new_function = FunctionType(new_code, f.__globals__, f.__name__, closure=closure)
+    new_function.__module__ = f.__module__
+    new_function.__name__ = f.__name__
+    new_function.__qualname__ = f.__qualname__
+    new_function.__annotations__ = f.__annotations__
+    new_function.__doc__ = f.__doc__
+    new_function.__defaults__ = f.__defaults__
+    new_function.__kwdefaults__ = f.__kwdefaults__
+    return new_function
+
+
+@overload
+def typechecked(
+    *,
+    forward_ref_policy: ForwardRefPolicy | Unset = unset,
+    typecheck_fail_callback: TypeCheckFailCallback | Unset = unset,
+    collection_check_strategy: CollectionCheckStrategy | Unset = unset,
+    debug_instrumentation: bool | Unset = unset,
+) -> Callable[[T_CallableOrType], T_CallableOrType]: ...
+
+
+@overload
+def typechecked(target: T_CallableOrType) -> T_CallableOrType: ...
+
+
+def typechecked(
+    target: T_CallableOrType | None = None,
+    *,
+    forward_ref_policy: ForwardRefPolicy | Unset = unset,
+    typecheck_fail_callback: TypeCheckFailCallback | Unset = unset,
+    collection_check_strategy: CollectionCheckStrategy | Unset = unset,
+    debug_instrumentation: bool | Unset = unset,
+) -> Any:
+    """
+    Instrument the target function to perform run-time type checking.
+
+    This decorator recompiles the target function, injecting code to type check
+    arguments, return values, yield values (excluding ``yield from``) and assignments to
+    annotated local variables.
+
+    This can also be used as a class decorator. This will instrument all type annotated
+    methods, including :func:`@classmethod `,
+    :func:`@staticmethod `,  and :class:`@property ` decorated
+    methods in the class.
+
+    .. note:: When Python is run in optimized mode (``-O`` or ``-OO``, this decorator
+        is a no-op). This is a feature meant for selectively introducing type checking
+        into a code base where the checks aren't meant to be run in production.
+
+    :param target: the function or class to enable type checking for
+    :param forward_ref_policy: override for
+        :attr:`.TypeCheckConfiguration.forward_ref_policy`
+    :param typecheck_fail_callback: override for
+        :attr:`.TypeCheckConfiguration.typecheck_fail_callback`
+    :param collection_check_strategy: override for
+        :attr:`.TypeCheckConfiguration.collection_check_strategy`
+    :param debug_instrumentation: override for
+        :attr:`.TypeCheckConfiguration.debug_instrumentation`
+
+    """
+    if target is None:
+        return partial(
+            typechecked,
+            forward_ref_policy=forward_ref_policy,
+            typecheck_fail_callback=typecheck_fail_callback,
+            collection_check_strategy=collection_check_strategy,
+            debug_instrumentation=debug_instrumentation,
+        )
+
+    if not __debug__:
+        return target
+
+    if isclass(target):
+        for key, attr in target.__dict__.items():
+            if is_method_of(attr, target):
+                retval = instrument(attr)
+                if isfunction(retval):
+                    setattr(target, key, retval)
+            elif isinstance(attr, (classmethod, staticmethod)):
+                if is_method_of(attr.__func__, target):
+                    retval = instrument(attr.__func__)
+                    if isfunction(retval):
+                        wrapper = attr.__class__(retval)
+                        setattr(target, key, wrapper)
+            elif isinstance(attr, property):
+                kwargs: dict[str, Any] = dict(doc=attr.__doc__)
+                for name in ("fset", "fget", "fdel"):
+                    property_func = kwargs[name] = getattr(attr, name)
+                    if is_method_of(property_func, target):
+                        retval = instrument(property_func)
+                        if isfunction(retval):
+                            kwargs[name] = retval
+
+                setattr(target, key, attr.__class__(**kwargs))
+
+        return target
+
+    # Find either the first Python wrapper or the actual function
+    wrapper_class: (
+        type[classmethod[Any, Any, Any]] | type[staticmethod[Any, Any]] | None
+    ) = None
+    if isinstance(target, (classmethod, staticmethod)):
+        wrapper_class = target.__class__
+        target = target.__func__
+
+    retval = instrument(target)
+    if isinstance(retval, str):
+        warn(
+            f"{retval} -- not typechecking {function_name(target)}",
+            InstrumentationWarning,
+            stacklevel=get_stacklevel(),
+        )
+        return target
+
+    if wrapper_class is None:
+        return retval
+    else:
+        return wrapper_class(retval)
diff --git a/pkg_resources/_vendor/typeguard/_exceptions.py b/pkg_resources/_vendor/typeguard/_exceptions.py
new file mode 100644
index 0000000000..625437a649
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_exceptions.py
@@ -0,0 +1,42 @@
+from collections import deque
+from typing import Deque
+
+
+class TypeHintWarning(UserWarning):
+    """
+    A warning that is emitted when a type hint in string form could not be resolved to
+    an actual type.
+    """
+
+
+class TypeCheckWarning(UserWarning):
+    """Emitted by typeguard's type checkers when a type mismatch is detected."""
+
+    def __init__(self, message: str):
+        super().__init__(message)
+
+
+class InstrumentationWarning(UserWarning):
+    """Emitted when there's a problem with instrumenting a function for type checks."""
+
+    def __init__(self, message: str):
+        super().__init__(message)
+
+
+class TypeCheckError(Exception):
+    """
+    Raised by typeguard's type checkers when a type mismatch is detected.
+    """
+
+    def __init__(self, message: str):
+        super().__init__(message)
+        self._path: Deque[str] = deque()
+
+    def append_path_element(self, element: str) -> None:
+        self._path.append(element)
+
+    def __str__(self) -> str:
+        if self._path:
+            return " of ".join(self._path) + " " + str(self.args[0])
+        else:
+            return str(self.args[0])
diff --git a/pkg_resources/_vendor/typeguard/_functions.py b/pkg_resources/_vendor/typeguard/_functions.py
new file mode 100644
index 0000000000..28497856a3
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_functions.py
@@ -0,0 +1,308 @@
+from __future__ import annotations
+
+import sys
+import warnings
+from typing import Any, Callable, NoReturn, TypeVar, Union, overload
+
+from . import _suppression
+from ._checkers import BINARY_MAGIC_METHODS, check_type_internal
+from ._config import (
+    CollectionCheckStrategy,
+    ForwardRefPolicy,
+    TypeCheckConfiguration,
+)
+from ._exceptions import TypeCheckError, TypeCheckWarning
+from ._memo import TypeCheckMemo
+from ._utils import get_stacklevel, qualified_name
+
+if sys.version_info >= (3, 11):
+    from typing import Literal, Never, TypeAlias
+else:
+    from typing_extensions import Literal, Never, TypeAlias
+
+T = TypeVar("T")
+TypeCheckFailCallback: TypeAlias = Callable[[TypeCheckError, TypeCheckMemo], Any]
+
+
+@overload
+def check_type(
+    value: object,
+    expected_type: type[T],
+    *,
+    forward_ref_policy: ForwardRefPolicy = ...,
+    typecheck_fail_callback: TypeCheckFailCallback | None = ...,
+    collection_check_strategy: CollectionCheckStrategy = ...,
+) -> T: ...
+
+
+@overload
+def check_type(
+    value: object,
+    expected_type: Any,
+    *,
+    forward_ref_policy: ForwardRefPolicy = ...,
+    typecheck_fail_callback: TypeCheckFailCallback | None = ...,
+    collection_check_strategy: CollectionCheckStrategy = ...,
+) -> Any: ...
+
+
+def check_type(
+    value: object,
+    expected_type: Any,
+    *,
+    forward_ref_policy: ForwardRefPolicy = TypeCheckConfiguration().forward_ref_policy,
+    typecheck_fail_callback: TypeCheckFailCallback | None = (
+        TypeCheckConfiguration().typecheck_fail_callback
+    ),
+    collection_check_strategy: CollectionCheckStrategy = (
+        TypeCheckConfiguration().collection_check_strategy
+    ),
+) -> Any:
+    """
+    Ensure that ``value`` matches ``expected_type``.
+
+    The types from the :mod:`typing` module do not support :func:`isinstance` or
+    :func:`issubclass` so a number of type specific checks are required. This function
+    knows which checker to call for which type.
+
+    This function wraps :func:`~.check_type_internal` in the following ways:
+
+    * Respects type checking suppression (:func:`~.suppress_type_checks`)
+    * Forms a :class:`~.TypeCheckMemo` from the current stack frame
+    * Calls the configured type check fail callback if the check fails
+
+    Note that this function is independent of the globally shared configuration in
+    :data:`typeguard.config`. This means that usage within libraries is safe from being
+    affected configuration changes made by other libraries or by the integrating
+    application. Instead, configuration options have the same default values as their
+    corresponding fields in :class:`TypeCheckConfiguration`.
+
+    :param value: value to be checked against ``expected_type``
+    :param expected_type: a class or generic type instance, or a tuple of such things
+    :param forward_ref_policy: see :attr:`TypeCheckConfiguration.forward_ref_policy`
+    :param typecheck_fail_callback:
+        see :attr`TypeCheckConfiguration.typecheck_fail_callback`
+    :param collection_check_strategy:
+        see :attr:`TypeCheckConfiguration.collection_check_strategy`
+    :return: ``value``, unmodified
+    :raises TypeCheckError: if there is a type mismatch
+
+    """
+    if type(expected_type) is tuple:
+        expected_type = Union[expected_type]
+
+    config = TypeCheckConfiguration(
+        forward_ref_policy=forward_ref_policy,
+        typecheck_fail_callback=typecheck_fail_callback,
+        collection_check_strategy=collection_check_strategy,
+    )
+
+    if _suppression.type_checks_suppressed or expected_type is Any:
+        return value
+
+    frame = sys._getframe(1)
+    memo = TypeCheckMemo(frame.f_globals, frame.f_locals, config=config)
+    try:
+        check_type_internal(value, expected_type, memo)
+    except TypeCheckError as exc:
+        exc.append_path_element(qualified_name(value, add_class_prefix=True))
+        if config.typecheck_fail_callback:
+            config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return value
+
+
+def check_argument_types(
+    func_name: str,
+    arguments: dict[str, tuple[Any, Any]],
+    memo: TypeCheckMemo,
+) -> Literal[True]:
+    if _suppression.type_checks_suppressed:
+        return True
+
+    for argname, (value, annotation) in arguments.items():
+        if annotation is NoReturn or annotation is Never:
+            exc = TypeCheckError(
+                f"{func_name}() was declared never to be called but it was"
+            )
+            if memo.config.typecheck_fail_callback:
+                memo.config.typecheck_fail_callback(exc, memo)
+            else:
+                raise exc
+
+        try:
+            check_type_internal(value, annotation, memo)
+        except TypeCheckError as exc:
+            qualname = qualified_name(value, add_class_prefix=True)
+            exc.append_path_element(f'argument "{argname}" ({qualname})')
+            if memo.config.typecheck_fail_callback:
+                memo.config.typecheck_fail_callback(exc, memo)
+            else:
+                raise
+
+    return True
+
+
+def check_return_type(
+    func_name: str,
+    retval: T,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> T:
+    if _suppression.type_checks_suppressed:
+        return retval
+
+    if annotation is NoReturn or annotation is Never:
+        exc = TypeCheckError(f"{func_name}() was declared never to return but it did")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise exc
+
+    try:
+        check_type_internal(retval, annotation, memo)
+    except TypeCheckError as exc:
+        # Allow NotImplemented if this is a binary magic method (__eq__() et al)
+        if retval is NotImplemented and annotation is bool:
+            # This does (and cannot) not check if it's actually a method
+            func_name = func_name.rsplit(".", 1)[-1]
+            if func_name in BINARY_MAGIC_METHODS:
+                return retval
+
+        qualname = qualified_name(retval, add_class_prefix=True)
+        exc.append_path_element(f"the return value ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return retval
+
+
+def check_send_type(
+    func_name: str,
+    sendval: T,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> T:
+    if _suppression.type_checks_suppressed:
+        return sendval
+
+    if annotation is NoReturn or annotation is Never:
+        exc = TypeCheckError(
+            f"{func_name}() was declared never to be sent a value to but it was"
+        )
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise exc
+
+    try:
+        check_type_internal(sendval, annotation, memo)
+    except TypeCheckError as exc:
+        qualname = qualified_name(sendval, add_class_prefix=True)
+        exc.append_path_element(f"the value sent to generator ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return sendval
+
+
+def check_yield_type(
+    func_name: str,
+    yieldval: T,
+    annotation: Any,
+    memo: TypeCheckMemo,
+) -> T:
+    if _suppression.type_checks_suppressed:
+        return yieldval
+
+    if annotation is NoReturn or annotation is Never:
+        exc = TypeCheckError(f"{func_name}() was declared never to yield but it did")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise exc
+
+    try:
+        check_type_internal(yieldval, annotation, memo)
+    except TypeCheckError as exc:
+        qualname = qualified_name(yieldval, add_class_prefix=True)
+        exc.append_path_element(f"the yielded value ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return yieldval
+
+
+def check_variable_assignment(
+    value: object, varname: str, annotation: Any, memo: TypeCheckMemo
+) -> Any:
+    if _suppression.type_checks_suppressed:
+        return value
+
+    try:
+        check_type_internal(value, annotation, memo)
+    except TypeCheckError as exc:
+        qualname = qualified_name(value, add_class_prefix=True)
+        exc.append_path_element(f"value assigned to {varname} ({qualname})")
+        if memo.config.typecheck_fail_callback:
+            memo.config.typecheck_fail_callback(exc, memo)
+        else:
+            raise
+
+    return value
+
+
+def check_multi_variable_assignment(
+    value: Any, targets: list[dict[str, Any]], memo: TypeCheckMemo
+) -> Any:
+    if max(len(target) for target in targets) == 1:
+        iterated_values = [value]
+    else:
+        iterated_values = list(value)
+
+    if not _suppression.type_checks_suppressed:
+        for expected_types in targets:
+            value_index = 0
+            for ann_index, (varname, expected_type) in enumerate(
+                expected_types.items()
+            ):
+                if varname.startswith("*"):
+                    varname = varname[1:]
+                    keys_left = len(expected_types) - 1 - ann_index
+                    next_value_index = len(iterated_values) - keys_left
+                    obj: object = iterated_values[value_index:next_value_index]
+                    value_index = next_value_index
+                else:
+                    obj = iterated_values[value_index]
+                    value_index += 1
+
+                try:
+                    check_type_internal(obj, expected_type, memo)
+                except TypeCheckError as exc:
+                    qualname = qualified_name(obj, add_class_prefix=True)
+                    exc.append_path_element(f"value assigned to {varname} ({qualname})")
+                    if memo.config.typecheck_fail_callback:
+                        memo.config.typecheck_fail_callback(exc, memo)
+                    else:
+                        raise
+
+    return iterated_values[0] if len(iterated_values) == 1 else iterated_values
+
+
+def warn_on_error(exc: TypeCheckError, memo: TypeCheckMemo) -> None:
+    """
+    Emit a warning on a type mismatch.
+
+    This is intended to be used as an error handler in
+    :attr:`TypeCheckConfiguration.typecheck_fail_callback`.
+
+    """
+    warnings.warn(TypeCheckWarning(str(exc)), stacklevel=get_stacklevel())
diff --git a/pkg_resources/_vendor/typeguard/_importhook.py b/pkg_resources/_vendor/typeguard/_importhook.py
new file mode 100644
index 0000000000..8590540a5a
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_importhook.py
@@ -0,0 +1,213 @@
+from __future__ import annotations
+
+import ast
+import sys
+import types
+from collections.abc import Callable, Iterable
+from importlib.abc import MetaPathFinder
+from importlib.machinery import ModuleSpec, SourceFileLoader
+from importlib.util import cache_from_source, decode_source
+from inspect import isclass
+from os import PathLike
+from types import CodeType, ModuleType, TracebackType
+from typing import Sequence, TypeVar
+from unittest.mock import patch
+
+from ._config import global_config
+from ._transformer import TypeguardTransformer
+
+if sys.version_info >= (3, 12):
+    from collections.abc import Buffer
+else:
+    from typing_extensions import Buffer
+
+if sys.version_info >= (3, 11):
+    from typing import ParamSpec
+else:
+    from typing_extensions import ParamSpec
+
+if sys.version_info >= (3, 10):
+    from importlib.metadata import PackageNotFoundError, version
+else:
+    from importlib_metadata import PackageNotFoundError, version
+
+try:
+    OPTIMIZATION = "typeguard" + "".join(version("typeguard").split(".")[:3])
+except PackageNotFoundError:
+    OPTIMIZATION = "typeguard"
+
+P = ParamSpec("P")
+T = TypeVar("T")
+
+
+# The name of this function is magical
+def _call_with_frames_removed(
+    f: Callable[P, T], *args: P.args, **kwargs: P.kwargs
+) -> T:
+    return f(*args, **kwargs)
+
+
+def optimized_cache_from_source(path: str, debug_override: bool | None = None) -> str:
+    return cache_from_source(path, debug_override, optimization=OPTIMIZATION)
+
+
+class TypeguardLoader(SourceFileLoader):
+    @staticmethod
+    def source_to_code(
+        data: Buffer | str | ast.Module | ast.Expression | ast.Interactive,
+        path: Buffer | str | PathLike[str] = "",
+    ) -> CodeType:
+        if isinstance(data, (ast.Module, ast.Expression, ast.Interactive)):
+            tree = data
+        else:
+            if isinstance(data, str):
+                source = data
+            else:
+                source = decode_source(data)
+
+            tree = _call_with_frames_removed(
+                ast.parse,
+                source,
+                path,
+                "exec",
+            )
+
+        tree = TypeguardTransformer().visit(tree)
+        ast.fix_missing_locations(tree)
+
+        if global_config.debug_instrumentation and sys.version_info >= (3, 9):
+            print(
+                f"Source code of {path!r} after instrumentation:\n"
+                "----------------------------------------------",
+                file=sys.stderr,
+            )
+            print(ast.unparse(tree), file=sys.stderr)
+            print("----------------------------------------------", file=sys.stderr)
+
+        return _call_with_frames_removed(
+            compile, tree, path, "exec", 0, dont_inherit=True
+        )
+
+    def exec_module(self, module: ModuleType) -> None:
+        # Use a custom optimization marker – the import lock should make this monkey
+        # patch safe
+        with patch(
+            "importlib._bootstrap_external.cache_from_source",
+            optimized_cache_from_source,
+        ):
+            super().exec_module(module)
+
+
+class TypeguardFinder(MetaPathFinder):
+    """
+    Wraps another path finder and instruments the module with
+    :func:`@typechecked ` if :meth:`should_instrument` returns
+    ``True``.
+
+    Should not be used directly, but rather via :func:`~.install_import_hook`.
+
+    .. versionadded:: 2.6
+    """
+
+    def __init__(self, packages: list[str] | None, original_pathfinder: MetaPathFinder):
+        self.packages = packages
+        self._original_pathfinder = original_pathfinder
+
+    def find_spec(
+        self,
+        fullname: str,
+        path: Sequence[str] | None,
+        target: types.ModuleType | None = None,
+    ) -> ModuleSpec | None:
+        if self.should_instrument(fullname):
+            spec = self._original_pathfinder.find_spec(fullname, path, target)
+            if spec is not None and isinstance(spec.loader, SourceFileLoader):
+                spec.loader = TypeguardLoader(spec.loader.name, spec.loader.path)
+                return spec
+
+        return None
+
+    def should_instrument(self, module_name: str) -> bool:
+        """
+        Determine whether the module with the given name should be instrumented.
+
+        :param module_name: full name of the module that is about to be imported (e.g.
+            ``xyz.abc``)
+
+        """
+        if self.packages is None:
+            return True
+
+        for package in self.packages:
+            if module_name == package or module_name.startswith(package + "."):
+                return True
+
+        return False
+
+
+class ImportHookManager:
+    """
+    A handle that can be used to uninstall the Typeguard import hook.
+    """
+
+    def __init__(self, hook: MetaPathFinder):
+        self.hook = hook
+
+    def __enter__(self) -> None:
+        pass
+
+    def __exit__(
+        self,
+        exc_type: type[BaseException],
+        exc_val: BaseException,
+        exc_tb: TracebackType,
+    ) -> None:
+        self.uninstall()
+
+    def uninstall(self) -> None:
+        """Uninstall the import hook."""
+        try:
+            sys.meta_path.remove(self.hook)
+        except ValueError:
+            pass  # already removed
+
+
+def install_import_hook(
+    packages: Iterable[str] | None = None,
+    *,
+    cls: type[TypeguardFinder] = TypeguardFinder,
+) -> ImportHookManager:
+    """
+    Install an import hook that instruments functions for automatic type checking.
+
+    This only affects modules loaded **after** this hook has been installed.
+
+    :param packages: an iterable of package names to instrument, or ``None`` to
+        instrument all packages
+    :param cls: a custom meta path finder class
+    :return: a context manager that uninstalls the hook on exit (or when you call
+        ``.uninstall()``)
+
+    .. versionadded:: 2.6
+
+    """
+    if packages is None:
+        target_packages: list[str] | None = None
+    elif isinstance(packages, str):
+        target_packages = [packages]
+    else:
+        target_packages = list(packages)
+
+    for finder in sys.meta_path:
+        if (
+            isclass(finder)
+            and finder.__name__ == "PathFinder"
+            and hasattr(finder, "find_spec")
+        ):
+            break
+    else:
+        raise RuntimeError("Cannot find a PathFinder in sys.meta_path")
+
+    hook = cls(target_packages, finder)
+    sys.meta_path.insert(0, hook)
+    return ImportHookManager(hook)
diff --git a/pkg_resources/_vendor/typeguard/_memo.py b/pkg_resources/_vendor/typeguard/_memo.py
new file mode 100644
index 0000000000..1d0d80c66d
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_memo.py
@@ -0,0 +1,48 @@
+from __future__ import annotations
+
+from typing import Any
+
+from typeguard._config import TypeCheckConfiguration, global_config
+
+
+class TypeCheckMemo:
+    """
+    Contains information necessary for type checkers to do their work.
+
+    .. attribute:: globals
+       :type: dict[str, Any]
+
+        Dictionary of global variables to use for resolving forward references.
+
+    .. attribute:: locals
+       :type: dict[str, Any]
+
+        Dictionary of local variables to use for resolving forward references.
+
+    .. attribute:: self_type
+       :type: type | None
+
+        When running type checks within an instance method or class method, this is the
+        class object that the first argument (usually named ``self`` or ``cls``) refers
+        to.
+
+    .. attribute:: config
+       :type: TypeCheckConfiguration
+
+         Contains the configuration for a particular set of type checking operations.
+    """
+
+    __slots__ = "globals", "locals", "self_type", "config"
+
+    def __init__(
+        self,
+        globals: dict[str, Any],
+        locals: dict[str, Any],
+        *,
+        self_type: type | None = None,
+        config: TypeCheckConfiguration = global_config,
+    ):
+        self.globals = globals
+        self.locals = locals
+        self.self_type = self_type
+        self.config = config
diff --git a/pkg_resources/_vendor/typeguard/_pytest_plugin.py b/pkg_resources/_vendor/typeguard/_pytest_plugin.py
new file mode 100644
index 0000000000..7b2f494ec7
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_pytest_plugin.py
@@ -0,0 +1,127 @@
+from __future__ import annotations
+
+import sys
+import warnings
+from typing import TYPE_CHECKING, Any, Literal
+
+from typeguard._config import CollectionCheckStrategy, ForwardRefPolicy, global_config
+from typeguard._exceptions import InstrumentationWarning
+from typeguard._importhook import install_import_hook
+from typeguard._utils import qualified_name, resolve_reference
+
+if TYPE_CHECKING:
+    from pytest import Config, Parser
+
+
+def pytest_addoption(parser: Parser) -> None:
+    def add_ini_option(
+        opt_type: (
+            Literal["string", "paths", "pathlist", "args", "linelist", "bool"] | None
+        ),
+    ) -> None:
+        parser.addini(
+            group.options[-1].names()[0][2:],
+            group.options[-1].attrs()["help"],
+            opt_type,
+        )
+
+    group = parser.getgroup("typeguard")
+    group.addoption(
+        "--typeguard-packages",
+        action="store",
+        help="comma separated name list of packages and modules to instrument for "
+        "type checking, or :all: to instrument all modules loaded after typeguard",
+    )
+    add_ini_option("linelist")
+
+    group.addoption(
+        "--typeguard-debug-instrumentation",
+        action="store_true",
+        help="print all instrumented code to stderr",
+    )
+    add_ini_option("bool")
+
+    group.addoption(
+        "--typeguard-typecheck-fail-callback",
+        action="store",
+        help=(
+            "a module:varname (e.g. typeguard:warn_on_error) reference to a function "
+            "that is called (with the exception, and memo object as arguments) to "
+            "handle a TypeCheckError"
+        ),
+    )
+    add_ini_option("string")
+
+    group.addoption(
+        "--typeguard-forward-ref-policy",
+        action="store",
+        choices=list(ForwardRefPolicy.__members__),
+        help=(
+            "determines how to deal with unresolveable forward references in type "
+            "annotations"
+        ),
+    )
+    add_ini_option("string")
+
+    group.addoption(
+        "--typeguard-collection-check-strategy",
+        action="store",
+        choices=list(CollectionCheckStrategy.__members__),
+        help="determines how thoroughly to check collections (list, dict, etc)",
+    )
+    add_ini_option("string")
+
+
+def pytest_configure(config: Config) -> None:
+    def getoption(name: str) -> Any:
+        return config.getoption(name.replace("-", "_")) or config.getini(name)
+
+    packages: list[str] | None = []
+    if packages_option := config.getoption("typeguard_packages"):
+        packages = [pkg.strip() for pkg in packages_option.split(",")]
+    elif packages_ini := config.getini("typeguard-packages"):
+        packages = packages_ini
+
+    if packages:
+        if packages == [":all:"]:
+            packages = None
+        else:
+            already_imported_packages = sorted(
+                package for package in packages if package in sys.modules
+            )
+            if already_imported_packages:
+                warnings.warn(
+                    f"typeguard cannot check these packages because they are already "
+                    f"imported: {', '.join(already_imported_packages)}",
+                    InstrumentationWarning,
+                    stacklevel=1,
+                )
+
+        install_import_hook(packages=packages)
+
+    debug_option = getoption("typeguard-debug-instrumentation")
+    if debug_option:
+        global_config.debug_instrumentation = True
+
+    fail_callback_option = getoption("typeguard-typecheck-fail-callback")
+    if fail_callback_option:
+        callback = resolve_reference(fail_callback_option)
+        if not callable(callback):
+            raise TypeError(
+                f"{fail_callback_option} ({qualified_name(callback.__class__)}) is not "
+                f"a callable"
+            )
+
+        global_config.typecheck_fail_callback = callback
+
+    forward_ref_policy_option = getoption("typeguard-forward-ref-policy")
+    if forward_ref_policy_option:
+        forward_ref_policy = ForwardRefPolicy.__members__[forward_ref_policy_option]
+        global_config.forward_ref_policy = forward_ref_policy
+
+    collection_check_strategy_option = getoption("typeguard-collection-check-strategy")
+    if collection_check_strategy_option:
+        collection_check_strategy = CollectionCheckStrategy.__members__[
+            collection_check_strategy_option
+        ]
+        global_config.collection_check_strategy = collection_check_strategy
diff --git a/pkg_resources/_vendor/typeguard/_suppression.py b/pkg_resources/_vendor/typeguard/_suppression.py
new file mode 100644
index 0000000000..bbbfbfbe8e
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_suppression.py
@@ -0,0 +1,86 @@
+from __future__ import annotations
+
+import sys
+from collections.abc import Callable, Generator
+from contextlib import contextmanager
+from functools import update_wrapper
+from threading import Lock
+from typing import ContextManager, TypeVar, overload
+
+if sys.version_info >= (3, 10):
+    from typing import ParamSpec
+else:
+    from typing_extensions import ParamSpec
+
+P = ParamSpec("P")
+T = TypeVar("T")
+
+type_checks_suppressed = 0
+type_checks_suppress_lock = Lock()
+
+
+@overload
+def suppress_type_checks(func: Callable[P, T]) -> Callable[P, T]: ...
+
+
+@overload
+def suppress_type_checks() -> ContextManager[None]: ...
+
+
+def suppress_type_checks(
+    func: Callable[P, T] | None = None,
+) -> Callable[P, T] | ContextManager[None]:
+    """
+    Temporarily suppress all type checking.
+
+    This function has two operating modes, based on how it's used:
+
+    #. as a context manager (``with suppress_type_checks(): ...``)
+    #. as a decorator (``@suppress_type_checks``)
+
+    When used as a context manager, :func:`check_type` and any automatically
+    instrumented functions skip the actual type checking. These context managers can be
+    nested.
+
+    When used as a decorator, all type checking is suppressed while the function is
+    running.
+
+    Type checking will resume once no more context managers are active and no decorated
+    functions are running.
+
+    Both operating modes are thread-safe.
+
+    """
+
+    def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
+        global type_checks_suppressed
+
+        with type_checks_suppress_lock:
+            type_checks_suppressed += 1
+
+        assert func is not None
+        try:
+            return func(*args, **kwargs)
+        finally:
+            with type_checks_suppress_lock:
+                type_checks_suppressed -= 1
+
+    def cm() -> Generator[None, None, None]:
+        global type_checks_suppressed
+
+        with type_checks_suppress_lock:
+            type_checks_suppressed += 1
+
+        try:
+            yield
+        finally:
+            with type_checks_suppress_lock:
+                type_checks_suppressed -= 1
+
+    if func is None:
+        # Context manager mode
+        return contextmanager(cm)()
+    else:
+        # Decorator mode
+        update_wrapper(wrapper, func)
+        return wrapper
diff --git a/pkg_resources/_vendor/typeguard/_transformer.py b/pkg_resources/_vendor/typeguard/_transformer.py
new file mode 100644
index 0000000000..13ac3630e6
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_transformer.py
@@ -0,0 +1,1229 @@
+from __future__ import annotations
+
+import ast
+import builtins
+import sys
+import typing
+from ast import (
+    AST,
+    Add,
+    AnnAssign,
+    Assign,
+    AsyncFunctionDef,
+    Attribute,
+    AugAssign,
+    BinOp,
+    BitAnd,
+    BitOr,
+    BitXor,
+    Call,
+    ClassDef,
+    Constant,
+    Dict,
+    Div,
+    Expr,
+    Expression,
+    FloorDiv,
+    FunctionDef,
+    If,
+    Import,
+    ImportFrom,
+    Index,
+    List,
+    Load,
+    LShift,
+    MatMult,
+    Mod,
+    Module,
+    Mult,
+    Name,
+    NamedExpr,
+    NodeTransformer,
+    NodeVisitor,
+    Pass,
+    Pow,
+    Return,
+    RShift,
+    Starred,
+    Store,
+    Sub,
+    Subscript,
+    Tuple,
+    Yield,
+    YieldFrom,
+    alias,
+    copy_location,
+    expr,
+    fix_missing_locations,
+    keyword,
+    walk,
+)
+from collections import defaultdict
+from collections.abc import Generator, Sequence
+from contextlib import contextmanager
+from copy import deepcopy
+from dataclasses import dataclass, field
+from typing import Any, ClassVar, cast, overload
+
+generator_names = (
+    "typing.Generator",
+    "collections.abc.Generator",
+    "typing.Iterator",
+    "collections.abc.Iterator",
+    "typing.Iterable",
+    "collections.abc.Iterable",
+    "typing.AsyncIterator",
+    "collections.abc.AsyncIterator",
+    "typing.AsyncIterable",
+    "collections.abc.AsyncIterable",
+    "typing.AsyncGenerator",
+    "collections.abc.AsyncGenerator",
+)
+anytype_names = (
+    "typing.Any",
+    "typing_extensions.Any",
+)
+literal_names = (
+    "typing.Literal",
+    "typing_extensions.Literal",
+)
+annotated_names = (
+    "typing.Annotated",
+    "typing_extensions.Annotated",
+)
+ignore_decorators = (
+    "typing.no_type_check",
+    "typeguard.typeguard_ignore",
+)
+aug_assign_functions = {
+    Add: "iadd",
+    Sub: "isub",
+    Mult: "imul",
+    MatMult: "imatmul",
+    Div: "itruediv",
+    FloorDiv: "ifloordiv",
+    Mod: "imod",
+    Pow: "ipow",
+    LShift: "ilshift",
+    RShift: "irshift",
+    BitAnd: "iand",
+    BitXor: "ixor",
+    BitOr: "ior",
+}
+
+
+@dataclass
+class TransformMemo:
+    node: Module | ClassDef | FunctionDef | AsyncFunctionDef | None
+    parent: TransformMemo | None
+    path: tuple[str, ...]
+    joined_path: Constant = field(init=False)
+    return_annotation: expr | None = None
+    yield_annotation: expr | None = None
+    send_annotation: expr | None = None
+    is_async: bool = False
+    local_names: set[str] = field(init=False, default_factory=set)
+    imported_names: dict[str, str] = field(init=False, default_factory=dict)
+    ignored_names: set[str] = field(init=False, default_factory=set)
+    load_names: defaultdict[str, dict[str, Name]] = field(
+        init=False, default_factory=lambda: defaultdict(dict)
+    )
+    has_yield_expressions: bool = field(init=False, default=False)
+    has_return_expressions: bool = field(init=False, default=False)
+    memo_var_name: Name | None = field(init=False, default=None)
+    should_instrument: bool = field(init=False, default=True)
+    variable_annotations: dict[str, expr] = field(init=False, default_factory=dict)
+    configuration_overrides: dict[str, Any] = field(init=False, default_factory=dict)
+    code_inject_index: int = field(init=False, default=0)
+
+    def __post_init__(self) -> None:
+        elements: list[str] = []
+        memo = self
+        while isinstance(memo.node, (ClassDef, FunctionDef, AsyncFunctionDef)):
+            elements.insert(0, memo.node.name)
+            if not memo.parent:
+                break
+
+            memo = memo.parent
+            if isinstance(memo.node, (FunctionDef, AsyncFunctionDef)):
+                elements.insert(0, "")
+
+        self.joined_path = Constant(".".join(elements))
+
+        # Figure out where to insert instrumentation code
+        if self.node:
+            for index, child in enumerate(self.node.body):
+                if isinstance(child, ImportFrom) and child.module == "__future__":
+                    # (module only) __future__ imports must come first
+                    continue
+                elif (
+                    isinstance(child, Expr)
+                    and isinstance(child.value, Constant)
+                    and isinstance(child.value.value, str)
+                ):
+                    continue  # docstring
+
+                self.code_inject_index = index
+                break
+
+    def get_unused_name(self, name: str) -> str:
+        memo: TransformMemo | None = self
+        while memo is not None:
+            if name in memo.local_names:
+                memo = self
+                name += "_"
+            else:
+                memo = memo.parent
+
+        self.local_names.add(name)
+        return name
+
+    def is_ignored_name(self, expression: expr | Expr | None) -> bool:
+        top_expression = (
+            expression.value if isinstance(expression, Expr) else expression
+        )
+
+        if isinstance(top_expression, Attribute) and isinstance(
+            top_expression.value, Name
+        ):
+            name = top_expression.value.id
+        elif isinstance(top_expression, Name):
+            name = top_expression.id
+        else:
+            return False
+
+        memo: TransformMemo | None = self
+        while memo is not None:
+            if name in memo.ignored_names:
+                return True
+
+            memo = memo.parent
+
+        return False
+
+    def get_memo_name(self) -> Name:
+        if not self.memo_var_name:
+            self.memo_var_name = Name(id="memo", ctx=Load())
+
+        return self.memo_var_name
+
+    def get_import(self, module: str, name: str) -> Name:
+        if module in self.load_names and name in self.load_names[module]:
+            return self.load_names[module][name]
+
+        qualified_name = f"{module}.{name}"
+        if name in self.imported_names and self.imported_names[name] == qualified_name:
+            return Name(id=name, ctx=Load())
+
+        alias = self.get_unused_name(name)
+        node = self.load_names[module][name] = Name(id=alias, ctx=Load())
+        self.imported_names[name] = qualified_name
+        return node
+
+    def insert_imports(self, node: Module | FunctionDef | AsyncFunctionDef) -> None:
+        """Insert imports needed by injected code."""
+        if not self.load_names:
+            return
+
+        # Insert imports after any "from __future__ ..." imports and any docstring
+        for modulename, names in self.load_names.items():
+            aliases = [
+                alias(orig_name, new_name.id if orig_name != new_name.id else None)
+                for orig_name, new_name in sorted(names.items())
+            ]
+            node.body.insert(self.code_inject_index, ImportFrom(modulename, aliases, 0))
+
+    def name_matches(self, expression: expr | Expr | None, *names: str) -> bool:
+        if expression is None:
+            return False
+
+        path: list[str] = []
+        top_expression = (
+            expression.value if isinstance(expression, Expr) else expression
+        )
+
+        if isinstance(top_expression, Subscript):
+            top_expression = top_expression.value
+        elif isinstance(top_expression, Call):
+            top_expression = top_expression.func
+
+        while isinstance(top_expression, Attribute):
+            path.insert(0, top_expression.attr)
+            top_expression = top_expression.value
+
+        if not isinstance(top_expression, Name):
+            return False
+
+        if top_expression.id in self.imported_names:
+            translated = self.imported_names[top_expression.id]
+        elif hasattr(builtins, top_expression.id):
+            translated = "builtins." + top_expression.id
+        else:
+            translated = top_expression.id
+
+        path.insert(0, translated)
+        joined_path = ".".join(path)
+        if joined_path in names:
+            return True
+        elif self.parent:
+            return self.parent.name_matches(expression, *names)
+        else:
+            return False
+
+    def get_config_keywords(self) -> list[keyword]:
+        if self.parent and isinstance(self.parent.node, ClassDef):
+            overrides = self.parent.configuration_overrides.copy()
+        else:
+            overrides = {}
+
+        overrides.update(self.configuration_overrides)
+        return [keyword(key, value) for key, value in overrides.items()]
+
+
+class NameCollector(NodeVisitor):
+    def __init__(self) -> None:
+        self.names: set[str] = set()
+
+    def visit_Import(self, node: Import) -> None:
+        for name in node.names:
+            self.names.add(name.asname or name.name)
+
+    def visit_ImportFrom(self, node: ImportFrom) -> None:
+        for name in node.names:
+            self.names.add(name.asname or name.name)
+
+    def visit_Assign(self, node: Assign) -> None:
+        for target in node.targets:
+            if isinstance(target, Name):
+                self.names.add(target.id)
+
+    def visit_NamedExpr(self, node: NamedExpr) -> Any:
+        if isinstance(node.target, Name):
+            self.names.add(node.target.id)
+
+    def visit_FunctionDef(self, node: FunctionDef) -> None:
+        pass
+
+    def visit_ClassDef(self, node: ClassDef) -> None:
+        pass
+
+
+class GeneratorDetector(NodeVisitor):
+    """Detects if a function node is a generator function."""
+
+    contains_yields: bool = False
+    in_root_function: bool = False
+
+    def visit_Yield(self, node: Yield) -> Any:
+        self.contains_yields = True
+
+    def visit_YieldFrom(self, node: YieldFrom) -> Any:
+        self.contains_yields = True
+
+    def visit_ClassDef(self, node: ClassDef) -> Any:
+        pass
+
+    def visit_FunctionDef(self, node: FunctionDef | AsyncFunctionDef) -> Any:
+        if not self.in_root_function:
+            self.in_root_function = True
+            self.generic_visit(node)
+            self.in_root_function = False
+
+    def visit_AsyncFunctionDef(self, node: AsyncFunctionDef) -> Any:
+        self.visit_FunctionDef(node)
+
+
+class AnnotationTransformer(NodeTransformer):
+    type_substitutions: ClassVar[dict[str, tuple[str, str]]] = {
+        "builtins.dict": ("typing", "Dict"),
+        "builtins.list": ("typing", "List"),
+        "builtins.tuple": ("typing", "Tuple"),
+        "builtins.set": ("typing", "Set"),
+        "builtins.frozenset": ("typing", "FrozenSet"),
+    }
+
+    def __init__(self, transformer: TypeguardTransformer):
+        self.transformer = transformer
+        self._memo = transformer._memo
+        self._level = 0
+
+    def visit(self, node: AST) -> Any:
+        # Don't process Literals
+        if isinstance(node, expr) and self._memo.name_matches(node, *literal_names):
+            return node
+
+        self._level += 1
+        new_node = super().visit(node)
+        self._level -= 1
+
+        if isinstance(new_node, Expression) and not hasattr(new_node, "body"):
+            return None
+
+        # Return None if this new node matches a variation of typing.Any
+        if (
+            self._level == 0
+            and isinstance(new_node, expr)
+            and self._memo.name_matches(new_node, *anytype_names)
+        ):
+            return None
+
+        return new_node
+
+    def visit_BinOp(self, node: BinOp) -> Any:
+        self.generic_visit(node)
+
+        if isinstance(node.op, BitOr):
+            # If either branch of the BinOp has been transformed to `None`, it means
+            # that a type in the union was ignored, so the entire annotation should e
+            # ignored
+            if not hasattr(node, "left") or not hasattr(node, "right"):
+                return None
+
+            # Return Any if either side is Any
+            if self._memo.name_matches(node.left, *anytype_names):
+                return node.left
+            elif self._memo.name_matches(node.right, *anytype_names):
+                return node.right
+
+            if sys.version_info < (3, 10):
+                union_name = self.transformer._get_import("typing", "Union")
+                return Subscript(
+                    value=union_name,
+                    slice=Index(
+                        Tuple(elts=[node.left, node.right], ctx=Load()), ctx=Load()
+                    ),
+                    ctx=Load(),
+                )
+
+        return node
+
+    def visit_Attribute(self, node: Attribute) -> Any:
+        if self._memo.is_ignored_name(node):
+            return None
+
+        return node
+
+    def visit_Subscript(self, node: Subscript) -> Any:
+        if self._memo.is_ignored_name(node.value):
+            return None
+
+        # The subscript of typing(_extensions).Literal can be any arbitrary string, so
+        # don't try to evaluate it as code
+        if node.slice:
+            if isinstance(node.slice, Index):
+                # Python 3.8
+                slice_value = node.slice.value  # type: ignore[attr-defined]
+            else:
+                slice_value = node.slice
+
+            if isinstance(slice_value, Tuple):
+                if self._memo.name_matches(node.value, *annotated_names):
+                    # Only treat the first argument to typing.Annotated as a potential
+                    # forward reference
+                    items = cast(
+                        typing.List[expr],
+                        [self.visit(slice_value.elts[0])] + slice_value.elts[1:],
+                    )
+                else:
+                    items = cast(
+                        typing.List[expr],
+                        [self.visit(item) for item in slice_value.elts],
+                    )
+
+                # If this is a Union and any of the items is Any, erase the entire
+                # annotation
+                if self._memo.name_matches(node.value, "typing.Union") and any(
+                    item is None
+                    or (
+                        isinstance(item, expr)
+                        and self._memo.name_matches(item, *anytype_names)
+                    )
+                    for item in items
+                ):
+                    return None
+
+                # If all items in the subscript were Any, erase the subscript entirely
+                if all(item is None for item in items):
+                    return node.value
+
+                for index, item in enumerate(items):
+                    if item is None:
+                        items[index] = self.transformer._get_import("typing", "Any")
+
+                slice_value.elts = items
+            else:
+                self.generic_visit(node)
+
+                # If the transformer erased the slice entirely, just return the node
+                # value without the subscript (unless it's Optional, in which case erase
+                # the node entirely
+                if self._memo.name_matches(
+                    node.value, "typing.Optional"
+                ) and not hasattr(node, "slice"):
+                    return None
+                if sys.version_info >= (3, 9) and not hasattr(node, "slice"):
+                    return node.value
+                elif sys.version_info < (3, 9) and not hasattr(node.slice, "value"):
+                    return node.value
+
+        return node
+
+    def visit_Name(self, node: Name) -> Any:
+        if self._memo.is_ignored_name(node):
+            return None
+
+        if sys.version_info < (3, 9):
+            for typename, substitute in self.type_substitutions.items():
+                if self._memo.name_matches(node, typename):
+                    new_node = self.transformer._get_import(*substitute)
+                    return copy_location(new_node, node)
+
+        return node
+
+    def visit_Call(self, node: Call) -> Any:
+        # Don't recurse into calls
+        return node
+
+    def visit_Constant(self, node: Constant) -> Any:
+        if isinstance(node.value, str):
+            expression = ast.parse(node.value, mode="eval")
+            new_node = self.visit(expression)
+            if new_node:
+                return copy_location(new_node.body, node)
+            else:
+                return None
+
+        return node
+
+
+class TypeguardTransformer(NodeTransformer):
+    def __init__(
+        self, target_path: Sequence[str] | None = None, target_lineno: int | None = None
+    ) -> None:
+        self._target_path = tuple(target_path) if target_path else None
+        self._memo = self._module_memo = TransformMemo(None, None, ())
+        self.names_used_in_annotations: set[str] = set()
+        self.target_node: FunctionDef | AsyncFunctionDef | None = None
+        self.target_lineno = target_lineno
+
+    def generic_visit(self, node: AST) -> AST:
+        has_non_empty_body_initially = bool(getattr(node, "body", None))
+        initial_type = type(node)
+
+        node = super().generic_visit(node)
+
+        if (
+            type(node) is initial_type
+            and has_non_empty_body_initially
+            and hasattr(node, "body")
+            and not node.body
+        ):
+            # If we have still the same node type after transformation
+            # but we've optimised it's body away, we add a `pass` statement.
+            node.body = [Pass()]
+
+        return node
+
+    @contextmanager
+    def _use_memo(
+        self, node: ClassDef | FunctionDef | AsyncFunctionDef
+    ) -> Generator[None, Any, None]:
+        new_memo = TransformMemo(node, self._memo, self._memo.path + (node.name,))
+        old_memo = self._memo
+        self._memo = new_memo
+
+        if isinstance(node, (FunctionDef, AsyncFunctionDef)):
+            new_memo.should_instrument = (
+                self._target_path is None or new_memo.path == self._target_path
+            )
+            if new_memo.should_instrument:
+                # Check if the function is a generator function
+                detector = GeneratorDetector()
+                detector.visit(node)
+
+                # Extract yield, send and return types where possible from a subscripted
+                # annotation like Generator[int, str, bool]
+                return_annotation = deepcopy(node.returns)
+                if detector.contains_yields and new_memo.name_matches(
+                    return_annotation, *generator_names
+                ):
+                    if isinstance(return_annotation, Subscript):
+                        annotation_slice = return_annotation.slice
+
+                        # Python < 3.9
+                        if isinstance(annotation_slice, Index):
+                            annotation_slice = (
+                                annotation_slice.value  # type: ignore[attr-defined]
+                            )
+
+                        if isinstance(annotation_slice, Tuple):
+                            items = annotation_slice.elts
+                        else:
+                            items = [annotation_slice]
+
+                        if len(items) > 0:
+                            new_memo.yield_annotation = self._convert_annotation(
+                                items[0]
+                            )
+
+                        if len(items) > 1:
+                            new_memo.send_annotation = self._convert_annotation(
+                                items[1]
+                            )
+
+                        if len(items) > 2:
+                            new_memo.return_annotation = self._convert_annotation(
+                                items[2]
+                            )
+                else:
+                    new_memo.return_annotation = self._convert_annotation(
+                        return_annotation
+                    )
+
+        if isinstance(node, AsyncFunctionDef):
+            new_memo.is_async = True
+
+        yield
+        self._memo = old_memo
+
+    def _get_import(self, module: str, name: str) -> Name:
+        memo = self._memo if self._target_path else self._module_memo
+        return memo.get_import(module, name)
+
+    @overload
+    def _convert_annotation(self, annotation: None) -> None: ...
+
+    @overload
+    def _convert_annotation(self, annotation: expr) -> expr: ...
+
+    def _convert_annotation(self, annotation: expr | None) -> expr | None:
+        if annotation is None:
+            return None
+
+        # Convert PEP 604 unions (x | y) and generic built-in collections where
+        # necessary, and undo forward references
+        new_annotation = cast(expr, AnnotationTransformer(self).visit(annotation))
+        if isinstance(new_annotation, expr):
+            new_annotation = ast.copy_location(new_annotation, annotation)
+
+            # Store names used in the annotation
+            names = {node.id for node in walk(new_annotation) if isinstance(node, Name)}
+            self.names_used_in_annotations.update(names)
+
+        return new_annotation
+
+    def visit_Name(self, node: Name) -> Name:
+        self._memo.local_names.add(node.id)
+        return node
+
+    def visit_Module(self, node: Module) -> Module:
+        self._module_memo = self._memo = TransformMemo(node, None, ())
+        self.generic_visit(node)
+        self._module_memo.insert_imports(node)
+
+        fix_missing_locations(node)
+        return node
+
+    def visit_Import(self, node: Import) -> Import:
+        for name in node.names:
+            self._memo.local_names.add(name.asname or name.name)
+            self._memo.imported_names[name.asname or name.name] = name.name
+
+        return node
+
+    def visit_ImportFrom(self, node: ImportFrom) -> ImportFrom:
+        for name in node.names:
+            if name.name != "*":
+                alias = name.asname or name.name
+                self._memo.local_names.add(alias)
+                self._memo.imported_names[alias] = f"{node.module}.{name.name}"
+
+        return node
+
+    def visit_ClassDef(self, node: ClassDef) -> ClassDef | None:
+        self._memo.local_names.add(node.name)
+
+        # Eliminate top level classes not belonging to the target path
+        if (
+            self._target_path is not None
+            and not self._memo.path
+            and node.name != self._target_path[0]
+        ):
+            return None
+
+        with self._use_memo(node):
+            for decorator in node.decorator_list.copy():
+                if self._memo.name_matches(decorator, "typeguard.typechecked"):
+                    # Remove the decorator to prevent duplicate instrumentation
+                    node.decorator_list.remove(decorator)
+
+                    # Store any configuration overrides
+                    if isinstance(decorator, Call) and decorator.keywords:
+                        self._memo.configuration_overrides.update(
+                            {kw.arg: kw.value for kw in decorator.keywords if kw.arg}
+                        )
+
+            self.generic_visit(node)
+            return node
+
+    def visit_FunctionDef(
+        self, node: FunctionDef | AsyncFunctionDef
+    ) -> FunctionDef | AsyncFunctionDef | None:
+        """
+        Injects type checks for function arguments, and for a return of None if the
+        function is annotated to return something else than Any or None, and the body
+        ends without an explicit "return".
+
+        """
+        self._memo.local_names.add(node.name)
+
+        # Eliminate top level functions not belonging to the target path
+        if (
+            self._target_path is not None
+            and not self._memo.path
+            and node.name != self._target_path[0]
+        ):
+            return None
+
+        # Skip instrumentation if we're instrumenting the whole module and the function
+        # contains either @no_type_check or @typeguard_ignore
+        if self._target_path is None:
+            for decorator in node.decorator_list:
+                if self._memo.name_matches(decorator, *ignore_decorators):
+                    return node
+
+        with self._use_memo(node):
+            arg_annotations: dict[str, Any] = {}
+            if self._target_path is None or self._memo.path == self._target_path:
+                # Find line number we're supposed to match against
+                if node.decorator_list:
+                    first_lineno = node.decorator_list[0].lineno
+                else:
+                    first_lineno = node.lineno
+
+                for decorator in node.decorator_list.copy():
+                    if self._memo.name_matches(decorator, "typing.overload"):
+                        # Remove overloads entirely
+                        return None
+                    elif self._memo.name_matches(decorator, "typeguard.typechecked"):
+                        # Remove the decorator to prevent duplicate instrumentation
+                        node.decorator_list.remove(decorator)
+
+                        # Store any configuration overrides
+                        if isinstance(decorator, Call) and decorator.keywords:
+                            self._memo.configuration_overrides = {
+                                kw.arg: kw.value for kw in decorator.keywords if kw.arg
+                            }
+
+                if self.target_lineno == first_lineno:
+                    assert self.target_node is None
+                    self.target_node = node
+                    if node.decorator_list:
+                        self.target_lineno = node.decorator_list[0].lineno
+                    else:
+                        self.target_lineno = node.lineno
+
+                all_args = node.args.args + node.args.kwonlyargs + node.args.posonlyargs
+
+                # Ensure that any type shadowed by the positional or keyword-only
+                # argument names are ignored in this function
+                for arg in all_args:
+                    self._memo.ignored_names.add(arg.arg)
+
+                # Ensure that any type shadowed by the variable positional argument name
+                # (e.g. "args" in *args) is ignored this function
+                if node.args.vararg:
+                    self._memo.ignored_names.add(node.args.vararg.arg)
+
+                # Ensure that any type shadowed by the variable keywrod argument name
+                # (e.g. "kwargs" in *kwargs) is ignored this function
+                if node.args.kwarg:
+                    self._memo.ignored_names.add(node.args.kwarg.arg)
+
+                for arg in all_args:
+                    annotation = self._convert_annotation(deepcopy(arg.annotation))
+                    if annotation:
+                        arg_annotations[arg.arg] = annotation
+
+                if node.args.vararg:
+                    annotation_ = self._convert_annotation(node.args.vararg.annotation)
+                    if annotation_:
+                        if sys.version_info >= (3, 9):
+                            container = Name("tuple", ctx=Load())
+                        else:
+                            container = self._get_import("typing", "Tuple")
+
+                        subscript_slice: Tuple | Index = Tuple(
+                            [
+                                annotation_,
+                                Constant(Ellipsis),
+                            ],
+                            ctx=Load(),
+                        )
+                        if sys.version_info < (3, 9):
+                            subscript_slice = Index(subscript_slice, ctx=Load())
+
+                        arg_annotations[node.args.vararg.arg] = Subscript(
+                            container, subscript_slice, ctx=Load()
+                        )
+
+                if node.args.kwarg:
+                    annotation_ = self._convert_annotation(node.args.kwarg.annotation)
+                    if annotation_:
+                        if sys.version_info >= (3, 9):
+                            container = Name("dict", ctx=Load())
+                        else:
+                            container = self._get_import("typing", "Dict")
+
+                        subscript_slice = Tuple(
+                            [
+                                Name("str", ctx=Load()),
+                                annotation_,
+                            ],
+                            ctx=Load(),
+                        )
+                        if sys.version_info < (3, 9):
+                            subscript_slice = Index(subscript_slice, ctx=Load())
+
+                        arg_annotations[node.args.kwarg.arg] = Subscript(
+                            container, subscript_slice, ctx=Load()
+                        )
+
+                if arg_annotations:
+                    self._memo.variable_annotations.update(arg_annotations)
+
+            self.generic_visit(node)
+
+            if arg_annotations:
+                annotations_dict = Dict(
+                    keys=[Constant(key) for key in arg_annotations.keys()],
+                    values=[
+                        Tuple([Name(key, ctx=Load()), annotation], ctx=Load())
+                        for key, annotation in arg_annotations.items()
+                    ],
+                )
+                func_name = self._get_import(
+                    "typeguard._functions", "check_argument_types"
+                )
+                args = [
+                    self._memo.joined_path,
+                    annotations_dict,
+                    self._memo.get_memo_name(),
+                ]
+                node.body.insert(
+                    self._memo.code_inject_index, Expr(Call(func_name, args, []))
+                )
+
+            # Add a checked "return None" to the end if there's no explicit return
+            # Skip if the return annotation is None or Any
+            if (
+                self._memo.return_annotation
+                and (not self._memo.is_async or not self._memo.has_yield_expressions)
+                and not isinstance(node.body[-1], Return)
+                and (
+                    not isinstance(self._memo.return_annotation, Constant)
+                    or self._memo.return_annotation.value is not None
+                )
+            ):
+                func_name = self._get_import(
+                    "typeguard._functions", "check_return_type"
+                )
+                return_node = Return(
+                    Call(
+                        func_name,
+                        [
+                            self._memo.joined_path,
+                            Constant(None),
+                            self._memo.return_annotation,
+                            self._memo.get_memo_name(),
+                        ],
+                        [],
+                    )
+                )
+
+                # Replace a placeholder "pass" at the end
+                if isinstance(node.body[-1], Pass):
+                    copy_location(return_node, node.body[-1])
+                    del node.body[-1]
+
+                node.body.append(return_node)
+
+            # Insert code to create the call memo, if it was ever needed for this
+            # function
+            if self._memo.memo_var_name:
+                memo_kwargs: dict[str, Any] = {}
+                if self._memo.parent and isinstance(self._memo.parent.node, ClassDef):
+                    for decorator in node.decorator_list:
+                        if (
+                            isinstance(decorator, Name)
+                            and decorator.id == "staticmethod"
+                        ):
+                            break
+                        elif (
+                            isinstance(decorator, Name)
+                            and decorator.id == "classmethod"
+                        ):
+                            memo_kwargs["self_type"] = Name(
+                                id=node.args.args[0].arg, ctx=Load()
+                            )
+                            break
+                    else:
+                        if node.args.args:
+                            if node.name == "__new__":
+                                memo_kwargs["self_type"] = Name(
+                                    id=node.args.args[0].arg, ctx=Load()
+                                )
+                            else:
+                                memo_kwargs["self_type"] = Attribute(
+                                    Name(id=node.args.args[0].arg, ctx=Load()),
+                                    "__class__",
+                                    ctx=Load(),
+                                )
+
+                # Construct the function reference
+                # Nested functions get special treatment: the function name is added
+                # to free variables (and the closure of the resulting function)
+                names: list[str] = [node.name]
+                memo = self._memo.parent
+                while memo:
+                    if isinstance(memo.node, (FunctionDef, AsyncFunctionDef)):
+                        # This is a nested function. Use the function name as-is.
+                        del names[:-1]
+                        break
+                    elif not isinstance(memo.node, ClassDef):
+                        break
+
+                    names.insert(0, memo.node.name)
+                    memo = memo.parent
+
+                config_keywords = self._memo.get_config_keywords()
+                if config_keywords:
+                    memo_kwargs["config"] = Call(
+                        self._get_import("dataclasses", "replace"),
+                        [self._get_import("typeguard._config", "global_config")],
+                        config_keywords,
+                    )
+
+                self._memo.memo_var_name.id = self._memo.get_unused_name("memo")
+                memo_store_name = Name(id=self._memo.memo_var_name.id, ctx=Store())
+                globals_call = Call(Name(id="globals", ctx=Load()), [], [])
+                locals_call = Call(Name(id="locals", ctx=Load()), [], [])
+                memo_expr = Call(
+                    self._get_import("typeguard", "TypeCheckMemo"),
+                    [globals_call, locals_call],
+                    [keyword(key, value) for key, value in memo_kwargs.items()],
+                )
+                node.body.insert(
+                    self._memo.code_inject_index,
+                    Assign([memo_store_name], memo_expr),
+                )
+
+                self._memo.insert_imports(node)
+
+                # Special case the __new__() method to create a local alias from the
+                # class name to the first argument (usually "cls")
+                if (
+                    isinstance(node, FunctionDef)
+                    and node.args
+                    and self._memo.parent is not None
+                    and isinstance(self._memo.parent.node, ClassDef)
+                    and node.name == "__new__"
+                ):
+                    first_args_expr = Name(node.args.args[0].arg, ctx=Load())
+                    cls_name = Name(self._memo.parent.node.name, ctx=Store())
+                    node.body.insert(
+                        self._memo.code_inject_index,
+                        Assign([cls_name], first_args_expr),
+                    )
+
+                # Rmove any placeholder "pass" at the end
+                if isinstance(node.body[-1], Pass):
+                    del node.body[-1]
+
+        return node
+
+    def visit_AsyncFunctionDef(
+        self, node: AsyncFunctionDef
+    ) -> FunctionDef | AsyncFunctionDef | None:
+        return self.visit_FunctionDef(node)
+
+    def visit_Return(self, node: Return) -> Return:
+        """This injects type checks into "return" statements."""
+        self.generic_visit(node)
+        if (
+            self._memo.return_annotation
+            and self._memo.should_instrument
+            and not self._memo.is_ignored_name(self._memo.return_annotation)
+        ):
+            func_name = self._get_import("typeguard._functions", "check_return_type")
+            old_node = node
+            retval = old_node.value or Constant(None)
+            node = Return(
+                Call(
+                    func_name,
+                    [
+                        self._memo.joined_path,
+                        retval,
+                        self._memo.return_annotation,
+                        self._memo.get_memo_name(),
+                    ],
+                    [],
+                )
+            )
+            copy_location(node, old_node)
+
+        return node
+
+    def visit_Yield(self, node: Yield) -> Yield | Call:
+        """
+        This injects type checks into "yield" expressions, checking both the yielded
+        value and the value sent back to the generator, when appropriate.
+
+        """
+        self._memo.has_yield_expressions = True
+        self.generic_visit(node)
+
+        if (
+            self._memo.yield_annotation
+            and self._memo.should_instrument
+            and not self._memo.is_ignored_name(self._memo.yield_annotation)
+        ):
+            func_name = self._get_import("typeguard._functions", "check_yield_type")
+            yieldval = node.value or Constant(None)
+            node.value = Call(
+                func_name,
+                [
+                    self._memo.joined_path,
+                    yieldval,
+                    self._memo.yield_annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+
+        if (
+            self._memo.send_annotation
+            and self._memo.should_instrument
+            and not self._memo.is_ignored_name(self._memo.send_annotation)
+        ):
+            func_name = self._get_import("typeguard._functions", "check_send_type")
+            old_node = node
+            call_node = Call(
+                func_name,
+                [
+                    self._memo.joined_path,
+                    old_node,
+                    self._memo.send_annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+            copy_location(call_node, old_node)
+            return call_node
+
+        return node
+
+    def visit_AnnAssign(self, node: AnnAssign) -> Any:
+        """
+        This injects a type check into a local variable annotation-assignment within a
+        function body.
+
+        """
+        self.generic_visit(node)
+
+        if (
+            isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef))
+            and node.annotation
+            and isinstance(node.target, Name)
+        ):
+            self._memo.ignored_names.add(node.target.id)
+            annotation = self._convert_annotation(deepcopy(node.annotation))
+            if annotation:
+                self._memo.variable_annotations[node.target.id] = annotation
+                if node.value:
+                    func_name = self._get_import(
+                        "typeguard._functions", "check_variable_assignment"
+                    )
+                    node.value = Call(
+                        func_name,
+                        [
+                            node.value,
+                            Constant(node.target.id),
+                            annotation,
+                            self._memo.get_memo_name(),
+                        ],
+                        [],
+                    )
+
+        return node
+
+    def visit_Assign(self, node: Assign) -> Any:
+        """
+        This injects a type check into a local variable assignment within a function
+        body. The variable must have been annotated earlier in the function body.
+
+        """
+        self.generic_visit(node)
+
+        # Only instrument function-local assignments
+        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)):
+            targets: list[dict[Constant, expr | None]] = []
+            check_required = False
+            for target in node.targets:
+                elts: Sequence[expr]
+                if isinstance(target, Name):
+                    elts = [target]
+                elif isinstance(target, Tuple):
+                    elts = target.elts
+                else:
+                    continue
+
+                annotations_: dict[Constant, expr | None] = {}
+                for exp in elts:
+                    prefix = ""
+                    if isinstance(exp, Starred):
+                        exp = exp.value
+                        prefix = "*"
+
+                    if isinstance(exp, Name):
+                        self._memo.ignored_names.add(exp.id)
+                        name = prefix + exp.id
+                        annotation = self._memo.variable_annotations.get(exp.id)
+                        if annotation:
+                            annotations_[Constant(name)] = annotation
+                            check_required = True
+                        else:
+                            annotations_[Constant(name)] = None
+
+                targets.append(annotations_)
+
+            if check_required:
+                # Replace missing annotations with typing.Any
+                for item in targets:
+                    for key, expression in item.items():
+                        if expression is None:
+                            item[key] = self._get_import("typing", "Any")
+
+                if len(targets) == 1 and len(targets[0]) == 1:
+                    func_name = self._get_import(
+                        "typeguard._functions", "check_variable_assignment"
+                    )
+                    target_varname = next(iter(targets[0]))
+                    node.value = Call(
+                        func_name,
+                        [
+                            node.value,
+                            target_varname,
+                            targets[0][target_varname],
+                            self._memo.get_memo_name(),
+                        ],
+                        [],
+                    )
+                elif targets:
+                    func_name = self._get_import(
+                        "typeguard._functions", "check_multi_variable_assignment"
+                    )
+                    targets_arg = List(
+                        [
+                            Dict(keys=list(target), values=list(target.values()))
+                            for target in targets
+                        ],
+                        ctx=Load(),
+                    )
+                    node.value = Call(
+                        func_name,
+                        [node.value, targets_arg, self._memo.get_memo_name()],
+                        [],
+                    )
+
+        return node
+
+    def visit_NamedExpr(self, node: NamedExpr) -> Any:
+        """This injects a type check into an assignment expression (a := foo())."""
+        self.generic_visit(node)
+
+        # Only instrument function-local assignments
+        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)) and isinstance(
+            node.target, Name
+        ):
+            self._memo.ignored_names.add(node.target.id)
+
+            # Bail out if no matching annotation is found
+            annotation = self._memo.variable_annotations.get(node.target.id)
+            if annotation is None:
+                return node
+
+            func_name = self._get_import(
+                "typeguard._functions", "check_variable_assignment"
+            )
+            node.value = Call(
+                func_name,
+                [
+                    node.value,
+                    Constant(node.target.id),
+                    annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+
+        return node
+
+    def visit_AugAssign(self, node: AugAssign) -> Any:
+        """
+        This injects a type check into an augmented assignment expression (a += 1).
+
+        """
+        self.generic_visit(node)
+
+        # Only instrument function-local assignments
+        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)) and isinstance(
+            node.target, Name
+        ):
+            # Bail out if no matching annotation is found
+            annotation = self._memo.variable_annotations.get(node.target.id)
+            if annotation is None:
+                return node
+
+            # Bail out if the operator is not found (newer Python version?)
+            try:
+                operator_func_name = aug_assign_functions[node.op.__class__]
+            except KeyError:
+                return node
+
+            operator_func = self._get_import("operator", operator_func_name)
+            operator_call = Call(
+                operator_func, [Name(node.target.id, ctx=Load()), node.value], []
+            )
+            check_call = Call(
+                self._get_import("typeguard._functions", "check_variable_assignment"),
+                [
+                    operator_call,
+                    Constant(node.target.id),
+                    annotation,
+                    self._memo.get_memo_name(),
+                ],
+                [],
+            )
+            return Assign(targets=[node.target], value=check_call)
+
+        return node
+
+    def visit_If(self, node: If) -> Any:
+        """
+        This blocks names from being collected from a module-level
+        "if typing.TYPE_CHECKING:" block, so that they won't be type checked.
+
+        """
+        self.generic_visit(node)
+
+        if (
+            self._memo is self._module_memo
+            and isinstance(node.test, Name)
+            and self._memo.name_matches(node.test, "typing.TYPE_CHECKING")
+        ):
+            collector = NameCollector()
+            collector.visit(node)
+            self._memo.ignored_names.update(collector.names)
+
+        return node
diff --git a/pkg_resources/_vendor/typeguard/_union_transformer.py b/pkg_resources/_vendor/typeguard/_union_transformer.py
new file mode 100644
index 0000000000..19617e6af5
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_union_transformer.py
@@ -0,0 +1,55 @@
+"""
+Transforms lazily evaluated PEP 604 unions into typing.Unions, for compatibility with
+Python versions older than 3.10.
+"""
+
+from __future__ import annotations
+
+from ast import (
+    BinOp,
+    BitOr,
+    Index,
+    Load,
+    Name,
+    NodeTransformer,
+    Subscript,
+    fix_missing_locations,
+    parse,
+)
+from ast import Tuple as ASTTuple
+from types import CodeType
+from typing import Any, Dict, FrozenSet, List, Set, Tuple, Union
+
+type_substitutions = {
+    "dict": Dict,
+    "list": List,
+    "tuple": Tuple,
+    "set": Set,
+    "frozenset": FrozenSet,
+    "Union": Union,
+}
+
+
+class UnionTransformer(NodeTransformer):
+    def __init__(self, union_name: Name | None = None):
+        self.union_name = union_name or Name(id="Union", ctx=Load())
+
+    def visit_BinOp(self, node: BinOp) -> Any:
+        self.generic_visit(node)
+        if isinstance(node.op, BitOr):
+            return Subscript(
+                value=self.union_name,
+                slice=Index(
+                    ASTTuple(elts=[node.left, node.right], ctx=Load()), ctx=Load()
+                ),
+                ctx=Load(),
+            )
+
+        return node
+
+
+def compile_type_hint(hint: str) -> CodeType:
+    parsed = parse(hint, "", "eval")
+    UnionTransformer().visit(parsed)
+    fix_missing_locations(parsed)
+    return compile(parsed, "", "eval", flags=0)
diff --git a/pkg_resources/_vendor/typeguard/_utils.py b/pkg_resources/_vendor/typeguard/_utils.py
new file mode 100644
index 0000000000..9bcc8417f8
--- /dev/null
+++ b/pkg_resources/_vendor/typeguard/_utils.py
@@ -0,0 +1,173 @@
+from __future__ import annotations
+
+import inspect
+import sys
+from importlib import import_module
+from inspect import currentframe
+from types import CodeType, FrameType, FunctionType
+from typing import TYPE_CHECKING, Any, Callable, ForwardRef, Union, cast, final
+from weakref import WeakValueDictionary
+
+if TYPE_CHECKING:
+    from ._memo import TypeCheckMemo
+
+if sys.version_info >= (3, 13):
+    from typing import get_args, get_origin
+
+    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
+        return forwardref._evaluate(
+            memo.globals, memo.locals, type_params=(), recursive_guard=frozenset()
+        )
+
+elif sys.version_info >= (3, 10):
+    from typing import get_args, get_origin
+
+    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
+        return forwardref._evaluate(
+            memo.globals, memo.locals, recursive_guard=frozenset()
+        )
+
+else:
+    from typing_extensions import get_args, get_origin
+
+    evaluate_extra_args: tuple[frozenset[Any], ...] = (
+        (frozenset(),) if sys.version_info >= (3, 9) else ()
+    )
+
+    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
+        from ._union_transformer import compile_type_hint, type_substitutions
+
+        if not forwardref.__forward_evaluated__:
+            forwardref.__forward_code__ = compile_type_hint(forwardref.__forward_arg__)
+
+        try:
+            return forwardref._evaluate(memo.globals, memo.locals, *evaluate_extra_args)
+        except NameError:
+            if sys.version_info < (3, 10):
+                # Try again, with the type substitutions (list -> List etc.) in place
+                new_globals = memo.globals.copy()
+                new_globals.setdefault("Union", Union)
+                if sys.version_info < (3, 9):
+                    new_globals.update(type_substitutions)
+
+                return forwardref._evaluate(
+                    new_globals, memo.locals or new_globals, *evaluate_extra_args
+                )
+
+            raise
+
+
+_functions_map: WeakValueDictionary[CodeType, FunctionType] = WeakValueDictionary()
+
+
+def get_type_name(type_: Any) -> str:
+    name: str
+    for attrname in "__name__", "_name", "__forward_arg__":
+        candidate = getattr(type_, attrname, None)
+        if isinstance(candidate, str):
+            name = candidate
+            break
+    else:
+        origin = get_origin(type_)
+        candidate = getattr(origin, "_name", None)
+        if candidate is None:
+            candidate = type_.__class__.__name__.strip("_")
+
+        if isinstance(candidate, str):
+            name = candidate
+        else:
+            return "(unknown)"
+
+    args = get_args(type_)
+    if args:
+        if name == "Literal":
+            formatted_args = ", ".join(repr(arg) for arg in args)
+        else:
+            formatted_args = ", ".join(get_type_name(arg) for arg in args)
+
+        name += f"[{formatted_args}]"
+
+    module = getattr(type_, "__module__", None)
+    if module and module not in (None, "typing", "typing_extensions", "builtins"):
+        name = module + "." + name
+
+    return name
+
+
+def qualified_name(obj: Any, *, add_class_prefix: bool = False) -> str:
+    """
+    Return the qualified name (e.g. package.module.Type) for the given object.
+
+    Builtins and types from the :mod:`typing` package get special treatment by having
+    the module name stripped from the generated name.
+
+    """
+    if obj is None:
+        return "None"
+    elif inspect.isclass(obj):
+        prefix = "class " if add_class_prefix else ""
+        type_ = obj
+    else:
+        prefix = ""
+        type_ = type(obj)
+
+    module = type_.__module__
+    qualname = type_.__qualname__
+    name = qualname if module in ("typing", "builtins") else f"{module}.{qualname}"
+    return prefix + name
+
+
+def function_name(func: Callable[..., Any]) -> str:
+    """
+    Return the qualified name of the given function.
+
+    Builtins and types from the :mod:`typing` package get special treatment by having
+    the module name stripped from the generated name.
+
+    """
+    # For partial functions and objects with __call__ defined, __qualname__ does not
+    # exist
+    module = getattr(func, "__module__", "")
+    qualname = (module + ".") if module not in ("builtins", "") else ""
+    return qualname + getattr(func, "__qualname__", repr(func))
+
+
+def resolve_reference(reference: str) -> Any:
+    modulename, varname = reference.partition(":")[::2]
+    if not modulename or not varname:
+        raise ValueError(f"{reference!r} is not a module:varname reference")
+
+    obj = import_module(modulename)
+    for attr in varname.split("."):
+        obj = getattr(obj, attr)
+
+    return obj
+
+
+def is_method_of(obj: object, cls: type) -> bool:
+    return (
+        inspect.isfunction(obj)
+        and obj.__module__ == cls.__module__
+        and obj.__qualname__.startswith(cls.__qualname__ + ".")
+    )
+
+
+def get_stacklevel() -> int:
+    level = 1
+    frame = cast(FrameType, currentframe()).f_back
+    while frame and frame.f_globals.get("__name__", "").startswith("typeguard."):
+        level += 1
+        frame = frame.f_back
+
+    return level
+
+
+@final
+class Unset:
+    __slots__ = ()
+
+    def __repr__(self) -> str:
+        return ""
+
+
+unset = Unset()
diff --git a/pkg_resources/_vendor/typeguard/py.typed b/pkg_resources/_vendor/typeguard/py.typed
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
new file mode 100644
index 0000000000..f26bcf4d2d
--- /dev/null
+++ b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
@@ -0,0 +1,279 @@
+A. HISTORY OF THE SOFTWARE
+==========================
+
+Python was created in the early 1990s by Guido van Rossum at Stichting
+Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
+as a successor of a language called ABC.  Guido remains Python's
+principal author, although it includes many contributions from others.
+
+In 1995, Guido continued his work on Python at the Corporation for
+National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
+in Reston, Virginia where he released several versions of the
+software.
+
+In May 2000, Guido and the Python core development team moved to
+BeOpen.com to form the BeOpen PythonLabs team.  In October of the same
+year, the PythonLabs team moved to Digital Creations, which became
+Zope Corporation.  In 2001, the Python Software Foundation (PSF, see
+https://www.python.org/psf/) was formed, a non-profit organization
+created specifically to own Python-related Intellectual Property.
+Zope Corporation was a sponsoring member of the PSF.
+
+All Python releases are Open Source (see https://opensource.org for
+the Open Source Definition).  Historically, most, but not all, Python
+releases have also been GPL-compatible; the table below summarizes
+the various releases.
+
+    Release         Derived     Year        Owner       GPL-
+                    from                                compatible? (1)
+
+    0.9.0 thru 1.2              1991-1995   CWI         yes
+    1.3 thru 1.5.2  1.2         1995-1999   CNRI        yes
+    1.6             1.5.2       2000        CNRI        no
+    2.0             1.6         2000        BeOpen.com  no
+    1.6.1           1.6         2001        CNRI        yes (2)
+    2.1             2.0+1.6.1   2001        PSF         no
+    2.0.1           2.0+1.6.1   2001        PSF         yes
+    2.1.1           2.1+2.0.1   2001        PSF         yes
+    2.1.2           2.1.1       2002        PSF         yes
+    2.1.3           2.1.2       2002        PSF         yes
+    2.2 and above   2.1.1       2001-now    PSF         yes
+
+Footnotes:
+
+(1) GPL-compatible doesn't mean that we're distributing Python under
+    the GPL.  All Python licenses, unlike the GPL, let you distribute
+    a modified version without making your changes open source.  The
+    GPL-compatible licenses make it possible to combine Python with
+    other software that is released under the GPL; the others don't.
+
+(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
+    because its license has a choice of law clause.  According to
+    CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
+    is "not incompatible" with the GPL.
+
+Thanks to the many outside volunteers who have worked under Guido's
+direction to make these releases possible.
+
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+===============================================================
+
+Python software and documentation are licensed under the
+Python Software Foundation License Version 2.
+
+Starting with Python 3.8.6, examples, recipes, and other code in
+the documentation are dual licensed under the PSF License Version 2
+and the Zero-Clause BSD license.
+
+Some software incorporated into Python is under different licenses.
+The licenses are listed with code falling under that license.
+
+
+PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+--------------------------------------------
+
+1. This LICENSE AGREEMENT is between the Python Software Foundation
+("PSF"), and the Individual or Organization ("Licensee") accessing and
+otherwise using this software ("Python") in source or binary form and
+its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF hereby
+grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
+analyze, test, perform and/or display publicly, prepare derivative works,
+distribute, and otherwise use Python alone or in any derivative version,
+provided, however, that PSF's License Agreement and PSF's notice of copyright,
+i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
+All Rights Reserved" are retained in Python alone or in any derivative version
+prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python.
+
+4. PSF is making Python available to Licensee on an "AS IS"
+basis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between PSF and
+Licensee.  This License Agreement does not grant permission to use PSF
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
+-------------------------------------------
+
+BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
+office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
+Individual or Organization ("Licensee") accessing and otherwise using
+this software in source or binary form and its associated
+documentation ("the Software").
+
+2. Subject to the terms and conditions of this BeOpen Python License
+Agreement, BeOpen hereby grants Licensee a non-exclusive,
+royalty-free, world-wide license to reproduce, analyze, test, perform
+and/or display publicly, prepare derivative works, distribute, and
+otherwise use the Software alone or in any derivative version,
+provided, however, that the BeOpen Python License is retained in the
+Software, alone or in any derivative version prepared by Licensee.
+
+3. BeOpen is making the Software available to Licensee on an "AS IS"
+basis.  BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
+SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
+AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
+DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+5. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+6. This License Agreement shall be governed by and interpreted in all
+respects by the law of the State of California, excluding conflict of
+law provisions.  Nothing in this License Agreement shall be deemed to
+create any relationship of agency, partnership, or joint venture
+between BeOpen and Licensee.  This License Agreement does not grant
+permission to use BeOpen trademarks or trade names in a trademark
+sense to endorse or promote products or services of Licensee, or any
+third party.  As an exception, the "BeOpen Python" logos available at
+http://www.pythonlabs.com/logos.html may be used according to the
+permissions granted on that web page.
+
+7. By copying, installing or otherwise using the software, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
+---------------------------------------
+
+1. This LICENSE AGREEMENT is between the Corporation for National
+Research Initiatives, having an office at 1895 Preston White Drive,
+Reston, VA 20191 ("CNRI"), and the Individual or Organization
+("Licensee") accessing and otherwise using Python 1.6.1 software in
+source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, CNRI
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python 1.6.1
+alone or in any derivative version, provided, however, that CNRI's
+License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
+1995-2001 Corporation for National Research Initiatives; All Rights
+Reserved" are retained in Python 1.6.1 alone or in any derivative
+version prepared by Licensee.  Alternately, in lieu of CNRI's License
+Agreement, Licensee may substitute the following text (omitting the
+quotes): "Python 1.6.1 is made available subject to the terms and
+conditions in CNRI's License Agreement.  This Agreement together with
+Python 1.6.1 may be located on the internet using the following
+unique, persistent identifier (known as a handle): 1895.22/1013.  This
+Agreement may also be obtained from a proxy server on the internet
+using the following URL: http://hdl.handle.net/1895.22/1013".
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python 1.6.1 or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python 1.6.1.
+
+4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
+basis.  CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. This License Agreement shall be governed by the federal
+intellectual property law of the United States, including without
+limitation the federal copyright law, and, to the extent such
+U.S. federal law does not apply, by the law of the Commonwealth of
+Virginia, excluding Virginia's conflict of law provisions.
+Notwithstanding the foregoing, with regard to derivative works based
+on Python 1.6.1 that incorporate non-separable material that was
+previously distributed under the GNU General Public License (GPL), the
+law of the Commonwealth of Virginia shall govern this License
+Agreement only as to issues arising under or with respect to
+Paragraphs 4, 5, and 7 of this License Agreement.  Nothing in this
+License Agreement shall be deemed to create any relationship of
+agency, partnership, or joint venture between CNRI and Licensee.  This
+License Agreement does not grant permission to use CNRI trademarks or
+trade name in a trademark sense to endorse or promote products or
+services of Licensee, or any third party.
+
+8. By clicking on the "ACCEPT" button where indicated, or by copying,
+installing or otherwise using Python 1.6.1, Licensee agrees to be
+bound by the terms and conditions of this License Agreement.
+
+        ACCEPT
+
+
+CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
+--------------------------------------------------
+
+Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
+The Netherlands.  All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
+----------------------------------------------------------------------
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA
new file mode 100644
index 0000000000..f15e2b3877
--- /dev/null
+++ b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA
@@ -0,0 +1,67 @@
+Metadata-Version: 2.1
+Name: typing_extensions
+Version: 4.12.2
+Summary: Backported and Experimental Type Hints for Python 3.8+
+Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing
+Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" 
+Requires-Python: >=3.8
+Description-Content-Type: text/markdown
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Python Software Foundation License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: 3.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: Topic :: Software Development
+Project-URL: Bug Tracker, https://github.com/python/typing_extensions/issues
+Project-URL: Changes, https://github.com/python/typing_extensions/blob/main/CHANGELOG.md
+Project-URL: Documentation, https://typing-extensions.readthedocs.io/
+Project-URL: Home, https://github.com/python/typing_extensions
+Project-URL: Q & A, https://github.com/python/typing/discussions
+Project-URL: Repository, https://github.com/python/typing_extensions
+
+# Typing Extensions
+
+[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing)
+
+[Documentation](https://typing-extensions.readthedocs.io/en/latest/#) –
+[PyPI](https://pypi.org/project/typing-extensions/)
+
+## Overview
+
+The `typing_extensions` module serves two related purposes:
+
+- Enable use of new type system features on older Python versions. For example,
+  `typing.TypeGuard` is new in Python 3.10, but `typing_extensions` allows
+  users on previous Python versions to use it too.
+- Enable experimentation with new type system PEPs before they are accepted and
+  added to the `typing` module.
+
+`typing_extensions` is treated specially by static type checkers such as
+mypy and pyright. Objects defined in `typing_extensions` are treated the same
+way as equivalent forms in `typing`.
+
+`typing_extensions` uses
+[Semantic Versioning](https://semver.org/). The
+major version will be incremented only for backwards-incompatible changes.
+Therefore, it's safe to depend
+on `typing_extensions` like this: `typing_extensions >=x.y, <(x+1)`,
+where `x.y` is the first version that includes all features you need.
+
+## Included items
+
+See [the documentation](https://typing-extensions.readthedocs.io/en/latest/#) for a
+complete listing of module contents.
+
+## Contributing
+
+See [CONTRIBUTING.md](https://github.com/python/typing_extensions/blob/main/CONTRIBUTING.md)
+for how to contribute to `typing_extensions`.
+
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD
new file mode 100644
index 0000000000..bc7b45334d
--- /dev/null
+++ b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD
@@ -0,0 +1,7 @@
+__pycache__/typing_extensions.cpython-312.pyc,,
+typing_extensions-4.12.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+typing_extensions-4.12.2.dist-info/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936
+typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjWx-N8TOznM9UGW5Gm2DicVpDtRA8W0,3018
+typing_extensions-4.12.2.dist-info/RECORD,,
+typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
+typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/WHEEL b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/WHEEL
new file mode 100644
index 0000000000..3b5e64b5e6
--- /dev/null
+++ b/pkg_resources/_vendor/typing_extensions-4.12.2.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/pkg_resources/_vendor/typing_extensions.py b/pkg_resources/_vendor/typing_extensions.py
new file mode 100644
index 0000000000..dec429ca87
--- /dev/null
+++ b/pkg_resources/_vendor/typing_extensions.py
@@ -0,0 +1,3641 @@
+import abc
+import collections
+import collections.abc
+import contextlib
+import functools
+import inspect
+import operator
+import sys
+import types as _types
+import typing
+import warnings
+
+__all__ = [
+    # Super-special typing primitives.
+    'Any',
+    'ClassVar',
+    'Concatenate',
+    'Final',
+    'LiteralString',
+    'ParamSpec',
+    'ParamSpecArgs',
+    'ParamSpecKwargs',
+    'Self',
+    'Type',
+    'TypeVar',
+    'TypeVarTuple',
+    'Unpack',
+
+    # ABCs (from collections.abc).
+    'Awaitable',
+    'AsyncIterator',
+    'AsyncIterable',
+    'Coroutine',
+    'AsyncGenerator',
+    'AsyncContextManager',
+    'Buffer',
+    'ChainMap',
+
+    # Concrete collection types.
+    'ContextManager',
+    'Counter',
+    'Deque',
+    'DefaultDict',
+    'NamedTuple',
+    'OrderedDict',
+    'TypedDict',
+
+    # Structural checks, a.k.a. protocols.
+    'SupportsAbs',
+    'SupportsBytes',
+    'SupportsComplex',
+    'SupportsFloat',
+    'SupportsIndex',
+    'SupportsInt',
+    'SupportsRound',
+
+    # One-off things.
+    'Annotated',
+    'assert_never',
+    'assert_type',
+    'clear_overloads',
+    'dataclass_transform',
+    'deprecated',
+    'Doc',
+    'get_overloads',
+    'final',
+    'get_args',
+    'get_origin',
+    'get_original_bases',
+    'get_protocol_members',
+    'get_type_hints',
+    'IntVar',
+    'is_protocol',
+    'is_typeddict',
+    'Literal',
+    'NewType',
+    'overload',
+    'override',
+    'Protocol',
+    'reveal_type',
+    'runtime',
+    'runtime_checkable',
+    'Text',
+    'TypeAlias',
+    'TypeAliasType',
+    'TypeGuard',
+    'TypeIs',
+    'TYPE_CHECKING',
+    'Never',
+    'NoReturn',
+    'ReadOnly',
+    'Required',
+    'NotRequired',
+
+    # Pure aliases, have always been in typing
+    'AbstractSet',
+    'AnyStr',
+    'BinaryIO',
+    'Callable',
+    'Collection',
+    'Container',
+    'Dict',
+    'ForwardRef',
+    'FrozenSet',
+    'Generator',
+    'Generic',
+    'Hashable',
+    'IO',
+    'ItemsView',
+    'Iterable',
+    'Iterator',
+    'KeysView',
+    'List',
+    'Mapping',
+    'MappingView',
+    'Match',
+    'MutableMapping',
+    'MutableSequence',
+    'MutableSet',
+    'NoDefault',
+    'Optional',
+    'Pattern',
+    'Reversible',
+    'Sequence',
+    'Set',
+    'Sized',
+    'TextIO',
+    'Tuple',
+    'Union',
+    'ValuesView',
+    'cast',
+    'no_type_check',
+    'no_type_check_decorator',
+]
+
+# for backward compatibility
+PEP_560 = True
+GenericMeta = type
+_PEP_696_IMPLEMENTED = sys.version_info >= (3, 13, 0, "beta")
+
+# The functions below are modified copies of typing internal helpers.
+# They are needed by _ProtocolMeta and they provide support for PEP 646.
+
+
+class _Sentinel:
+    def __repr__(self):
+        return ""
+
+
+_marker = _Sentinel()
+
+
+if sys.version_info >= (3, 10):
+    def _should_collect_from_parameters(t):
+        return isinstance(
+            t, (typing._GenericAlias, _types.GenericAlias, _types.UnionType)
+        )
+elif sys.version_info >= (3, 9):
+    def _should_collect_from_parameters(t):
+        return isinstance(t, (typing._GenericAlias, _types.GenericAlias))
+else:
+    def _should_collect_from_parameters(t):
+        return isinstance(t, typing._GenericAlias) and not t._special
+
+
+NoReturn = typing.NoReturn
+
+# Some unconstrained type variables.  These are used by the container types.
+# (These are not for export.)
+T = typing.TypeVar('T')  # Any type.
+KT = typing.TypeVar('KT')  # Key type.
+VT = typing.TypeVar('VT')  # Value type.
+T_co = typing.TypeVar('T_co', covariant=True)  # Any type covariant containers.
+T_contra = typing.TypeVar('T_contra', contravariant=True)  # Ditto contravariant.
+
+
+if sys.version_info >= (3, 11):
+    from typing import Any
+else:
+
+    class _AnyMeta(type):
+        def __instancecheck__(self, obj):
+            if self is Any:
+                raise TypeError("typing_extensions.Any cannot be used with isinstance()")
+            return super().__instancecheck__(obj)
+
+        def __repr__(self):
+            if self is Any:
+                return "typing_extensions.Any"
+            return super().__repr__()
+
+    class Any(metaclass=_AnyMeta):
+        """Special type indicating an unconstrained type.
+        - Any is compatible with every type.
+        - Any assumed to have all methods.
+        - All values assumed to be instances of Any.
+        Note that all the above statements are true from the point of view of
+        static type checkers. At runtime, Any should not be used with instance
+        checks.
+        """
+        def __new__(cls, *args, **kwargs):
+            if cls is Any:
+                raise TypeError("Any cannot be instantiated")
+            return super().__new__(cls, *args, **kwargs)
+
+
+ClassVar = typing.ClassVar
+
+
+class _ExtensionsSpecialForm(typing._SpecialForm, _root=True):
+    def __repr__(self):
+        return 'typing_extensions.' + self._name
+
+
+Final = typing.Final
+
+if sys.version_info >= (3, 11):
+    final = typing.final
+else:
+    # @final exists in 3.8+, but we backport it for all versions
+    # before 3.11 to keep support for the __final__ attribute.
+    # See https://bugs.python.org/issue46342
+    def final(f):
+        """This decorator can be used to indicate to type checkers that
+        the decorated method cannot be overridden, and decorated class
+        cannot be subclassed. For example:
+
+            class Base:
+                @final
+                def done(self) -> None:
+                    ...
+            class Sub(Base):
+                def done(self) -> None:  # Error reported by type checker
+                    ...
+            @final
+            class Leaf:
+                ...
+            class Other(Leaf):  # Error reported by type checker
+                ...
+
+        There is no runtime checking of these properties. The decorator
+        sets the ``__final__`` attribute to ``True`` on the decorated object
+        to allow runtime introspection.
+        """
+        try:
+            f.__final__ = True
+        except (AttributeError, TypeError):
+            # Skip the attribute silently if it is not writable.
+            # AttributeError happens if the object has __slots__ or a
+            # read-only property, TypeError if it's a builtin class.
+            pass
+        return f
+
+
+def IntVar(name):
+    return typing.TypeVar(name)
+
+
+# A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8
+if sys.version_info >= (3, 10, 1):
+    Literal = typing.Literal
+else:
+    def _flatten_literal_params(parameters):
+        """An internal helper for Literal creation: flatten Literals among parameters"""
+        params = []
+        for p in parameters:
+            if isinstance(p, _LiteralGenericAlias):
+                params.extend(p.__args__)
+            else:
+                params.append(p)
+        return tuple(params)
+
+    def _value_and_type_iter(params):
+        for p in params:
+            yield p, type(p)
+
+    class _LiteralGenericAlias(typing._GenericAlias, _root=True):
+        def __eq__(self, other):
+            if not isinstance(other, _LiteralGenericAlias):
+                return NotImplemented
+            these_args_deduped = set(_value_and_type_iter(self.__args__))
+            other_args_deduped = set(_value_and_type_iter(other.__args__))
+            return these_args_deduped == other_args_deduped
+
+        def __hash__(self):
+            return hash(frozenset(_value_and_type_iter(self.__args__)))
+
+    class _LiteralForm(_ExtensionsSpecialForm, _root=True):
+        def __init__(self, doc: str):
+            self._name = 'Literal'
+            self._doc = self.__doc__ = doc
+
+        def __getitem__(self, parameters):
+            if not isinstance(parameters, tuple):
+                parameters = (parameters,)
+
+            parameters = _flatten_literal_params(parameters)
+
+            val_type_pairs = list(_value_and_type_iter(parameters))
+            try:
+                deduped_pairs = set(val_type_pairs)
+            except TypeError:
+                # unhashable parameters
+                pass
+            else:
+                # similar logic to typing._deduplicate on Python 3.9+
+                if len(deduped_pairs) < len(val_type_pairs):
+                    new_parameters = []
+                    for pair in val_type_pairs:
+                        if pair in deduped_pairs:
+                            new_parameters.append(pair[0])
+                            deduped_pairs.remove(pair)
+                    assert not deduped_pairs, deduped_pairs
+                    parameters = tuple(new_parameters)
+
+            return _LiteralGenericAlias(self, parameters)
+
+    Literal = _LiteralForm(doc="""\
+                           A type that can be used to indicate to type checkers
+                           that the corresponding value has a value literally equivalent
+                           to the provided parameter. For example:
+
+                               var: Literal[4] = 4
+
+                           The type checker understands that 'var' is literally equal to
+                           the value 4 and no other value.
+
+                           Literal[...] cannot be subclassed. There is no runtime
+                           checking verifying that the parameter is actually a value
+                           instead of a type.""")
+
+
+_overload_dummy = typing._overload_dummy
+
+
+if hasattr(typing, "get_overloads"):  # 3.11+
+    overload = typing.overload
+    get_overloads = typing.get_overloads
+    clear_overloads = typing.clear_overloads
+else:
+    # {module: {qualname: {firstlineno: func}}}
+    _overload_registry = collections.defaultdict(
+        functools.partial(collections.defaultdict, dict)
+    )
+
+    def overload(func):
+        """Decorator for overloaded functions/methods.
+
+        In a stub file, place two or more stub definitions for the same
+        function in a row, each decorated with @overload.  For example:
+
+        @overload
+        def utf8(value: None) -> None: ...
+        @overload
+        def utf8(value: bytes) -> bytes: ...
+        @overload
+        def utf8(value: str) -> bytes: ...
+
+        In a non-stub file (i.e. a regular .py file), do the same but
+        follow it with an implementation.  The implementation should *not*
+        be decorated with @overload.  For example:
+
+        @overload
+        def utf8(value: None) -> None: ...
+        @overload
+        def utf8(value: bytes) -> bytes: ...
+        @overload
+        def utf8(value: str) -> bytes: ...
+        def utf8(value):
+            # implementation goes here
+
+        The overloads for a function can be retrieved at runtime using the
+        get_overloads() function.
+        """
+        # classmethod and staticmethod
+        f = getattr(func, "__func__", func)
+        try:
+            _overload_registry[f.__module__][f.__qualname__][
+                f.__code__.co_firstlineno
+            ] = func
+        except AttributeError:
+            # Not a normal function; ignore.
+            pass
+        return _overload_dummy
+
+    def get_overloads(func):
+        """Return all defined overloads for *func* as a sequence."""
+        # classmethod and staticmethod
+        f = getattr(func, "__func__", func)
+        if f.__module__ not in _overload_registry:
+            return []
+        mod_dict = _overload_registry[f.__module__]
+        if f.__qualname__ not in mod_dict:
+            return []
+        return list(mod_dict[f.__qualname__].values())
+
+    def clear_overloads():
+        """Clear all overloads in the registry."""
+        _overload_registry.clear()
+
+
+# This is not a real generic class.  Don't use outside annotations.
+Type = typing.Type
+
+# Various ABCs mimicking those in collections.abc.
+# A few are simply re-exported for completeness.
+Awaitable = typing.Awaitable
+Coroutine = typing.Coroutine
+AsyncIterable = typing.AsyncIterable
+AsyncIterator = typing.AsyncIterator
+Deque = typing.Deque
+DefaultDict = typing.DefaultDict
+OrderedDict = typing.OrderedDict
+Counter = typing.Counter
+ChainMap = typing.ChainMap
+Text = typing.Text
+TYPE_CHECKING = typing.TYPE_CHECKING
+
+
+if sys.version_info >= (3, 13, 0, "beta"):
+    from typing import AsyncContextManager, AsyncGenerator, ContextManager, Generator
+else:
+    def _is_dunder(attr):
+        return attr.startswith('__') and attr.endswith('__')
+
+    # Python <3.9 doesn't have typing._SpecialGenericAlias
+    _special_generic_alias_base = getattr(
+        typing, "_SpecialGenericAlias", typing._GenericAlias
+    )
+
+    class _SpecialGenericAlias(_special_generic_alias_base, _root=True):
+        def __init__(self, origin, nparams, *, inst=True, name=None, defaults=()):
+            if _special_generic_alias_base is typing._GenericAlias:
+                # Python <3.9
+                self.__origin__ = origin
+                self._nparams = nparams
+                super().__init__(origin, nparams, special=True, inst=inst, name=name)
+            else:
+                # Python >= 3.9
+                super().__init__(origin, nparams, inst=inst, name=name)
+            self._defaults = defaults
+
+        def __setattr__(self, attr, val):
+            allowed_attrs = {'_name', '_inst', '_nparams', '_defaults'}
+            if _special_generic_alias_base is typing._GenericAlias:
+                # Python <3.9
+                allowed_attrs.add("__origin__")
+            if _is_dunder(attr) or attr in allowed_attrs:
+                object.__setattr__(self, attr, val)
+            else:
+                setattr(self.__origin__, attr, val)
+
+        @typing._tp_cache
+        def __getitem__(self, params):
+            if not isinstance(params, tuple):
+                params = (params,)
+            msg = "Parameters to generic types must be types."
+            params = tuple(typing._type_check(p, msg) for p in params)
+            if (
+                self._defaults
+                and len(params) < self._nparams
+                and len(params) + len(self._defaults) >= self._nparams
+            ):
+                params = (*params, *self._defaults[len(params) - self._nparams:])
+            actual_len = len(params)
+
+            if actual_len != self._nparams:
+                if self._defaults:
+                    expected = f"at least {self._nparams - len(self._defaults)}"
+                else:
+                    expected = str(self._nparams)
+                if not self._nparams:
+                    raise TypeError(f"{self} is not a generic class")
+                raise TypeError(
+                    f"Too {'many' if actual_len > self._nparams else 'few'}"
+                    f" arguments for {self};"
+                    f" actual {actual_len}, expected {expected}"
+                )
+            return self.copy_with(params)
+
+    _NoneType = type(None)
+    Generator = _SpecialGenericAlias(
+        collections.abc.Generator, 3, defaults=(_NoneType, _NoneType)
+    )
+    AsyncGenerator = _SpecialGenericAlias(
+        collections.abc.AsyncGenerator, 2, defaults=(_NoneType,)
+    )
+    ContextManager = _SpecialGenericAlias(
+        contextlib.AbstractContextManager,
+        2,
+        name="ContextManager",
+        defaults=(typing.Optional[bool],)
+    )
+    AsyncContextManager = _SpecialGenericAlias(
+        contextlib.AbstractAsyncContextManager,
+        2,
+        name="AsyncContextManager",
+        defaults=(typing.Optional[bool],)
+    )
+
+
+_PROTO_ALLOWLIST = {
+    'collections.abc': [
+        'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable',
+        'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', 'Buffer',
+    ],
+    'contextlib': ['AbstractContextManager', 'AbstractAsyncContextManager'],
+    'typing_extensions': ['Buffer'],
+}
+
+
+_EXCLUDED_ATTRS = frozenset(typing.EXCLUDED_ATTRIBUTES) | {
+    "__match_args__", "__protocol_attrs__", "__non_callable_proto_members__",
+    "__final__",
+}
+
+
+def _get_protocol_attrs(cls):
+    attrs = set()
+    for base in cls.__mro__[:-1]:  # without object
+        if base.__name__ in {'Protocol', 'Generic'}:
+            continue
+        annotations = getattr(base, '__annotations__', {})
+        for attr in (*base.__dict__, *annotations):
+            if (not attr.startswith('_abc_') and attr not in _EXCLUDED_ATTRS):
+                attrs.add(attr)
+    return attrs
+
+
+def _caller(depth=2):
+    try:
+        return sys._getframe(depth).f_globals.get('__name__', '__main__')
+    except (AttributeError, ValueError):  # For platforms without _getframe()
+        return None
+
+
+# `__match_args__` attribute was removed from protocol members in 3.13,
+# we want to backport this change to older Python versions.
+if sys.version_info >= (3, 13):
+    Protocol = typing.Protocol
+else:
+    def _allow_reckless_class_checks(depth=3):
+        """Allow instance and class checks for special stdlib modules.
+        The abc and functools modules indiscriminately call isinstance() and
+        issubclass() on the whole MRO of a user class, which may contain protocols.
+        """
+        return _caller(depth) in {'abc', 'functools', None}
+
+    def _no_init(self, *args, **kwargs):
+        if type(self)._is_protocol:
+            raise TypeError('Protocols cannot be instantiated')
+
+    def _type_check_issubclass_arg_1(arg):
+        """Raise TypeError if `arg` is not an instance of `type`
+        in `issubclass(arg, )`.
+
+        In most cases, this is verified by type.__subclasscheck__.
+        Checking it again unnecessarily would slow down issubclass() checks,
+        so, we don't perform this check unless we absolutely have to.
+
+        For various error paths, however,
+        we want to ensure that *this* error message is shown to the user
+        where relevant, rather than a typing.py-specific error message.
+        """
+        if not isinstance(arg, type):
+            # Same error message as for issubclass(1, int).
+            raise TypeError('issubclass() arg 1 must be a class')
+
+    # Inheriting from typing._ProtocolMeta isn't actually desirable,
+    # but is necessary to allow typing.Protocol and typing_extensions.Protocol
+    # to mix without getting TypeErrors about "metaclass conflict"
+    class _ProtocolMeta(type(typing.Protocol)):
+        # This metaclass is somewhat unfortunate,
+        # but is necessary for several reasons...
+        #
+        # NOTE: DO NOT call super() in any methods in this class
+        # That would call the methods on typing._ProtocolMeta on Python 3.8-3.11
+        # and those are slow
+        def __new__(mcls, name, bases, namespace, **kwargs):
+            if name == "Protocol" and len(bases) < 2:
+                pass
+            elif {Protocol, typing.Protocol} & set(bases):
+                for base in bases:
+                    if not (
+                        base in {object, typing.Generic, Protocol, typing.Protocol}
+                        or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__, [])
+                        or is_protocol(base)
+                    ):
+                        raise TypeError(
+                            f"Protocols can only inherit from other protocols, "
+                            f"got {base!r}"
+                        )
+            return abc.ABCMeta.__new__(mcls, name, bases, namespace, **kwargs)
+
+        def __init__(cls, *args, **kwargs):
+            abc.ABCMeta.__init__(cls, *args, **kwargs)
+            if getattr(cls, "_is_protocol", False):
+                cls.__protocol_attrs__ = _get_protocol_attrs(cls)
+
+        def __subclasscheck__(cls, other):
+            if cls is Protocol:
+                return type.__subclasscheck__(cls, other)
+            if (
+                getattr(cls, '_is_protocol', False)
+                and not _allow_reckless_class_checks()
+            ):
+                if not getattr(cls, '_is_runtime_protocol', False):
+                    _type_check_issubclass_arg_1(other)
+                    raise TypeError(
+                        "Instance and class checks can only be used with "
+                        "@runtime_checkable protocols"
+                    )
+                if (
+                    # this attribute is set by @runtime_checkable:
+                    cls.__non_callable_proto_members__
+                    and cls.__dict__.get("__subclasshook__") is _proto_hook
+                ):
+                    _type_check_issubclass_arg_1(other)
+                    non_method_attrs = sorted(cls.__non_callable_proto_members__)
+                    raise TypeError(
+                        "Protocols with non-method members don't support issubclass()."
+                        f" Non-method members: {str(non_method_attrs)[1:-1]}."
+                    )
+            return abc.ABCMeta.__subclasscheck__(cls, other)
+
+        def __instancecheck__(cls, instance):
+            # We need this method for situations where attributes are
+            # assigned in __init__.
+            if cls is Protocol:
+                return type.__instancecheck__(cls, instance)
+            if not getattr(cls, "_is_protocol", False):
+                # i.e., it's a concrete subclass of a protocol
+                return abc.ABCMeta.__instancecheck__(cls, instance)
+
+            if (
+                not getattr(cls, '_is_runtime_protocol', False) and
+                not _allow_reckless_class_checks()
+            ):
+                raise TypeError("Instance and class checks can only be used with"
+                                " @runtime_checkable protocols")
+
+            if abc.ABCMeta.__instancecheck__(cls, instance):
+                return True
+
+            for attr in cls.__protocol_attrs__:
+                try:
+                    val = inspect.getattr_static(instance, attr)
+                except AttributeError:
+                    break
+                # this attribute is set by @runtime_checkable:
+                if val is None and attr not in cls.__non_callable_proto_members__:
+                    break
+            else:
+                return True
+
+            return False
+
+        def __eq__(cls, other):
+            # Hack so that typing.Generic.__class_getitem__
+            # treats typing_extensions.Protocol
+            # as equivalent to typing.Protocol
+            if abc.ABCMeta.__eq__(cls, other) is True:
+                return True
+            return cls is Protocol and other is typing.Protocol
+
+        # This has to be defined, or the abc-module cache
+        # complains about classes with this metaclass being unhashable,
+        # if we define only __eq__!
+        def __hash__(cls) -> int:
+            return type.__hash__(cls)
+
+    @classmethod
+    def _proto_hook(cls, other):
+        if not cls.__dict__.get('_is_protocol', False):
+            return NotImplemented
+
+        for attr in cls.__protocol_attrs__:
+            for base in other.__mro__:
+                # Check if the members appears in the class dictionary...
+                if attr in base.__dict__:
+                    if base.__dict__[attr] is None:
+                        return NotImplemented
+                    break
+
+                # ...or in annotations, if it is a sub-protocol.
+                annotations = getattr(base, '__annotations__', {})
+                if (
+                    isinstance(annotations, collections.abc.Mapping)
+                    and attr in annotations
+                    and is_protocol(other)
+                ):
+                    break
+            else:
+                return NotImplemented
+        return True
+
+    class Protocol(typing.Generic, metaclass=_ProtocolMeta):
+        __doc__ = typing.Protocol.__doc__
+        __slots__ = ()
+        _is_protocol = True
+        _is_runtime_protocol = False
+
+        def __init_subclass__(cls, *args, **kwargs):
+            super().__init_subclass__(*args, **kwargs)
+
+            # Determine if this is a protocol or a concrete subclass.
+            if not cls.__dict__.get('_is_protocol', False):
+                cls._is_protocol = any(b is Protocol for b in cls.__bases__)
+
+            # Set (or override) the protocol subclass hook.
+            if '__subclasshook__' not in cls.__dict__:
+                cls.__subclasshook__ = _proto_hook
+
+            # Prohibit instantiation for protocol classes
+            if cls._is_protocol and cls.__init__ is Protocol.__init__:
+                cls.__init__ = _no_init
+
+
+if sys.version_info >= (3, 13):
+    runtime_checkable = typing.runtime_checkable
+else:
+    def runtime_checkable(cls):
+        """Mark a protocol class as a runtime protocol.
+
+        Such protocol can be used with isinstance() and issubclass().
+        Raise TypeError if applied to a non-protocol class.
+        This allows a simple-minded structural check very similar to
+        one trick ponies in collections.abc such as Iterable.
+
+        For example::
+
+            @runtime_checkable
+            class Closable(Protocol):
+                def close(self): ...
+
+            assert isinstance(open('/some/file'), Closable)
+
+        Warning: this will check only the presence of the required methods,
+        not their type signatures!
+        """
+        if not issubclass(cls, typing.Generic) or not getattr(cls, '_is_protocol', False):
+            raise TypeError(f'@runtime_checkable can be only applied to protocol classes,'
+                            f' got {cls!r}')
+        cls._is_runtime_protocol = True
+
+        # typing.Protocol classes on <=3.11 break if we execute this block,
+        # because typing.Protocol classes on <=3.11 don't have a
+        # `__protocol_attrs__` attribute, and this block relies on the
+        # `__protocol_attrs__` attribute. Meanwhile, typing.Protocol classes on 3.12.2+
+        # break if we *don't* execute this block, because *they* assume that all
+        # protocol classes have a `__non_callable_proto_members__` attribute
+        # (which this block sets)
+        if isinstance(cls, _ProtocolMeta) or sys.version_info >= (3, 12, 2):
+            # PEP 544 prohibits using issubclass()
+            # with protocols that have non-method members.
+            # See gh-113320 for why we compute this attribute here,
+            # rather than in `_ProtocolMeta.__init__`
+            cls.__non_callable_proto_members__ = set()
+            for attr in cls.__protocol_attrs__:
+                try:
+                    is_callable = callable(getattr(cls, attr, None))
+                except Exception as e:
+                    raise TypeError(
+                        f"Failed to determine whether protocol member {attr!r} "
+                        "is a method member"
+                    ) from e
+                else:
+                    if not is_callable:
+                        cls.__non_callable_proto_members__.add(attr)
+
+        return cls
+
+
+# The "runtime" alias exists for backwards compatibility.
+runtime = runtime_checkable
+
+
+# Our version of runtime-checkable protocols is faster on Python 3.8-3.11
+if sys.version_info >= (3, 12):
+    SupportsInt = typing.SupportsInt
+    SupportsFloat = typing.SupportsFloat
+    SupportsComplex = typing.SupportsComplex
+    SupportsBytes = typing.SupportsBytes
+    SupportsIndex = typing.SupportsIndex
+    SupportsAbs = typing.SupportsAbs
+    SupportsRound = typing.SupportsRound
+else:
+    @runtime_checkable
+    class SupportsInt(Protocol):
+        """An ABC with one abstract method __int__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __int__(self) -> int:
+            pass
+
+    @runtime_checkable
+    class SupportsFloat(Protocol):
+        """An ABC with one abstract method __float__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __float__(self) -> float:
+            pass
+
+    @runtime_checkable
+    class SupportsComplex(Protocol):
+        """An ABC with one abstract method __complex__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __complex__(self) -> complex:
+            pass
+
+    @runtime_checkable
+    class SupportsBytes(Protocol):
+        """An ABC with one abstract method __bytes__."""
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __bytes__(self) -> bytes:
+            pass
+
+    @runtime_checkable
+    class SupportsIndex(Protocol):
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __index__(self) -> int:
+            pass
+
+    @runtime_checkable
+    class SupportsAbs(Protocol[T_co]):
+        """
+        An ABC with one abstract method __abs__ that is covariant in its return type.
+        """
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __abs__(self) -> T_co:
+            pass
+
+    @runtime_checkable
+    class SupportsRound(Protocol[T_co]):
+        """
+        An ABC with one abstract method __round__ that is covariant in its return type.
+        """
+        __slots__ = ()
+
+        @abc.abstractmethod
+        def __round__(self, ndigits: int = 0) -> T_co:
+            pass
+
+
+def _ensure_subclassable(mro_entries):
+    def inner(func):
+        if sys.implementation.name == "pypy" and sys.version_info < (3, 9):
+            cls_dict = {
+                "__call__": staticmethod(func),
+                "__mro_entries__": staticmethod(mro_entries)
+            }
+            t = type(func.__name__, (), cls_dict)
+            return functools.update_wrapper(t(), func)
+        else:
+            func.__mro_entries__ = mro_entries
+            return func
+    return inner
+
+
+# Update this to something like >=3.13.0b1 if and when
+# PEP 728 is implemented in CPython
+_PEP_728_IMPLEMENTED = False
+
+if _PEP_728_IMPLEMENTED:
+    # The standard library TypedDict in Python 3.8 does not store runtime information
+    # about which (if any) keys are optional.  See https://bugs.python.org/issue38834
+    # The standard library TypedDict in Python 3.9.0/1 does not honour the "total"
+    # keyword with old-style TypedDict().  See https://bugs.python.org/issue42059
+    # The standard library TypedDict below Python 3.11 does not store runtime
+    # information about optional and required keys when using Required or NotRequired.
+    # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11.
+    # Aaaand on 3.12 we add __orig_bases__ to TypedDict
+    # to enable better runtime introspection.
+    # On 3.13 we deprecate some odd ways of creating TypedDicts.
+    # Also on 3.13, PEP 705 adds the ReadOnly[] qualifier.
+    # PEP 728 (still pending) makes more changes.
+    TypedDict = typing.TypedDict
+    _TypedDictMeta = typing._TypedDictMeta
+    is_typeddict = typing.is_typeddict
+else:
+    # 3.10.0 and later
+    _TAKES_MODULE = "module" in inspect.signature(typing._type_check).parameters
+
+    def _get_typeddict_qualifiers(annotation_type):
+        while True:
+            annotation_origin = get_origin(annotation_type)
+            if annotation_origin is Annotated:
+                annotation_args = get_args(annotation_type)
+                if annotation_args:
+                    annotation_type = annotation_args[0]
+                else:
+                    break
+            elif annotation_origin is Required:
+                yield Required
+                annotation_type, = get_args(annotation_type)
+            elif annotation_origin is NotRequired:
+                yield NotRequired
+                annotation_type, = get_args(annotation_type)
+            elif annotation_origin is ReadOnly:
+                yield ReadOnly
+                annotation_type, = get_args(annotation_type)
+            else:
+                break
+
+    class _TypedDictMeta(type):
+        def __new__(cls, name, bases, ns, *, total=True, closed=False):
+            """Create new typed dict class object.
+
+            This method is called when TypedDict is subclassed,
+            or when TypedDict is instantiated. This way
+            TypedDict supports all three syntax forms described in its docstring.
+            Subclasses and instances of TypedDict return actual dictionaries.
+            """
+            for base in bases:
+                if type(base) is not _TypedDictMeta and base is not typing.Generic:
+                    raise TypeError('cannot inherit from both a TypedDict type '
+                                    'and a non-TypedDict base class')
+
+            if any(issubclass(b, typing.Generic) for b in bases):
+                generic_base = (typing.Generic,)
+            else:
+                generic_base = ()
+
+            # typing.py generally doesn't let you inherit from plain Generic, unless
+            # the name of the class happens to be "Protocol"
+            tp_dict = type.__new__(_TypedDictMeta, "Protocol", (*generic_base, dict), ns)
+            tp_dict.__name__ = name
+            if tp_dict.__qualname__ == "Protocol":
+                tp_dict.__qualname__ = name
+
+            if not hasattr(tp_dict, '__orig_bases__'):
+                tp_dict.__orig_bases__ = bases
+
+            annotations = {}
+            if "__annotations__" in ns:
+                own_annotations = ns["__annotations__"]
+            elif "__annotate__" in ns:
+                # TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
+                own_annotations = ns["__annotate__"](1)
+            else:
+                own_annotations = {}
+            msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type"
+            if _TAKES_MODULE:
+                own_annotations = {
+                    n: typing._type_check(tp, msg, module=tp_dict.__module__)
+                    for n, tp in own_annotations.items()
+                }
+            else:
+                own_annotations = {
+                    n: typing._type_check(tp, msg)
+                    for n, tp in own_annotations.items()
+                }
+            required_keys = set()
+            optional_keys = set()
+            readonly_keys = set()
+            mutable_keys = set()
+            extra_items_type = None
+
+            for base in bases:
+                base_dict = base.__dict__
+
+                annotations.update(base_dict.get('__annotations__', {}))
+                required_keys.update(base_dict.get('__required_keys__', ()))
+                optional_keys.update(base_dict.get('__optional_keys__', ()))
+                readonly_keys.update(base_dict.get('__readonly_keys__', ()))
+                mutable_keys.update(base_dict.get('__mutable_keys__', ()))
+                base_extra_items_type = base_dict.get('__extra_items__', None)
+                if base_extra_items_type is not None:
+                    extra_items_type = base_extra_items_type
+
+            if closed and extra_items_type is None:
+                extra_items_type = Never
+            if closed and "__extra_items__" in own_annotations:
+                annotation_type = own_annotations.pop("__extra_items__")
+                qualifiers = set(_get_typeddict_qualifiers(annotation_type))
+                if Required in qualifiers:
+                    raise TypeError(
+                        "Special key __extra_items__ does not support "
+                        "Required"
+                    )
+                if NotRequired in qualifiers:
+                    raise TypeError(
+                        "Special key __extra_items__ does not support "
+                        "NotRequired"
+                    )
+                extra_items_type = annotation_type
+
+            annotations.update(own_annotations)
+            for annotation_key, annotation_type in own_annotations.items():
+                qualifiers = set(_get_typeddict_qualifiers(annotation_type))
+
+                if Required in qualifiers:
+                    required_keys.add(annotation_key)
+                elif NotRequired in qualifiers:
+                    optional_keys.add(annotation_key)
+                elif total:
+                    required_keys.add(annotation_key)
+                else:
+                    optional_keys.add(annotation_key)
+                if ReadOnly in qualifiers:
+                    mutable_keys.discard(annotation_key)
+                    readonly_keys.add(annotation_key)
+                else:
+                    mutable_keys.add(annotation_key)
+                    readonly_keys.discard(annotation_key)
+
+            tp_dict.__annotations__ = annotations
+            tp_dict.__required_keys__ = frozenset(required_keys)
+            tp_dict.__optional_keys__ = frozenset(optional_keys)
+            tp_dict.__readonly_keys__ = frozenset(readonly_keys)
+            tp_dict.__mutable_keys__ = frozenset(mutable_keys)
+            if not hasattr(tp_dict, '__total__'):
+                tp_dict.__total__ = total
+            tp_dict.__closed__ = closed
+            tp_dict.__extra_items__ = extra_items_type
+            return tp_dict
+
+        __call__ = dict  # static method
+
+        def __subclasscheck__(cls, other):
+            # Typed dicts are only for static structural subtyping.
+            raise TypeError('TypedDict does not support instance and class checks')
+
+        __instancecheck__ = __subclasscheck__
+
+    _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
+
+    @_ensure_subclassable(lambda bases: (_TypedDict,))
+    def TypedDict(typename, fields=_marker, /, *, total=True, closed=False, **kwargs):
+        """A simple typed namespace. At runtime it is equivalent to a plain dict.
+
+        TypedDict creates a dictionary type such that a type checker will expect all
+        instances to have a certain set of keys, where each key is
+        associated with a value of a consistent type. This expectation
+        is not checked at runtime.
+
+        Usage::
+
+            class Point2D(TypedDict):
+                x: int
+                y: int
+                label: str
+
+            a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
+            b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check
+
+            assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
+
+        The type info can be accessed via the Point2D.__annotations__ dict, and
+        the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets.
+        TypedDict supports an additional equivalent form::
+
+            Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
+
+        By default, all keys must be present in a TypedDict. It is possible
+        to override this by specifying totality::
+
+            class Point2D(TypedDict, total=False):
+                x: int
+                y: int
+
+        This means that a Point2D TypedDict can have any of the keys omitted. A type
+        checker is only expected to support a literal False or True as the value of
+        the total argument. True is the default, and makes all items defined in the
+        class body be required.
+
+        The Required and NotRequired special forms can also be used to mark
+        individual keys as being required or not required::
+
+            class Point2D(TypedDict):
+                x: int  # the "x" key must always be present (Required is the default)
+                y: NotRequired[int]  # the "y" key can be omitted
+
+        See PEP 655 for more details on Required and NotRequired.
+        """
+        if fields is _marker or fields is None:
+            if fields is _marker:
+                deprecated_thing = "Failing to pass a value for the 'fields' parameter"
+            else:
+                deprecated_thing = "Passing `None` as the 'fields' parameter"
+
+            example = f"`{typename} = TypedDict({typename!r}, {{}})`"
+            deprecation_msg = (
+                f"{deprecated_thing} is deprecated and will be disallowed in "
+                "Python 3.15. To create a TypedDict class with 0 fields "
+                "using the functional syntax, pass an empty dictionary, e.g. "
+            ) + example + "."
+            warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2)
+            if closed is not False and closed is not True:
+                kwargs["closed"] = closed
+                closed = False
+            fields = kwargs
+        elif kwargs:
+            raise TypeError("TypedDict takes either a dict or keyword arguments,"
+                            " but not both")
+        if kwargs:
+            if sys.version_info >= (3, 13):
+                raise TypeError("TypedDict takes no keyword arguments")
+            warnings.warn(
+                "The kwargs-based syntax for TypedDict definitions is deprecated "
+                "in Python 3.11, will be removed in Python 3.13, and may not be "
+                "understood by third-party type checkers.",
+                DeprecationWarning,
+                stacklevel=2,
+            )
+
+        ns = {'__annotations__': dict(fields)}
+        module = _caller()
+        if module is not None:
+            # Setting correct module is necessary to make typed dict classes pickleable.
+            ns['__module__'] = module
+
+        td = _TypedDictMeta(typename, (), ns, total=total, closed=closed)
+        td.__orig_bases__ = (TypedDict,)
+        return td
+
+    if hasattr(typing, "_TypedDictMeta"):
+        _TYPEDDICT_TYPES = (typing._TypedDictMeta, _TypedDictMeta)
+    else:
+        _TYPEDDICT_TYPES = (_TypedDictMeta,)
+
+    def is_typeddict(tp):
+        """Check if an annotation is a TypedDict class
+
+        For example::
+            class Film(TypedDict):
+                title: str
+                year: int
+
+            is_typeddict(Film)  # => True
+            is_typeddict(Union[list, str])  # => False
+        """
+        # On 3.8, this would otherwise return True
+        if hasattr(typing, "TypedDict") and tp is typing.TypedDict:
+            return False
+        return isinstance(tp, _TYPEDDICT_TYPES)
+
+
+if hasattr(typing, "assert_type"):
+    assert_type = typing.assert_type
+
+else:
+    def assert_type(val, typ, /):
+        """Assert (to the type checker) that the value is of the given type.
+
+        When the type checker encounters a call to assert_type(), it
+        emits an error if the value is not of the specified type::
+
+            def greet(name: str) -> None:
+                assert_type(name, str)  # ok
+                assert_type(name, int)  # type checker error
+
+        At runtime this returns the first argument unchanged and otherwise
+        does nothing.
+        """
+        return val
+
+
+if hasattr(typing, "ReadOnly"):  # 3.13+
+    get_type_hints = typing.get_type_hints
+else:  # <=3.13
+    # replaces _strip_annotations()
+    def _strip_extras(t):
+        """Strips Annotated, Required and NotRequired from a given type."""
+        if isinstance(t, _AnnotatedAlias):
+            return _strip_extras(t.__origin__)
+        if hasattr(t, "__origin__") and t.__origin__ in (Required, NotRequired, ReadOnly):
+            return _strip_extras(t.__args__[0])
+        if isinstance(t, typing._GenericAlias):
+            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
+            if stripped_args == t.__args__:
+                return t
+            return t.copy_with(stripped_args)
+        if hasattr(_types, "GenericAlias") and isinstance(t, _types.GenericAlias):
+            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
+            if stripped_args == t.__args__:
+                return t
+            return _types.GenericAlias(t.__origin__, stripped_args)
+        if hasattr(_types, "UnionType") and isinstance(t, _types.UnionType):
+            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
+            if stripped_args == t.__args__:
+                return t
+            return functools.reduce(operator.or_, stripped_args)
+
+        return t
+
+    def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
+        """Return type hints for an object.
+
+        This is often the same as obj.__annotations__, but it handles
+        forward references encoded as string literals, adds Optional[t] if a
+        default value equal to None is set and recursively replaces all
+        'Annotated[T, ...]', 'Required[T]' or 'NotRequired[T]' with 'T'
+        (unless 'include_extras=True').
+
+        The argument may be a module, class, method, or function. The annotations
+        are returned as a dictionary. For classes, annotations include also
+        inherited members.
+
+        TypeError is raised if the argument is not of a type that can contain
+        annotations, and an empty dictionary is returned if no annotations are
+        present.
+
+        BEWARE -- the behavior of globalns and localns is counterintuitive
+        (unless you are familiar with how eval() and exec() work).  The
+        search order is locals first, then globals.
+
+        - If no dict arguments are passed, an attempt is made to use the
+          globals from obj (or the respective module's globals for classes),
+          and these are also used as the locals.  If the object does not appear
+          to have globals, an empty dictionary is used.
+
+        - If one dict argument is passed, it is used for both globals and
+          locals.
+
+        - If two dict arguments are passed, they specify globals and
+          locals, respectively.
+        """
+        if hasattr(typing, "Annotated"):  # 3.9+
+            hint = typing.get_type_hints(
+                obj, globalns=globalns, localns=localns, include_extras=True
+            )
+        else:  # 3.8
+            hint = typing.get_type_hints(obj, globalns=globalns, localns=localns)
+        if include_extras:
+            return hint
+        return {k: _strip_extras(t) for k, t in hint.items()}
+
+
+# Python 3.9+ has PEP 593 (Annotated)
+if hasattr(typing, 'Annotated'):
+    Annotated = typing.Annotated
+    # Not exported and not a public API, but needed for get_origin() and get_args()
+    # to work.
+    _AnnotatedAlias = typing._AnnotatedAlias
+# 3.8
+else:
+    class _AnnotatedAlias(typing._GenericAlias, _root=True):
+        """Runtime representation of an annotated type.
+
+        At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't'
+        with extra annotations. The alias behaves like a normal typing alias,
+        instantiating is the same as instantiating the underlying type, binding
+        it to types is also the same.
+        """
+        def __init__(self, origin, metadata):
+            if isinstance(origin, _AnnotatedAlias):
+                metadata = origin.__metadata__ + metadata
+                origin = origin.__origin__
+            super().__init__(origin, origin)
+            self.__metadata__ = metadata
+
+        def copy_with(self, params):
+            assert len(params) == 1
+            new_type = params[0]
+            return _AnnotatedAlias(new_type, self.__metadata__)
+
+        def __repr__(self):
+            return (f"typing_extensions.Annotated[{typing._type_repr(self.__origin__)}, "
+                    f"{', '.join(repr(a) for a in self.__metadata__)}]")
+
+        def __reduce__(self):
+            return operator.getitem, (
+                Annotated, (self.__origin__, *self.__metadata__)
+            )
+
+        def __eq__(self, other):
+            if not isinstance(other, _AnnotatedAlias):
+                return NotImplemented
+            if self.__origin__ != other.__origin__:
+                return False
+            return self.__metadata__ == other.__metadata__
+
+        def __hash__(self):
+            return hash((self.__origin__, self.__metadata__))
+
+    class Annotated:
+        """Add context specific metadata to a type.
+
+        Example: Annotated[int, runtime_check.Unsigned] indicates to the
+        hypothetical runtime_check module that this type is an unsigned int.
+        Every other consumer of this type can ignore this metadata and treat
+        this type as int.
+
+        The first argument to Annotated must be a valid type (and will be in
+        the __origin__ field), the remaining arguments are kept as a tuple in
+        the __extra__ field.
+
+        Details:
+
+        - It's an error to call `Annotated` with less than two arguments.
+        - Nested Annotated are flattened::
+
+            Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]
+
+        - Instantiating an annotated type is equivalent to instantiating the
+        underlying type::
+
+            Annotated[C, Ann1](5) == C(5)
+
+        - Annotated can be used as a generic type alias::
+
+            Optimized = Annotated[T, runtime.Optimize()]
+            Optimized[int] == Annotated[int, runtime.Optimize()]
+
+            OptimizedList = Annotated[List[T], runtime.Optimize()]
+            OptimizedList[int] == Annotated[List[int], runtime.Optimize()]
+        """
+
+        __slots__ = ()
+
+        def __new__(cls, *args, **kwargs):
+            raise TypeError("Type Annotated cannot be instantiated.")
+
+        @typing._tp_cache
+        def __class_getitem__(cls, params):
+            if not isinstance(params, tuple) or len(params) < 2:
+                raise TypeError("Annotated[...] should be used "
+                                "with at least two arguments (a type and an "
+                                "annotation).")
+            allowed_special_forms = (ClassVar, Final)
+            if get_origin(params[0]) in allowed_special_forms:
+                origin = params[0]
+            else:
+                msg = "Annotated[t, ...]: t must be a type."
+                origin = typing._type_check(params[0], msg)
+            metadata = tuple(params[1:])
+            return _AnnotatedAlias(origin, metadata)
+
+        def __init_subclass__(cls, *args, **kwargs):
+            raise TypeError(
+                f"Cannot subclass {cls.__module__}.Annotated"
+            )
+
+# Python 3.8 has get_origin() and get_args() but those implementations aren't
+# Annotated-aware, so we can't use those. Python 3.9's versions don't support
+# ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do.
+if sys.version_info[:2] >= (3, 10):
+    get_origin = typing.get_origin
+    get_args = typing.get_args
+# 3.8-3.9
+else:
+    try:
+        # 3.9+
+        from typing import _BaseGenericAlias
+    except ImportError:
+        _BaseGenericAlias = typing._GenericAlias
+    try:
+        # 3.9+
+        from typing import GenericAlias as _typing_GenericAlias
+    except ImportError:
+        _typing_GenericAlias = typing._GenericAlias
+
+    def get_origin(tp):
+        """Get the unsubscripted version of a type.
+
+        This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar
+        and Annotated. Return None for unsupported types. Examples::
+
+            get_origin(Literal[42]) is Literal
+            get_origin(int) is None
+            get_origin(ClassVar[int]) is ClassVar
+            get_origin(Generic) is Generic
+            get_origin(Generic[T]) is Generic
+            get_origin(Union[T, int]) is Union
+            get_origin(List[Tuple[T, T]][int]) == list
+            get_origin(P.args) is P
+        """
+        if isinstance(tp, _AnnotatedAlias):
+            return Annotated
+        if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias, _BaseGenericAlias,
+                           ParamSpecArgs, ParamSpecKwargs)):
+            return tp.__origin__
+        if tp is typing.Generic:
+            return typing.Generic
+        return None
+
+    def get_args(tp):
+        """Get type arguments with all substitutions performed.
+
+        For unions, basic simplifications used by Union constructor are performed.
+        Examples::
+            get_args(Dict[str, int]) == (str, int)
+            get_args(int) == ()
+            get_args(Union[int, Union[T, int], str][int]) == (int, str)
+            get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
+            get_args(Callable[[], T][int]) == ([], int)
+        """
+        if isinstance(tp, _AnnotatedAlias):
+            return (tp.__origin__, *tp.__metadata__)
+        if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias)):
+            if getattr(tp, "_special", False):
+                return ()
+            res = tp.__args__
+            if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis:
+                res = (list(res[:-1]), res[-1])
+            return res
+        return ()
+
+
+# 3.10+
+if hasattr(typing, 'TypeAlias'):
+    TypeAlias = typing.TypeAlias
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def TypeAlias(self, parameters):
+        """Special marker indicating that an assignment should
+        be recognized as a proper type alias definition by type
+        checkers.
+
+        For example::
+
+            Predicate: TypeAlias = Callable[..., bool]
+
+        It's invalid when used anywhere except as in the example above.
+        """
+        raise TypeError(f"{self} is not subscriptable")
+# 3.8
+else:
+    TypeAlias = _ExtensionsSpecialForm(
+        'TypeAlias',
+        doc="""Special marker indicating that an assignment should
+        be recognized as a proper type alias definition by type
+        checkers.
+
+        For example::
+
+            Predicate: TypeAlias = Callable[..., bool]
+
+        It's invalid when used anywhere except as in the example
+        above."""
+    )
+
+
+if hasattr(typing, "NoDefault"):
+    NoDefault = typing.NoDefault
+else:
+    class NoDefaultTypeMeta(type):
+        def __setattr__(cls, attr, value):
+            # TypeError is consistent with the behavior of NoneType
+            raise TypeError(
+                f"cannot set {attr!r} attribute of immutable type {cls.__name__!r}"
+            )
+
+    class NoDefaultType(metaclass=NoDefaultTypeMeta):
+        """The type of the NoDefault singleton."""
+
+        __slots__ = ()
+
+        def __new__(cls):
+            return globals().get("NoDefault") or object.__new__(cls)
+
+        def __repr__(self):
+            return "typing_extensions.NoDefault"
+
+        def __reduce__(self):
+            return "NoDefault"
+
+    NoDefault = NoDefaultType()
+    del NoDefaultType, NoDefaultTypeMeta
+
+
+def _set_default(type_param, default):
+    type_param.has_default = lambda: default is not NoDefault
+    type_param.__default__ = default
+
+
+def _set_module(typevarlike):
+    # for pickling:
+    def_mod = _caller(depth=3)
+    if def_mod != 'typing_extensions':
+        typevarlike.__module__ = def_mod
+
+
+class _DefaultMixin:
+    """Mixin for TypeVarLike defaults."""
+
+    __slots__ = ()
+    __init__ = _set_default
+
+
+# Classes using this metaclass must provide a _backported_typevarlike ClassVar
+class _TypeVarLikeMeta(type):
+    def __instancecheck__(cls, __instance: Any) -> bool:
+        return isinstance(__instance, cls._backported_typevarlike)
+
+
+if _PEP_696_IMPLEMENTED:
+    from typing import TypeVar
+else:
+    # Add default and infer_variance parameters from PEP 696 and 695
+    class TypeVar(metaclass=_TypeVarLikeMeta):
+        """Type variable."""
+
+        _backported_typevarlike = typing.TypeVar
+
+        def __new__(cls, name, *constraints, bound=None,
+                    covariant=False, contravariant=False,
+                    default=NoDefault, infer_variance=False):
+            if hasattr(typing, "TypeAliasType"):
+                # PEP 695 implemented (3.12+), can pass infer_variance to typing.TypeVar
+                typevar = typing.TypeVar(name, *constraints, bound=bound,
+                                         covariant=covariant, contravariant=contravariant,
+                                         infer_variance=infer_variance)
+            else:
+                typevar = typing.TypeVar(name, *constraints, bound=bound,
+                                         covariant=covariant, contravariant=contravariant)
+                if infer_variance and (covariant or contravariant):
+                    raise ValueError("Variance cannot be specified with infer_variance.")
+                typevar.__infer_variance__ = infer_variance
+
+            _set_default(typevar, default)
+            _set_module(typevar)
+
+            def _tvar_prepare_subst(alias, args):
+                if (
+                    typevar.has_default()
+                    and alias.__parameters__.index(typevar) == len(args)
+                ):
+                    args += (typevar.__default__,)
+                return args
+
+            typevar.__typing_prepare_subst__ = _tvar_prepare_subst
+            return typevar
+
+        def __init_subclass__(cls) -> None:
+            raise TypeError(f"type '{__name__}.TypeVar' is not an acceptable base type")
+
+
+# Python 3.10+ has PEP 612
+if hasattr(typing, 'ParamSpecArgs'):
+    ParamSpecArgs = typing.ParamSpecArgs
+    ParamSpecKwargs = typing.ParamSpecKwargs
+# 3.8-3.9
+else:
+    class _Immutable:
+        """Mixin to indicate that object should not be copied."""
+        __slots__ = ()
+
+        def __copy__(self):
+            return self
+
+        def __deepcopy__(self, memo):
+            return self
+
+    class ParamSpecArgs(_Immutable):
+        """The args for a ParamSpec object.
+
+        Given a ParamSpec object P, P.args is an instance of ParamSpecArgs.
+
+        ParamSpecArgs objects have a reference back to their ParamSpec:
+
+        P.args.__origin__ is P
+
+        This type is meant for runtime introspection and has no special meaning to
+        static type checkers.
+        """
+        def __init__(self, origin):
+            self.__origin__ = origin
+
+        def __repr__(self):
+            return f"{self.__origin__.__name__}.args"
+
+        def __eq__(self, other):
+            if not isinstance(other, ParamSpecArgs):
+                return NotImplemented
+            return self.__origin__ == other.__origin__
+
+    class ParamSpecKwargs(_Immutable):
+        """The kwargs for a ParamSpec object.
+
+        Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs.
+
+        ParamSpecKwargs objects have a reference back to their ParamSpec:
+
+        P.kwargs.__origin__ is P
+
+        This type is meant for runtime introspection and has no special meaning to
+        static type checkers.
+        """
+        def __init__(self, origin):
+            self.__origin__ = origin
+
+        def __repr__(self):
+            return f"{self.__origin__.__name__}.kwargs"
+
+        def __eq__(self, other):
+            if not isinstance(other, ParamSpecKwargs):
+                return NotImplemented
+            return self.__origin__ == other.__origin__
+
+
+if _PEP_696_IMPLEMENTED:
+    from typing import ParamSpec
+
+# 3.10+
+elif hasattr(typing, 'ParamSpec'):
+
+    # Add default parameter - PEP 696
+    class ParamSpec(metaclass=_TypeVarLikeMeta):
+        """Parameter specification."""
+
+        _backported_typevarlike = typing.ParamSpec
+
+        def __new__(cls, name, *, bound=None,
+                    covariant=False, contravariant=False,
+                    infer_variance=False, default=NoDefault):
+            if hasattr(typing, "TypeAliasType"):
+                # PEP 695 implemented, can pass infer_variance to typing.TypeVar
+                paramspec = typing.ParamSpec(name, bound=bound,
+                                             covariant=covariant,
+                                             contravariant=contravariant,
+                                             infer_variance=infer_variance)
+            else:
+                paramspec = typing.ParamSpec(name, bound=bound,
+                                             covariant=covariant,
+                                             contravariant=contravariant)
+                paramspec.__infer_variance__ = infer_variance
+
+            _set_default(paramspec, default)
+            _set_module(paramspec)
+
+            def _paramspec_prepare_subst(alias, args):
+                params = alias.__parameters__
+                i = params.index(paramspec)
+                if i == len(args) and paramspec.has_default():
+                    args = [*args, paramspec.__default__]
+                if i >= len(args):
+                    raise TypeError(f"Too few arguments for {alias}")
+                # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
+                if len(params) == 1 and not typing._is_param_expr(args[0]):
+                    assert i == 0
+                    args = (args,)
+                # Convert lists to tuples to help other libraries cache the results.
+                elif isinstance(args[i], list):
+                    args = (*args[:i], tuple(args[i]), *args[i + 1:])
+                return args
+
+            paramspec.__typing_prepare_subst__ = _paramspec_prepare_subst
+            return paramspec
+
+        def __init_subclass__(cls) -> None:
+            raise TypeError(f"type '{__name__}.ParamSpec' is not an acceptable base type")
+
+# 3.8-3.9
+else:
+
+    # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
+    class ParamSpec(list, _DefaultMixin):
+        """Parameter specification variable.
+
+        Usage::
+
+           P = ParamSpec('P')
+
+        Parameter specification variables exist primarily for the benefit of static
+        type checkers.  They are used to forward the parameter types of one
+        callable to another callable, a pattern commonly found in higher order
+        functions and decorators.  They are only valid when used in ``Concatenate``,
+        or s the first argument to ``Callable``. In Python 3.10 and higher,
+        they are also supported in user-defined Generics at runtime.
+        See class Generic for more information on generic types.  An
+        example for annotating a decorator::
+
+           T = TypeVar('T')
+           P = ParamSpec('P')
+
+           def add_logging(f: Callable[P, T]) -> Callable[P, T]:
+               '''A type-safe decorator to add logging to a function.'''
+               def inner(*args: P.args, **kwargs: P.kwargs) -> T:
+                   logging.info(f'{f.__name__} was called')
+                   return f(*args, **kwargs)
+               return inner
+
+           @add_logging
+           def add_two(x: float, y: float) -> float:
+               '''Add two numbers together.'''
+               return x + y
+
+        Parameter specification variables defined with covariant=True or
+        contravariant=True can be used to declare covariant or contravariant
+        generic types.  These keyword arguments are valid, but their actual semantics
+        are yet to be decided.  See PEP 612 for details.
+
+        Parameter specification variables can be introspected. e.g.:
+
+           P.__name__ == 'T'
+           P.__bound__ == None
+           P.__covariant__ == False
+           P.__contravariant__ == False
+
+        Note that only parameter specification variables defined in global scope can
+        be pickled.
+        """
+
+        # Trick Generic __parameters__.
+        __class__ = typing.TypeVar
+
+        @property
+        def args(self):
+            return ParamSpecArgs(self)
+
+        @property
+        def kwargs(self):
+            return ParamSpecKwargs(self)
+
+        def __init__(self, name, *, bound=None, covariant=False, contravariant=False,
+                     infer_variance=False, default=NoDefault):
+            list.__init__(self, [self])
+            self.__name__ = name
+            self.__covariant__ = bool(covariant)
+            self.__contravariant__ = bool(contravariant)
+            self.__infer_variance__ = bool(infer_variance)
+            if bound:
+                self.__bound__ = typing._type_check(bound, 'Bound must be a type.')
+            else:
+                self.__bound__ = None
+            _DefaultMixin.__init__(self, default)
+
+            # for pickling:
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+
+        def __repr__(self):
+            if self.__infer_variance__:
+                prefix = ''
+            elif self.__covariant__:
+                prefix = '+'
+            elif self.__contravariant__:
+                prefix = '-'
+            else:
+                prefix = '~'
+            return prefix + self.__name__
+
+        def __hash__(self):
+            return object.__hash__(self)
+
+        def __eq__(self, other):
+            return self is other
+
+        def __reduce__(self):
+            return self.__name__
+
+        # Hack to get typing._type_check to pass.
+        def __call__(self, *args, **kwargs):
+            pass
+
+
+# 3.8-3.9
+if not hasattr(typing, 'Concatenate'):
+    # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
+    class _ConcatenateGenericAlias(list):
+
+        # Trick Generic into looking into this for __parameters__.
+        __class__ = typing._GenericAlias
+
+        # Flag in 3.8.
+        _special = False
+
+        def __init__(self, origin, args):
+            super().__init__(args)
+            self.__origin__ = origin
+            self.__args__ = args
+
+        def __repr__(self):
+            _type_repr = typing._type_repr
+            return (f'{_type_repr(self.__origin__)}'
+                    f'[{", ".join(_type_repr(arg) for arg in self.__args__)}]')
+
+        def __hash__(self):
+            return hash((self.__origin__, self.__args__))
+
+        # Hack to get typing._type_check to pass in Generic.
+        def __call__(self, *args, **kwargs):
+            pass
+
+        @property
+        def __parameters__(self):
+            return tuple(
+                tp for tp in self.__args__ if isinstance(tp, (typing.TypeVar, ParamSpec))
+            )
+
+
+# 3.8-3.9
+@typing._tp_cache
+def _concatenate_getitem(self, parameters):
+    if parameters == ():
+        raise TypeError("Cannot take a Concatenate of no types.")
+    if not isinstance(parameters, tuple):
+        parameters = (parameters,)
+    if not isinstance(parameters[-1], ParamSpec):
+        raise TypeError("The last parameter to Concatenate should be a "
+                        "ParamSpec variable.")
+    msg = "Concatenate[arg, ...]: each arg must be a type."
+    parameters = tuple(typing._type_check(p, msg) for p in parameters)
+    return _ConcatenateGenericAlias(self, parameters)
+
+
+# 3.10+
+if hasattr(typing, 'Concatenate'):
+    Concatenate = typing.Concatenate
+    _ConcatenateGenericAlias = typing._ConcatenateGenericAlias
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def Concatenate(self, parameters):
+        """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
+        higher order function which adds, removes or transforms parameters of a
+        callable.
+
+        For example::
+
+           Callable[Concatenate[int, P], int]
+
+        See PEP 612 for detailed information.
+        """
+        return _concatenate_getitem(self, parameters)
+# 3.8
+else:
+    class _ConcatenateForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            return _concatenate_getitem(self, parameters)
+
+    Concatenate = _ConcatenateForm(
+        'Concatenate',
+        doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
+        higher order function which adds, removes or transforms parameters of a
+        callable.
+
+        For example::
+
+           Callable[Concatenate[int, P], int]
+
+        See PEP 612 for detailed information.
+        """)
+
+# 3.10+
+if hasattr(typing, 'TypeGuard'):
+    TypeGuard = typing.TypeGuard
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def TypeGuard(self, parameters):
+        """Special typing form used to annotate the return type of a user-defined
+        type guard function.  ``TypeGuard`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeGuard[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeGuard`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the type inside ``TypeGuard``.
+
+        For example::
+
+            def is_str(val: Union[str, float]):
+                # "isinstance" type guard
+                if isinstance(val, str):
+                    # Type of ``val`` is narrowed to ``str``
+                    ...
+                else:
+                    # Else, type of ``val`` is narrowed to ``float``.
+                    ...
+
+        Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
+        form of ``TypeA`` (it can even be a wider form) and this may lead to
+        type-unsafe results.  The main reason is to allow for things like
+        narrowing ``List[object]`` to ``List[str]`` even though the latter is not
+        a subtype of the former, since ``List`` is invariant.  The responsibility of
+        writing type-safe type guards is left to the user.
+
+        ``TypeGuard`` also works with type variables.  For more information, see
+        PEP 647 (User-Defined Type Guards).
+        """
+        item = typing._type_check(parameters, f'{self} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+# 3.8
+else:
+    class _TypeGuardForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type')
+            return typing._GenericAlias(self, (item,))
+
+    TypeGuard = _TypeGuardForm(
+        'TypeGuard',
+        doc="""Special typing form used to annotate the return type of a user-defined
+        type guard function.  ``TypeGuard`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeGuard[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeGuard`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the type inside ``TypeGuard``.
+
+        For example::
+
+            def is_str(val: Union[str, float]):
+                # "isinstance" type guard
+                if isinstance(val, str):
+                    # Type of ``val`` is narrowed to ``str``
+                    ...
+                else:
+                    # Else, type of ``val`` is narrowed to ``float``.
+                    ...
+
+        Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
+        form of ``TypeA`` (it can even be a wider form) and this may lead to
+        type-unsafe results.  The main reason is to allow for things like
+        narrowing ``List[object]`` to ``List[str]`` even though the latter is not
+        a subtype of the former, since ``List`` is invariant.  The responsibility of
+        writing type-safe type guards is left to the user.
+
+        ``TypeGuard`` also works with type variables.  For more information, see
+        PEP 647 (User-Defined Type Guards).
+        """)
+
+# 3.13+
+if hasattr(typing, 'TypeIs'):
+    TypeIs = typing.TypeIs
+# 3.9
+elif sys.version_info[:2] >= (3, 9):
+    @_ExtensionsSpecialForm
+    def TypeIs(self, parameters):
+        """Special typing form used to annotate the return type of a user-defined
+        type narrower function.  ``TypeIs`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeIs[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeIs`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the intersection of the type inside ``TypeGuard`` and the argument's
+        previously known type.
+
+        For example::
+
+            def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
+                return hasattr(val, '__await__')
+
+            def f(val: Union[int, Awaitable[int]]) -> int:
+                if is_awaitable(val):
+                    assert_type(val, Awaitable[int])
+                else:
+                    assert_type(val, int)
+
+        ``TypeIs`` also works with type variables.  For more information, see
+        PEP 742 (Narrowing types with TypeIs).
+        """
+        item = typing._type_check(parameters, f'{self} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+# 3.8
+else:
+    class _TypeIsForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type')
+            return typing._GenericAlias(self, (item,))
+
+    TypeIs = _TypeIsForm(
+        'TypeIs',
+        doc="""Special typing form used to annotate the return type of a user-defined
+        type narrower function.  ``TypeIs`` only accepts a single type argument.
+        At runtime, functions marked this way should return a boolean.
+
+        ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
+        type checkers to determine a more precise type of an expression within a
+        program's code flow.  Usually type narrowing is done by analyzing
+        conditional code flow and applying the narrowing to a block of code.  The
+        conditional expression here is sometimes referred to as a "type guard".
+
+        Sometimes it would be convenient to use a user-defined boolean function
+        as a type guard.  Such a function should use ``TypeIs[...]`` as its
+        return type to alert static type checkers to this intention.
+
+        Using  ``-> TypeIs`` tells the static type checker that for a given
+        function:
+
+        1. The return value is a boolean.
+        2. If the return value is ``True``, the type of its argument
+        is the intersection of the type inside ``TypeGuard`` and the argument's
+        previously known type.
+
+        For example::
+
+            def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
+                return hasattr(val, '__await__')
+
+            def f(val: Union[int, Awaitable[int]]) -> int:
+                if is_awaitable(val):
+                    assert_type(val, Awaitable[int])
+                else:
+                    assert_type(val, int)
+
+        ``TypeIs`` also works with type variables.  For more information, see
+        PEP 742 (Narrowing types with TypeIs).
+        """)
+
+
+# Vendored from cpython typing._SpecialFrom
+class _SpecialForm(typing._Final, _root=True):
+    __slots__ = ('_name', '__doc__', '_getitem')
+
+    def __init__(self, getitem):
+        self._getitem = getitem
+        self._name = getitem.__name__
+        self.__doc__ = getitem.__doc__
+
+    def __getattr__(self, item):
+        if item in {'__name__', '__qualname__'}:
+            return self._name
+
+        raise AttributeError(item)
+
+    def __mro_entries__(self, bases):
+        raise TypeError(f"Cannot subclass {self!r}")
+
+    def __repr__(self):
+        return f'typing_extensions.{self._name}'
+
+    def __reduce__(self):
+        return self._name
+
+    def __call__(self, *args, **kwds):
+        raise TypeError(f"Cannot instantiate {self!r}")
+
+    def __or__(self, other):
+        return typing.Union[self, other]
+
+    def __ror__(self, other):
+        return typing.Union[other, self]
+
+    def __instancecheck__(self, obj):
+        raise TypeError(f"{self} cannot be used with isinstance()")
+
+    def __subclasscheck__(self, cls):
+        raise TypeError(f"{self} cannot be used with issubclass()")
+
+    @typing._tp_cache
+    def __getitem__(self, parameters):
+        return self._getitem(self, parameters)
+
+
+if hasattr(typing, "LiteralString"):  # 3.11+
+    LiteralString = typing.LiteralString
+else:
+    @_SpecialForm
+    def LiteralString(self, params):
+        """Represents an arbitrary literal string.
+
+        Example::
+
+          from typing_extensions import LiteralString
+
+          def query(sql: LiteralString) -> ...:
+              ...
+
+          query("SELECT * FROM table")  # ok
+          query(f"SELECT * FROM {input()}")  # not ok
+
+        See PEP 675 for details.
+
+        """
+        raise TypeError(f"{self} is not subscriptable")
+
+
+if hasattr(typing, "Self"):  # 3.11+
+    Self = typing.Self
+else:
+    @_SpecialForm
+    def Self(self, params):
+        """Used to spell the type of "self" in classes.
+
+        Example::
+
+          from typing import Self
+
+          class ReturnsSelf:
+              def parse(self, data: bytes) -> Self:
+                  ...
+                  return self
+
+        """
+
+        raise TypeError(f"{self} is not subscriptable")
+
+
+if hasattr(typing, "Never"):  # 3.11+
+    Never = typing.Never
+else:
+    @_SpecialForm
+    def Never(self, params):
+        """The bottom type, a type that has no members.
+
+        This can be used to define a function that should never be
+        called, or a function that never returns::
+
+            from typing_extensions import Never
+
+            def never_call_me(arg: Never) -> None:
+                pass
+
+            def int_or_str(arg: int | str) -> None:
+                never_call_me(arg)  # type checker error
+                match arg:
+                    case int():
+                        print("It's an int")
+                    case str():
+                        print("It's a str")
+                    case _:
+                        never_call_me(arg)  # ok, arg is of type Never
+
+        """
+
+        raise TypeError(f"{self} is not subscriptable")
+
+
+if hasattr(typing, 'Required'):  # 3.11+
+    Required = typing.Required
+    NotRequired = typing.NotRequired
+elif sys.version_info[:2] >= (3, 9):  # 3.9-3.10
+    @_ExtensionsSpecialForm
+    def Required(self, parameters):
+        """A special typing construct to mark a key of a total=False TypedDict
+        as required. For example:
+
+            class Movie(TypedDict, total=False):
+                title: Required[str]
+                year: int
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+
+        There is no runtime checking that a required key is actually provided
+        when instantiating a related TypedDict.
+        """
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+
+    @_ExtensionsSpecialForm
+    def NotRequired(self, parameters):
+        """A special typing construct to mark a key of a TypedDict as
+        potentially missing. For example:
+
+            class Movie(TypedDict):
+                title: str
+                year: NotRequired[int]
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+        """
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+
+else:  # 3.8
+    class _RequiredForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type.')
+            return typing._GenericAlias(self, (item,))
+
+    Required = _RequiredForm(
+        'Required',
+        doc="""A special typing construct to mark a key of a total=False TypedDict
+        as required. For example:
+
+            class Movie(TypedDict, total=False):
+                title: Required[str]
+                year: int
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+
+        There is no runtime checking that a required key is actually provided
+        when instantiating a related TypedDict.
+        """)
+    NotRequired = _RequiredForm(
+        'NotRequired',
+        doc="""A special typing construct to mark a key of a TypedDict as
+        potentially missing. For example:
+
+            class Movie(TypedDict):
+                title: str
+                year: NotRequired[int]
+
+            m = Movie(
+                title='The Matrix',  # typechecker error if key is omitted
+                year=1999,
+            )
+        """)
+
+
+if hasattr(typing, 'ReadOnly'):
+    ReadOnly = typing.ReadOnly
+elif sys.version_info[:2] >= (3, 9):  # 3.9-3.12
+    @_ExtensionsSpecialForm
+    def ReadOnly(self, parameters):
+        """A special typing construct to mark an item of a TypedDict as read-only.
+
+        For example:
+
+            class Movie(TypedDict):
+                title: ReadOnly[str]
+                year: int
+
+            def mutate_movie(m: Movie) -> None:
+                m["year"] = 1992  # allowed
+                m["title"] = "The Matrix"  # typechecker error
+
+        There is no runtime checking for this property.
+        """
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return typing._GenericAlias(self, (item,))
+
+else:  # 3.8
+    class _ReadOnlyForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type.')
+            return typing._GenericAlias(self, (item,))
+
+    ReadOnly = _ReadOnlyForm(
+        'ReadOnly',
+        doc="""A special typing construct to mark a key of a TypedDict as read-only.
+
+        For example:
+
+            class Movie(TypedDict):
+                title: ReadOnly[str]
+                year: int
+
+            def mutate_movie(m: Movie) -> None:
+                m["year"] = 1992  # allowed
+                m["title"] = "The Matrix"  # typechecker error
+
+        There is no runtime checking for this propery.
+        """)
+
+
+_UNPACK_DOC = """\
+Type unpack operator.
+
+The type unpack operator takes the child types from some container type,
+such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For
+example:
+
+  # For some generic class `Foo`:
+  Foo[Unpack[tuple[int, str]]]  # Equivalent to Foo[int, str]
+
+  Ts = TypeVarTuple('Ts')
+  # Specifies that `Bar` is generic in an arbitrary number of types.
+  # (Think of `Ts` as a tuple of an arbitrary number of individual
+  #  `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
+  #  `Generic[]`.)
+  class Bar(Generic[Unpack[Ts]]): ...
+  Bar[int]  # Valid
+  Bar[int, str]  # Also valid
+
+From Python 3.11, this can also be done using the `*` operator:
+
+    Foo[*tuple[int, str]]
+    class Bar(Generic[*Ts]): ...
+
+The operator can also be used along with a `TypedDict` to annotate
+`**kwargs` in a function signature. For instance:
+
+  class Movie(TypedDict):
+    name: str
+    year: int
+
+  # This function expects two keyword arguments - *name* of type `str` and
+  # *year* of type `int`.
+  def foo(**kwargs: Unpack[Movie]): ...
+
+Note that there is only some runtime checking of this operator. Not
+everything the runtime allows may be accepted by static type checkers.
+
+For more information, see PEP 646 and PEP 692.
+"""
+
+
+if sys.version_info >= (3, 12):  # PEP 692 changed the repr of Unpack[]
+    Unpack = typing.Unpack
+
+    def _is_unpack(obj):
+        return get_origin(obj) is Unpack
+
+elif sys.version_info[:2] >= (3, 9):  # 3.9+
+    class _UnpackSpecialForm(_ExtensionsSpecialForm, _root=True):
+        def __init__(self, getitem):
+            super().__init__(getitem)
+            self.__doc__ = _UNPACK_DOC
+
+    class _UnpackAlias(typing._GenericAlias, _root=True):
+        __class__ = typing.TypeVar
+
+        @property
+        def __typing_unpacked_tuple_args__(self):
+            assert self.__origin__ is Unpack
+            assert len(self.__args__) == 1
+            arg, = self.__args__
+            if isinstance(arg, (typing._GenericAlias, _types.GenericAlias)):
+                if arg.__origin__ is not tuple:
+                    raise TypeError("Unpack[...] must be used with a tuple type")
+                return arg.__args__
+            return None
+
+    @_UnpackSpecialForm
+    def Unpack(self, parameters):
+        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
+        return _UnpackAlias(self, (item,))
+
+    def _is_unpack(obj):
+        return isinstance(obj, _UnpackAlias)
+
+else:  # 3.8
+    class _UnpackAlias(typing._GenericAlias, _root=True):
+        __class__ = typing.TypeVar
+
+    class _UnpackForm(_ExtensionsSpecialForm, _root=True):
+        def __getitem__(self, parameters):
+            item = typing._type_check(parameters,
+                                      f'{self._name} accepts only a single type.')
+            return _UnpackAlias(self, (item,))
+
+    Unpack = _UnpackForm('Unpack', doc=_UNPACK_DOC)
+
+    def _is_unpack(obj):
+        return isinstance(obj, _UnpackAlias)
+
+
+if _PEP_696_IMPLEMENTED:
+    from typing import TypeVarTuple
+
+elif hasattr(typing, "TypeVarTuple"):  # 3.11+
+
+    def _unpack_args(*args):
+        newargs = []
+        for arg in args:
+            subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
+            if subargs is not None and not (subargs and subargs[-1] is ...):
+                newargs.extend(subargs)
+            else:
+                newargs.append(arg)
+        return newargs
+
+    # Add default parameter - PEP 696
+    class TypeVarTuple(metaclass=_TypeVarLikeMeta):
+        """Type variable tuple."""
+
+        _backported_typevarlike = typing.TypeVarTuple
+
+        def __new__(cls, name, *, default=NoDefault):
+            tvt = typing.TypeVarTuple(name)
+            _set_default(tvt, default)
+            _set_module(tvt)
+
+            def _typevartuple_prepare_subst(alias, args):
+                params = alias.__parameters__
+                typevartuple_index = params.index(tvt)
+                for param in params[typevartuple_index + 1:]:
+                    if isinstance(param, TypeVarTuple):
+                        raise TypeError(
+                            f"More than one TypeVarTuple parameter in {alias}"
+                        )
+
+                alen = len(args)
+                plen = len(params)
+                left = typevartuple_index
+                right = plen - typevartuple_index - 1
+                var_tuple_index = None
+                fillarg = None
+                for k, arg in enumerate(args):
+                    if not isinstance(arg, type):
+                        subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
+                        if subargs and len(subargs) == 2 and subargs[-1] is ...:
+                            if var_tuple_index is not None:
+                                raise TypeError(
+                                    "More than one unpacked "
+                                    "arbitrary-length tuple argument"
+                                )
+                            var_tuple_index = k
+                            fillarg = subargs[0]
+                if var_tuple_index is not None:
+                    left = min(left, var_tuple_index)
+                    right = min(right, alen - var_tuple_index - 1)
+                elif left + right > alen:
+                    raise TypeError(f"Too few arguments for {alias};"
+                                    f" actual {alen}, expected at least {plen - 1}")
+                if left == alen - right and tvt.has_default():
+                    replacement = _unpack_args(tvt.__default__)
+                else:
+                    replacement = args[left: alen - right]
+
+                return (
+                    *args[:left],
+                    *([fillarg] * (typevartuple_index - left)),
+                    replacement,
+                    *([fillarg] * (plen - right - left - typevartuple_index - 1)),
+                    *args[alen - right:],
+                )
+
+            tvt.__typing_prepare_subst__ = _typevartuple_prepare_subst
+            return tvt
+
+        def __init_subclass__(self, *args, **kwds):
+            raise TypeError("Cannot subclass special typing classes")
+
+else:  # <=3.10
+    class TypeVarTuple(_DefaultMixin):
+        """Type variable tuple.
+
+        Usage::
+
+            Ts = TypeVarTuple('Ts')
+
+        In the same way that a normal type variable is a stand-in for a single
+        type such as ``int``, a type variable *tuple* is a stand-in for a *tuple*
+        type such as ``Tuple[int, str]``.
+
+        Type variable tuples can be used in ``Generic`` declarations.
+        Consider the following example::
+
+            class Array(Generic[*Ts]): ...
+
+        The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``,
+        where ``T1`` and ``T2`` are type variables. To use these type variables
+        as type parameters of ``Array``, we must *unpack* the type variable tuple using
+        the star operator: ``*Ts``. The signature of ``Array`` then behaves
+        as if we had simply written ``class Array(Generic[T1, T2]): ...``.
+        In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows
+        us to parameterise the class with an *arbitrary* number of type parameters.
+
+        Type variable tuples can be used anywhere a normal ``TypeVar`` can.
+        This includes class definitions, as shown above, as well as function
+        signatures and variable annotations::
+
+            class Array(Generic[*Ts]):
+
+                def __init__(self, shape: Tuple[*Ts]):
+                    self._shape: Tuple[*Ts] = shape
+
+                def get_shape(self) -> Tuple[*Ts]:
+                    return self._shape
+
+            shape = (Height(480), Width(640))
+            x: Array[Height, Width] = Array(shape)
+            y = abs(x)  # Inferred type is Array[Height, Width]
+            z = x + x   #        ...    is Array[Height, Width]
+            x.get_shape()  #     ...    is tuple[Height, Width]
+
+        """
+
+        # Trick Generic __parameters__.
+        __class__ = typing.TypeVar
+
+        def __iter__(self):
+            yield self.__unpacked__
+
+        def __init__(self, name, *, default=NoDefault):
+            self.__name__ = name
+            _DefaultMixin.__init__(self, default)
+
+            # for pickling:
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+
+            self.__unpacked__ = Unpack[self]
+
+        def __repr__(self):
+            return self.__name__
+
+        def __hash__(self):
+            return object.__hash__(self)
+
+        def __eq__(self, other):
+            return self is other
+
+        def __reduce__(self):
+            return self.__name__
+
+        def __init_subclass__(self, *args, **kwds):
+            if '_root' not in kwds:
+                raise TypeError("Cannot subclass special typing classes")
+
+
+if hasattr(typing, "reveal_type"):  # 3.11+
+    reveal_type = typing.reveal_type
+else:  # <=3.10
+    def reveal_type(obj: T, /) -> T:
+        """Reveal the inferred type of a variable.
+
+        When a static type checker encounters a call to ``reveal_type()``,
+        it will emit the inferred type of the argument::
+
+            x: int = 1
+            reveal_type(x)
+
+        Running a static type checker (e.g., ``mypy``) on this example
+        will produce output similar to 'Revealed type is "builtins.int"'.
+
+        At runtime, the function prints the runtime type of the
+        argument and returns it unchanged.
+
+        """
+        print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr)
+        return obj
+
+
+if hasattr(typing, "_ASSERT_NEVER_REPR_MAX_LENGTH"):  # 3.11+
+    _ASSERT_NEVER_REPR_MAX_LENGTH = typing._ASSERT_NEVER_REPR_MAX_LENGTH
+else:  # <=3.10
+    _ASSERT_NEVER_REPR_MAX_LENGTH = 100
+
+
+if hasattr(typing, "assert_never"):  # 3.11+
+    assert_never = typing.assert_never
+else:  # <=3.10
+    def assert_never(arg: Never, /) -> Never:
+        """Assert to the type checker that a line of code is unreachable.
+
+        Example::
+
+            def int_or_str(arg: int | str) -> None:
+                match arg:
+                    case int():
+                        print("It's an int")
+                    case str():
+                        print("It's a str")
+                    case _:
+                        assert_never(arg)
+
+        If a type checker finds that a call to assert_never() is
+        reachable, it will emit an error.
+
+        At runtime, this throws an exception when called.
+
+        """
+        value = repr(arg)
+        if len(value) > _ASSERT_NEVER_REPR_MAX_LENGTH:
+            value = value[:_ASSERT_NEVER_REPR_MAX_LENGTH] + '...'
+        raise AssertionError(f"Expected code to be unreachable, but got: {value}")
+
+
+if sys.version_info >= (3, 12):  # 3.12+
+    # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
+    dataclass_transform = typing.dataclass_transform
+else:  # <=3.11
+    def dataclass_transform(
+        *,
+        eq_default: bool = True,
+        order_default: bool = False,
+        kw_only_default: bool = False,
+        frozen_default: bool = False,
+        field_specifiers: typing.Tuple[
+            typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
+            ...
+        ] = (),
+        **kwargs: typing.Any,
+    ) -> typing.Callable[[T], T]:
+        """Decorator that marks a function, class, or metaclass as providing
+        dataclass-like behavior.
+
+        Example:
+
+            from typing_extensions import dataclass_transform
+
+            _T = TypeVar("_T")
+
+            # Used on a decorator function
+            @dataclass_transform()
+            def create_model(cls: type[_T]) -> type[_T]:
+                ...
+                return cls
+
+            @create_model
+            class CustomerModel:
+                id: int
+                name: str
+
+            # Used on a base class
+            @dataclass_transform()
+            class ModelBase: ...
+
+            class CustomerModel(ModelBase):
+                id: int
+                name: str
+
+            # Used on a metaclass
+            @dataclass_transform()
+            class ModelMeta(type): ...
+
+            class ModelBase(metaclass=ModelMeta): ...
+
+            class CustomerModel(ModelBase):
+                id: int
+                name: str
+
+        Each of the ``CustomerModel`` classes defined in this example will now
+        behave similarly to a dataclass created with the ``@dataclasses.dataclass``
+        decorator. For example, the type checker will synthesize an ``__init__``
+        method.
+
+        The arguments to this decorator can be used to customize this behavior:
+        - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be
+          True or False if it is omitted by the caller.
+        - ``order_default`` indicates whether the ``order`` parameter is
+          assumed to be True or False if it is omitted by the caller.
+        - ``kw_only_default`` indicates whether the ``kw_only`` parameter is
+          assumed to be True or False if it is omitted by the caller.
+        - ``frozen_default`` indicates whether the ``frozen`` parameter is
+          assumed to be True or False if it is omitted by the caller.
+        - ``field_specifiers`` specifies a static list of supported classes
+          or functions that describe fields, similar to ``dataclasses.field()``.
+
+        At runtime, this decorator records its arguments in the
+        ``__dataclass_transform__`` attribute on the decorated object.
+
+        See PEP 681 for details.
+
+        """
+        def decorator(cls_or_fn):
+            cls_or_fn.__dataclass_transform__ = {
+                "eq_default": eq_default,
+                "order_default": order_default,
+                "kw_only_default": kw_only_default,
+                "frozen_default": frozen_default,
+                "field_specifiers": field_specifiers,
+                "kwargs": kwargs,
+            }
+            return cls_or_fn
+        return decorator
+
+
+if hasattr(typing, "override"):  # 3.12+
+    override = typing.override
+else:  # <=3.11
+    _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any])
+
+    def override(arg: _F, /) -> _F:
+        """Indicate that a method is intended to override a method in a base class.
+
+        Usage:
+
+            class Base:
+                def method(self) -> None:
+                    pass
+
+            class Child(Base):
+                @override
+                def method(self) -> None:
+                    super().method()
+
+        When this decorator is applied to a method, the type checker will
+        validate that it overrides a method with the same name on a base class.
+        This helps prevent bugs that may occur when a base class is changed
+        without an equivalent change to a child class.
+
+        There is no runtime checking of these properties. The decorator
+        sets the ``__override__`` attribute to ``True`` on the decorated object
+        to allow runtime introspection.
+
+        See PEP 698 for details.
+
+        """
+        try:
+            arg.__override__ = True
+        except (AttributeError, TypeError):
+            # Skip the attribute silently if it is not writable.
+            # AttributeError happens if the object has __slots__ or a
+            # read-only property, TypeError if it's a builtin class.
+            pass
+        return arg
+
+
+if hasattr(warnings, "deprecated"):
+    deprecated = warnings.deprecated
+else:
+    _T = typing.TypeVar("_T")
+
+    class deprecated:
+        """Indicate that a class, function or overload is deprecated.
+
+        When this decorator is applied to an object, the type checker
+        will generate a diagnostic on usage of the deprecated object.
+
+        Usage:
+
+            @deprecated("Use B instead")
+            class A:
+                pass
+
+            @deprecated("Use g instead")
+            def f():
+                pass
+
+            @overload
+            @deprecated("int support is deprecated")
+            def g(x: int) -> int: ...
+            @overload
+            def g(x: str) -> int: ...
+
+        The warning specified by *category* will be emitted at runtime
+        on use of deprecated objects. For functions, that happens on calls;
+        for classes, on instantiation and on creation of subclasses.
+        If the *category* is ``None``, no warning is emitted at runtime.
+        The *stacklevel* determines where the
+        warning is emitted. If it is ``1`` (the default), the warning
+        is emitted at the direct caller of the deprecated object; if it
+        is higher, it is emitted further up the stack.
+        Static type checker behavior is not affected by the *category*
+        and *stacklevel* arguments.
+
+        The deprecation message passed to the decorator is saved in the
+        ``__deprecated__`` attribute on the decorated object.
+        If applied to an overload, the decorator
+        must be after the ``@overload`` decorator for the attribute to
+        exist on the overload as returned by ``get_overloads()``.
+
+        See PEP 702 for details.
+
+        """
+        def __init__(
+            self,
+            message: str,
+            /,
+            *,
+            category: typing.Optional[typing.Type[Warning]] = DeprecationWarning,
+            stacklevel: int = 1,
+        ) -> None:
+            if not isinstance(message, str):
+                raise TypeError(
+                    "Expected an object of type str for 'message', not "
+                    f"{type(message).__name__!r}"
+                )
+            self.message = message
+            self.category = category
+            self.stacklevel = stacklevel
+
+        def __call__(self, arg: _T, /) -> _T:
+            # Make sure the inner functions created below don't
+            # retain a reference to self.
+            msg = self.message
+            category = self.category
+            stacklevel = self.stacklevel
+            if category is None:
+                arg.__deprecated__ = msg
+                return arg
+            elif isinstance(arg, type):
+                import functools
+                from types import MethodType
+
+                original_new = arg.__new__
+
+                @functools.wraps(original_new)
+                def __new__(cls, *args, **kwargs):
+                    if cls is arg:
+                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                    if original_new is not object.__new__:
+                        return original_new(cls, *args, **kwargs)
+                    # Mirrors a similar check in object.__new__.
+                    elif cls.__init__ is object.__init__ and (args or kwargs):
+                        raise TypeError(f"{cls.__name__}() takes no arguments")
+                    else:
+                        return original_new(cls)
+
+                arg.__new__ = staticmethod(__new__)
+
+                original_init_subclass = arg.__init_subclass__
+                # We need slightly different behavior if __init_subclass__
+                # is a bound method (likely if it was implemented in Python)
+                if isinstance(original_init_subclass, MethodType):
+                    original_init_subclass = original_init_subclass.__func__
+
+                    @functools.wraps(original_init_subclass)
+                    def __init_subclass__(*args, **kwargs):
+                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                        return original_init_subclass(*args, **kwargs)
+
+                    arg.__init_subclass__ = classmethod(__init_subclass__)
+                # Or otherwise, which likely means it's a builtin such as
+                # object's implementation of __init_subclass__.
+                else:
+                    @functools.wraps(original_init_subclass)
+                    def __init_subclass__(*args, **kwargs):
+                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                        return original_init_subclass(*args, **kwargs)
+
+                    arg.__init_subclass__ = __init_subclass__
+
+                arg.__deprecated__ = __new__.__deprecated__ = msg
+                __init_subclass__.__deprecated__ = msg
+                return arg
+            elif callable(arg):
+                import functools
+
+                @functools.wraps(arg)
+                def wrapper(*args, **kwargs):
+                    warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
+                    return arg(*args, **kwargs)
+
+                arg.__deprecated__ = wrapper.__deprecated__ = msg
+                return wrapper
+            else:
+                raise TypeError(
+                    "@deprecated decorator with non-None category must be applied to "
+                    f"a class or callable, not {arg!r}"
+                )
+
+
+# We have to do some monkey patching to deal with the dual nature of
+# Unpack/TypeVarTuple:
+# - We want Unpack to be a kind of TypeVar so it gets accepted in
+#   Generic[Unpack[Ts]]
+# - We want it to *not* be treated as a TypeVar for the purposes of
+#   counting generic parameters, so that when we subscript a generic,
+#   the runtime doesn't try to substitute the Unpack with the subscripted type.
+if not hasattr(typing, "TypeVarTuple"):
+    def _check_generic(cls, parameters, elen=_marker):
+        """Check correct count for parameters of a generic cls (internal helper).
+
+        This gives a nice error message in case of count mismatch.
+        """
+        if not elen:
+            raise TypeError(f"{cls} is not a generic class")
+        if elen is _marker:
+            if not hasattr(cls, "__parameters__") or not cls.__parameters__:
+                raise TypeError(f"{cls} is not a generic class")
+            elen = len(cls.__parameters__)
+        alen = len(parameters)
+        if alen != elen:
+            expect_val = elen
+            if hasattr(cls, "__parameters__"):
+                parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
+                num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in parameters)
+                if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
+                    return
+
+                # deal with TypeVarLike defaults
+                # required TypeVarLikes cannot appear after a defaulted one.
+                if alen < elen:
+                    # since we validate TypeVarLike default in _collect_type_vars
+                    # or _collect_parameters we can safely check parameters[alen]
+                    if (
+                        getattr(parameters[alen], '__default__', NoDefault)
+                        is not NoDefault
+                    ):
+                        return
+
+                    num_default_tv = sum(getattr(p, '__default__', NoDefault)
+                                         is not NoDefault for p in parameters)
+
+                    elen -= num_default_tv
+
+                    expect_val = f"at least {elen}"
+
+            things = "arguments" if sys.version_info >= (3, 10) else "parameters"
+            raise TypeError(f"Too {'many' if alen > elen else 'few'} {things}"
+                            f" for {cls}; actual {alen}, expected {expect_val}")
+else:
+    # Python 3.11+
+
+    def _check_generic(cls, parameters, elen):
+        """Check correct count for parameters of a generic cls (internal helper).
+
+        This gives a nice error message in case of count mismatch.
+        """
+        if not elen:
+            raise TypeError(f"{cls} is not a generic class")
+        alen = len(parameters)
+        if alen != elen:
+            expect_val = elen
+            if hasattr(cls, "__parameters__"):
+                parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
+
+                # deal with TypeVarLike defaults
+                # required TypeVarLikes cannot appear after a defaulted one.
+                if alen < elen:
+                    # since we validate TypeVarLike default in _collect_type_vars
+                    # or _collect_parameters we can safely check parameters[alen]
+                    if (
+                        getattr(parameters[alen], '__default__', NoDefault)
+                        is not NoDefault
+                    ):
+                        return
+
+                    num_default_tv = sum(getattr(p, '__default__', NoDefault)
+                                         is not NoDefault for p in parameters)
+
+                    elen -= num_default_tv
+
+                    expect_val = f"at least {elen}"
+
+            raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
+                            f" for {cls}; actual {alen}, expected {expect_val}")
+
+if not _PEP_696_IMPLEMENTED:
+    typing._check_generic = _check_generic
+
+
+def _has_generic_or_protocol_as_origin() -> bool:
+    try:
+        frame = sys._getframe(2)
+    # - Catch AttributeError: not all Python implementations have sys._getframe()
+    # - Catch ValueError: maybe we're called from an unexpected module
+    #   and the call stack isn't deep enough
+    except (AttributeError, ValueError):
+        return False  # err on the side of leniency
+    else:
+        # If we somehow get invoked from outside typing.py,
+        # also err on the side of leniency
+        if frame.f_globals.get("__name__") != "typing":
+            return False
+        origin = frame.f_locals.get("origin")
+        # Cannot use "in" because origin may be an object with a buggy __eq__ that
+        # throws an error.
+        return origin is typing.Generic or origin is Protocol or origin is typing.Protocol
+
+
+_TYPEVARTUPLE_TYPES = {TypeVarTuple, getattr(typing, "TypeVarTuple", None)}
+
+
+def _is_unpacked_typevartuple(x) -> bool:
+    if get_origin(x) is not Unpack:
+        return False
+    args = get_args(x)
+    return (
+        bool(args)
+        and len(args) == 1
+        and type(args[0]) in _TYPEVARTUPLE_TYPES
+    )
+
+
+# Python 3.11+ _collect_type_vars was renamed to _collect_parameters
+if hasattr(typing, '_collect_type_vars'):
+    def _collect_type_vars(types, typevar_types=None):
+        """Collect all type variable contained in types in order of
+        first appearance (lexicographic order). For example::
+
+            _collect_type_vars((T, List[S, T])) == (T, S)
+        """
+        if typevar_types is None:
+            typevar_types = typing.TypeVar
+        tvars = []
+
+        # A required TypeVarLike cannot appear after a TypeVarLike with a default
+        # if it was a direct call to `Generic[]` or `Protocol[]`
+        enforce_default_ordering = _has_generic_or_protocol_as_origin()
+        default_encountered = False
+
+        # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
+        type_var_tuple_encountered = False
+
+        for t in types:
+            if _is_unpacked_typevartuple(t):
+                type_var_tuple_encountered = True
+            elif isinstance(t, typevar_types) and t not in tvars:
+                if enforce_default_ordering:
+                    has_default = getattr(t, '__default__', NoDefault) is not NoDefault
+                    if has_default:
+                        if type_var_tuple_encountered:
+                            raise TypeError('Type parameter with a default'
+                                            ' follows TypeVarTuple')
+                        default_encountered = True
+                    elif default_encountered:
+                        raise TypeError(f'Type parameter {t!r} without a default'
+                                        ' follows type parameter with a default')
+
+                tvars.append(t)
+            if _should_collect_from_parameters(t):
+                tvars.extend([t for t in t.__parameters__ if t not in tvars])
+        return tuple(tvars)
+
+    typing._collect_type_vars = _collect_type_vars
+else:
+    def _collect_parameters(args):
+        """Collect all type variables and parameter specifications in args
+        in order of first appearance (lexicographic order).
+
+        For example::
+
+            assert _collect_parameters((T, Callable[P, T])) == (T, P)
+        """
+        parameters = []
+
+        # A required TypeVarLike cannot appear after a TypeVarLike with default
+        # if it was a direct call to `Generic[]` or `Protocol[]`
+        enforce_default_ordering = _has_generic_or_protocol_as_origin()
+        default_encountered = False
+
+        # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
+        type_var_tuple_encountered = False
+
+        for t in args:
+            if isinstance(t, type):
+                # We don't want __parameters__ descriptor of a bare Python class.
+                pass
+            elif isinstance(t, tuple):
+                # `t` might be a tuple, when `ParamSpec` is substituted with
+                # `[T, int]`, or `[int, *Ts]`, etc.
+                for x in t:
+                    for collected in _collect_parameters([x]):
+                        if collected not in parameters:
+                            parameters.append(collected)
+            elif hasattr(t, '__typing_subst__'):
+                if t not in parameters:
+                    if enforce_default_ordering:
+                        has_default = (
+                            getattr(t, '__default__', NoDefault) is not NoDefault
+                        )
+
+                        if type_var_tuple_encountered and has_default:
+                            raise TypeError('Type parameter with a default'
+                                            ' follows TypeVarTuple')
+
+                        if has_default:
+                            default_encountered = True
+                        elif default_encountered:
+                            raise TypeError(f'Type parameter {t!r} without a default'
+                                            ' follows type parameter with a default')
+
+                    parameters.append(t)
+            else:
+                if _is_unpacked_typevartuple(t):
+                    type_var_tuple_encountered = True
+                for x in getattr(t, '__parameters__', ()):
+                    if x not in parameters:
+                        parameters.append(x)
+
+        return tuple(parameters)
+
+    if not _PEP_696_IMPLEMENTED:
+        typing._collect_parameters = _collect_parameters
+
+# Backport typing.NamedTuple as it exists in Python 3.13.
+# In 3.11, the ability to define generic `NamedTuple`s was supported.
+# This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8.
+# On 3.12, we added __orig_bases__ to call-based NamedTuples
+# On 3.13, we deprecated kwargs-based NamedTuples
+if sys.version_info >= (3, 13):
+    NamedTuple = typing.NamedTuple
+else:
+    def _make_nmtuple(name, types, module, defaults=()):
+        fields = [n for n, t in types]
+        annotations = {n: typing._type_check(t, f"field {n} annotation must be a type")
+                       for n, t in types}
+        nm_tpl = collections.namedtuple(name, fields,
+                                        defaults=defaults, module=module)
+        nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations
+        # The `_field_types` attribute was removed in 3.9;
+        # in earlier versions, it is the same as the `__annotations__` attribute
+        if sys.version_info < (3, 9):
+            nm_tpl._field_types = annotations
+        return nm_tpl
+
+    _prohibited_namedtuple_fields = typing._prohibited
+    _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'})
+
+    class _NamedTupleMeta(type):
+        def __new__(cls, typename, bases, ns):
+            assert _NamedTuple in bases
+            for base in bases:
+                if base is not _NamedTuple and base is not typing.Generic:
+                    raise TypeError(
+                        'can only inherit from a NamedTuple type and Generic')
+            bases = tuple(tuple if base is _NamedTuple else base for base in bases)
+            if "__annotations__" in ns:
+                types = ns["__annotations__"]
+            elif "__annotate__" in ns:
+                # TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
+                types = ns["__annotate__"](1)
+            else:
+                types = {}
+            default_names = []
+            for field_name in types:
+                if field_name in ns:
+                    default_names.append(field_name)
+                elif default_names:
+                    raise TypeError(f"Non-default namedtuple field {field_name} "
+                                    f"cannot follow default field"
+                                    f"{'s' if len(default_names) > 1 else ''} "
+                                    f"{', '.join(default_names)}")
+            nm_tpl = _make_nmtuple(
+                typename, types.items(),
+                defaults=[ns[n] for n in default_names],
+                module=ns['__module__']
+            )
+            nm_tpl.__bases__ = bases
+            if typing.Generic in bases:
+                if hasattr(typing, '_generic_class_getitem'):  # 3.12+
+                    nm_tpl.__class_getitem__ = classmethod(typing._generic_class_getitem)
+                else:
+                    class_getitem = typing.Generic.__class_getitem__.__func__
+                    nm_tpl.__class_getitem__ = classmethod(class_getitem)
+            # update from user namespace without overriding special namedtuple attributes
+            for key, val in ns.items():
+                if key in _prohibited_namedtuple_fields:
+                    raise AttributeError("Cannot overwrite NamedTuple attribute " + key)
+                elif key not in _special_namedtuple_fields:
+                    if key not in nm_tpl._fields:
+                        setattr(nm_tpl, key, ns[key])
+                    try:
+                        set_name = type(val).__set_name__
+                    except AttributeError:
+                        pass
+                    else:
+                        try:
+                            set_name(val, nm_tpl, key)
+                        except BaseException as e:
+                            msg = (
+                                f"Error calling __set_name__ on {type(val).__name__!r} "
+                                f"instance {key!r} in {typename!r}"
+                            )
+                            # BaseException.add_note() existed on py311,
+                            # but the __set_name__ machinery didn't start
+                            # using add_note() until py312.
+                            # Making sure exceptions are raised in the same way
+                            # as in "normal" classes seems most important here.
+                            if sys.version_info >= (3, 12):
+                                e.add_note(msg)
+                                raise
+                            else:
+                                raise RuntimeError(msg) from e
+
+            if typing.Generic in bases:
+                nm_tpl.__init_subclass__()
+            return nm_tpl
+
+    _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {})
+
+    def _namedtuple_mro_entries(bases):
+        assert NamedTuple in bases
+        return (_NamedTuple,)
+
+    @_ensure_subclassable(_namedtuple_mro_entries)
+    def NamedTuple(typename, fields=_marker, /, **kwargs):
+        """Typed version of namedtuple.
+
+        Usage::
+
+            class Employee(NamedTuple):
+                name: str
+                id: int
+
+        This is equivalent to::
+
+            Employee = collections.namedtuple('Employee', ['name', 'id'])
+
+        The resulting class has an extra __annotations__ attribute, giving a
+        dict that maps field names to types.  (The field names are also in
+        the _fields attribute, which is part of the namedtuple API.)
+        An alternative equivalent functional syntax is also accepted::
+
+            Employee = NamedTuple('Employee', [('name', str), ('id', int)])
+        """
+        if fields is _marker:
+            if kwargs:
+                deprecated_thing = "Creating NamedTuple classes using keyword arguments"
+                deprecation_msg = (
+                    "{name} is deprecated and will be disallowed in Python {remove}. "
+                    "Use the class-based or functional syntax instead."
+                )
+            else:
+                deprecated_thing = "Failing to pass a value for the 'fields' parameter"
+                example = f"`{typename} = NamedTuple({typename!r}, [])`"
+                deprecation_msg = (
+                    "{name} is deprecated and will be disallowed in Python {remove}. "
+                    "To create a NamedTuple class with 0 fields "
+                    "using the functional syntax, "
+                    "pass an empty list, e.g. "
+                ) + example + "."
+        elif fields is None:
+            if kwargs:
+                raise TypeError(
+                    "Cannot pass `None` as the 'fields' parameter "
+                    "and also specify fields using keyword arguments"
+                )
+            else:
+                deprecated_thing = "Passing `None` as the 'fields' parameter"
+                example = f"`{typename} = NamedTuple({typename!r}, [])`"
+                deprecation_msg = (
+                    "{name} is deprecated and will be disallowed in Python {remove}. "
+                    "To create a NamedTuple class with 0 fields "
+                    "using the functional syntax, "
+                    "pass an empty list, e.g. "
+                ) + example + "."
+        elif kwargs:
+            raise TypeError("Either list of fields or keywords"
+                            " can be provided to NamedTuple, not both")
+        if fields is _marker or fields is None:
+            warnings.warn(
+                deprecation_msg.format(name=deprecated_thing, remove="3.15"),
+                DeprecationWarning,
+                stacklevel=2,
+            )
+            fields = kwargs.items()
+        nt = _make_nmtuple(typename, fields, module=_caller())
+        nt.__orig_bases__ = (NamedTuple,)
+        return nt
+
+
+if hasattr(collections.abc, "Buffer"):
+    Buffer = collections.abc.Buffer
+else:
+    class Buffer(abc.ABC):  # noqa: B024
+        """Base class for classes that implement the buffer protocol.
+
+        The buffer protocol allows Python objects to expose a low-level
+        memory buffer interface. Before Python 3.12, it is not possible
+        to implement the buffer protocol in pure Python code, or even
+        to check whether a class implements the buffer protocol. In
+        Python 3.12 and higher, the ``__buffer__`` method allows access
+        to the buffer protocol from Python code, and the
+        ``collections.abc.Buffer`` ABC allows checking whether a class
+        implements the buffer protocol.
+
+        To indicate support for the buffer protocol in earlier versions,
+        inherit from this ABC, either in a stub file or at runtime,
+        or use ABC registration. This ABC provides no methods, because
+        there is no Python-accessible methods shared by pre-3.12 buffer
+        classes. It is useful primarily for static checks.
+
+        """
+
+    # As a courtesy, register the most common stdlib buffer classes.
+    Buffer.register(memoryview)
+    Buffer.register(bytearray)
+    Buffer.register(bytes)
+
+
+# Backport of types.get_original_bases, available on 3.12+ in CPython
+if hasattr(_types, "get_original_bases"):
+    get_original_bases = _types.get_original_bases
+else:
+    def get_original_bases(cls, /):
+        """Return the class's "original" bases prior to modification by `__mro_entries__`.
+
+        Examples::
+
+            from typing import TypeVar, Generic
+            from typing_extensions import NamedTuple, TypedDict
+
+            T = TypeVar("T")
+            class Foo(Generic[T]): ...
+            class Bar(Foo[int], float): ...
+            class Baz(list[str]): ...
+            Eggs = NamedTuple("Eggs", [("a", int), ("b", str)])
+            Spam = TypedDict("Spam", {"a": int, "b": str})
+
+            assert get_original_bases(Bar) == (Foo[int], float)
+            assert get_original_bases(Baz) == (list[str],)
+            assert get_original_bases(Eggs) == (NamedTuple,)
+            assert get_original_bases(Spam) == (TypedDict,)
+            assert get_original_bases(int) == (object,)
+        """
+        try:
+            return cls.__dict__.get("__orig_bases__", cls.__bases__)
+        except AttributeError:
+            raise TypeError(
+                f'Expected an instance of type, not {type(cls).__name__!r}'
+            ) from None
+
+
+# NewType is a class on Python 3.10+, making it pickleable
+# The error message for subclassing instances of NewType was improved on 3.11+
+if sys.version_info >= (3, 11):
+    NewType = typing.NewType
+else:
+    class NewType:
+        """NewType creates simple unique types with almost zero
+        runtime overhead. NewType(name, tp) is considered a subtype of tp
+        by static type checkers. At runtime, NewType(name, tp) returns
+        a dummy callable that simply returns its argument. Usage::
+            UserId = NewType('UserId', int)
+            def name_by_id(user_id: UserId) -> str:
+                ...
+            UserId('user')          # Fails type check
+            name_by_id(42)          # Fails type check
+            name_by_id(UserId(42))  # OK
+            num = UserId(5) + 1     # type: int
+        """
+
+        def __call__(self, obj, /):
+            return obj
+
+        def __init__(self, name, tp):
+            self.__qualname__ = name
+            if '.' in name:
+                name = name.rpartition('.')[-1]
+            self.__name__ = name
+            self.__supertype__ = tp
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+
+        def __mro_entries__(self, bases):
+            # We defined __mro_entries__ to get a better error message
+            # if a user attempts to subclass a NewType instance. bpo-46170
+            supercls_name = self.__name__
+
+            class Dummy:
+                def __init_subclass__(cls):
+                    subcls_name = cls.__name__
+                    raise TypeError(
+                        f"Cannot subclass an instance of NewType. "
+                        f"Perhaps you were looking for: "
+                        f"`{subcls_name} = NewType({subcls_name!r}, {supercls_name})`"
+                    )
+
+            return (Dummy,)
+
+        def __repr__(self):
+            return f'{self.__module__}.{self.__qualname__}'
+
+        def __reduce__(self):
+            return self.__qualname__
+
+        if sys.version_info >= (3, 10):
+            # PEP 604 methods
+            # It doesn't make sense to have these methods on Python <3.10
+
+            def __or__(self, other):
+                return typing.Union[self, other]
+
+            def __ror__(self, other):
+                return typing.Union[other, self]
+
+
+if hasattr(typing, "TypeAliasType"):
+    TypeAliasType = typing.TypeAliasType
+else:
+    def _is_unionable(obj):
+        """Corresponds to is_unionable() in unionobject.c in CPython."""
+        return obj is None or isinstance(obj, (
+            type,
+            _types.GenericAlias,
+            _types.UnionType,
+            TypeAliasType,
+        ))
+
+    class TypeAliasType:
+        """Create named, parameterized type aliases.
+
+        This provides a backport of the new `type` statement in Python 3.12:
+
+            type ListOrSet[T] = list[T] | set[T]
+
+        is equivalent to:
+
+            T = TypeVar("T")
+            ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,))
+
+        The name ListOrSet can then be used as an alias for the type it refers to.
+
+        The type_params argument should contain all the type parameters used
+        in the value of the type alias. If the alias is not generic, this
+        argument is omitted.
+
+        Static type checkers should only support type aliases declared using
+        TypeAliasType that follow these rules:
+
+        - The first argument (the name) must be a string literal.
+        - The TypeAliasType instance must be immediately assigned to a variable
+          of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid,
+          as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)').
+
+        """
+
+        def __init__(self, name: str, value, *, type_params=()):
+            if not isinstance(name, str):
+                raise TypeError("TypeAliasType name must be a string")
+            self.__value__ = value
+            self.__type_params__ = type_params
+
+            parameters = []
+            for type_param in type_params:
+                if isinstance(type_param, TypeVarTuple):
+                    parameters.extend(type_param)
+                else:
+                    parameters.append(type_param)
+            self.__parameters__ = tuple(parameters)
+            def_mod = _caller()
+            if def_mod != 'typing_extensions':
+                self.__module__ = def_mod
+            # Setting this attribute closes the TypeAliasType from further modification
+            self.__name__ = name
+
+        def __setattr__(self, name: str, value: object, /) -> None:
+            if hasattr(self, "__name__"):
+                self._raise_attribute_error(name)
+            super().__setattr__(name, value)
+
+        def __delattr__(self, name: str, /) -> Never:
+            self._raise_attribute_error(name)
+
+        def _raise_attribute_error(self, name: str) -> Never:
+            # Match the Python 3.12 error messages exactly
+            if name == "__name__":
+                raise AttributeError("readonly attribute")
+            elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}:
+                raise AttributeError(
+                    f"attribute '{name}' of 'typing.TypeAliasType' objects "
+                    "is not writable"
+                )
+            else:
+                raise AttributeError(
+                    f"'typing.TypeAliasType' object has no attribute '{name}'"
+                )
+
+        def __repr__(self) -> str:
+            return self.__name__
+
+        def __getitem__(self, parameters):
+            if not isinstance(parameters, tuple):
+                parameters = (parameters,)
+            parameters = [
+                typing._type_check(
+                    item, f'Subscripting {self.__name__} requires a type.'
+                )
+                for item in parameters
+            ]
+            return typing._GenericAlias(self, tuple(parameters))
+
+        def __reduce__(self):
+            return self.__name__
+
+        def __init_subclass__(cls, *args, **kwargs):
+            raise TypeError(
+                "type 'typing_extensions.TypeAliasType' is not an acceptable base type"
+            )
+
+        # The presence of this method convinces typing._type_check
+        # that TypeAliasTypes are types.
+        def __call__(self):
+            raise TypeError("Type alias is not callable")
+
+        if sys.version_info >= (3, 10):
+            def __or__(self, right):
+                # For forward compatibility with 3.12, reject Unions
+                # that are not accepted by the built-in Union.
+                if not _is_unionable(right):
+                    return NotImplemented
+                return typing.Union[self, right]
+
+            def __ror__(self, left):
+                if not _is_unionable(left):
+                    return NotImplemented
+                return typing.Union[left, self]
+
+
+if hasattr(typing, "is_protocol"):
+    is_protocol = typing.is_protocol
+    get_protocol_members = typing.get_protocol_members
+else:
+    def is_protocol(tp: type, /) -> bool:
+        """Return True if the given type is a Protocol.
+
+        Example::
+
+            >>> from typing_extensions import Protocol, is_protocol
+            >>> class P(Protocol):
+            ...     def a(self) -> str: ...
+            ...     b: int
+            >>> is_protocol(P)
+            True
+            >>> is_protocol(int)
+            False
+        """
+        return (
+            isinstance(tp, type)
+            and getattr(tp, '_is_protocol', False)
+            and tp is not Protocol
+            and tp is not typing.Protocol
+        )
+
+    def get_protocol_members(tp: type, /) -> typing.FrozenSet[str]:
+        """Return the set of members defined in a Protocol.
+
+        Example::
+
+            >>> from typing_extensions import Protocol, get_protocol_members
+            >>> class P(Protocol):
+            ...     def a(self) -> str: ...
+            ...     b: int
+            >>> get_protocol_members(P)
+            frozenset({'a', 'b'})
+
+        Raise a TypeError for arguments that are not Protocols.
+        """
+        if not is_protocol(tp):
+            raise TypeError(f'{tp!r} is not a Protocol')
+        if hasattr(tp, '__protocol_attrs__'):
+            return frozenset(tp.__protocol_attrs__)
+        return frozenset(_get_protocol_attrs(tp))
+
+
+if hasattr(typing, "Doc"):
+    Doc = typing.Doc
+else:
+    class Doc:
+        """Define the documentation of a type annotation using ``Annotated``, to be
+         used in class attributes, function and method parameters, return values,
+         and variables.
+
+        The value should be a positional-only string literal to allow static tools
+        like editors and documentation generators to use it.
+
+        This complements docstrings.
+
+        The string value passed is available in the attribute ``documentation``.
+
+        Example::
+
+            >>> from typing_extensions import Annotated, Doc
+            >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ...
+        """
+        def __init__(self, documentation: str, /) -> None:
+            self.documentation = documentation
+
+        def __repr__(self) -> str:
+            return f"Doc({self.documentation!r})"
+
+        def __hash__(self) -> int:
+            return hash(self.documentation)
+
+        def __eq__(self, other: object) -> bool:
+            if not isinstance(other, Doc):
+                return NotImplemented
+            return self.documentation == other.documentation
+
+
+_CapsuleType = getattr(_types, "CapsuleType", None)
+
+if _CapsuleType is None:
+    try:
+        import _socket
+    except ImportError:
+        pass
+    else:
+        _CAPI = getattr(_socket, "CAPI", None)
+        if _CAPI is not None:
+            _CapsuleType = type(_CAPI)
+
+if _CapsuleType is not None:
+    CapsuleType = _CapsuleType
+    __all__.append("CapsuleType")
+
+
+# Aliases for items that have always been in typing.
+# Explicitly assign these (rather than using `from typing import *` at the top),
+# so that we get a CI error if one of these is deleted from typing.py
+# in a future version of Python
+AbstractSet = typing.AbstractSet
+AnyStr = typing.AnyStr
+BinaryIO = typing.BinaryIO
+Callable = typing.Callable
+Collection = typing.Collection
+Container = typing.Container
+Dict = typing.Dict
+ForwardRef = typing.ForwardRef
+FrozenSet = typing.FrozenSet
+Generic = typing.Generic
+Hashable = typing.Hashable
+IO = typing.IO
+ItemsView = typing.ItemsView
+Iterable = typing.Iterable
+Iterator = typing.Iterator
+KeysView = typing.KeysView
+List = typing.List
+Mapping = typing.Mapping
+MappingView = typing.MappingView
+Match = typing.Match
+MutableMapping = typing.MutableMapping
+MutableSequence = typing.MutableSequence
+MutableSet = typing.MutableSet
+Optional = typing.Optional
+Pattern = typing.Pattern
+Reversible = typing.Reversible
+Sequence = typing.Sequence
+Set = typing.Set
+Sized = typing.Sized
+TextIO = typing.TextIO
+Tuple = typing.Tuple
+Union = typing.Union
+ValuesView = typing.ValuesView
+cast = typing.cast
+no_type_check = typing.no_type_check
+no_type_check_decorator = typing.no_type_check_decorator
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER b/pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE b/pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE
new file mode 100644
index 0000000000..1bb5a44356
--- /dev/null
+++ b/pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE
@@ -0,0 +1,17 @@
+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/pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA b/pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA
new file mode 100644
index 0000000000..1399281717
--- /dev/null
+++ b/pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA
@@ -0,0 +1,102 @@
+Metadata-Version: 2.1
+Name: zipp
+Version: 3.19.2
+Summary: Backport of pathlib-compatible object wrapper for zip files
+Author-email: "Jason R. Coombs" 
+Project-URL: Homepage, https://github.com/jaraco/zipp
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: jaraco.itertools ; extra == 'test'
+Requires-Dist: jaraco.functools ; extra == 'test'
+Requires-Dist: more-itertools ; extra == 'test'
+Requires-Dist: big-O ; extra == 'test'
+Requires-Dist: pytest-ignore-flaky ; extra == 'test'
+Requires-Dist: jaraco.test ; extra == 'test'
+Requires-Dist: importlib-resources ; (python_version < "3.9") and extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/zipp.svg
+   :target: https://pypi.org/project/zipp
+
+.. image:: https://img.shields.io/pypi/pyversions/zipp.svg
+
+.. image:: https://github.com/jaraco/zipp/actions/workflows/main.yml/badge.svg
+   :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22tests%22
+   :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+    :target: https://github.com/astral-sh/ruff
+    :alt: Ruff
+
+.. .. image:: https://readthedocs.org/projects/PROJECT_RTD/badge/?version=latest
+..    :target: https://PROJECT_RTD.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+   :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/zipp
+   :target: https://tidelift.com/subscription/pkg/pypi-zipp?utm_source=pypi-zipp&utm_medium=readme
+
+
+A pathlib-compatible Zipfile object wrapper. Official backport of the standard library
+`Path object `_.
+
+
+Compatibility
+=============
+
+New features are introduced in this third-party library and later merged
+into CPython. The following table indicates which versions of this library
+were contributed to different versions in the standard library:
+
+.. list-table::
+   :header-rows: 1
+
+   * - zipp
+     - stdlib
+   * - 3.18
+     - 3.13
+   * - 3.16
+     - 3.12
+   * - 3.5
+     - 3.11
+   * - 3.2
+     - 3.10
+   * - 3.3 ??
+     - 3.9
+   * - 1.0
+     - 3.8
+
+
+Usage
+=====
+
+Use ``zipp.Path`` in place of ``zipfile.Path`` on any Python.
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD b/pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD
new file mode 100644
index 0000000000..77c02835d8
--- /dev/null
+++ b/pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD
@@ -0,0 +1,15 @@
+zipp-3.19.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+zipp-3.19.2.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+zipp-3.19.2.dist-info/METADATA,sha256=UIrk_kMIHGSwsKKChYizqMw0MMZpPRZ2ZiVpQAsN_bE,3575
+zipp-3.19.2.dist-info/RECORD,,
+zipp-3.19.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+zipp-3.19.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+zipp-3.19.2.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5
+zipp/__init__.py,sha256=QuI1g00G4fRAcGt-HqbV0oWIkmSgedCGGYsHHYzNa8A,13412
+zipp/__pycache__/__init__.cpython-312.pyc,,
+zipp/__pycache__/glob.cpython-312.pyc,,
+zipp/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+zipp/compat/__pycache__/__init__.cpython-312.pyc,,
+zipp/compat/__pycache__/py310.cpython-312.pyc,,
+zipp/compat/py310.py,sha256=eZpkW0zRtunkhEh8jjX3gCGe22emoKCBJw72Zt4RkhA,219
+zipp/glob.py,sha256=etWpnfEoRyfUvrUsi6sTiGmErvPwe6HzY6pT8jg_lUI,3082
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/REQUESTED b/pkg_resources/_vendor/zipp-3.19.2.dist-info/REQUESTED
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL b/pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL
new file mode 100644
index 0000000000..bab98d6758
--- /dev/null
+++ b/pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/pkg_resources/_vendor/zipp-3.7.0.dist-info/top_level.txt b/pkg_resources/_vendor/zipp-3.19.2.dist-info/top_level.txt
similarity index 100%
rename from pkg_resources/_vendor/zipp-3.7.0.dist-info/top_level.txt
rename to pkg_resources/_vendor/zipp-3.19.2.dist-info/top_level.txt
diff --git a/pkg_resources/_vendor/zipp-3.7.0.dist-info/METADATA b/pkg_resources/_vendor/zipp-3.7.0.dist-info/METADATA
deleted file mode 100644
index b1308b5f6e..0000000000
--- a/pkg_resources/_vendor/zipp-3.7.0.dist-info/METADATA
+++ /dev/null
@@ -1,58 +0,0 @@
-Metadata-Version: 2.1
-Name: zipp
-Version: 3.7.0
-Summary: Backport of pathlib-compatible object wrapper for zip files
-Home-page: https://github.com/jaraco/zipp
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
-License: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.7
-License-File: LICENSE
-Provides-Extra: docs
-Requires-Dist: sphinx ; extra == 'docs'
-Requires-Dist: jaraco.packaging (>=8.2) ; extra == 'docs'
-Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest (>=6) ; extra == 'testing'
-Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
-Requires-Dist: pytest-flake8 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler (>=1.0.1) ; extra == 'testing'
-Requires-Dist: jaraco.itertools ; extra == 'testing'
-Requires-Dist: func-timeout ; extra == 'testing'
-Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
-Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/zipp.svg
-   :target: `PyPI link`_
-
-.. image:: https://img.shields.io/pypi/pyversions/zipp.svg
-   :target: `PyPI link`_
-
-.. _PyPI link: https://pypi.org/project/zipp
-
-.. image:: https://github.com/jaraco/zipp/workflows/tests/badge.svg
-   :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
-   :target: https://github.com/psf/black
-   :alt: Code style: Black
-
-.. .. image:: https://readthedocs.org/projects/skeleton/badge/?version=latest
-..    :target: https://skeleton.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2021-informational
-   :target: https://blog.jaraco.com/skeleton
-
-
-A pathlib-compatible Zipfile object wrapper. Official backport of the standard library
-`Path object `_.
-
-
diff --git a/pkg_resources/_vendor/zipp-3.7.0.dist-info/RECORD b/pkg_resources/_vendor/zipp-3.7.0.dist-info/RECORD
deleted file mode 100644
index adc797bc2e..0000000000
--- a/pkg_resources/_vendor/zipp-3.7.0.dist-info/RECORD
+++ /dev/null
@@ -1,9 +0,0 @@
-__pycache__/zipp.cpython-312.pyc,,
-zipp-3.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-zipp-3.7.0.dist-info/LICENSE,sha256=2z8CRrH5J48VhFuZ_sR4uLUG63ZIeZNyL4xuJUKF-vg,1050
-zipp-3.7.0.dist-info/METADATA,sha256=ZLzgaXTyZX_MxTU0lcGfhdPY4CjFrT_3vyQ2Fo49pl8,2261
-zipp-3.7.0.dist-info/RECORD,,
-zipp-3.7.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-zipp-3.7.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
-zipp-3.7.0.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5
-zipp.py,sha256=ajztOH-9I7KA_4wqDYygtHa6xUBVZgFpmZ8FE74HHHI,8425
diff --git a/pkg_resources/_vendor/zipp.py b/pkg_resources/_vendor/zipp/__init__.py
similarity index 52%
rename from pkg_resources/_vendor/zipp.py
rename to pkg_resources/_vendor/zipp/__init__.py
index 26b723c1fd..d65297b835 100644
--- a/pkg_resources/_vendor/zipp.py
+++ b/pkg_resources/_vendor/zipp/__init__.py
@@ -3,13 +3,13 @@
 import zipfile
 import itertools
 import contextlib
-import sys
 import pathlib
+import re
+import stat
+import sys
 
-if sys.version_info < (3, 7):
-    from collections import OrderedDict
-else:
-    OrderedDict = dict
+from .compat.py310 import text_encoding
+from .glob import Translator
 
 
 __all__ = ['Path']
@@ -56,7 +56,7 @@ def _ancestry(path):
         path, tail = posixpath.split(path)
 
 
-_dedupe = OrderedDict.fromkeys
+_dedupe = dict.fromkeys
 """Deduplicate an iterable in original order"""
 
 
@@ -68,10 +68,95 @@ def _difference(minuend, subtrahend):
     return itertools.filterfalse(set(subtrahend).__contains__, minuend)
 
 
-class CompleteDirs(zipfile.ZipFile):
+class InitializedState:
+    """
+    Mix-in to save the initialization state for pickling.
+    """
+
+    def __init__(self, *args, **kwargs):
+        self.__args = args
+        self.__kwargs = kwargs
+        super().__init__(*args, **kwargs)
+
+    def __getstate__(self):
+        return self.__args, self.__kwargs
+
+    def __setstate__(self, state):
+        args, kwargs = state
+        super().__init__(*args, **kwargs)
+
+
+class SanitizedNames:
+    """
+    ZipFile mix-in to ensure names are sanitized.
+    """
+
+    def namelist(self):
+        return list(map(self._sanitize, super().namelist()))
+
+    @staticmethod
+    def _sanitize(name):
+        r"""
+        Ensure a relative path with posix separators and no dot names.
+
+        Modeled after
+        https://github.com/python/cpython/blob/bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c/Lib/zipfile/__init__.py#L1799-L1813
+        but provides consistent cross-platform behavior.
+
+        >>> san = SanitizedNames._sanitize
+        >>> san('/foo/bar')
+        'foo/bar'
+        >>> san('//foo.txt')
+        'foo.txt'
+        >>> san('foo/.././bar.txt')
+        'foo/bar.txt'
+        >>> san('foo../.bar.txt')
+        'foo../.bar.txt'
+        >>> san('\\foo\\bar.txt')
+        'foo/bar.txt'
+        >>> san('D:\\foo.txt')
+        'D/foo.txt'
+        >>> san('\\\\server\\share\\file.txt')
+        'server/share/file.txt'
+        >>> san('\\\\?\\GLOBALROOT\\Volume3')
+        '?/GLOBALROOT/Volume3'
+        >>> san('\\\\.\\PhysicalDrive1\\root')
+        'PhysicalDrive1/root'
+
+        Retain any trailing slash.
+        >>> san('abc/')
+        'abc/'
+
+        Raises a ValueError if the result is empty.
+        >>> san('../..')
+        Traceback (most recent call last):
+        ...
+        ValueError: Empty filename
+        """
+
+        def allowed(part):
+            return part and part not in {'..', '.'}
+
+        # Remove the drive letter.
+        # Don't use ntpath.splitdrive, because that also strips UNC paths
+        bare = re.sub('^([A-Z]):', r'\1', name, flags=re.IGNORECASE)
+        clean = bare.replace('\\', '/')
+        parts = clean.split('/')
+        joined = '/'.join(filter(allowed, parts))
+        if not joined:
+            raise ValueError("Empty filename")
+        return joined + '/' * name.endswith('/')
+
+
+class CompleteDirs(InitializedState, SanitizedNames, zipfile.ZipFile):
     """
     A ZipFile subclass that ensures that implied directories
     are always included in the namelist.
+
+    >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt']))
+    ['foo/', 'foo/bar/']
+    >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt', 'foo/bar/']))
+    ['foo/']
     """
 
     @staticmethod
@@ -81,7 +166,7 @@ def _implied_dirs(names):
         return _dedupe(_difference(as_dirs, names))
 
     def namelist(self):
-        names = super(CompleteDirs, self).namelist()
+        names = super().namelist()
         return names + list(self._implied_dirs(names))
 
     def _name_set(self):
@@ -97,6 +182,17 @@ def resolve_dir(self, name):
         dir_match = name not in names and dirname in names
         return dirname if dir_match else name
 
+    def getinfo(self, name):
+        """
+        Supplement getinfo for implied dirs.
+        """
+        try:
+            return super().getinfo(name)
+        except KeyError:
+            if not name.endswith('/') or name not in self._name_set():
+                raise
+            return zipfile.ZipInfo(filename=name)
+
     @classmethod
     def make(cls, source):
         """
@@ -107,7 +203,7 @@ def make(cls, source):
             return source
 
         if not isinstance(source, zipfile.ZipFile):
-            return cls(_pathlib_compat(source))
+            return cls(source)
 
         # Only allow for FastLookup when supplied zipfile is read-only
         if 'r' not in source.mode:
@@ -116,6 +212,16 @@ def make(cls, source):
         source.__class__ = cls
         return source
 
+    @classmethod
+    def inject(cls, zf: zipfile.ZipFile) -> zipfile.ZipFile:
+        """
+        Given a writable zip file zf, inject directory entries for
+        any directories implied by the presence of children.
+        """
+        for name in cls._implied_dirs(zf.namelist()):
+            zf.writestr(name, b"")
+        return zf
+
 
 class FastLookup(CompleteDirs):
     """
@@ -126,30 +232,29 @@ class FastLookup(CompleteDirs):
     def namelist(self):
         with contextlib.suppress(AttributeError):
             return self.__names
-        self.__names = super(FastLookup, self).namelist()
+        self.__names = super().namelist()
         return self.__names
 
     def _name_set(self):
         with contextlib.suppress(AttributeError):
             return self.__lookup
-        self.__lookup = super(FastLookup, self)._name_set()
+        self.__lookup = super()._name_set()
         return self.__lookup
 
 
-def _pathlib_compat(path):
-    """
-    For path-like objects, convert to a filename for compatibility
-    on Python 3.6.1 and earlier.
-    """
-    try:
-        return path.__fspath__()
-    except AttributeError:
-        return str(path)
+def _extract_text_encoding(encoding=None, *args, **kwargs):
+    # compute stack level so that the caller of the caller sees any warning.
+    is_pypy = sys.implementation.name == 'pypy'
+    stack_level = 3 + is_pypy
+    return text_encoding(encoding, stack_level), args, kwargs
 
 
 class Path:
     """
-    A pathlib-compatible interface for zip files.
+    A :class:`importlib.resources.abc.Traversable` interface for zip files.
+
+    Implements many of the features users enjoy from
+    :class:`pathlib.Path`.
 
     Consider a zip file with this structure::
 
@@ -169,13 +274,13 @@ class Path:
 
     Path accepts the zipfile object itself or a filename
 
-    >>> root = Path(zf)
+    >>> path = Path(zf)
 
     From there, several path operations are available.
 
     Directory iteration (including the zip file itself):
 
-    >>> a, b = root.iterdir()
+    >>> a, b = path.iterdir()
     >>> a
     Path('mem/abcde.zip', 'a.txt')
     >>> b
@@ -196,7 +301,7 @@ class Path:
 
     Read text:
 
-    >>> c.read_text()
+    >>> c.read_text(encoding='utf-8')
     'content of c'
 
     existence:
@@ -213,16 +318,38 @@ class Path:
     'mem/abcde.zip/b/c.txt'
 
     At the root, ``name``, ``filename``, and ``parent``
-    resolve to the zipfile. Note these attributes are not
-    valid and will raise a ``ValueError`` if the zipfile
-    has no filename.
+    resolve to the zipfile.
 
-    >>> root.name
+    >>> str(path)
+    'mem/abcde.zip/'
+    >>> path.name
     'abcde.zip'
-    >>> str(root.filename).replace(os.sep, posixpath.sep)
-    'mem/abcde.zip'
-    >>> str(root.parent)
+    >>> path.filename == pathlib.Path('mem/abcde.zip')
+    True
+    >>> str(path.parent)
     'mem'
+
+    If the zipfile has no filename, such attributes are not
+    valid and accessing them will raise an Exception.
+
+    >>> zf.filename = None
+    >>> path.name
+    Traceback (most recent call last):
+    ...
+    TypeError: ...
+
+    >>> path.filename
+    Traceback (most recent call last):
+    ...
+    TypeError: ...
+
+    >>> path.parent
+    Traceback (most recent call last):
+    ...
+    TypeError: ...
+
+    # workaround python/cpython#106763
+    >>> pass
     """
 
     __repr = "{self.__class__.__name__}({self.root.filename!r}, {self.at!r})"
@@ -240,6 +367,18 @@ def __init__(self, root, at=""):
         self.root = FastLookup.make(root)
         self.at = at
 
+    def __eq__(self, other):
+        """
+        >>> Path(zipfile.ZipFile(io.BytesIO(), 'w')) == 'foo'
+        False
+        """
+        if self.__class__ is not other.__class__:
+            return NotImplemented
+        return (self.root, self.at) == (other.root, other.at)
+
+    def __hash__(self):
+        return hash((self.root, self.at))
+
     def open(self, mode='r', *args, pwd=None, **kwargs):
         """
         Open this entry as text or binary following the semantics
@@ -256,30 +395,36 @@ def open(self, mode='r', *args, pwd=None, **kwargs):
             if args or kwargs:
                 raise ValueError("encoding args invalid for binary operation")
             return stream
-        return io.TextIOWrapper(stream, *args, **kwargs)
+        # Text mode:
+        encoding, args, kwargs = _extract_text_encoding(*args, **kwargs)
+        return io.TextIOWrapper(stream, encoding, *args, **kwargs)
+
+    def _base(self):
+        return pathlib.PurePosixPath(self.at or self.root.filename)
 
     @property
     def name(self):
-        return pathlib.Path(self.at).name or self.filename.name
+        return self._base().name
 
     @property
     def suffix(self):
-        return pathlib.Path(self.at).suffix or self.filename.suffix
+        return self._base().suffix
 
     @property
     def suffixes(self):
-        return pathlib.Path(self.at).suffixes or self.filename.suffixes
+        return self._base().suffixes
 
     @property
     def stem(self):
-        return pathlib.Path(self.at).stem or self.filename.stem
+        return self._base().stem
 
     @property
     def filename(self):
         return pathlib.Path(self.root.filename).joinpath(self.at)
 
     def read_text(self, *args, **kwargs):
-        with self.open('r', *args, **kwargs) as strm:
+        encoding, args, kwargs = _extract_text_encoding(*args, **kwargs)
+        with self.open('r', encoding, *args, **kwargs) as strm:
             return strm.read()
 
     def read_bytes(self):
@@ -307,6 +452,33 @@ def iterdir(self):
         subs = map(self._next, self.root.namelist())
         return filter(self._is_child, subs)
 
+    def match(self, path_pattern):
+        return pathlib.PurePosixPath(self.at).match(path_pattern)
+
+    def is_symlink(self):
+        """
+        Return whether this path is a symlink.
+        """
+        info = self.root.getinfo(self.at)
+        mode = info.external_attr >> 16
+        return stat.S_ISLNK(mode)
+
+    def glob(self, pattern):
+        if not pattern:
+            raise ValueError(f"Unacceptable pattern: {pattern!r}")
+
+        prefix = re.escape(self.at)
+        tr = Translator(seps='/')
+        matches = re.compile(prefix + tr.translate(pattern)).fullmatch
+        names = (data.filename for data in self.root.filelist)
+        return map(self._next, filter(matches, names))
+
+    def rglob(self, pattern):
+        return self.glob(f'**/{pattern}')
+
+    def relative_to(self, other, *extra):
+        return posixpath.relpath(str(self), str(other.joinpath(*extra)))
+
     def __str__(self):
         return posixpath.join(self.root.filename, self.at)
 
@@ -314,7 +486,7 @@ def __repr__(self):
         return self.__repr.format(self=self)
 
     def joinpath(self, *other):
-        next = posixpath.join(self.at, *map(_pathlib_compat, other))
+        next = posixpath.join(self.at, *other)
         return self._next(self.root.resolve_dir(next))
 
     __truediv__ = joinpath
diff --git a/pkg_resources/_vendor/zipp/compat/__init__.py b/pkg_resources/_vendor/zipp/compat/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/pkg_resources/_vendor/zipp/compat/py310.py b/pkg_resources/_vendor/zipp/compat/py310.py
new file mode 100644
index 0000000000..d5ca53e037
--- /dev/null
+++ b/pkg_resources/_vendor/zipp/compat/py310.py
@@ -0,0 +1,11 @@
+import sys
+import io
+
+
+def _text_encoding(encoding, stacklevel=2, /):  # pragma: no cover
+    return encoding
+
+
+text_encoding = (
+    io.text_encoding if sys.version_info > (3, 10) else _text_encoding  # type: ignore
+)
diff --git a/pkg_resources/_vendor/zipp/glob.py b/pkg_resources/_vendor/zipp/glob.py
new file mode 100644
index 0000000000..69c41d77c3
--- /dev/null
+++ b/pkg_resources/_vendor/zipp/glob.py
@@ -0,0 +1,106 @@
+import os
+import re
+
+
+_default_seps = os.sep + str(os.altsep) * bool(os.altsep)
+
+
+class Translator:
+    """
+    >>> Translator('xyz')
+    Traceback (most recent call last):
+    ...
+    AssertionError: Invalid separators
+
+    >>> Translator('')
+    Traceback (most recent call last):
+    ...
+    AssertionError: Invalid separators
+    """
+
+    seps: str
+
+    def __init__(self, seps: str = _default_seps):
+        assert seps and set(seps) <= set(_default_seps), "Invalid separators"
+        self.seps = seps
+
+    def translate(self, pattern):
+        """
+        Given a glob pattern, produce a regex that matches it.
+        """
+        return self.extend(self.translate_core(pattern))
+
+    def extend(self, pattern):
+        r"""
+        Extend regex for pattern-wide concerns.
+
+        Apply '(?s:)' to create a non-matching group that
+        matches newlines (valid on Unix).
+
+        Append '\Z' to imply fullmatch even when match is used.
+        """
+        return rf'(?s:{pattern})\Z'
+
+    def translate_core(self, pattern):
+        r"""
+        Given a glob pattern, produce a regex that matches it.
+
+        >>> t = Translator()
+        >>> t.translate_core('*.txt').replace('\\\\', '')
+        '[^/]*\\.txt'
+        >>> t.translate_core('a?txt')
+        'a[^/]txt'
+        >>> t.translate_core('**/*').replace('\\\\', '')
+        '.*/[^/][^/]*'
+        """
+        self.restrict_rglob(pattern)
+        return ''.join(map(self.replace, separate(self.star_not_empty(pattern))))
+
+    def replace(self, match):
+        """
+        Perform the replacements for a match from :func:`separate`.
+        """
+        return match.group('set') or (
+            re.escape(match.group(0))
+            .replace('\\*\\*', r'.*')
+            .replace('\\*', rf'[^{re.escape(self.seps)}]*')
+            .replace('\\?', r'[^/]')
+        )
+
+    def restrict_rglob(self, pattern):
+        """
+        Raise ValueError if ** appears in anything but a full path segment.
+
+        >>> Translator().translate('**foo')
+        Traceback (most recent call last):
+        ...
+        ValueError: ** must appear alone in a path segment
+        """
+        seps_pattern = rf'[{re.escape(self.seps)}]+'
+        segments = re.split(seps_pattern, pattern)
+        if any('**' in segment and segment != '**' for segment in segments):
+            raise ValueError("** must appear alone in a path segment")
+
+    def star_not_empty(self, pattern):
+        """
+        Ensure that * will not match an empty segment.
+        """
+
+        def handle_segment(match):
+            segment = match.group(0)
+            return '?*' if segment == '*' else segment
+
+        not_seps_pattern = rf'[^{re.escape(self.seps)}]+'
+        return re.sub(not_seps_pattern, handle_segment, pattern)
+
+
+def separate(pattern):
+    """
+    Separate out character sets to avoid translating their contents.
+
+    >>> [m.group(0) for m in separate('*.txt')]
+    ['*.txt']
+    >>> [m.group(0) for m in separate('a[?]txt')]
+    ['a', '[?]', 'txt']
+    """
+    return re.finditer(r'([^\[]+)|(?P[\[].*?[\]])|([\[][^\]]*$)', pattern)

From 51615db65917c4c4d6946ca870a38bbc8693b270 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 21:11:25 -0400
Subject: [PATCH 121/151] Remove obsolete 'rewrite' functionality from vendored
 script.

---
 tools/vendored.py | 172 +---------------------------------------------
 1 file changed, 1 insertion(+), 171 deletions(-)

diff --git a/tools/vendored.py b/tools/vendored.py
index 208aab8eb1..a2ee6fd054 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -1,8 +1,5 @@
-import re
-import shutil
 import sys
 import subprocess
-from textwrap import dedent
 
 from jaraco.packaging import metadata
 from path import Path
@@ -18,182 +15,15 @@ def update_vendored():
     update_setuptools()
 
 
-def rewrite_packaging(pkg_files, new_root):
-    """
-    Rewrite imports in packaging to redirect to vendored copies.
-    """
-    for file in pkg_files.glob('*.py'):
-        text = file.text()
-        text = re.sub(r' (pyparsing)', rf' {new_root}.\1', text)
-        text = text.replace(
-            'from six.moves.urllib import parse',
-            'from urllib import parse',
-        )
-        file.write_text(text)
-
-
-def rewrite_jaraco_text(pkg_files, new_root):
-    """
-    Rewrite imports in jaraco.text to redirect to vendored copies.
-    """
-    for file in pkg_files.glob('*.py'):
-        text = file.read_text()
-        text = re.sub(r' (jaraco\.)', rf' {new_root}.\1', text)
-        text = re.sub(r' (importlib_resources)', rf' {new_root}.\1', text)
-        # suppress loading of lorem_ipsum; ref #3072
-        text = re.sub(r'^lorem_ipsum.*\n$', '', text, flags=re.M)
-        file.write_text(text)
-
-
-def repair_namespace(pkg_files):
-    # required for zip-packaged setuptools #3084
-    pkg_files.joinpath('__init__.py').write_text('')
-
-
-def rewrite_jaraco_functools(pkg_files, new_root):
-    """
-    Rewrite imports in jaraco.functools to redirect to vendored copies.
-    """
-    for file in pkg_files.glob('*.py'):
-        text = file.read_text()
-        text = re.sub(r' (more_itertools)', rf' {new_root}.\1', text)
-        file.write_text(text)
-
-
-def rewrite_jaraco_context(pkg_files, new_root):
-    """
-    Rewrite imports in jaraco.context to redirect to vendored copies.
-    """
-    for file in pkg_files.glob('context.py'):
-        text = file.read_text()
-        text = re.sub(r' (backports)', rf' {new_root}.\1', text)
-        file.write_text(text)
-
-
-def rewrite_importlib_resources(pkg_files, new_root):
-    """
-    Rewrite imports in importlib_resources to redirect to vendored copies.
-    """
-    for file in pkg_files.glob('*.py'):
-        text = file.read_text().replace('importlib_resources.abc', '.abc')
-        text = text.replace('zipp', '..zipp')
-        file.write_text(text)
-
-
-def rewrite_importlib_metadata(pkg_files, new_root):
-    """
-    Rewrite imports in importlib_metadata to redirect to vendored copies.
-    """
-    for file in pkg_files.glob('*.py'):
-        text = file.read_text()
-        text = text.replace('import zipp', 'from .. import zipp')
-        file.write_text(text)
-
-
-def rewrite_more_itertools(pkg_files: Path):
-    """
-    Defer import of concurrent.futures. Workaround for #3090.
-    """
-    more_file = pkg_files.joinpath('more.py')
-    text = more_file.read_text()
-    text = re.sub(r'^.*concurrent.futures.*?\n', '', text, flags=re.MULTILINE)
-    text = re.sub(
-        'ThreadPoolExecutor',
-        '__import__("concurrent.futures").futures.ThreadPoolExecutor',
-        text,
-    )
-    more_file.write_text(text)
-
-
-def rewrite_wheel(pkg_files: Path):
-    """
-    Remove parts of wheel not needed by bdist_wheel, and rewrite imports to use
-    setuptools's own code or vendored dependencies.
-    """
-    shutil.rmtree(pkg_files / 'cli')
-    shutil.rmtree(pkg_files / 'vendored')
-    pkg_files.joinpath('_setuptools_logging.py').unlink()
-    pkg_files.joinpath('__main__.py').unlink()
-    pkg_files.joinpath('bdist_wheel.py').unlink()
-
-    # Rewrite vendored imports to use setuptools's own vendored libraries
-    for path in pkg_files.iterdir():
-        if path.suffix == '.py':  # type: ignore[attr-defined]
-            code = path.read_text()
-            if path.name == 'wheelfile.py':
-                code = re.sub(
-                    r"^from wheel.util import ",
-                    r"from .util import ",
-                    code,
-                    flags=re.MULTILINE,
-                )
-
-                # No need to keep the wheel.cli package just for this trivial exception
-                code = re.sub(
-                    r"^from wheel.cli import WheelError\n",
-                    r"",
-                    code,
-                    flags=re.MULTILINE,
-                )
-                code += dedent(
-                    """
-
-                    class WheelError(Exception):
-                        pass
-                    """
-                )
-            else:
-                code = re.sub(
-                    r"^from \.vendored\.([\w.]+) import ",
-                    r"from ..\1 import ",
-                    code,
-                    flags=re.MULTILINE,
-                )
-                code = re.sub(
-                    r"^from \.util import log$",
-                    r"from distutils import log$",
-                    code,
-                    flags=re.MULTILINE,
-                )
-
-            path.write_text(code)  # type: ignore[attr-defined]
-
-
-def rewrite_platformdirs(pkg_files: Path):
-    """
-    Replace some absolute imports with relative ones.
-    """
-    init = pkg_files.joinpath('__init__.py')
-    text = init.read_text()
-    text = text.replace('from platformdirs.', 'from .')
-    init.write_text(text)
-
-
 def clean(vendor):
     """
     Remove all files out of the vendor directory except the meta
     data (as pip uninstall doesn't support -t).
     """
-    ignored = ['vendored.txt', 'ruff.toml']
+    ignored = ['ruff.toml']
     remove_all(path for path in vendor.glob('*') if path.basename() not in ignored)
 
 
-def install(vendor):
-    clean(vendor)
-    install_args = [
-        sys.executable,
-        '-m',
-        'pip',
-        'install',
-        '-r',
-        str(vendor / 'vendored.txt'),
-        '-t',
-        str(vendor),
-    ]
-    subprocess.check_call(install_args)
-    (vendor / '__init__.py').write_text('')
-
-
 def update_pkg_resources():
     deps = [
         'packaging >= 24',

From b4b6bf755eeeb11deb3783dce8582472a1819850 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 21:18:44 -0400
Subject: [PATCH 122/151] Update auto-detect the minimum python version needed
 for vendored packages.

---
 tools/vendored.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/vendored.py b/tools/vendored.py
index a2ee6fd054..22b18e50a4 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -1,7 +1,8 @@
+import functools
 import sys
 import subprocess
 
-from jaraco.packaging import metadata
+import jaraco.packaging.metadata
 from path import Path
 
 
@@ -41,11 +42,20 @@ def update_pkg_resources():
     install_deps(deps, vendor)
 
 
+@functools.cache
+def metadata():
+    return jaraco.packaging.metadata.load('.')
+
+
 def load_deps():
     """
     Read the dependencies from `.`.
     """
-    return metadata.load('.').get_all('Requires-Dist')
+    return metadata().get_all('Requires-Dist')
+
+
+def min_python():
+    return metadata()['Requires-Python'].removeprefix('>=').strip()
 
 
 def install_deps(deps, vendor):
@@ -65,7 +75,7 @@ def install_deps(deps, vendor):
         '--target',
         str(vendor),
         '--python-version',
-        '3.8',
+        min_python(),
         '--only-binary',
         ':all:',
     ] + list(deps)

From 4f6d97344c9e15c643aa3e366b21377a2008bc11 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:20:10 -0400
Subject: [PATCH 123/151] Refresh vendored dependencies.

---
 .../platformdirs-4.2.2.dist-info/INSTALLER    |   1 +
 .../platformdirs-4.2.2.dist-info/METADATA     | 319 +++++++++
 .../platformdirs-4.2.2.dist-info/RECORD       |  23 +
 .../platformdirs-4.2.2.dist-info/REQUESTED    |   0
 .../platformdirs-4.2.2.dist-info/WHEEL        |   4 +
 .../licenses/LICENSE                          |  21 +
 setuptools/_vendor/platformdirs/__init__.py   | 627 ++++++++++++++++++
 setuptools/_vendor/platformdirs/__main__.py   |  55 ++
 setuptools/_vendor/platformdirs/android.py    | 249 +++++++
 setuptools/_vendor/platformdirs/api.py        | 292 ++++++++
 setuptools/_vendor/platformdirs/macos.py      | 130 ++++
 setuptools/_vendor/platformdirs/py.typed      |   0
 setuptools/_vendor/platformdirs/unix.py       | 275 ++++++++
 setuptools/_vendor/platformdirs/version.py    |  16 +
 setuptools/_vendor/platformdirs/windows.py    | 272 ++++++++
 15 files changed, 2284 insertions(+)
 create mode 100644 setuptools/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
 create mode 100644 setuptools/_vendor/platformdirs-4.2.2.dist-info/METADATA
 create mode 100644 setuptools/_vendor/platformdirs-4.2.2.dist-info/RECORD
 create mode 100644 setuptools/_vendor/platformdirs-4.2.2.dist-info/REQUESTED
 create mode 100644 setuptools/_vendor/platformdirs-4.2.2.dist-info/WHEEL
 create mode 100644 setuptools/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
 create mode 100644 setuptools/_vendor/platformdirs/__init__.py
 create mode 100644 setuptools/_vendor/platformdirs/__main__.py
 create mode 100644 setuptools/_vendor/platformdirs/android.py
 create mode 100644 setuptools/_vendor/platformdirs/api.py
 create mode 100644 setuptools/_vendor/platformdirs/macos.py
 create mode 100644 setuptools/_vendor/platformdirs/py.typed
 create mode 100644 setuptools/_vendor/platformdirs/unix.py
 create mode 100644 setuptools/_vendor/platformdirs/version.py
 create mode 100644 setuptools/_vendor/platformdirs/windows.py

diff --git a/setuptools/_vendor/platformdirs-4.2.2.dist-info/INSTALLER b/setuptools/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
new file mode 100644
index 0000000000..a1b589e38a
--- /dev/null
+++ b/setuptools/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/setuptools/_vendor/platformdirs-4.2.2.dist-info/METADATA b/setuptools/_vendor/platformdirs-4.2.2.dist-info/METADATA
new file mode 100644
index 0000000000..ab51ef36ad
--- /dev/null
+++ b/setuptools/_vendor/platformdirs-4.2.2.dist-info/METADATA
@@ -0,0 +1,319 @@
+Metadata-Version: 2.3
+Name: platformdirs
+Version: 4.2.2
+Summary: A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`.
+Project-URL: Documentation, https://platformdirs.readthedocs.io
+Project-URL: Homepage, https://github.com/platformdirs/platformdirs
+Project-URL: Source, https://github.com/platformdirs/platformdirs
+Project-URL: Tracker, https://github.com/platformdirs/platformdirs/issues
+Maintainer-email: Bernát Gábor , Julian Berman , Ofek Lev , Ronny Pfannschmidt 
+License-Expression: MIT
+License-File: LICENSE
+Keywords: appdirs,application,cache,directory,log,user
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3 :: Only
+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 :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >=3.8
+Provides-Extra: docs
+Requires-Dist: furo>=2023.9.10; extra == 'docs'
+Requires-Dist: proselint>=0.13; extra == 'docs'
+Requires-Dist: sphinx-autodoc-typehints>=1.25.2; extra == 'docs'
+Requires-Dist: sphinx>=7.2.6; extra == 'docs'
+Provides-Extra: test
+Requires-Dist: appdirs==1.4.4; extra == 'test'
+Requires-Dist: covdefaults>=2.3; extra == 'test'
+Requires-Dist: pytest-cov>=4.1; extra == 'test'
+Requires-Dist: pytest-mock>=3.12; extra == 'test'
+Requires-Dist: pytest>=7.4.3; extra == 'test'
+Provides-Extra: type
+Requires-Dist: mypy>=1.8; extra == 'type'
+Description-Content-Type: text/x-rst
+
+The problem
+===========
+
+.. image:: https://github.com/platformdirs/platformdirs/actions/workflows/check.yml/badge.svg
+   :target: https://github.com/platformdirs/platformdirs/actions
+
+When writing desktop application, finding the right location to store user data
+and configuration varies per platform. Even for single-platform apps, there
+may by plenty of nuances in figuring out the right location.
+
+For example, if running on macOS, you should use::
+
+    ~/Library/Application Support/
+
+If on Windows (at least English Win) that should be::
+
+    C:\Documents and Settings\\Application Data\Local Settings\\
+
+or possibly::
+
+    C:\Documents and Settings\\Application Data\\
+
+for `roaming profiles `_ but that is another story.
+
+On Linux (and other Unices), according to the `XDG Basedir Spec`_, it should be::
+
+    ~/.local/share/
+
+.. _XDG Basedir Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+
+``platformdirs`` to the rescue
+==============================
+
+This kind of thing is what the ``platformdirs`` package is for.
+``platformdirs`` will help you choose an appropriate:
+
+- user data dir (``user_data_dir``)
+- user config dir (``user_config_dir``)
+- user cache dir (``user_cache_dir``)
+- site data dir (``site_data_dir``)
+- site config dir (``site_config_dir``)
+- user log dir (``user_log_dir``)
+- user documents dir (``user_documents_dir``)
+- user downloads dir (``user_downloads_dir``)
+- user pictures dir (``user_pictures_dir``)
+- user videos dir (``user_videos_dir``)
+- user music dir (``user_music_dir``)
+- user desktop dir (``user_desktop_dir``)
+- user runtime dir (``user_runtime_dir``)
+
+And also:
+
+- Is slightly opinionated on the directory names used. Look for "OPINION" in
+  documentation and code for when an opinion is being applied.
+
+Example output
+==============
+
+On macOS:
+
+.. code-block:: pycon
+
+    >>> from platformdirs import *
+    >>> appname = "SuperApp"
+    >>> appauthor = "Acme"
+    >>> user_data_dir(appname, appauthor)
+    '/Users/trentm/Library/Application Support/SuperApp'
+    >>> site_data_dir(appname, appauthor)
+    '/Library/Application Support/SuperApp'
+    >>> user_cache_dir(appname, appauthor)
+    '/Users/trentm/Library/Caches/SuperApp'
+    >>> user_log_dir(appname, appauthor)
+    '/Users/trentm/Library/Logs/SuperApp'
+    >>> user_documents_dir()
+    '/Users/trentm/Documents'
+    >>> user_downloads_dir()
+    '/Users/trentm/Downloads'
+    >>> user_pictures_dir()
+    '/Users/trentm/Pictures'
+    >>> user_videos_dir()
+    '/Users/trentm/Movies'
+    >>> user_music_dir()
+    '/Users/trentm/Music'
+    >>> user_desktop_dir()
+    '/Users/trentm/Desktop'
+    >>> user_runtime_dir(appname, appauthor)
+    '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
+
+On Windows:
+
+.. code-block:: pycon
+
+    >>> from platformdirs import *
+    >>> appname = "SuperApp"
+    >>> appauthor = "Acme"
+    >>> user_data_dir(appname, appauthor)
+    'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp'
+    >>> user_data_dir(appname, appauthor, roaming=True)
+    'C:\\Users\\trentm\\AppData\\Roaming\\Acme\\SuperApp'
+    >>> user_cache_dir(appname, appauthor)
+    'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Cache'
+    >>> user_log_dir(appname, appauthor)
+    'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs'
+    >>> user_documents_dir()
+    'C:\\Users\\trentm\\Documents'
+    >>> user_downloads_dir()
+    'C:\\Users\\trentm\\Downloads'
+    >>> user_pictures_dir()
+    'C:\\Users\\trentm\\Pictures'
+    >>> user_videos_dir()
+    'C:\\Users\\trentm\\Videos'
+    >>> user_music_dir()
+    'C:\\Users\\trentm\\Music'
+    >>> user_desktop_dir()
+    'C:\\Users\\trentm\\Desktop'
+    >>> user_runtime_dir(appname, appauthor)
+    'C:\\Users\\trentm\\AppData\\Local\\Temp\\Acme\\SuperApp'
+
+On Linux:
+
+.. code-block:: pycon
+
+    >>> from platformdirs import *
+    >>> appname = "SuperApp"
+    >>> appauthor = "Acme"
+    >>> user_data_dir(appname, appauthor)
+    '/home/trentm/.local/share/SuperApp'
+    >>> site_data_dir(appname, appauthor)
+    '/usr/local/share/SuperApp'
+    >>> site_data_dir(appname, appauthor, multipath=True)
+    '/usr/local/share/SuperApp:/usr/share/SuperApp'
+    >>> user_cache_dir(appname, appauthor)
+    '/home/trentm/.cache/SuperApp'
+    >>> user_log_dir(appname, appauthor)
+    '/home/trentm/.local/state/SuperApp/log'
+    >>> user_config_dir(appname)
+    '/home/trentm/.config/SuperApp'
+    >>> user_documents_dir()
+    '/home/trentm/Documents'
+    >>> user_downloads_dir()
+    '/home/trentm/Downloads'
+    >>> user_pictures_dir()
+    '/home/trentm/Pictures'
+    >>> user_videos_dir()
+    '/home/trentm/Videos'
+    >>> user_music_dir()
+    '/home/trentm/Music'
+    >>> user_desktop_dir()
+    '/home/trentm/Desktop'
+    >>> user_runtime_dir(appname, appauthor)
+    '/run/user/{os.getuid()}/SuperApp'
+    >>> site_config_dir(appname)
+    '/etc/xdg/SuperApp'
+    >>> os.environ["XDG_CONFIG_DIRS"] = "/etc:/usr/local/etc"
+    >>> site_config_dir(appname, multipath=True)
+    '/etc/SuperApp:/usr/local/etc/SuperApp'
+
+On Android::
+
+    >>> from platformdirs import *
+    >>> appname = "SuperApp"
+    >>> appauthor = "Acme"
+    >>> user_data_dir(appname, appauthor)
+    '/data/data/com.myApp/files/SuperApp'
+    >>> user_cache_dir(appname, appauthor)
+    '/data/data/com.myApp/cache/SuperApp'
+    >>> user_log_dir(appname, appauthor)
+    '/data/data/com.myApp/cache/SuperApp/log'
+    >>> user_config_dir(appname)
+    '/data/data/com.myApp/shared_prefs/SuperApp'
+    >>> user_documents_dir()
+    '/storage/emulated/0/Documents'
+    >>> user_downloads_dir()
+    '/storage/emulated/0/Downloads'
+    >>> user_pictures_dir()
+    '/storage/emulated/0/Pictures'
+    >>> user_videos_dir()
+    '/storage/emulated/0/DCIM/Camera'
+    >>> user_music_dir()
+    '/storage/emulated/0/Music'
+    >>> user_desktop_dir()
+    '/storage/emulated/0/Desktop'
+    >>> user_runtime_dir(appname, appauthor)
+    '/data/data/com.myApp/cache/SuperApp/tmp'
+
+Note: Some android apps like Termux and Pydroid are used as shells. These
+apps are used by the end user to emulate Linux environment. Presence of
+``SHELL`` environment variable is used by Platformdirs to differentiate
+between general android apps and android apps used as shells. Shell android
+apps also support ``XDG_*`` environment variables.
+
+
+``PlatformDirs`` for convenience
+================================
+
+.. code-block:: pycon
+
+    >>> from platformdirs import PlatformDirs
+    >>> dirs = PlatformDirs("SuperApp", "Acme")
+    >>> dirs.user_data_dir
+    '/Users/trentm/Library/Application Support/SuperApp'
+    >>> dirs.site_data_dir
+    '/Library/Application Support/SuperApp'
+    >>> dirs.user_cache_dir
+    '/Users/trentm/Library/Caches/SuperApp'
+    >>> dirs.user_log_dir
+    '/Users/trentm/Library/Logs/SuperApp'
+    >>> dirs.user_documents_dir
+    '/Users/trentm/Documents'
+    >>> dirs.user_downloads_dir
+    '/Users/trentm/Downloads'
+    >>> dirs.user_pictures_dir
+    '/Users/trentm/Pictures'
+    >>> dirs.user_videos_dir
+    '/Users/trentm/Movies'
+    >>> dirs.user_music_dir
+    '/Users/trentm/Music'
+    >>> dirs.user_desktop_dir
+    '/Users/trentm/Desktop'
+    >>> dirs.user_runtime_dir
+    '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
+
+Per-version isolation
+=====================
+
+If you have multiple versions of your app in use that you want to be
+able to run side-by-side, then you may want version-isolation for these
+dirs::
+
+    >>> from platformdirs import PlatformDirs
+    >>> dirs = PlatformDirs("SuperApp", "Acme", version="1.0")
+    >>> dirs.user_data_dir
+    '/Users/trentm/Library/Application Support/SuperApp/1.0'
+    >>> dirs.site_data_dir
+    '/Library/Application Support/SuperApp/1.0'
+    >>> dirs.user_cache_dir
+    '/Users/trentm/Library/Caches/SuperApp/1.0'
+    >>> dirs.user_log_dir
+    '/Users/trentm/Library/Logs/SuperApp/1.0'
+    >>> dirs.user_documents_dir
+    '/Users/trentm/Documents'
+    >>> dirs.user_downloads_dir
+    '/Users/trentm/Downloads'
+    >>> dirs.user_pictures_dir
+    '/Users/trentm/Pictures'
+    >>> dirs.user_videos_dir
+    '/Users/trentm/Movies'
+    >>> dirs.user_music_dir
+    '/Users/trentm/Music'
+    >>> dirs.user_desktop_dir
+    '/Users/trentm/Desktop'
+    >>> dirs.user_runtime_dir
+    '/Users/trentm/Library/Caches/TemporaryItems/SuperApp/1.0'
+
+Be wary of using this for configuration files though; you'll need to handle
+migrating configuration files manually.
+
+Why this Fork?
+==============
+
+This repository is a friendly fork of the wonderful work started by
+`ActiveState `_ who created
+``appdirs``, this package's ancestor.
+
+Maintaining an open source project is no easy task, particularly
+from within an organization, and the Python community is indebted
+to ``appdirs`` (and to Trent Mick and Jeff Rouse in particular) for
+creating an incredibly useful simple module, as evidenced by the wide
+number of users it has attracted over the years.
+
+Nonetheless, given the number of long-standing open issues
+and pull requests, and no clear path towards `ensuring
+that maintenance of the package would continue or grow
+`_, this fork was
+created.
+
+Contributions are most welcome.
diff --git a/setuptools/_vendor/platformdirs-4.2.2.dist-info/RECORD b/setuptools/_vendor/platformdirs-4.2.2.dist-info/RECORD
new file mode 100644
index 0000000000..64c0c8ea2e
--- /dev/null
+++ b/setuptools/_vendor/platformdirs-4.2.2.dist-info/RECORD
@@ -0,0 +1,23 @@
+platformdirs-4.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+platformdirs-4.2.2.dist-info/METADATA,sha256=zmsie01G1MtXR0wgIv5XpVeTO7idr0WWvfmxKsKWuGk,11429
+platformdirs-4.2.2.dist-info/RECORD,,
+platformdirs-4.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+platformdirs-4.2.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
+platformdirs-4.2.2.dist-info/licenses/LICENSE,sha256=KeD9YukphQ6G6yjD_czwzv30-pSHkBHP-z0NS-1tTbY,1089
+platformdirs/__init__.py,sha256=EMGE8qeHRR9CzDFr8kL3tA8hdZZniYjXBVZd0UGTWK0,22225
+platformdirs/__main__.py,sha256=HnsUQHpiBaiTxwcmwVw-nFaPdVNZtQIdi1eWDtI-MzI,1493
+platformdirs/__pycache__/__init__.cpython-312.pyc,,
+platformdirs/__pycache__/__main__.cpython-312.pyc,,
+platformdirs/__pycache__/android.cpython-312.pyc,,
+platformdirs/__pycache__/api.cpython-312.pyc,,
+platformdirs/__pycache__/macos.cpython-312.pyc,,
+platformdirs/__pycache__/unix.cpython-312.pyc,,
+platformdirs/__pycache__/version.cpython-312.pyc,,
+platformdirs/__pycache__/windows.cpython-312.pyc,,
+platformdirs/android.py,sha256=xZXY9Jd46WOsxT2U6-5HsNtDZ-IQqxcEUrBLl3hYk4o,9016
+platformdirs/api.py,sha256=QBYdUac2eC521ek_y53uD1Dcq-lJX8IgSRVd4InC6uc,8996
+platformdirs/macos.py,sha256=wftsbsvq6nZ0WORXSiCrZNkRHz_WKuktl0a6mC7MFkI,5580
+platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+platformdirs/unix.py,sha256=Cci9Wqt35dAMsg6HT9nRGHSBW5obb0pR3AE1JJnsCXg,10643
+platformdirs/version.py,sha256=r7F76tZRjgQKzrpx_I0_ZMQOMU-PS7eGnHD7zEK3KB0,411
+platformdirs/windows.py,sha256=IFpiohUBwxPtCzlyKwNtxyW4Jk8haa6W8o59mfrDXVo,10125
diff --git a/setuptools/_vendor/platformdirs-4.2.2.dist-info/REQUESTED b/setuptools/_vendor/platformdirs-4.2.2.dist-info/REQUESTED
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/platformdirs-4.2.2.dist-info/WHEEL b/setuptools/_vendor/platformdirs-4.2.2.dist-info/WHEEL
new file mode 100644
index 0000000000..516596c767
--- /dev/null
+++ b/setuptools/_vendor/platformdirs-4.2.2.dist-info/WHEEL
@@ -0,0 +1,4 @@
+Wheel-Version: 1.0
+Generator: hatchling 1.24.2
+Root-Is-Purelib: true
+Tag: py3-none-any
diff --git a/setuptools/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE b/setuptools/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
new file mode 100644
index 0000000000..f35fed9191
--- /dev/null
+++ b/setuptools/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2010-202x The platformdirs developers
+
+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/setuptools/_vendor/platformdirs/__init__.py b/setuptools/_vendor/platformdirs/__init__.py
new file mode 100644
index 0000000000..3f7d9490d1
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/__init__.py
@@ -0,0 +1,627 @@
+"""
+Utilities for determining application-specific dirs.
+
+See  for details and usage.
+
+"""
+
+from __future__ import annotations
+
+import os
+import sys
+from typing import TYPE_CHECKING
+
+from .api import PlatformDirsABC
+from .version import __version__
+from .version import __version_tuple__ as __version_info__
+
+if TYPE_CHECKING:
+    from pathlib import Path
+    from typing import Literal
+
+
+def _set_platform_dir_class() -> type[PlatformDirsABC]:
+    if sys.platform == "win32":
+        from platformdirs.windows import Windows as Result  # noqa: PLC0415
+    elif sys.platform == "darwin":
+        from platformdirs.macos import MacOS as Result  # noqa: PLC0415
+    else:
+        from platformdirs.unix import Unix as Result  # noqa: PLC0415
+
+    if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
+        if os.getenv("SHELL") or os.getenv("PREFIX"):
+            return Result
+
+        from platformdirs.android import _android_folder  # noqa: PLC0415
+
+        if _android_folder() is not None:
+            from platformdirs.android import Android  # noqa: PLC0415
+
+            return Android  # return to avoid redefinition of a result
+
+    return Result
+
+
+PlatformDirs = _set_platform_dir_class()  #: Currently active platform
+AppDirs = PlatformDirs  #: Backwards compatibility with appdirs
+
+
+def user_data_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: data directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_data_dir
+
+
+def site_data_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param multipath: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: data directory shared by users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_data_dir
+
+
+def user_config_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: config directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_config_dir
+
+
+def site_config_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param multipath: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: config directory shared by the users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_config_dir
+
+
+def user_cache_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: cache directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_cache_dir
+
+
+def site_cache_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: cache directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_cache_dir
+
+
+def user_state_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: state directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_state_dir
+
+
+def user_log_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: log directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_log_dir
+
+
+def user_documents_dir() -> str:
+    """:returns: documents directory tied to the user"""
+    return PlatformDirs().user_documents_dir
+
+
+def user_downloads_dir() -> str:
+    """:returns: downloads directory tied to the user"""
+    return PlatformDirs().user_downloads_dir
+
+
+def user_pictures_dir() -> str:
+    """:returns: pictures directory tied to the user"""
+    return PlatformDirs().user_pictures_dir
+
+
+def user_videos_dir() -> str:
+    """:returns: videos directory tied to the user"""
+    return PlatformDirs().user_videos_dir
+
+
+def user_music_dir() -> str:
+    """:returns: music directory tied to the user"""
+    return PlatformDirs().user_music_dir
+
+
+def user_desktop_dir() -> str:
+    """:returns: desktop directory tied to the user"""
+    return PlatformDirs().user_desktop_dir
+
+
+def user_runtime_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: runtime directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_runtime_dir
+
+
+def site_runtime_dir(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> str:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: runtime directory shared by users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_runtime_dir
+
+
+def user_data_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: data path tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_data_path
+
+
+def site_data_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param multipath: See `multipath `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: data path shared by users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_data_path
+
+
+def user_config_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: config path tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_config_path
+
+
+def site_config_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    multipath: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param multipath: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: config path shared by the users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        multipath=multipath,
+        ensure_exists=ensure_exists,
+    ).site_config_path
+
+
+def site_cache_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: cache directory tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_cache_path
+
+
+def user_cache_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: cache path tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_cache_path
+
+
+def user_state_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    roaming: bool = False,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param roaming: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: state path tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        roaming=roaming,
+        ensure_exists=ensure_exists,
+    ).user_state_path
+
+
+def user_log_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `roaming `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: log path tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_log_path
+
+
+def user_documents_path() -> Path:
+    """:returns: documents a path tied to the user"""
+    return PlatformDirs().user_documents_path
+
+
+def user_downloads_path() -> Path:
+    """:returns: downloads path tied to the user"""
+    return PlatformDirs().user_downloads_path
+
+
+def user_pictures_path() -> Path:
+    """:returns: pictures path tied to the user"""
+    return PlatformDirs().user_pictures_path
+
+
+def user_videos_path() -> Path:
+    """:returns: videos path tied to the user"""
+    return PlatformDirs().user_videos_path
+
+
+def user_music_path() -> Path:
+    """:returns: music path tied to the user"""
+    return PlatformDirs().user_music_path
+
+
+def user_desktop_path() -> Path:
+    """:returns: desktop path tied to the user"""
+    return PlatformDirs().user_desktop_path
+
+
+def user_runtime_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: runtime path tied to the user
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).user_runtime_path
+
+
+def site_runtime_path(
+    appname: str | None = None,
+    appauthor: str | None | Literal[False] = None,
+    version: str | None = None,
+    opinion: bool = True,  # noqa: FBT001, FBT002
+    ensure_exists: bool = False,  # noqa: FBT001, FBT002
+) -> Path:
+    """
+    :param appname: See `appname `.
+    :param appauthor: See `appauthor `.
+    :param version: See `version `.
+    :param opinion: See `opinion `.
+    :param ensure_exists: See `ensure_exists `.
+    :returns: runtime path shared by users
+    """
+    return PlatformDirs(
+        appname=appname,
+        appauthor=appauthor,
+        version=version,
+        opinion=opinion,
+        ensure_exists=ensure_exists,
+    ).site_runtime_path
+
+
+__all__ = [
+    "AppDirs",
+    "PlatformDirs",
+    "PlatformDirsABC",
+    "__version__",
+    "__version_info__",
+    "site_cache_dir",
+    "site_cache_path",
+    "site_config_dir",
+    "site_config_path",
+    "site_data_dir",
+    "site_data_path",
+    "site_runtime_dir",
+    "site_runtime_path",
+    "user_cache_dir",
+    "user_cache_path",
+    "user_config_dir",
+    "user_config_path",
+    "user_data_dir",
+    "user_data_path",
+    "user_desktop_dir",
+    "user_desktop_path",
+    "user_documents_dir",
+    "user_documents_path",
+    "user_downloads_dir",
+    "user_downloads_path",
+    "user_log_dir",
+    "user_log_path",
+    "user_music_dir",
+    "user_music_path",
+    "user_pictures_dir",
+    "user_pictures_path",
+    "user_runtime_dir",
+    "user_runtime_path",
+    "user_state_dir",
+    "user_state_path",
+    "user_videos_dir",
+    "user_videos_path",
+]
diff --git a/setuptools/_vendor/platformdirs/__main__.py b/setuptools/_vendor/platformdirs/__main__.py
new file mode 100644
index 0000000000..922c521358
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/__main__.py
@@ -0,0 +1,55 @@
+"""Main entry point."""
+
+from __future__ import annotations
+
+from platformdirs import PlatformDirs, __version__
+
+PROPS = (
+    "user_data_dir",
+    "user_config_dir",
+    "user_cache_dir",
+    "user_state_dir",
+    "user_log_dir",
+    "user_documents_dir",
+    "user_downloads_dir",
+    "user_pictures_dir",
+    "user_videos_dir",
+    "user_music_dir",
+    "user_runtime_dir",
+    "site_data_dir",
+    "site_config_dir",
+    "site_cache_dir",
+    "site_runtime_dir",
+)
+
+
+def main() -> None:
+    """Run the main entry point."""
+    app_name = "MyApp"
+    app_author = "MyCompany"
+
+    print(f"-- platformdirs {__version__} --")  # noqa: T201
+
+    print("-- app dirs (with optional 'version')")  # noqa: T201
+    dirs = PlatformDirs(app_name, app_author, version="1.0")
+    for prop in PROPS:
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
+
+    print("\n-- app dirs (without optional 'version')")  # noqa: T201
+    dirs = PlatformDirs(app_name, app_author)
+    for prop in PROPS:
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
+
+    print("\n-- app dirs (without optional 'appauthor')")  # noqa: T201
+    dirs = PlatformDirs(app_name)
+    for prop in PROPS:
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
+
+    print("\n-- app dirs (with disabled 'appauthor')")  # noqa: T201
+    dirs = PlatformDirs(app_name, appauthor=False)
+    for prop in PROPS:
+        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
+
+
+if __name__ == "__main__":
+    main()
diff --git a/setuptools/_vendor/platformdirs/android.py b/setuptools/_vendor/platformdirs/android.py
new file mode 100644
index 0000000000..afd3141c72
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/android.py
@@ -0,0 +1,249 @@
+"""Android."""
+
+from __future__ import annotations
+
+import os
+import re
+import sys
+from functools import lru_cache
+from typing import TYPE_CHECKING, cast
+
+from .api import PlatformDirsABC
+
+
+class Android(PlatformDirsABC):
+    """
+    Follows the guidance `from here `_.
+
+    Makes use of the `appname `, `version
+    `, `ensure_exists `.
+
+    """
+
+    @property
+    def user_data_dir(self) -> str:
+        """:return: data directory tied to the user, e.g. ``/data/user///files/``"""
+        return self._append_app_name_and_version(cast(str, _android_folder()), "files")
+
+    @property
+    def site_data_dir(self) -> str:
+        """:return: data directory shared by users, same as `user_data_dir`"""
+        return self.user_data_dir
+
+    @property
+    def user_config_dir(self) -> str:
+        """
+        :return: config directory tied to the user, e.g. \
+        ``/data/user///shared_prefs/``
+        """
+        return self._append_app_name_and_version(cast(str, _android_folder()), "shared_prefs")
+
+    @property
+    def site_config_dir(self) -> str:
+        """:return: config directory shared by the users, same as `user_config_dir`"""
+        return self.user_config_dir
+
+    @property
+    def user_cache_dir(self) -> str:
+        """:return: cache directory tied to the user, e.g.,``/data/user///cache/``"""
+        return self._append_app_name_and_version(cast(str, _android_folder()), "cache")
+
+    @property
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users, same as `user_cache_dir`"""
+        return self.user_cache_dir
+
+    @property
+    def user_state_dir(self) -> str:
+        """:return: state directory tied to the user, same as `user_data_dir`"""
+        return self.user_data_dir
+
+    @property
+    def user_log_dir(self) -> str:
+        """
+        :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it,
+          e.g. ``/data/user///cache//log``
+        """
+        path = self.user_cache_dir
+        if self.opinion:
+            path = os.path.join(path, "log")  # noqa: PTH118
+        return path
+
+    @property
+    def user_documents_dir(self) -> str:
+        """:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``"""
+        return _android_documents_folder()
+
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``"""
+        return _android_downloads_folder()
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``"""
+        return _android_pictures_folder()
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``"""
+        return _android_videos_folder()
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``"""
+        return _android_music_folder()
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user e.g. ``/storage/emulated/0/Desktop``"""
+        return "/storage/emulated/0/Desktop"
+
+    @property
+    def user_runtime_dir(self) -> str:
+        """
+        :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it,
+          e.g. ``/data/user///cache//tmp``
+        """
+        path = self.user_cache_dir
+        if self.opinion:
+            path = os.path.join(path, "tmp")  # noqa: PTH118
+        return path
+
+    @property
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
+        return self.user_runtime_dir
+
+
+@lru_cache(maxsize=1)
+def _android_folder() -> str | None:  # noqa: C901, PLR0912
+    """:return: base folder for the Android OS or None if it cannot be found"""
+    result: str | None = None
+    # type checker isn't happy with our "import android", just don't do this when type checking see
+    # https://stackoverflow.com/a/61394121
+    if not TYPE_CHECKING:
+        try:
+            # First try to get a path to android app using python4android (if available)...
+            from android import mActivity  # noqa: PLC0415
+
+            context = cast("android.content.Context", mActivity.getApplicationContext())  # noqa: F821
+            result = context.getFilesDir().getParentFile().getAbsolutePath()
+        except Exception:  # noqa: BLE001
+            result = None
+    if result is None:
+        try:
+            # ...and fall back to using plain pyjnius, if python4android isn't available or doesn't deliver any useful
+            # result...
+            from jnius import autoclass  # noqa: PLC0415
+
+            context = autoclass("android.content.Context")
+            result = context.getFilesDir().getParentFile().getAbsolutePath()
+        except Exception:  # noqa: BLE001
+            result = None
+    if result is None:
+        # and if that fails, too, find an android folder looking at path on the sys.path
+        # warning: only works for apps installed under /data, not adopted storage etc.
+        pattern = re.compile(r"/data/(data|user/\d+)/(.+)/files")
+        for path in sys.path:
+            if pattern.match(path):
+                result = path.split("/files")[0]
+                break
+        else:
+            result = None
+    if result is None:
+        # one last try: find an android folder looking at path on the sys.path taking adopted storage paths into
+        # account
+        pattern = re.compile(r"/mnt/expand/[a-fA-F0-9-]{36}/(data|user/\d+)/(.+)/files")
+        for path in sys.path:
+            if pattern.match(path):
+                result = path.split("/files")[0]
+                break
+        else:
+            result = None
+    return result
+
+
+@lru_cache(maxsize=1)
+def _android_documents_folder() -> str:
+    """:return: documents folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        documents_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOCUMENTS).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        documents_dir = "/storage/emulated/0/Documents"
+
+    return documents_dir
+
+
+@lru_cache(maxsize=1)
+def _android_downloads_folder() -> str:
+    """:return: downloads folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        downloads_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOWNLOADS).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        downloads_dir = "/storage/emulated/0/Downloads"
+
+    return downloads_dir
+
+
+@lru_cache(maxsize=1)
+def _android_pictures_folder() -> str:
+    """:return: pictures folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        pictures_dir: str = context.getExternalFilesDir(environment.DIRECTORY_PICTURES).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        pictures_dir = "/storage/emulated/0/Pictures"
+
+    return pictures_dir
+
+
+@lru_cache(maxsize=1)
+def _android_videos_folder() -> str:
+    """:return: videos folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        videos_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DCIM).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        videos_dir = "/storage/emulated/0/DCIM/Camera"
+
+    return videos_dir
+
+
+@lru_cache(maxsize=1)
+def _android_music_folder() -> str:
+    """:return: music folder for the Android OS"""
+    # Get directories with pyjnius
+    try:
+        from jnius import autoclass  # noqa: PLC0415
+
+        context = autoclass("android.content.Context")
+        environment = autoclass("android.os.Environment")
+        music_dir: str = context.getExternalFilesDir(environment.DIRECTORY_MUSIC).getAbsolutePath()
+    except Exception:  # noqa: BLE001
+        music_dir = "/storage/emulated/0/Music"
+
+    return music_dir
+
+
+__all__ = [
+    "Android",
+]
diff --git a/setuptools/_vendor/platformdirs/api.py b/setuptools/_vendor/platformdirs/api.py
new file mode 100644
index 0000000000..c50caa648a
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/api.py
@@ -0,0 +1,292 @@
+"""Base API."""
+
+from __future__ import annotations
+
+import os
+from abc import ABC, abstractmethod
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+    from typing import Iterator, Literal
+
+
+class PlatformDirsABC(ABC):  # noqa: PLR0904
+    """Abstract base class for platform directories."""
+
+    def __init__(  # noqa: PLR0913, PLR0917
+        self,
+        appname: str | None = None,
+        appauthor: str | None | Literal[False] = None,
+        version: str | None = None,
+        roaming: bool = False,  # noqa: FBT001, FBT002
+        multipath: bool = False,  # noqa: FBT001, FBT002
+        opinion: bool = True,  # noqa: FBT001, FBT002
+        ensure_exists: bool = False,  # noqa: FBT001, FBT002
+    ) -> None:
+        """
+        Create a new platform directory.
+
+        :param appname: See `appname`.
+        :param appauthor: See `appauthor`.
+        :param version: See `version`.
+        :param roaming: See `roaming`.
+        :param multipath: See `multipath`.
+        :param opinion: See `opinion`.
+        :param ensure_exists: See `ensure_exists`.
+
+        """
+        self.appname = appname  #: The name of application.
+        self.appauthor = appauthor
+        """
+        The name of the app author or distributing body for this application.
+
+        Typically, it is the owning company name. Defaults to `appname`. You may pass ``False`` to disable it.
+
+        """
+        self.version = version
+        """
+        An optional version path element to append to the path.
+
+        You might want to use this if you want multiple versions of your app to be able to run independently. If used,
+        this would typically be ``.``.
+
+        """
+        self.roaming = roaming
+        """
+        Whether to use the roaming appdata directory on Windows.
+
+        That means that for users on a Windows network setup for roaming profiles, this user data will be synced on
+        login (see
+        `here `_).
+
+        """
+        self.multipath = multipath
+        """
+        An optional parameter which indicates that the entire list of data dirs should be returned.
+
+        By default, the first item would only be returned.
+
+        """
+        self.opinion = opinion  #: A flag to indicating to use opinionated values.
+        self.ensure_exists = ensure_exists
+        """
+        Optionally create the directory (and any missing parents) upon access if it does not exist.
+
+        By default, no directories are created.
+
+        """
+
+    def _append_app_name_and_version(self, *base: str) -> str:
+        params = list(base[1:])
+        if self.appname:
+            params.append(self.appname)
+            if self.version:
+                params.append(self.version)
+        path = os.path.join(base[0], *params)  # noqa: PTH118
+        self._optionally_create_directory(path)
+        return path
+
+    def _optionally_create_directory(self, path: str) -> None:
+        if self.ensure_exists:
+            Path(path).mkdir(parents=True, exist_ok=True)
+
+    @property
+    @abstractmethod
+    def user_data_dir(self) -> str:
+        """:return: data directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def site_data_dir(self) -> str:
+        """:return: data directory shared by users"""
+
+    @property
+    @abstractmethod
+    def user_config_dir(self) -> str:
+        """:return: config directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def site_config_dir(self) -> str:
+        """:return: config directory shared by the users"""
+
+    @property
+    @abstractmethod
+    def user_cache_dir(self) -> str:
+        """:return: cache directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users"""
+
+    @property
+    @abstractmethod
+    def user_state_dir(self) -> str:
+        """:return: state directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_log_dir(self) -> str:
+        """:return: log directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_documents_dir(self) -> str:
+        """:return: documents directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def user_runtime_dir(self) -> str:
+        """:return: runtime directory tied to the user"""
+
+    @property
+    @abstractmethod
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users"""
+
+    @property
+    def user_data_path(self) -> Path:
+        """:return: data path tied to the user"""
+        return Path(self.user_data_dir)
+
+    @property
+    def site_data_path(self) -> Path:
+        """:return: data path shared by users"""
+        return Path(self.site_data_dir)
+
+    @property
+    def user_config_path(self) -> Path:
+        """:return: config path tied to the user"""
+        return Path(self.user_config_dir)
+
+    @property
+    def site_config_path(self) -> Path:
+        """:return: config path shared by the users"""
+        return Path(self.site_config_dir)
+
+    @property
+    def user_cache_path(self) -> Path:
+        """:return: cache path tied to the user"""
+        return Path(self.user_cache_dir)
+
+    @property
+    def site_cache_path(self) -> Path:
+        """:return: cache path shared by users"""
+        return Path(self.site_cache_dir)
+
+    @property
+    def user_state_path(self) -> Path:
+        """:return: state path tied to the user"""
+        return Path(self.user_state_dir)
+
+    @property
+    def user_log_path(self) -> Path:
+        """:return: log path tied to the user"""
+        return Path(self.user_log_dir)
+
+    @property
+    def user_documents_path(self) -> Path:
+        """:return: documents a path tied to the user"""
+        return Path(self.user_documents_dir)
+
+    @property
+    def user_downloads_path(self) -> Path:
+        """:return: downloads path tied to the user"""
+        return Path(self.user_downloads_dir)
+
+    @property
+    def user_pictures_path(self) -> Path:
+        """:return: pictures path tied to the user"""
+        return Path(self.user_pictures_dir)
+
+    @property
+    def user_videos_path(self) -> Path:
+        """:return: videos path tied to the user"""
+        return Path(self.user_videos_dir)
+
+    @property
+    def user_music_path(self) -> Path:
+        """:return: music path tied to the user"""
+        return Path(self.user_music_dir)
+
+    @property
+    def user_desktop_path(self) -> Path:
+        """:return: desktop path tied to the user"""
+        return Path(self.user_desktop_dir)
+
+    @property
+    def user_runtime_path(self) -> Path:
+        """:return: runtime path tied to the user"""
+        return Path(self.user_runtime_dir)
+
+    @property
+    def site_runtime_path(self) -> Path:
+        """:return: runtime path shared by users"""
+        return Path(self.site_runtime_dir)
+
+    def iter_config_dirs(self) -> Iterator[str]:
+        """:yield: all user and site configuration directories."""
+        yield self.user_config_dir
+        yield self.site_config_dir
+
+    def iter_data_dirs(self) -> Iterator[str]:
+        """:yield: all user and site data directories."""
+        yield self.user_data_dir
+        yield self.site_data_dir
+
+    def iter_cache_dirs(self) -> Iterator[str]:
+        """:yield: all user and site cache directories."""
+        yield self.user_cache_dir
+        yield self.site_cache_dir
+
+    def iter_runtime_dirs(self) -> Iterator[str]:
+        """:yield: all user and site runtime directories."""
+        yield self.user_runtime_dir
+        yield self.site_runtime_dir
+
+    def iter_config_paths(self) -> Iterator[Path]:
+        """:yield: all user and site configuration paths."""
+        for path in self.iter_config_dirs():
+            yield Path(path)
+
+    def iter_data_paths(self) -> Iterator[Path]:
+        """:yield: all user and site data paths."""
+        for path in self.iter_data_dirs():
+            yield Path(path)
+
+    def iter_cache_paths(self) -> Iterator[Path]:
+        """:yield: all user and site cache paths."""
+        for path in self.iter_cache_dirs():
+            yield Path(path)
+
+    def iter_runtime_paths(self) -> Iterator[Path]:
+        """:yield: all user and site runtime paths."""
+        for path in self.iter_runtime_dirs():
+            yield Path(path)
diff --git a/setuptools/_vendor/platformdirs/macos.py b/setuptools/_vendor/platformdirs/macos.py
new file mode 100644
index 0000000000..eb1ba5df1d
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/macos.py
@@ -0,0 +1,130 @@
+"""macOS."""
+
+from __future__ import annotations
+
+import os.path
+import sys
+
+from .api import PlatformDirsABC
+
+
+class MacOS(PlatformDirsABC):
+    """
+    Platform directories for the macOS operating system.
+
+    Follows the guidance from
+    `Apple documentation `_.
+    Makes use of the `appname `,
+    `version `,
+    `ensure_exists `.
+
+    """
+
+    @property
+    def user_data_dir(self) -> str:
+        """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support"))  # noqa: PTH111
+
+    @property
+    def site_data_dir(self) -> str:
+        """
+        :return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``.
+          If we're using a Python binary managed by `Homebrew `_, the directory
+          will be under the Homebrew prefix, e.g. ``/opt/homebrew/share/$appname/$version``.
+          If `multipath ` is enabled, and we're in Homebrew,
+          the response is a multi-path string separated by ":", e.g.
+          ``/opt/homebrew/share/$appname/$version:/Library/Application Support/$appname/$version``
+        """
+        is_homebrew = sys.prefix.startswith("/opt/homebrew")
+        path_list = [self._append_app_name_and_version("/opt/homebrew/share")] if is_homebrew else []
+        path_list.append(self._append_app_name_and_version("/Library/Application Support"))
+        if self.multipath:
+            return os.pathsep.join(path_list)
+        return path_list[0]
+
+    @property
+    def user_config_dir(self) -> str:
+        """:return: config directory tied to the user, same as `user_data_dir`"""
+        return self.user_data_dir
+
+    @property
+    def site_config_dir(self) -> str:
+        """:return: config directory shared by the users, same as `site_data_dir`"""
+        return self.site_data_dir
+
+    @property
+    def user_cache_dir(self) -> str:
+        """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))  # noqa: PTH111
+
+    @property
+    def site_cache_dir(self) -> str:
+        """
+        :return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``.
+          If we're using a Python binary managed by `Homebrew `_, the directory
+          will be under the Homebrew prefix, e.g. ``/opt/homebrew/var/cache/$appname/$version``.
+          If `multipath ` is enabled, and we're in Homebrew,
+          the response is a multi-path string separated by ":", e.g.
+          ``/opt/homebrew/var/cache/$appname/$version:/Library/Caches/$appname/$version``
+        """
+        is_homebrew = sys.prefix.startswith("/opt/homebrew")
+        path_list = [self._append_app_name_and_version("/opt/homebrew/var/cache")] if is_homebrew else []
+        path_list.append(self._append_app_name_and_version("/Library/Caches"))
+        if self.multipath:
+            return os.pathsep.join(path_list)
+        return path_list[0]
+
+    @property
+    def user_state_dir(self) -> str:
+        """:return: state directory tied to the user, same as `user_data_dir`"""
+        return self.user_data_dir
+
+    @property
+    def user_log_dir(self) -> str:
+        """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))  # noqa: PTH111
+
+    @property
+    def user_documents_dir(self) -> str:
+        """:return: documents directory tied to the user, e.g. ``~/Documents``"""
+        return os.path.expanduser("~/Documents")  # noqa: PTH111
+
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
+        return os.path.expanduser("~/Downloads")  # noqa: PTH111
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
+        return os.path.expanduser("~/Pictures")  # noqa: PTH111
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user, e.g. ``~/Movies``"""
+        return os.path.expanduser("~/Movies")  # noqa: PTH111
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user, e.g. ``~/Music``"""
+        return os.path.expanduser("~/Music")  # noqa: PTH111
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
+        return os.path.expanduser("~/Desktop")  # noqa: PTH111
+
+    @property
+    def user_runtime_dir(self) -> str:
+        """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
+        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))  # noqa: PTH111
+
+    @property
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
+        return self.user_runtime_dir
+
+
+__all__ = [
+    "MacOS",
+]
diff --git a/setuptools/_vendor/platformdirs/py.typed b/setuptools/_vendor/platformdirs/py.typed
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setuptools/_vendor/platformdirs/unix.py b/setuptools/_vendor/platformdirs/unix.py
new file mode 100644
index 0000000000..9500ade614
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/unix.py
@@ -0,0 +1,275 @@
+"""Unix."""
+
+from __future__ import annotations
+
+import os
+import sys
+from configparser import ConfigParser
+from pathlib import Path
+from typing import Iterator, NoReturn
+
+from .api import PlatformDirsABC
+
+if sys.platform == "win32":
+
+    def getuid() -> NoReturn:
+        msg = "should only be used on Unix"
+        raise RuntimeError(msg)
+
+else:
+    from os import getuid
+
+
+class Unix(PlatformDirsABC):  # noqa: PLR0904
+    """
+    On Unix/Linux, we follow the `XDG Basedir Spec `_.
+
+    The spec allows overriding directories with environment variables. The examples shown are the default values,
+    alongside the name of the environment variable that overrides them. Makes use of the `appname
+    `, `version `, `multipath
+    `, `opinion `, `ensure_exists
+    `.
+
+    """
+
+    @property
+    def user_data_dir(self) -> str:
+        """
+        :return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or
+         ``$XDG_DATA_HOME/$appname/$version``
+        """
+        path = os.environ.get("XDG_DATA_HOME", "")
+        if not path.strip():
+            path = os.path.expanduser("~/.local/share")  # noqa: PTH111
+        return self._append_app_name_and_version(path)
+
+    @property
+    def _site_data_dirs(self) -> list[str]:
+        path = os.environ.get("XDG_DATA_DIRS", "")
+        if not path.strip():
+            path = f"/usr/local/share{os.pathsep}/usr/share"
+        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]
+
+    @property
+    def site_data_dir(self) -> str:
+        """
+        :return: data directories shared by users (if `multipath ` is
+         enabled and ``XDG_DATA_DIRS`` is set and a multi path the response is also a multi path separated by the
+         OS path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
+        """
+        # XDG default for $XDG_DATA_DIRS; only first, if multipath is False
+        dirs = self._site_data_dirs
+        if not self.multipath:
+            return dirs[0]
+        return os.pathsep.join(dirs)
+
+    @property
+    def user_config_dir(self) -> str:
+        """
+        :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
+         ``$XDG_CONFIG_HOME/$appname/$version``
+        """
+        path = os.environ.get("XDG_CONFIG_HOME", "")
+        if not path.strip():
+            path = os.path.expanduser("~/.config")  # noqa: PTH111
+        return self._append_app_name_and_version(path)
+
+    @property
+    def _site_config_dirs(self) -> list[str]:
+        path = os.environ.get("XDG_CONFIG_DIRS", "")
+        if not path.strip():
+            path = "/etc/xdg"
+        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]
+
+    @property
+    def site_config_dir(self) -> str:
+        """
+        :return: config directories shared by users (if `multipath `
+         is enabled and ``XDG_CONFIG_DIRS`` is set and a multi path the response is also a multi path separated by
+         the OS path separator), e.g. ``/etc/xdg/$appname/$version``
+        """
+        # XDG default for $XDG_CONFIG_DIRS only first, if multipath is False
+        dirs = self._site_config_dirs
+        if not self.multipath:
+            return dirs[0]
+        return os.pathsep.join(dirs)
+
+    @property
+    def user_cache_dir(self) -> str:
+        """
+        :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
+         ``~/$XDG_CACHE_HOME/$appname/$version``
+        """
+        path = os.environ.get("XDG_CACHE_HOME", "")
+        if not path.strip():
+            path = os.path.expanduser("~/.cache")  # noqa: PTH111
+        return self._append_app_name_and_version(path)
+
+    @property
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``"""
+        return self._append_app_name_and_version("/var/cache")
+
+    @property
+    def user_state_dir(self) -> str:
+        """
+        :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
+         ``$XDG_STATE_HOME/$appname/$version``
+        """
+        path = os.environ.get("XDG_STATE_HOME", "")
+        if not path.strip():
+            path = os.path.expanduser("~/.local/state")  # noqa: PTH111
+        return self._append_app_name_and_version(path)
+
+    @property
+    def user_log_dir(self) -> str:
+        """:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it"""
+        path = self.user_state_dir
+        if self.opinion:
+            path = os.path.join(path, "log")  # noqa: PTH118
+            self._optionally_create_directory(path)
+        return path
+
+    @property
+    def user_documents_dir(self) -> str:
+        """:return: documents directory tied to the user, e.g. ``~/Documents``"""
+        return _get_user_media_dir("XDG_DOCUMENTS_DIR", "~/Documents")
+
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
+        return _get_user_media_dir("XDG_DOWNLOAD_DIR", "~/Downloads")
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
+        return _get_user_media_dir("XDG_PICTURES_DIR", "~/Pictures")
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user, e.g. ``~/Videos``"""
+        return _get_user_media_dir("XDG_VIDEOS_DIR", "~/Videos")
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user, e.g. ``~/Music``"""
+        return _get_user_media_dir("XDG_MUSIC_DIR", "~/Music")
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
+        return _get_user_media_dir("XDG_DESKTOP_DIR", "~/Desktop")
+
+    @property
+    def user_runtime_dir(self) -> str:
+        """
+        :return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or
+         ``$XDG_RUNTIME_DIR/$appname/$version``.
+
+         For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/user/$(id -u)/$appname/$version`` if
+         exists, otherwise ``/tmp/runtime-$(id -u)/$appname/$version``, if``$XDG_RUNTIME_DIR``
+         is not set.
+        """
+        path = os.environ.get("XDG_RUNTIME_DIR", "")
+        if not path.strip():
+            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
+                path = f"/var/run/user/{getuid()}"
+                if not Path(path).exists():
+                    path = f"/tmp/runtime-{getuid()}"  # noqa: S108
+            else:
+                path = f"/run/user/{getuid()}"
+        return self._append_app_name_and_version(path)
+
+    @property
+    def site_runtime_dir(self) -> str:
+        """
+        :return: runtime directory shared by users, e.g. ``/run/$appname/$version`` or \
+        ``$XDG_RUNTIME_DIR/$appname/$version``.
+
+        Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will
+        fall back to paths associated to the root user instead of a regular logged-in user if it's not set.
+
+        If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir`
+        instead.
+
+        For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set.
+        """
+        path = os.environ.get("XDG_RUNTIME_DIR", "")
+        if not path.strip():
+            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
+                path = "/var/run"
+            else:
+                path = "/run"
+        return self._append_app_name_and_version(path)
+
+    @property
+    def site_data_path(self) -> Path:
+        """:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
+        return self._first_item_as_path_if_multipath(self.site_data_dir)
+
+    @property
+    def site_config_path(self) -> Path:
+        """:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``"""
+        return self._first_item_as_path_if_multipath(self.site_config_dir)
+
+    @property
+    def site_cache_path(self) -> Path:
+        """:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
+        return self._first_item_as_path_if_multipath(self.site_cache_dir)
+
+    def _first_item_as_path_if_multipath(self, directory: str) -> Path:
+        if self.multipath:
+            # If multipath is True, the first path is returned.
+            directory = directory.split(os.pathsep)[0]
+        return Path(directory)
+
+    def iter_config_dirs(self) -> Iterator[str]:
+        """:yield: all user and site configuration directories."""
+        yield self.user_config_dir
+        yield from self._site_config_dirs
+
+    def iter_data_dirs(self) -> Iterator[str]:
+        """:yield: all user and site data directories."""
+        yield self.user_data_dir
+        yield from self._site_data_dirs
+
+
+def _get_user_media_dir(env_var: str, fallback_tilde_path: str) -> str:
+    media_dir = _get_user_dirs_folder(env_var)
+    if media_dir is None:
+        media_dir = os.environ.get(env_var, "").strip()
+        if not media_dir:
+            media_dir = os.path.expanduser(fallback_tilde_path)  # noqa: PTH111
+
+    return media_dir
+
+
+def _get_user_dirs_folder(key: str) -> str | None:
+    """
+    Return directory from user-dirs.dirs config file.
+
+    See https://freedesktop.org/wiki/Software/xdg-user-dirs/.
+
+    """
+    user_dirs_config_path = Path(Unix().user_config_dir) / "user-dirs.dirs"
+    if user_dirs_config_path.exists():
+        parser = ConfigParser()
+
+        with user_dirs_config_path.open() as stream:
+            # Add fake section header, so ConfigParser doesn't complain
+            parser.read_string(f"[top]\n{stream.read()}")
+
+        if key not in parser["top"]:
+            return None
+
+        path = parser["top"][key].strip('"')
+        # Handle relative home paths
+        return path.replace("$HOME", os.path.expanduser("~"))  # noqa: PTH111
+
+    return None
+
+
+__all__ = [
+    "Unix",
+]
diff --git a/setuptools/_vendor/platformdirs/version.py b/setuptools/_vendor/platformdirs/version.py
new file mode 100644
index 0000000000..6483ddce0b
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/version.py
@@ -0,0 +1,16 @@
+# file generated by setuptools_scm
+# don't change, don't track in version control
+TYPE_CHECKING = False
+if TYPE_CHECKING:
+    from typing import Tuple, Union
+    VERSION_TUPLE = Tuple[Union[int, str], ...]
+else:
+    VERSION_TUPLE = object
+
+version: str
+__version__: str
+__version_tuple__: VERSION_TUPLE
+version_tuple: VERSION_TUPLE
+
+__version__ = version = '4.2.2'
+__version_tuple__ = version_tuple = (4, 2, 2)
diff --git a/setuptools/_vendor/platformdirs/windows.py b/setuptools/_vendor/platformdirs/windows.py
new file mode 100644
index 0000000000..d7bc96091a
--- /dev/null
+++ b/setuptools/_vendor/platformdirs/windows.py
@@ -0,0 +1,272 @@
+"""Windows."""
+
+from __future__ import annotations
+
+import os
+import sys
+from functools import lru_cache
+from typing import TYPE_CHECKING
+
+from .api import PlatformDirsABC
+
+if TYPE_CHECKING:
+    from collections.abc import Callable
+
+
+class Windows(PlatformDirsABC):
+    """
+    `MSDN on where to store app data files `_.
+
+    Makes use of the `appname `, `appauthor
+    `, `version `, `roaming
+    `, `opinion `, `ensure_exists
+    `.
+
+    """
+
+    @property
+    def user_data_dir(self) -> str:
+        """
+        :return: data directory tied to the user, e.g.
+         ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname`` (not roaming) or
+         ``%USERPROFILE%\\AppData\\Roaming\\$appauthor\\$appname`` (roaming)
+        """
+        const = "CSIDL_APPDATA" if self.roaming else "CSIDL_LOCAL_APPDATA"
+        path = os.path.normpath(get_win_folder(const))
+        return self._append_parts(path)
+
+    def _append_parts(self, path: str, *, opinion_value: str | None = None) -> str:
+        params = []
+        if self.appname:
+            if self.appauthor is not False:
+                author = self.appauthor or self.appname
+                params.append(author)
+            params.append(self.appname)
+            if opinion_value is not None and self.opinion:
+                params.append(opinion_value)
+            if self.version:
+                params.append(self.version)
+        path = os.path.join(path, *params)  # noqa: PTH118
+        self._optionally_create_directory(path)
+        return path
+
+    @property
+    def site_data_dir(self) -> str:
+        """:return: data directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname``"""
+        path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
+        return self._append_parts(path)
+
+    @property
+    def user_config_dir(self) -> str:
+        """:return: config directory tied to the user, same as `user_data_dir`"""
+        return self.user_data_dir
+
+    @property
+    def site_config_dir(self) -> str:
+        """:return: config directory shared by the users, same as `site_data_dir`"""
+        return self.site_data_dir
+
+    @property
+    def user_cache_dir(self) -> str:
+        """
+        :return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g.
+         ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname\\Cache\\$version``
+        """
+        path = os.path.normpath(get_win_folder("CSIDL_LOCAL_APPDATA"))
+        return self._append_parts(path, opinion_value="Cache")
+
+    @property
+    def site_cache_dir(self) -> str:
+        """:return: cache directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname\\Cache\\$version``"""
+        path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
+        return self._append_parts(path, opinion_value="Cache")
+
+    @property
+    def user_state_dir(self) -> str:
+        """:return: state directory tied to the user, same as `user_data_dir`"""
+        return self.user_data_dir
+
+    @property
+    def user_log_dir(self) -> str:
+        """:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it"""
+        path = self.user_data_dir
+        if self.opinion:
+            path = os.path.join(path, "Logs")  # noqa: PTH118
+            self._optionally_create_directory(path)
+        return path
+
+    @property
+    def user_documents_dir(self) -> str:
+        """:return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``"""
+        return os.path.normpath(get_win_folder("CSIDL_PERSONAL"))
+
+    @property
+    def user_downloads_dir(self) -> str:
+        """:return: downloads directory tied to the user e.g. ``%USERPROFILE%\\Downloads``"""
+        return os.path.normpath(get_win_folder("CSIDL_DOWNLOADS"))
+
+    @property
+    def user_pictures_dir(self) -> str:
+        """:return: pictures directory tied to the user e.g. ``%USERPROFILE%\\Pictures``"""
+        return os.path.normpath(get_win_folder("CSIDL_MYPICTURES"))
+
+    @property
+    def user_videos_dir(self) -> str:
+        """:return: videos directory tied to the user e.g. ``%USERPROFILE%\\Videos``"""
+        return os.path.normpath(get_win_folder("CSIDL_MYVIDEO"))
+
+    @property
+    def user_music_dir(self) -> str:
+        """:return: music directory tied to the user e.g. ``%USERPROFILE%\\Music``"""
+        return os.path.normpath(get_win_folder("CSIDL_MYMUSIC"))
+
+    @property
+    def user_desktop_dir(self) -> str:
+        """:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\\Desktop``"""
+        return os.path.normpath(get_win_folder("CSIDL_DESKTOPDIRECTORY"))
+
+    @property
+    def user_runtime_dir(self) -> str:
+        """
+        :return: runtime directory tied to the user, e.g.
+         ``%USERPROFILE%\\AppData\\Local\\Temp\\$appauthor\\$appname``
+        """
+        path = os.path.normpath(os.path.join(get_win_folder("CSIDL_LOCAL_APPDATA"), "Temp"))  # noqa: PTH118
+        return self._append_parts(path)
+
+    @property
+    def site_runtime_dir(self) -> str:
+        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
+        return self.user_runtime_dir
+
+
+def get_win_folder_from_env_vars(csidl_name: str) -> str:
+    """Get folder from environment variables."""
+    result = get_win_folder_if_csidl_name_not_env_var(csidl_name)
+    if result is not None:
+        return result
+
+    env_var_name = {
+        "CSIDL_APPDATA": "APPDATA",
+        "CSIDL_COMMON_APPDATA": "ALLUSERSPROFILE",
+        "CSIDL_LOCAL_APPDATA": "LOCALAPPDATA",
+    }.get(csidl_name)
+    if env_var_name is None:
+        msg = f"Unknown CSIDL name: {csidl_name}"
+        raise ValueError(msg)
+    result = os.environ.get(env_var_name)
+    if result is None:
+        msg = f"Unset environment variable: {env_var_name}"
+        raise ValueError(msg)
+    return result
+
+
+def get_win_folder_if_csidl_name_not_env_var(csidl_name: str) -> str | None:
+    """Get a folder for a CSIDL name that does not exist as an environment variable."""
+    if csidl_name == "CSIDL_PERSONAL":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Documents")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_DOWNLOADS":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Downloads")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_MYPICTURES":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Pictures")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_MYVIDEO":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Videos")  # noqa: PTH118
+
+    if csidl_name == "CSIDL_MYMUSIC":
+        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Music")  # noqa: PTH118
+    return None
+
+
+def get_win_folder_from_registry(csidl_name: str) -> str:
+    """
+    Get folder from the registry.
+
+    This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer
+    for all CSIDL_* names.
+
+    """
+    shell_folder_name = {
+        "CSIDL_APPDATA": "AppData",
+        "CSIDL_COMMON_APPDATA": "Common AppData",
+        "CSIDL_LOCAL_APPDATA": "Local AppData",
+        "CSIDL_PERSONAL": "Personal",
+        "CSIDL_DOWNLOADS": "{374DE290-123F-4565-9164-39C4925E467B}",
+        "CSIDL_MYPICTURES": "My Pictures",
+        "CSIDL_MYVIDEO": "My Video",
+        "CSIDL_MYMUSIC": "My Music",
+    }.get(csidl_name)
+    if shell_folder_name is None:
+        msg = f"Unknown CSIDL name: {csidl_name}"
+        raise ValueError(msg)
+    if sys.platform != "win32":  # only needed for mypy type checker to know that this code runs only on Windows
+        raise NotImplementedError
+    import winreg  # noqa: PLC0415
+
+    key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
+    directory, _ = winreg.QueryValueEx(key, shell_folder_name)
+    return str(directory)
+
+
+def get_win_folder_via_ctypes(csidl_name: str) -> str:
+    """Get folder with ctypes."""
+    # There is no 'CSIDL_DOWNLOADS'.
+    # Use 'CSIDL_PROFILE' (40) and append the default folder 'Downloads' instead.
+    # https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid
+
+    import ctypes  # noqa: PLC0415
+
+    csidl_const = {
+        "CSIDL_APPDATA": 26,
+        "CSIDL_COMMON_APPDATA": 35,
+        "CSIDL_LOCAL_APPDATA": 28,
+        "CSIDL_PERSONAL": 5,
+        "CSIDL_MYPICTURES": 39,
+        "CSIDL_MYVIDEO": 14,
+        "CSIDL_MYMUSIC": 13,
+        "CSIDL_DOWNLOADS": 40,
+        "CSIDL_DESKTOPDIRECTORY": 16,
+    }.get(csidl_name)
+    if csidl_const is None:
+        msg = f"Unknown CSIDL name: {csidl_name}"
+        raise ValueError(msg)
+
+    buf = ctypes.create_unicode_buffer(1024)
+    windll = getattr(ctypes, "windll")  # noqa: B009 # using getattr to avoid false positive with mypy type checker
+    windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
+
+    # Downgrade to short path name if it has high-bit chars.
+    if any(ord(c) > 255 for c in buf):  # noqa: PLR2004
+        buf2 = ctypes.create_unicode_buffer(1024)
+        if windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
+            buf = buf2
+
+    if csidl_name == "CSIDL_DOWNLOADS":
+        return os.path.join(buf.value, "Downloads")  # noqa: PTH118
+
+    return buf.value
+
+
+def _pick_get_win_folder() -> Callable[[str], str]:
+    try:
+        import ctypes  # noqa: PLC0415
+    except ImportError:
+        pass
+    else:
+        if hasattr(ctypes, "windll"):
+            return get_win_folder_via_ctypes
+    try:
+        import winreg  # noqa: PLC0415, F401
+    except ImportError:
+        return get_win_folder_from_env_vars
+    else:
+        return get_win_folder_from_registry
+
+
+get_win_folder = lru_cache(maxsize=None)(_pick_get_win_folder())
+
+__all__ = [
+    "Windows",
+]

From 8b4b9d0c46b01511bcba053c545af7804cbf6f34 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:25:08 -0400
Subject: [PATCH 124/151] Consolidate vendored packages in the setuptools
 package.

Now that the vendoring doesn't depend on importing the setuptools package, it's safe for pkg_resources to import _from_ there without actually importing setuptools.
---
 pkg_resources/__init__.py                     |    2 +-
 .../autocommand-2.2.2.dist-info/INSTALLER     |    1 -
 .../autocommand-2.2.2.dist-info/LICENSE       |  166 -
 .../autocommand-2.2.2.dist-info/METADATA      |  420 --
 .../autocommand-2.2.2.dist-info/RECORD        |   18 -
 .../_vendor/autocommand-2.2.2.dist-info/WHEEL |    5 -
 .../autocommand-2.2.2.dist-info/top_level.txt |    1 -
 pkg_resources/_vendor/autocommand/__init__.py |   27 -
 .../_vendor/autocommand/autoasync.py          |  142 -
 .../_vendor/autocommand/autocommand.py        |   70 -
 pkg_resources/_vendor/autocommand/automain.py |   59 -
 .../_vendor/autocommand/autoparse.py          |  333 --
 pkg_resources/_vendor/autocommand/errors.py   |   23 -
 .../INSTALLER                                 |    1 -
 .../backports.tarfile-1.2.0.dist-info/LICENSE |   17 -
 .../METADATA                                  |   46 -
 .../backports.tarfile-1.2.0.dist-info/RECORD  |   17 -
 .../REQUESTED                                 |    0
 .../backports.tarfile-1.2.0.dist-info/WHEEL   |    5 -
 .../top_level.txt                             |    1 -
 pkg_resources/_vendor/backports/__init__.py   |    1 -
 .../_vendor/backports/tarfile/__init__.py     | 2937 ----------
 .../_vendor/backports/tarfile/__main__.py     |    5 -
 .../backports/tarfile/compat/__init__.py      |    0
 .../_vendor/backports/tarfile/compat/py38.py  |   24 -
 .../INSTALLER                                 |    1 -
 .../LICENSE                                   |  202 -
 .../METADATA                                  |  100 -
 .../RECORD                                    |   89 -
 .../REQUESTED                                 |    0
 .../importlib_resources-6.4.0.dist-info/WHEEL |    5 -
 .../top_level.txt                             |    1 -
 .../_vendor/importlib_resources/__init__.py   |   36 -
 .../_vendor/importlib_resources/_adapters.py  |  168 -
 .../_vendor/importlib_resources/_common.py    |  210 -
 .../_vendor/importlib_resources/_itertools.py |   38 -
 .../_vendor/importlib_resources/abc.py        |  171 -
 .../importlib_resources/compat/__init__.py    |    0
 .../importlib_resources/compat/py38.py        |   11 -
 .../importlib_resources/compat/py39.py        |   10 -
 .../_vendor/importlib_resources/functional.py |   81 -
 .../importlib_resources/future/__init__.py    |    0
 .../importlib_resources/future/adapters.py    |   95 -
 .../_vendor/importlib_resources/py.typed      |    0
 .../_vendor/importlib_resources/readers.py    |  194 -
 .../_vendor/importlib_resources/simple.py     |  106 -
 .../importlib_resources/tests/__init__.py     |    0
 .../importlib_resources/tests/_path.py        |   56 -
 .../tests/compat/__init__.py                  |    0
 .../importlib_resources/tests/compat/py312.py |   18 -
 .../importlib_resources/tests/compat/py39.py  |   10 -
 .../tests/data01/__init__.py                  |    0
 .../tests/data01/binary.file                  |  Bin 4 -> 0 bytes
 .../tests/data01/subdirectory/__init__.py     |    0
 .../tests/data01/subdirectory/binary.file     |    1 -
 .../tests/data01/utf-16.file                  |  Bin 44 -> 0 bytes
 .../tests/data01/utf-8.file                   |    1 -
 .../tests/data02/__init__.py                  |    0
 .../tests/data02/one/__init__.py              |    0
 .../tests/data02/one/resource1.txt            |    1 -
 .../subdirectory/subsubdir/resource.txt       |    1 -
 .../tests/data02/two/__init__.py              |    0
 .../tests/data02/two/resource2.txt            |    1 -
 .../tests/namespacedata01/binary.file         |  Bin 4 -> 0 bytes
 .../namespacedata01/subdirectory/binary.file  |    1 -
 .../tests/namespacedata01/utf-16.file         |  Bin 44 -> 0 bytes
 .../tests/namespacedata01/utf-8.file          |    1 -
 .../tests/test_compatibilty_files.py          |  104 -
 .../tests/test_contents.py                    |   43 -
 .../importlib_resources/tests/test_custom.py  |   47 -
 .../importlib_resources/tests/test_files.py   |  117 -
 .../tests/test_functional.py                  |  242 -
 .../importlib_resources/tests/test_open.py    |   89 -
 .../importlib_resources/tests/test_path.py    |   65 -
 .../importlib_resources/tests/test_read.py    |   97 -
 .../importlib_resources/tests/test_reader.py  |  145 -
 .../tests/test_resource.py                    |  241 -
 .../_vendor/importlib_resources/tests/util.py |  164 -
 .../_vendor/importlib_resources/tests/zip.py  |   32 -
 .../_vendor/inflect-7.3.1.dist-info/INSTALLER |    1 -
 .../_vendor/inflect-7.3.1.dist-info/LICENSE   |   17 -
 .../_vendor/inflect-7.3.1.dist-info/METADATA  |  591 --
 .../_vendor/inflect-7.3.1.dist-info/RECORD    |   13 -
 .../_vendor/inflect-7.3.1.dist-info/WHEEL     |    5 -
 .../inflect-7.3.1.dist-info/top_level.txt     |    1 -
 pkg_resources/_vendor/inflect/__init__.py     | 3986 --------------
 .../_vendor/inflect/compat/__init__.py        |    0
 pkg_resources/_vendor/inflect/compat/py38.py  |    7 -
 pkg_resources/_vendor/inflect/py.typed        |    0
 .../jaraco.context-5.3.0.dist-info/INSTALLER  |    1 -
 .../jaraco.context-5.3.0.dist-info/LICENSE    |   17 -
 .../jaraco.context-5.3.0.dist-info/METADATA   |   75 -
 .../jaraco.context-5.3.0.dist-info/RECORD     |    8 -
 .../jaraco.context-5.3.0.dist-info/WHEEL      |    5 -
 .../top_level.txt                             |    1 -
 .../INSTALLER                                 |    1 -
 .../jaraco.functools-4.0.1.dist-info/LICENSE  |   17 -
 .../jaraco.functools-4.0.1.dist-info/METADATA |   64 -
 .../jaraco.functools-4.0.1.dist-info/RECORD   |   10 -
 .../jaraco.functools-4.0.1.dist-info/WHEEL    |    5 -
 .../top_level.txt                             |    1 -
 .../jaraco.text-3.12.1.dist-info/INSTALLER    |    1 -
 .../jaraco.text-3.12.1.dist-info/LICENSE      |   17 -
 .../jaraco.text-3.12.1.dist-info/METADATA     |   95 -
 .../jaraco.text-3.12.1.dist-info/RECORD       |   20 -
 .../jaraco.text-3.12.1.dist-info/REQUESTED    |    0
 .../jaraco.text-3.12.1.dist-info/WHEEL        |    5 -
 .../top_level.txt                             |    1 -
 pkg_resources/_vendor/jaraco/context.py       |  361 --
 .../_vendor/jaraco/functools/__init__.py      |  633 ---
 .../_vendor/jaraco/functools/__init__.pyi     |  125 -
 .../_vendor/jaraco/functools/py.typed         |    0
 .../_vendor/jaraco/text/Lorem ipsum.txt       |    2 -
 pkg_resources/_vendor/jaraco/text/__init__.py |  624 ---
 pkg_resources/_vendor/jaraco/text/layouts.py  |   25 -
 .../_vendor/jaraco/text/show-newlines.py      |   33 -
 .../_vendor/jaraco/text/strip-prefix.py       |   21 -
 .../_vendor/jaraco/text/to-dvorak.py          |    6 -
 .../_vendor/jaraco/text/to-qwerty.py          |    6 -
 .../more_itertools-10.3.0.dist-info/INSTALLER |    1 -
 .../more_itertools-10.3.0.dist-info/LICENSE   |   19 -
 .../more_itertools-10.3.0.dist-info/METADATA  |  266 -
 .../more_itertools-10.3.0.dist-info/RECORD    |   15 -
 .../more_itertools-10.3.0.dist-info/WHEEL     |    4 -
 .../_vendor/more_itertools/__init__.py        |    6 -
 .../_vendor/more_itertools/__init__.pyi       |    2 -
 pkg_resources/_vendor/more_itertools/more.py  | 4806 -----------------
 pkg_resources/_vendor/more_itertools/more.pyi |  709 ---
 pkg_resources/_vendor/more_itertools/py.typed |    0
 .../_vendor/more_itertools/recipes.py         | 1046 ----
 .../_vendor/more_itertools/recipes.pyi        |  136 -
 .../packaging-24.1.dist-info/INSTALLER        |    1 -
 .../_vendor/packaging-24.1.dist-info/LICENSE  |    3 -
 .../packaging-24.1.dist-info/LICENSE.APACHE   |  177 -
 .../packaging-24.1.dist-info/LICENSE.BSD      |   23 -
 .../_vendor/packaging-24.1.dist-info/METADATA |  102 -
 .../_vendor/packaging-24.1.dist-info/RECORD   |   37 -
 .../packaging-24.1.dist-info/REQUESTED        |    0
 .../_vendor/packaging-24.1.dist-info/WHEEL    |    4 -
 pkg_resources/_vendor/packaging/__init__.py   |   15 -
 pkg_resources/_vendor/packaging/_elffile.py   |  110 -
 pkg_resources/_vendor/packaging/_manylinux.py |  262 -
 pkg_resources/_vendor/packaging/_musllinux.py |   85 -
 pkg_resources/_vendor/packaging/_parser.py    |  354 --
 .../_vendor/packaging/_structures.py          |   61 -
 pkg_resources/_vendor/packaging/_tokenizer.py |  194 -
 pkg_resources/_vendor/packaging/markers.py    |  325 --
 pkg_resources/_vendor/packaging/metadata.py   |  804 ---
 pkg_resources/_vendor/packaging/py.typed      |    0
 .../_vendor/packaging/requirements.py         |   91 -
 pkg_resources/_vendor/packaging/specifiers.py | 1009 ----
 pkg_resources/_vendor/packaging/tags.py       |  568 --
 pkg_resources/_vendor/packaging/utils.py      |  174 -
 pkg_resources/_vendor/packaging/version.py    |  563 --
 .../platformdirs-4.2.2.dist-info/INSTALLER    |    1 -
 .../platformdirs-4.2.2.dist-info/METADATA     |  319 --
 .../platformdirs-4.2.2.dist-info/RECORD       |   23 -
 .../platformdirs-4.2.2.dist-info/REQUESTED    |    0
 .../platformdirs-4.2.2.dist-info/WHEEL        |    4 -
 .../licenses/LICENSE                          |   21 -
 .../_vendor/platformdirs/__init__.py          |  627 ---
 .../_vendor/platformdirs/__main__.py          |   55 -
 pkg_resources/_vendor/platformdirs/android.py |  249 -
 pkg_resources/_vendor/platformdirs/api.py     |  292 -
 pkg_resources/_vendor/platformdirs/macos.py   |  130 -
 pkg_resources/_vendor/platformdirs/py.typed   |    0
 pkg_resources/_vendor/platformdirs/unix.py    |  275 -
 pkg_resources/_vendor/platformdirs/version.py |   16 -
 pkg_resources/_vendor/platformdirs/windows.py |  272 -
 pkg_resources/_vendor/ruff.toml               |    1 -
 .../typeguard-4.3.0.dist-info/INSTALLER       |    1 -
 .../_vendor/typeguard-4.3.0.dist-info/LICENSE |   19 -
 .../typeguard-4.3.0.dist-info/METADATA        |   81 -
 .../_vendor/typeguard-4.3.0.dist-info/RECORD  |   34 -
 .../_vendor/typeguard-4.3.0.dist-info/WHEEL   |    5 -
 .../entry_points.txt                          |    2 -
 .../typeguard-4.3.0.dist-info/top_level.txt   |    1 -
 pkg_resources/_vendor/typeguard/__init__.py   |   48 -
 pkg_resources/_vendor/typeguard/_checkers.py  |  993 ----
 pkg_resources/_vendor/typeguard/_config.py    |  108 -
 .../_vendor/typeguard/_decorators.py          |  235 -
 .../_vendor/typeguard/_exceptions.py          |   42 -
 pkg_resources/_vendor/typeguard/_functions.py |  308 --
 .../_vendor/typeguard/_importhook.py          |  213 -
 pkg_resources/_vendor/typeguard/_memo.py      |   48 -
 .../_vendor/typeguard/_pytest_plugin.py       |  127 -
 .../_vendor/typeguard/_suppression.py         |   86 -
 .../_vendor/typeguard/_transformer.py         | 1229 -----
 .../_vendor/typeguard/_union_transformer.py   |   55 -
 pkg_resources/_vendor/typeguard/_utils.py     |  173 -
 pkg_resources/_vendor/typeguard/py.typed      |    0
 .../INSTALLER                                 |    1 -
 .../LICENSE                                   |  279 -
 .../METADATA                                  |   67 -
 .../typing_extensions-4.12.2.dist-info/RECORD |    7 -
 .../typing_extensions-4.12.2.dist-info/WHEEL  |    4 -
 pkg_resources/_vendor/typing_extensions.py    | 3641 -------------
 .../_vendor/zipp-3.19.2.dist-info/INSTALLER   |    1 -
 .../_vendor/zipp-3.19.2.dist-info/LICENSE     |   17 -
 .../_vendor/zipp-3.19.2.dist-info/METADATA    |  102 -
 .../_vendor/zipp-3.19.2.dist-info/RECORD      |   15 -
 .../_vendor/zipp-3.19.2.dist-info/REQUESTED   |    0
 .../_vendor/zipp-3.19.2.dist-info/WHEEL       |    5 -
 .../zipp-3.19.2.dist-info/top_level.txt       |    1 -
 pkg_resources/_vendor/zipp/__init__.py        |  501 --
 pkg_resources/_vendor/zipp/compat/__init__.py |    0
 pkg_resources/_vendor/zipp/compat/py310.py    |   11 -
 pkg_resources/_vendor/zipp/glob.py            |  106 -
 tools/vendored.py                             |   18 -
 209 files changed, 1 insertion(+), 36957 deletions(-)
 delete mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/autocommand/__init__.py
 delete mode 100644 pkg_resources/_vendor/autocommand/autoasync.py
 delete mode 100644 pkg_resources/_vendor/autocommand/autocommand.py
 delete mode 100644 pkg_resources/_vendor/autocommand/automain.py
 delete mode 100644 pkg_resources/_vendor/autocommand/autoparse.py
 delete mode 100644 pkg_resources/_vendor/autocommand/errors.py
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/backports/__init__.py
 delete mode 100644 pkg_resources/_vendor/backports/tarfile/__init__.py
 delete mode 100644 pkg_resources/_vendor/backports/tarfile/__main__.py
 delete mode 100644 pkg_resources/_vendor/backports/tarfile/compat/__init__.py
 delete mode 100644 pkg_resources/_vendor/backports/tarfile/compat/py38.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/REQUESTED
 delete mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/importlib_resources/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/_adapters.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/_common.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/_itertools.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/abc.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/compat/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/compat/py38.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/compat/py39.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/functional.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/future/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/future/adapters.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/py.typed
 delete mode 100644 pkg_resources/_vendor/importlib_resources/readers.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/simple.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/_path.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/compat/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/compat/py312.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/compat/py39.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data01/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data01/binary.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/binary.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data01/utf-16.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data01/utf-8.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data02/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data02/one/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data02/one/resource1.txt
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data02/two/__init__.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/data02/two/resource2.txt
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/namespacedata01/binary.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/namespacedata01/utf-16.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/namespacedata01/utf-8.file
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_contents.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_custom.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_files.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_functional.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_open.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_path.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_read.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_reader.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/test_resource.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/util.py
 delete mode 100644 pkg_resources/_vendor/importlib_resources/tests/zip.py
 delete mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/inflect/__init__.py
 delete mode 100644 pkg_resources/_vendor/inflect/compat/__init__.py
 delete mode 100644 pkg_resources/_vendor/inflect/compat/py38.py
 delete mode 100644 pkg_resources/_vendor/inflect/py.typed
 delete mode 100644 pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/jaraco/context.py
 delete mode 100644 pkg_resources/_vendor/jaraco/functools/__init__.py
 delete mode 100644 pkg_resources/_vendor/jaraco/functools/__init__.pyi
 delete mode 100644 pkg_resources/_vendor/jaraco/functools/py.typed
 delete mode 100644 pkg_resources/_vendor/jaraco/text/Lorem ipsum.txt
 delete mode 100644 pkg_resources/_vendor/jaraco/text/__init__.py
 delete mode 100644 pkg_resources/_vendor/jaraco/text/layouts.py
 delete mode 100644 pkg_resources/_vendor/jaraco/text/show-newlines.py
 delete mode 100644 pkg_resources/_vendor/jaraco/text/strip-prefix.py
 delete mode 100644 pkg_resources/_vendor/jaraco/text/to-dvorak.py
 delete mode 100644 pkg_resources/_vendor/jaraco/text/to-qwerty.py
 delete mode 100644 pkg_resources/_vendor/more_itertools-10.3.0.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/more_itertools-10.3.0.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/more_itertools-10.3.0.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/more_itertools-10.3.0.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/more_itertools/__init__.py
 delete mode 100644 pkg_resources/_vendor/more_itertools/__init__.pyi
 delete mode 100755 pkg_resources/_vendor/more_itertools/more.py
 delete mode 100644 pkg_resources/_vendor/more_itertools/more.pyi
 delete mode 100644 pkg_resources/_vendor/more_itertools/py.typed
 delete mode 100644 pkg_resources/_vendor/more_itertools/recipes.py
 delete mode 100644 pkg_resources/_vendor/more_itertools/recipes.pyi
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.APACHE
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.BSD
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/REQUESTED
 delete mode 100644 pkg_resources/_vendor/packaging-24.1.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/packaging/__init__.py
 delete mode 100644 pkg_resources/_vendor/packaging/_elffile.py
 delete mode 100644 pkg_resources/_vendor/packaging/_manylinux.py
 delete mode 100644 pkg_resources/_vendor/packaging/_musllinux.py
 delete mode 100644 pkg_resources/_vendor/packaging/_parser.py
 delete mode 100644 pkg_resources/_vendor/packaging/_structures.py
 delete mode 100644 pkg_resources/_vendor/packaging/_tokenizer.py
 delete mode 100644 pkg_resources/_vendor/packaging/markers.py
 delete mode 100644 pkg_resources/_vendor/packaging/metadata.py
 delete mode 100644 pkg_resources/_vendor/packaging/py.typed
 delete mode 100644 pkg_resources/_vendor/packaging/requirements.py
 delete mode 100644 pkg_resources/_vendor/packaging/specifiers.py
 delete mode 100644 pkg_resources/_vendor/packaging/tags.py
 delete mode 100644 pkg_resources/_vendor/packaging/utils.py
 delete mode 100644 pkg_resources/_vendor/packaging/version.py
 delete mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/REQUESTED
 delete mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
 delete mode 100644 pkg_resources/_vendor/platformdirs/__init__.py
 delete mode 100644 pkg_resources/_vendor/platformdirs/__main__.py
 delete mode 100644 pkg_resources/_vendor/platformdirs/android.py
 delete mode 100644 pkg_resources/_vendor/platformdirs/api.py
 delete mode 100644 pkg_resources/_vendor/platformdirs/macos.py
 delete mode 100644 pkg_resources/_vendor/platformdirs/py.typed
 delete mode 100644 pkg_resources/_vendor/platformdirs/unix.py
 delete mode 100644 pkg_resources/_vendor/platformdirs/version.py
 delete mode 100644 pkg_resources/_vendor/platformdirs/windows.py
 delete mode 100644 pkg_resources/_vendor/ruff.toml
 delete mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
 delete mode 100644 pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/typeguard/__init__.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_checkers.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_config.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_decorators.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_exceptions.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_functions.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_importhook.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_memo.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_pytest_plugin.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_suppression.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_transformer.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_union_transformer.py
 delete mode 100644 pkg_resources/_vendor/typeguard/_utils.py
 delete mode 100644 pkg_resources/_vendor/typeguard/py.typed
 delete mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/typing_extensions.py
 delete mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER
 delete mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE
 delete mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA
 delete mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD
 delete mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/REQUESTED
 delete mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL
 delete mode 100644 pkg_resources/_vendor/zipp-3.19.2.dist-info/top_level.txt
 delete mode 100644 pkg_resources/_vendor/zipp/__init__.py
 delete mode 100644 pkg_resources/_vendor/zipp/compat/__init__.py
 delete mode 100644 pkg_resources/_vendor/zipp/compat/py310.py
 delete mode 100644 pkg_resources/_vendor/zipp/glob.py

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 4b7887e9f4..e53525032c 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -74,7 +74,7 @@
 
 import _imp
 
-sys.path.append(os.path.dirname(__file__) + '/_vendor')
+sys.path.append(os.path.dirname(__file__) + '/../setuptools/_vendor')
 
 # capture these to bypass sandboxing
 from os import utime
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/INSTALLER b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE
deleted file mode 100644
index b49c3af060..0000000000
--- a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/LICENSE
+++ /dev/null
@@ -1,166 +0,0 @@
-GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. 
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions.
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
-   a) Give prominent notice with each copy of the Combined Work that
-   the Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
-   document.
-
-   c) For a Combined Work that displays copyright notices during
-   execution, include the copyright notice for the Library among
-   these notices, as well as a reference directing the user to the
-   copies of the GNU GPL and this license document.
-
-   d) Do one of the following:
-
-       0) Convey the Minimal Corresponding Source under the terms of this
-       License, and the Corresponding Application Code in a form
-       suitable for, and under terms that permit, the user to
-       recombine or relink the Application with a modified version of
-       the Linked Version to produce a modified Combined Work, in the
-       manner specified by section 6 of the GNU GPL for conveying
-       Corresponding Source.
-
-       1) Use a suitable shared library mechanism for linking with the
-       Library.  A suitable mechanism is one that (a) uses at run time
-       a copy of the Library already present on the user's computer
-       system, and (b) will operate properly with a modified version
-       of the Library that is interface-compatible with the Linked
-       Version.
-
-   e) Provide Installation Information, but only if you would otherwise
-   be required to provide such information under section 6 of the
-   GNU GPL, and only to the extent that such information is
-   necessary to install and execute a modified version of the
-   Combined Work produced by recombining or relinking the
-   Application with a modified version of the Linked Version. (If
-   you use option 4d0, the Installation Information must accompany
-   the Minimal Corresponding Source and Corresponding Application
-   Code. If you use option 4d1, you must provide the Installation
-   Information in the manner specified by section 6 of the GNU GPL
-   for conveying Corresponding Source.)
-
-  5. Combined Libraries.
-
-  You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
-   a) Accompany the combined library with a copy of the same work based
-   on the Library, uncombined with any other library facilities,
-   conveyed under the terms of this License.
-
-   b) Give prominent notice with the combined library that part of it
-   is a work based on the Library, and explaining where to find the
-   accompanying uncombined form of the same work.
-
-  6. Revised Versions of the GNU Lesser General Public License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-  Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
-  If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
-
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA
deleted file mode 100644
index 32214fb440..0000000000
--- a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/METADATA
+++ /dev/null
@@ -1,420 +0,0 @@
-Metadata-Version: 2.1
-Name: autocommand
-Version: 2.2.2
-Summary: A library to create a command-line program from a function
-Home-page: https://github.com/Lucretiel/autocommand
-Author: Nathan West
-License: LGPLv3
-Project-URL: Homepage, https://github.com/Lucretiel/autocommand
-Project-URL: Bug Tracker, https://github.com/Lucretiel/autocommand/issues
-Platform: any
-Classifier: Development Status :: 6 - Mature
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Topic :: Software Development
-Classifier: Topic :: Software Development :: Libraries
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=3.7
-Description-Content-Type: text/markdown
-License-File: LICENSE
-
-[![PyPI version](https://badge.fury.io/py/autocommand.svg)](https://badge.fury.io/py/autocommand)
-
-# autocommand
-
-A library to automatically generate and run simple argparse parsers from function signatures.
-
-## Installation
-
-Autocommand is installed via pip:
-
-```
-$ pip install autocommand
-```
-
-## Usage
-
-Autocommand turns a function into a command-line program. It converts the function's parameter signature into command-line arguments, and automatically runs the function if the module was called as `__main__`. In effect, it lets your create a smart main function.
-
-```python
-from autocommand import autocommand
-
-# This program takes exactly one argument and echos it.
-@autocommand(__name__)
-def echo(thing):
-    print(thing)
-```
-
-```
-$ python echo.py hello
-hello
-$ python echo.py -h
-usage: echo [-h] thing
-
-positional arguments:
-  thing
-
-optional arguments:
-  -h, --help  show this help message and exit
-$ python echo.py hello world  # too many arguments
-usage: echo.py [-h] thing
-echo.py: error: unrecognized arguments: world
-```
-
-As you can see, autocommand converts the signature of the function into an argument spec. When you run the file as a program, autocommand collects the command-line arguments and turns them into function arguments. The function is executed with these arguments, and then the program exits with the return value of the function, via `sys.exit`. Autocommand also automatically creates a usage message, which can be invoked with `-h` or `--help`, and automatically prints an error message when provided with invalid arguments.
-
-### Types
-
-You can use a type annotation to give an argument a type. Any type (or in fact any callable) that returns an object when given a string argument can be used, though there are a few special cases that are described later.
-
-```python
-@autocommand(__name__)
-def net_client(host, port: int):
-    ...
-```
-
-Autocommand will catch `TypeErrors` raised by the type during argument parsing, so you can supply a callable and do some basic argument validation as well.
-
-### Trailing Arguments
-
-You can add a `*args` parameter to your function to give it trailing arguments. The command will collect 0 or more trailing arguments and supply them to `args` as a tuple. If a type annotation is supplied, the type is applied to each argument.
-
-```python
-# Write the contents of each file, one by one
-@autocommand(__name__)
-def cat(*files):
-    for filename in files:
-        with open(filename) as file:
-            for line in file:
-                print(line.rstrip())
-```
-
-```
-$ python cat.py -h
-usage: ipython [-h] [file [file ...]]
-
-positional arguments:
-  file
-
-optional arguments:
-  -h, --help  show this help message and exit
-```
-
-### Options
-
-To create `--option` switches, just assign a default. Autocommand will automatically create `--long` and `-s`hort switches.
-
-```python
-@autocommand(__name__)
-def do_with_config(argument, config='~/foo.conf'):
-    pass
-```
-
-```
-$ python example.py -h
-usage: example.py [-h] [-c CONFIG] argument
-
-positional arguments:
-  argument
-
-optional arguments:
-  -h, --help            show this help message and exit
-  -c CONFIG, --config CONFIG
-```
-
-The option's type is automatically deduced from the default, unless one is explicitly given in an annotation:
-
-```python
-@autocommand(__name__)
-def http_connect(host, port=80):
-    print('{}:{}'.format(host, port))
-```
-
-```
-$ python http.py -h
-usage: http.py [-h] [-p PORT] host
-
-positional arguments:
-  host
-
-optional arguments:
-  -h, --help            show this help message and exit
-  -p PORT, --port PORT
-$ python http.py localhost
-localhost:80
-$ python http.py localhost -p 8080
-localhost:8080
-$ python http.py localhost -p blah
-usage: http.py [-h] [-p PORT] host
-http.py: error: argument -p/--port: invalid int value: 'blah'
-```
-
-#### None
-
-If an option is given a default value of `None`, it reads in a value as normal, but supplies `None` if the option isn't provided.
-
-#### Switches
-
-If an argument is given a default value of `True` or `False`, or
-given an explicit `bool` type, it becomes an option switch.
-
-```python
-    @autocommand(__name__)
-    def example(verbose=False, quiet=False):
-        pass
-```
-
-```
-$ python example.py -h
-usage: example.py [-h] [-v] [-q]
-
-optional arguments:
-  -h, --help     show this help message and exit
-  -v, --verbose
-  -q, --quiet
-```
-
-Autocommand attempts to do the "correct thing" in these cases- if the default is `True`, then supplying the switch makes the argument `False`; if the type is `bool` and the default is some other `True` value, then supplying the switch makes the argument `False`, while not supplying the switch makes the argument the default value.
-
-Autocommand also supports the creation of switch inverters. Pass `add_nos=True` to `autocommand` to enable this.
-
-```
-    @autocommand(__name__, add_nos=True)
-    def example(verbose=False):
-        pass
-```
-
-```
-$ python example.py -h
-usage: ipython [-h] [-v] [--no-verbose]
-
-optional arguments:
-  -h, --help     show this help message and exit
-  -v, --verbose
-  --no-verbose
-```
-
-Using the `--no-` version of a switch will pass the opposite value in as a function argument. If multiple switches are present, the last one takes precedence.
-
-#### Files
-
-If the default value is a file object, such as `sys.stdout`, then autocommand just looks for a string, for a file path. It doesn't do any special checking on the string, though (such as checking if the file exists); it's better to let the client decide how to handle errors in this case. Instead, it provides a special context manager called `smart_open`, which behaves exactly like `open` if a filename or other openable type is provided, but also lets you use already open files:
-
-```python
-from autocommand import autocommand, smart_open
-import sys
-
-# Write the contents of stdin, or a file, to stdout
-@autocommand(__name__)
-def write_out(infile=sys.stdin):
-    with smart_open(infile) as f:
-        for line in f:
-            print(line.rstrip())
-    # If a file was opened, it is closed here. If it was just stdin, it is untouched.
-```
-
-```
-$ echo "Hello World!" | python write_out.py | tee hello.txt
-Hello World!
-$ python write_out.py --infile hello.txt
-Hello World!
-```
-
-### Descriptions and docstrings
-
-The `autocommand` decorator accepts `description` and `epilog` kwargs, corresponding to the `description `_ and `epilog `_ of the `ArgumentParser`. If no description is given, but the decorated function has a docstring, then it is taken as the `description` for the `ArgumentParser`. You can also provide both the description and epilog in the docstring by splitting it into two sections with 4 or more - characters.
-
-```python
-@autocommand(__name__)
-def copy(infile=sys.stdin, outfile=sys.stdout):
-    '''
-    Copy an the contents of a file (or stdin) to another file (or stdout)
-    ----------
-    Some extra documentation in the epilog
-    '''
-    with smart_open(infile) as istr:
-        with smart_open(outfile, 'w') as ostr:
-            for line in istr:
-                ostr.write(line)
-```
-
-```
-$ python copy.py -h
-usage: copy.py [-h] [-i INFILE] [-o OUTFILE]
-
-Copy an the contents of a file (or stdin) to another file (or stdout)
-
-optional arguments:
-  -h, --help            show this help message and exit
-  -i INFILE, --infile INFILE
-  -o OUTFILE, --outfile OUTFILE
-
-Some extra documentation in the epilog
-$ echo "Hello World" | python copy.py --outfile hello.txt
-$ python copy.py --infile hello.txt --outfile hello2.txt
-$ python copy.py --infile hello2.txt
-Hello World
-```
-
-### Parameter descriptions
-
-You can also attach description text to individual parameters in the annotation. To attach both a type and a description, supply them both in any order in a tuple
-
-```python
-@autocommand(__name__)
-def copy_net(
-    infile: 'The name of the file to send',
-    host: 'The host to send the file to',
-    port: (int, 'The port to connect to')):
-
-    '''
-    Copy a file over raw TCP to a remote destination.
-    '''
-    # Left as an exercise to the reader
-```
-
-### Decorators and wrappers
-
-Autocommand automatically follows wrapper chains created by `@functools.wraps`. This means that you can apply other wrapping decorators to your main function, and autocommand will still correctly detect the signature.
-
-```python
-from functools import wraps
-from autocommand import autocommand
-
-def print_yielded(func):
-    '''
-    Convert a generator into a function that prints all yielded elements
-    '''
-    @wraps(func)
-    def wrapper(*args, **kwargs):
-        for thing in func(*args, **kwargs):
-            print(thing)
-    return wrapper
-
-@autocommand(__name__,
-    description= 'Print all the values from START to STOP, inclusive, in steps of STEP',
-    epilog=      'STOP and STEP default to 1')
-@print_yielded
-def seq(stop, start=1, step=1):
-    for i in range(start, stop + 1, step):
-        yield i
-```
-
-```
-$ seq.py -h
-usage: seq.py [-h] [-s START] [-S STEP] stop
-
-Print all the values from START to STOP, inclusive, in steps of STEP
-
-positional arguments:
-  stop
-
-optional arguments:
-  -h, --help            show this help message and exit
-  -s START, --start START
-  -S STEP, --step STEP
-
-STOP and STEP default to 1
-```
-
-Even though autocommand is being applied to the `wrapper` returned by `print_yielded`, it still retreives the signature of the underlying `seq` function to create the argument parsing.
-
-### Custom Parser
-
-While autocommand's automatic parser generator is a powerful convenience, it doesn't cover all of the different features that argparse provides. If you need these features, you can provide your own parser as a kwarg to `autocommand`:
-
-```python
-from argparse import ArgumentParser
-from autocommand import autocommand
-
-parser = ArgumentParser()
-# autocommand can't do optional positonal parameters
-parser.add_argument('arg', nargs='?')
-# or mutually exclusive options
-group = parser.add_mutually_exclusive_group()
-group.add_argument('-v', '--verbose', action='store_true')
-group.add_argument('-q', '--quiet', action='store_true')
-
-@autocommand(__name__, parser=parser)
-def main(arg, verbose, quiet):
-    print(arg, verbose, quiet)
-```
-
-```
-$ python parser.py -h
-usage: write_file.py [-h] [-v | -q] [arg]
-
-positional arguments:
-  arg
-
-optional arguments:
-  -h, --help     show this help message and exit
-  -v, --verbose
-  -q, --quiet
-$ python parser.py
-None False False
-$ python parser.py hello
-hello False False
-$ python parser.py -v
-None True False
-$ python parser.py -q
-None False True
-$ python parser.py -vq
-usage: parser.py [-h] [-v | -q] [arg]
-parser.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
-```
-
-Any parser should work fine, so long as each of the parser's arguments has a corresponding parameter in the decorated main function. The order of parameters doesn't matter, as long as they are all present. Note that when using a custom parser, autocommand doesn't modify the parser or the retrieved arguments. This means that no description/epilog will be added, and the function's type annotations and defaults (if present) will be ignored.
-
-## Testing and Library use
-
-The decorated function is only called and exited from if the first argument to `autocommand` is `'__main__'` or `True`. If it is neither of these values, or no argument is given, then a new main function is created by the decorator. This function has the signature `main(argv=None)`, and is intended to be called with arguments as if via `main(sys.argv[1:])`. The function has the attributes `parser` and `main`, which are the generated `ArgumentParser` and the original main function that was decorated. This is to facilitate testing and library use of your main. Calling the function triggers a `parse_args()` with the supplied arguments, and returns the result of the main function. Note that, while it returns instead of calling `sys.exit`, the `parse_args()` function will raise a `SystemExit` in the event of a parsing error or `-h/--help` argument.
-
-```python
-    @autocommand()
-    def test_prog(arg1, arg2: int, quiet=False, verbose=False):
-        if not quiet:
-            print(arg1, arg2)
-            if verbose:
-                print("LOUD NOISES")
-
-        return 0
-
-    print(test_prog(['-v', 'hello', '80']))
-```
-
-```
-$ python test_prog.py
-hello 80
-LOUD NOISES
-0
-```
-
-If the function is called with no arguments, `sys.argv[1:]` is used. This is to allow the autocommand function to be used as a setuptools entry point.
-
-## Exceptions and limitations
-
-- There are a few possible exceptions that `autocommand` can raise. All of them derive from `autocommand.AutocommandError`.
-
-  - If an invalid annotation is given (that is, it isn't a `type`, `str`, `(type, str)`, or `(str, type)`, an `AnnotationError` is raised. The `type` may be any callable, as described in the `Types`_ section.
-  - If the function has a `**kwargs` parameter, a `KWargError` is raised.
-  - If, somehow, the function has a positional-only parameter, a `PositionalArgError` is raised. This means that the argument doesn't have a name, which is currently not possible with a plain `def` or `lambda`, though many built-in functions have this kind of parameter.
-
-- There are a few argparse features that are not supported by autocommand.
-
-  - It isn't possible to have an optional positional argument (as opposed to a `--option`). POSIX thinks this is bad form anyway.
-  - It isn't possible to have mutually exclusive arguments or options
-  - It isn't possible to have subcommands or subparsers, though I'm working on a few solutions involving classes or nested function definitions to allow this.
-
-## Development
-
-Autocommand cannot be important from the project root; this is to enforce separation of concerns and prevent accidental importing of `setup.py` or tests. To develop, install the project in editable mode:
-
-```
-$ python setup.py develop
-```
-
-This will create a link to the source files in the deployment directory, so that any source changes are reflected when it is imported.
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD
deleted file mode 100644
index e6e12ea51e..0000000000
--- a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/RECORD
+++ /dev/null
@@ -1,18 +0,0 @@
-autocommand-2.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634
-autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006
-autocommand-2.2.2.dist-info/RECORD,,
-autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
-autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12
-autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037
-autocommand/__pycache__/__init__.cpython-312.pyc,,
-autocommand/__pycache__/autoasync.cpython-312.pyc,,
-autocommand/__pycache__/autocommand.cpython-312.pyc,,
-autocommand/__pycache__/automain.cpython-312.pyc,,
-autocommand/__pycache__/autoparse.cpython-312.pyc,,
-autocommand/__pycache__/errors.cpython-312.pyc,,
-autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680
-autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505
-autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076
-autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642
-autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/WHEEL b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/WHEEL
deleted file mode 100644
index 57e3d840d5..0000000000
--- a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.38.4)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt b/pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt
deleted file mode 100644
index dda5158ff6..0000000000
--- a/pkg_resources/_vendor/autocommand-2.2.2.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-autocommand
diff --git a/pkg_resources/_vendor/autocommand/__init__.py b/pkg_resources/_vendor/autocommand/__init__.py
deleted file mode 100644
index 73fbfca6b3..0000000000
--- a/pkg_resources/_vendor/autocommand/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2014-2016 Nathan West
-#
-# This file is part of autocommand.
-#
-# autocommand is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# autocommand is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with autocommand.  If not, see .
-
-# flake8 flags all these imports as unused, hence the NOQAs everywhere.
-
-from .automain import automain  # NOQA
-from .autoparse import autoparse, smart_open  # NOQA
-from .autocommand import autocommand  # NOQA
-
-try:
-    from .autoasync import autoasync  # NOQA
-except ImportError:  # pragma: no cover
-    pass
diff --git a/pkg_resources/_vendor/autocommand/autoasync.py b/pkg_resources/_vendor/autocommand/autoasync.py
deleted file mode 100644
index 688f7e0554..0000000000
--- a/pkg_resources/_vendor/autocommand/autoasync.py
+++ /dev/null
@@ -1,142 +0,0 @@
-# Copyright 2014-2015 Nathan West
-#
-# This file is part of autocommand.
-#
-# autocommand is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# autocommand is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with autocommand.  If not, see .
-
-from asyncio import get_event_loop, iscoroutine
-from functools import wraps
-from inspect import signature
-
-
-async def _run_forever_coro(coro, args, kwargs, loop):
-    '''
-    This helper function launches an async main function that was tagged with
-    forever=True. There are two possibilities:
-
-    - The function is a normal function, which handles initializing the event
-      loop, which is then run forever
-    - The function is a coroutine, which needs to be scheduled in the event
-      loop, which is then run forever
-      - There is also the possibility that the function is a normal function
-        wrapping a coroutine function
-
-    The function is therefore called unconditionally and scheduled in the event
-    loop if the return value is a coroutine object.
-
-    The reason this is a separate function is to make absolutely sure that all
-    the objects created are garbage collected after all is said and done; we
-    do this to ensure that any exceptions raised in the tasks are collected
-    ASAP.
-    '''
-
-    # Personal note: I consider this an antipattern, as it relies on the use of
-    # unowned resources. The setup function dumps some stuff into the event
-    # loop where it just whirls in the ether without a well defined owner or
-    # lifetime. For this reason, there's a good chance I'll remove the
-    # forever=True feature from autoasync at some point in the future.
-    thing = coro(*args, **kwargs)
-    if iscoroutine(thing):
-        await thing
-
-
-def autoasync(coro=None, *, loop=None, forever=False, pass_loop=False):
-    '''
-    Convert an asyncio coroutine into a function which, when called, is
-    evaluted in an event loop, and the return value returned. This is intented
-    to make it easy to write entry points into asyncio coroutines, which
-    otherwise need to be explictly evaluted with an event loop's
-    run_until_complete.
-
-    If `loop` is given, it is used as the event loop to run the coro in. If it
-    is None (the default), the loop is retreived using asyncio.get_event_loop.
-    This call is defered until the decorated function is called, so that
-    callers can install custom event loops or event loop policies after
-    @autoasync is applied.
-
-    If `forever` is True, the loop is run forever after the decorated coroutine
-    is finished. Use this for servers created with asyncio.start_server and the
-    like.
-
-    If `pass_loop` is True, the event loop object is passed into the coroutine
-    as the `loop` kwarg when the wrapper function is called. In this case, the
-    wrapper function's __signature__ is updated to remove this parameter, so
-    that autoparse can still be used on it without generating a parameter for
-    `loop`.
-
-    This coroutine can be called with ( @autoasync(...) ) or without
-    ( @autoasync ) arguments.
-
-    Examples:
-
-    @autoasync
-    def get_file(host, port):
-        reader, writer = yield from asyncio.open_connection(host, port)
-        data = reader.read()
-        sys.stdout.write(data.decode())
-
-    get_file(host, port)
-
-    @autoasync(forever=True, pass_loop=True)
-    def server(host, port, loop):
-        yield_from loop.create_server(Proto, host, port)
-
-    server('localhost', 8899)
-
-    '''
-    if coro is None:
-        return lambda c: autoasync(
-            c, loop=loop,
-            forever=forever,
-            pass_loop=pass_loop)
-
-    # The old and new signatures are required to correctly bind the loop
-    # parameter in 100% of cases, even if it's a positional parameter.
-    # NOTE: A future release will probably require the loop parameter to be
-    # a kwonly parameter.
-    if pass_loop:
-        old_sig = signature(coro)
-        new_sig = old_sig.replace(parameters=(
-            param for name, param in old_sig.parameters.items()
-            if name != "loop"))
-
-    @wraps(coro)
-    def autoasync_wrapper(*args, **kwargs):
-        # Defer the call to get_event_loop so that, if a custom policy is
-        # installed after the autoasync decorator, it is respected at call time
-        local_loop = get_event_loop() if loop is None else loop
-
-        # Inject the 'loop' argument. We have to use this signature binding to
-        # ensure it's injected in the correct place (positional, keyword, etc)
-        if pass_loop:
-            bound_args = old_sig.bind_partial()
-            bound_args.arguments.update(
-                loop=local_loop,
-                **new_sig.bind(*args, **kwargs).arguments)
-            args, kwargs = bound_args.args, bound_args.kwargs
-
-        if forever:
-            local_loop.create_task(_run_forever_coro(
-                coro, args, kwargs, local_loop
-            ))
-            local_loop.run_forever()
-        else:
-            return local_loop.run_until_complete(coro(*args, **kwargs))
-
-    # Attach the updated signature. This allows 'pass_loop' to be used with
-    # autoparse
-    if pass_loop:
-        autoasync_wrapper.__signature__ = new_sig
-
-    return autoasync_wrapper
diff --git a/pkg_resources/_vendor/autocommand/autocommand.py b/pkg_resources/_vendor/autocommand/autocommand.py
deleted file mode 100644
index 097e86de07..0000000000
--- a/pkg_resources/_vendor/autocommand/autocommand.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright 2014-2015 Nathan West
-#
-# This file is part of autocommand.
-#
-# autocommand is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# autocommand is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with autocommand.  If not, see .
-
-from .autoparse import autoparse
-from .automain import automain
-try:
-    from .autoasync import autoasync
-except ImportError:  # pragma: no cover
-    pass
-
-
-def autocommand(
-        module, *,
-        description=None,
-        epilog=None,
-        add_nos=False,
-        parser=None,
-        loop=None,
-        forever=False,
-        pass_loop=False):
-
-    if callable(module):
-        raise TypeError('autocommand requires a module name argument')
-
-    def autocommand_decorator(func):
-        # Step 1: if requested, run it all in an asyncio event loop. autoasync
-        # patches the __signature__ of the decorated function, so that in the
-        # event that pass_loop is True, the `loop` parameter of the original
-        # function will *not* be interpreted as a command-line argument by
-        # autoparse
-        if loop is not None or forever or pass_loop:
-            func = autoasync(
-                func,
-                loop=None if loop is True else loop,
-                pass_loop=pass_loop,
-                forever=forever)
-
-        # Step 2: create parser. We do this second so that the arguments are
-        # parsed and passed *before* entering the asyncio event loop, if it
-        # exists. This simplifies the stack trace and ensures errors are
-        # reported earlier. It also ensures that errors raised during parsing &
-        # passing are still raised if `forever` is True.
-        func = autoparse(
-            func,
-            description=description,
-            epilog=epilog,
-            add_nos=add_nos,
-            parser=parser)
-
-        # Step 3: call the function automatically if __name__ == '__main__' (or
-        # if True was provided)
-        func = automain(module)(func)
-
-        return func
-
-    return autocommand_decorator
diff --git a/pkg_resources/_vendor/autocommand/automain.py b/pkg_resources/_vendor/autocommand/automain.py
deleted file mode 100644
index 6cc45db66a..0000000000
--- a/pkg_resources/_vendor/autocommand/automain.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 2014-2015 Nathan West
-#
-# This file is part of autocommand.
-#
-# autocommand is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# autocommand is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with autocommand.  If not, see .
-
-import sys
-from .errors import AutocommandError
-
-
-class AutomainRequiresModuleError(AutocommandError, TypeError):
-    pass
-
-
-def automain(module, *, args=(), kwargs=None):
-    '''
-    This decorator automatically invokes a function if the module is being run
-    as the "__main__" module. Optionally, provide args or kwargs with which to
-    call the function. If `module` is "__main__", the function is called, and
-    the program is `sys.exit`ed with the return value. You can also pass `True`
-    to cause the function to be called unconditionally. If the function is not
-    called, it is returned unchanged by the decorator.
-
-    Usage:
-
-    @automain(__name__)  # Pass __name__ to check __name__=="__main__"
-    def main():
-        ...
-
-    If __name__ is "__main__" here, the main function is called, and then
-    sys.exit called with the return value.
-    '''
-
-    # Check that @automain(...) was called, rather than @automain
-    if callable(module):
-        raise AutomainRequiresModuleError(module)
-
-    if module == '__main__' or module is True:
-        if kwargs is None:
-            kwargs = {}
-
-        # Use a function definition instead of a lambda for a neater traceback
-        def automain_decorator(main):
-            sys.exit(main(*args, **kwargs))
-
-        return automain_decorator
-    else:
-        return lambda main: main
diff --git a/pkg_resources/_vendor/autocommand/autoparse.py b/pkg_resources/_vendor/autocommand/autoparse.py
deleted file mode 100644
index 0276a3fae1..0000000000
--- a/pkg_resources/_vendor/autocommand/autoparse.py
+++ /dev/null
@@ -1,333 +0,0 @@
-# Copyright 2014-2015 Nathan West
-#
-# This file is part of autocommand.
-#
-# autocommand is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# autocommand is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with autocommand.  If not, see .
-
-import sys
-from re import compile as compile_regex
-from inspect import signature, getdoc, Parameter
-from argparse import ArgumentParser
-from contextlib import contextmanager
-from functools import wraps
-from io import IOBase
-from autocommand.errors import AutocommandError
-
-
-_empty = Parameter.empty
-
-
-class AnnotationError(AutocommandError):
-    '''Annotation error: annotation must be a string, type, or tuple of both'''
-
-
-class PositionalArgError(AutocommandError):
-    '''
-    Postional Arg Error: autocommand can't handle postional-only parameters
-    '''
-
-
-class KWArgError(AutocommandError):
-    '''kwarg Error: autocommand can't handle a **kwargs parameter'''
-
-
-class DocstringError(AutocommandError):
-    '''Docstring error'''
-
-
-class TooManySplitsError(DocstringError):
-    '''
-    The docstring had too many ---- section splits. Currently we only support
-    using up to a single split, to split the docstring into description and
-    epilog parts.
-    '''
-
-
-def _get_type_description(annotation):
-    '''
-    Given an annotation, return the (type, description) for the parameter.
-    If you provide an annotation that is somehow both a string and a callable,
-    the behavior is undefined.
-    '''
-    if annotation is _empty:
-        return None, None
-    elif callable(annotation):
-        return annotation, None
-    elif isinstance(annotation, str):
-        return None, annotation
-    elif isinstance(annotation, tuple):
-        try:
-            arg1, arg2 = annotation
-        except ValueError as e:
-            raise AnnotationError(annotation) from e
-        else:
-            if callable(arg1) and isinstance(arg2, str):
-                return arg1, arg2
-            elif isinstance(arg1, str) and callable(arg2):
-                return arg2, arg1
-
-    raise AnnotationError(annotation)
-
-
-def _add_arguments(param, parser, used_char_args, add_nos):
-    '''
-    Add the argument(s) to an ArgumentParser (using add_argument) for a given
-    parameter. used_char_args is the set of -short options currently already in
-    use, and is updated (if necessary) by this function. If add_nos is True,
-    this will also add an inverse switch for all boolean options. For
-    instance, for the boolean parameter "verbose", this will create --verbose
-    and --no-verbose.
-    '''
-
-    # Impl note: This function is kept separate from make_parser because it's
-    # already very long and I wanted to separate out as much as possible into
-    # its own call scope, to prevent even the possibility of suble mutation
-    # bugs.
-    if param.kind is param.POSITIONAL_ONLY:
-        raise PositionalArgError(param)
-    elif param.kind is param.VAR_KEYWORD:
-        raise KWArgError(param)
-
-    # These are the kwargs for the add_argument function.
-    arg_spec = {}
-    is_option = False
-
-    # Get the type and default from the annotation.
-    arg_type, description = _get_type_description(param.annotation)
-
-    # Get the default value
-    default = param.default
-
-    # If there is no explicit type, and the default is present and not None,
-    # infer the type from the default.
-    if arg_type is None and default not in {_empty, None}:
-        arg_type = type(default)
-
-    # Add default. The presence of a default means this is an option, not an
-    # argument.
-    if default is not _empty:
-        arg_spec['default'] = default
-        is_option = True
-
-    # Add the type
-    if arg_type is not None:
-        # Special case for bool: make it just a --switch
-        if arg_type is bool:
-            if not default or default is _empty:
-                arg_spec['action'] = 'store_true'
-            else:
-                arg_spec['action'] = 'store_false'
-
-            # Switches are always options
-            is_option = True
-
-        # Special case for file types: make it a string type, for filename
-        elif isinstance(default, IOBase):
-            arg_spec['type'] = str
-
-        # TODO: special case for list type.
-        #   - How to specificy type of list members?
-        #       - param: [int]
-        #       - param: int =[]
-        #   - action='append' vs nargs='*'
-
-        else:
-            arg_spec['type'] = arg_type
-
-    # nargs: if the signature includes *args, collect them as trailing CLI
-    # arguments in a list. *args can't have a default value, so it can never be
-    # an option.
-    if param.kind is param.VAR_POSITIONAL:
-        # TODO: consider depluralizing metavar/name here.
-        arg_spec['nargs'] = '*'
-
-    # Add description.
-    if description is not None:
-        arg_spec['help'] = description
-
-    # Get the --flags
-    flags = []
-    name = param.name
-
-    if is_option:
-        # Add the first letter as a -short option.
-        for letter in name[0], name[0].swapcase():
-            if letter not in used_char_args:
-                used_char_args.add(letter)
-                flags.append('-{}'.format(letter))
-                break
-
-        # If the parameter is a --long option, or is a -short option that
-        # somehow failed to get a flag, add it.
-        if len(name) > 1 or not flags:
-            flags.append('--{}'.format(name))
-
-        arg_spec['dest'] = name
-    else:
-        flags.append(name)
-
-    parser.add_argument(*flags, **arg_spec)
-
-    # Create the --no- version for boolean switches
-    if add_nos and arg_type is bool:
-        parser.add_argument(
-            '--no-{}'.format(name),
-            action='store_const',
-            dest=name,
-            const=default if default is not _empty else False)
-
-
-def make_parser(func_sig, description, epilog, add_nos):
-    '''
-    Given the signature of a function, create an ArgumentParser
-    '''
-    parser = ArgumentParser(description=description, epilog=epilog)
-
-    used_char_args = {'h'}
-
-    # Arange the params so that single-character arguments are first. This
-    # esnures they don't have to get --long versions. sorted is stable, so the
-    # parameters will otherwise still be in relative order.
-    params = sorted(
-        func_sig.parameters.values(),
-        key=lambda param: len(param.name) > 1)
-
-    for param in params:
-        _add_arguments(param, parser, used_char_args, add_nos)
-
-    return parser
-
-
-_DOCSTRING_SPLIT = compile_regex(r'\n\s*-{4,}\s*\n')
-
-
-def parse_docstring(docstring):
-    '''
-    Given a docstring, parse it into a description and epilog part
-    '''
-    if docstring is None:
-        return '', ''
-
-    parts = _DOCSTRING_SPLIT.split(docstring)
-
-    if len(parts) == 1:
-        return docstring, ''
-    elif len(parts) == 2:
-        return parts[0], parts[1]
-    else:
-        raise TooManySplitsError()
-
-
-def autoparse(
-        func=None, *,
-        description=None,
-        epilog=None,
-        add_nos=False,
-        parser=None):
-    '''
-    This decorator converts a function that takes normal arguments into a
-    function which takes a single optional argument, argv, parses it using an
-    argparse.ArgumentParser, and calls the underlying function with the parsed
-    arguments. If it is not given, sys.argv[1:] is used. This is so that the
-    function can be used as a setuptools entry point, as well as a normal main
-    function. sys.argv[1:] is not evaluated until the function is called, to
-    allow injecting different arguments for testing.
-
-    It uses the argument signature of the function to create an
-    ArgumentParser. Parameters without defaults become positional parameters,
-    while parameters *with* defaults become --options. Use annotations to set
-    the type of the parameter.
-
-    The `desctiption` and `epilog` parameters corrospond to the same respective
-    argparse parameters. If no description is given, it defaults to the
-    decorated functions's docstring, if present.
-
-    If add_nos is True, every boolean option (that is, every parameter with a
-    default of True/False or a type of bool) will have a --no- version created
-    as well, which inverts the option. For instance, the --verbose option will
-    have a --no-verbose counterpart. These are not mutually exclusive-
-    whichever one appears last in the argument list will have precedence.
-
-    If a parser is given, it is used instead of one generated from the function
-    signature. In this case, no parser is created; instead, the given parser is
-    used to parse the argv argument. The parser's results' argument names must
-    match up with the parameter names of the decorated function.
-
-    The decorated function is attached to the result as the `func` attribute,
-    and the parser is attached as the `parser` attribute.
-    '''
-
-    # If @autoparse(...) is used instead of @autoparse
-    if func is None:
-        return lambda f: autoparse(
-            f, description=description,
-            epilog=epilog,
-            add_nos=add_nos,
-            parser=parser)
-
-    func_sig = signature(func)
-
-    docstr_description, docstr_epilog = parse_docstring(getdoc(func))
-
-    if parser is None:
-        parser = make_parser(
-            func_sig,
-            description or docstr_description,
-            epilog or docstr_epilog,
-            add_nos)
-
-    @wraps(func)
-    def autoparse_wrapper(argv=None):
-        if argv is None:
-            argv = sys.argv[1:]
-
-        # Get empty argument binding, to fill with parsed arguments. This
-        # object does all the heavy lifting of turning named arguments into
-        # into correctly bound *args and **kwargs.
-        parsed_args = func_sig.bind_partial()
-        parsed_args.arguments.update(vars(parser.parse_args(argv)))
-
-        return func(*parsed_args.args, **parsed_args.kwargs)
-
-    # TODO: attach an updated __signature__ to autoparse_wrapper, just in case.
-
-    # Attach the wrapped function and parser, and return the wrapper.
-    autoparse_wrapper.func = func
-    autoparse_wrapper.parser = parser
-    return autoparse_wrapper
-
-
-@contextmanager
-def smart_open(filename_or_file, *args, **kwargs):
-    '''
-    This context manager allows you to open a filename, if you want to default
-    some already-existing file object, like sys.stdout, which shouldn't be
-    closed at the end of the context. If the filename argument is a str, bytes,
-    or int, the file object is created via a call to open with the given *args
-    and **kwargs, sent to the context, and closed at the end of the context,
-    just like "with open(filename) as f:". If it isn't one of the openable
-    types, the object simply sent to the context unchanged, and left unclosed
-    at the end of the context. Example:
-
-        def work_with_file(name=sys.stdout):
-            with smart_open(name) as f:
-                # Works correctly if name is a str filename or sys.stdout
-                print("Some stuff", file=f)
-                # If it was a filename, f is closed at the end here.
-    '''
-    if isinstance(filename_or_file, (str, bytes, int)):
-        with open(filename_or_file, *args, **kwargs) as file:
-            yield file
-    else:
-        yield filename_or_file
diff --git a/pkg_resources/_vendor/autocommand/errors.py b/pkg_resources/_vendor/autocommand/errors.py
deleted file mode 100644
index 2570607399..0000000000
--- a/pkg_resources/_vendor/autocommand/errors.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright 2014-2016 Nathan West
-#
-# This file is part of autocommand.
-#
-# autocommand is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# autocommand is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with autocommand.  If not, see .
-
-
-class AutocommandError(Exception):
-    '''Base class for autocommand exceptions'''
-    pass
-
-# Individual modules will define errors specific to that module.
diff --git a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
deleted file mode 100644
index 1bb5a44356..0000000000
--- a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-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/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/METADATA b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
deleted file mode 100644
index db0a2dcdbe..0000000000
--- a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
+++ /dev/null
@@ -1,46 +0,0 @@
-Metadata-Version: 2.1
-Name: backports.tarfile
-Version: 1.2.0
-Summary: Backport of CPython tarfile module
-Author-email: "Jason R. Coombs" 
-Project-URL: Homepage, https://github.com/jaraco/backports.tarfile
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.8
-Description-Content-Type: text/x-rst
-License-File: LICENSE
-Provides-Extra: docs
-Requires-Dist: sphinx >=3.5 ; extra == 'docs'
-Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
-Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
-Requires-Dist: furo ; extra == 'docs'
-Requires-Dist: sphinx-lint ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'testing'
-Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
-Requires-Dist: jaraco.test ; extra == 'testing'
-Requires-Dist: pytest !=8.0.* ; extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/backports.tarfile.svg
-   :target: https://pypi.org/project/backports.tarfile
-
-.. image:: https://img.shields.io/pypi/pyversions/backports.tarfile.svg
-
-.. image:: https://github.com/jaraco/backports.tarfile/actions/workflows/main.yml/badge.svg
-   :target: https://github.com/jaraco/backports.tarfile/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
-    :target: https://github.com/astral-sh/ruff
-    :alt: Ruff
-
-.. .. image:: https://readthedocs.org/projects/backportstarfile/badge/?version=latest
-..    :target: https://backportstarfile.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2024-informational
-   :target: https://blog.jaraco.com/skeleton
diff --git a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
deleted file mode 100644
index 536dc2f09e..0000000000
--- a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
+++ /dev/null
@@ -1,17 +0,0 @@
-backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020
-backports.tarfile-1.2.0.dist-info/RECORD,,
-backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
-backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81
-backports/__pycache__/__init__.cpython-312.pyc,,
-backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491
-backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59
-backports/tarfile/__pycache__/__init__.cpython-312.pyc,,
-backports/tarfile/__pycache__/__main__.cpython-312.pyc,,
-backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-backports/tarfile/compat/__pycache__/__init__.cpython-312.pyc,,
-backports/tarfile/compat/__pycache__/py38.cpython-312.pyc,,
-backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568
diff --git a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
deleted file mode 100644
index bab98d6758..0000000000
--- a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.43.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt b/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
deleted file mode 100644
index 99d2be5b64..0000000000
--- a/pkg_resources/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-backports
diff --git a/pkg_resources/_vendor/backports/__init__.py b/pkg_resources/_vendor/backports/__init__.py
deleted file mode 100644
index 0d1f7edf5d..0000000000
--- a/pkg_resources/_vendor/backports/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-__path__ = __import__('pkgutil').extend_path(__path__, __name__)  # type: ignore
diff --git a/pkg_resources/_vendor/backports/tarfile/__init__.py b/pkg_resources/_vendor/backports/tarfile/__init__.py
deleted file mode 100644
index 8c16881cb3..0000000000
--- a/pkg_resources/_vendor/backports/tarfile/__init__.py
+++ /dev/null
@@ -1,2937 +0,0 @@
-#-------------------------------------------------------------------
-# tarfile.py
-#-------------------------------------------------------------------
-# Copyright (C) 2002 Lars Gustaebel 
-# All rights reserved.
-#
-# Permission  is  hereby granted,  free  of charge,  to  any person
-# obtaining a  copy of  this software  and associated documentation
-# files  (the  "Software"),  to   deal  in  the  Software   without
-# restriction,  including  without limitation  the  rights to  use,
-# copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies  of  the  Software,  and to  permit  persons  to  whom the
-# Software  is  furnished  to  do  so,  subject  to  the  following
-# conditions:
-#
-# The above copyright  notice and this  permission notice shall  be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS  IS", WITHOUT WARRANTY OF ANY  KIND,
-# EXPRESS OR IMPLIED, INCLUDING  BUT NOT LIMITED TO  THE WARRANTIES
-# OF  MERCHANTABILITY,  FITNESS   FOR  A  PARTICULAR   PURPOSE  AND
-# NONINFRINGEMENT.  IN  NO  EVENT SHALL  THE  AUTHORS  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.
-#
-"""Read from and write to tar format archives.
-"""
-
-version     = "0.9.0"
-__author__  = "Lars Gust\u00e4bel (lars@gustaebel.de)"
-__credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend."
-
-#---------
-# Imports
-#---------
-from builtins import open as bltn_open
-import sys
-import os
-import io
-import shutil
-import stat
-import time
-import struct
-import copy
-import re
-
-from .compat.py38 import removesuffix
-
-try:
-    import pwd
-except ImportError:
-    pwd = None
-try:
-    import grp
-except ImportError:
-    grp = None
-
-# os.symlink on Windows prior to 6.0 raises NotImplementedError
-# OSError (winerror=1314) will be raised if the caller does not hold the
-# SeCreateSymbolicLinkPrivilege privilege
-symlink_exception = (AttributeError, NotImplementedError, OSError)
-
-# from tarfile import *
-__all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError", "ReadError",
-           "CompressionError", "StreamError", "ExtractError", "HeaderError",
-           "ENCODING", "USTAR_FORMAT", "GNU_FORMAT", "PAX_FORMAT",
-           "DEFAULT_FORMAT", "open","fully_trusted_filter", "data_filter",
-           "tar_filter", "FilterError", "AbsoluteLinkError",
-           "OutsideDestinationError", "SpecialFileError", "AbsolutePathError",
-           "LinkOutsideDestinationError"]
-
-
-#---------------------------------------------------------
-# tar constants
-#---------------------------------------------------------
-NUL = b"\0"                     # the null character
-BLOCKSIZE = 512                 # length of processing blocks
-RECORDSIZE = BLOCKSIZE * 20     # length of records
-GNU_MAGIC = b"ustar  \0"        # magic gnu tar string
-POSIX_MAGIC = b"ustar\x0000"    # magic posix tar string
-
-LENGTH_NAME = 100               # maximum length of a filename
-LENGTH_LINK = 100               # maximum length of a linkname
-LENGTH_PREFIX = 155             # maximum length of the prefix field
-
-REGTYPE = b"0"                  # regular file
-AREGTYPE = b"\0"                # regular file
-LNKTYPE = b"1"                  # link (inside tarfile)
-SYMTYPE = b"2"                  # symbolic link
-CHRTYPE = b"3"                  # character special device
-BLKTYPE = b"4"                  # block special device
-DIRTYPE = b"5"                  # directory
-FIFOTYPE = b"6"                 # fifo special device
-CONTTYPE = b"7"                 # contiguous file
-
-GNUTYPE_LONGNAME = b"L"         # GNU tar longname
-GNUTYPE_LONGLINK = b"K"         # GNU tar longlink
-GNUTYPE_SPARSE = b"S"           # GNU tar sparse file
-
-XHDTYPE = b"x"                  # POSIX.1-2001 extended header
-XGLTYPE = b"g"                  # POSIX.1-2001 global header
-SOLARIS_XHDTYPE = b"X"          # Solaris extended header
-
-USTAR_FORMAT = 0                # POSIX.1-1988 (ustar) format
-GNU_FORMAT = 1                  # GNU tar format
-PAX_FORMAT = 2                  # POSIX.1-2001 (pax) format
-DEFAULT_FORMAT = PAX_FORMAT
-
-#---------------------------------------------------------
-# tarfile constants
-#---------------------------------------------------------
-# File types that tarfile supports:
-SUPPORTED_TYPES = (REGTYPE, AREGTYPE, LNKTYPE,
-                   SYMTYPE, DIRTYPE, FIFOTYPE,
-                   CONTTYPE, CHRTYPE, BLKTYPE,
-                   GNUTYPE_LONGNAME, GNUTYPE_LONGLINK,
-                   GNUTYPE_SPARSE)
-
-# File types that will be treated as a regular file.
-REGULAR_TYPES = (REGTYPE, AREGTYPE,
-                 CONTTYPE, GNUTYPE_SPARSE)
-
-# File types that are part of the GNU tar format.
-GNU_TYPES = (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK,
-             GNUTYPE_SPARSE)
-
-# Fields from a pax header that override a TarInfo attribute.
-PAX_FIELDS = ("path", "linkpath", "size", "mtime",
-              "uid", "gid", "uname", "gname")
-
-# Fields from a pax header that are affected by hdrcharset.
-PAX_NAME_FIELDS = {"path", "linkpath", "uname", "gname"}
-
-# Fields in a pax header that are numbers, all other fields
-# are treated as strings.
-PAX_NUMBER_FIELDS = {
-    "atime": float,
-    "ctime": float,
-    "mtime": float,
-    "uid": int,
-    "gid": int,
-    "size": int
-}
-
-#---------------------------------------------------------
-# initialization
-#---------------------------------------------------------
-if os.name == "nt":
-    ENCODING = "utf-8"
-else:
-    ENCODING = sys.getfilesystemencoding()
-
-#---------------------------------------------------------
-# Some useful functions
-#---------------------------------------------------------
-
-def stn(s, length, encoding, errors):
-    """Convert a string to a null-terminated bytes object.
-    """
-    if s is None:
-        raise ValueError("metadata cannot contain None")
-    s = s.encode(encoding, errors)
-    return s[:length] + (length - len(s)) * NUL
-
-def nts(s, encoding, errors):
-    """Convert a null-terminated bytes object to a string.
-    """
-    p = s.find(b"\0")
-    if p != -1:
-        s = s[:p]
-    return s.decode(encoding, errors)
-
-def nti(s):
-    """Convert a number field to a python number.
-    """
-    # There are two possible encodings for a number field, see
-    # itn() below.
-    if s[0] in (0o200, 0o377):
-        n = 0
-        for i in range(len(s) - 1):
-            n <<= 8
-            n += s[i + 1]
-        if s[0] == 0o377:
-            n = -(256 ** (len(s) - 1) - n)
-    else:
-        try:
-            s = nts(s, "ascii", "strict")
-            n = int(s.strip() or "0", 8)
-        except ValueError:
-            raise InvalidHeaderError("invalid header")
-    return n
-
-def itn(n, digits=8, format=DEFAULT_FORMAT):
-    """Convert a python number to a number field.
-    """
-    # POSIX 1003.1-1988 requires numbers to be encoded as a string of
-    # octal digits followed by a null-byte, this allows values up to
-    # (8**(digits-1))-1. GNU tar allows storing numbers greater than
-    # that if necessary. A leading 0o200 or 0o377 byte indicate this
-    # particular encoding, the following digits-1 bytes are a big-endian
-    # base-256 representation. This allows values up to (256**(digits-1))-1.
-    # A 0o200 byte indicates a positive number, a 0o377 byte a negative
-    # number.
-    original_n = n
-    n = int(n)
-    if 0 <= n < 8 ** (digits - 1):
-        s = bytes("%0*o" % (digits - 1, n), "ascii") + NUL
-    elif format == GNU_FORMAT and -256 ** (digits - 1) <= n < 256 ** (digits - 1):
-        if n >= 0:
-            s = bytearray([0o200])
-        else:
-            s = bytearray([0o377])
-            n = 256 ** digits + n
-
-        for i in range(digits - 1):
-            s.insert(1, n & 0o377)
-            n >>= 8
-    else:
-        raise ValueError("overflow in number field")
-
-    return s
-
-def calc_chksums(buf):
-    """Calculate the checksum for a member's header by summing up all
-       characters except for the chksum field which is treated as if
-       it was filled with spaces. According to the GNU tar sources,
-       some tars (Sun and NeXT) calculate chksum with signed char,
-       which will be different if there are chars in the buffer with
-       the high bit set. So we calculate two checksums, unsigned and
-       signed.
-    """
-    unsigned_chksum = 256 + sum(struct.unpack_from("148B8x356B", buf))
-    signed_chksum = 256 + sum(struct.unpack_from("148b8x356b", buf))
-    return unsigned_chksum, signed_chksum
-
-def copyfileobj(src, dst, length=None, exception=OSError, bufsize=None):
-    """Copy length bytes from fileobj src to fileobj dst.
-       If length is None, copy the entire content.
-    """
-    bufsize = bufsize or 16 * 1024
-    if length == 0:
-        return
-    if length is None:
-        shutil.copyfileobj(src, dst, bufsize)
-        return
-
-    blocks, remainder = divmod(length, bufsize)
-    for b in range(blocks):
-        buf = src.read(bufsize)
-        if len(buf) < bufsize:
-            raise exception("unexpected end of data")
-        dst.write(buf)
-
-    if remainder != 0:
-        buf = src.read(remainder)
-        if len(buf) < remainder:
-            raise exception("unexpected end of data")
-        dst.write(buf)
-    return
-
-def _safe_print(s):
-    encoding = getattr(sys.stdout, 'encoding', None)
-    if encoding is not None:
-        s = s.encode(encoding, 'backslashreplace').decode(encoding)
-    print(s, end=' ')
-
-
-class TarError(Exception):
-    """Base exception."""
-    pass
-class ExtractError(TarError):
-    """General exception for extract errors."""
-    pass
-class ReadError(TarError):
-    """Exception for unreadable tar archives."""
-    pass
-class CompressionError(TarError):
-    """Exception for unavailable compression methods."""
-    pass
-class StreamError(TarError):
-    """Exception for unsupported operations on stream-like TarFiles."""
-    pass
-class HeaderError(TarError):
-    """Base exception for header errors."""
-    pass
-class EmptyHeaderError(HeaderError):
-    """Exception for empty headers."""
-    pass
-class TruncatedHeaderError(HeaderError):
-    """Exception for truncated headers."""
-    pass
-class EOFHeaderError(HeaderError):
-    """Exception for end of file headers."""
-    pass
-class InvalidHeaderError(HeaderError):
-    """Exception for invalid headers."""
-    pass
-class SubsequentHeaderError(HeaderError):
-    """Exception for missing and invalid extended headers."""
-    pass
-
-#---------------------------
-# internal stream interface
-#---------------------------
-class _LowLevelFile:
-    """Low-level file object. Supports reading and writing.
-       It is used instead of a regular file object for streaming
-       access.
-    """
-
-    def __init__(self, name, mode):
-        mode = {
-            "r": os.O_RDONLY,
-            "w": os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
-        }[mode]
-        if hasattr(os, "O_BINARY"):
-            mode |= os.O_BINARY
-        self.fd = os.open(name, mode, 0o666)
-
-    def close(self):
-        os.close(self.fd)
-
-    def read(self, size):
-        return os.read(self.fd, size)
-
-    def write(self, s):
-        os.write(self.fd, s)
-
-class _Stream:
-    """Class that serves as an adapter between TarFile and
-       a stream-like object.  The stream-like object only
-       needs to have a read() or write() method that works with bytes,
-       and the method is accessed blockwise.
-       Use of gzip or bzip2 compression is possible.
-       A stream-like object could be for example: sys.stdin.buffer,
-       sys.stdout.buffer, a socket, a tape device etc.
-
-       _Stream is intended to be used only internally.
-    """
-
-    def __init__(self, name, mode, comptype, fileobj, bufsize,
-                 compresslevel):
-        """Construct a _Stream object.
-        """
-        self._extfileobj = True
-        if fileobj is None:
-            fileobj = _LowLevelFile(name, mode)
-            self._extfileobj = False
-
-        if comptype == '*':
-            # Enable transparent compression detection for the
-            # stream interface
-            fileobj = _StreamProxy(fileobj)
-            comptype = fileobj.getcomptype()
-
-        self.name     = name or ""
-        self.mode     = mode
-        self.comptype = comptype
-        self.fileobj  = fileobj
-        self.bufsize  = bufsize
-        self.buf      = b""
-        self.pos      = 0
-        self.closed   = False
-
-        try:
-            if comptype == "gz":
-                try:
-                    import zlib
-                except ImportError:
-                    raise CompressionError("zlib module is not available") from None
-                self.zlib = zlib
-                self.crc = zlib.crc32(b"")
-                if mode == "r":
-                    self.exception = zlib.error
-                    self._init_read_gz()
-                else:
-                    self._init_write_gz(compresslevel)
-
-            elif comptype == "bz2":
-                try:
-                    import bz2
-                except ImportError:
-                    raise CompressionError("bz2 module is not available") from None
-                if mode == "r":
-                    self.dbuf = b""
-                    self.cmp = bz2.BZ2Decompressor()
-                    self.exception = OSError
-                else:
-                    self.cmp = bz2.BZ2Compressor(compresslevel)
-
-            elif comptype == "xz":
-                try:
-                    import lzma
-                except ImportError:
-                    raise CompressionError("lzma module is not available") from None
-                if mode == "r":
-                    self.dbuf = b""
-                    self.cmp = lzma.LZMADecompressor()
-                    self.exception = lzma.LZMAError
-                else:
-                    self.cmp = lzma.LZMACompressor()
-
-            elif comptype != "tar":
-                raise CompressionError("unknown compression type %r" % comptype)
-
-        except:
-            if not self._extfileobj:
-                self.fileobj.close()
-            self.closed = True
-            raise
-
-    def __del__(self):
-        if hasattr(self, "closed") and not self.closed:
-            self.close()
-
-    def _init_write_gz(self, compresslevel):
-        """Initialize for writing with gzip compression.
-        """
-        self.cmp = self.zlib.compressobj(compresslevel,
-                                         self.zlib.DEFLATED,
-                                         -self.zlib.MAX_WBITS,
-                                         self.zlib.DEF_MEM_LEVEL,
-                                         0)
-        timestamp = struct.pack(" self.bufsize:
-            self.fileobj.write(self.buf[:self.bufsize])
-            self.buf = self.buf[self.bufsize:]
-
-    def close(self):
-        """Close the _Stream object. No operation should be
-           done on it afterwards.
-        """
-        if self.closed:
-            return
-
-        self.closed = True
-        try:
-            if self.mode == "w" and self.comptype != "tar":
-                self.buf += self.cmp.flush()
-
-            if self.mode == "w" and self.buf:
-                self.fileobj.write(self.buf)
-                self.buf = b""
-                if self.comptype == "gz":
-                    self.fileobj.write(struct.pack("= 0:
-            blocks, remainder = divmod(pos - self.pos, self.bufsize)
-            for i in range(blocks):
-                self.read(self.bufsize)
-            self.read(remainder)
-        else:
-            raise StreamError("seeking backwards is not allowed")
-        return self.pos
-
-    def read(self, size):
-        """Return the next size number of bytes from the stream."""
-        assert size is not None
-        buf = self._read(size)
-        self.pos += len(buf)
-        return buf
-
-    def _read(self, size):
-        """Return size bytes from the stream.
-        """
-        if self.comptype == "tar":
-            return self.__read(size)
-
-        c = len(self.dbuf)
-        t = [self.dbuf]
-        while c < size:
-            # Skip underlying buffer to avoid unaligned double buffering.
-            if self.buf:
-                buf = self.buf
-                self.buf = b""
-            else:
-                buf = self.fileobj.read(self.bufsize)
-                if not buf:
-                    break
-            try:
-                buf = self.cmp.decompress(buf)
-            except self.exception as e:
-                raise ReadError("invalid compressed data") from e
-            t.append(buf)
-            c += len(buf)
-        t = b"".join(t)
-        self.dbuf = t[size:]
-        return t[:size]
-
-    def __read(self, size):
-        """Return size bytes from stream. If internal buffer is empty,
-           read another block from the stream.
-        """
-        c = len(self.buf)
-        t = [self.buf]
-        while c < size:
-            buf = self.fileobj.read(self.bufsize)
-            if not buf:
-                break
-            t.append(buf)
-            c += len(buf)
-        t = b"".join(t)
-        self.buf = t[size:]
-        return t[:size]
-# class _Stream
-
-class _StreamProxy(object):
-    """Small proxy class that enables transparent compression
-       detection for the Stream interface (mode 'r|*').
-    """
-
-    def __init__(self, fileobj):
-        self.fileobj = fileobj
-        self.buf = self.fileobj.read(BLOCKSIZE)
-
-    def read(self, size):
-        self.read = self.fileobj.read
-        return self.buf
-
-    def getcomptype(self):
-        if self.buf.startswith(b"\x1f\x8b\x08"):
-            return "gz"
-        elif self.buf[0:3] == b"BZh" and self.buf[4:10] == b"1AY&SY":
-            return "bz2"
-        elif self.buf.startswith((b"\x5d\x00\x00\x80", b"\xfd7zXZ")):
-            return "xz"
-        else:
-            return "tar"
-
-    def close(self):
-        self.fileobj.close()
-# class StreamProxy
-
-#------------------------
-# Extraction file object
-#------------------------
-class _FileInFile(object):
-    """A thin wrapper around an existing file object that
-       provides a part of its data as an individual file
-       object.
-    """
-
-    def __init__(self, fileobj, offset, size, name, blockinfo=None):
-        self.fileobj = fileobj
-        self.offset = offset
-        self.size = size
-        self.position = 0
-        self.name = name
-        self.closed = False
-
-        if blockinfo is None:
-            blockinfo = [(0, size)]
-
-        # Construct a map with data and zero blocks.
-        self.map_index = 0
-        self.map = []
-        lastpos = 0
-        realpos = self.offset
-        for offset, size in blockinfo:
-            if offset > lastpos:
-                self.map.append((False, lastpos, offset, None))
-            self.map.append((True, offset, offset + size, realpos))
-            realpos += size
-            lastpos = offset + size
-        if lastpos < self.size:
-            self.map.append((False, lastpos, self.size, None))
-
-    def flush(self):
-        pass
-
-    @property
-    def mode(self):
-        return 'rb'
-
-    def readable(self):
-        return True
-
-    def writable(self):
-        return False
-
-    def seekable(self):
-        return self.fileobj.seekable()
-
-    def tell(self):
-        """Return the current file position.
-        """
-        return self.position
-
-    def seek(self, position, whence=io.SEEK_SET):
-        """Seek to a position in the file.
-        """
-        if whence == io.SEEK_SET:
-            self.position = min(max(position, 0), self.size)
-        elif whence == io.SEEK_CUR:
-            if position < 0:
-                self.position = max(self.position + position, 0)
-            else:
-                self.position = min(self.position + position, self.size)
-        elif whence == io.SEEK_END:
-            self.position = max(min(self.size + position, self.size), 0)
-        else:
-            raise ValueError("Invalid argument")
-        return self.position
-
-    def read(self, size=None):
-        """Read data from the file.
-        """
-        if size is None:
-            size = self.size - self.position
-        else:
-            size = min(size, self.size - self.position)
-
-        buf = b""
-        while size > 0:
-            while True:
-                data, start, stop, offset = self.map[self.map_index]
-                if start <= self.position < stop:
-                    break
-                else:
-                    self.map_index += 1
-                    if self.map_index == len(self.map):
-                        self.map_index = 0
-            length = min(size, stop - self.position)
-            if data:
-                self.fileobj.seek(offset + (self.position - start))
-                b = self.fileobj.read(length)
-                if len(b) != length:
-                    raise ReadError("unexpected end of data")
-                buf += b
-            else:
-                buf += NUL * length
-            size -= length
-            self.position += length
-        return buf
-
-    def readinto(self, b):
-        buf = self.read(len(b))
-        b[:len(buf)] = buf
-        return len(buf)
-
-    def close(self):
-        self.closed = True
-#class _FileInFile
-
-class ExFileObject(io.BufferedReader):
-
-    def __init__(self, tarfile, tarinfo):
-        fileobj = _FileInFile(tarfile.fileobj, tarinfo.offset_data,
-                tarinfo.size, tarinfo.name, tarinfo.sparse)
-        super().__init__(fileobj)
-#class ExFileObject
-
-
-#-----------------------------
-# extraction filters (PEP 706)
-#-----------------------------
-
-class FilterError(TarError):
-    pass
-
-class AbsolutePathError(FilterError):
-    def __init__(self, tarinfo):
-        self.tarinfo = tarinfo
-        super().__init__(f'member {tarinfo.name!r} has an absolute path')
-
-class OutsideDestinationError(FilterError):
-    def __init__(self, tarinfo, path):
-        self.tarinfo = tarinfo
-        self._path = path
-        super().__init__(f'{tarinfo.name!r} would be extracted to {path!r}, '
-                         + 'which is outside the destination')
-
-class SpecialFileError(FilterError):
-    def __init__(self, tarinfo):
-        self.tarinfo = tarinfo
-        super().__init__(f'{tarinfo.name!r} is a special file')
-
-class AbsoluteLinkError(FilterError):
-    def __init__(self, tarinfo):
-        self.tarinfo = tarinfo
-        super().__init__(f'{tarinfo.name!r} is a link to an absolute path')
-
-class LinkOutsideDestinationError(FilterError):
-    def __init__(self, tarinfo, path):
-        self.tarinfo = tarinfo
-        self._path = path
-        super().__init__(f'{tarinfo.name!r} would link to {path!r}, '
-                         + 'which is outside the destination')
-
-def _get_filtered_attrs(member, dest_path, for_data=True):
-    new_attrs = {}
-    name = member.name
-    dest_path = os.path.realpath(dest_path)
-    # Strip leading / (tar's directory separator) from filenames.
-    # Include os.sep (target OS directory separator) as well.
-    if name.startswith(('/', os.sep)):
-        name = new_attrs['name'] = member.path.lstrip('/' + os.sep)
-    if os.path.isabs(name):
-        # Path is absolute even after stripping.
-        # For example, 'C:/foo' on Windows.
-        raise AbsolutePathError(member)
-    # Ensure we stay in the destination
-    target_path = os.path.realpath(os.path.join(dest_path, name))
-    if os.path.commonpath([target_path, dest_path]) != dest_path:
-        raise OutsideDestinationError(member, target_path)
-    # Limit permissions (no high bits, and go-w)
-    mode = member.mode
-    if mode is not None:
-        # Strip high bits & group/other write bits
-        mode = mode & 0o755
-        if for_data:
-            # For data, handle permissions & file types
-            if member.isreg() or member.islnk():
-                if not mode & 0o100:
-                    # Clear executable bits if not executable by user
-                    mode &= ~0o111
-                # Ensure owner can read & write
-                mode |= 0o600
-            elif member.isdir() or member.issym():
-                # Ignore mode for directories & symlinks
-                mode = None
-            else:
-                # Reject special files
-                raise SpecialFileError(member)
-        if mode != member.mode:
-            new_attrs['mode'] = mode
-    if for_data:
-        # Ignore ownership for 'data'
-        if member.uid is not None:
-            new_attrs['uid'] = None
-        if member.gid is not None:
-            new_attrs['gid'] = None
-        if member.uname is not None:
-            new_attrs['uname'] = None
-        if member.gname is not None:
-            new_attrs['gname'] = None
-        # Check link destination for 'data'
-        if member.islnk() or member.issym():
-            if os.path.isabs(member.linkname):
-                raise AbsoluteLinkError(member)
-            if member.issym():
-                target_path = os.path.join(dest_path,
-                                           os.path.dirname(name),
-                                           member.linkname)
-            else:
-                target_path = os.path.join(dest_path,
-                                           member.linkname)
-            target_path = os.path.realpath(target_path)
-            if os.path.commonpath([target_path, dest_path]) != dest_path:
-                raise LinkOutsideDestinationError(member, target_path)
-    return new_attrs
-
-def fully_trusted_filter(member, dest_path):
-    return member
-
-def tar_filter(member, dest_path):
-    new_attrs = _get_filtered_attrs(member, dest_path, False)
-    if new_attrs:
-        return member.replace(**new_attrs, deep=False)
-    return member
-
-def data_filter(member, dest_path):
-    new_attrs = _get_filtered_attrs(member, dest_path, True)
-    if new_attrs:
-        return member.replace(**new_attrs, deep=False)
-    return member
-
-_NAMED_FILTERS = {
-    "fully_trusted": fully_trusted_filter,
-    "tar": tar_filter,
-    "data": data_filter,
-}
-
-#------------------
-# Exported Classes
-#------------------
-
-# Sentinel for replace() defaults, meaning "don't change the attribute"
-_KEEP = object()
-
-class TarInfo(object):
-    """Informational class which holds the details about an
-       archive member given by a tar header block.
-       TarInfo objects are returned by TarFile.getmember(),
-       TarFile.getmembers() and TarFile.gettarinfo() and are
-       usually created internally.
-    """
-
-    __slots__ = dict(
-        name = 'Name of the archive member.',
-        mode = 'Permission bits.',
-        uid = 'User ID of the user who originally stored this member.',
-        gid = 'Group ID of the user who originally stored this member.',
-        size = 'Size in bytes.',
-        mtime = 'Time of last modification.',
-        chksum = 'Header checksum.',
-        type = ('File type. type is usually one of these constants: '
-                'REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, '
-                'CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.'),
-        linkname = ('Name of the target file name, which is only present '
-                    'in TarInfo objects of type LNKTYPE and SYMTYPE.'),
-        uname = 'User name.',
-        gname = 'Group name.',
-        devmajor = 'Device major number.',
-        devminor = 'Device minor number.',
-        offset = 'The tar header starts here.',
-        offset_data = "The file's data starts here.",
-        pax_headers = ('A dictionary containing key-value pairs of an '
-                       'associated pax extended header.'),
-        sparse = 'Sparse member information.',
-        _tarfile = None,
-        _sparse_structs = None,
-        _link_target = None,
-        )
-
-    def __init__(self, name=""):
-        """Construct a TarInfo object. name is the optional name
-           of the member.
-        """
-        self.name = name        # member name
-        self.mode = 0o644       # file permissions
-        self.uid = 0            # user id
-        self.gid = 0            # group id
-        self.size = 0           # file size
-        self.mtime = 0          # modification time
-        self.chksum = 0         # header checksum
-        self.type = REGTYPE     # member type
-        self.linkname = ""      # link name
-        self.uname = ""         # user name
-        self.gname = ""         # group name
-        self.devmajor = 0       # device major number
-        self.devminor = 0       # device minor number
-
-        self.offset = 0         # the tar header starts here
-        self.offset_data = 0    # the file's data starts here
-
-        self.sparse = None      # sparse member information
-        self.pax_headers = {}   # pax header information
-
-    @property
-    def tarfile(self):
-        import warnings
-        warnings.warn(
-            'The undocumented "tarfile" attribute of TarInfo objects '
-            + 'is deprecated and will be removed in Python 3.16',
-            DeprecationWarning, stacklevel=2)
-        return self._tarfile
-
-    @tarfile.setter
-    def tarfile(self, tarfile):
-        import warnings
-        warnings.warn(
-            'The undocumented "tarfile" attribute of TarInfo objects '
-            + 'is deprecated and will be removed in Python 3.16',
-            DeprecationWarning, stacklevel=2)
-        self._tarfile = tarfile
-
-    @property
-    def path(self):
-        'In pax headers, "name" is called "path".'
-        return self.name
-
-    @path.setter
-    def path(self, name):
-        self.name = name
-
-    @property
-    def linkpath(self):
-        'In pax headers, "linkname" is called "linkpath".'
-        return self.linkname
-
-    @linkpath.setter
-    def linkpath(self, linkname):
-        self.linkname = linkname
-
-    def __repr__(self):
-        return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self))
-
-    def replace(self, *,
-                name=_KEEP, mtime=_KEEP, mode=_KEEP, linkname=_KEEP,
-                uid=_KEEP, gid=_KEEP, uname=_KEEP, gname=_KEEP,
-                deep=True, _KEEP=_KEEP):
-        """Return a deep copy of self with the given attributes replaced.
-        """
-        if deep:
-            result = copy.deepcopy(self)
-        else:
-            result = copy.copy(self)
-        if name is not _KEEP:
-            result.name = name
-        if mtime is not _KEEP:
-            result.mtime = mtime
-        if mode is not _KEEP:
-            result.mode = mode
-        if linkname is not _KEEP:
-            result.linkname = linkname
-        if uid is not _KEEP:
-            result.uid = uid
-        if gid is not _KEEP:
-            result.gid = gid
-        if uname is not _KEEP:
-            result.uname = uname
-        if gname is not _KEEP:
-            result.gname = gname
-        return result
-
-    def get_info(self):
-        """Return the TarInfo's attributes as a dictionary.
-        """
-        if self.mode is None:
-            mode = None
-        else:
-            mode = self.mode & 0o7777
-        info = {
-            "name":     self.name,
-            "mode":     mode,
-            "uid":      self.uid,
-            "gid":      self.gid,
-            "size":     self.size,
-            "mtime":    self.mtime,
-            "chksum":   self.chksum,
-            "type":     self.type,
-            "linkname": self.linkname,
-            "uname":    self.uname,
-            "gname":    self.gname,
-            "devmajor": self.devmajor,
-            "devminor": self.devminor
-        }
-
-        if info["type"] == DIRTYPE and not info["name"].endswith("/"):
-            info["name"] += "/"
-
-        return info
-
-    def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"):
-        """Return a tar header as a string of 512 byte blocks.
-        """
-        info = self.get_info()
-        for name, value in info.items():
-            if value is None:
-                raise ValueError("%s may not be None" % name)
-
-        if format == USTAR_FORMAT:
-            return self.create_ustar_header(info, encoding, errors)
-        elif format == GNU_FORMAT:
-            return self.create_gnu_header(info, encoding, errors)
-        elif format == PAX_FORMAT:
-            return self.create_pax_header(info, encoding)
-        else:
-            raise ValueError("invalid format")
-
-    def create_ustar_header(self, info, encoding, errors):
-        """Return the object as a ustar header block.
-        """
-        info["magic"] = POSIX_MAGIC
-
-        if len(info["linkname"].encode(encoding, errors)) > LENGTH_LINK:
-            raise ValueError("linkname is too long")
-
-        if len(info["name"].encode(encoding, errors)) > LENGTH_NAME:
-            info["prefix"], info["name"] = self._posix_split_name(info["name"], encoding, errors)
-
-        return self._create_header(info, USTAR_FORMAT, encoding, errors)
-
-    def create_gnu_header(self, info, encoding, errors):
-        """Return the object as a GNU header block sequence.
-        """
-        info["magic"] = GNU_MAGIC
-
-        buf = b""
-        if len(info["linkname"].encode(encoding, errors)) > LENGTH_LINK:
-            buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK, encoding, errors)
-
-        if len(info["name"].encode(encoding, errors)) > LENGTH_NAME:
-            buf += self._create_gnu_long_header(info["name"], GNUTYPE_LONGNAME, encoding, errors)
-
-        return buf + self._create_header(info, GNU_FORMAT, encoding, errors)
-
-    def create_pax_header(self, info, encoding):
-        """Return the object as a ustar header block. If it cannot be
-           represented this way, prepend a pax extended header sequence
-           with supplement information.
-        """
-        info["magic"] = POSIX_MAGIC
-        pax_headers = self.pax_headers.copy()
-
-        # Test string fields for values that exceed the field length or cannot
-        # be represented in ASCII encoding.
-        for name, hname, length in (
-                ("name", "path", LENGTH_NAME), ("linkname", "linkpath", LENGTH_LINK),
-                ("uname", "uname", 32), ("gname", "gname", 32)):
-
-            if hname in pax_headers:
-                # The pax header has priority.
-                continue
-
-            # Try to encode the string as ASCII.
-            try:
-                info[name].encode("ascii", "strict")
-            except UnicodeEncodeError:
-                pax_headers[hname] = info[name]
-                continue
-
-            if len(info[name]) > length:
-                pax_headers[hname] = info[name]
-
-        # Test number fields for values that exceed the field limit or values
-        # that like to be stored as float.
-        for name, digits in (("uid", 8), ("gid", 8), ("size", 12), ("mtime", 12)):
-            needs_pax = False
-
-            val = info[name]
-            val_is_float = isinstance(val, float)
-            val_int = round(val) if val_is_float else val
-            if not 0 <= val_int < 8 ** (digits - 1):
-                # Avoid overflow.
-                info[name] = 0
-                needs_pax = True
-            elif val_is_float:
-                # Put rounded value in ustar header, and full
-                # precision value in pax header.
-                info[name] = val_int
-                needs_pax = True
-
-            # The existing pax header has priority.
-            if needs_pax and name not in pax_headers:
-                pax_headers[name] = str(val)
-
-        # Create a pax extended header if necessary.
-        if pax_headers:
-            buf = self._create_pax_generic_header(pax_headers, XHDTYPE, encoding)
-        else:
-            buf = b""
-
-        return buf + self._create_header(info, USTAR_FORMAT, "ascii", "replace")
-
-    @classmethod
-    def create_pax_global_header(cls, pax_headers):
-        """Return the object as a pax global header block sequence.
-        """
-        return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf-8")
-
-    def _posix_split_name(self, name, encoding, errors):
-        """Split a name longer than 100 chars into a prefix
-           and a name part.
-        """
-        components = name.split("/")
-        for i in range(1, len(components)):
-            prefix = "/".join(components[:i])
-            name = "/".join(components[i:])
-            if len(prefix.encode(encoding, errors)) <= LENGTH_PREFIX and \
-                    len(name.encode(encoding, errors)) <= LENGTH_NAME:
-                break
-        else:
-            raise ValueError("name is too long")
-
-        return prefix, name
-
-    @staticmethod
-    def _create_header(info, format, encoding, errors):
-        """Return a header block. info is a dictionary with file
-           information, format must be one of the *_FORMAT constants.
-        """
-        has_device_fields = info.get("type") in (CHRTYPE, BLKTYPE)
-        if has_device_fields:
-            devmajor = itn(info.get("devmajor", 0), 8, format)
-            devminor = itn(info.get("devminor", 0), 8, format)
-        else:
-            devmajor = stn("", 8, encoding, errors)
-            devminor = stn("", 8, encoding, errors)
-
-        # None values in metadata should cause ValueError.
-        # itn()/stn() do this for all fields except type.
-        filetype = info.get("type", REGTYPE)
-        if filetype is None:
-            raise ValueError("TarInfo.type must not be None")
-
-        parts = [
-            stn(info.get("name", ""), 100, encoding, errors),
-            itn(info.get("mode", 0) & 0o7777, 8, format),
-            itn(info.get("uid", 0), 8, format),
-            itn(info.get("gid", 0), 8, format),
-            itn(info.get("size", 0), 12, format),
-            itn(info.get("mtime", 0), 12, format),
-            b"        ", # checksum field
-            filetype,
-            stn(info.get("linkname", ""), 100, encoding, errors),
-            info.get("magic", POSIX_MAGIC),
-            stn(info.get("uname", ""), 32, encoding, errors),
-            stn(info.get("gname", ""), 32, encoding, errors),
-            devmajor,
-            devminor,
-            stn(info.get("prefix", ""), 155, encoding, errors)
-        ]
-
-        buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts))
-        chksum = calc_chksums(buf[-BLOCKSIZE:])[0]
-        buf = buf[:-364] + bytes("%06o\0" % chksum, "ascii") + buf[-357:]
-        return buf
-
-    @staticmethod
-    def _create_payload(payload):
-        """Return the string payload filled with zero bytes
-           up to the next 512 byte border.
-        """
-        blocks, remainder = divmod(len(payload), BLOCKSIZE)
-        if remainder > 0:
-            payload += (BLOCKSIZE - remainder) * NUL
-        return payload
-
-    @classmethod
-    def _create_gnu_long_header(cls, name, type, encoding, errors):
-        """Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
-           for name.
-        """
-        name = name.encode(encoding, errors) + NUL
-
-        info = {}
-        info["name"] = "././@LongLink"
-        info["type"] = type
-        info["size"] = len(name)
-        info["magic"] = GNU_MAGIC
-
-        # create extended header + name blocks.
-        return cls._create_header(info, USTAR_FORMAT, encoding, errors) + \
-                cls._create_payload(name)
-
-    @classmethod
-    def _create_pax_generic_header(cls, pax_headers, type, encoding):
-        """Return a POSIX.1-2008 extended or global header sequence
-           that contains a list of keyword, value pairs. The values
-           must be strings.
-        """
-        # Check if one of the fields contains surrogate characters and thereby
-        # forces hdrcharset=BINARY, see _proc_pax() for more information.
-        binary = False
-        for keyword, value in pax_headers.items():
-            try:
-                value.encode("utf-8", "strict")
-            except UnicodeEncodeError:
-                binary = True
-                break
-
-        records = b""
-        if binary:
-            # Put the hdrcharset field at the beginning of the header.
-            records += b"21 hdrcharset=BINARY\n"
-
-        for keyword, value in pax_headers.items():
-            keyword = keyword.encode("utf-8")
-            if binary:
-                # Try to restore the original byte representation of 'value'.
-                # Needless to say, that the encoding must match the string.
-                value = value.encode(encoding, "surrogateescape")
-            else:
-                value = value.encode("utf-8")
-
-            l = len(keyword) + len(value) + 3   # ' ' + '=' + '\n'
-            n = p = 0
-            while True:
-                n = l + len(str(p))
-                if n == p:
-                    break
-                p = n
-            records += bytes(str(p), "ascii") + b" " + keyword + b"=" + value + b"\n"
-
-        # We use a hardcoded "././@PaxHeader" name like star does
-        # instead of the one that POSIX recommends.
-        info = {}
-        info["name"] = "././@PaxHeader"
-        info["type"] = type
-        info["size"] = len(records)
-        info["magic"] = POSIX_MAGIC
-
-        # Create pax header + record blocks.
-        return cls._create_header(info, USTAR_FORMAT, "ascii", "replace") + \
-                cls._create_payload(records)
-
-    @classmethod
-    def frombuf(cls, buf, encoding, errors):
-        """Construct a TarInfo object from a 512 byte bytes object.
-        """
-        if len(buf) == 0:
-            raise EmptyHeaderError("empty header")
-        if len(buf) != BLOCKSIZE:
-            raise TruncatedHeaderError("truncated header")
-        if buf.count(NUL) == BLOCKSIZE:
-            raise EOFHeaderError("end of file header")
-
-        chksum = nti(buf[148:156])
-        if chksum not in calc_chksums(buf):
-            raise InvalidHeaderError("bad checksum")
-
-        obj = cls()
-        obj.name = nts(buf[0:100], encoding, errors)
-        obj.mode = nti(buf[100:108])
-        obj.uid = nti(buf[108:116])
-        obj.gid = nti(buf[116:124])
-        obj.size = nti(buf[124:136])
-        obj.mtime = nti(buf[136:148])
-        obj.chksum = chksum
-        obj.type = buf[156:157]
-        obj.linkname = nts(buf[157:257], encoding, errors)
-        obj.uname = nts(buf[265:297], encoding, errors)
-        obj.gname = nts(buf[297:329], encoding, errors)
-        obj.devmajor = nti(buf[329:337])
-        obj.devminor = nti(buf[337:345])
-        prefix = nts(buf[345:500], encoding, errors)
-
-        # Old V7 tar format represents a directory as a regular
-        # file with a trailing slash.
-        if obj.type == AREGTYPE and obj.name.endswith("/"):
-            obj.type = DIRTYPE
-
-        # The old GNU sparse format occupies some of the unused
-        # space in the buffer for up to 4 sparse structures.
-        # Save them for later processing in _proc_sparse().
-        if obj.type == GNUTYPE_SPARSE:
-            pos = 386
-            structs = []
-            for i in range(4):
-                try:
-                    offset = nti(buf[pos:pos + 12])
-                    numbytes = nti(buf[pos + 12:pos + 24])
-                except ValueError:
-                    break
-                structs.append((offset, numbytes))
-                pos += 24
-            isextended = bool(buf[482])
-            origsize = nti(buf[483:495])
-            obj._sparse_structs = (structs, isextended, origsize)
-
-        # Remove redundant slashes from directories.
-        if obj.isdir():
-            obj.name = obj.name.rstrip("/")
-
-        # Reconstruct a ustar longname.
-        if prefix and obj.type not in GNU_TYPES:
-            obj.name = prefix + "/" + obj.name
-        return obj
-
-    @classmethod
-    def fromtarfile(cls, tarfile):
-        """Return the next TarInfo object from TarFile object
-           tarfile.
-        """
-        buf = tarfile.fileobj.read(BLOCKSIZE)
-        obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
-        obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
-        return obj._proc_member(tarfile)
-
-    #--------------------------------------------------------------------------
-    # The following are methods that are called depending on the type of a
-    # member. The entry point is _proc_member() which can be overridden in a
-    # subclass to add custom _proc_*() methods. A _proc_*() method MUST
-    # implement the following
-    # operations:
-    # 1. Set self.offset_data to the position where the data blocks begin,
-    #    if there is data that follows.
-    # 2. Set tarfile.offset to the position where the next member's header will
-    #    begin.
-    # 3. Return self or another valid TarInfo object.
-    def _proc_member(self, tarfile):
-        """Choose the right processing method depending on
-           the type and call it.
-        """
-        if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK):
-            return self._proc_gnulong(tarfile)
-        elif self.type == GNUTYPE_SPARSE:
-            return self._proc_sparse(tarfile)
-        elif self.type in (XHDTYPE, XGLTYPE, SOLARIS_XHDTYPE):
-            return self._proc_pax(tarfile)
-        else:
-            return self._proc_builtin(tarfile)
-
-    def _proc_builtin(self, tarfile):
-        """Process a builtin type or an unknown type which
-           will be treated as a regular file.
-        """
-        self.offset_data = tarfile.fileobj.tell()
-        offset = self.offset_data
-        if self.isreg() or self.type not in SUPPORTED_TYPES:
-            # Skip the following data blocks.
-            offset += self._block(self.size)
-        tarfile.offset = offset
-
-        # Patch the TarInfo object with saved global
-        # header information.
-        self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors)
-
-        # Remove redundant slashes from directories. This is to be consistent
-        # with frombuf().
-        if self.isdir():
-            self.name = self.name.rstrip("/")
-
-        return self
-
-    def _proc_gnulong(self, tarfile):
-        """Process the blocks that hold a GNU longname
-           or longlink member.
-        """
-        buf = tarfile.fileobj.read(self._block(self.size))
-
-        # Fetch the next header and process it.
-        try:
-            next = self.fromtarfile(tarfile)
-        except HeaderError as e:
-            raise SubsequentHeaderError(str(e)) from None
-
-        # Patch the TarInfo object from the next header with
-        # the longname information.
-        next.offset = self.offset
-        if self.type == GNUTYPE_LONGNAME:
-            next.name = nts(buf, tarfile.encoding, tarfile.errors)
-        elif self.type == GNUTYPE_LONGLINK:
-            next.linkname = nts(buf, tarfile.encoding, tarfile.errors)
-
-        # Remove redundant slashes from directories. This is to be consistent
-        # with frombuf().
-        if next.isdir():
-            next.name = removesuffix(next.name, "/")
-
-        return next
-
-    def _proc_sparse(self, tarfile):
-        """Process a GNU sparse header plus extra headers.
-        """
-        # We already collected some sparse structures in frombuf().
-        structs, isextended, origsize = self._sparse_structs
-        del self._sparse_structs
-
-        # Collect sparse structures from extended header blocks.
-        while isextended:
-            buf = tarfile.fileobj.read(BLOCKSIZE)
-            pos = 0
-            for i in range(21):
-                try:
-                    offset = nti(buf[pos:pos + 12])
-                    numbytes = nti(buf[pos + 12:pos + 24])
-                except ValueError:
-                    break
-                if offset and numbytes:
-                    structs.append((offset, numbytes))
-                pos += 24
-            isextended = bool(buf[504])
-        self.sparse = structs
-
-        self.offset_data = tarfile.fileobj.tell()
-        tarfile.offset = self.offset_data + self._block(self.size)
-        self.size = origsize
-        return self
-
-    def _proc_pax(self, tarfile):
-        """Process an extended or global header as described in
-           POSIX.1-2008.
-        """
-        # Read the header information.
-        buf = tarfile.fileobj.read(self._block(self.size))
-
-        # A pax header stores supplemental information for either
-        # the following file (extended) or all following files
-        # (global).
-        if self.type == XGLTYPE:
-            pax_headers = tarfile.pax_headers
-        else:
-            pax_headers = tarfile.pax_headers.copy()
-
-        # Check if the pax header contains a hdrcharset field. This tells us
-        # the encoding of the path, linkpath, uname and gname fields. Normally,
-        # these fields are UTF-8 encoded but since POSIX.1-2008 tar
-        # implementations are allowed to store them as raw binary strings if
-        # the translation to UTF-8 fails.
-        match = re.search(br"\d+ hdrcharset=([^\n]+)\n", buf)
-        if match is not None:
-            pax_headers["hdrcharset"] = match.group(1).decode("utf-8")
-
-        # For the time being, we don't care about anything other than "BINARY".
-        # The only other value that is currently allowed by the standard is
-        # "ISO-IR 10646 2000 UTF-8" in other words UTF-8.
-        hdrcharset = pax_headers.get("hdrcharset")
-        if hdrcharset == "BINARY":
-            encoding = tarfile.encoding
-        else:
-            encoding = "utf-8"
-
-        # Parse pax header information. A record looks like that:
-        # "%d %s=%s\n" % (length, keyword, value). length is the size
-        # of the complete record including the length field itself and
-        # the newline. keyword and value are both UTF-8 encoded strings.
-        regex = re.compile(br"(\d+) ([^=]+)=")
-        pos = 0
-        while match := regex.match(buf, pos):
-            length, keyword = match.groups()
-            length = int(length)
-            if length == 0:
-                raise InvalidHeaderError("invalid header")
-            value = buf[match.end(2) + 1:match.start(1) + length - 1]
-
-            # Normally, we could just use "utf-8" as the encoding and "strict"
-            # as the error handler, but we better not take the risk. For
-            # example, GNU tar <= 1.23 is known to store filenames it cannot
-            # translate to UTF-8 as raw strings (unfortunately without a
-            # hdrcharset=BINARY header).
-            # We first try the strict standard encoding, and if that fails we
-            # fall back on the user's encoding and error handler.
-            keyword = self._decode_pax_field(keyword, "utf-8", "utf-8",
-                    tarfile.errors)
-            if keyword in PAX_NAME_FIELDS:
-                value = self._decode_pax_field(value, encoding, tarfile.encoding,
-                        tarfile.errors)
-            else:
-                value = self._decode_pax_field(value, "utf-8", "utf-8",
-                        tarfile.errors)
-
-            pax_headers[keyword] = value
-            pos += length
-
-        # Fetch the next header.
-        try:
-            next = self.fromtarfile(tarfile)
-        except HeaderError as e:
-            raise SubsequentHeaderError(str(e)) from None
-
-        # Process GNU sparse information.
-        if "GNU.sparse.map" in pax_headers:
-            # GNU extended sparse format version 0.1.
-            self._proc_gnusparse_01(next, pax_headers)
-
-        elif "GNU.sparse.size" in pax_headers:
-            # GNU extended sparse format version 0.0.
-            self._proc_gnusparse_00(next, pax_headers, buf)
-
-        elif pax_headers.get("GNU.sparse.major") == "1" and pax_headers.get("GNU.sparse.minor") == "0":
-            # GNU extended sparse format version 1.0.
-            self._proc_gnusparse_10(next, pax_headers, tarfile)
-
-        if self.type in (XHDTYPE, SOLARIS_XHDTYPE):
-            # Patch the TarInfo object with the extended header info.
-            next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
-            next.offset = self.offset
-
-            if "size" in pax_headers:
-                # If the extended header replaces the size field,
-                # we need to recalculate the offset where the next
-                # header starts.
-                offset = next.offset_data
-                if next.isreg() or next.type not in SUPPORTED_TYPES:
-                    offset += next._block(next.size)
-                tarfile.offset = offset
-
-        return next
-
-    def _proc_gnusparse_00(self, next, pax_headers, buf):
-        """Process a GNU tar extended sparse header, version 0.0.
-        """
-        offsets = []
-        for match in re.finditer(br"\d+ GNU.sparse.offset=(\d+)\n", buf):
-            offsets.append(int(match.group(1)))
-        numbytes = []
-        for match in re.finditer(br"\d+ GNU.sparse.numbytes=(\d+)\n", buf):
-            numbytes.append(int(match.group(1)))
-        next.sparse = list(zip(offsets, numbytes))
-
-    def _proc_gnusparse_01(self, next, pax_headers):
-        """Process a GNU tar extended sparse header, version 0.1.
-        """
-        sparse = [int(x) for x in pax_headers["GNU.sparse.map"].split(",")]
-        next.sparse = list(zip(sparse[::2], sparse[1::2]))
-
-    def _proc_gnusparse_10(self, next, pax_headers, tarfile):
-        """Process a GNU tar extended sparse header, version 1.0.
-        """
-        fields = None
-        sparse = []
-        buf = tarfile.fileobj.read(BLOCKSIZE)
-        fields, buf = buf.split(b"\n", 1)
-        fields = int(fields)
-        while len(sparse) < fields * 2:
-            if b"\n" not in buf:
-                buf += tarfile.fileobj.read(BLOCKSIZE)
-            number, buf = buf.split(b"\n", 1)
-            sparse.append(int(number))
-        next.offset_data = tarfile.fileobj.tell()
-        next.sparse = list(zip(sparse[::2], sparse[1::2]))
-
-    def _apply_pax_info(self, pax_headers, encoding, errors):
-        """Replace fields with supplemental information from a previous
-           pax extended or global header.
-        """
-        for keyword, value in pax_headers.items():
-            if keyword == "GNU.sparse.name":
-                setattr(self, "path", value)
-            elif keyword == "GNU.sparse.size":
-                setattr(self, "size", int(value))
-            elif keyword == "GNU.sparse.realsize":
-                setattr(self, "size", int(value))
-            elif keyword in PAX_FIELDS:
-                if keyword in PAX_NUMBER_FIELDS:
-                    try:
-                        value = PAX_NUMBER_FIELDS[keyword](value)
-                    except ValueError:
-                        value = 0
-                if keyword == "path":
-                    value = value.rstrip("/")
-                setattr(self, keyword, value)
-
-        self.pax_headers = pax_headers.copy()
-
-    def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors):
-        """Decode a single field from a pax record.
-        """
-        try:
-            return value.decode(encoding, "strict")
-        except UnicodeDecodeError:
-            return value.decode(fallback_encoding, fallback_errors)
-
-    def _block(self, count):
-        """Round up a byte count by BLOCKSIZE and return it,
-           e.g. _block(834) => 1024.
-        """
-        blocks, remainder = divmod(count, BLOCKSIZE)
-        if remainder:
-            blocks += 1
-        return blocks * BLOCKSIZE
-
-    def isreg(self):
-        'Return True if the Tarinfo object is a regular file.'
-        return self.type in REGULAR_TYPES
-
-    def isfile(self):
-        'Return True if the Tarinfo object is a regular file.'
-        return self.isreg()
-
-    def isdir(self):
-        'Return True if it is a directory.'
-        return self.type == DIRTYPE
-
-    def issym(self):
-        'Return True if it is a symbolic link.'
-        return self.type == SYMTYPE
-
-    def islnk(self):
-        'Return True if it is a hard link.'
-        return self.type == LNKTYPE
-
-    def ischr(self):
-        'Return True if it is a character device.'
-        return self.type == CHRTYPE
-
-    def isblk(self):
-        'Return True if it is a block device.'
-        return self.type == BLKTYPE
-
-    def isfifo(self):
-        'Return True if it is a FIFO.'
-        return self.type == FIFOTYPE
-
-    def issparse(self):
-        return self.sparse is not None
-
-    def isdev(self):
-        'Return True if it is one of character device, block device or FIFO.'
-        return self.type in (CHRTYPE, BLKTYPE, FIFOTYPE)
-# class TarInfo
-
-class TarFile(object):
-    """The TarFile Class provides an interface to tar archives.
-    """
-
-    debug = 0                   # May be set from 0 (no msgs) to 3 (all msgs)
-
-    dereference = False         # If true, add content of linked file to the
-                                # tar file, else the link.
-
-    ignore_zeros = False        # If true, skips empty or invalid blocks and
-                                # continues processing.
-
-    errorlevel = 1              # If 0, fatal errors only appear in debug
-                                # messages (if debug >= 0). If > 0, errors
-                                # are passed to the caller as exceptions.
-
-    format = DEFAULT_FORMAT     # The format to use when creating an archive.
-
-    encoding = ENCODING         # Encoding for 8-bit character strings.
-
-    errors = None               # Error handler for unicode conversion.
-
-    tarinfo = TarInfo           # The default TarInfo class to use.
-
-    fileobject = ExFileObject   # The file-object for extractfile().
-
-    extraction_filter = None    # The default filter for extraction.
-
-    def __init__(self, name=None, mode="r", fileobj=None, format=None,
-            tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
-            errors="surrogateescape", pax_headers=None, debug=None,
-            errorlevel=None, copybufsize=None, stream=False):
-        """Open an (uncompressed) tar archive 'name'. 'mode' is either 'r' to
-           read from an existing archive, 'a' to append data to an existing
-           file or 'w' to create a new file overwriting an existing one. 'mode'
-           defaults to 'r'.
-           If 'fileobj' is given, it is used for reading or writing data. If it
-           can be determined, 'mode' is overridden by 'fileobj's mode.
-           'fileobj' is not closed, when TarFile is closed.
-        """
-        modes = {"r": "rb", "a": "r+b", "w": "wb", "x": "xb"}
-        if mode not in modes:
-            raise ValueError("mode must be 'r', 'a', 'w' or 'x'")
-        self.mode = mode
-        self._mode = modes[mode]
-
-        if not fileobj:
-            if self.mode == "a" and not os.path.exists(name):
-                # Create nonexistent files in append mode.
-                self.mode = "w"
-                self._mode = "wb"
-            fileobj = bltn_open(name, self._mode)
-            self._extfileobj = False
-        else:
-            if (name is None and hasattr(fileobj, "name") and
-                isinstance(fileobj.name, (str, bytes))):
-                name = fileobj.name
-            if hasattr(fileobj, "mode"):
-                self._mode = fileobj.mode
-            self._extfileobj = True
-        self.name = os.path.abspath(name) if name else None
-        self.fileobj = fileobj
-
-        self.stream = stream
-
-        # Init attributes.
-        if format is not None:
-            self.format = format
-        if tarinfo is not None:
-            self.tarinfo = tarinfo
-        if dereference is not None:
-            self.dereference = dereference
-        if ignore_zeros is not None:
-            self.ignore_zeros = ignore_zeros
-        if encoding is not None:
-            self.encoding = encoding
-        self.errors = errors
-
-        if pax_headers is not None and self.format == PAX_FORMAT:
-            self.pax_headers = pax_headers
-        else:
-            self.pax_headers = {}
-
-        if debug is not None:
-            self.debug = debug
-        if errorlevel is not None:
-            self.errorlevel = errorlevel
-
-        # Init datastructures.
-        self.copybufsize = copybufsize
-        self.closed = False
-        self.members = []       # list of members as TarInfo objects
-        self._loaded = False    # flag if all members have been read
-        self.offset = self.fileobj.tell()
-                                # current position in the archive file
-        self.inodes = {}        # dictionary caching the inodes of
-                                # archive members already added
-
-        try:
-            if self.mode == "r":
-                self.firstmember = None
-                self.firstmember = self.next()
-
-            if self.mode == "a":
-                # Move to the end of the archive,
-                # before the first empty block.
-                while True:
-                    self.fileobj.seek(self.offset)
-                    try:
-                        tarinfo = self.tarinfo.fromtarfile(self)
-                        self.members.append(tarinfo)
-                    except EOFHeaderError:
-                        self.fileobj.seek(self.offset)
-                        break
-                    except HeaderError as e:
-                        raise ReadError(str(e)) from None
-
-            if self.mode in ("a", "w", "x"):
-                self._loaded = True
-
-                if self.pax_headers:
-                    buf = self.tarinfo.create_pax_global_header(self.pax_headers.copy())
-                    self.fileobj.write(buf)
-                    self.offset += len(buf)
-        except:
-            if not self._extfileobj:
-                self.fileobj.close()
-            self.closed = True
-            raise
-
-    #--------------------------------------------------------------------------
-    # Below are the classmethods which act as alternate constructors to the
-    # TarFile class. The open() method is the only one that is needed for
-    # public use; it is the "super"-constructor and is able to select an
-    # adequate "sub"-constructor for a particular compression using the mapping
-    # from OPEN_METH.
-    #
-    # This concept allows one to subclass TarFile without losing the comfort of
-    # the super-constructor. A sub-constructor is registered and made available
-    # by adding it to the mapping in OPEN_METH.
-
-    @classmethod
-    def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs):
-        r"""Open a tar archive for reading, writing or appending. Return
-           an appropriate TarFile class.
-
-           mode:
-           'r' or 'r:\*' open for reading with transparent compression
-           'r:'         open for reading exclusively uncompressed
-           'r:gz'       open for reading with gzip compression
-           'r:bz2'      open for reading with bzip2 compression
-           'r:xz'       open for reading with lzma compression
-           'a' or 'a:'  open for appending, creating the file if necessary
-           'w' or 'w:'  open for writing without compression
-           'w:gz'       open for writing with gzip compression
-           'w:bz2'      open for writing with bzip2 compression
-           'w:xz'       open for writing with lzma compression
-
-           'x' or 'x:'  create a tarfile exclusively without compression, raise
-                        an exception if the file is already created
-           'x:gz'       create a gzip compressed tarfile, raise an exception
-                        if the file is already created
-           'x:bz2'      create a bzip2 compressed tarfile, raise an exception
-                        if the file is already created
-           'x:xz'       create an lzma compressed tarfile, raise an exception
-                        if the file is already created
-
-           'r|\*'        open a stream of tar blocks with transparent compression
-           'r|'         open an uncompressed stream of tar blocks for reading
-           'r|gz'       open a gzip compressed stream of tar blocks
-           'r|bz2'      open a bzip2 compressed stream of tar blocks
-           'r|xz'       open an lzma compressed stream of tar blocks
-           'w|'         open an uncompressed stream for writing
-           'w|gz'       open a gzip compressed stream for writing
-           'w|bz2'      open a bzip2 compressed stream for writing
-           'w|xz'       open an lzma compressed stream for writing
-        """
-
-        if not name and not fileobj:
-            raise ValueError("nothing to open")
-
-        if mode in ("r", "r:*"):
-            # Find out which *open() is appropriate for opening the file.
-            def not_compressed(comptype):
-                return cls.OPEN_METH[comptype] == 'taropen'
-            error_msgs = []
-            for comptype in sorted(cls.OPEN_METH, key=not_compressed):
-                func = getattr(cls, cls.OPEN_METH[comptype])
-                if fileobj is not None:
-                    saved_pos = fileobj.tell()
-                try:
-                    return func(name, "r", fileobj, **kwargs)
-                except (ReadError, CompressionError) as e:
-                    error_msgs.append(f'- method {comptype}: {e!r}')
-                    if fileobj is not None:
-                        fileobj.seek(saved_pos)
-                    continue
-            error_msgs_summary = '\n'.join(error_msgs)
-            raise ReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
-
-        elif ":" in mode:
-            filemode, comptype = mode.split(":", 1)
-            filemode = filemode or "r"
-            comptype = comptype or "tar"
-
-            # Select the *open() function according to
-            # given compression.
-            if comptype in cls.OPEN_METH:
-                func = getattr(cls, cls.OPEN_METH[comptype])
-            else:
-                raise CompressionError("unknown compression type %r" % comptype)
-            return func(name, filemode, fileobj, **kwargs)
-
-        elif "|" in mode:
-            filemode, comptype = mode.split("|", 1)
-            filemode = filemode or "r"
-            comptype = comptype or "tar"
-
-            if filemode not in ("r", "w"):
-                raise ValueError("mode must be 'r' or 'w'")
-
-            compresslevel = kwargs.pop("compresslevel", 9)
-            stream = _Stream(name, filemode, comptype, fileobj, bufsize,
-                             compresslevel)
-            try:
-                t = cls(name, filemode, stream, **kwargs)
-            except:
-                stream.close()
-                raise
-            t._extfileobj = False
-            return t
-
-        elif mode in ("a", "w", "x"):
-            return cls.taropen(name, mode, fileobj, **kwargs)
-
-        raise ValueError("undiscernible mode")
-
-    @classmethod
-    def taropen(cls, name, mode="r", fileobj=None, **kwargs):
-        """Open uncompressed tar archive name for reading or writing.
-        """
-        if mode not in ("r", "a", "w", "x"):
-            raise ValueError("mode must be 'r', 'a', 'w' or 'x'")
-        return cls(name, mode, fileobj, **kwargs)
-
-    @classmethod
-    def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
-        """Open gzip compressed tar archive name for reading or writing.
-           Appending is not allowed.
-        """
-        if mode not in ("r", "w", "x"):
-            raise ValueError("mode must be 'r', 'w' or 'x'")
-
-        try:
-            from gzip import GzipFile
-        except ImportError:
-            raise CompressionError("gzip module is not available") from None
-
-        try:
-            fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
-        except OSError as e:
-            if fileobj is not None and mode == 'r':
-                raise ReadError("not a gzip file") from e
-            raise
-
-        try:
-            t = cls.taropen(name, mode, fileobj, **kwargs)
-        except OSError as e:
-            fileobj.close()
-            if mode == 'r':
-                raise ReadError("not a gzip file") from e
-            raise
-        except:
-            fileobj.close()
-            raise
-        t._extfileobj = False
-        return t
-
-    @classmethod
-    def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
-        """Open bzip2 compressed tar archive name for reading or writing.
-           Appending is not allowed.
-        """
-        if mode not in ("r", "w", "x"):
-            raise ValueError("mode must be 'r', 'w' or 'x'")
-
-        try:
-            from bz2 import BZ2File
-        except ImportError:
-            raise CompressionError("bz2 module is not available") from None
-
-        fileobj = BZ2File(fileobj or name, mode, compresslevel=compresslevel)
-
-        try:
-            t = cls.taropen(name, mode, fileobj, **kwargs)
-        except (OSError, EOFError) as e:
-            fileobj.close()
-            if mode == 'r':
-                raise ReadError("not a bzip2 file") from e
-            raise
-        except:
-            fileobj.close()
-            raise
-        t._extfileobj = False
-        return t
-
-    @classmethod
-    def xzopen(cls, name, mode="r", fileobj=None, preset=None, **kwargs):
-        """Open lzma compressed tar archive name for reading or writing.
-           Appending is not allowed.
-        """
-        if mode not in ("r", "w", "x"):
-            raise ValueError("mode must be 'r', 'w' or 'x'")
-
-        try:
-            from lzma import LZMAFile, LZMAError
-        except ImportError:
-            raise CompressionError("lzma module is not available") from None
-
-        fileobj = LZMAFile(fileobj or name, mode, preset=preset)
-
-        try:
-            t = cls.taropen(name, mode, fileobj, **kwargs)
-        except (LZMAError, EOFError) as e:
-            fileobj.close()
-            if mode == 'r':
-                raise ReadError("not an lzma file") from e
-            raise
-        except:
-            fileobj.close()
-            raise
-        t._extfileobj = False
-        return t
-
-    # All *open() methods are registered here.
-    OPEN_METH = {
-        "tar": "taropen",   # uncompressed tar
-        "gz":  "gzopen",    # gzip compressed tar
-        "bz2": "bz2open",   # bzip2 compressed tar
-        "xz":  "xzopen"     # lzma compressed tar
-    }
-
-    #--------------------------------------------------------------------------
-    # The public methods which TarFile provides:
-
-    def close(self):
-        """Close the TarFile. In write-mode, two finishing zero blocks are
-           appended to the archive.
-        """
-        if self.closed:
-            return
-
-        self.closed = True
-        try:
-            if self.mode in ("a", "w", "x"):
-                self.fileobj.write(NUL * (BLOCKSIZE * 2))
-                self.offset += (BLOCKSIZE * 2)
-                # fill up the end with zero-blocks
-                # (like option -b20 for tar does)
-                blocks, remainder = divmod(self.offset, RECORDSIZE)
-                if remainder > 0:
-                    self.fileobj.write(NUL * (RECORDSIZE - remainder))
-        finally:
-            if not self._extfileobj:
-                self.fileobj.close()
-
-    def getmember(self, name):
-        """Return a TarInfo object for member 'name'. If 'name' can not be
-           found in the archive, KeyError is raised. If a member occurs more
-           than once in the archive, its last occurrence is assumed to be the
-           most up-to-date version.
-        """
-        tarinfo = self._getmember(name.rstrip('/'))
-        if tarinfo is None:
-            raise KeyError("filename %r not found" % name)
-        return tarinfo
-
-    def getmembers(self):
-        """Return the members of the archive as a list of TarInfo objects. The
-           list has the same order as the members in the archive.
-        """
-        self._check()
-        if not self._loaded:    # if we want to obtain a list of
-            self._load()        # all members, we first have to
-                                # scan the whole archive.
-        return self.members
-
-    def getnames(self):
-        """Return the members of the archive as a list of their names. It has
-           the same order as the list returned by getmembers().
-        """
-        return [tarinfo.name for tarinfo in self.getmembers()]
-
-    def gettarinfo(self, name=None, arcname=None, fileobj=None):
-        """Create a TarInfo object from the result of os.stat or equivalent
-           on an existing file. The file is either named by 'name', or
-           specified as a file object 'fileobj' with a file descriptor. If
-           given, 'arcname' specifies an alternative name for the file in the
-           archive, otherwise, the name is taken from the 'name' attribute of
-           'fileobj', or the 'name' argument. The name should be a text
-           string.
-        """
-        self._check("awx")
-
-        # When fileobj is given, replace name by
-        # fileobj's real name.
-        if fileobj is not None:
-            name = fileobj.name
-
-        # Building the name of the member in the archive.
-        # Backward slashes are converted to forward slashes,
-        # Absolute paths are turned to relative paths.
-        if arcname is None:
-            arcname = name
-        drv, arcname = os.path.splitdrive(arcname)
-        arcname = arcname.replace(os.sep, "/")
-        arcname = arcname.lstrip("/")
-
-        # Now, fill the TarInfo object with
-        # information specific for the file.
-        tarinfo = self.tarinfo()
-        tarinfo._tarfile = self  # To be removed in 3.16.
-
-        # Use os.stat or os.lstat, depending on if symlinks shall be resolved.
-        if fileobj is None:
-            if not self.dereference:
-                statres = os.lstat(name)
-            else:
-                statres = os.stat(name)
-        else:
-            statres = os.fstat(fileobj.fileno())
-        linkname = ""
-
-        stmd = statres.st_mode
-        if stat.S_ISREG(stmd):
-            inode = (statres.st_ino, statres.st_dev)
-            if not self.dereference and statres.st_nlink > 1 and \
-                    inode in self.inodes and arcname != self.inodes[inode]:
-                # Is it a hardlink to an already
-                # archived file?
-                type = LNKTYPE
-                linkname = self.inodes[inode]
-            else:
-                # The inode is added only if its valid.
-                # For win32 it is always 0.
-                type = REGTYPE
-                if inode[0]:
-                    self.inodes[inode] = arcname
-        elif stat.S_ISDIR(stmd):
-            type = DIRTYPE
-        elif stat.S_ISFIFO(stmd):
-            type = FIFOTYPE
-        elif stat.S_ISLNK(stmd):
-            type = SYMTYPE
-            linkname = os.readlink(name)
-        elif stat.S_ISCHR(stmd):
-            type = CHRTYPE
-        elif stat.S_ISBLK(stmd):
-            type = BLKTYPE
-        else:
-            return None
-
-        # Fill the TarInfo object with all
-        # information we can get.
-        tarinfo.name = arcname
-        tarinfo.mode = stmd
-        tarinfo.uid = statres.st_uid
-        tarinfo.gid = statres.st_gid
-        if type == REGTYPE:
-            tarinfo.size = statres.st_size
-        else:
-            tarinfo.size = 0
-        tarinfo.mtime = statres.st_mtime
-        tarinfo.type = type
-        tarinfo.linkname = linkname
-        if pwd:
-            try:
-                tarinfo.uname = pwd.getpwuid(tarinfo.uid)[0]
-            except KeyError:
-                pass
-        if grp:
-            try:
-                tarinfo.gname = grp.getgrgid(tarinfo.gid)[0]
-            except KeyError:
-                pass
-
-        if type in (CHRTYPE, BLKTYPE):
-            if hasattr(os, "major") and hasattr(os, "minor"):
-                tarinfo.devmajor = os.major(statres.st_rdev)
-                tarinfo.devminor = os.minor(statres.st_rdev)
-        return tarinfo
-
-    def list(self, verbose=True, *, members=None):
-        """Print a table of contents to sys.stdout. If 'verbose' is False, only
-           the names of the members are printed. If it is True, an 'ls -l'-like
-           output is produced. 'members' is optional and must be a subset of the
-           list returned by getmembers().
-        """
-        # Convert tarinfo type to stat type.
-        type2mode = {REGTYPE: stat.S_IFREG, SYMTYPE: stat.S_IFLNK,
-                     FIFOTYPE: stat.S_IFIFO, CHRTYPE: stat.S_IFCHR,
-                     DIRTYPE: stat.S_IFDIR, BLKTYPE: stat.S_IFBLK}
-        self._check()
-
-        if members is None:
-            members = self
-        for tarinfo in members:
-            if verbose:
-                if tarinfo.mode is None:
-                    _safe_print("??????????")
-                else:
-                    modetype = type2mode.get(tarinfo.type, 0)
-                    _safe_print(stat.filemode(modetype | tarinfo.mode))
-                _safe_print("%s/%s" % (tarinfo.uname or tarinfo.uid,
-                                       tarinfo.gname or tarinfo.gid))
-                if tarinfo.ischr() or tarinfo.isblk():
-                    _safe_print("%10s" %
-                            ("%d,%d" % (tarinfo.devmajor, tarinfo.devminor)))
-                else:
-                    _safe_print("%10d" % tarinfo.size)
-                if tarinfo.mtime is None:
-                    _safe_print("????-??-?? ??:??:??")
-                else:
-                    _safe_print("%d-%02d-%02d %02d:%02d:%02d" \
-                                % time.localtime(tarinfo.mtime)[:6])
-
-            _safe_print(tarinfo.name + ("/" if tarinfo.isdir() else ""))
-
-            if verbose:
-                if tarinfo.issym():
-                    _safe_print("-> " + tarinfo.linkname)
-                if tarinfo.islnk():
-                    _safe_print("link to " + tarinfo.linkname)
-            print()
-
-    def add(self, name, arcname=None, recursive=True, *, filter=None):
-        """Add the file 'name' to the archive. 'name' may be any type of file
-           (directory, fifo, symbolic link, etc.). If given, 'arcname'
-           specifies an alternative name for the file in the archive.
-           Directories are added recursively by default. This can be avoided by
-           setting 'recursive' to False. 'filter' is a function
-           that expects a TarInfo object argument and returns the changed
-           TarInfo object, if it returns None the TarInfo object will be
-           excluded from the archive.
-        """
-        self._check("awx")
-
-        if arcname is None:
-            arcname = name
-
-        # Skip if somebody tries to archive the archive...
-        if self.name is not None and os.path.abspath(name) == self.name:
-            self._dbg(2, "tarfile: Skipped %r" % name)
-            return
-
-        self._dbg(1, name)
-
-        # Create a TarInfo object from the file.
-        tarinfo = self.gettarinfo(name, arcname)
-
-        if tarinfo is None:
-            self._dbg(1, "tarfile: Unsupported type %r" % name)
-            return
-
-        # Change or exclude the TarInfo object.
-        if filter is not None:
-            tarinfo = filter(tarinfo)
-            if tarinfo is None:
-                self._dbg(2, "tarfile: Excluded %r" % name)
-                return
-
-        # Append the tar header and data to the archive.
-        if tarinfo.isreg():
-            with bltn_open(name, "rb") as f:
-                self.addfile(tarinfo, f)
-
-        elif tarinfo.isdir():
-            self.addfile(tarinfo)
-            if recursive:
-                for f in sorted(os.listdir(name)):
-                    self.add(os.path.join(name, f), os.path.join(arcname, f),
-                            recursive, filter=filter)
-
-        else:
-            self.addfile(tarinfo)
-
-    def addfile(self, tarinfo, fileobj=None):
-        """Add the TarInfo object 'tarinfo' to the archive. If 'tarinfo' represents
-           a non zero-size regular file, the 'fileobj' argument should be a binary file,
-           and tarinfo.size bytes are read from it and added to the archive.
-           You can create TarInfo objects directly, or by using gettarinfo().
-        """
-        self._check("awx")
-
-        if fileobj is None and tarinfo.isreg() and tarinfo.size != 0:
-            raise ValueError("fileobj not provided for non zero-size regular file")
-
-        tarinfo = copy.copy(tarinfo)
-
-        buf = tarinfo.tobuf(self.format, self.encoding, self.errors)
-        self.fileobj.write(buf)
-        self.offset += len(buf)
-        bufsize=self.copybufsize
-        # If there's data to follow, append it.
-        if fileobj is not None:
-            copyfileobj(fileobj, self.fileobj, tarinfo.size, bufsize=bufsize)
-            blocks, remainder = divmod(tarinfo.size, BLOCKSIZE)
-            if remainder > 0:
-                self.fileobj.write(NUL * (BLOCKSIZE - remainder))
-                blocks += 1
-            self.offset += blocks * BLOCKSIZE
-
-        self.members.append(tarinfo)
-
-    def _get_filter_function(self, filter):
-        if filter is None:
-            filter = self.extraction_filter
-            if filter is None:
-                import warnings
-                warnings.warn(
-                    'Python 3.14 will, by default, filter extracted tar '
-                    + 'archives and reject files or modify their metadata. '
-                    + 'Use the filter argument to control this behavior.',
-                    DeprecationWarning, stacklevel=3)
-                return fully_trusted_filter
-            if isinstance(filter, str):
-                raise TypeError(
-                    'String names are not supported for '
-                    + 'TarFile.extraction_filter. Use a function such as '
-                    + 'tarfile.data_filter directly.')
-            return filter
-        if callable(filter):
-            return filter
-        try:
-            return _NAMED_FILTERS[filter]
-        except KeyError:
-            raise ValueError(f"filter {filter!r} not found") from None
-
-    def extractall(self, path=".", members=None, *, numeric_owner=False,
-                   filter=None):
-        """Extract all members from the archive to the current working
-           directory and set owner, modification time and permissions on
-           directories afterwards. 'path' specifies a different directory
-           to extract to. 'members' is optional and must be a subset of the
-           list returned by getmembers(). If 'numeric_owner' is True, only
-           the numbers for user/group names are used and not the names.
-
-           The 'filter' function will be called on each member just
-           before extraction.
-           It can return a changed TarInfo or None to skip the member.
-           String names of common filters are accepted.
-        """
-        directories = []
-
-        filter_function = self._get_filter_function(filter)
-        if members is None:
-            members = self
-
-        for member in members:
-            tarinfo = self._get_extract_tarinfo(member, filter_function, path)
-            if tarinfo is None:
-                continue
-            if tarinfo.isdir():
-                # For directories, delay setting attributes until later,
-                # since permissions can interfere with extraction and
-                # extracting contents can reset mtime.
-                directories.append(tarinfo)
-            self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
-                              numeric_owner=numeric_owner)
-
-        # Reverse sort directories.
-        directories.sort(key=lambda a: a.name, reverse=True)
-
-        # Set correct owner, mtime and filemode on directories.
-        for tarinfo in directories:
-            dirpath = os.path.join(path, tarinfo.name)
-            try:
-                self.chown(tarinfo, dirpath, numeric_owner=numeric_owner)
-                self.utime(tarinfo, dirpath)
-                self.chmod(tarinfo, dirpath)
-            except ExtractError as e:
-                self._handle_nonfatal_error(e)
-
-    def extract(self, member, path="", set_attrs=True, *, numeric_owner=False,
-                filter=None):
-        """Extract a member from the archive to the current working directory,
-           using its full name. Its file information is extracted as accurately
-           as possible. 'member' may be a filename or a TarInfo object. You can
-           specify a different directory using 'path'. File attributes (owner,
-           mtime, mode) are set unless 'set_attrs' is False. If 'numeric_owner'
-           is True, only the numbers for user/group names are used and not
-           the names.
-
-           The 'filter' function will be called before extraction.
-           It can return a changed TarInfo or None to skip the member.
-           String names of common filters are accepted.
-        """
-        filter_function = self._get_filter_function(filter)
-        tarinfo = self._get_extract_tarinfo(member, filter_function, path)
-        if tarinfo is not None:
-            self._extract_one(tarinfo, path, set_attrs, numeric_owner)
-
-    def _get_extract_tarinfo(self, member, filter_function, path):
-        """Get filtered TarInfo (or None) from member, which might be a str"""
-        if isinstance(member, str):
-            tarinfo = self.getmember(member)
-        else:
-            tarinfo = member
-
-        unfiltered = tarinfo
-        try:
-            tarinfo = filter_function(tarinfo, path)
-        except (OSError, FilterError) as e:
-            self._handle_fatal_error(e)
-        except ExtractError as e:
-            self._handle_nonfatal_error(e)
-        if tarinfo is None:
-            self._dbg(2, "tarfile: Excluded %r" % unfiltered.name)
-            return None
-        # Prepare the link target for makelink().
-        if tarinfo.islnk():
-            tarinfo = copy.copy(tarinfo)
-            tarinfo._link_target = os.path.join(path, tarinfo.linkname)
-        return tarinfo
-
-    def _extract_one(self, tarinfo, path, set_attrs, numeric_owner):
-        """Extract from filtered tarinfo to disk"""
-        self._check("r")
-
-        try:
-            self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
-                                 set_attrs=set_attrs,
-                                 numeric_owner=numeric_owner)
-        except OSError as e:
-            self._handle_fatal_error(e)
-        except ExtractError as e:
-            self._handle_nonfatal_error(e)
-
-    def _handle_nonfatal_error(self, e):
-        """Handle non-fatal error (ExtractError) according to errorlevel"""
-        if self.errorlevel > 1:
-            raise
-        else:
-            self._dbg(1, "tarfile: %s" % e)
-
-    def _handle_fatal_error(self, e):
-        """Handle "fatal" error according to self.errorlevel"""
-        if self.errorlevel > 0:
-            raise
-        elif isinstance(e, OSError):
-            if e.filename is None:
-                self._dbg(1, "tarfile: %s" % e.strerror)
-            else:
-                self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename))
-        else:
-            self._dbg(1, "tarfile: %s %s" % (type(e).__name__, e))
-
-    def extractfile(self, member):
-        """Extract a member from the archive as a file object. 'member' may be
-           a filename or a TarInfo object. If 'member' is a regular file or
-           a link, an io.BufferedReader object is returned. For all other
-           existing members, None is returned. If 'member' does not appear
-           in the archive, KeyError is raised.
-        """
-        self._check("r")
-
-        if isinstance(member, str):
-            tarinfo = self.getmember(member)
-        else:
-            tarinfo = member
-
-        if tarinfo.isreg() or tarinfo.type not in SUPPORTED_TYPES:
-            # Members with unknown types are treated as regular files.
-            return self.fileobject(self, tarinfo)
-
-        elif tarinfo.islnk() or tarinfo.issym():
-            if isinstance(self.fileobj, _Stream):
-                # A small but ugly workaround for the case that someone tries
-                # to extract a (sym)link as a file-object from a non-seekable
-                # stream of tar blocks.
-                raise StreamError("cannot extract (sym)link as file object")
-            else:
-                # A (sym)link's file object is its target's file object.
-                return self.extractfile(self._find_link_target(tarinfo))
-        else:
-            # If there's no data associated with the member (directory, chrdev,
-            # blkdev, etc.), return None instead of a file object.
-            return None
-
-    def _extract_member(self, tarinfo, targetpath, set_attrs=True,
-                        numeric_owner=False):
-        """Extract the TarInfo object tarinfo to a physical
-           file called targetpath.
-        """
-        # Fetch the TarInfo object for the given name
-        # and build the destination pathname, replacing
-        # forward slashes to platform specific separators.
-        targetpath = targetpath.rstrip("/")
-        targetpath = targetpath.replace("/", os.sep)
-
-        # Create all upper directories.
-        upperdirs = os.path.dirname(targetpath)
-        if upperdirs and not os.path.exists(upperdirs):
-            # Create directories that are not part of the archive with
-            # default permissions.
-            os.makedirs(upperdirs, exist_ok=True)
-
-        if tarinfo.islnk() or tarinfo.issym():
-            self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname))
-        else:
-            self._dbg(1, tarinfo.name)
-
-        if tarinfo.isreg():
-            self.makefile(tarinfo, targetpath)
-        elif tarinfo.isdir():
-            self.makedir(tarinfo, targetpath)
-        elif tarinfo.isfifo():
-            self.makefifo(tarinfo, targetpath)
-        elif tarinfo.ischr() or tarinfo.isblk():
-            self.makedev(tarinfo, targetpath)
-        elif tarinfo.islnk() or tarinfo.issym():
-            self.makelink(tarinfo, targetpath)
-        elif tarinfo.type not in SUPPORTED_TYPES:
-            self.makeunknown(tarinfo, targetpath)
-        else:
-            self.makefile(tarinfo, targetpath)
-
-        if set_attrs:
-            self.chown(tarinfo, targetpath, numeric_owner)
-            if not tarinfo.issym():
-                self.chmod(tarinfo, targetpath)
-                self.utime(tarinfo, targetpath)
-
-    #--------------------------------------------------------------------------
-    # Below are the different file methods. They are called via
-    # _extract_member() when extract() is called. They can be replaced in a
-    # subclass to implement other functionality.
-
-    def makedir(self, tarinfo, targetpath):
-        """Make a directory called targetpath.
-        """
-        try:
-            if tarinfo.mode is None:
-                # Use the system's default mode
-                os.mkdir(targetpath)
-            else:
-                # Use a safe mode for the directory, the real mode is set
-                # later in _extract_member().
-                os.mkdir(targetpath, 0o700)
-        except FileExistsError:
-            if not os.path.isdir(targetpath):
-                raise
-
-    def makefile(self, tarinfo, targetpath):
-        """Make a file called targetpath.
-        """
-        source = self.fileobj
-        source.seek(tarinfo.offset_data)
-        bufsize = self.copybufsize
-        with bltn_open(targetpath, "wb") as target:
-            if tarinfo.sparse is not None:
-                for offset, size in tarinfo.sparse:
-                    target.seek(offset)
-                    copyfileobj(source, target, size, ReadError, bufsize)
-                target.seek(tarinfo.size)
-                target.truncate()
-            else:
-                copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
-
-    def makeunknown(self, tarinfo, targetpath):
-        """Make a file from a TarInfo object with an unknown type
-           at targetpath.
-        """
-        self.makefile(tarinfo, targetpath)
-        self._dbg(1, "tarfile: Unknown file type %r, " \
-                     "extracted as regular file." % tarinfo.type)
-
-    def makefifo(self, tarinfo, targetpath):
-        """Make a fifo called targetpath.
-        """
-        if hasattr(os, "mkfifo"):
-            os.mkfifo(targetpath)
-        else:
-            raise ExtractError("fifo not supported by system")
-
-    def makedev(self, tarinfo, targetpath):
-        """Make a character or block device called targetpath.
-        """
-        if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
-            raise ExtractError("special devices not supported by system")
-
-        mode = tarinfo.mode
-        if mode is None:
-            # Use mknod's default
-            mode = 0o600
-        if tarinfo.isblk():
-            mode |= stat.S_IFBLK
-        else:
-            mode |= stat.S_IFCHR
-
-        os.mknod(targetpath, mode,
-                 os.makedev(tarinfo.devmajor, tarinfo.devminor))
-
-    def makelink(self, tarinfo, targetpath):
-        """Make a (symbolic) link called targetpath. If it cannot be created
-          (platform limitation), we try to make a copy of the referenced file
-          instead of a link.
-        """
-        try:
-            # For systems that support symbolic and hard links.
-            if tarinfo.issym():
-                if os.path.lexists(targetpath):
-                    # Avoid FileExistsError on following os.symlink.
-                    os.unlink(targetpath)
-                os.symlink(tarinfo.linkname, targetpath)
-            else:
-                if os.path.exists(tarinfo._link_target):
-                    os.link(tarinfo._link_target, targetpath)
-                else:
-                    self._extract_member(self._find_link_target(tarinfo),
-                                         targetpath)
-        except symlink_exception:
-            try:
-                self._extract_member(self._find_link_target(tarinfo),
-                                     targetpath)
-            except KeyError:
-                raise ExtractError("unable to resolve link inside archive") from None
-
-    def chown(self, tarinfo, targetpath, numeric_owner):
-        """Set owner of targetpath according to tarinfo. If numeric_owner
-           is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
-           is False, fall back to .gid/.uid when the search based on name
-           fails.
-        """
-        if hasattr(os, "geteuid") and os.geteuid() == 0:
-            # We have to be root to do so.
-            g = tarinfo.gid
-            u = tarinfo.uid
-            if not numeric_owner:
-                try:
-                    if grp and tarinfo.gname:
-                        g = grp.getgrnam(tarinfo.gname)[2]
-                except KeyError:
-                    pass
-                try:
-                    if pwd and tarinfo.uname:
-                        u = pwd.getpwnam(tarinfo.uname)[2]
-                except KeyError:
-                    pass
-            if g is None:
-                g = -1
-            if u is None:
-                u = -1
-            try:
-                if tarinfo.issym() and hasattr(os, "lchown"):
-                    os.lchown(targetpath, u, g)
-                else:
-                    os.chown(targetpath, u, g)
-            except (OSError, OverflowError) as e:
-                # OverflowError can be raised if an ID doesn't fit in 'id_t'
-                raise ExtractError("could not change owner") from e
-
-    def chmod(self, tarinfo, targetpath):
-        """Set file permissions of targetpath according to tarinfo.
-        """
-        if tarinfo.mode is None:
-            return
-        try:
-            os.chmod(targetpath, tarinfo.mode)
-        except OSError as e:
-            raise ExtractError("could not change mode") from e
-
-    def utime(self, tarinfo, targetpath):
-        """Set modification time of targetpath according to tarinfo.
-        """
-        mtime = tarinfo.mtime
-        if mtime is None:
-            return
-        if not hasattr(os, 'utime'):
-            return
-        try:
-            os.utime(targetpath, (mtime, mtime))
-        except OSError as e:
-            raise ExtractError("could not change modification time") from e
-
-    #--------------------------------------------------------------------------
-    def next(self):
-        """Return the next member of the archive as a TarInfo object, when
-           TarFile is opened for reading. Return None if there is no more
-           available.
-        """
-        self._check("ra")
-        if self.firstmember is not None:
-            m = self.firstmember
-            self.firstmember = None
-            return m
-
-        # Advance the file pointer.
-        if self.offset != self.fileobj.tell():
-            if self.offset == 0:
-                return None
-            self.fileobj.seek(self.offset - 1)
-            if not self.fileobj.read(1):
-                raise ReadError("unexpected end of data")
-
-        # Read the next block.
-        tarinfo = None
-        while True:
-            try:
-                tarinfo = self.tarinfo.fromtarfile(self)
-            except EOFHeaderError as e:
-                if self.ignore_zeros:
-                    self._dbg(2, "0x%X: %s" % (self.offset, e))
-                    self.offset += BLOCKSIZE
-                    continue
-            except InvalidHeaderError as e:
-                if self.ignore_zeros:
-                    self._dbg(2, "0x%X: %s" % (self.offset, e))
-                    self.offset += BLOCKSIZE
-                    continue
-                elif self.offset == 0:
-                    raise ReadError(str(e)) from None
-            except EmptyHeaderError:
-                if self.offset == 0:
-                    raise ReadError("empty file") from None
-            except TruncatedHeaderError as e:
-                if self.offset == 0:
-                    raise ReadError(str(e)) from None
-            except SubsequentHeaderError as e:
-                raise ReadError(str(e)) from None
-            except Exception as e:
-                try:
-                    import zlib
-                    if isinstance(e, zlib.error):
-                        raise ReadError(f'zlib error: {e}') from None
-                    else:
-                        raise e
-                except ImportError:
-                    raise e
-            break
-
-        if tarinfo is not None:
-            # if streaming the file we do not want to cache the tarinfo
-            if not self.stream:
-                self.members.append(tarinfo)
-        else:
-            self._loaded = True
-
-        return tarinfo
-
-    #--------------------------------------------------------------------------
-    # Little helper methods:
-
-    def _getmember(self, name, tarinfo=None, normalize=False):
-        """Find an archive member by name from bottom to top.
-           If tarinfo is given, it is used as the starting point.
-        """
-        # Ensure that all members have been loaded.
-        members = self.getmembers()
-
-        # Limit the member search list up to tarinfo.
-        skipping = False
-        if tarinfo is not None:
-            try:
-                index = members.index(tarinfo)
-            except ValueError:
-                # The given starting point might be a (modified) copy.
-                # We'll later skip members until we find an equivalent.
-                skipping = True
-            else:
-                # Happy fast path
-                members = members[:index]
-
-        if normalize:
-            name = os.path.normpath(name)
-
-        for member in reversed(members):
-            if skipping:
-                if tarinfo.offset == member.offset:
-                    skipping = False
-                continue
-            if normalize:
-                member_name = os.path.normpath(member.name)
-            else:
-                member_name = member.name
-
-            if name == member_name:
-                return member
-
-        if skipping:
-            # Starting point was not found
-            raise ValueError(tarinfo)
-
-    def _load(self):
-        """Read through the entire archive file and look for readable
-           members. This should not run if the file is set to stream.
-        """
-        if not self.stream:
-            while self.next() is not None:
-                pass
-            self._loaded = True
-
-    def _check(self, mode=None):
-        """Check if TarFile is still open, and if the operation's mode
-           corresponds to TarFile's mode.
-        """
-        if self.closed:
-            raise OSError("%s is closed" % self.__class__.__name__)
-        if mode is not None and self.mode not in mode:
-            raise OSError("bad operation for mode %r" % self.mode)
-
-    def _find_link_target(self, tarinfo):
-        """Find the target member of a symlink or hardlink member in the
-           archive.
-        """
-        if tarinfo.issym():
-            # Always search the entire archive.
-            linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
-            limit = None
-        else:
-            # Search the archive before the link, because a hard link is
-            # just a reference to an already archived file.
-            linkname = tarinfo.linkname
-            limit = tarinfo
-
-        member = self._getmember(linkname, tarinfo=limit, normalize=True)
-        if member is None:
-            raise KeyError("linkname %r not found" % linkname)
-        return member
-
-    def __iter__(self):
-        """Provide an iterator object.
-        """
-        if self._loaded:
-            yield from self.members
-            return
-
-        # Yield items using TarFile's next() method.
-        # When all members have been read, set TarFile as _loaded.
-        index = 0
-        # Fix for SF #1100429: Under rare circumstances it can
-        # happen that getmembers() is called during iteration,
-        # which will have already exhausted the next() method.
-        if self.firstmember is not None:
-            tarinfo = self.next()
-            index += 1
-            yield tarinfo
-
-        while True:
-            if index < len(self.members):
-                tarinfo = self.members[index]
-            elif not self._loaded:
-                tarinfo = self.next()
-                if not tarinfo:
-                    self._loaded = True
-                    return
-            else:
-                return
-            index += 1
-            yield tarinfo
-
-    def _dbg(self, level, msg):
-        """Write debugging output to sys.stderr.
-        """
-        if level <= self.debug:
-            print(msg, file=sys.stderr)
-
-    def __enter__(self):
-        self._check()
-        return self
-
-    def __exit__(self, type, value, traceback):
-        if type is None:
-            self.close()
-        else:
-            # An exception occurred. We must not call close() because
-            # it would try to write end-of-archive blocks and padding.
-            if not self._extfileobj:
-                self.fileobj.close()
-            self.closed = True
-
-#--------------------
-# exported functions
-#--------------------
-
-def is_tarfile(name):
-    """Return True if name points to a tar archive that we
-       are able to handle, else return False.
-
-       'name' should be a string, file, or file-like object.
-    """
-    try:
-        if hasattr(name, "read"):
-            pos = name.tell()
-            t = open(fileobj=name)
-            name.seek(pos)
-        else:
-            t = open(name)
-        t.close()
-        return True
-    except TarError:
-        return False
-
-open = TarFile.open
-
-
-def main():
-    import argparse
-
-    description = 'A simple command-line interface for tarfile module.'
-    parser = argparse.ArgumentParser(description=description)
-    parser.add_argument('-v', '--verbose', action='store_true', default=False,
-                        help='Verbose output')
-    parser.add_argument('--filter', metavar='',
-                        choices=_NAMED_FILTERS,
-                        help='Filter for extraction')
-
-    group = parser.add_mutually_exclusive_group(required=True)
-    group.add_argument('-l', '--list', metavar='',
-                       help='Show listing of a tarfile')
-    group.add_argument('-e', '--extract', nargs='+',
-                       metavar=('', ''),
-                       help='Extract tarfile into target dir')
-    group.add_argument('-c', '--create', nargs='+',
-                       metavar=('', ''),
-                       help='Create tarfile from sources')
-    group.add_argument('-t', '--test', metavar='',
-                       help='Test if a tarfile is valid')
-
-    args = parser.parse_args()
-
-    if args.filter and args.extract is None:
-        parser.exit(1, '--filter is only valid for extraction\n')
-
-    if args.test is not None:
-        src = args.test
-        if is_tarfile(src):
-            with open(src, 'r') as tar:
-                tar.getmembers()
-                print(tar.getmembers(), file=sys.stderr)
-            if args.verbose:
-                print('{!r} is a tar archive.'.format(src))
-        else:
-            parser.exit(1, '{!r} is not a tar archive.\n'.format(src))
-
-    elif args.list is not None:
-        src = args.list
-        if is_tarfile(src):
-            with TarFile.open(src, 'r:*') as tf:
-                tf.list(verbose=args.verbose)
-        else:
-            parser.exit(1, '{!r} is not a tar archive.\n'.format(src))
-
-    elif args.extract is not None:
-        if len(args.extract) == 1:
-            src = args.extract[0]
-            curdir = os.curdir
-        elif len(args.extract) == 2:
-            src, curdir = args.extract
-        else:
-            parser.exit(1, parser.format_help())
-
-        if is_tarfile(src):
-            with TarFile.open(src, 'r:*') as tf:
-                tf.extractall(path=curdir, filter=args.filter)
-            if args.verbose:
-                if curdir == '.':
-                    msg = '{!r} file is extracted.'.format(src)
-                else:
-                    msg = ('{!r} file is extracted '
-                           'into {!r} directory.').format(src, curdir)
-                print(msg)
-        else:
-            parser.exit(1, '{!r} is not a tar archive.\n'.format(src))
-
-    elif args.create is not None:
-        tar_name = args.create.pop(0)
-        _, ext = os.path.splitext(tar_name)
-        compressions = {
-            # gz
-            '.gz': 'gz',
-            '.tgz': 'gz',
-            # xz
-            '.xz': 'xz',
-            '.txz': 'xz',
-            # bz2
-            '.bz2': 'bz2',
-            '.tbz': 'bz2',
-            '.tbz2': 'bz2',
-            '.tb2': 'bz2',
-        }
-        tar_mode = 'w:' + compressions[ext] if ext in compressions else 'w'
-        tar_files = args.create
-
-        with TarFile.open(tar_name, tar_mode) as tf:
-            for file_name in tar_files:
-                tf.add(file_name)
-
-        if args.verbose:
-            print('{!r} file created.'.format(tar_name))
-
-if __name__ == '__main__':
-    main()
diff --git a/pkg_resources/_vendor/backports/tarfile/__main__.py b/pkg_resources/_vendor/backports/tarfile/__main__.py
deleted file mode 100644
index daf5509086..0000000000
--- a/pkg_resources/_vendor/backports/tarfile/__main__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from . import main
-
-
-if __name__ == '__main__':
-    main()
diff --git a/pkg_resources/_vendor/backports/tarfile/compat/__init__.py b/pkg_resources/_vendor/backports/tarfile/compat/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/backports/tarfile/compat/py38.py b/pkg_resources/_vendor/backports/tarfile/compat/py38.py
deleted file mode 100644
index 20fbbfc1c0..0000000000
--- a/pkg_resources/_vendor/backports/tarfile/compat/py38.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import sys
-
-
-if sys.version_info < (3, 9):
-
-    def removesuffix(self, suffix):
-        # suffix='' should not call self[:-0].
-        if suffix and self.endswith(suffix):
-            return self[: -len(suffix)]
-        else:
-            return self[:]
-
-    def removeprefix(self, prefix):
-        if self.startswith(prefix):
-            return self[len(prefix) :]
-        else:
-            return self[:]
-else:
-
-    def removesuffix(self, suffix):
-        return self.removesuffix(suffix)
-
-    def removeprefix(self, prefix):
-        return self.removeprefix(prefix)
diff --git a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/LICENSE b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 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/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/METADATA b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/METADATA
deleted file mode 100644
index b088e721d2..0000000000
--- a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/METADATA
+++ /dev/null
@@ -1,100 +0,0 @@
-Metadata-Version: 2.1
-Name: importlib_resources
-Version: 6.4.0
-Summary: Read resources from Python packages
-Home-page: https://github.com/python/importlib_resources
-Author: Barry Warsaw
-Author-email: barry@python.org
-Project-URL: Documentation, https://importlib-resources.readthedocs.io/
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: Apache Software License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.8
-License-File: LICENSE
-Requires-Dist: zipp >=3.1.0 ; python_version < "3.10"
-Provides-Extra: docs
-Requires-Dist: sphinx >=3.5 ; extra == 'docs'
-Requires-Dist: sphinx <7.2.5 ; extra == 'docs'
-Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
-Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
-Requires-Dist: furo ; extra == 'docs'
-Requires-Dist: sphinx-lint ; extra == 'docs'
-Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest >=6 ; extra == 'testing'
-Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
-Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
-Requires-Dist: zipp >=3.17 ; extra == 'testing'
-Requires-Dist: jaraco.test >=5.4 ; extra == 'testing'
-Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/importlib_resources.svg
-   :target: https://pypi.org/project/importlib_resources
-
-.. image:: https://img.shields.io/pypi/pyversions/importlib_resources.svg
-
-.. image:: https://github.com/python/importlib_resources/actions/workflows/main.yml/badge.svg
-   :target: https://github.com/python/importlib_resources/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
-    :target: https://github.com/astral-sh/ruff
-    :alt: Ruff
-
-.. image:: https://readthedocs.org/projects/importlib-resources/badge/?version=latest
-   :target: https://importlib-resources.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2024-informational
-   :target: https://blog.jaraco.com/skeleton
-
-.. image:: https://tidelift.com/badges/package/pypi/importlib-resources
-   :target: https://tidelift.com/subscription/pkg/pypi-importlib-resources?utm_source=pypi-importlib-resources&utm_medium=readme
-
-``importlib_resources`` is a backport of Python standard library
-`importlib.resources
-`_
-module for older Pythons.
-
-The key goal of this module is to replace parts of `pkg_resources
-`_ with a
-solution in Python's stdlib that relies on well-defined APIs.  This makes
-reading resources included in packages easier, with more stable and consistent
-semantics.
-
-Compatibility
-=============
-
-New features are introduced in this third-party library and later merged
-into CPython. The following table indicates which versions of this library
-were contributed to different versions in the standard library:
-
-.. list-table::
-   :header-rows: 1
-
-   * - importlib_resources
-     - stdlib
-   * - 6.0
-     - 3.13
-   * - 5.12
-     - 3.12
-   * - 5.7
-     - 3.11
-   * - 5.0
-     - 3.10
-   * - 1.3
-     - 3.9
-   * - 0.5 (?)
-     - 3.7
-
-For Enterprise
-==============
-
-Available as part of the Tidelift Subscription.
-
-This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
-
-`Learn more `_.
diff --git a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD
deleted file mode 100644
index 18888dea71..0000000000
--- a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/RECORD
+++ /dev/null
@@ -1,89 +0,0 @@
-importlib_resources-6.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-importlib_resources-6.4.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
-importlib_resources-6.4.0.dist-info/METADATA,sha256=g4eM2LuL0OiZcUVND0qwDJUpE29gOvtO3BSPXTbO9Fk,3944
-importlib_resources-6.4.0.dist-info/RECORD,,
-importlib_resources-6.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources-6.4.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-importlib_resources-6.4.0.dist-info/top_level.txt,sha256=fHIjHU1GZwAjvcydpmUnUrTnbvdiWjG4OEVZK8by0TQ,20
-importlib_resources/__init__.py,sha256=uyp1kzYR6SawQBsqlyaXXfIxJx4Z2mM8MjmZn8qq2Gk,505
-importlib_resources/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/__pycache__/_adapters.cpython-312.pyc,,
-importlib_resources/__pycache__/_common.cpython-312.pyc,,
-importlib_resources/__pycache__/_itertools.cpython-312.pyc,,
-importlib_resources/__pycache__/abc.cpython-312.pyc,,
-importlib_resources/__pycache__/functional.cpython-312.pyc,,
-importlib_resources/__pycache__/readers.cpython-312.pyc,,
-importlib_resources/__pycache__/simple.cpython-312.pyc,,
-importlib_resources/_adapters.py,sha256=vprJGbUeHbajX6XCuMP6J3lMrqCi-P_MTlziJUR7jfk,4482
-importlib_resources/_common.py,sha256=blt4-ZtHnbUPzQQyPP7jLGgl_86btIW5ZhIsEhclhoA,5571
-importlib_resources/_itertools.py,sha256=eDisV6RqiNZOogLSXf6LOGHOYc79FGgPrKNLzFLmCrU,1277
-importlib_resources/abc.py,sha256=UKNU9ncEDkZRB3txcGb3WLxsL2iju9JbaLTI-dfLE_4,5162
-importlib_resources/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/compat/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/compat/__pycache__/py38.cpython-312.pyc,,
-importlib_resources/compat/__pycache__/py39.cpython-312.pyc,,
-importlib_resources/compat/py38.py,sha256=MWhut3XsAJwBYUaa5Qb2AoCrZNqcQjVThP-P1uBoE_4,230
-importlib_resources/compat/py39.py,sha256=Wfln4uQUShNz1XdCG-toG6_Y0WrlUmO9JzpvtcfQ-Cw,184
-importlib_resources/functional.py,sha256=mLU4DwSlh8_2IXWqwKOfPVxyRqAEpB3B4XTfRxr3X3M,2651
-importlib_resources/future/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/future/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/future/__pycache__/adapters.cpython-312.pyc,,
-importlib_resources/future/adapters.py,sha256=1-MF2VRcCButhcC1OMfZILU9o3kwZ4nXB2lurXpaIAw,2940
-importlib_resources/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/readers.py,sha256=WNKurBHHVu9EVtUhWkOj2fxH50HP7uanNFuupAqH2S8,5863
-importlib_resources/simple.py,sha256=CQ3TiIMFiJs_80o-7xJL1EpbUUVna4-NGDrSTQ3HW2Y,2584
-importlib_resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/_path.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_compatibilty_files.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_contents.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_custom.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_files.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_functional.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_open.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_path.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_read.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_reader.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/test_resource.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/util.cpython-312.pyc,,
-importlib_resources/tests/__pycache__/zip.cpython-312.pyc,,
-importlib_resources/tests/_path.py,sha256=nkv3ek7D1U898v921rYbldDCtKri2oyYOi3EJqGjEGU,1289
-importlib_resources/tests/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/compat/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/compat/__pycache__/py312.cpython-312.pyc,,
-importlib_resources/tests/compat/__pycache__/py39.cpython-312.pyc,,
-importlib_resources/tests/compat/py312.py,sha256=qcWjpZhQo2oEsdwIlRRQHrsMGDltkFTnETeG7fLdUS8,364
-importlib_resources/tests/compat/py39.py,sha256=lRTk0RWAOEb9RzAgvdRnqJUGCBLc3qoFQwzuJSa_zP4,329
-importlib_resources/tests/data01/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data01/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/data01/subdirectory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data01/subdirectory/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data01/subdirectory/binary.file,sha256=xtRM9Bj2EOP-nh2SlP9D3vgcbNytbLsYIM_0jTqkNV0,4
-importlib_resources/tests/data01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
-importlib_resources/tests/data01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
-importlib_resources/tests/data02/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/one/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/one/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/one/resource1.txt,sha256=10flKac7c-XXFzJ3t-AB5MJjlBy__dSZvPE_dOm2q6U,13
-importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt,sha256=jnrBBztxYrtQck7cmVnc4xQVO4-agzAZDGSFkAWtlFw,10
-importlib_resources/tests/data02/two/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-importlib_resources/tests/data02/two/__pycache__/__init__.cpython-312.pyc,,
-importlib_resources/tests/data02/two/resource2.txt,sha256=lt2jbN3TMn9QiFKM832X39bU_62UptDdUkoYzkvEbl0,13
-importlib_resources/tests/namespacedata01/binary.file,sha256=BU7ewdAhH2JP7Qy8qdT5QAsOSRxDdCryxbCr6_DJkNg,4
-importlib_resources/tests/namespacedata01/subdirectory/binary.file,sha256=cbkhEL8TXIVYHIoSj2oZwPasp1KwxskeNXGJnPCbFF0,4
-importlib_resources/tests/namespacedata01/utf-16.file,sha256=t5q9qhxX0rYqItBOM8D3ylwG-RHrnOYteTLtQr6sF7g,44
-importlib_resources/tests/namespacedata01/utf-8.file,sha256=kwWgYG4yQ-ZF2X_WA66EjYPmxJRn-w8aSOiS9e8tKYY,20
-importlib_resources/tests/test_compatibilty_files.py,sha256=95N_R7aik8cvnE6sBJpsxmP0K5plOWRIJDgbalD-Hpw,3314
-importlib_resources/tests/test_contents.py,sha256=70HW3mL_hv05Emv-OgdmwoLhXxjtuVxiWVaUpgRaRWA,930
-importlib_resources/tests/test_custom.py,sha256=QrHZqIWl0e-fsQRfm0ych8stOlKJOsAIU3rK6QOcyN0,1221
-importlib_resources/tests/test_files.py,sha256=OcShYu33kCcyXlDyZSVPkJNE08h-N_4bQOLV2QaSqX0,3472
-importlib_resources/tests/test_functional.py,sha256=ByCVViAwb2PIlKvDNJEqTZ0aLZGpFl5qa7CMCX-7HKM,8591
-importlib_resources/tests/test_open.py,sha256=ccmzbOeEa6zTd4ymZZ8yISrecfuYV0jhon-Vddqysu4,2778
-importlib_resources/tests/test_path.py,sha256=x8r2gJxG3hFM9xCOFNkgmHYXxsMldMLTSW_AZYf1l-A,2009
-importlib_resources/tests/test_read.py,sha256=7tsILQ2NoqVGFQxhHqxBwc5hWcN8b_3idojCsszTNfQ,3112
-importlib_resources/tests/test_reader.py,sha256=IcIUXaiPAtuahGV4_ZT4YXFLMMsJmcM1iOxqdIH2Aa4,5001
-importlib_resources/tests/test_resource.py,sha256=fcF8WgZ6rDCTRFnxtAUbdiaNe4G23yGovT1nb2dc7ls,7823
-importlib_resources/tests/util.py,sha256=vjVzEyX0X2RkTN-wGiQiplayp9sZom4JDjJinTNewos,4745
-importlib_resources/tests/zip.py,sha256=2MKmF8-osXBJSnqcUTuAUek_-tSB3iKmIT9qPhcsOsM,783
diff --git a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/REQUESTED b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/REQUESTED
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/WHEEL b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
deleted file mode 100644
index bab98d6758..0000000000
--- a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.43.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt b/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt
deleted file mode 100644
index 58ad1bd333..0000000000
--- a/pkg_resources/_vendor/importlib_resources-6.4.0.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-importlib_resources
diff --git a/pkg_resources/_vendor/importlib_resources/__init__.py b/pkg_resources/_vendor/importlib_resources/__init__.py
deleted file mode 100644
index 0d029abd63..0000000000
--- a/pkg_resources/_vendor/importlib_resources/__init__.py
+++ /dev/null
@@ -1,36 +0,0 @@
-"""Read resources contained within a package."""
-
-from ._common import (
-    as_file,
-    files,
-    Package,
-    Anchor,
-)
-
-from .functional import (
-    contents,
-    is_resource,
-    open_binary,
-    open_text,
-    path,
-    read_binary,
-    read_text,
-)
-
-from .abc import ResourceReader
-
-
-__all__ = [
-    'Package',
-    'Anchor',
-    'ResourceReader',
-    'as_file',
-    'files',
-    'contents',
-    'is_resource',
-    'open_binary',
-    'open_text',
-    'path',
-    'read_binary',
-    'read_text',
-]
diff --git a/pkg_resources/_vendor/importlib_resources/_adapters.py b/pkg_resources/_vendor/importlib_resources/_adapters.py
deleted file mode 100644
index 50688fbb66..0000000000
--- a/pkg_resources/_vendor/importlib_resources/_adapters.py
+++ /dev/null
@@ -1,168 +0,0 @@
-from contextlib import suppress
-from io import TextIOWrapper
-
-from . import abc
-
-
-class SpecLoaderAdapter:
-    """
-    Adapt a package spec to adapt the underlying loader.
-    """
-
-    def __init__(self, spec, adapter=lambda spec: spec.loader):
-        self.spec = spec
-        self.loader = adapter(spec)
-
-    def __getattr__(self, name):
-        return getattr(self.spec, name)
-
-
-class TraversableResourcesLoader:
-    """
-    Adapt a loader to provide TraversableResources.
-    """
-
-    def __init__(self, spec):
-        self.spec = spec
-
-    def get_resource_reader(self, name):
-        return CompatibilityFiles(self.spec)._native()
-
-
-def _io_wrapper(file, mode='r', *args, **kwargs):
-    if mode == 'r':
-        return TextIOWrapper(file, *args, **kwargs)
-    elif mode == 'rb':
-        return file
-    raise ValueError(f"Invalid mode value '{mode}', only 'r' and 'rb' are supported")
-
-
-class CompatibilityFiles:
-    """
-    Adapter for an existing or non-existent resource reader
-    to provide a compatibility .files().
-    """
-
-    class SpecPath(abc.Traversable):
-        """
-        Path tied to a module spec.
-        Can be read and exposes the resource reader children.
-        """
-
-        def __init__(self, spec, reader):
-            self._spec = spec
-            self._reader = reader
-
-        def iterdir(self):
-            if not self._reader:
-                return iter(())
-            return iter(
-                CompatibilityFiles.ChildPath(self._reader, path)
-                for path in self._reader.contents()
-            )
-
-        def is_file(self):
-            return False
-
-        is_dir = is_file
-
-        def joinpath(self, other):
-            if not self._reader:
-                return CompatibilityFiles.OrphanPath(other)
-            return CompatibilityFiles.ChildPath(self._reader, other)
-
-        @property
-        def name(self):
-            return self._spec.name
-
-        def open(self, mode='r', *args, **kwargs):
-            return _io_wrapper(self._reader.open_resource(None), mode, *args, **kwargs)
-
-    class ChildPath(abc.Traversable):
-        """
-        Path tied to a resource reader child.
-        Can be read but doesn't expose any meaningful children.
-        """
-
-        def __init__(self, reader, name):
-            self._reader = reader
-            self._name = name
-
-        def iterdir(self):
-            return iter(())
-
-        def is_file(self):
-            return self._reader.is_resource(self.name)
-
-        def is_dir(self):
-            return not self.is_file()
-
-        def joinpath(self, other):
-            return CompatibilityFiles.OrphanPath(self.name, other)
-
-        @property
-        def name(self):
-            return self._name
-
-        def open(self, mode='r', *args, **kwargs):
-            return _io_wrapper(
-                self._reader.open_resource(self.name), mode, *args, **kwargs
-            )
-
-    class OrphanPath(abc.Traversable):
-        """
-        Orphan path, not tied to a module spec or resource reader.
-        Can't be read and doesn't expose any meaningful children.
-        """
-
-        def __init__(self, *path_parts):
-            if len(path_parts) < 1:
-                raise ValueError('Need at least one path part to construct a path')
-            self._path = path_parts
-
-        def iterdir(self):
-            return iter(())
-
-        def is_file(self):
-            return False
-
-        is_dir = is_file
-
-        def joinpath(self, other):
-            return CompatibilityFiles.OrphanPath(*self._path, other)
-
-        @property
-        def name(self):
-            return self._path[-1]
-
-        def open(self, mode='r', *args, **kwargs):
-            raise FileNotFoundError("Can't open orphan path")
-
-    def __init__(self, spec):
-        self.spec = spec
-
-    @property
-    def _reader(self):
-        with suppress(AttributeError):
-            return self.spec.loader.get_resource_reader(self.spec.name)
-
-    def _native(self):
-        """
-        Return the native reader if it supports files().
-        """
-        reader = self._reader
-        return reader if hasattr(reader, 'files') else self
-
-    def __getattr__(self, attr):
-        return getattr(self._reader, attr)
-
-    def files(self):
-        return CompatibilityFiles.SpecPath(self.spec, self._reader)
-
-
-def wrap_spec(package):
-    """
-    Construct a package spec with traversable compatibility
-    on the spec/loader/reader.
-    """
-    return SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
diff --git a/pkg_resources/_vendor/importlib_resources/_common.py b/pkg_resources/_vendor/importlib_resources/_common.py
deleted file mode 100644
index 8df6b39e41..0000000000
--- a/pkg_resources/_vendor/importlib_resources/_common.py
+++ /dev/null
@@ -1,210 +0,0 @@
-import os
-import pathlib
-import tempfile
-import functools
-import contextlib
-import types
-import importlib
-import inspect
-import warnings
-import itertools
-
-from typing import Union, Optional, cast
-from .abc import ResourceReader, Traversable
-
-Package = Union[types.ModuleType, str]
-Anchor = Package
-
-
-def package_to_anchor(func):
-    """
-    Replace 'package' parameter as 'anchor' and warn about the change.
-
-    Other errors should fall through.
-
-    >>> files('a', 'b')
-    Traceback (most recent call last):
-    TypeError: files() takes from 0 to 1 positional arguments but 2 were given
-
-    Remove this compatibility in Python 3.14.
-    """
-    undefined = object()
-
-    @functools.wraps(func)
-    def wrapper(anchor=undefined, package=undefined):
-        if package is not undefined:
-            if anchor is not undefined:
-                return func(anchor, package)
-            warnings.warn(
-                "First parameter to files is renamed to 'anchor'",
-                DeprecationWarning,
-                stacklevel=2,
-            )
-            return func(package)
-        elif anchor is undefined:
-            return func()
-        return func(anchor)
-
-    return wrapper
-
-
-@package_to_anchor
-def files(anchor: Optional[Anchor] = None) -> Traversable:
-    """
-    Get a Traversable resource for an anchor.
-    """
-    return from_package(resolve(anchor))
-
-
-def get_resource_reader(package: types.ModuleType) -> Optional[ResourceReader]:
-    """
-    Return the package's loader if it's a ResourceReader.
-    """
-    # We can't use
-    # a issubclass() check here because apparently abc.'s __subclasscheck__()
-    # hook wants to create a weak reference to the object, but
-    # zipimport.zipimporter does not support weak references, resulting in a
-    # TypeError.  That seems terrible.
-    spec = package.__spec__
-    reader = getattr(spec.loader, 'get_resource_reader', None)  # type: ignore
-    if reader is None:
-        return None
-    return reader(spec.name)  # type: ignore
-
-
-@functools.singledispatch
-def resolve(cand: Optional[Anchor]) -> types.ModuleType:
-    return cast(types.ModuleType, cand)
-
-
-@resolve.register
-def _(cand: str) -> types.ModuleType:
-    return importlib.import_module(cand)
-
-
-@resolve.register
-def _(cand: None) -> types.ModuleType:
-    return resolve(_infer_caller().f_globals['__name__'])
-
-
-def _infer_caller():
-    """
-    Walk the stack and find the frame of the first caller not in this module.
-    """
-
-    def is_this_file(frame_info):
-        return frame_info.filename == __file__
-
-    def is_wrapper(frame_info):
-        return frame_info.function == 'wrapper'
-
-    not_this_file = itertools.filterfalse(is_this_file, inspect.stack())
-    # also exclude 'wrapper' due to singledispatch in the call stack
-    callers = itertools.filterfalse(is_wrapper, not_this_file)
-    return next(callers).frame
-
-
-def from_package(package: types.ModuleType):
-    """
-    Return a Traversable object for the given package.
-
-    """
-    # deferred for performance (python/cpython#109829)
-    from .future.adapters import wrap_spec
-
-    spec = wrap_spec(package)
-    reader = spec.loader.get_resource_reader(spec.name)
-    return reader.files()
-
-
-@contextlib.contextmanager
-def _tempfile(
-    reader,
-    suffix='',
-    # gh-93353: Keep a reference to call os.remove() in late Python
-    # finalization.
-    *,
-    _os_remove=os.remove,
-):
-    # Not using tempfile.NamedTemporaryFile as it leads to deeper 'try'
-    # blocks due to the need to close the temporary file to work on Windows
-    # properly.
-    fd, raw_path = tempfile.mkstemp(suffix=suffix)
-    try:
-        try:
-            os.write(fd, reader())
-        finally:
-            os.close(fd)
-        del reader
-        yield pathlib.Path(raw_path)
-    finally:
-        try:
-            _os_remove(raw_path)
-        except FileNotFoundError:
-            pass
-
-
-def _temp_file(path):
-    return _tempfile(path.read_bytes, suffix=path.name)
-
-
-def _is_present_dir(path: Traversable) -> bool:
-    """
-    Some Traversables implement ``is_dir()`` to raise an
-    exception (i.e. ``FileNotFoundError``) when the
-    directory doesn't exist. This function wraps that call
-    to always return a boolean and only return True
-    if there's a dir and it exists.
-    """
-    with contextlib.suppress(FileNotFoundError):
-        return path.is_dir()
-    return False
-
-
-@functools.singledispatch
-def as_file(path):
-    """
-    Given a Traversable object, return that object as a
-    path on the local file system in a context manager.
-    """
-    return _temp_dir(path) if _is_present_dir(path) else _temp_file(path)
-
-
-@as_file.register(pathlib.Path)
-@contextlib.contextmanager
-def _(path):
-    """
-    Degenerate behavior for pathlib.Path objects.
-    """
-    yield path
-
-
-@contextlib.contextmanager
-def _temp_path(dir: tempfile.TemporaryDirectory):
-    """
-    Wrap tempfile.TemporyDirectory to return a pathlib object.
-    """
-    with dir as result:
-        yield pathlib.Path(result)
-
-
-@contextlib.contextmanager
-def _temp_dir(path):
-    """
-    Given a traversable dir, recursively replicate the whole tree
-    to the file system in a context manager.
-    """
-    assert path.is_dir()
-    with _temp_path(tempfile.TemporaryDirectory()) as temp_dir:
-        yield _write_contents(temp_dir, path)
-
-
-def _write_contents(target, source):
-    child = target.joinpath(source.name)
-    if source.is_dir():
-        child.mkdir()
-        for item in source.iterdir():
-            _write_contents(child, item)
-    else:
-        child.write_bytes(source.read_bytes())
-    return child
diff --git a/pkg_resources/_vendor/importlib_resources/_itertools.py b/pkg_resources/_vendor/importlib_resources/_itertools.py
deleted file mode 100644
index 7b775ef5ae..0000000000
--- a/pkg_resources/_vendor/importlib_resources/_itertools.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# from more_itertools 9.0
-def only(iterable, default=None, too_long=None):
-    """If *iterable* has only one item, return it.
-    If it has zero items, return *default*.
-    If it has more than one item, raise the exception given by *too_long*,
-    which is ``ValueError`` by default.
-    >>> only([], default='missing')
-    'missing'
-    >>> only([1])
-    1
-    >>> only([1, 2])  # doctest: +IGNORE_EXCEPTION_DETAIL
-    Traceback (most recent call last):
-    ...
-    ValueError: Expected exactly one item in iterable, but got 1, 2,
-     and perhaps more.'
-    >>> only([1, 2], too_long=TypeError)  # doctest: +IGNORE_EXCEPTION_DETAIL
-    Traceback (most recent call last):
-    ...
-    TypeError
-    Note that :func:`only` attempts to advance *iterable* twice to ensure there
-    is only one item.  See :func:`spy` or :func:`peekable` to check
-    iterable contents less destructively.
-    """
-    it = iter(iterable)
-    first_value = next(it, default)
-
-    try:
-        second_value = next(it)
-    except StopIteration:
-        pass
-    else:
-        msg = (
-            'Expected exactly one item in iterable, but got {!r}, {!r}, '
-            'and perhaps more.'.format(first_value, second_value)
-        )
-        raise too_long or ValueError(msg)
-
-    return first_value
diff --git a/pkg_resources/_vendor/importlib_resources/abc.py b/pkg_resources/_vendor/importlib_resources/abc.py
deleted file mode 100644
index 7a58dd2f96..0000000000
--- a/pkg_resources/_vendor/importlib_resources/abc.py
+++ /dev/null
@@ -1,171 +0,0 @@
-import abc
-import io
-import itertools
-import pathlib
-from typing import Any, BinaryIO, Iterable, Iterator, NoReturn, Text, Optional
-from typing import runtime_checkable, Protocol
-
-from .compat.py38 import StrPath
-
-
-__all__ = ["ResourceReader", "Traversable", "TraversableResources"]
-
-
-class ResourceReader(metaclass=abc.ABCMeta):
-    """Abstract base class for loaders to provide resource reading support."""
-
-    @abc.abstractmethod
-    def open_resource(self, resource: Text) -> BinaryIO:
-        """Return an opened, file-like object for binary reading.
-
-        The 'resource' argument is expected to represent only a file name.
-        If the resource cannot be found, FileNotFoundError is raised.
-        """
-        # This deliberately raises FileNotFoundError instead of
-        # NotImplementedError so that if this method is accidentally called,
-        # it'll still do the right thing.
-        raise FileNotFoundError
-
-    @abc.abstractmethod
-    def resource_path(self, resource: Text) -> Text:
-        """Return the file system path to the specified resource.
-
-        The 'resource' argument is expected to represent only a file name.
-        If the resource does not exist on the file system, raise
-        FileNotFoundError.
-        """
-        # This deliberately raises FileNotFoundError instead of
-        # NotImplementedError so that if this method is accidentally called,
-        # it'll still do the right thing.
-        raise FileNotFoundError
-
-    @abc.abstractmethod
-    def is_resource(self, path: Text) -> bool:
-        """Return True if the named 'path' is a resource.
-
-        Files are resources, directories are not.
-        """
-        raise FileNotFoundError
-
-    @abc.abstractmethod
-    def contents(self) -> Iterable[str]:
-        """Return an iterable of entries in `package`."""
-        raise FileNotFoundError
-
-
-class TraversalError(Exception):
-    pass
-
-
-@runtime_checkable
-class Traversable(Protocol):
-    """
-    An object with a subset of pathlib.Path methods suitable for
-    traversing directories and opening files.
-
-    Any exceptions that occur when accessing the backing resource
-    may propagate unaltered.
-    """
-
-    @abc.abstractmethod
-    def iterdir(self) -> Iterator["Traversable"]:
-        """
-        Yield Traversable objects in self
-        """
-
-    def read_bytes(self) -> bytes:
-        """
-        Read contents of self as bytes
-        """
-        with self.open('rb') as strm:
-            return strm.read()
-
-    def read_text(self, encoding: Optional[str] = None) -> str:
-        """
-        Read contents of self as text
-        """
-        with self.open(encoding=encoding) as strm:
-            return strm.read()
-
-    @abc.abstractmethod
-    def is_dir(self) -> bool:
-        """
-        Return True if self is a directory
-        """
-
-    @abc.abstractmethod
-    def is_file(self) -> bool:
-        """
-        Return True if self is a file
-        """
-
-    def joinpath(self, *descendants: StrPath) -> "Traversable":
-        """
-        Return Traversable resolved with any descendants applied.
-
-        Each descendant should be a path segment relative to self
-        and each may contain multiple levels separated by
-        ``posixpath.sep`` (``/``).
-        """
-        if not descendants:
-            return self
-        names = itertools.chain.from_iterable(
-            path.parts for path in map(pathlib.PurePosixPath, descendants)
-        )
-        target = next(names)
-        matches = (
-            traversable for traversable in self.iterdir() if traversable.name == target
-        )
-        try:
-            match = next(matches)
-        except StopIteration:
-            raise TraversalError(
-                "Target not found during traversal.", target, list(names)
-            )
-        return match.joinpath(*names)
-
-    def __truediv__(self, child: StrPath) -> "Traversable":
-        """
-        Return Traversable child in self
-        """
-        return self.joinpath(child)
-
-    @abc.abstractmethod
-    def open(self, mode='r', *args, **kwargs):
-        """
-        mode may be 'r' or 'rb' to open as text or binary. Return a handle
-        suitable for reading (same as pathlib.Path.open).
-
-        When opening as text, accepts encoding parameters such as those
-        accepted by io.TextIOWrapper.
-        """
-
-    @property
-    @abc.abstractmethod
-    def name(self) -> str:
-        """
-        The base name of this object without any parent references.
-        """
-
-
-class TraversableResources(ResourceReader):
-    """
-    The required interface for providing traversable
-    resources.
-    """
-
-    @abc.abstractmethod
-    def files(self) -> "Traversable":
-        """Return a Traversable object for the loaded package."""
-
-    def open_resource(self, resource: StrPath) -> io.BufferedReader:
-        return self.files().joinpath(resource).open('rb')
-
-    def resource_path(self, resource: Any) -> NoReturn:
-        raise FileNotFoundError(resource)
-
-    def is_resource(self, path: StrPath) -> bool:
-        return self.files().joinpath(path).is_file()
-
-    def contents(self) -> Iterator[str]:
-        return (item.name for item in self.files().iterdir())
diff --git a/pkg_resources/_vendor/importlib_resources/compat/__init__.py b/pkg_resources/_vendor/importlib_resources/compat/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/compat/py38.py b/pkg_resources/_vendor/importlib_resources/compat/py38.py
deleted file mode 100644
index 4d548257f8..0000000000
--- a/pkg_resources/_vendor/importlib_resources/compat/py38.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import os
-import sys
-
-from typing import Union
-
-
-if sys.version_info >= (3, 9):
-    StrPath = Union[str, os.PathLike[str]]
-else:
-    # PathLike is only subscriptable at runtime in 3.9+
-    StrPath = Union[str, "os.PathLike[str]"]
diff --git a/pkg_resources/_vendor/importlib_resources/compat/py39.py b/pkg_resources/_vendor/importlib_resources/compat/py39.py
deleted file mode 100644
index ab87b9dc14..0000000000
--- a/pkg_resources/_vendor/importlib_resources/compat/py39.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import sys
-
-
-__all__ = ['ZipPath']
-
-
-if sys.version_info >= (3, 10):
-    from zipfile import Path as ZipPath  # type: ignore
-else:
-    from zipp import Path as ZipPath  # type: ignore
diff --git a/pkg_resources/_vendor/importlib_resources/functional.py b/pkg_resources/_vendor/importlib_resources/functional.py
deleted file mode 100644
index f59416f2dd..0000000000
--- a/pkg_resources/_vendor/importlib_resources/functional.py
+++ /dev/null
@@ -1,81 +0,0 @@
-"""Simplified function-based API for importlib.resources"""
-
-import warnings
-
-from ._common import files, as_file
-
-
-_MISSING = object()
-
-
-def open_binary(anchor, *path_names):
-    """Open for binary reading the *resource* within *package*."""
-    return _get_resource(anchor, path_names).open('rb')
-
-
-def open_text(anchor, *path_names, encoding=_MISSING, errors='strict'):
-    """Open for text reading the *resource* within *package*."""
-    encoding = _get_encoding_arg(path_names, encoding)
-    resource = _get_resource(anchor, path_names)
-    return resource.open('r', encoding=encoding, errors=errors)
-
-
-def read_binary(anchor, *path_names):
-    """Read and return contents of *resource* within *package* as bytes."""
-    return _get_resource(anchor, path_names).read_bytes()
-
-
-def read_text(anchor, *path_names, encoding=_MISSING, errors='strict'):
-    """Read and return contents of *resource* within *package* as str."""
-    encoding = _get_encoding_arg(path_names, encoding)
-    resource = _get_resource(anchor, path_names)
-    return resource.read_text(encoding=encoding, errors=errors)
-
-
-def path(anchor, *path_names):
-    """Return the path to the *resource* as an actual file system path."""
-    return as_file(_get_resource(anchor, path_names))
-
-
-def is_resource(anchor, *path_names):
-    """Return ``True`` if there is a resource named *name* in the package,
-
-    Otherwise returns ``False``.
-    """
-    return _get_resource(anchor, path_names).is_file()
-
-
-def contents(anchor, *path_names):
-    """Return an iterable over the named resources within the package.
-
-    The iterable returns :class:`str` resources (e.g. files).
-    The iterable does not recurse into subdirectories.
-    """
-    warnings.warn(
-        "importlib.resources.contents is deprecated. "
-        "Use files(anchor).iterdir() instead.",
-        DeprecationWarning,
-        stacklevel=1,
-    )
-    return (resource.name for resource in _get_resource(anchor, path_names).iterdir())
-
-
-def _get_encoding_arg(path_names, encoding):
-    # For compatibility with versions where *encoding* was a positional
-    # argument, it needs to be given explicitly when there are multiple
-    # *path_names*.
-    # This limitation can be removed in Python 3.15.
-    if encoding is _MISSING:
-        if len(path_names) > 1:
-            raise TypeError(
-                "'encoding' argument required with multiple path names",
-            )
-        else:
-            return 'utf-8'
-    return encoding
-
-
-def _get_resource(anchor, path_names):
-    if anchor is None:
-        raise TypeError("anchor must be module or string, got None")
-    return files(anchor).joinpath(*path_names)
diff --git a/pkg_resources/_vendor/importlib_resources/future/__init__.py b/pkg_resources/_vendor/importlib_resources/future/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/future/adapters.py b/pkg_resources/_vendor/importlib_resources/future/adapters.py
deleted file mode 100644
index 0e9764bae8..0000000000
--- a/pkg_resources/_vendor/importlib_resources/future/adapters.py
+++ /dev/null
@@ -1,95 +0,0 @@
-import functools
-import pathlib
-from contextlib import suppress
-from types import SimpleNamespace
-
-from .. import readers, _adapters
-
-
-def _block_standard(reader_getter):
-    """
-    Wrap _adapters.TraversableResourcesLoader.get_resource_reader
-    and intercept any standard library readers.
-    """
-
-    @functools.wraps(reader_getter)
-    def wrapper(*args, **kwargs):
-        """
-        If the reader is from the standard library, return None to allow
-        allow likely newer implementations in this library to take precedence.
-        """
-        try:
-            reader = reader_getter(*args, **kwargs)
-        except NotADirectoryError:
-            # MultiplexedPath may fail on zip subdirectory
-            return
-        # Python 3.10+
-        mod_name = reader.__class__.__module__
-        if mod_name.startswith('importlib.') and mod_name.endswith('readers'):
-            return
-        # Python 3.8, 3.9
-        if isinstance(reader, _adapters.CompatibilityFiles) and (
-            reader.spec.loader.__class__.__module__.startswith('zipimport')
-            or reader.spec.loader.__class__.__module__.startswith(
-                '_frozen_importlib_external'
-            )
-        ):
-            return
-        return reader
-
-    return wrapper
-
-
-def _skip_degenerate(reader):
-    """
-    Mask any degenerate reader. Ref #298.
-    """
-    is_degenerate = (
-        isinstance(reader, _adapters.CompatibilityFiles) and not reader._reader
-    )
-    return reader if not is_degenerate else None
-
-
-class TraversableResourcesLoader(_adapters.TraversableResourcesLoader):
-    """
-    Adapt loaders to provide TraversableResources and other
-    compatibility.
-
-    Ensures the readers from importlib_resources are preferred
-    over stdlib readers.
-    """
-
-    def get_resource_reader(self, name):
-        return (
-            _skip_degenerate(_block_standard(super().get_resource_reader)(name))
-            or self._standard_reader()
-            or super().get_resource_reader(name)
-        )
-
-    def _standard_reader(self):
-        return self._zip_reader() or self._namespace_reader() or self._file_reader()
-
-    def _zip_reader(self):
-        with suppress(AttributeError):
-            return readers.ZipReader(self.spec.loader, self.spec.name)
-
-    def _namespace_reader(self):
-        with suppress(AttributeError, ValueError):
-            return readers.NamespaceReader(self.spec.submodule_search_locations)
-
-    def _file_reader(self):
-        try:
-            path = pathlib.Path(self.spec.origin)
-        except TypeError:
-            return None
-        if path.exists():
-            return readers.FileReader(SimpleNamespace(path=path))
-
-
-def wrap_spec(package):
-    """
-    Override _adapters.wrap_spec to use TraversableResourcesLoader
-    from above. Ensures that future behavior is always available on older
-    Pythons.
-    """
-    return _adapters.SpecLoaderAdapter(package.__spec__, TraversableResourcesLoader)
diff --git a/pkg_resources/_vendor/importlib_resources/py.typed b/pkg_resources/_vendor/importlib_resources/py.typed
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/readers.py b/pkg_resources/_vendor/importlib_resources/readers.py
deleted file mode 100644
index 4a80a774aa..0000000000
--- a/pkg_resources/_vendor/importlib_resources/readers.py
+++ /dev/null
@@ -1,194 +0,0 @@
-import collections
-import contextlib
-import itertools
-import pathlib
-import operator
-import re
-import warnings
-
-from . import abc
-
-from ._itertools import only
-from .compat.py39 import ZipPath
-
-
-def remove_duplicates(items):
-    return iter(collections.OrderedDict.fromkeys(items))
-
-
-class FileReader(abc.TraversableResources):
-    def __init__(self, loader):
-        self.path = pathlib.Path(loader.path).parent
-
-    def resource_path(self, resource):
-        """
-        Return the file system path to prevent
-        `resources.path()` from creating a temporary
-        copy.
-        """
-        return str(self.path.joinpath(resource))
-
-    def files(self):
-        return self.path
-
-
-class ZipReader(abc.TraversableResources):
-    def __init__(self, loader, module):
-        _, _, name = module.rpartition('.')
-        self.prefix = loader.prefix.replace('\\', '/') + name + '/'
-        self.archive = loader.archive
-
-    def open_resource(self, resource):
-        try:
-            return super().open_resource(resource)
-        except KeyError as exc:
-            raise FileNotFoundError(exc.args[0])
-
-    def is_resource(self, path):
-        """
-        Workaround for `zipfile.Path.is_file` returning true
-        for non-existent paths.
-        """
-        target = self.files().joinpath(path)
-        return target.is_file() and target.exists()
-
-    def files(self):
-        return ZipPath(self.archive, self.prefix)
-
-
-class MultiplexedPath(abc.Traversable):
-    """
-    Given a series of Traversable objects, implement a merged
-    version of the interface across all objects. Useful for
-    namespace packages which may be multihomed at a single
-    name.
-    """
-
-    def __init__(self, *paths):
-        self._paths = list(map(_ensure_traversable, remove_duplicates(paths)))
-        if not self._paths:
-            message = 'MultiplexedPath must contain at least one path'
-            raise FileNotFoundError(message)
-        if not all(path.is_dir() for path in self._paths):
-            raise NotADirectoryError('MultiplexedPath only supports directories')
-
-    def iterdir(self):
-        children = (child for path in self._paths for child in path.iterdir())
-        by_name = operator.attrgetter('name')
-        groups = itertools.groupby(sorted(children, key=by_name), key=by_name)
-        return map(self._follow, (locs for name, locs in groups))
-
-    def read_bytes(self):
-        raise FileNotFoundError(f'{self} is not a file')
-
-    def read_text(self, *args, **kwargs):
-        raise FileNotFoundError(f'{self} is not a file')
-
-    def is_dir(self):
-        return True
-
-    def is_file(self):
-        return False
-
-    def joinpath(self, *descendants):
-        try:
-            return super().joinpath(*descendants)
-        except abc.TraversalError:
-            # One of the paths did not resolve (a directory does not exist).
-            # Just return something that will not exist.
-            return self._paths[0].joinpath(*descendants)
-
-    @classmethod
-    def _follow(cls, children):
-        """
-        Construct a MultiplexedPath if needed.
-
-        If children contains a sole element, return it.
-        Otherwise, return a MultiplexedPath of the items.
-        Unless one of the items is not a Directory, then return the first.
-        """
-        subdirs, one_dir, one_file = itertools.tee(children, 3)
-
-        try:
-            return only(one_dir)
-        except ValueError:
-            try:
-                return cls(*subdirs)
-            except NotADirectoryError:
-                return next(one_file)
-
-    def open(self, *args, **kwargs):
-        raise FileNotFoundError(f'{self} is not a file')
-
-    @property
-    def name(self):
-        return self._paths[0].name
-
-    def __repr__(self):
-        paths = ', '.join(f"'{path}'" for path in self._paths)
-        return f'MultiplexedPath({paths})'
-
-
-class NamespaceReader(abc.TraversableResources):
-    def __init__(self, namespace_path):
-        if 'NamespacePath' not in str(namespace_path):
-            raise ValueError('Invalid path')
-        self.path = MultiplexedPath(*map(self._resolve, namespace_path))
-
-    @classmethod
-    def _resolve(cls, path_str) -> abc.Traversable:
-        r"""
-        Given an item from a namespace path, resolve it to a Traversable.
-
-        path_str might be a directory on the filesystem or a path to a
-        zipfile plus the path within the zipfile, e.g. ``/foo/bar`` or
-        ``/foo/baz.zip/inner_dir`` or ``foo\baz.zip\inner_dir\sub``.
-        """
-        (dir,) = (cand for cand in cls._candidate_paths(path_str) if cand.is_dir())
-        return dir
-
-    @classmethod
-    def _candidate_paths(cls, path_str):
-        yield pathlib.Path(path_str)
-        yield from cls._resolve_zip_path(path_str)
-
-    @staticmethod
-    def _resolve_zip_path(path_str):
-        for match in reversed(list(re.finditer(r'[\\/]', path_str))):
-            with contextlib.suppress(
-                FileNotFoundError,
-                IsADirectoryError,
-                NotADirectoryError,
-                PermissionError,
-            ):
-                inner = path_str[match.end() :].replace('\\', '/') + '/'
-                yield ZipPath(path_str[: match.start()], inner.lstrip('/'))
-
-    def resource_path(self, resource):
-        """
-        Return the file system path to prevent
-        `resources.path()` from creating a temporary
-        copy.
-        """
-        return str(self.path.joinpath(resource))
-
-    def files(self):
-        return self.path
-
-
-def _ensure_traversable(path):
-    """
-    Convert deprecated string arguments to traversables (pathlib.Path).
-
-    Remove with Python 3.15.
-    """
-    if not isinstance(path, str):
-        return path
-
-    warnings.warn(
-        "String arguments are deprecated. Pass a Traversable instead.",
-        DeprecationWarning,
-        stacklevel=3,
-    )
-
-    return pathlib.Path(path)
diff --git a/pkg_resources/_vendor/importlib_resources/simple.py b/pkg_resources/_vendor/importlib_resources/simple.py
deleted file mode 100644
index 96f117fec6..0000000000
--- a/pkg_resources/_vendor/importlib_resources/simple.py
+++ /dev/null
@@ -1,106 +0,0 @@
-"""
-Interface adapters for low-level readers.
-"""
-
-import abc
-import io
-import itertools
-from typing import BinaryIO, List
-
-from .abc import Traversable, TraversableResources
-
-
-class SimpleReader(abc.ABC):
-    """
-    The minimum, low-level interface required from a resource
-    provider.
-    """
-
-    @property
-    @abc.abstractmethod
-    def package(self) -> str:
-        """
-        The name of the package for which this reader loads resources.
-        """
-
-    @abc.abstractmethod
-    def children(self) -> List['SimpleReader']:
-        """
-        Obtain an iterable of SimpleReader for available
-        child containers (e.g. directories).
-        """
-
-    @abc.abstractmethod
-    def resources(self) -> List[str]:
-        """
-        Obtain available named resources for this virtual package.
-        """
-
-    @abc.abstractmethod
-    def open_binary(self, resource: str) -> BinaryIO:
-        """
-        Obtain a File-like for a named resource.
-        """
-
-    @property
-    def name(self):
-        return self.package.split('.')[-1]
-
-
-class ResourceContainer(Traversable):
-    """
-    Traversable container for a package's resources via its reader.
-    """
-
-    def __init__(self, reader: SimpleReader):
-        self.reader = reader
-
-    def is_dir(self):
-        return True
-
-    def is_file(self):
-        return False
-
-    def iterdir(self):
-        files = (ResourceHandle(self, name) for name in self.reader.resources)
-        dirs = map(ResourceContainer, self.reader.children())
-        return itertools.chain(files, dirs)
-
-    def open(self, *args, **kwargs):
-        raise IsADirectoryError()
-
-
-class ResourceHandle(Traversable):
-    """
-    Handle to a named resource in a ResourceReader.
-    """
-
-    def __init__(self, parent: ResourceContainer, name: str):
-        self.parent = parent
-        self.name = name  # type: ignore
-
-    def is_file(self):
-        return True
-
-    def is_dir(self):
-        return False
-
-    def open(self, mode='r', *args, **kwargs):
-        stream = self.parent.reader.open_binary(self.name)
-        if 'b' not in mode:
-            stream = io.TextIOWrapper(stream, *args, **kwargs)
-        return stream
-
-    def joinpath(self, name):
-        raise RuntimeError("Cannot traverse into a resource")
-
-
-class TraversableReader(TraversableResources, SimpleReader):
-    """
-    A TraversableResources based on SimpleReader. Resource providers
-    may derive from this class to provide the TraversableResources
-    interface by supplying the SimpleReader interface.
-    """
-
-    def files(self):
-        return ResourceContainer(self)
diff --git a/pkg_resources/_vendor/importlib_resources/tests/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/tests/_path.py b/pkg_resources/_vendor/importlib_resources/tests/_path.py
deleted file mode 100644
index 1f97c96146..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/_path.py
+++ /dev/null
@@ -1,56 +0,0 @@
-import pathlib
-import functools
-
-from typing import Dict, Union
-
-
-####
-# from jaraco.path 3.4.1
-
-FilesSpec = Dict[str, Union[str, bytes, 'FilesSpec']]  # type: ignore
-
-
-def build(spec: FilesSpec, prefix=pathlib.Path()):
-    """
-    Build a set of files/directories, as described by the spec.
-
-    Each key represents a pathname, and the value represents
-    the content. Content may be a nested directory.
-
-    >>> spec = {
-    ...     'README.txt': "A README file",
-    ...     "foo": {
-    ...         "__init__.py": "",
-    ...         "bar": {
-    ...             "__init__.py": "",
-    ...         },
-    ...         "baz.py": "# Some code",
-    ...     }
-    ... }
-    >>> target = getfixture('tmp_path')
-    >>> build(spec, target)
-    >>> target.joinpath('foo/baz.py').read_text(encoding='utf-8')
-    '# Some code'
-    """
-    for name, contents in spec.items():
-        create(contents, pathlib.Path(prefix) / name)
-
-
-@functools.singledispatch
-def create(content: Union[str, bytes, FilesSpec], path):
-    path.mkdir(exist_ok=True)
-    build(content, prefix=path)  # type: ignore
-
-
-@create.register
-def _(content: bytes, path):
-    path.write_bytes(content)
-
-
-@create.register
-def _(content: str, path):
-    path.write_text(content, encoding='utf-8')
-
-
-# end from jaraco.path
-####
diff --git a/pkg_resources/_vendor/importlib_resources/tests/compat/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/compat/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/tests/compat/py312.py b/pkg_resources/_vendor/importlib_resources/tests/compat/py312.py
deleted file mode 100644
index ea9a58ba2e..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/compat/py312.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import contextlib
-
-from .py39 import import_helper
-
-
-@contextlib.contextmanager
-def isolated_modules():
-    """
-    Save modules on entry and cleanup on exit.
-    """
-    (saved,) = import_helper.modules_setup()
-    try:
-        yield
-    finally:
-        import_helper.modules_cleanup(saved)
-
-
-vars(import_helper).setdefault('isolated_modules', isolated_modules)
diff --git a/pkg_resources/_vendor/importlib_resources/tests/compat/py39.py b/pkg_resources/_vendor/importlib_resources/tests/compat/py39.py
deleted file mode 100644
index e158eb85d3..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/compat/py39.py
+++ /dev/null
@@ -1,10 +0,0 @@
-"""
-Backward-compatability shims to support Python 3.9 and earlier.
-"""
-
-from jaraco.test.cpython import from_test_support, try_import
-
-import_helper = try_import('import_helper') or from_test_support(
-    'modules_setup', 'modules_cleanup', 'DirsOnSysPath'
-)
-os_helper = try_import('os_helper') or from_test_support('temp_dir')
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data01/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/data01/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data01/binary.file b/pkg_resources/_vendor/importlib_resources/tests/data01/binary.file
deleted file mode 100644
index eaf36c1daccfdf325514461cd1a2ffbc139b5464..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 4
LcmZQzWMT#Y01f~L

diff --git a/pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/binary.file b/pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/binary.file
deleted file mode 100644
index 5bd8bb897b..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/data01/subdirectory/binary.file
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data01/utf-16.file b/pkg_resources/_vendor/importlib_resources/tests/data01/utf-16.file
deleted file mode 100644
index 2cb772295ef4b480a8d83725bd5006a0236d8f68..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 44
ucmezW&x0YAAqNQa8FUyF7(y9B7~B|i84MZBfV^^`Xc15@g+Y;liva-T)Ce>H

diff --git a/pkg_resources/_vendor/importlib_resources/tests/data01/utf-8.file b/pkg_resources/_vendor/importlib_resources/tests/data01/utf-8.file
deleted file mode 100644
index 1c0132ad90..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/data01/utf-8.file
+++ /dev/null
@@ -1 +0,0 @@
-Hello, UTF-8 world!
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data02/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/data02/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data02/one/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/data02/one/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data02/one/resource1.txt b/pkg_resources/_vendor/importlib_resources/tests/data02/one/resource1.txt
deleted file mode 100644
index 61a813e401..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/data02/one/resource1.txt
+++ /dev/null
@@ -1 +0,0 @@
-one resource
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt b/pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
deleted file mode 100644
index 48f587a2d0..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/data02/subdirectory/subsubdir/resource.txt
+++ /dev/null
@@ -1 +0,0 @@
-a resource
\ No newline at end of file
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data02/two/__init__.py b/pkg_resources/_vendor/importlib_resources/tests/data02/two/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/importlib_resources/tests/data02/two/resource2.txt b/pkg_resources/_vendor/importlib_resources/tests/data02/two/resource2.txt
deleted file mode 100644
index a80ce46ea3..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/data02/two/resource2.txt
+++ /dev/null
@@ -1 +0,0 @@
-two resource
diff --git a/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/binary.file b/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/binary.file
deleted file mode 100644
index eaf36c1daccfdf325514461cd1a2ffbc139b5464..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 4
LcmZQzWMT#Y01f~L

diff --git a/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file b/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
deleted file mode 100644
index 100f50643d..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/subdirectory/binary.file
+++ /dev/null
@@ -1 +0,0 @@
-

\ No newline at end of file
diff --git a/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/utf-16.file b/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/utf-16.file
deleted file mode 100644
index 2cb772295ef4b480a8d83725bd5006a0236d8f68..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 44
ucmezW&x0YAAqNQa8FUyF7(y9B7~B|i84MZBfV^^`Xc15@g+Y;liva-T)Ce>H

diff --git a/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/utf-8.file b/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/utf-8.file
deleted file mode 100644
index 1c0132ad90..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/namespacedata01/utf-8.file
+++ /dev/null
@@ -1 +0,0 @@
-Hello, UTF-8 world!
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py b/pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py
deleted file mode 100644
index 13ad0dfb21..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_compatibilty_files.py
+++ /dev/null
@@ -1,104 +0,0 @@
-import io
-import unittest
-
-import importlib_resources as resources
-
-from importlib_resources._adapters import (
-    CompatibilityFiles,
-    wrap_spec,
-)
-
-from . import util
-
-
-class CompatibilityFilesTests(unittest.TestCase):
-    @property
-    def package(self):
-        bytes_data = io.BytesIO(b'Hello, world!')
-        return util.create_package(
-            file=bytes_data,
-            path='some_path',
-            contents=('a', 'b', 'c'),
-        )
-
-    @property
-    def files(self):
-        return resources.files(self.package)
-
-    def test_spec_path_iter(self):
-        self.assertEqual(
-            sorted(path.name for path in self.files.iterdir()),
-            ['a', 'b', 'c'],
-        )
-
-    def test_child_path_iter(self):
-        self.assertEqual(list((self.files / 'a').iterdir()), [])
-
-    def test_orphan_path_iter(self):
-        self.assertEqual(list((self.files / 'a' / 'a').iterdir()), [])
-        self.assertEqual(list((self.files / 'a' / 'a' / 'a').iterdir()), [])
-
-    def test_spec_path_is(self):
-        self.assertFalse(self.files.is_file())
-        self.assertFalse(self.files.is_dir())
-
-    def test_child_path_is(self):
-        self.assertTrue((self.files / 'a').is_file())
-        self.assertFalse((self.files / 'a').is_dir())
-
-    def test_orphan_path_is(self):
-        self.assertFalse((self.files / 'a' / 'a').is_file())
-        self.assertFalse((self.files / 'a' / 'a').is_dir())
-        self.assertFalse((self.files / 'a' / 'a' / 'a').is_file())
-        self.assertFalse((self.files / 'a' / 'a' / 'a').is_dir())
-
-    def test_spec_path_name(self):
-        self.assertEqual(self.files.name, 'testingpackage')
-
-    def test_child_path_name(self):
-        self.assertEqual((self.files / 'a').name, 'a')
-
-    def test_orphan_path_name(self):
-        self.assertEqual((self.files / 'a' / 'b').name, 'b')
-        self.assertEqual((self.files / 'a' / 'b' / 'c').name, 'c')
-
-    def test_spec_path_open(self):
-        self.assertEqual(self.files.read_bytes(), b'Hello, world!')
-        self.assertEqual(self.files.read_text(encoding='utf-8'), 'Hello, world!')
-
-    def test_child_path_open(self):
-        self.assertEqual((self.files / 'a').read_bytes(), b'Hello, world!')
-        self.assertEqual(
-            (self.files / 'a').read_text(encoding='utf-8'), 'Hello, world!'
-        )
-
-    def test_orphan_path_open(self):
-        with self.assertRaises(FileNotFoundError):
-            (self.files / 'a' / 'b').read_bytes()
-        with self.assertRaises(FileNotFoundError):
-            (self.files / 'a' / 'b' / 'c').read_bytes()
-
-    def test_open_invalid_mode(self):
-        with self.assertRaises(ValueError):
-            self.files.open('0')
-
-    def test_orphan_path_invalid(self):
-        with self.assertRaises(ValueError):
-            CompatibilityFiles.OrphanPath()
-
-    def test_wrap_spec(self):
-        spec = wrap_spec(self.package)
-        self.assertIsInstance(spec.loader.get_resource_reader(None), CompatibilityFiles)
-
-
-class CompatibilityFilesNoReaderTests(unittest.TestCase):
-    @property
-    def package(self):
-        return util.create_package_from_loader(None)
-
-    @property
-    def files(self):
-        return resources.files(self.package)
-
-    def test_spec_path_joinpath(self):
-        self.assertIsInstance(self.files / 'a', CompatibilityFiles.OrphanPath)
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_contents.py b/pkg_resources/_vendor/importlib_resources/tests/test_contents.py
deleted file mode 100644
index 7dc3b0a619..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_contents.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import unittest
-import importlib_resources as resources
-
-from . import data01
-from . import util
-
-
-class ContentsTests:
-    expected = {
-        '__init__.py',
-        'binary.file',
-        'subdirectory',
-        'utf-16.file',
-        'utf-8.file',
-    }
-
-    def test_contents(self):
-        contents = {path.name for path in resources.files(self.data).iterdir()}
-        assert self.expected <= contents
-
-
-class ContentsDiskTests(ContentsTests, unittest.TestCase):
-    def setUp(self):
-        self.data = data01
-
-
-class ContentsZipTests(ContentsTests, util.ZipSetup, unittest.TestCase):
-    pass
-
-
-class ContentsNamespaceTests(ContentsTests, unittest.TestCase):
-    expected = {
-        # no __init__ because of namespace design
-        'binary.file',
-        'subdirectory',
-        'utf-16.file',
-        'utf-8.file',
-    }
-
-    def setUp(self):
-        from . import namespacedata01
-
-        self.data = namespacedata01
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_custom.py b/pkg_resources/_vendor/importlib_resources/tests/test_custom.py
deleted file mode 100644
index 86c65676f1..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_custom.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import unittest
-import contextlib
-import pathlib
-
-import importlib_resources as resources
-from .. import abc
-from ..abc import TraversableResources, ResourceReader
-from . import util
-from .compat.py39 import os_helper
-
-
-class SimpleLoader:
-    """
-    A simple loader that only implements a resource reader.
-    """
-
-    def __init__(self, reader: ResourceReader):
-        self.reader = reader
-
-    def get_resource_reader(self, package):
-        return self.reader
-
-
-class MagicResources(TraversableResources):
-    """
-    Magically returns the resources at path.
-    """
-
-    def __init__(self, path: pathlib.Path):
-        self.path = path
-
-    def files(self):
-        return self.path
-
-
-class CustomTraversableResourcesTests(unittest.TestCase):
-    def setUp(self):
-        self.fixtures = contextlib.ExitStack()
-        self.addCleanup(self.fixtures.close)
-
-    def test_custom_loader(self):
-        temp_dir = pathlib.Path(self.fixtures.enter_context(os_helper.temp_dir()))
-        loader = SimpleLoader(MagicResources(temp_dir))
-        pkg = util.create_package_from_loader(loader)
-        files = resources.files(pkg)
-        assert isinstance(files, abc.Traversable)
-        assert list(files.iterdir()) == []
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_files.py b/pkg_resources/_vendor/importlib_resources/tests/test_files.py
deleted file mode 100644
index 3e86ec64bc..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_files.py
+++ /dev/null
@@ -1,117 +0,0 @@
-import textwrap
-import unittest
-import warnings
-import importlib
-import contextlib
-
-import importlib_resources as resources
-from ..abc import Traversable
-from . import data01
-from . import util
-from . import _path
-from .compat.py39 import os_helper
-from .compat.py312 import import_helper
-
-
-@contextlib.contextmanager
-def suppress_known_deprecation():
-    with warnings.catch_warnings(record=True) as ctx:
-        warnings.simplefilter('default', category=DeprecationWarning)
-        yield ctx
-
-
-class FilesTests:
-    def test_read_bytes(self):
-        files = resources.files(self.data)
-        actual = files.joinpath('utf-8.file').read_bytes()
-        assert actual == b'Hello, UTF-8 world!\n'
-
-    def test_read_text(self):
-        files = resources.files(self.data)
-        actual = files.joinpath('utf-8.file').read_text(encoding='utf-8')
-        assert actual == 'Hello, UTF-8 world!\n'
-
-    def test_traversable(self):
-        assert isinstance(resources.files(self.data), Traversable)
-
-    def test_joinpath_with_multiple_args(self):
-        files = resources.files(self.data)
-        binfile = files.joinpath('subdirectory', 'binary.file')
-        self.assertTrue(binfile.is_file())
-
-    def test_old_parameter(self):
-        """
-        Files used to take a 'package' parameter. Make sure anyone
-        passing by name is still supported.
-        """
-        with suppress_known_deprecation():
-            resources.files(package=self.data)
-
-
-class OpenDiskTests(FilesTests, unittest.TestCase):
-    def setUp(self):
-        self.data = data01
-
-
-class OpenZipTests(FilesTests, util.ZipSetup, unittest.TestCase):
-    pass
-
-
-class OpenNamespaceTests(FilesTests, unittest.TestCase):
-    def setUp(self):
-        from . import namespacedata01
-
-        self.data = namespacedata01
-
-
-class OpenNamespaceZipTests(FilesTests, util.ZipSetup, unittest.TestCase):
-    ZIP_MODULE = 'namespacedata01'
-
-
-class SiteDir:
-    def setUp(self):
-        self.fixtures = contextlib.ExitStack()
-        self.addCleanup(self.fixtures.close)
-        self.site_dir = self.fixtures.enter_context(os_helper.temp_dir())
-        self.fixtures.enter_context(import_helper.DirsOnSysPath(self.site_dir))
-        self.fixtures.enter_context(import_helper.isolated_modules())
-
-
-class ModulesFilesTests(SiteDir, unittest.TestCase):
-    def test_module_resources(self):
-        """
-        A module can have resources found adjacent to the module.
-        """
-        spec = {
-            'mod.py': '',
-            'res.txt': 'resources are the best',
-        }
-        _path.build(spec, self.site_dir)
-        import mod
-
-        actual = resources.files(mod).joinpath('res.txt').read_text(encoding='utf-8')
-        assert actual == spec['res.txt']
-
-
-class ImplicitContextFilesTests(SiteDir, unittest.TestCase):
-    def test_implicit_files(self):
-        """
-        Without any parameter, files() will infer the location as the caller.
-        """
-        spec = {
-            'somepkg': {
-                '__init__.py': textwrap.dedent(
-                    """
-                    import importlib_resources as res
-                    val = res.files().joinpath('res.txt').read_text(encoding='utf-8')
-                    """
-                ),
-                'res.txt': 'resources are the best',
-            },
-        }
-        _path.build(spec, self.site_dir)
-        assert importlib.import_module('somepkg').val == 'resources are the best'
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_functional.py b/pkg_resources/_vendor/importlib_resources/tests/test_functional.py
deleted file mode 100644
index 69706cf7be..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_functional.py
+++ /dev/null
@@ -1,242 +0,0 @@
-import unittest
-import os
-import contextlib
-
-try:
-    from test.support.warnings_helper import ignore_warnings, check_warnings
-except ImportError:
-    # older Python versions
-    from test.support import ignore_warnings, check_warnings
-
-import importlib_resources as resources
-
-# Since the functional API forwards to Traversable, we only test
-# filesystem resources here -- not zip files, namespace packages etc.
-# We do test for two kinds of Anchor, though.
-
-
-class StringAnchorMixin:
-    anchor01 = 'importlib_resources.tests.data01'
-    anchor02 = 'importlib_resources.tests.data02'
-
-
-class ModuleAnchorMixin:
-    from . import data01 as anchor01
-    from . import data02 as anchor02
-
-
-class FunctionalAPIBase:
-    def _gen_resourcetxt_path_parts(self):
-        """Yield various names of a text file in anchor02, each in a subTest"""
-        for path_parts in (
-            ('subdirectory', 'subsubdir', 'resource.txt'),
-            ('subdirectory/subsubdir/resource.txt',),
-            ('subdirectory/subsubdir', 'resource.txt'),
-        ):
-            with self.subTest(path_parts=path_parts):
-                yield path_parts
-
-    def test_read_text(self):
-        self.assertEqual(
-            resources.read_text(self.anchor01, 'utf-8.file'),
-            'Hello, UTF-8 world!\n',
-        )
-        self.assertEqual(
-            resources.read_text(
-                self.anchor02,
-                'subdirectory',
-                'subsubdir',
-                'resource.txt',
-                encoding='utf-8',
-            ),
-            'a resource',
-        )
-        for path_parts in self._gen_resourcetxt_path_parts():
-            self.assertEqual(
-                resources.read_text(
-                    self.anchor02,
-                    *path_parts,
-                    encoding='utf-8',
-                ),
-                'a resource',
-            )
-        # Use generic OSError, since e.g. attempting to read a directory can
-        # fail with PermissionError rather than IsADirectoryError
-        with self.assertRaises(OSError):
-            resources.read_text(self.anchor01)
-        with self.assertRaises(OSError):
-            resources.read_text(self.anchor01, 'no-such-file')
-        with self.assertRaises(UnicodeDecodeError):
-            resources.read_text(self.anchor01, 'utf-16.file')
-        self.assertEqual(
-            resources.read_text(
-                self.anchor01,
-                'binary.file',
-                encoding='latin1',
-            ),
-            '\x00\x01\x02\x03',
-        )
-        self.assertEqual(
-            resources.read_text(
-                self.anchor01,
-                'utf-16.file',
-                errors='backslashreplace',
-            ),
-            'Hello, UTF-16 world!\n'.encode('utf-16').decode(
-                errors='backslashreplace',
-            ),
-        )
-
-    def test_read_binary(self):
-        self.assertEqual(
-            resources.read_binary(self.anchor01, 'utf-8.file'),
-            b'Hello, UTF-8 world!\n',
-        )
-        for path_parts in self._gen_resourcetxt_path_parts():
-            self.assertEqual(
-                resources.read_binary(self.anchor02, *path_parts),
-                b'a resource',
-            )
-
-    def test_open_text(self):
-        with resources.open_text(self.anchor01, 'utf-8.file') as f:
-            self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
-        for path_parts in self._gen_resourcetxt_path_parts():
-            with resources.open_text(
-                self.anchor02,
-                *path_parts,
-                encoding='utf-8',
-            ) as f:
-                self.assertEqual(f.read(), 'a resource')
-        # Use generic OSError, since e.g. attempting to read a directory can
-        # fail with PermissionError rather than IsADirectoryError
-        with self.assertRaises(OSError):
-            resources.open_text(self.anchor01)
-        with self.assertRaises(OSError):
-            resources.open_text(self.anchor01, 'no-such-file')
-        with resources.open_text(self.anchor01, 'utf-16.file') as f:
-            with self.assertRaises(UnicodeDecodeError):
-                f.read()
-        with resources.open_text(
-            self.anchor01,
-            'binary.file',
-            encoding='latin1',
-        ) as f:
-            self.assertEqual(f.read(), '\x00\x01\x02\x03')
-        with resources.open_text(
-            self.anchor01,
-            'utf-16.file',
-            errors='backslashreplace',
-        ) as f:
-            self.assertEqual(
-                f.read(),
-                'Hello, UTF-16 world!\n'.encode('utf-16').decode(
-                    errors='backslashreplace',
-                ),
-            )
-
-    def test_open_binary(self):
-        with resources.open_binary(self.anchor01, 'utf-8.file') as f:
-            self.assertEqual(f.read(), b'Hello, UTF-8 world!\n')
-        for path_parts in self._gen_resourcetxt_path_parts():
-            with resources.open_binary(
-                self.anchor02,
-                *path_parts,
-            ) as f:
-                self.assertEqual(f.read(), b'a resource')
-
-    def test_path(self):
-        with resources.path(self.anchor01, 'utf-8.file') as path:
-            with open(str(path), encoding='utf-8') as f:
-                self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
-        with resources.path(self.anchor01) as path:
-            with open(os.path.join(path, 'utf-8.file'), encoding='utf-8') as f:
-                self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
-
-    def test_is_resource(self):
-        is_resource = resources.is_resource
-        self.assertTrue(is_resource(self.anchor01, 'utf-8.file'))
-        self.assertFalse(is_resource(self.anchor01, 'no_such_file'))
-        self.assertFalse(is_resource(self.anchor01))
-        self.assertFalse(is_resource(self.anchor01, 'subdirectory'))
-        for path_parts in self._gen_resourcetxt_path_parts():
-            self.assertTrue(is_resource(self.anchor02, *path_parts))
-
-    def test_contents(self):
-        with check_warnings((".*contents.*", DeprecationWarning)):
-            c = resources.contents(self.anchor01)
-        self.assertGreaterEqual(
-            set(c),
-            {'utf-8.file', 'utf-16.file', 'binary.file', 'subdirectory'},
-        )
-        with contextlib.ExitStack() as cm:
-            cm.enter_context(self.assertRaises(OSError))
-            cm.enter_context(check_warnings((".*contents.*", DeprecationWarning)))
-
-            list(resources.contents(self.anchor01, 'utf-8.file'))
-
-        for path_parts in self._gen_resourcetxt_path_parts():
-            with contextlib.ExitStack() as cm:
-                cm.enter_context(self.assertRaises(OSError))
-                cm.enter_context(check_warnings((".*contents.*", DeprecationWarning)))
-
-                list(resources.contents(self.anchor01, *path_parts))
-        with check_warnings((".*contents.*", DeprecationWarning)):
-            c = resources.contents(self.anchor01, 'subdirectory')
-        self.assertGreaterEqual(
-            set(c),
-            {'binary.file'},
-        )
-
-    @ignore_warnings(category=DeprecationWarning)
-    def test_common_errors(self):
-        for func in (
-            resources.read_text,
-            resources.read_binary,
-            resources.open_text,
-            resources.open_binary,
-            resources.path,
-            resources.is_resource,
-            resources.contents,
-        ):
-            with self.subTest(func=func):
-                # Rejecting None anchor
-                with self.assertRaises(TypeError):
-                    func(None)
-                # Rejecting invalid anchor type
-                with self.assertRaises((TypeError, AttributeError)):
-                    func(1234)
-                # Unknown module
-                with self.assertRaises(ModuleNotFoundError):
-                    func('$missing module$')
-
-    def test_text_errors(self):
-        for func in (
-            resources.read_text,
-            resources.open_text,
-        ):
-            with self.subTest(func=func):
-                # Multiple path arguments need explicit encoding argument.
-                with self.assertRaises(TypeError):
-                    func(
-                        self.anchor02,
-                        'subdirectory',
-                        'subsubdir',
-                        'resource.txt',
-                    )
-
-
-class FunctionalAPITest_StringAnchor(
-    unittest.TestCase,
-    FunctionalAPIBase,
-    StringAnchorMixin,
-):
-    pass
-
-
-class FunctionalAPITest_ModuleAnchor(
-    unittest.TestCase,
-    FunctionalAPIBase,
-    ModuleAnchorMixin,
-):
-    pass
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_open.py b/pkg_resources/_vendor/importlib_resources/tests/test_open.py
deleted file mode 100644
index 44f1018af3..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_open.py
+++ /dev/null
@@ -1,89 +0,0 @@
-import unittest
-
-import importlib_resources as resources
-from . import data01
-from . import util
-
-
-class CommonBinaryTests(util.CommonTests, unittest.TestCase):
-    def execute(self, package, path):
-        target = resources.files(package).joinpath(path)
-        with target.open('rb'):
-            pass
-
-
-class CommonTextTests(util.CommonTests, unittest.TestCase):
-    def execute(self, package, path):
-        target = resources.files(package).joinpath(path)
-        with target.open(encoding='utf-8'):
-            pass
-
-
-class OpenTests:
-    def test_open_binary(self):
-        target = resources.files(self.data) / 'binary.file'
-        with target.open('rb') as fp:
-            result = fp.read()
-            self.assertEqual(result, bytes(range(4)))
-
-    def test_open_text_default_encoding(self):
-        target = resources.files(self.data) / 'utf-8.file'
-        with target.open(encoding='utf-8') as fp:
-            result = fp.read()
-            self.assertEqual(result, 'Hello, UTF-8 world!\n')
-
-    def test_open_text_given_encoding(self):
-        target = resources.files(self.data) / 'utf-16.file'
-        with target.open(encoding='utf-16', errors='strict') as fp:
-            result = fp.read()
-        self.assertEqual(result, 'Hello, UTF-16 world!\n')
-
-    def test_open_text_with_errors(self):
-        """
-        Raises UnicodeError without the 'errors' argument.
-        """
-        target = resources.files(self.data) / 'utf-16.file'
-        with target.open(encoding='utf-8', errors='strict') as fp:
-            self.assertRaises(UnicodeError, fp.read)
-        with target.open(encoding='utf-8', errors='ignore') as fp:
-            result = fp.read()
-        self.assertEqual(
-            result,
-            'H\x00e\x00l\x00l\x00o\x00,\x00 '
-            '\x00U\x00T\x00F\x00-\x001\x006\x00 '
-            '\x00w\x00o\x00r\x00l\x00d\x00!\x00\n\x00',
-        )
-
-    def test_open_binary_FileNotFoundError(self):
-        target = resources.files(self.data) / 'does-not-exist'
-        with self.assertRaises(FileNotFoundError):
-            target.open('rb')
-
-    def test_open_text_FileNotFoundError(self):
-        target = resources.files(self.data) / 'does-not-exist'
-        with self.assertRaises(FileNotFoundError):
-            target.open(encoding='utf-8')
-
-
-class OpenDiskTests(OpenTests, unittest.TestCase):
-    def setUp(self):
-        self.data = data01
-
-
-class OpenDiskNamespaceTests(OpenTests, unittest.TestCase):
-    def setUp(self):
-        from . import namespacedata01
-
-        self.data = namespacedata01
-
-
-class OpenZipTests(OpenTests, util.ZipSetup, unittest.TestCase):
-    pass
-
-
-class OpenNamespaceZipTests(OpenTests, util.ZipSetup, unittest.TestCase):
-    ZIP_MODULE = 'namespacedata01'
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_path.py b/pkg_resources/_vendor/importlib_resources/tests/test_path.py
deleted file mode 100644
index c3e1cbb4ed..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_path.py
+++ /dev/null
@@ -1,65 +0,0 @@
-import io
-import pathlib
-import unittest
-
-import importlib_resources as resources
-from . import data01
-from . import util
-
-
-class CommonTests(util.CommonTests, unittest.TestCase):
-    def execute(self, package, path):
-        with resources.as_file(resources.files(package).joinpath(path)):
-            pass
-
-
-class PathTests:
-    def test_reading(self):
-        """
-        Path should be readable and a pathlib.Path instance.
-        """
-        target = resources.files(self.data) / 'utf-8.file'
-        with resources.as_file(target) as path:
-            self.assertIsInstance(path, pathlib.Path)
-            self.assertTrue(path.name.endswith("utf-8.file"), repr(path))
-            self.assertEqual('Hello, UTF-8 world!\n', path.read_text(encoding='utf-8'))
-
-
-class PathDiskTests(PathTests, unittest.TestCase):
-    data = data01
-
-    def test_natural_path(self):
-        """
-        Guarantee the internal implementation detail that
-        file-system-backed resources do not get the tempdir
-        treatment.
-        """
-        target = resources.files(self.data) / 'utf-8.file'
-        with resources.as_file(target) as path:
-            assert 'data' in str(path)
-
-
-class PathMemoryTests(PathTests, unittest.TestCase):
-    def setUp(self):
-        file = io.BytesIO(b'Hello, UTF-8 world!\n')
-        self.addCleanup(file.close)
-        self.data = util.create_package(
-            file=file, path=FileNotFoundError("package exists only in memory")
-        )
-        self.data.__spec__.origin = None
-        self.data.__spec__.has_location = False
-
-
-class PathZipTests(PathTests, util.ZipSetup, unittest.TestCase):
-    def test_remove_in_context_manager(self):
-        """
-        It is not an error if the file that was temporarily stashed on the
-        file system is removed inside the `with` stanza.
-        """
-        target = resources.files(self.data) / 'utf-8.file'
-        with resources.as_file(target) as path:
-            path.unlink()
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_read.py b/pkg_resources/_vendor/importlib_resources/tests/test_read.py
deleted file mode 100644
index 97d90128cf..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_read.py
+++ /dev/null
@@ -1,97 +0,0 @@
-import unittest
-import importlib_resources as resources
-
-from . import data01
-from . import util
-from importlib import import_module
-
-
-class CommonBinaryTests(util.CommonTests, unittest.TestCase):
-    def execute(self, package, path):
-        resources.files(package).joinpath(path).read_bytes()
-
-
-class CommonTextTests(util.CommonTests, unittest.TestCase):
-    def execute(self, package, path):
-        resources.files(package).joinpath(path).read_text(encoding='utf-8')
-
-
-class ReadTests:
-    def test_read_bytes(self):
-        result = resources.files(self.data).joinpath('binary.file').read_bytes()
-        self.assertEqual(result, bytes(range(4)))
-
-    def test_read_text_default_encoding(self):
-        result = (
-            resources.files(self.data)
-            .joinpath('utf-8.file')
-            .read_text(encoding='utf-8')
-        )
-        self.assertEqual(result, 'Hello, UTF-8 world!\n')
-
-    def test_read_text_given_encoding(self):
-        result = (
-            resources.files(self.data)
-            .joinpath('utf-16.file')
-            .read_text(encoding='utf-16')
-        )
-        self.assertEqual(result, 'Hello, UTF-16 world!\n')
-
-    def test_read_text_with_errors(self):
-        """
-        Raises UnicodeError without the 'errors' argument.
-        """
-        target = resources.files(self.data) / 'utf-16.file'
-        self.assertRaises(UnicodeError, target.read_text, encoding='utf-8')
-        result = target.read_text(encoding='utf-8', errors='ignore')
-        self.assertEqual(
-            result,
-            'H\x00e\x00l\x00l\x00o\x00,\x00 '
-            '\x00U\x00T\x00F\x00-\x001\x006\x00 '
-            '\x00w\x00o\x00r\x00l\x00d\x00!\x00\n\x00',
-        )
-
-
-class ReadDiskTests(ReadTests, unittest.TestCase):
-    data = data01
-
-
-class ReadZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
-    def test_read_submodule_resource(self):
-        submodule = import_module('data01.subdirectory')
-        result = resources.files(submodule).joinpath('binary.file').read_bytes()
-        self.assertEqual(result, bytes(range(4, 8)))
-
-    def test_read_submodule_resource_by_name(self):
-        result = (
-            resources.files('data01.subdirectory').joinpath('binary.file').read_bytes()
-        )
-        self.assertEqual(result, bytes(range(4, 8)))
-
-
-class ReadNamespaceTests(ReadTests, unittest.TestCase):
-    def setUp(self):
-        from . import namespacedata01
-
-        self.data = namespacedata01
-
-
-class ReadNamespaceZipTests(ReadTests, util.ZipSetup, unittest.TestCase):
-    ZIP_MODULE = 'namespacedata01'
-
-    def test_read_submodule_resource(self):
-        submodule = import_module('namespacedata01.subdirectory')
-        result = resources.files(submodule).joinpath('binary.file').read_bytes()
-        self.assertEqual(result, bytes(range(12, 16)))
-
-    def test_read_submodule_resource_by_name(self):
-        result = (
-            resources.files('namespacedata01.subdirectory')
-            .joinpath('binary.file')
-            .read_bytes()
-        )
-        self.assertEqual(result, bytes(range(12, 16)))
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_reader.py b/pkg_resources/_vendor/importlib_resources/tests/test_reader.py
deleted file mode 100644
index 95c2fc85a4..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_reader.py
+++ /dev/null
@@ -1,145 +0,0 @@
-import os.path
-import sys
-import pathlib
-import unittest
-
-from importlib import import_module
-from importlib_resources.readers import MultiplexedPath, NamespaceReader
-
-
-class MultiplexedPathTest(unittest.TestCase):
-    @classmethod
-    def setUpClass(cls):
-        cls.folder = pathlib.Path(__file__).parent / 'namespacedata01'
-
-    def test_init_no_paths(self):
-        with self.assertRaises(FileNotFoundError):
-            MultiplexedPath()
-
-    def test_init_file(self):
-        with self.assertRaises(NotADirectoryError):
-            MultiplexedPath(self.folder / 'binary.file')
-
-    def test_iterdir(self):
-        contents = {path.name for path in MultiplexedPath(self.folder).iterdir()}
-        try:
-            contents.remove('__pycache__')
-        except (KeyError, ValueError):
-            pass
-        self.assertEqual(
-            contents, {'subdirectory', 'binary.file', 'utf-16.file', 'utf-8.file'}
-        )
-
-    def test_iterdir_duplicate(self):
-        data01 = pathlib.Path(__file__).parent.joinpath('data01')
-        contents = {
-            path.name for path in MultiplexedPath(self.folder, data01).iterdir()
-        }
-        for remove in ('__pycache__', '__init__.pyc'):
-            try:
-                contents.remove(remove)
-            except (KeyError, ValueError):
-                pass
-        self.assertEqual(
-            contents,
-            {'__init__.py', 'binary.file', 'subdirectory', 'utf-16.file', 'utf-8.file'},
-        )
-
-    def test_is_dir(self):
-        self.assertEqual(MultiplexedPath(self.folder).is_dir(), True)
-
-    def test_is_file(self):
-        self.assertEqual(MultiplexedPath(self.folder).is_file(), False)
-
-    def test_open_file(self):
-        path = MultiplexedPath(self.folder)
-        with self.assertRaises(FileNotFoundError):
-            path.read_bytes()
-        with self.assertRaises(FileNotFoundError):
-            path.read_text()
-        with self.assertRaises(FileNotFoundError):
-            path.open()
-
-    def test_join_path(self):
-        data01 = pathlib.Path(__file__).parent.joinpath('data01')
-        prefix = str(data01.parent)
-        path = MultiplexedPath(self.folder, data01)
-        self.assertEqual(
-            str(path.joinpath('binary.file'))[len(prefix) + 1 :],
-            os.path.join('namespacedata01', 'binary.file'),
-        )
-        sub = path.joinpath('subdirectory')
-        assert isinstance(sub, MultiplexedPath)
-        assert 'namespacedata01' in str(sub)
-        assert 'data01' in str(sub)
-        self.assertEqual(
-            str(path.joinpath('imaginary'))[len(prefix) + 1 :],
-            os.path.join('namespacedata01', 'imaginary'),
-        )
-        self.assertEqual(path.joinpath(), path)
-
-    def test_join_path_compound(self):
-        path = MultiplexedPath(self.folder)
-        assert not path.joinpath('imaginary/foo.py').exists()
-
-    def test_join_path_common_subdir(self):
-        data01 = pathlib.Path(__file__).parent.joinpath('data01')
-        data02 = pathlib.Path(__file__).parent.joinpath('data02')
-        prefix = str(data01.parent)
-        path = MultiplexedPath(data01, data02)
-        self.assertIsInstance(path.joinpath('subdirectory'), MultiplexedPath)
-        self.assertEqual(
-            str(path.joinpath('subdirectory', 'subsubdir'))[len(prefix) + 1 :],
-            os.path.join('data02', 'subdirectory', 'subsubdir'),
-        )
-
-    def test_repr(self):
-        self.assertEqual(
-            repr(MultiplexedPath(self.folder)),
-            f"MultiplexedPath('{self.folder}')",
-        )
-
-    def test_name(self):
-        self.assertEqual(
-            MultiplexedPath(self.folder).name,
-            os.path.basename(self.folder),
-        )
-
-
-class NamespaceReaderTest(unittest.TestCase):
-    site_dir = str(pathlib.Path(__file__).parent)
-
-    @classmethod
-    def setUpClass(cls):
-        sys.path.append(cls.site_dir)
-
-    @classmethod
-    def tearDownClass(cls):
-        sys.path.remove(cls.site_dir)
-
-    def test_init_error(self):
-        with self.assertRaises(ValueError):
-            NamespaceReader(['path1', 'path2'])
-
-    def test_resource_path(self):
-        namespacedata01 = import_module('namespacedata01')
-        reader = NamespaceReader(namespacedata01.__spec__.submodule_search_locations)
-
-        root = os.path.abspath(os.path.join(__file__, '..', 'namespacedata01'))
-        self.assertEqual(
-            reader.resource_path('binary.file'), os.path.join(root, 'binary.file')
-        )
-        self.assertEqual(
-            reader.resource_path('imaginary'), os.path.join(root, 'imaginary')
-        )
-
-    def test_files(self):
-        namespacedata01 = import_module('namespacedata01')
-        reader = NamespaceReader(namespacedata01.__spec__.submodule_search_locations)
-        root = os.path.abspath(os.path.join(__file__, '..', 'namespacedata01'))
-        self.assertIsInstance(reader.files(), MultiplexedPath)
-        self.assertEqual(repr(reader.files()), f"MultiplexedPath('{root}')")
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/test_resource.py b/pkg_resources/_vendor/importlib_resources/tests/test_resource.py
deleted file mode 100644
index dc2a108cde..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/test_resource.py
+++ /dev/null
@@ -1,241 +0,0 @@
-import sys
-import unittest
-import importlib_resources as resources
-import pathlib
-
-from . import data01
-from . import util
-from importlib import import_module
-
-
-class ResourceTests:
-    # Subclasses are expected to set the `data` attribute.
-
-    def test_is_file_exists(self):
-        target = resources.files(self.data) / 'binary.file'
-        self.assertTrue(target.is_file())
-
-    def test_is_file_missing(self):
-        target = resources.files(self.data) / 'not-a-file'
-        self.assertFalse(target.is_file())
-
-    def test_is_dir(self):
-        target = resources.files(self.data) / 'subdirectory'
-        self.assertFalse(target.is_file())
-        self.assertTrue(target.is_dir())
-
-
-class ResourceDiskTests(ResourceTests, unittest.TestCase):
-    def setUp(self):
-        self.data = data01
-
-
-class ResourceZipTests(ResourceTests, util.ZipSetup, unittest.TestCase):
-    pass
-
-
-def names(traversable):
-    return {item.name for item in traversable.iterdir()}
-
-
-class ResourceLoaderTests(unittest.TestCase):
-    def test_resource_contents(self):
-        package = util.create_package(
-            file=data01, path=data01.__file__, contents=['A', 'B', 'C']
-        )
-        self.assertEqual(names(resources.files(package)), {'A', 'B', 'C'})
-
-    def test_is_file(self):
-        package = util.create_package(
-            file=data01, path=data01.__file__, contents=['A', 'B', 'C', 'D/E', 'D/F']
-        )
-        self.assertTrue(resources.files(package).joinpath('B').is_file())
-
-    def test_is_dir(self):
-        package = util.create_package(
-            file=data01, path=data01.__file__, contents=['A', 'B', 'C', 'D/E', 'D/F']
-        )
-        self.assertTrue(resources.files(package).joinpath('D').is_dir())
-
-    def test_resource_missing(self):
-        package = util.create_package(
-            file=data01, path=data01.__file__, contents=['A', 'B', 'C', 'D/E', 'D/F']
-        )
-        self.assertFalse(resources.files(package).joinpath('Z').is_file())
-
-
-class ResourceCornerCaseTests(unittest.TestCase):
-    def test_package_has_no_reader_fallback(self):
-        """
-        Test odd ball packages which:
-        # 1. Do not have a ResourceReader as a loader
-        # 2. Are not on the file system
-        # 3. Are not in a zip file
-        """
-        module = util.create_package(
-            file=data01, path=data01.__file__, contents=['A', 'B', 'C']
-        )
-        # Give the module a dummy loader.
-        module.__loader__ = object()
-        # Give the module a dummy origin.
-        module.__file__ = '/path/which/shall/not/be/named'
-        module.__spec__.loader = module.__loader__
-        module.__spec__.origin = module.__file__
-        self.assertFalse(resources.files(module).joinpath('A').is_file())
-
-
-class ResourceFromZipsTest01(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = 'data01'
-
-    def test_is_submodule_resource(self):
-        submodule = import_module('data01.subdirectory')
-        self.assertTrue(resources.files(submodule).joinpath('binary.file').is_file())
-
-    def test_read_submodule_resource_by_name(self):
-        self.assertTrue(
-            resources.files('data01.subdirectory').joinpath('binary.file').is_file()
-        )
-
-    def test_submodule_contents(self):
-        submodule = import_module('data01.subdirectory')
-        self.assertEqual(
-            names(resources.files(submodule)), {'__init__.py', 'binary.file'}
-        )
-
-    def test_submodule_contents_by_name(self):
-        self.assertEqual(
-            names(resources.files('data01.subdirectory')),
-            {'__init__.py', 'binary.file'},
-        )
-
-    def test_as_file_directory(self):
-        with resources.as_file(resources.files('data01')) as data:
-            assert data.name == 'data01'
-            assert data.is_dir()
-            assert data.joinpath('subdirectory').is_dir()
-            assert len(list(data.iterdir()))
-        assert not data.parent.exists()
-
-
-class ResourceFromZipsTest02(util.ZipSetupBase, unittest.TestCase):
-    ZIP_MODULE = 'data02'
-
-    def test_unrelated_contents(self):
-        """
-        Test thata zip with two unrelated subpackages return
-        distinct resources. Ref python/importlib_resources#44.
-        """
-        self.assertEqual(
-            names(resources.files('data02.one')),
-            {'__init__.py', 'resource1.txt'},
-        )
-        self.assertEqual(
-            names(resources.files('data02.two')),
-            {'__init__.py', 'resource2.txt'},
-        )
-
-
-class DeletingZipsTest(util.ZipSetupBase, unittest.TestCase):
-    """Having accessed resources in a zip file should not keep an open
-    reference to the zip.
-    """
-
-    def test_iterdir_does_not_keep_open(self):
-        [item.name for item in resources.files('data01').iterdir()]
-
-    def test_is_file_does_not_keep_open(self):
-        resources.files('data01').joinpath('binary.file').is_file()
-
-    def test_is_file_failure_does_not_keep_open(self):
-        resources.files('data01').joinpath('not-present').is_file()
-
-    @unittest.skip("Desired but not supported.")
-    def test_as_file_does_not_keep_open(self):  # pragma: no cover
-        resources.as_file(resources.files('data01') / 'binary.file')
-
-    def test_entered_path_does_not_keep_open(self):
-        """
-        Mimic what certifi does on import to make its bundle
-        available for the process duration.
-        """
-        resources.as_file(resources.files('data01') / 'binary.file').__enter__()
-
-    def test_read_binary_does_not_keep_open(self):
-        resources.files('data01').joinpath('binary.file').read_bytes()
-
-    def test_read_text_does_not_keep_open(self):
-        resources.files('data01').joinpath('utf-8.file').read_text(encoding='utf-8')
-
-
-class ResourceFromNamespaceTests:
-    def test_is_submodule_resource(self):
-        self.assertTrue(
-            resources.files(import_module('namespacedata01'))
-            .joinpath('binary.file')
-            .is_file()
-        )
-
-    def test_read_submodule_resource_by_name(self):
-        self.assertTrue(
-            resources.files('namespacedata01').joinpath('binary.file').is_file()
-        )
-
-    def test_submodule_contents(self):
-        contents = names(resources.files(import_module('namespacedata01')))
-        try:
-            contents.remove('__pycache__')
-        except KeyError:
-            pass
-        self.assertEqual(
-            contents, {'subdirectory', 'binary.file', 'utf-8.file', 'utf-16.file'}
-        )
-
-    def test_submodule_contents_by_name(self):
-        contents = names(resources.files('namespacedata01'))
-        try:
-            contents.remove('__pycache__')
-        except KeyError:
-            pass
-        self.assertEqual(
-            contents, {'subdirectory', 'binary.file', 'utf-8.file', 'utf-16.file'}
-        )
-
-    def test_submodule_sub_contents(self):
-        contents = names(resources.files(import_module('namespacedata01.subdirectory')))
-        try:
-            contents.remove('__pycache__')
-        except KeyError:
-            pass
-        self.assertEqual(contents, {'binary.file'})
-
-    def test_submodule_sub_contents_by_name(self):
-        contents = names(resources.files('namespacedata01.subdirectory'))
-        try:
-            contents.remove('__pycache__')
-        except KeyError:
-            pass
-        self.assertEqual(contents, {'binary.file'})
-
-
-class ResourceFromNamespaceDiskTests(ResourceFromNamespaceTests, unittest.TestCase):
-    site_dir = str(pathlib.Path(__file__).parent)
-
-    @classmethod
-    def setUpClass(cls):
-        sys.path.append(cls.site_dir)
-
-    @classmethod
-    def tearDownClass(cls):
-        sys.path.remove(cls.site_dir)
-
-
-class ResourceFromNamespaceZipTests(
-    util.ZipSetupBase,
-    ResourceFromNamespaceTests,
-    unittest.TestCase,
-):
-    ZIP_MODULE = 'namespacedata01'
-
-
-if __name__ == '__main__':
-    unittest.main()
diff --git a/pkg_resources/_vendor/importlib_resources/tests/util.py b/pkg_resources/_vendor/importlib_resources/tests/util.py
deleted file mode 100644
index fb827d2fa0..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/util.py
+++ /dev/null
@@ -1,164 +0,0 @@
-import abc
-import importlib
-import io
-import sys
-import types
-import pathlib
-import contextlib
-
-from . import data01
-from ..abc import ResourceReader
-from .compat.py39 import import_helper, os_helper
-from . import zip as zip_
-
-
-from importlib.machinery import ModuleSpec
-
-
-class Reader(ResourceReader):
-    def __init__(self, **kwargs):
-        vars(self).update(kwargs)
-
-    def get_resource_reader(self, package):
-        return self
-
-    def open_resource(self, path):
-        self._path = path
-        if isinstance(self.file, Exception):
-            raise self.file
-        return self.file
-
-    def resource_path(self, path_):
-        self._path = path_
-        if isinstance(self.path, Exception):
-            raise self.path
-        return self.path
-
-    def is_resource(self, path_):
-        self._path = path_
-        if isinstance(self.path, Exception):
-            raise self.path
-
-        def part(entry):
-            return entry.split('/')
-
-        return any(
-            len(parts) == 1 and parts[0] == path_ for parts in map(part, self._contents)
-        )
-
-    def contents(self):
-        if isinstance(self.path, Exception):
-            raise self.path
-        yield from self._contents
-
-
-def create_package_from_loader(loader, is_package=True):
-    name = 'testingpackage'
-    module = types.ModuleType(name)
-    spec = ModuleSpec(name, loader, origin='does-not-exist', is_package=is_package)
-    module.__spec__ = spec
-    module.__loader__ = loader
-    return module
-
-
-def create_package(file=None, path=None, is_package=True, contents=()):
-    return create_package_from_loader(
-        Reader(file=file, path=path, _contents=contents),
-        is_package,
-    )
-
-
-class CommonTests(metaclass=abc.ABCMeta):
-    """
-    Tests shared by test_open, test_path, and test_read.
-    """
-
-    @abc.abstractmethod
-    def execute(self, package, path):
-        """
-        Call the pertinent legacy API function (e.g. open_text, path)
-        on package and path.
-        """
-
-    def test_package_name(self):
-        """
-        Passing in the package name should succeed.
-        """
-        self.execute(data01.__name__, 'utf-8.file')
-
-    def test_package_object(self):
-        """
-        Passing in the package itself should succeed.
-        """
-        self.execute(data01, 'utf-8.file')
-
-    def test_string_path(self):
-        """
-        Passing in a string for the path should succeed.
-        """
-        path = 'utf-8.file'
-        self.execute(data01, path)
-
-    def test_pathlib_path(self):
-        """
-        Passing in a pathlib.PurePath object for the path should succeed.
-        """
-        path = pathlib.PurePath('utf-8.file')
-        self.execute(data01, path)
-
-    def test_importing_module_as_side_effect(self):
-        """
-        The anchor package can already be imported.
-        """
-        del sys.modules[data01.__name__]
-        self.execute(data01.__name__, 'utf-8.file')
-
-    def test_missing_path(self):
-        """
-        Attempting to open or read or request the path for a
-        non-existent path should succeed if open_resource
-        can return a viable data stream.
-        """
-        bytes_data = io.BytesIO(b'Hello, world!')
-        package = create_package(file=bytes_data, path=FileNotFoundError())
-        self.execute(package, 'utf-8.file')
-        self.assertEqual(package.__loader__._path, 'utf-8.file')
-
-    def test_extant_path(self):
-        # Attempting to open or read or request the path when the
-        # path does exist should still succeed. Does not assert
-        # anything about the result.
-        bytes_data = io.BytesIO(b'Hello, world!')
-        # any path that exists
-        path = __file__
-        package = create_package(file=bytes_data, path=path)
-        self.execute(package, 'utf-8.file')
-        self.assertEqual(package.__loader__._path, 'utf-8.file')
-
-    def test_useless_loader(self):
-        package = create_package(file=FileNotFoundError(), path=FileNotFoundError())
-        with self.assertRaises(FileNotFoundError):
-            self.execute(package, 'utf-8.file')
-
-
-class ZipSetupBase:
-    ZIP_MODULE = 'data01'
-
-    def setUp(self):
-        self.fixtures = contextlib.ExitStack()
-        self.addCleanup(self.fixtures.close)
-
-        self.fixtures.enter_context(import_helper.isolated_modules())
-
-        temp_dir = self.fixtures.enter_context(os_helper.temp_dir())
-        modules = pathlib.Path(temp_dir) / 'zipped modules.zip'
-        src_path = pathlib.Path(__file__).parent.joinpath(self.ZIP_MODULE)
-        self.fixtures.enter_context(
-            import_helper.DirsOnSysPath(str(zip_.make_zip_file(src_path, modules)))
-        )
-
-        self.data = importlib.import_module(self.ZIP_MODULE)
-
-
-class ZipSetup(ZipSetupBase):
-    pass
diff --git a/pkg_resources/_vendor/importlib_resources/tests/zip.py b/pkg_resources/_vendor/importlib_resources/tests/zip.py
deleted file mode 100644
index 962195a901..0000000000
--- a/pkg_resources/_vendor/importlib_resources/tests/zip.py
+++ /dev/null
@@ -1,32 +0,0 @@
-"""
-Generate zip test data files.
-"""
-
-import contextlib
-import os
-import pathlib
-import zipfile
-
-import zipp
-
-
-def make_zip_file(src, dst):
-    """
-    Zip the files in src into a new zipfile at dst.
-    """
-    with zipfile.ZipFile(dst, 'w') as zf:
-        for src_path, rel in walk(src):
-            dst_name = src.name / pathlib.PurePosixPath(rel.as_posix())
-            zf.write(src_path, dst_name)
-        zipp.CompleteDirs.inject(zf)
-    return dst
-
-
-def walk(datapath):
-    for dirpath, dirnames, filenames in os.walk(datapath):
-        with contextlib.suppress(ValueError):
-            dirnames.remove('__pycache__')
-        for filename in filenames:
-            res = pathlib.Path(dirpath) / filename
-            rel = res.relative_to(datapath)
-            yield res, rel
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/INSTALLER b/pkg_resources/_vendor/inflect-7.3.1.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/inflect-7.3.1.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/LICENSE b/pkg_resources/_vendor/inflect-7.3.1.dist-info/LICENSE
deleted file mode 100644
index 1bb5a44356..0000000000
--- a/pkg_resources/_vendor/inflect-7.3.1.dist-info/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-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/pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA b/pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA
deleted file mode 100644
index 9a2097a54a..0000000000
--- a/pkg_resources/_vendor/inflect-7.3.1.dist-info/METADATA
+++ /dev/null
@@ -1,591 +0,0 @@
-Metadata-Version: 2.1
-Name: inflect
-Version: 7.3.1
-Summary: Correctly generate plurals, singular nouns, ordinals, indefinite articles
-Author-email: Paul Dyson 
-Maintainer-email: "Jason R. Coombs" 
-Project-URL: Source, https://github.com/jaraco/inflect
-Keywords: plural,inflect,participle
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Natural Language :: English
-Classifier: Operating System :: OS Independent
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Classifier: Topic :: Text Processing :: Linguistic
-Requires-Python: >=3.8
-Description-Content-Type: text/x-rst
-License-File: LICENSE
-Requires-Dist: more-itertools >=8.5.0
-Requires-Dist: typeguard >=4.0.1
-Requires-Dist: typing-extensions ; python_version < "3.9"
-Provides-Extra: doc
-Requires-Dist: sphinx >=3.5 ; extra == 'doc'
-Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
-Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
-Requires-Dist: furo ; extra == 'doc'
-Requires-Dist: sphinx-lint ; extra == 'doc'
-Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
-Provides-Extra: test
-Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
-Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
-Requires-Dist: pytest-cov ; extra == 'test'
-Requires-Dist: pytest-mypy ; extra == 'test'
-Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
-Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
-Requires-Dist: pygments ; extra == 'test'
-
-.. image:: https://img.shields.io/pypi/v/inflect.svg
-   :target: https://pypi.org/project/inflect
-
-.. image:: https://img.shields.io/pypi/pyversions/inflect.svg
-
-.. image:: https://github.com/jaraco/inflect/actions/workflows/main.yml/badge.svg
-   :target: https://github.com/jaraco/inflect/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
-    :target: https://github.com/astral-sh/ruff
-    :alt: Ruff
-
-.. image:: https://readthedocs.org/projects/inflect/badge/?version=latest
-   :target: https://inflect.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2024-informational
-   :target: https://blog.jaraco.com/skeleton
-
-.. image:: https://tidelift.com/badges/package/pypi/inflect
-   :target: https://tidelift.com/subscription/pkg/pypi-inflect?utm_source=pypi-inflect&utm_medium=readme
-
-NAME
-====
-
-inflect.py - Correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words.
-
-SYNOPSIS
-========
-
-.. code-block:: python
-
-    import inflect
-
-    p = inflect.engine()
-
-    # METHODS:
-
-    # plural plural_noun plural_verb plural_adj singular_noun no num
-    # compare compare_nouns compare_nouns compare_adjs
-    # a an
-    # present_participle
-    # ordinal number_to_words
-    # join
-    # inflect classical gender
-    # defnoun defverb defadj defa defan
-
-
-    # UNCONDITIONALLY FORM THE PLURAL
-
-    print("The plural of ", word, " is ", p.plural(word))
-
-
-    # CONDITIONALLY FORM THE PLURAL
-
-    print("I saw", cat_count, p.plural("cat", cat_count))
-
-
-    # FORM PLURALS FOR SPECIFIC PARTS OF SPEECH
-
-    print(
-        p.plural_noun("I", N1),
-        p.plural_verb("saw", N1),
-        p.plural_adj("my", N2),
-        p.plural_noun("saw", N2),
-    )
-
-
-    # FORM THE SINGULAR OF PLURAL NOUNS
-
-    print("The singular of ", word, " is ", p.singular_noun(word))
-
-    # SELECT THE GENDER OF SINGULAR PRONOUNS
-
-    print(p.singular_noun("they"))  # 'it'
-    p.gender("feminine")
-    print(p.singular_noun("they"))  # 'she'
-
-
-    # DEAL WITH "0/1/N" -> "no/1/N" TRANSLATION:
-
-    print("There ", p.plural_verb("was", errors), p.no(" error", errors))
-
-
-    # USE DEFAULT COUNTS:
-
-    print(
-        p.num(N1, ""),
-        p.plural("I"),
-        p.plural_verb(" saw"),
-        p.num(N2),
-        p.plural_noun(" saw"),
-    )
-    print("There ", p.num(errors, ""), p.plural_verb("was"), p.no(" error"))
-
-
-    # COMPARE TWO WORDS "NUMBER-INSENSITIVELY":
-
-    if p.compare(word1, word2):
-        print("same")
-    if p.compare_nouns(word1, word2):
-        print("same noun")
-    if p.compare_verbs(word1, word2):
-        print("same verb")
-    if p.compare_adjs(word1, word2):
-        print("same adj.")
-
-
-    # ADD CORRECT "a" OR "an" FOR A GIVEN WORD:
-
-    print("Did you want ", p.a(thing), " or ", p.an(idea))
-
-
-    # CONVERT NUMERALS INTO ORDINALS (i.e. 1->1st, 2->2nd, 3->3rd, etc.)
-
-    print("It was", p.ordinal(position), " from the left\n")
-
-    # CONVERT NUMERALS TO WORDS (i.e. 1->"one", 101->"one hundred and one", etc.)
-    # RETURNS A SINGLE STRING...
-
-    words = p.number_to_words(1234)
-    # "one thousand, two hundred and thirty-four"
-    words = p.number_to_words(p.ordinal(1234))
-    # "one thousand, two hundred and thirty-fourth"
-
-
-    # GET BACK A LIST OF STRINGS, ONE FOR EACH "CHUNK"...
-
-    words = p.number_to_words(1234, wantlist=True)
-    # ("one thousand","two hundred and thirty-four")
-
-
-    # OPTIONAL PARAMETERS CHANGE TRANSLATION:
-
-    words = p.number_to_words(12345, group=1)
-    # "one, two, three, four, five"
-
-    words = p.number_to_words(12345, group=2)
-    # "twelve, thirty-four, five"
-
-    words = p.number_to_words(12345, group=3)
-    # "one twenty-three, forty-five"
-
-    words = p.number_to_words(1234, andword="")
-    # "one thousand, two hundred thirty-four"
-
-    words = p.number_to_words(1234, andword=", plus")
-    # "one thousand, two hundred, plus thirty-four"
-    # TODO: I get no comma before plus: check perl
-
-    words = p.number_to_words(555_1202, group=1, zero="oh")
-    # "five, five, five, one, two, oh, two"
-
-    words = p.number_to_words(555_1202, group=1, one="unity")
-    # "five, five, five, unity, two, oh, two"
-
-    words = p.number_to_words(123.456, group=1, decimal="mark")
-    # "one two three mark four five six"
-    # TODO: DOCBUG: perl gives commas here as do I
-
-    # LITERAL STYLE ONLY NAMES NUMBERS LESS THAN A CERTAIN THRESHOLD...
-
-    words = p.number_to_words(9, threshold=10)  # "nine"
-    words = p.number_to_words(10, threshold=10)  # "ten"
-    words = p.number_to_words(11, threshold=10)  # "11"
-    words = p.number_to_words(1000, threshold=10)  # "1,000"
-
-    # JOIN WORDS INTO A LIST:
-
-    mylist = p.join(("apple", "banana", "carrot"))
-    # "apple, banana, and carrot"
-
-    mylist = p.join(("apple", "banana"))
-    # "apple and banana"
-
-    mylist = p.join(("apple", "banana", "carrot"), final_sep="")
-    # "apple, banana and carrot"
-
-
-    # REQUIRE "CLASSICAL" PLURALS (EG: "focus"->"foci", "cherub"->"cherubim")
-
-    p.classical()  # USE ALL CLASSICAL PLURALS
-
-    p.classical(all=True)  # USE ALL CLASSICAL PLURALS
-    p.classical(all=False)  # SWITCH OFF CLASSICAL MODE
-
-    p.classical(zero=True)  #  "no error" INSTEAD OF "no errors"
-    p.classical(zero=False)  #  "no errors" INSTEAD OF "no error"
-
-    p.classical(herd=True)  #  "2 buffalo" INSTEAD OF "2 buffalos"
-    p.classical(herd=False)  #  "2 buffalos" INSTEAD OF "2 buffalo"
-
-    p.classical(persons=True)  # "2 chairpersons" INSTEAD OF "2 chairpeople"
-    p.classical(persons=False)  # "2 chairpeople" INSTEAD OF "2 chairpersons"
-
-    p.classical(ancient=True)  # "2 formulae" INSTEAD OF "2 formulas"
-    p.classical(ancient=False)  # "2 formulas" INSTEAD OF "2 formulae"
-
-
-    # INTERPOLATE "plural()", "plural_noun()", "plural_verb()", "plural_adj()", "singular_noun()",
-    # a()", "an()", "num()" AND "ordinal()" WITHIN STRINGS:
-
-    print(p.inflect("The plural of {0} is plural('{0}')".format(word)))
-    print(p.inflect("The singular of {0} is singular_noun('{0}')".format(word)))
-    print(p.inflect("I saw {0} plural('cat',{0})".format(cat_count)))
-    print(
-        p.inflect(
-            "plural('I',{0}) "
-            "plural_verb('saw',{0}) "
-            "plural('a',{1}) "
-            "plural_noun('saw',{1})".format(N1, N2)
-        )
-    )
-    print(
-        p.inflect(
-            "num({0}, False)plural('I') "
-            "plural_verb('saw') "
-            "num({1}, False)plural('a') "
-            "plural_noun('saw')".format(N1, N2)
-        )
-    )
-    print(p.inflect("I saw num({0}) plural('cat')\nnum()".format(cat_count)))
-    print(p.inflect("There plural_verb('was',{0}) no('error',{0})".format(errors)))
-    print(p.inflect("There num({0}, False)plural_verb('was') no('error')".format(errors)))
-    print(p.inflect("Did you want a('{0}') or an('{1}')".format(thing, idea)))
-    print(p.inflect("It was ordinal('{0}') from the left".format(position)))
-
-
-    # ADD USER-DEFINED INFLECTIONS (OVERRIDING INBUILT RULES):
-
-    p.defnoun("VAX", "VAXen")  # SINGULAR => PLURAL
-
-    p.defverb(
-        "will",  # 1ST PERSON SINGULAR
-        "shall",  # 1ST PERSON PLURAL
-        "will",  # 2ND PERSON SINGULAR
-        "will",  # 2ND PERSON PLURAL
-        "will",  # 3RD PERSON SINGULAR
-        "will",  # 3RD PERSON PLURAL
-    )
-
-    p.defadj("hir", "their")  # SINGULAR => PLURAL
-
-    p.defa("h")  # "AY HALWAYS SEZ 'HAITCH'!"
-
-    p.defan("horrendous.*")  # "AN HORRENDOUS AFFECTATION"
-
-
-DESCRIPTION
-===========
-
-The methods of the class ``engine`` in module ``inflect.py`` provide plural
-inflections, singular noun inflections, "a"/"an" selection for English words,
-and manipulation of numbers as words.
-
-Plural forms of all nouns, most verbs, and some adjectives are
-provided. Where appropriate, "classical" variants (for example: "brother" ->
-"brethren", "dogma" -> "dogmata", etc.) are also provided.
-
-Single forms of nouns are also provided. The gender of singular pronouns
-can be chosen (for example "they" -> "it" or "she" or "he" or "they").
-
-Pronunciation-based "a"/"an" selection is provided for all English
-words, and most initialisms.
-
-It is also possible to inflect numerals (1,2,3) to ordinals (1st, 2nd, 3rd)
-and to English words ("one", "two", "three").
-
-In generating these inflections, ``inflect.py`` follows the Oxford
-English Dictionary and the guidelines in Fowler's Modern English
-Usage, preferring the former where the two disagree.
-
-The module is built around standard British spelling, but is designed
-to cope with common American variants as well. Slang, jargon, and
-other English dialects are *not* explicitly catered for.
-
-Where two or more inflected forms exist for a single word (typically a
-"classical" form and a "modern" form), ``inflect.py`` prefers the
-more common form (typically the "modern" one), unless "classical"
-processing has been specified
-(see `MODERN VS CLASSICAL INFLECTIONS`).
-
-FORMING PLURALS AND SINGULARS
-=============================
-
-Inflecting Plurals and Singulars
---------------------------------
-
-All of the ``plural...`` plural inflection methods take the word to be
-inflected as their first argument and return the corresponding inflection.
-Note that all such methods expect the *singular* form of the word. The
-results of passing a plural form are undefined (and unlikely to be correct).
-Similarly, the ``si...`` singular inflection method expects the *plural*
-form of the word.
-
-The ``plural...`` methods also take an optional second argument,
-which indicates the grammatical "number" of the word (or of another word
-with which the word being inflected must agree). If the "number" argument is
-supplied and is not ``1`` (or ``"one"`` or ``"a"``, or some other adjective that
-implies the singular), the plural form of the word is returned. If the
-"number" argument *does* indicate singularity, the (uninflected) word
-itself is returned. If the number argument is omitted, the plural form
-is returned unconditionally.
-
-The ``si...`` method takes a second argument in a similar fashion. If it is
-some form of the number ``1``, or is omitted, the singular form is returned.
-Otherwise the plural is returned unaltered.
-
-
-The various methods of ``inflect.engine`` are:
-
-
-
-``plural_noun(word, count=None)``
-
- The method ``plural_noun()`` takes a *singular* English noun or
- pronoun and returns its plural. Pronouns in the nominative ("I" ->
- "we") and accusative ("me" -> "us") cases are handled, as are
- possessive pronouns ("mine" -> "ours").
-
-
-``plural_verb(word, count=None)``
-
- The method ``plural_verb()`` takes the *singular* form of a
- conjugated verb (that is, one which is already in the correct "person"
- and "mood") and returns the corresponding plural conjugation.
-
-
-``plural_adj(word, count=None)``
-
- The method ``plural_adj()`` takes the *singular* form of
- certain types of adjectives and returns the corresponding plural form.
- Adjectives that are correctly handled include: "numerical" adjectives
- ("a" -> "some"), demonstrative adjectives ("this" -> "these", "that" ->
- "those"), and possessives ("my" -> "our", "cat's" -> "cats'", "child's"
- -> "childrens'", etc.)
-
-
-``plural(word, count=None)``
-
- The method ``plural()`` takes a *singular* English noun,
- pronoun, verb, or adjective and returns its plural form. Where a word
- has more than one inflection depending on its part of speech (for
- example, the noun "thought" inflects to "thoughts", the verb "thought"
- to "thought"), the (singular) noun sense is preferred to the (singular)
- verb sense.
-
- Hence ``plural("knife")`` will return "knives" ("knife" having been treated
- as a singular noun), whereas ``plural("knifes")`` will return "knife"
- ("knifes" having been treated as a 3rd person singular verb).
-
- The inherent ambiguity of such cases suggests that,
- where the part of speech is known, ``plural_noun``, ``plural_verb``, and
- ``plural_adj`` should be used in preference to ``plural``.
-
-
-``singular_noun(word, count=None)``
-
- The method ``singular_noun()`` takes a *plural* English noun or
- pronoun and returns its singular. Pronouns in the nominative ("we" ->
- "I") and accusative ("us" -> "me") cases are handled, as are
- possessive pronouns ("ours" -> "mine"). When third person
- singular pronouns are returned they take the neuter gender by default
- ("they" -> "it"), not ("they"-> "she") nor ("they" -> "he"). This can be
- changed with ``gender()``.
-
-Note that all these methods ignore any whitespace surrounding the
-word being inflected, but preserve that whitespace when the result is
-returned. For example, ``plural(" cat  ")`` returns " cats  ".
-
-
-``gender(genderletter)``
-
- The third person plural pronoun takes the same form for the female, male and
- neuter (e.g. "they"). The singular however, depends upon gender (e.g. "she",
- "he", "it" and "they" -- "they" being the gender neutral form.) By default
- ``singular_noun`` returns the neuter form, however, the gender can be selected with
- the ``gender`` method. Pass the first letter of the gender to
- ``gender`` to return the f(eminine), m(asculine), n(euter) or t(hey)
- form of the singular. e.g.
- gender('f') followed by singular_noun('themselves') returns 'herself'.
-
-Numbered plurals
-----------------
-
-The ``plural...`` methods return only the inflected word, not the count that
-was used to inflect it. Thus, in order to produce "I saw 3 ducks", it
-is necessary to use:
-
-.. code-block:: python
-
-    print("I saw", N, p.plural_noun(animal, N))
-
-Since the usual purpose of producing a plural is to make it agree with
-a preceding count, inflect.py provides a method
-(``no(word, count)``) which, given a word and a(n optional) count, returns the
-count followed by the correctly inflected word. Hence the previous
-example can be rewritten:
-
-.. code-block:: python
-
-    print("I saw ", p.no(animal, N))
-
-In addition, if the count is zero (or some other term which implies
-zero, such as ``"zero"``, ``"nil"``, etc.) the count is replaced by the
-word "no". Hence, if ``N`` had the value zero, the previous example
-would print (the somewhat more elegant)::
-
-    I saw no animals
-
-rather than::
-
-    I saw 0 animals
-
-Note that the name of the method is a pun: the method
-returns either a number (a *No.*) or a ``"no"``, in front of the
-inflected word.
-
-
-Reducing the number of counts required
---------------------------------------
-
-In some contexts, the need to supply an explicit count to the various
-``plural...`` methods makes for tiresome repetition. For example:
-
-.. code-block:: python
-
-    print(
-        plural_adj("This", errors),
-        plural_noun(" error", errors),
-        plural_verb(" was", errors),
-        " fatal.",
-    )
-
-inflect.py therefore provides a method
-(``num(count=None, show=None)``) which may be used to set a persistent "default number"
-value. If such a value is set, it is subsequently used whenever an
-optional second "number" argument is omitted. The default value thus set
-can subsequently be removed by calling ``num()`` with no arguments.
-Hence we could rewrite the previous example:
-
-.. code-block:: python
-
-    p.num(errors)
-    print(p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal.")
-    p.num()
-
-Normally, ``num()`` returns its first argument, so that it may also
-be "inlined" in contexts like:
-
-.. code-block:: python
-
-    print(p.num(errors), p.plural_noun(" error"), p.plural_verb(" was"), " detected.")
-    if severity > 1:
-        print(
-            p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
-        )
-
-However, in certain contexts (see `INTERPOLATING INFLECTIONS IN STRINGS`)
-it is preferable that ``num()`` return an empty string. Hence ``num()``
-provides an optional second argument. If that argument is supplied (that is, if
-it is defined) and evaluates to false, ``num`` returns an empty string
-instead of its first argument. For example:
-
-.. code-block:: python
-
-    print(p.num(errors, 0), p.no("error"), p.plural_verb(" was"), " detected.")
-    if severity > 1:
-        print(
-            p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
-        )
-
-
-
-Number-insensitive equality
----------------------------
-
-inflect.py also provides a solution to the problem
-of comparing words of differing plurality through the methods
-``compare(word1, word2)``, ``compare_nouns(word1, word2)``,
-``compare_verbs(word1, word2)``, and ``compare_adjs(word1, word2)``.
-Each  of these methods takes two strings, and  compares them
-using the corresponding plural-inflection method (``plural()``, ``plural_noun()``,
-``plural_verb()``, and ``plural_adj()`` respectively).
-
-The comparison returns true if:
-
-- the strings are equal, or
-- one string is equal to a plural form of the other, or
-- the strings are two different plural forms of the one word.
-
-
-Hence all of the following return true:
-
-.. code-block:: python
-
-    p.compare("index", "index")  # RETURNS "eq"
-    p.compare("index", "indexes")  # RETURNS "s:p"
-    p.compare("index", "indices")  # RETURNS "s:p"
-    p.compare("indexes", "index")  # RETURNS "p:s"
-    p.compare("indices", "index")  # RETURNS "p:s"
-    p.compare("indices", "indexes")  # RETURNS "p:p"
-    p.compare("indexes", "indices")  # RETURNS "p:p"
-    p.compare("indices", "indices")  # RETURNS "eq"
-
-As indicated by the comments in the previous example, the actual value
-returned by the various ``compare`` methods encodes which of the
-three equality rules succeeded: "eq" is returned if the strings were
-identical, "s:p" if the strings were singular and plural respectively,
-"p:s" for plural and singular, and "p:p" for two distinct plurals.
-Inequality is indicated by returning an empty string.
-
-It should be noted that two distinct singular words which happen to take
-the same plural form are *not* considered equal, nor are cases where
-one (singular) word's plural is the other (plural) word's singular.
-Hence all of the following return false:
-
-.. code-block:: python
-
-    p.compare("base", "basis")  # ALTHOUGH BOTH -> "bases"
-    p.compare("syrinx", "syringe")  # ALTHOUGH BOTH -> "syringes"
-    p.compare("she", "he")  # ALTHOUGH BOTH -> "they"
-
-    p.compare("opus", "operas")  # ALTHOUGH "opus" -> "opera" -> "operas"
-    p.compare("taxi", "taxes")  # ALTHOUGH "taxi" -> "taxis" -> "taxes"
-
-Note too that, although the comparison is "number-insensitive" it is *not*
-case-insensitive (that is, ``plural("time","Times")`` returns false. To obtain
-both number and case insensitivity, use the ``lower()`` method on both strings
-(that is, ``plural("time".lower(), "Times".lower())`` returns true).
-
-Related Functionality
-=====================
-
-Shout out to these libraries that provide related functionality:
-
-* `WordSet `_
-  parses identifiers like variable names into sets of words suitable for re-assembling
-  in another form.
-
-* `word2number `_ converts words to
-  a number.
-
-
-For Enterprise
-==============
-
-Available as part of the Tidelift Subscription.
-
-This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
-
-`Learn more `_.
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD b/pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD
deleted file mode 100644
index 73ff576be5..0000000000
--- a/pkg_resources/_vendor/inflect-7.3.1.dist-info/RECORD
+++ /dev/null
@@ -1,13 +0,0 @@
-inflect-7.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-inflect-7.3.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-inflect-7.3.1.dist-info/METADATA,sha256=ZgMNY0WAZRs-U8wZiV2SMfjSKqBrMngXyDMs_CAwMwg,21079
-inflect-7.3.1.dist-info/RECORD,,
-inflect-7.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
-inflect-7.3.1.dist-info/top_level.txt,sha256=m52ujdp10CqT6jh1XQxZT6kEntcnv-7Tl7UiGNTzWZA,8
-inflect/__init__.py,sha256=Jxy1HJXZiZ85kHeLAhkmvz6EMTdFqBe-duvt34R6IOc,103796
-inflect/__pycache__/__init__.cpython-312.pyc,,
-inflect/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-inflect/compat/__pycache__/__init__.cpython-312.pyc,,
-inflect/compat/__pycache__/py38.cpython-312.pyc,,
-inflect/compat/py38.py,sha256=oObVfVnWX9_OpnOuEJn1mFbJxVhwyR5epbiTNXDDaso,160
-inflect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/WHEEL b/pkg_resources/_vendor/inflect-7.3.1.dist-info/WHEEL
deleted file mode 100644
index 564c6724e4..0000000000
--- a/pkg_resources/_vendor/inflect-7.3.1.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: setuptools (70.2.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt b/pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt
deleted file mode 100644
index 0fd75fab3e..0000000000
--- a/pkg_resources/_vendor/inflect-7.3.1.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-inflect
diff --git a/pkg_resources/_vendor/inflect/__init__.py b/pkg_resources/_vendor/inflect/__init__.py
deleted file mode 100644
index 3eec27f4c6..0000000000
--- a/pkg_resources/_vendor/inflect/__init__.py
+++ /dev/null
@@ -1,3986 +0,0 @@
-"""
-inflect: english language inflection
- - correctly generate plurals, ordinals, indefinite articles
- - convert numbers to words
-
-Copyright (C) 2010 Paul Dyson
-
-Based upon the Perl module
-`Lingua::EN::Inflect `_.
-
-methods:
-    classical inflect
-    plural plural_noun plural_verb plural_adj singular_noun no num a an
-    compare compare_nouns compare_verbs compare_adjs
-    present_participle
-    ordinal
-    number_to_words
-    join
-    defnoun defverb defadj defa defan
-
-INFLECTIONS:
-    classical inflect
-    plural plural_noun plural_verb plural_adj singular_noun compare
-    no num a an present_participle
-
-PLURALS:
-    classical inflect
-    plural plural_noun plural_verb plural_adj singular_noun no num
-    compare compare_nouns compare_verbs compare_adjs
-
-COMPARISONS:
-    classical
-    compare compare_nouns compare_verbs compare_adjs
-
-ARTICLES:
-    classical inflect num a an
-
-NUMERICAL:
-    ordinal number_to_words
-
-USER_DEFINED:
-    defnoun defverb defadj defa defan
-
-Exceptions:
- UnknownClassicalModeError
- BadNumValueError
- BadChunkingOptionError
- NumOutOfRangeError
- BadUserDefinedPatternError
- BadRcFileError
- BadGenderError
-
-"""
-
-from __future__ import annotations
-
-import ast
-import collections
-import contextlib
-import functools
-import itertools
-import re
-from numbers import Number
-from typing import (
-    TYPE_CHECKING,
-    Any,
-    Callable,
-    Dict,
-    Iterable,
-    List,
-    Literal,
-    Match,
-    Optional,
-    Sequence,
-    Tuple,
-    Union,
-    cast,
-)
-
-from more_itertools import windowed_complete
-from typeguard import typechecked
-
-from .compat.py38 import Annotated
-
-
-class UnknownClassicalModeError(Exception):
-    pass
-
-
-class BadNumValueError(Exception):
-    pass
-
-
-class BadChunkingOptionError(Exception):
-    pass
-
-
-class NumOutOfRangeError(Exception):
-    pass
-
-
-class BadUserDefinedPatternError(Exception):
-    pass
-
-
-class BadRcFileError(Exception):
-    pass
-
-
-class BadGenderError(Exception):
-    pass
-
-
-def enclose(s: str) -> str:
-    return f"(?:{s})"
-
-
-def joinstem(cutpoint: Optional[int] = 0, words: Optional[Iterable[str]] = None) -> str:
-    """
-    Join stem of each word in words into a string for regex.
-
-    Each word is truncated at cutpoint.
-
-    Cutpoint is usually negative indicating the number of letters to remove
-    from the end of each word.
-
-    >>> joinstem(-2, ["ephemeris", "iris", ".*itis"])
-    '(?:ephemer|ir|.*it)'
-
-    >>> joinstem(None, ["ephemeris"])
-    '(?:ephemeris)'
-
-    >>> joinstem(5, None)
-    '(?:)'
-    """
-    return enclose("|".join(w[:cutpoint] for w in words or []))
-
-
-def bysize(words: Iterable[str]) -> Dict[int, set]:
-    """
-    From a list of words, return a dict of sets sorted by word length.
-
-    >>> words = ['ant', 'cat', 'dog', 'pig', 'frog', 'goat', 'horse', 'elephant']
-    >>> ret = bysize(words)
-    >>> sorted(ret[3])
-    ['ant', 'cat', 'dog', 'pig']
-    >>> ret[5]
-    {'horse'}
-    """
-    res: Dict[int, set] = collections.defaultdict(set)
-    for w in words:
-        res[len(w)].add(w)
-    return res
-
-
-def make_pl_si_lists(
-    lst: Iterable[str],
-    plending: str,
-    siendingsize: Optional[int],
-    dojoinstem: bool = True,
-):
-    """
-    given a list of singular words: lst
-
-    an ending to append to make the plural: plending
-
-    the number of characters to remove from the singular
-    before appending plending: siendingsize
-
-    a flag whether to create a joinstem: dojoinstem
-
-    return:
-    a list of pluralised words: si_list (called si because this is what you need to
-    look for to make the singular)
-
-    the pluralised words as a dict of sets sorted by word length: si_bysize
-    the singular words as a dict of sets sorted by word length: pl_bysize
-    if dojoinstem is True: a regular expression that matches any of the stems: stem
-    """
-    if siendingsize is not None:
-        siendingsize = -siendingsize
-    si_list = [w[:siendingsize] + plending for w in lst]
-    pl_bysize = bysize(lst)
-    si_bysize = bysize(si_list)
-    if dojoinstem:
-        stem = joinstem(siendingsize, lst)
-        return si_list, si_bysize, pl_bysize, stem
-    else:
-        return si_list, si_bysize, pl_bysize
-
-
-# 1. PLURALS
-
-pl_sb_irregular_s = {
-    "corpus": "corpuses|corpora",
-    "opus": "opuses|opera",
-    "genus": "genera",
-    "mythos": "mythoi",
-    "penis": "penises|penes",
-    "testis": "testes",
-    "atlas": "atlases|atlantes",
-    "yes": "yeses",
-}
-
-pl_sb_irregular = {
-    "child": "children",
-    "chili": "chilis|chilies",
-    "brother": "brothers|brethren",
-    "infinity": "infinities|infinity",
-    "loaf": "loaves",
-    "lore": "lores|lore",
-    "hoof": "hoofs|hooves",
-    "beef": "beefs|beeves",
-    "thief": "thiefs|thieves",
-    "money": "monies",
-    "mongoose": "mongooses",
-    "ox": "oxen",
-    "cow": "cows|kine",
-    "graffito": "graffiti",
-    "octopus": "octopuses|octopodes",
-    "genie": "genies|genii",
-    "ganglion": "ganglions|ganglia",
-    "trilby": "trilbys",
-    "turf": "turfs|turves",
-    "numen": "numina",
-    "atman": "atmas",
-    "occiput": "occiputs|occipita",
-    "sabretooth": "sabretooths",
-    "sabertooth": "sabertooths",
-    "lowlife": "lowlifes",
-    "flatfoot": "flatfoots",
-    "tenderfoot": "tenderfoots",
-    "romany": "romanies",
-    "jerry": "jerries",
-    "mary": "maries",
-    "talouse": "talouses",
-    "rom": "roma",
-    "carmen": "carmina",
-}
-
-pl_sb_irregular.update(pl_sb_irregular_s)
-# pl_sb_irregular_keys = enclose('|'.join(pl_sb_irregular.keys()))
-
-pl_sb_irregular_caps = {
-    "Romany": "Romanies",
-    "Jerry": "Jerrys",
-    "Mary": "Marys",
-    "Rom": "Roma",
-}
-
-pl_sb_irregular_compound = {"prima donna": "prima donnas|prime donne"}
-
-si_sb_irregular = {v: k for (k, v) in pl_sb_irregular.items()}
-for k in list(si_sb_irregular):
-    if "|" in k:
-        k1, k2 = k.split("|")
-        si_sb_irregular[k1] = si_sb_irregular[k2] = si_sb_irregular[k]
-        del si_sb_irregular[k]
-si_sb_irregular_caps = {v: k for (k, v) in pl_sb_irregular_caps.items()}
-si_sb_irregular_compound = {v: k for (k, v) in pl_sb_irregular_compound.items()}
-for k in list(si_sb_irregular_compound):
-    if "|" in k:
-        k1, k2 = k.split("|")
-        si_sb_irregular_compound[k1] = si_sb_irregular_compound[k2] = (
-            si_sb_irregular_compound[k]
-        )
-        del si_sb_irregular_compound[k]
-
-# si_sb_irregular_keys = enclose('|'.join(si_sb_irregular.keys()))
-
-# Z's that don't double
-
-pl_sb_z_zes_list = ("quartz", "topaz")
-pl_sb_z_zes_bysize = bysize(pl_sb_z_zes_list)
-
-pl_sb_ze_zes_list = ("snooze",)
-pl_sb_ze_zes_bysize = bysize(pl_sb_ze_zes_list)
-
-
-# CLASSICAL "..is" -> "..ides"
-
-pl_sb_C_is_ides_complete = [
-    # GENERAL WORDS...
-    "ephemeris",
-    "iris",
-    "clitoris",
-    "chrysalis",
-    "epididymis",
-]
-
-pl_sb_C_is_ides_endings = [
-    # INFLAMATIONS...
-    "itis"
-]
-
-pl_sb_C_is_ides = joinstem(
-    -2, pl_sb_C_is_ides_complete + [f".*{w}" for w in pl_sb_C_is_ides_endings]
-)
-
-pl_sb_C_is_ides_list = pl_sb_C_is_ides_complete + pl_sb_C_is_ides_endings
-
-(
-    si_sb_C_is_ides_list,
-    si_sb_C_is_ides_bysize,
-    pl_sb_C_is_ides_bysize,
-) = make_pl_si_lists(pl_sb_C_is_ides_list, "ides", 2, dojoinstem=False)
-
-
-# CLASSICAL "..a" -> "..ata"
-
-pl_sb_C_a_ata_list = (
-    "anathema",
-    "bema",
-    "carcinoma",
-    "charisma",
-    "diploma",
-    "dogma",
-    "drama",
-    "edema",
-    "enema",
-    "enigma",
-    "lemma",
-    "lymphoma",
-    "magma",
-    "melisma",
-    "miasma",
-    "oedema",
-    "sarcoma",
-    "schema",
-    "soma",
-    "stigma",
-    "stoma",
-    "trauma",
-    "gumma",
-    "pragma",
-)
-
-(
-    si_sb_C_a_ata_list,
-    si_sb_C_a_ata_bysize,
-    pl_sb_C_a_ata_bysize,
-    pl_sb_C_a_ata,
-) = make_pl_si_lists(pl_sb_C_a_ata_list, "ata", 1)
-
-# UNCONDITIONAL "..a" -> "..ae"
-
-pl_sb_U_a_ae_list = (
-    "alumna",
-    "alga",
-    "vertebra",
-    "persona",
-    "vita",
-)
-(
-    si_sb_U_a_ae_list,
-    si_sb_U_a_ae_bysize,
-    pl_sb_U_a_ae_bysize,
-    pl_sb_U_a_ae,
-) = make_pl_si_lists(pl_sb_U_a_ae_list, "e", None)
-
-# CLASSICAL "..a" -> "..ae"
-
-pl_sb_C_a_ae_list = (
-    "amoeba",
-    "antenna",
-    "formula",
-    "hyperbola",
-    "medusa",
-    "nebula",
-    "parabola",
-    "abscissa",
-    "hydra",
-    "nova",
-    "lacuna",
-    "aurora",
-    "umbra",
-    "flora",
-    "fauna",
-)
-(
-    si_sb_C_a_ae_list,
-    si_sb_C_a_ae_bysize,
-    pl_sb_C_a_ae_bysize,
-    pl_sb_C_a_ae,
-) = make_pl_si_lists(pl_sb_C_a_ae_list, "e", None)
-
-
-# CLASSICAL "..en" -> "..ina"
-
-pl_sb_C_en_ina_list = ("stamen", "foramen", "lumen")
-
-(
-    si_sb_C_en_ina_list,
-    si_sb_C_en_ina_bysize,
-    pl_sb_C_en_ina_bysize,
-    pl_sb_C_en_ina,
-) = make_pl_si_lists(pl_sb_C_en_ina_list, "ina", 2)
-
-
-# UNCONDITIONAL "..um" -> "..a"
-
-pl_sb_U_um_a_list = (
-    "bacterium",
-    "agendum",
-    "desideratum",
-    "erratum",
-    "stratum",
-    "datum",
-    "ovum",
-    "extremum",
-    "candelabrum",
-)
-(
-    si_sb_U_um_a_list,
-    si_sb_U_um_a_bysize,
-    pl_sb_U_um_a_bysize,
-    pl_sb_U_um_a,
-) = make_pl_si_lists(pl_sb_U_um_a_list, "a", 2)
-
-# CLASSICAL "..um" -> "..a"
-
-pl_sb_C_um_a_list = (
-    "maximum",
-    "minimum",
-    "momentum",
-    "optimum",
-    "quantum",
-    "cranium",
-    "curriculum",
-    "dictum",
-    "phylum",
-    "aquarium",
-    "compendium",
-    "emporium",
-    "encomium",
-    "gymnasium",
-    "honorarium",
-    "interregnum",
-    "lustrum",
-    "memorandum",
-    "millennium",
-    "rostrum",
-    "spectrum",
-    "speculum",
-    "stadium",
-    "trapezium",
-    "ultimatum",
-    "medium",
-    "vacuum",
-    "velum",
-    "consortium",
-    "arboretum",
-)
-
-(
-    si_sb_C_um_a_list,
-    si_sb_C_um_a_bysize,
-    pl_sb_C_um_a_bysize,
-    pl_sb_C_um_a,
-) = make_pl_si_lists(pl_sb_C_um_a_list, "a", 2)
-
-
-# UNCONDITIONAL "..us" -> "i"
-
-pl_sb_U_us_i_list = (
-    "alumnus",
-    "alveolus",
-    "bacillus",
-    "bronchus",
-    "locus",
-    "nucleus",
-    "stimulus",
-    "meniscus",
-    "sarcophagus",
-)
-(
-    si_sb_U_us_i_list,
-    si_sb_U_us_i_bysize,
-    pl_sb_U_us_i_bysize,
-    pl_sb_U_us_i,
-) = make_pl_si_lists(pl_sb_U_us_i_list, "i", 2)
-
-# CLASSICAL "..us" -> "..i"
-
-pl_sb_C_us_i_list = (
-    "focus",
-    "radius",
-    "genius",
-    "incubus",
-    "succubus",
-    "nimbus",
-    "fungus",
-    "nucleolus",
-    "stylus",
-    "torus",
-    "umbilicus",
-    "uterus",
-    "hippopotamus",
-    "cactus",
-)
-
-(
-    si_sb_C_us_i_list,
-    si_sb_C_us_i_bysize,
-    pl_sb_C_us_i_bysize,
-    pl_sb_C_us_i,
-) = make_pl_si_lists(pl_sb_C_us_i_list, "i", 2)
-
-
-# CLASSICAL "..us" -> "..us"  (ASSIMILATED 4TH DECLENSION LATIN NOUNS)
-
-pl_sb_C_us_us = (
-    "status",
-    "apparatus",
-    "prospectus",
-    "sinus",
-    "hiatus",
-    "impetus",
-    "plexus",
-)
-pl_sb_C_us_us_bysize = bysize(pl_sb_C_us_us)
-
-# UNCONDITIONAL "..on" -> "a"
-
-pl_sb_U_on_a_list = (
-    "criterion",
-    "perihelion",
-    "aphelion",
-    "phenomenon",
-    "prolegomenon",
-    "noumenon",
-    "organon",
-    "asyndeton",
-    "hyperbaton",
-)
-(
-    si_sb_U_on_a_list,
-    si_sb_U_on_a_bysize,
-    pl_sb_U_on_a_bysize,
-    pl_sb_U_on_a,
-) = make_pl_si_lists(pl_sb_U_on_a_list, "a", 2)
-
-# CLASSICAL "..on" -> "..a"
-
-pl_sb_C_on_a_list = ("oxymoron",)
-
-(
-    si_sb_C_on_a_list,
-    si_sb_C_on_a_bysize,
-    pl_sb_C_on_a_bysize,
-    pl_sb_C_on_a,
-) = make_pl_si_lists(pl_sb_C_on_a_list, "a", 2)
-
-
-# CLASSICAL "..o" -> "..i"  (BUT NORMALLY -> "..os")
-
-pl_sb_C_o_i = [
-    "solo",
-    "soprano",
-    "basso",
-    "alto",
-    "contralto",
-    "tempo",
-    "piano",
-    "virtuoso",
-]  # list not tuple so can concat for pl_sb_U_o_os
-
-pl_sb_C_o_i_bysize = bysize(pl_sb_C_o_i)
-si_sb_C_o_i_bysize = bysize([f"{w[:-1]}i" for w in pl_sb_C_o_i])
-
-pl_sb_C_o_i_stems = joinstem(-1, pl_sb_C_o_i)
-
-# ALWAYS "..o" -> "..os"
-
-pl_sb_U_o_os_complete = {"ado", "ISO", "NATO", "NCO", "NGO", "oto"}
-si_sb_U_o_os_complete = {f"{w}s" for w in pl_sb_U_o_os_complete}
-
-
-pl_sb_U_o_os_endings = [
-    "aficionado",
-    "aggro",
-    "albino",
-    "allegro",
-    "ammo",
-    "Antananarivo",
-    "archipelago",
-    "armadillo",
-    "auto",
-    "avocado",
-    "Bamako",
-    "Barquisimeto",
-    "bimbo",
-    "bingo",
-    "Biro",
-    "bolero",
-    "Bolzano",
-    "bongo",
-    "Boto",
-    "burro",
-    "Cairo",
-    "canto",
-    "cappuccino",
-    "casino",
-    "cello",
-    "Chicago",
-    "Chimango",
-    "cilantro",
-    "cochito",
-    "coco",
-    "Colombo",
-    "Colorado",
-    "commando",
-    "concertino",
-    "contango",
-    "credo",
-    "crescendo",
-    "cyano",
-    "demo",
-    "ditto",
-    "Draco",
-    "dynamo",
-    "embryo",
-    "Esperanto",
-    "espresso",
-    "euro",
-    "falsetto",
-    "Faro",
-    "fiasco",
-    "Filipino",
-    "flamenco",
-    "furioso",
-    "generalissimo",
-    "Gestapo",
-    "ghetto",
-    "gigolo",
-    "gizmo",
-    "Greensboro",
-    "gringo",
-    "Guaiabero",
-    "guano",
-    "gumbo",
-    "gyro",
-    "hairdo",
-    "hippo",
-    "Idaho",
-    "impetigo",
-    "inferno",
-    "info",
-    "intermezzo",
-    "intertrigo",
-    "Iquico",
-    "jumbo",
-    "junto",
-    "Kakapo",
-    "kilo",
-    "Kinkimavo",
-    "Kokako",
-    "Kosovo",
-    "Lesotho",
-    "libero",
-    "libido",
-    "libretto",
-    "lido",
-    "Lilo",
-    "limbo",
-    "limo",
-    "lineno",
-    "lingo",
-    "lino",
-    "livedo",
-    "loco",
-    "logo",
-    "lumbago",
-    "macho",
-    "macro",
-    "mafioso",
-    "magneto",
-    "magnifico",
-    "Majuro",
-    "Malabo",
-    "manifesto",
-    "Maputo",
-    "Maracaibo",
-    "medico",
-    "memo",
-    "metro",
-    "Mexico",
-    "micro",
-    "Milano",
-    "Monaco",
-    "mono",
-    "Montenegro",
-    "Morocco",
-    "Muqdisho",
-    "myo",
-    "neutrino",
-    "Ningbo",
-    "octavo",
-    "oregano",
-    "Orinoco",
-    "Orlando",
-    "Oslo",
-    "panto",
-    "Paramaribo",
-    "Pardusco",
-    "pedalo",
-    "photo",
-    "pimento",
-    "pinto",
-    "pleco",
-    "Pluto",
-    "pogo",
-    "polo",
-    "poncho",
-    "Porto-Novo",
-    "Porto",
-    "pro",
-    "psycho",
-    "pueblo",
-    "quarto",
-    "Quito",
-    "repo",
-    "rhino",
-    "risotto",
-    "rococo",
-    "rondo",
-    "Sacramento",
-    "saddo",
-    "sago",
-    "salvo",
-    "Santiago",
-    "Sapporo",
-    "Sarajevo",
-    "scherzando",
-    "scherzo",
-    "silo",
-    "sirocco",
-    "sombrero",
-    "staccato",
-    "sterno",
-    "stucco",
-    "stylo",
-    "sumo",
-    "Taiko",
-    "techno",
-    "terrazzo",
-    "testudo",
-    "timpano",
-    "tiro",
-    "tobacco",
-    "Togo",
-    "Tokyo",
-    "torero",
-    "Torino",
-    "Toronto",
-    "torso",
-    "tremolo",
-    "typo",
-    "tyro",
-    "ufo",
-    "UNESCO",
-    "vaquero",
-    "vermicello",
-    "verso",
-    "vibrato",
-    "violoncello",
-    "Virgo",
-    "weirdo",
-    "WHO",
-    "WTO",
-    "Yamoussoukro",
-    "yo-yo",
-    "zero",
-    "Zibo",
-] + pl_sb_C_o_i
-
-pl_sb_U_o_os_bysize = bysize(pl_sb_U_o_os_endings)
-si_sb_U_o_os_bysize = bysize([f"{w}s" for w in pl_sb_U_o_os_endings])
-
-
-# UNCONDITIONAL "..ch" -> "..chs"
-
-pl_sb_U_ch_chs_list = ("czech", "eunuch", "stomach")
-
-(
-    si_sb_U_ch_chs_list,
-    si_sb_U_ch_chs_bysize,
-    pl_sb_U_ch_chs_bysize,
-    pl_sb_U_ch_chs,
-) = make_pl_si_lists(pl_sb_U_ch_chs_list, "s", None)
-
-
-# UNCONDITIONAL "..[ei]x" -> "..ices"
-
-pl_sb_U_ex_ices_list = ("codex", "murex", "silex")
-(
-    si_sb_U_ex_ices_list,
-    si_sb_U_ex_ices_bysize,
-    pl_sb_U_ex_ices_bysize,
-    pl_sb_U_ex_ices,
-) = make_pl_si_lists(pl_sb_U_ex_ices_list, "ices", 2)
-
-pl_sb_U_ix_ices_list = ("radix", "helix")
-(
-    si_sb_U_ix_ices_list,
-    si_sb_U_ix_ices_bysize,
-    pl_sb_U_ix_ices_bysize,
-    pl_sb_U_ix_ices,
-) = make_pl_si_lists(pl_sb_U_ix_ices_list, "ices", 2)
-
-# CLASSICAL "..[ei]x" -> "..ices"
-
-pl_sb_C_ex_ices_list = (
-    "vortex",
-    "vertex",
-    "cortex",
-    "latex",
-    "pontifex",
-    "apex",
-    "index",
-    "simplex",
-)
-
-(
-    si_sb_C_ex_ices_list,
-    si_sb_C_ex_ices_bysize,
-    pl_sb_C_ex_ices_bysize,
-    pl_sb_C_ex_ices,
-) = make_pl_si_lists(pl_sb_C_ex_ices_list, "ices", 2)
-
-
-pl_sb_C_ix_ices_list = ("appendix",)
-
-(
-    si_sb_C_ix_ices_list,
-    si_sb_C_ix_ices_bysize,
-    pl_sb_C_ix_ices_bysize,
-    pl_sb_C_ix_ices,
-) = make_pl_si_lists(pl_sb_C_ix_ices_list, "ices", 2)
-
-
-# ARABIC: ".." -> "..i"
-
-pl_sb_C_i_list = ("afrit", "afreet", "efreet")
-
-(si_sb_C_i_list, si_sb_C_i_bysize, pl_sb_C_i_bysize, pl_sb_C_i) = make_pl_si_lists(
-    pl_sb_C_i_list, "i", None
-)
-
-
-# HEBREW: ".." -> "..im"
-
-pl_sb_C_im_list = ("goy", "seraph", "cherub")
-
-(si_sb_C_im_list, si_sb_C_im_bysize, pl_sb_C_im_bysize, pl_sb_C_im) = make_pl_si_lists(
-    pl_sb_C_im_list, "im", None
-)
-
-
-# UNCONDITIONAL "..man" -> "..mans"
-
-pl_sb_U_man_mans_list = """
-    ataman caiman cayman ceriman
-    desman dolman farman harman hetman
-    human leman ottoman shaman talisman
-""".split()
-pl_sb_U_man_mans_caps_list = """
-    Alabaman Bahaman Burman German
-    Hiroshiman Liman Nakayaman Norman Oklahoman
-    Panaman Roman Selman Sonaman Tacoman Yakiman
-    Yokohaman Yuman
-""".split()
-
-(
-    si_sb_U_man_mans_list,
-    si_sb_U_man_mans_bysize,
-    pl_sb_U_man_mans_bysize,
-) = make_pl_si_lists(pl_sb_U_man_mans_list, "s", None, dojoinstem=False)
-(
-    si_sb_U_man_mans_caps_list,
-    si_sb_U_man_mans_caps_bysize,
-    pl_sb_U_man_mans_caps_bysize,
-) = make_pl_si_lists(pl_sb_U_man_mans_caps_list, "s", None, dojoinstem=False)
-
-# UNCONDITIONAL "..louse" -> "..lice"
-pl_sb_U_louse_lice_list = ("booklouse", "grapelouse", "louse", "woodlouse")
-
-(
-    si_sb_U_louse_lice_list,
-    si_sb_U_louse_lice_bysize,
-    pl_sb_U_louse_lice_bysize,
-) = make_pl_si_lists(pl_sb_U_louse_lice_list, "lice", 5, dojoinstem=False)
-
-pl_sb_uninflected_s_complete = [
-    # PAIRS OR GROUPS SUBSUMED TO A SINGULAR...
-    "breeches",
-    "britches",
-    "pajamas",
-    "pyjamas",
-    "clippers",
-    "gallows",
-    "hijinks",
-    "headquarters",
-    "pliers",
-    "scissors",
-    "testes",
-    "herpes",
-    "pincers",
-    "shears",
-    "proceedings",
-    "trousers",
-    # UNASSIMILATED LATIN 4th DECLENSION
-    "cantus",
-    "coitus",
-    "nexus",
-    # RECENT IMPORTS...
-    "contretemps",
-    "corps",
-    "debris",
-    "siemens",
-    # DISEASES
-    "mumps",
-    # MISCELLANEOUS OTHERS...
-    "diabetes",
-    "jackanapes",
-    "series",
-    "species",
-    "subspecies",
-    "rabies",
-    "chassis",
-    "innings",
-    "news",
-    "mews",
-    "haggis",
-]
-
-pl_sb_uninflected_s_endings = [
-    # RECENT IMPORTS...
-    "ois",
-    # DISEASES
-    "measles",
-]
-
-pl_sb_uninflected_s = pl_sb_uninflected_s_complete + [
-    f".*{w}" for w in pl_sb_uninflected_s_endings
-]
-
-pl_sb_uninflected_herd = (
-    # DON'T INFLECT IN CLASSICAL MODE, OTHERWISE NORMAL INFLECTION
-    "wildebeest",
-    "swine",
-    "eland",
-    "bison",
-    "buffalo",
-    "cattle",
-    "elk",
-    "rhinoceros",
-    "zucchini",
-    "caribou",
-    "dace",
-    "grouse",
-    "guinea fowl",
-    "guinea-fowl",
-    "haddock",
-    "hake",
-    "halibut",
-    "herring",
-    "mackerel",
-    "pickerel",
-    "pike",
-    "roe",
-    "seed",
-    "shad",
-    "snipe",
-    "teal",
-    "turbot",
-    "water fowl",
-    "water-fowl",
-)
-
-pl_sb_uninflected_complete = [
-    # SOME FISH AND HERD ANIMALS
-    "tuna",
-    "salmon",
-    "mackerel",
-    "trout",
-    "bream",
-    "sea-bass",
-    "sea bass",
-    "carp",
-    "cod",
-    "flounder",
-    "whiting",
-    "moose",
-    # OTHER ODDITIES
-    "graffiti",
-    "djinn",
-    "samuri",
-    "offspring",
-    "pence",
-    "quid",
-    "hertz",
-] + pl_sb_uninflected_s_complete
-# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
-
-pl_sb_uninflected_caps = [
-    # ALL NATIONALS ENDING IN -ese
-    "Portuguese",
-    "Amoyese",
-    "Borghese",
-    "Congoese",
-    "Faroese",
-    "Foochowese",
-    "Genevese",
-    "Genoese",
-    "Gilbertese",
-    "Hottentotese",
-    "Kiplingese",
-    "Kongoese",
-    "Lucchese",
-    "Maltese",
-    "Nankingese",
-    "Niasese",
-    "Pekingese",
-    "Piedmontese",
-    "Pistoiese",
-    "Sarawakese",
-    "Shavese",
-    "Vermontese",
-    "Wenchowese",
-    "Yengeese",
-]
-
-
-pl_sb_uninflected_endings = [
-    # UNCOUNTABLE NOUNS
-    "butter",
-    "cash",
-    "furniture",
-    "information",
-    # SOME FISH AND HERD ANIMALS
-    "fish",
-    "deer",
-    "sheep",
-    # ALL NATIONALS ENDING IN -ese
-    "nese",
-    "rese",
-    "lese",
-    "mese",
-    # DISEASES
-    "pox",
-    # OTHER ODDITIES
-    "craft",
-] + pl_sb_uninflected_s_endings
-# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
-
-
-pl_sb_uninflected_bysize = bysize(pl_sb_uninflected_endings)
-
-
-# SINGULAR WORDS ENDING IN ...s (ALL INFLECT WITH ...es)
-
-pl_sb_singular_s_complete = [
-    "acropolis",
-    "aegis",
-    "alias",
-    "asbestos",
-    "bathos",
-    "bias",
-    "bronchitis",
-    "bursitis",
-    "caddis",
-    "cannabis",
-    "canvas",
-    "chaos",
-    "cosmos",
-    "dais",
-    "digitalis",
-    "epidermis",
-    "ethos",
-    "eyas",
-    "gas",
-    "glottis",
-    "hubris",
-    "ibis",
-    "lens",
-    "mantis",
-    "marquis",
-    "metropolis",
-    "pathos",
-    "pelvis",
-    "polis",
-    "rhinoceros",
-    "sassafras",
-    "trellis",
-] + pl_sb_C_is_ides_complete
-
-
-pl_sb_singular_s_endings = ["ss", "us"] + pl_sb_C_is_ides_endings
-
-pl_sb_singular_s_bysize = bysize(pl_sb_singular_s_endings)
-
-si_sb_singular_s_complete = [f"{w}es" for w in pl_sb_singular_s_complete]
-si_sb_singular_s_endings = [f"{w}es" for w in pl_sb_singular_s_endings]
-si_sb_singular_s_bysize = bysize(si_sb_singular_s_endings)
-
-pl_sb_singular_s_es = ["[A-Z].*es"]
-
-pl_sb_singular_s = enclose(
-    "|".join(
-        pl_sb_singular_s_complete
-        + [f".*{w}" for w in pl_sb_singular_s_endings]
-        + pl_sb_singular_s_es
-    )
-)
-
-
-# PLURALS ENDING IN uses -> use
-
-
-si_sb_ois_oi_case = ("Bolshois", "Hanois")
-
-si_sb_uses_use_case = ("Betelgeuses", "Duses", "Meuses", "Syracuses", "Toulouses")
-
-si_sb_uses_use = (
-    "abuses",
-    "applauses",
-    "blouses",
-    "carouses",
-    "causes",
-    "chartreuses",
-    "clauses",
-    "contuses",
-    "douses",
-    "excuses",
-    "fuses",
-    "grouses",
-    "hypotenuses",
-    "masseuses",
-    "menopauses",
-    "misuses",
-    "muses",
-    "overuses",
-    "pauses",
-    "peruses",
-    "profuses",
-    "recluses",
-    "reuses",
-    "ruses",
-    "souses",
-    "spouses",
-    "suffuses",
-    "transfuses",
-    "uses",
-)
-
-si_sb_ies_ie_case = (
-    "Addies",
-    "Aggies",
-    "Allies",
-    "Amies",
-    "Angies",
-    "Annies",
-    "Annmaries",
-    "Archies",
-    "Arties",
-    "Aussies",
-    "Barbies",
-    "Barries",
-    "Basies",
-    "Bennies",
-    "Bernies",
-    "Berties",
-    "Bessies",
-    "Betties",
-    "Billies",
-    "Blondies",
-    "Bobbies",
-    "Bonnies",
-    "Bowies",
-    "Brandies",
-    "Bries",
-    "Brownies",
-    "Callies",
-    "Carnegies",
-    "Carries",
-    "Cassies",
-    "Charlies",
-    "Cheries",
-    "Christies",
-    "Connies",
-    "Curies",
-    "Dannies",
-    "Debbies",
-    "Dixies",
-    "Dollies",
-    "Donnies",
-    "Drambuies",
-    "Eddies",
-    "Effies",
-    "Ellies",
-    "Elsies",
-    "Eries",
-    "Ernies",
-    "Essies",
-    "Eugenies",
-    "Fannies",
-    "Flossies",
-    "Frankies",
-    "Freddies",
-    "Gillespies",
-    "Goldies",
-    "Gracies",
-    "Guthries",
-    "Hallies",
-    "Hatties",
-    "Hetties",
-    "Hollies",
-    "Jackies",
-    "Jamies",
-    "Janies",
-    "Jannies",
-    "Jeanies",
-    "Jeannies",
-    "Jennies",
-    "Jessies",
-    "Jimmies",
-    "Jodies",
-    "Johnies",
-    "Johnnies",
-    "Josies",
-    "Julies",
-    "Kalgoorlies",
-    "Kathies",
-    "Katies",
-    "Kellies",
-    "Kewpies",
-    "Kristies",
-    "Laramies",
-    "Lassies",
-    "Lauries",
-    "Leslies",
-    "Lessies",
-    "Lillies",
-    "Lizzies",
-    "Lonnies",
-    "Lories",
-    "Lorries",
-    "Lotties",
-    "Louies",
-    "Mackenzies",
-    "Maggies",
-    "Maisies",
-    "Mamies",
-    "Marcies",
-    "Margies",
-    "Maries",
-    "Marjories",
-    "Matties",
-    "McKenzies",
-    "Melanies",
-    "Mickies",
-    "Millies",
-    "Minnies",
-    "Mollies",
-    "Mounties",
-    "Nannies",
-    "Natalies",
-    "Nellies",
-    "Netties",
-    "Ollies",
-    "Ozzies",
-    "Pearlies",
-    "Pottawatomies",
-    "Reggies",
-    "Richies",
-    "Rickies",
-    "Robbies",
-    "Ronnies",
-    "Rosalies",
-    "Rosemaries",
-    "Rosies",
-    "Roxies",
-    "Rushdies",
-    "Ruthies",
-    "Sadies",
-    "Sallies",
-    "Sammies",
-    "Scotties",
-    "Selassies",
-    "Sherries",
-    "Sophies",
-    "Stacies",
-    "Stefanies",
-    "Stephanies",
-    "Stevies",
-    "Susies",
-    "Sylvies",
-    "Tammies",
-    "Terries",
-    "Tessies",
-    "Tommies",
-    "Tracies",
-    "Trekkies",
-    "Valaries",
-    "Valeries",
-    "Valkyries",
-    "Vickies",
-    "Virgies",
-    "Willies",
-    "Winnies",
-    "Wylies",
-    "Yorkies",
-)
-
-si_sb_ies_ie = (
-    "aeries",
-    "baggies",
-    "belies",
-    "biggies",
-    "birdies",
-    "bogies",
-    "bonnies",
-    "boogies",
-    "bookies",
-    "bourgeoisies",
-    "brownies",
-    "budgies",
-    "caddies",
-    "calories",
-    "camaraderies",
-    "cockamamies",
-    "collies",
-    "cookies",
-    "coolies",
-    "cooties",
-    "coteries",
-    "crappies",
-    "curies",
-    "cutesies",
-    "dogies",
-    "eyries",
-    "floozies",
-    "footsies",
-    "freebies",
-    "genies",
-    "goalies",
-    "groupies",
-    "hies",
-    "jalousies",
-    "junkies",
-    "kiddies",
-    "laddies",
-    "lassies",
-    "lies",
-    "lingeries",
-    "magpies",
-    "menageries",
-    "mommies",
-    "movies",
-    "neckties",
-    "newbies",
-    "nighties",
-    "oldies",
-    "organdies",
-    "overlies",
-    "pies",
-    "pinkies",
-    "pixies",
-    "potpies",
-    "prairies",
-    "quickies",
-    "reveries",
-    "rookies",
-    "rotisseries",
-    "softies",
-    "sorties",
-    "species",
-    "stymies",
-    "sweeties",
-    "ties",
-    "underlies",
-    "unties",
-    "veggies",
-    "vies",
-    "yuppies",
-    "zombies",
-)
-
-
-si_sb_oes_oe_case = (
-    "Chloes",
-    "Crusoes",
-    "Defoes",
-    "Faeroes",
-    "Ivanhoes",
-    "Joes",
-    "McEnroes",
-    "Moes",
-    "Monroes",
-    "Noes",
-    "Poes",
-    "Roscoes",
-    "Tahoes",
-    "Tippecanoes",
-    "Zoes",
-)
-
-si_sb_oes_oe = (
-    "aloes",
-    "backhoes",
-    "canoes",
-    "does",
-    "floes",
-    "foes",
-    "hoes",
-    "mistletoes",
-    "oboes",
-    "pekoes",
-    "roes",
-    "sloes",
-    "throes",
-    "tiptoes",
-    "toes",
-    "woes",
-)
-
-si_sb_z_zes = ("quartzes", "topazes")
-
-si_sb_zzes_zz = ("buzzes", "fizzes", "frizzes", "razzes")
-
-si_sb_ches_che_case = (
-    "Andromaches",
-    "Apaches",
-    "Blanches",
-    "Comanches",
-    "Nietzsches",
-    "Porsches",
-    "Roches",
-)
-
-si_sb_ches_che = (
-    "aches",
-    "avalanches",
-    "backaches",
-    "bellyaches",
-    "caches",
-    "cloches",
-    "creches",
-    "douches",
-    "earaches",
-    "fiches",
-    "headaches",
-    "heartaches",
-    "microfiches",
-    "niches",
-    "pastiches",
-    "psyches",
-    "quiches",
-    "stomachaches",
-    "toothaches",
-    "tranches",
-)
-
-si_sb_xes_xe = ("annexes", "axes", "deluxes", "pickaxes")
-
-si_sb_sses_sse_case = ("Hesses", "Jesses", "Larousses", "Matisses")
-si_sb_sses_sse = (
-    "bouillabaisses",
-    "crevasses",
-    "demitasses",
-    "impasses",
-    "mousses",
-    "posses",
-)
-
-si_sb_ves_ve_case = (
-    # *[nwl]ives -> [nwl]live
-    "Clives",
-    "Palmolives",
-)
-si_sb_ves_ve = (
-    # *[^d]eaves -> eave
-    "interweaves",
-    "weaves",
-    # *[nwl]ives -> [nwl]live
-    "olives",
-    # *[eoa]lves -> [eoa]lve
-    "bivalves",
-    "dissolves",
-    "resolves",
-    "salves",
-    "twelves",
-    "valves",
-)
-
-
-plverb_special_s = enclose(
-    "|".join(
-        [pl_sb_singular_s]
-        + pl_sb_uninflected_s
-        + list(pl_sb_irregular_s)
-        + ["(.*[csx])is", "(.*)ceps", "[A-Z].*s"]
-    )
-)
-
-_pl_sb_postfix_adj_defn = (
-    ("general", enclose(r"(?!major|lieutenant|brigadier|adjutant|.*star)\S+")),
-    ("martial", enclose("court")),
-    ("force", enclose("pound")),
-)
-
-pl_sb_postfix_adj: Iterable[str] = (
-    enclose(val + f"(?=(?:-|\\s+){key})") for key, val in _pl_sb_postfix_adj_defn
-)
-
-pl_sb_postfix_adj_stems = f"({'|'.join(pl_sb_postfix_adj)})(.*)"
-
-
-# PLURAL WORDS ENDING IS es GO TO SINGULAR is
-
-si_sb_es_is = (
-    "amanuenses",
-    "amniocenteses",
-    "analyses",
-    "antitheses",
-    "apotheoses",
-    "arterioscleroses",
-    "atheroscleroses",
-    "axes",
-    # 'bases', # bases -> basis
-    "catalyses",
-    "catharses",
-    "chasses",
-    "cirrhoses",
-    "cocces",
-    "crises",
-    "diagnoses",
-    "dialyses",
-    "diereses",
-    "electrolyses",
-    "emphases",
-    "exegeses",
-    "geneses",
-    "halitoses",
-    "hydrolyses",
-    "hypnoses",
-    "hypotheses",
-    "hystereses",
-    "metamorphoses",
-    "metastases",
-    "misdiagnoses",
-    "mitoses",
-    "mononucleoses",
-    "narcoses",
-    "necroses",
-    "nemeses",
-    "neuroses",
-    "oases",
-    "osmoses",
-    "osteoporoses",
-    "paralyses",
-    "parentheses",
-    "parthenogeneses",
-    "periphrases",
-    "photosyntheses",
-    "probosces",
-    "prognoses",
-    "prophylaxes",
-    "prostheses",
-    "preces",
-    "psoriases",
-    "psychoanalyses",
-    "psychokineses",
-    "psychoses",
-    "scleroses",
-    "scolioses",
-    "sepses",
-    "silicoses",
-    "symbioses",
-    "synopses",
-    "syntheses",
-    "taxes",
-    "telekineses",
-    "theses",
-    "thromboses",
-    "tuberculoses",
-    "urinalyses",
-)
-
-pl_prep_list = """
-    about above across after among around at athwart before behind
-    below beneath beside besides between betwixt beyond but by
-    during except for from in into near of off on onto out over
-    since till to under until unto upon with""".split()
-
-pl_prep_list_da = pl_prep_list + ["de", "du", "da"]
-
-pl_prep_bysize = bysize(pl_prep_list_da)
-
-pl_prep = enclose("|".join(pl_prep_list_da))
-
-pl_sb_prep_dual_compound = rf"(.*?)((?:-|\s+)(?:{pl_prep})(?:-|\s+))a(?:-|\s+)(.*)"
-
-
-singular_pronoun_genders = {
-    "neuter",
-    "feminine",
-    "masculine",
-    "gender-neutral",
-    "feminine or masculine",
-    "masculine or feminine",
-}
-
-pl_pron_nom = {
-    # NOMINATIVE    REFLEXIVE
-    "i": "we",
-    "myself": "ourselves",
-    "you": "you",
-    "yourself": "yourselves",
-    "she": "they",
-    "herself": "themselves",
-    "he": "they",
-    "himself": "themselves",
-    "it": "they",
-    "itself": "themselves",
-    "they": "they",
-    "themself": "themselves",
-    #   POSSESSIVE
-    "mine": "ours",
-    "yours": "yours",
-    "hers": "theirs",
-    "his": "theirs",
-    "its": "theirs",
-    "theirs": "theirs",
-}
-
-si_pron: Dict[str, Dict[str, Union[str, Dict[str, str]]]] = {
-    "nom": {v: k for (k, v) in pl_pron_nom.items()}
-}
-si_pron["nom"]["we"] = "I"
-
-
-pl_pron_acc = {
-    # ACCUSATIVE    REFLEXIVE
-    "me": "us",
-    "myself": "ourselves",
-    "you": "you",
-    "yourself": "yourselves",
-    "her": "them",
-    "herself": "themselves",
-    "him": "them",
-    "himself": "themselves",
-    "it": "them",
-    "itself": "themselves",
-    "them": "them",
-    "themself": "themselves",
-}
-
-pl_pron_acc_keys = enclose("|".join(pl_pron_acc))
-pl_pron_acc_keys_bysize = bysize(pl_pron_acc)
-
-si_pron["acc"] = {v: k for (k, v) in pl_pron_acc.items()}
-
-for _thecase, _plur, _gend, _sing in (
-    ("nom", "they", "neuter", "it"),
-    ("nom", "they", "feminine", "she"),
-    ("nom", "they", "masculine", "he"),
-    ("nom", "they", "gender-neutral", "they"),
-    ("nom", "they", "feminine or masculine", "she or he"),
-    ("nom", "they", "masculine or feminine", "he or she"),
-    ("nom", "themselves", "neuter", "itself"),
-    ("nom", "themselves", "feminine", "herself"),
-    ("nom", "themselves", "masculine", "himself"),
-    ("nom", "themselves", "gender-neutral", "themself"),
-    ("nom", "themselves", "feminine or masculine", "herself or himself"),
-    ("nom", "themselves", "masculine or feminine", "himself or herself"),
-    ("nom", "theirs", "neuter", "its"),
-    ("nom", "theirs", "feminine", "hers"),
-    ("nom", "theirs", "masculine", "his"),
-    ("nom", "theirs", "gender-neutral", "theirs"),
-    ("nom", "theirs", "feminine or masculine", "hers or his"),
-    ("nom", "theirs", "masculine or feminine", "his or hers"),
-    ("acc", "them", "neuter", "it"),
-    ("acc", "them", "feminine", "her"),
-    ("acc", "them", "masculine", "him"),
-    ("acc", "them", "gender-neutral", "them"),
-    ("acc", "them", "feminine or masculine", "her or him"),
-    ("acc", "them", "masculine or feminine", "him or her"),
-    ("acc", "themselves", "neuter", "itself"),
-    ("acc", "themselves", "feminine", "herself"),
-    ("acc", "themselves", "masculine", "himself"),
-    ("acc", "themselves", "gender-neutral", "themself"),
-    ("acc", "themselves", "feminine or masculine", "herself or himself"),
-    ("acc", "themselves", "masculine or feminine", "himself or herself"),
-):
-    try:
-        si_pron[_thecase][_plur][_gend] = _sing  # type: ignore
-    except TypeError:
-        si_pron[_thecase][_plur] = {}
-        si_pron[_thecase][_plur][_gend] = _sing  # type: ignore
-
-
-si_pron_acc_keys = enclose("|".join(si_pron["acc"]))
-si_pron_acc_keys_bysize = bysize(si_pron["acc"])
-
-
-def get_si_pron(thecase, word, gender) -> str:
-    try:
-        sing = si_pron[thecase][word]
-    except KeyError:
-        raise  # not a pronoun
-    try:
-        return sing[gender]  # has several types due to gender
-    except TypeError:
-        return cast(str, sing)  # answer independent of gender
-
-
-# These dictionaries group verbs by first, second and third person
-# conjugations.
-
-plverb_irregular_pres = {
-    "am": "are",
-    "are": "are",
-    "is": "are",
-    "was": "were",
-    "were": "were",
-    "have": "have",
-    "has": "have",
-    "do": "do",
-    "does": "do",
-}
-
-plverb_ambiguous_pres = {
-    "act": "act",
-    "acts": "act",
-    "blame": "blame",
-    "blames": "blame",
-    "can": "can",
-    "must": "must",
-    "fly": "fly",
-    "flies": "fly",
-    "copy": "copy",
-    "copies": "copy",
-    "drink": "drink",
-    "drinks": "drink",
-    "fight": "fight",
-    "fights": "fight",
-    "fire": "fire",
-    "fires": "fire",
-    "like": "like",
-    "likes": "like",
-    "look": "look",
-    "looks": "look",
-    "make": "make",
-    "makes": "make",
-    "reach": "reach",
-    "reaches": "reach",
-    "run": "run",
-    "runs": "run",
-    "sink": "sink",
-    "sinks": "sink",
-    "sleep": "sleep",
-    "sleeps": "sleep",
-    "view": "view",
-    "views": "view",
-}
-
-plverb_ambiguous_pres_keys = re.compile(
-    rf"^({enclose('|'.join(plverb_ambiguous_pres))})((\s.*)?)$", re.IGNORECASE
-)
-
-
-plverb_irregular_non_pres = (
-    "did",
-    "had",
-    "ate",
-    "made",
-    "put",
-    "spent",
-    "fought",
-    "sank",
-    "gave",
-    "sought",
-    "shall",
-    "could",
-    "ought",
-    "should",
-)
-
-plverb_ambiguous_non_pres = re.compile(
-    r"^((?:thought|saw|bent|will|might|cut))((\s.*)?)$", re.IGNORECASE
-)
-
-# "..oes" -> "..oe" (the rest are "..oes" -> "o")
-
-pl_v_oes_oe = ("canoes", "floes", "oboes", "roes", "throes", "woes")
-pl_v_oes_oe_endings_size4 = ("hoes", "toes")
-pl_v_oes_oe_endings_size5 = ("shoes",)
-
-
-pl_count_zero = ("0", "no", "zero", "nil")
-
-
-pl_count_one = ("1", "a", "an", "one", "each", "every", "this", "that")
-
-pl_adj_special = {"a": "some", "an": "some", "this": "these", "that": "those"}
-
-pl_adj_special_keys = re.compile(
-    rf"^({enclose('|'.join(pl_adj_special))})$", re.IGNORECASE
-)
-
-pl_adj_poss = {
-    "my": "our",
-    "your": "your",
-    "its": "their",
-    "her": "their",
-    "his": "their",
-    "their": "their",
-}
-
-pl_adj_poss_keys = re.compile(rf"^({enclose('|'.join(pl_adj_poss))})$", re.IGNORECASE)
-
-
-# 2. INDEFINITE ARTICLES
-
-# THIS PATTERN MATCHES STRINGS OF CAPITALS STARTING WITH A "VOWEL-SOUND"
-# CONSONANT FOLLOWED BY ANOTHER CONSONANT, AND WHICH ARE NOT LIKELY
-# TO BE REAL WORDS (OH, ALL RIGHT THEN, IT'S JUST MAGIC!)
-
-A_abbrev = re.compile(
-    r"""
-^(?! FJO | [HLMNS]Y.  | RY[EO] | SQU
-  | ( F[LR]? | [HL] | MN? | N | RH? | S[CHKLMNPTVW]? | X(YL)?) [AEIOU])
-[FHLMNRSX][A-Z]
-""",
-    re.VERBOSE,
-)
-
-# THIS PATTERN CODES THE BEGINNINGS OF ALL ENGLISH WORDS BEGINING WITH A
-# 'y' FOLLOWED BY A CONSONANT. ANY OTHER Y-CONSONANT PREFIX THEREFORE
-# IMPLIES AN ABBREVIATION.
-
-A_y_cons = re.compile(r"^(y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt))", re.IGNORECASE)
-
-# EXCEPTIONS TO EXCEPTIONS
-
-A_explicit_a = re.compile(r"^((?:unabomber|unanimous|US))", re.IGNORECASE)
-
-A_explicit_an = re.compile(
-    r"^((?:euler|hour(?!i)|heir|honest|hono[ur]|mpeg))", re.IGNORECASE
-)
-
-A_ordinal_an = re.compile(r"^([aefhilmnorsx]-?th)", re.IGNORECASE)
-
-A_ordinal_a = re.compile(r"^([bcdgjkpqtuvwyz]-?th)", re.IGNORECASE)
-
-
-# NUMERICAL INFLECTIONS
-
-nth = {
-    0: "th",
-    1: "st",
-    2: "nd",
-    3: "rd",
-    4: "th",
-    5: "th",
-    6: "th",
-    7: "th",
-    8: "th",
-    9: "th",
-    11: "th",
-    12: "th",
-    13: "th",
-}
-nth_suff = set(nth.values())
-
-ordinal = dict(
-    ty="tieth",
-    one="first",
-    two="second",
-    three="third",
-    five="fifth",
-    eight="eighth",
-    nine="ninth",
-    twelve="twelfth",
-)
-
-ordinal_suff = re.compile(rf"({'|'.join(ordinal)})\Z")
-
-
-# NUMBERS
-
-unit = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
-teen = [
-    "ten",
-    "eleven",
-    "twelve",
-    "thirteen",
-    "fourteen",
-    "fifteen",
-    "sixteen",
-    "seventeen",
-    "eighteen",
-    "nineteen",
-]
-ten = [
-    "",
-    "",
-    "twenty",
-    "thirty",
-    "forty",
-    "fifty",
-    "sixty",
-    "seventy",
-    "eighty",
-    "ninety",
-]
-mill = [
-    " ",
-    " thousand",
-    " million",
-    " billion",
-    " trillion",
-    " quadrillion",
-    " quintillion",
-    " sextillion",
-    " septillion",
-    " octillion",
-    " nonillion",
-    " decillion",
-]
-
-
-# SUPPORT CLASSICAL PLURALIZATIONS
-
-def_classical = dict(
-    all=False, zero=False, herd=False, names=True, persons=False, ancient=False
-)
-
-all_classical = {k: True for k in def_classical}
-no_classical = {k: False for k in def_classical}
-
-
-# Maps strings to built-in constant types
-string_to_constant = {"True": True, "False": False, "None": None}
-
-
-# Pre-compiled regular expression objects
-DOLLAR_DIGITS = re.compile(r"\$(\d+)")
-FUNCTION_CALL = re.compile(r"((\w+)\([^)]*\)*)", re.IGNORECASE)
-PARTITION_WORD = re.compile(r"\A(\s*)(.+?)(\s*)\Z")
-PL_SB_POSTFIX_ADJ_STEMS_RE = re.compile(
-    rf"^(?:{pl_sb_postfix_adj_stems})$", re.IGNORECASE
-)
-PL_SB_PREP_DUAL_COMPOUND_RE = re.compile(
-    rf"^(?:{pl_sb_prep_dual_compound})$", re.IGNORECASE
-)
-DENOMINATOR = re.compile(r"(?P.+)( (per|a) .+)")
-PLVERB_SPECIAL_S_RE = re.compile(rf"^({plverb_special_s})$")
-WHITESPACE = re.compile(r"\s")
-ENDS_WITH_S = re.compile(r"^(.*[^s])s$", re.IGNORECASE)
-ENDS_WITH_APOSTROPHE_S = re.compile(r"^(.*)'s?$")
-INDEFINITE_ARTICLE_TEST = re.compile(r"\A(\s*)(?:an?\s+)?(.+?)(\s*)\Z", re.IGNORECASE)
-SPECIAL_AN = re.compile(r"^[aefhilmnorsx]$", re.IGNORECASE)
-SPECIAL_A = re.compile(r"^[bcdgjkpqtuvwyz]$", re.IGNORECASE)
-SPECIAL_ABBREV_AN = re.compile(r"^[aefhilmnorsx][.-]", re.IGNORECASE)
-SPECIAL_ABBREV_A = re.compile(r"^[a-z][.-]", re.IGNORECASE)
-CONSONANTS = re.compile(r"^[^aeiouy]", re.IGNORECASE)
-ARTICLE_SPECIAL_EU = re.compile(r"^e[uw]", re.IGNORECASE)
-ARTICLE_SPECIAL_ONCE = re.compile(r"^onc?e\b", re.IGNORECASE)
-ARTICLE_SPECIAL_ONETIME = re.compile(r"^onetime\b", re.IGNORECASE)
-ARTICLE_SPECIAL_UNIT = re.compile(r"^uni([^nmd]|mo)", re.IGNORECASE)
-ARTICLE_SPECIAL_UBA = re.compile(r"^u[bcfghjkqrst][aeiou]", re.IGNORECASE)
-ARTICLE_SPECIAL_UKR = re.compile(r"^ukr", re.IGNORECASE)
-SPECIAL_CAPITALS = re.compile(r"^U[NK][AIEO]?")
-VOWELS = re.compile(r"^[aeiou]", re.IGNORECASE)
-
-DIGIT_GROUP = re.compile(r"(\d)")
-TWO_DIGITS = re.compile(r"(\d)(\d)")
-THREE_DIGITS = re.compile(r"(\d)(\d)(\d)")
-THREE_DIGITS_WORD = re.compile(r"(\d)(\d)(\d)(?=\D*\Z)")
-TWO_DIGITS_WORD = re.compile(r"(\d)(\d)(?=\D*\Z)")
-ONE_DIGIT_WORD = re.compile(r"(\d)(?=\D*\Z)")
-
-FOUR_DIGIT_COMMA = re.compile(r"(\d)(\d{3}(?:,|\Z))")
-NON_DIGIT = re.compile(r"\D")
-WHITESPACES_COMMA = re.compile(r"\s+,")
-COMMA_WORD = re.compile(r", (\S+)\s+\Z")
-WHITESPACES = re.compile(r"\s+")
-
-
-PRESENT_PARTICIPLE_REPLACEMENTS = (
-    (re.compile(r"ie$"), r"y"),
-    (
-        re.compile(r"ue$"),
-        r"u",
-    ),  # TODO: isn't ue$ -> u encompassed in the following rule?
-    (re.compile(r"([auy])e$"), r"\g<1>"),
-    (re.compile(r"ski$"), r"ski"),
-    (re.compile(r"[^b]i$"), r""),
-    (re.compile(r"^(are|were)$"), r"be"),
-    (re.compile(r"^(had)$"), r"hav"),
-    (re.compile(r"^(hoe)$"), r"\g<1>"),
-    (re.compile(r"([^e])e$"), r"\g<1>"),
-    (re.compile(r"er$"), r"er"),
-    (re.compile(r"([^aeiou][aeiouy]([bdgmnprst]))$"), r"\g<1>\g<2>"),
-)
-
-DIGIT = re.compile(r"\d")
-
-
-class Words(str):
-    lowered: str
-    split_: List[str]
-    first: str
-    last: str
-
-    def __init__(self, orig) -> None:
-        self.lowered = self.lower()
-        self.split_ = self.split()
-        self.first = self.split_[0]
-        self.last = self.split_[-1]
-
-
-Falsish = Any  # ideally, falsish would only validate on bool(value) is False
-
-
-_STATIC_TYPE_CHECKING = TYPE_CHECKING
-# ^-- Workaround for typeguard AST manipulation:
-#     https://github.com/agronholm/typeguard/issues/353#issuecomment-1556306554
-
-if _STATIC_TYPE_CHECKING:  # pragma: no cover
-    Word = Annotated[str, "String with at least 1 character"]
-else:
-
-    class _WordMeta(type):  # Too dynamic to be supported by mypy...
-        def __instancecheck__(self, instance: Any) -> bool:
-            return isinstance(instance, str) and len(instance) >= 1
-
-    class Word(metaclass=_WordMeta):  # type: ignore[no-redef]
-        """String with at least 1 character"""
-
-
-class engine:
-    def __init__(self) -> None:
-        self.classical_dict = def_classical.copy()
-        self.persistent_count: Optional[int] = None
-        self.mill_count = 0
-        self.pl_sb_user_defined: List[Optional[Word]] = []
-        self.pl_v_user_defined: List[Optional[Word]] = []
-        self.pl_adj_user_defined: List[Optional[Word]] = []
-        self.si_sb_user_defined: List[Optional[Word]] = []
-        self.A_a_user_defined: List[Optional[Word]] = []
-        self.thegender = "neuter"
-        self.__number_args: Optional[Dict[str, str]] = None
-
-    @property
-    def _number_args(self):
-        return cast(Dict[str, str], self.__number_args)
-
-    @_number_args.setter
-    def _number_args(self, val):
-        self.__number_args = val
-
-    @typechecked
-    def defnoun(self, singular: Optional[Word], plural: Optional[Word]) -> int:
-        """
-        Set the noun plural of singular to plural.
-
-        """
-        self.checkpat(singular)
-        self.checkpatplural(plural)
-        self.pl_sb_user_defined.extend((singular, plural))
-        self.si_sb_user_defined.extend((plural, singular))
-        return 1
-
-    @typechecked
-    def defverb(
-        self,
-        s1: Optional[Word],
-        p1: Optional[Word],
-        s2: Optional[Word],
-        p2: Optional[Word],
-        s3: Optional[Word],
-        p3: Optional[Word],
-    ) -> int:
-        """
-        Set the verb plurals for s1, s2 and s3 to p1, p2 and p3 respectively.
-
-        Where 1, 2 and 3 represent the 1st, 2nd and 3rd person forms of the verb.
-
-        """
-        self.checkpat(s1)
-        self.checkpat(s2)
-        self.checkpat(s3)
-        self.checkpatplural(p1)
-        self.checkpatplural(p2)
-        self.checkpatplural(p3)
-        self.pl_v_user_defined.extend((s1, p1, s2, p2, s3, p3))
-        return 1
-
-    @typechecked
-    def defadj(self, singular: Optional[Word], plural: Optional[Word]) -> int:
-        """
-        Set the adjective plural of singular to plural.
-
-        """
-        self.checkpat(singular)
-        self.checkpatplural(plural)
-        self.pl_adj_user_defined.extend((singular, plural))
-        return 1
-
-    @typechecked
-    def defa(self, pattern: Optional[Word]) -> int:
-        """
-        Define the indefinite article as 'a' for words matching pattern.
-
-        """
-        self.checkpat(pattern)
-        self.A_a_user_defined.extend((pattern, "a"))
-        return 1
-
-    @typechecked
-    def defan(self, pattern: Optional[Word]) -> int:
-        """
-        Define the indefinite article as 'an' for words matching pattern.
-
-        """
-        self.checkpat(pattern)
-        self.A_a_user_defined.extend((pattern, "an"))
-        return 1
-
-    def checkpat(self, pattern: Optional[Word]) -> None:
-        """
-        check for errors in a regex pattern
-        """
-        if pattern is None:
-            return
-        try:
-            re.match(pattern, "")
-        except re.error as err:
-            raise BadUserDefinedPatternError(pattern) from err
-
-    def checkpatplural(self, pattern: Optional[Word]) -> None:
-        """
-        check for errors in a regex replace pattern
-        """
-        return
-
-    @typechecked
-    def ud_match(self, word: Word, wordlist: Sequence[Optional[Word]]) -> Optional[str]:
-        for i in range(len(wordlist) - 2, -2, -2):  # backwards through even elements
-            mo = re.search(rf"^{wordlist[i]}$", word, re.IGNORECASE)
-            if mo:
-                if wordlist[i + 1] is None:
-                    return None
-                pl = DOLLAR_DIGITS.sub(
-                    r"\\1", cast(Word, wordlist[i + 1])
-                )  # change $n to \n for expand
-                return mo.expand(pl)
-        return None
-
-    def classical(self, **kwargs) -> None:
-        """
-        turn classical mode on and off for various categories
-
-        turn on all classical modes:
-        classical()
-        classical(all=True)
-
-        turn on or off specific claassical modes:
-        e.g.
-        classical(herd=True)
-        classical(names=False)
-
-        By default all classical modes are off except names.
-
-        unknown value in args or key in kwargs raises
-        exception: UnknownClasicalModeError
-
-        """
-        if not kwargs:
-            self.classical_dict = all_classical.copy()
-            return
-        if "all" in kwargs:
-            if kwargs["all"]:
-                self.classical_dict = all_classical.copy()
-            else:
-                self.classical_dict = no_classical.copy()
-
-        for k, v in kwargs.items():
-            if k in def_classical:
-                self.classical_dict[k] = v
-            else:
-                raise UnknownClassicalModeError
-
-    def num(
-        self, count: Optional[int] = None, show: Optional[int] = None
-    ) -> str:  # (;$count,$show)
-        """
-        Set the number to be used in other method calls.
-
-        Returns count.
-
-        Set show to False to return '' instead.
-
-        """
-        if count is not None:
-            try:
-                self.persistent_count = int(count)
-            except ValueError as err:
-                raise BadNumValueError from err
-            if (show is None) or show:
-                return str(count)
-        else:
-            self.persistent_count = None
-        return ""
-
-    def gender(self, gender: str) -> None:
-        """
-        set the gender for the singular of plural pronouns
-
-        can be one of:
-        'neuter'                ('they' -> 'it')
-        'feminine'              ('they' -> 'she')
-        'masculine'             ('they' -> 'he')
-        'gender-neutral'        ('they' -> 'they')
-        'feminine or masculine' ('they' -> 'she or he')
-        'masculine or feminine' ('they' -> 'he or she')
-        """
-        if gender in singular_pronoun_genders:
-            self.thegender = gender
-        else:
-            raise BadGenderError
-
-    def _get_value_from_ast(self, obj):
-        """
-        Return the value of the ast object.
-        """
-        if isinstance(obj, ast.Num):
-            return obj.n
-        elif isinstance(obj, ast.Str):
-            return obj.s
-        elif isinstance(obj, ast.List):
-            return [self._get_value_from_ast(e) for e in obj.elts]
-        elif isinstance(obj, ast.Tuple):
-            return tuple([self._get_value_from_ast(e) for e in obj.elts])
-
-        # None, True and False are NameConstants in Py3.4 and above.
-        elif isinstance(obj, ast.NameConstant):
-            return obj.value
-
-        # Probably passed a variable name.
-        # Or passed a single word without wrapping it in quotes as an argument
-        # ex: p.inflect("I plural(see)") instead of p.inflect("I plural('see')")
-        raise NameError(f"name '{obj.id}' is not defined")
-
-    def _string_to_substitute(
-        self, mo: Match, methods_dict: Dict[str, Callable]
-    ) -> str:
-        """
-        Return the string to be substituted for the match.
-        """
-        matched_text, f_name = mo.groups()
-        # matched_text is the complete match string. e.g. plural_noun(cat)
-        # f_name is the function name. e.g. plural_noun
-
-        # Return matched_text if function name is not in methods_dict
-        if f_name not in methods_dict:
-            return matched_text
-
-        # Parse the matched text
-        a_tree = ast.parse(matched_text)
-
-        # get the args and kwargs from ast objects
-        args_list = [
-            self._get_value_from_ast(a)
-            for a in a_tree.body[0].value.args  # type: ignore[attr-defined]
-        ]
-        kwargs_list = {
-            kw.arg: self._get_value_from_ast(kw.value)
-            for kw in a_tree.body[0].value.keywords  # type: ignore[attr-defined]
-        }
-
-        # Call the corresponding function
-        return methods_dict[f_name](*args_list, **kwargs_list)
-
-    # 0. PERFORM GENERAL INFLECTIONS IN A STRING
-
-    @typechecked
-    def inflect(self, text: Word) -> str:
-        """
-        Perform inflections in a string.
-
-        e.g. inflect('The plural of cat is plural(cat)') returns
-        'The plural of cat is cats'
-
-        can use plural, plural_noun, plural_verb, plural_adj,
-        singular_noun, a, an, no, ordinal, number_to_words,
-        and prespart
-
-        """
-        save_persistent_count = self.persistent_count
-
-        # Dictionary of allowed methods
-        methods_dict: Dict[str, Callable] = {
-            "plural": self.plural,
-            "plural_adj": self.plural_adj,
-            "plural_noun": self.plural_noun,
-            "plural_verb": self.plural_verb,
-            "singular_noun": self.singular_noun,
-            "a": self.a,
-            "an": self.a,
-            "no": self.no,
-            "ordinal": self.ordinal,
-            "number_to_words": self.number_to_words,
-            "present_participle": self.present_participle,
-            "num": self.num,
-        }
-
-        # Regular expression to find Python's function call syntax
-        output = FUNCTION_CALL.sub(
-            lambda mo: self._string_to_substitute(mo, methods_dict), text
-        )
-        self.persistent_count = save_persistent_count
-        return output
-
-    # ## PLURAL SUBROUTINES
-
-    def postprocess(self, orig: str, inflected) -> str:
-        inflected = str(inflected)
-        if "|" in inflected:
-            word_options = inflected.split("|")
-            # When two parts of a noun need to be pluralized
-            if len(word_options[0].split(" ")) == len(word_options[1].split(" ")):
-                result = inflected.split("|")[self.classical_dict["all"]].split(" ")
-            # When only the last part of the noun needs to be pluralized
-            else:
-                result = inflected.split(" ")
-                for index, word in enumerate(result):
-                    if "|" in word:
-                        result[index] = word.split("|")[self.classical_dict["all"]]
-        else:
-            result = inflected.split(" ")
-
-        # Try to fix word wise capitalization
-        for index, word in enumerate(orig.split(" ")):
-            if word == "I":
-                # Is this the only word for exceptions like this
-                # Where the original is fully capitalized
-                # without 'meaning' capitalization?
-                # Also this fails to handle a capitalizaion in context
-                continue
-            if word.capitalize() == word:
-                result[index] = result[index].capitalize()
-            if word == word.upper():
-                result[index] = result[index].upper()
-        return " ".join(result)
-
-    def partition_word(self, text: str) -> Tuple[str, str, str]:
-        mo = PARTITION_WORD.search(text)
-        if mo:
-            return mo.group(1), mo.group(2), mo.group(3)
-        else:
-            return "", "", ""
-
-    @typechecked
-    def plural(self, text: Word, count: Optional[Union[str, int, Any]] = None) -> str:
-        """
-        Return the plural of text.
-
-        If count supplied, then return text if count is one of:
-            1, a, an, one, each, every, this, that
-
-        otherwise return the plural.
-
-        Whitespace at the start and end is preserved.
-
-        """
-        pre, word, post = self.partition_word(text)
-        if not word:
-            return text
-        plural = self.postprocess(
-            word,
-            self._pl_special_adjective(word, count)
-            or self._pl_special_verb(word, count)
-            or self._plnoun(word, count),
-        )
-        return f"{pre}{plural}{post}"
-
-    @typechecked
-    def plural_noun(
-        self, text: Word, count: Optional[Union[str, int, Any]] = None
-    ) -> str:
-        """
-        Return the plural of text, where text is a noun.
-
-        If count supplied, then return text if count is one of:
-            1, a, an, one, each, every, this, that
-
-        otherwise return the plural.
-
-        Whitespace at the start and end is preserved.
-
-        """
-        pre, word, post = self.partition_word(text)
-        if not word:
-            return text
-        plural = self.postprocess(word, self._plnoun(word, count))
-        return f"{pre}{plural}{post}"
-
-    @typechecked
-    def plural_verb(
-        self, text: Word, count: Optional[Union[str, int, Any]] = None
-    ) -> str:
-        """
-        Return the plural of text, where text is a verb.
-
-        If count supplied, then return text if count is one of:
-            1, a, an, one, each, every, this, that
-
-        otherwise return the plural.
-
-        Whitespace at the start and end is preserved.
-
-        """
-        pre, word, post = self.partition_word(text)
-        if not word:
-            return text
-        plural = self.postprocess(
-            word,
-            self._pl_special_verb(word, count) or self._pl_general_verb(word, count),
-        )
-        return f"{pre}{plural}{post}"
-
-    @typechecked
-    def plural_adj(
-        self, text: Word, count: Optional[Union[str, int, Any]] = None
-    ) -> str:
-        """
-        Return the plural of text, where text is an adjective.
-
-        If count supplied, then return text if count is one of:
-            1, a, an, one, each, every, this, that
-
-        otherwise return the plural.
-
-        Whitespace at the start and end is preserved.
-
-        """
-        pre, word, post = self.partition_word(text)
-        if not word:
-            return text
-        plural = self.postprocess(word, self._pl_special_adjective(word, count) or word)
-        return f"{pre}{plural}{post}"
-
-    @typechecked
-    def compare(self, word1: Word, word2: Word) -> Union[str, bool]:
-        """
-        compare word1 and word2 for equality regardless of plurality
-
-        return values:
-        eq - the strings are equal
-        p:s - word1 is the plural of word2
-        s:p - word2 is the plural of word1
-        p:p - word1 and word2 are two different plural forms of the one word
-        False - otherwise
-
-        >>> compare = engine().compare
-        >>> compare("egg", "eggs")
-        's:p'
-        >>> compare('egg', 'egg')
-        'eq'
-
-        Words should not be empty.
-
-        >>> compare('egg', '')
-        Traceback (most recent call last):
-        ...
-        typeguard.TypeCheckError:...is not an instance of inflect.Word
-        """
-        norms = self.plural_noun, self.plural_verb, self.plural_adj
-        results = (self._plequal(word1, word2, norm) for norm in norms)
-        return next(filter(None, results), False)
-
-    @typechecked
-    def compare_nouns(self, word1: Word, word2: Word) -> Union[str, bool]:
-        """
-        compare word1 and word2 for equality regardless of plurality
-        word1 and word2 are to be treated as nouns
-
-        return values:
-        eq - the strings are equal
-        p:s - word1 is the plural of word2
-        s:p - word2 is the plural of word1
-        p:p - word1 and word2 are two different plural forms of the one word
-        False - otherwise
-
-        """
-        return self._plequal(word1, word2, self.plural_noun)
-
-    @typechecked
-    def compare_verbs(self, word1: Word, word2: Word) -> Union[str, bool]:
-        """
-        compare word1 and word2 for equality regardless of plurality
-        word1 and word2 are to be treated as verbs
-
-        return values:
-        eq - the strings are equal
-        p:s - word1 is the plural of word2
-        s:p - word2 is the plural of word1
-        p:p - word1 and word2 are two different plural forms of the one word
-        False - otherwise
-
-        """
-        return self._plequal(word1, word2, self.plural_verb)
-
-    @typechecked
-    def compare_adjs(self, word1: Word, word2: Word) -> Union[str, bool]:
-        """
-        compare word1 and word2 for equality regardless of plurality
-        word1 and word2 are to be treated as adjectives
-
-        return values:
-        eq - the strings are equal
-        p:s - word1 is the plural of word2
-        s:p - word2 is the plural of word1
-        p:p - word1 and word2 are two different plural forms of the one word
-        False - otherwise
-
-        """
-        return self._plequal(word1, word2, self.plural_adj)
-
-    @typechecked
-    def singular_noun(
-        self,
-        text: Word,
-        count: Optional[Union[int, str, Any]] = None,
-        gender: Optional[str] = None,
-    ) -> Union[str, Literal[False]]:
-        """
-        Return the singular of text, where text is a plural noun.
-
-        If count supplied, then return the singular if count is one of:
-            1, a, an, one, each, every, this, that or if count is None
-
-        otherwise return text unchanged.
-
-        Whitespace at the start and end is preserved.
-
-        >>> p = engine()
-        >>> p.singular_noun('horses')
-        'horse'
-        >>> p.singular_noun('knights')
-        'knight'
-
-        Returns False when a singular noun is passed.
-
-        >>> p.singular_noun('horse')
-        False
-        >>> p.singular_noun('knight')
-        False
-        >>> p.singular_noun('soldier')
-        False
-
-        """
-        pre, word, post = self.partition_word(text)
-        if not word:
-            return text
-        sing = self._sinoun(word, count=count, gender=gender)
-        if sing is not False:
-            plural = self.postprocess(word, sing)
-            return f"{pre}{plural}{post}"
-        return False
-
-    def _plequal(self, word1: str, word2: str, pl) -> Union[str, bool]:  # noqa: C901
-        classval = self.classical_dict.copy()
-        self.classical_dict = all_classical.copy()
-        if word1 == word2:
-            return "eq"
-        if word1 == pl(word2):
-            return "p:s"
-        if pl(word1) == word2:
-            return "s:p"
-        self.classical_dict = no_classical.copy()
-        if word1 == pl(word2):
-            return "p:s"
-        if pl(word1) == word2:
-            return "s:p"
-        self.classical_dict = classval.copy()
-
-        if pl == self.plural or pl == self.plural_noun:
-            if self._pl_check_plurals_N(word1, word2):
-                return "p:p"
-            if self._pl_check_plurals_N(word2, word1):
-                return "p:p"
-        if pl == self.plural or pl == self.plural_adj:
-            if self._pl_check_plurals_adj(word1, word2):
-                return "p:p"
-        return False
-
-    def _pl_reg_plurals(self, pair: str, stems: str, end1: str, end2: str) -> bool:
-        pattern = rf"({stems})({end1}\|\1{end2}|{end2}\|\1{end1})"
-        return bool(re.search(pattern, pair))
-
-    def _pl_check_plurals_N(self, word1: str, word2: str) -> bool:
-        stem_endings = (
-            (pl_sb_C_a_ata, "as", "ata"),
-            (pl_sb_C_is_ides, "is", "ides"),
-            (pl_sb_C_a_ae, "s", "e"),
-            (pl_sb_C_en_ina, "ens", "ina"),
-            (pl_sb_C_um_a, "ums", "a"),
-            (pl_sb_C_us_i, "uses", "i"),
-            (pl_sb_C_on_a, "ons", "a"),
-            (pl_sb_C_o_i_stems, "os", "i"),
-            (pl_sb_C_ex_ices, "exes", "ices"),
-            (pl_sb_C_ix_ices, "ixes", "ices"),
-            (pl_sb_C_i, "s", "i"),
-            (pl_sb_C_im, "s", "im"),
-            (".*eau", "s", "x"),
-            (".*ieu", "s", "x"),
-            (".*tri", "xes", "ces"),
-            (".{2,}[yia]n", "xes", "ges"),
-        )
-
-        words = map(Words, (word1, word2))
-        pair = "|".join(word.last for word in words)
-
-        return (
-            pair in pl_sb_irregular_s.values()
-            or pair in pl_sb_irregular.values()
-            or pair in pl_sb_irregular_caps.values()
-            or any(
-                self._pl_reg_plurals(pair, stems, end1, end2)
-                for stems, end1, end2 in stem_endings
-            )
-        )
-
-    def _pl_check_plurals_adj(self, word1: str, word2: str) -> bool:
-        word1a = word1[: word1.rfind("'")] if word1.endswith(("'s", "'")) else ""
-        word2a = word2[: word2.rfind("'")] if word2.endswith(("'s", "'")) else ""
-
-        return (
-            bool(word1a)
-            and bool(word2a)
-            and (
-                self._pl_check_plurals_N(word1a, word2a)
-                or self._pl_check_plurals_N(word2a, word1a)
-            )
-        )
-
-    def get_count(self, count: Optional[Union[str, int]] = None) -> Union[str, int]:
-        if count is None and self.persistent_count is not None:
-            count = self.persistent_count
-
-        if count is not None:
-            count = (
-                1
-                if (
-                    (str(count) in pl_count_one)
-                    or (
-                        self.classical_dict["zero"]
-                        and str(count).lower() in pl_count_zero
-                    )
-                )
-                else 2
-            )
-        else:
-            count = ""
-        return count
-
-    # @profile
-    def _plnoun(  # noqa: C901
-        self, word: str, count: Optional[Union[str, int]] = None
-    ) -> str:
-        count = self.get_count(count)
-
-        # DEFAULT TO PLURAL
-
-        if count == 1:
-            return word
-
-        # HANDLE USER-DEFINED NOUNS
-
-        value = self.ud_match(word, self.pl_sb_user_defined)
-        if value is not None:
-            return value
-
-        # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
-
-        if word == "":
-            return word
-
-        word = Words(word)
-
-        if word.last.lower() in pl_sb_uninflected_complete:
-            if len(word.split_) >= 3:
-                return self._handle_long_compounds(word, count=2) or word
-            return word
-
-        if word in pl_sb_uninflected_caps:
-            return word
-
-        for k, v in pl_sb_uninflected_bysize.items():
-            if word.lowered[-k:] in v:
-                return word
-
-        if self.classical_dict["herd"] and word.last.lower() in pl_sb_uninflected_herd:
-            return word
-
-        # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
-
-        mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
-        if mo and mo.group(2) != "":
-            return f"{self._plnoun(mo.group(1), 2)}{mo.group(2)}"
-
-        if " a " in word.lowered or "-a-" in word.lowered:
-            mo = PL_SB_PREP_DUAL_COMPOUND_RE.search(word)
-            if mo and mo.group(2) != "" and mo.group(3) != "":
-                return (
-                    f"{self._plnoun(mo.group(1), 2)}"
-                    f"{mo.group(2)}"
-                    f"{self._plnoun(mo.group(3))}"
-                )
-
-        if len(word.split_) >= 3:
-            handled_words = self._handle_long_compounds(word, count=2)
-            if handled_words is not None:
-                return handled_words
-
-        # only pluralize denominators in units
-        mo = DENOMINATOR.search(word.lowered)
-        if mo:
-            index = len(mo.group("denominator"))
-            return f"{self._plnoun(word[:index])}{word[index:]}"
-
-        # handle units given in degrees (only accept if
-        # there is no more than one word following)
-        # degree Celsius => degrees Celsius but degree
-        # fahrenheit hour => degree fahrenheit hours
-        if len(word.split_) >= 2 and word.split_[-2] == "degree":
-            return " ".join([self._plnoun(word.first)] + word.split_[1:])
-
-        with contextlib.suppress(ValueError):
-            return self._handle_prepositional_phrase(
-                word.lowered,
-                functools.partial(self._plnoun, count=2),
-                '-',
-            )
-
-        # HANDLE PRONOUNS
-
-        for k, v in pl_pron_acc_keys_bysize.items():
-            if word.lowered[-k:] in v:  # ends with accusative pronoun
-                for pk, pv in pl_prep_bysize.items():
-                    if word.lowered[:pk] in pv:  # starts with a prep
-                        if word.lowered.split() == [
-                            word.lowered[:pk],
-                            word.lowered[-k:],
-                        ]:
-                            # only whitespace in between
-                            return word.lowered[:-k] + pl_pron_acc[word.lowered[-k:]]
-
-        try:
-            return pl_pron_nom[word.lowered]
-        except KeyError:
-            pass
-
-        try:
-            return pl_pron_acc[word.lowered]
-        except KeyError:
-            pass
-
-        # HANDLE ISOLATED IRREGULAR PLURALS
-
-        if word.last in pl_sb_irregular_caps:
-            llen = len(word.last)
-            return f"{word[:-llen]}{pl_sb_irregular_caps[word.last]}"
-
-        lowered_last = word.last.lower()
-        if lowered_last in pl_sb_irregular:
-            llen = len(lowered_last)
-            return f"{word[:-llen]}{pl_sb_irregular[lowered_last]}"
-
-        dash_split = word.lowered.split('-')
-        if (" ".join(dash_split[-2:])).lower() in pl_sb_irregular_compound:
-            llen = len(
-                " ".join(dash_split[-2:])
-            )  # TODO: what if 2 spaces between these words?
-            return (
-                f"{word[:-llen]}"
-                f"{pl_sb_irregular_compound[(' '.join(dash_split[-2:])).lower()]}"
-            )
-
-        if word.lowered[-3:] == "quy":
-            return f"{word[:-1]}ies"
-
-        if word.lowered[-6:] == "person":
-            if self.classical_dict["persons"]:
-                return f"{word}s"
-            else:
-                return f"{word[:-4]}ople"
-
-        # HANDLE FAMILIES OF IRREGULAR PLURALS
-
-        if word.lowered[-3:] == "man":
-            for k, v in pl_sb_U_man_mans_bysize.items():
-                if word.lowered[-k:] in v:
-                    return f"{word}s"
-            for k, v in pl_sb_U_man_mans_caps_bysize.items():
-                if word[-k:] in v:
-                    return f"{word}s"
-            return f"{word[:-3]}men"
-        if word.lowered[-5:] == "mouse":
-            return f"{word[:-5]}mice"
-        if word.lowered[-5:] == "louse":
-            v = pl_sb_U_louse_lice_bysize.get(len(word))
-            if v and word.lowered in v:
-                return f"{word[:-5]}lice"
-            return f"{word}s"
-        if word.lowered[-5:] == "goose":
-            return f"{word[:-5]}geese"
-        if word.lowered[-5:] == "tooth":
-            return f"{word[:-5]}teeth"
-        if word.lowered[-4:] == "foot":
-            return f"{word[:-4]}feet"
-        if word.lowered[-4:] == "taco":
-            return f"{word[:-5]}tacos"
-
-        if word.lowered == "die":
-            return "dice"
-
-        # HANDLE UNASSIMILATED IMPORTS
-
-        if word.lowered[-4:] == "ceps":
-            return word
-        if word.lowered[-4:] == "zoon":
-            return f"{word[:-2]}a"
-        if word.lowered[-3:] in ("cis", "sis", "xis"):
-            return f"{word[:-2]}es"
-
-        for lastlet, d, numend, post in (
-            ("h", pl_sb_U_ch_chs_bysize, None, "s"),
-            ("x", pl_sb_U_ex_ices_bysize, -2, "ices"),
-            ("x", pl_sb_U_ix_ices_bysize, -2, "ices"),
-            ("m", pl_sb_U_um_a_bysize, -2, "a"),
-            ("s", pl_sb_U_us_i_bysize, -2, "i"),
-            ("n", pl_sb_U_on_a_bysize, -2, "a"),
-            ("a", pl_sb_U_a_ae_bysize, None, "e"),
-        ):
-            if word.lowered[-1] == lastlet:  # this test to add speed
-                for k, v in d.items():
-                    if word.lowered[-k:] in v:
-                        return word[:numend] + post
-
-        # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
-
-        if self.classical_dict["ancient"]:
-            if word.lowered[-4:] == "trix":
-                return f"{word[:-1]}ces"
-            if word.lowered[-3:] in ("eau", "ieu"):
-                return f"{word}x"
-            if word.lowered[-3:] in ("ynx", "inx", "anx") and len(word) > 4:
-                return f"{word[:-1]}ges"
-
-            for lastlet, d, numend, post in (
-                ("n", pl_sb_C_en_ina_bysize, -2, "ina"),
-                ("x", pl_sb_C_ex_ices_bysize, -2, "ices"),
-                ("x", pl_sb_C_ix_ices_bysize, -2, "ices"),
-                ("m", pl_sb_C_um_a_bysize, -2, "a"),
-                ("s", pl_sb_C_us_i_bysize, -2, "i"),
-                ("s", pl_sb_C_us_us_bysize, None, ""),
-                ("a", pl_sb_C_a_ae_bysize, None, "e"),
-                ("a", pl_sb_C_a_ata_bysize, None, "ta"),
-                ("s", pl_sb_C_is_ides_bysize, -1, "des"),
-                ("o", pl_sb_C_o_i_bysize, -1, "i"),
-                ("n", pl_sb_C_on_a_bysize, -2, "a"),
-            ):
-                if word.lowered[-1] == lastlet:  # this test to add speed
-                    for k, v in d.items():
-                        if word.lowered[-k:] in v:
-                            return word[:numend] + post
-
-            for d, numend, post in (
-                (pl_sb_C_i_bysize, None, "i"),
-                (pl_sb_C_im_bysize, None, "im"),
-            ):
-                for k, v in d.items():
-                    if word.lowered[-k:] in v:
-                        return word[:numend] + post
-
-        # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
-
-        if lowered_last in pl_sb_singular_s_complete:
-            return f"{word}es"
-
-        for k, v in pl_sb_singular_s_bysize.items():
-            if word.lowered[-k:] in v:
-                return f"{word}es"
-
-        if word.lowered[-2:] == "es" and word[0] == word[0].upper():
-            return f"{word}es"
-
-        if word.lowered[-1] == "z":
-            for k, v in pl_sb_z_zes_bysize.items():
-                if word.lowered[-k:] in v:
-                    return f"{word}es"
-
-            if word.lowered[-2:-1] != "z":
-                return f"{word}zes"
-
-        if word.lowered[-2:] == "ze":
-            for k, v in pl_sb_ze_zes_bysize.items():
-                if word.lowered[-k:] in v:
-                    return f"{word}s"
-
-        if word.lowered[-2:] in ("ch", "sh", "zz", "ss") or word.lowered[-1] == "x":
-            return f"{word}es"
-
-        # HANDLE ...f -> ...ves
-
-        if word.lowered[-3:] in ("elf", "alf", "olf"):
-            return f"{word[:-1]}ves"
-        if word.lowered[-3:] == "eaf" and word.lowered[-4:-3] != "d":
-            return f"{word[:-1]}ves"
-        if word.lowered[-4:] in ("nife", "life", "wife"):
-            return f"{word[:-2]}ves"
-        if word.lowered[-3:] == "arf":
-            return f"{word[:-1]}ves"
-
-        # HANDLE ...y
-
-        if word.lowered[-1] == "y":
-            if word.lowered[-2:-1] in "aeiou" or len(word) == 1:
-                return f"{word}s"
-
-            if self.classical_dict["names"]:
-                if word.lowered[-1] == "y" and word[0] == word[0].upper():
-                    return f"{word}s"
-
-            return f"{word[:-1]}ies"
-
-        # HANDLE ...o
-
-        if lowered_last in pl_sb_U_o_os_complete:
-            return f"{word}s"
-
-        for k, v in pl_sb_U_o_os_bysize.items():
-            if word.lowered[-k:] in v:
-                return f"{word}s"
-
-        if word.lowered[-2:] in ("ao", "eo", "io", "oo", "uo"):
-            return f"{word}s"
-
-        if word.lowered[-1] == "o":
-            return f"{word}es"
-
-        # OTHERWISE JUST ADD ...s
-
-        return f"{word}s"
-
-    @classmethod
-    def _handle_prepositional_phrase(cls, phrase, transform, sep):
-        """
-        Given a word or phrase possibly separated by sep, parse out
-        the prepositional phrase and apply the transform to the word
-        preceding the prepositional phrase.
-
-        Raise ValueError if the pivot is not found or if at least two
-        separators are not found.
-
-        >>> engine._handle_prepositional_phrase("man-of-war", str.upper, '-')
-        'MAN-of-war'
-        >>> engine._handle_prepositional_phrase("man of war", str.upper, ' ')
-        'MAN of war'
-        """
-        parts = phrase.split(sep)
-        if len(parts) < 3:
-            raise ValueError("Cannot handle words with fewer than two separators")
-
-        pivot = cls._find_pivot(parts, pl_prep_list_da)
-
-        transformed = transform(parts[pivot - 1]) or parts[pivot - 1]
-        return " ".join(
-            parts[: pivot - 1] + [sep.join([transformed, parts[pivot], ''])]
-        ) + " ".join(parts[(pivot + 1) :])
-
-    def _handle_long_compounds(self, word: Words, count: int) -> Union[str, None]:
-        """
-        Handles the plural and singular for compound `Words` that
-        have three or more words, based on the given count.
-
-        >>> engine()._handle_long_compounds(Words("pair of scissors"), 2)
-        'pairs of scissors'
-        >>> engine()._handle_long_compounds(Words("men beyond hills"), 1)
-        'man beyond hills'
-        """
-        inflection = self._sinoun if count == 1 else self._plnoun
-        solutions = (  # type: ignore
-            " ".join(
-                itertools.chain(
-                    leader,
-                    [inflection(cand, count), prep],  # type: ignore
-                    trailer,
-                )
-            )
-            for leader, (cand, prep), trailer in windowed_complete(word.split_, 2)
-            if prep in pl_prep_list_da  # type: ignore
-        )
-        return next(solutions, None)
-
-    @staticmethod
-    def _find_pivot(words, candidates):
-        pivots = (
-            index for index in range(1, len(words) - 1) if words[index] in candidates
-        )
-        try:
-            return next(pivots)
-        except StopIteration:
-            raise ValueError("No pivot found") from None
-
-    def _pl_special_verb(  # noqa: C901
-        self, word: str, count: Optional[Union[str, int]] = None
-    ) -> Union[str, bool]:
-        if self.classical_dict["zero"] and str(count).lower() in pl_count_zero:
-            return False
-        count = self.get_count(count)
-
-        if count == 1:
-            return word
-
-        # HANDLE USER-DEFINED VERBS
-
-        value = self.ud_match(word, self.pl_v_user_defined)
-        if value is not None:
-            return value
-
-        # HANDLE IRREGULAR PRESENT TENSE (SIMPLE AND COMPOUND)
-
-        try:
-            words = Words(word)
-        except IndexError:
-            return False  # word is ''
-
-        if words.first in plverb_irregular_pres:
-            return f"{plverb_irregular_pres[words.first]}{words[len(words.first) :]}"
-
-        # HANDLE IRREGULAR FUTURE, PRETERITE AND PERFECT TENSES
-
-        if words.first in plverb_irregular_non_pres:
-            return word
-
-        # HANDLE PRESENT NEGATIONS (SIMPLE AND COMPOUND)
-
-        if words.first.endswith("n't") and words.first[:-3] in plverb_irregular_pres:
-            return (
-                f"{plverb_irregular_pres[words.first[:-3]]}n't"
-                f"{words[len(words.first) :]}"
-            )
-
-        if words.first.endswith("n't"):
-            return word
-
-        # HANDLE SPECIAL CASES
-
-        mo = PLVERB_SPECIAL_S_RE.search(word)
-        if mo:
-            return False
-        if WHITESPACE.search(word):
-            return False
-
-        if words.lowered == "quizzes":
-            return "quiz"
-
-        # HANDLE STANDARD 3RD PERSON (CHOP THE ...(e)s OFF SINGLE WORDS)
-
-        if (
-            words.lowered[-4:] in ("ches", "shes", "zzes", "sses")
-            or words.lowered[-3:] == "xes"
-        ):
-            return words[:-2]
-
-        if words.lowered[-3:] == "ies" and len(words) > 3:
-            return words.lowered[:-3] + "y"
-
-        if (
-            words.last.lower() in pl_v_oes_oe
-            or words.lowered[-4:] in pl_v_oes_oe_endings_size4
-            or words.lowered[-5:] in pl_v_oes_oe_endings_size5
-        ):
-            return words[:-1]
-
-        if words.lowered.endswith("oes") and len(words) > 3:
-            return words.lowered[:-2]
-
-        mo = ENDS_WITH_S.search(words)
-        if mo:
-            return mo.group(1)
-
-        # OTHERWISE, A REGULAR VERB (HANDLE ELSEWHERE)
-
-        return False
-
-    def _pl_general_verb(
-        self, word: str, count: Optional[Union[str, int]] = None
-    ) -> str:
-        count = self.get_count(count)
-
-        if count == 1:
-            return word
-
-        # HANDLE AMBIGUOUS PRESENT TENSES  (SIMPLE AND COMPOUND)
-
-        mo = plverb_ambiguous_pres_keys.search(word)
-        if mo:
-            return f"{plverb_ambiguous_pres[mo.group(1).lower()]}{mo.group(2)}"
-
-        # HANDLE AMBIGUOUS PRETERITE AND PERFECT TENSES
-
-        mo = plverb_ambiguous_non_pres.search(word)
-        if mo:
-            return word
-
-        # OTHERWISE, 1st OR 2ND PERSON IS UNINFLECTED
-
-        return word
-
-    def _pl_special_adjective(
-        self, word: str, count: Optional[Union[str, int]] = None
-    ) -> Union[str, bool]:
-        count = self.get_count(count)
-
-        if count == 1:
-            return word
-
-        # HANDLE USER-DEFINED ADJECTIVES
-
-        value = self.ud_match(word, self.pl_adj_user_defined)
-        if value is not None:
-            return value
-
-        # HANDLE KNOWN CASES
-
-        mo = pl_adj_special_keys.search(word)
-        if mo:
-            return pl_adj_special[mo.group(1).lower()]
-
-        # HANDLE POSSESSIVES
-
-        mo = pl_adj_poss_keys.search(word)
-        if mo:
-            return pl_adj_poss[mo.group(1).lower()]
-
-        mo = ENDS_WITH_APOSTROPHE_S.search(word)
-        if mo:
-            pl = self.plural_noun(mo.group(1))
-            trailing_s = "" if pl[-1] == "s" else "s"
-            return f"{pl}'{trailing_s}"
-
-        # OTHERWISE, NO IDEA
-
-        return False
-
-    # @profile
-    def _sinoun(  # noqa: C901
-        self,
-        word: str,
-        count: Optional[Union[str, int]] = None,
-        gender: Optional[str] = None,
-    ) -> Union[str, bool]:
-        count = self.get_count(count)
-
-        # DEFAULT TO PLURAL
-
-        if count == 2:
-            return word
-
-        # SET THE GENDER
-
-        try:
-            if gender is None:
-                gender = self.thegender
-            elif gender not in singular_pronoun_genders:
-                raise BadGenderError
-        except (TypeError, IndexError) as err:
-            raise BadGenderError from err
-
-        # HANDLE USER-DEFINED NOUNS
-
-        value = self.ud_match(word, self.si_sb_user_defined)
-        if value is not None:
-            return value
-
-        # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
-
-        if word == "":
-            return word
-
-        if word in si_sb_ois_oi_case:
-            return word[:-1]
-
-        words = Words(word)
-
-        if words.last.lower() in pl_sb_uninflected_complete:
-            if len(words.split_) >= 3:
-                return self._handle_long_compounds(words, count=1) or word
-            return word
-
-        if word in pl_sb_uninflected_caps:
-            return word
-
-        for k, v in pl_sb_uninflected_bysize.items():
-            if words.lowered[-k:] in v:
-                return word
-
-        if self.classical_dict["herd"] and words.last.lower() in pl_sb_uninflected_herd:
-            return word
-
-        if words.last.lower() in pl_sb_C_us_us:
-            return word if self.classical_dict["ancient"] else False
-
-        # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
-
-        mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
-        if mo and mo.group(2) != "":
-            return f"{self._sinoun(mo.group(1), 1, gender=gender)}{mo.group(2)}"
-
-        with contextlib.suppress(ValueError):
-            return self._handle_prepositional_phrase(
-                words.lowered,
-                functools.partial(self._sinoun, count=1, gender=gender),
-                ' ',
-            )
-
-        with contextlib.suppress(ValueError):
-            return self._handle_prepositional_phrase(
-                words.lowered,
-                functools.partial(self._sinoun, count=1, gender=gender),
-                '-',
-            )
-
-        # HANDLE PRONOUNS
-
-        for k, v in si_pron_acc_keys_bysize.items():
-            if words.lowered[-k:] in v:  # ends with accusative pronoun
-                for pk, pv in pl_prep_bysize.items():
-                    if words.lowered[:pk] in pv:  # starts with a prep
-                        if words.lowered.split() == [
-                            words.lowered[:pk],
-                            words.lowered[-k:],
-                        ]:
-                            # only whitespace in between
-                            return words.lowered[:-k] + get_si_pron(
-                                "acc", words.lowered[-k:], gender
-                            )
-
-        try:
-            return get_si_pron("nom", words.lowered, gender)
-        except KeyError:
-            pass
-
-        try:
-            return get_si_pron("acc", words.lowered, gender)
-        except KeyError:
-            pass
-
-        # HANDLE ISOLATED IRREGULAR PLURALS
-
-        if words.last in si_sb_irregular_caps:
-            llen = len(words.last)
-            return f"{word[:-llen]}{si_sb_irregular_caps[words.last]}"
-
-        if words.last.lower() in si_sb_irregular:
-            llen = len(words.last.lower())
-            return f"{word[:-llen]}{si_sb_irregular[words.last.lower()]}"
-
-        dash_split = words.lowered.split("-")
-        if (" ".join(dash_split[-2:])).lower() in si_sb_irregular_compound:
-            llen = len(
-                " ".join(dash_split[-2:])
-            )  # TODO: what if 2 spaces between these words?
-            return "{}{}".format(
-                word[:-llen],
-                si_sb_irregular_compound[(" ".join(dash_split[-2:])).lower()],
-            )
-
-        if words.lowered[-5:] == "quies":
-            return word[:-3] + "y"
-
-        if words.lowered[-7:] == "persons":
-            return word[:-1]
-        if words.lowered[-6:] == "people":
-            return word[:-4] + "rson"
-
-        # HANDLE FAMILIES OF IRREGULAR PLURALS
-
-        if words.lowered[-4:] == "mans":
-            for k, v in si_sb_U_man_mans_bysize.items():
-                if words.lowered[-k:] in v:
-                    return word[:-1]
-            for k, v in si_sb_U_man_mans_caps_bysize.items():
-                if word[-k:] in v:
-                    return word[:-1]
-        if words.lowered[-3:] == "men":
-            return word[:-3] + "man"
-        if words.lowered[-4:] == "mice":
-            return word[:-4] + "mouse"
-        if words.lowered[-4:] == "lice":
-            v = si_sb_U_louse_lice_bysize.get(len(word))
-            if v and words.lowered in v:
-                return word[:-4] + "louse"
-        if words.lowered[-5:] == "geese":
-            return word[:-5] + "goose"
-        if words.lowered[-5:] == "teeth":
-            return word[:-5] + "tooth"
-        if words.lowered[-4:] == "feet":
-            return word[:-4] + "foot"
-
-        if words.lowered == "dice":
-            return "die"
-
-        # HANDLE UNASSIMILATED IMPORTS
-
-        if words.lowered[-4:] == "ceps":
-            return word
-        if words.lowered[-3:] == "zoa":
-            return word[:-1] + "on"
-
-        for lastlet, d, unass_numend, post in (
-            ("s", si_sb_U_ch_chs_bysize, -1, ""),
-            ("s", si_sb_U_ex_ices_bysize, -4, "ex"),
-            ("s", si_sb_U_ix_ices_bysize, -4, "ix"),
-            ("a", si_sb_U_um_a_bysize, -1, "um"),
-            ("i", si_sb_U_us_i_bysize, -1, "us"),
-            ("a", si_sb_U_on_a_bysize, -1, "on"),
-            ("e", si_sb_U_a_ae_bysize, -1, ""),
-        ):
-            if words.lowered[-1] == lastlet:  # this test to add speed
-                for k, v in d.items():
-                    if words.lowered[-k:] in v:
-                        return word[:unass_numend] + post
-
-        # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
-
-        if self.classical_dict["ancient"]:
-            if words.lowered[-6:] == "trices":
-                return word[:-3] + "x"
-            if words.lowered[-4:] in ("eaux", "ieux"):
-                return word[:-1]
-            if words.lowered[-5:] in ("ynges", "inges", "anges") and len(word) > 6:
-                return word[:-3] + "x"
-
-            for lastlet, d, class_numend, post in (
-                ("a", si_sb_C_en_ina_bysize, -3, "en"),
-                ("s", si_sb_C_ex_ices_bysize, -4, "ex"),
-                ("s", si_sb_C_ix_ices_bysize, -4, "ix"),
-                ("a", si_sb_C_um_a_bysize, -1, "um"),
-                ("i", si_sb_C_us_i_bysize, -1, "us"),
-                ("s", pl_sb_C_us_us_bysize, None, ""),
-                ("e", si_sb_C_a_ae_bysize, -1, ""),
-                ("a", si_sb_C_a_ata_bysize, -2, ""),
-                ("s", si_sb_C_is_ides_bysize, -3, "s"),
-                ("i", si_sb_C_o_i_bysize, -1, "o"),
-                ("a", si_sb_C_on_a_bysize, -1, "on"),
-                ("m", si_sb_C_im_bysize, -2, ""),
-                ("i", si_sb_C_i_bysize, -1, ""),
-            ):
-                if words.lowered[-1] == lastlet:  # this test to add speed
-                    for k, v in d.items():
-                        if words.lowered[-k:] in v:
-                            return word[:class_numend] + post
-
-        # HANDLE PLURLS ENDING IN uses -> use
-
-        if (
-            words.lowered[-6:] == "houses"
-            or word in si_sb_uses_use_case
-            or words.last.lower() in si_sb_uses_use
-        ):
-            return word[:-1]
-
-        # HANDLE PLURLS ENDING IN ies -> ie
-
-        if word in si_sb_ies_ie_case or words.last.lower() in si_sb_ies_ie:
-            return word[:-1]
-
-        # HANDLE PLURLS ENDING IN oes -> oe
-
-        if (
-            words.lowered[-5:] == "shoes"
-            or word in si_sb_oes_oe_case
-            or words.last.lower() in si_sb_oes_oe
-        ):
-            return word[:-1]
-
-        # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
-
-        if word in si_sb_sses_sse_case or words.last.lower() in si_sb_sses_sse:
-            return word[:-1]
-
-        if words.last.lower() in si_sb_singular_s_complete:
-            return word[:-2]
-
-        for k, v in si_sb_singular_s_bysize.items():
-            if words.lowered[-k:] in v:
-                return word[:-2]
-
-        if words.lowered[-4:] == "eses" and word[0] == word[0].upper():
-            return word[:-2]
-
-        if words.last.lower() in si_sb_z_zes:
-            return word[:-2]
-
-        if words.last.lower() in si_sb_zzes_zz:
-            return word[:-2]
-
-        if words.lowered[-4:] == "zzes":
-            return word[:-3]
-
-        if word in si_sb_ches_che_case or words.last.lower() in si_sb_ches_che:
-            return word[:-1]
-
-        if words.lowered[-4:] in ("ches", "shes"):
-            return word[:-2]
-
-        if words.last.lower() in si_sb_xes_xe:
-            return word[:-1]
-
-        if words.lowered[-3:] == "xes":
-            return word[:-2]
-
-        # HANDLE ...f -> ...ves
-
-        if word in si_sb_ves_ve_case or words.last.lower() in si_sb_ves_ve:
-            return word[:-1]
-
-        if words.lowered[-3:] == "ves":
-            if words.lowered[-5:-3] in ("el", "al", "ol"):
-                return word[:-3] + "f"
-            if words.lowered[-5:-3] == "ea" and word[-6:-5] != "d":
-                return word[:-3] + "f"
-            if words.lowered[-5:-3] in ("ni", "li", "wi"):
-                return word[:-3] + "fe"
-            if words.lowered[-5:-3] == "ar":
-                return word[:-3] + "f"
-
-        # HANDLE ...y
-
-        if words.lowered[-2:] == "ys":
-            if len(words.lowered) > 2 and words.lowered[-3] in "aeiou":
-                return word[:-1]
-
-            if self.classical_dict["names"]:
-                if words.lowered[-2:] == "ys" and word[0] == word[0].upper():
-                    return word[:-1]
-
-        if words.lowered[-3:] == "ies":
-            return word[:-3] + "y"
-
-        # HANDLE ...o
-
-        if words.lowered[-2:] == "os":
-            if words.last.lower() in si_sb_U_o_os_complete:
-                return word[:-1]
-
-            for k, v in si_sb_U_o_os_bysize.items():
-                if words.lowered[-k:] in v:
-                    return word[:-1]
-
-            if words.lowered[-3:] in ("aos", "eos", "ios", "oos", "uos"):
-                return word[:-1]
-
-        if words.lowered[-3:] == "oes":
-            return word[:-2]
-
-        # UNASSIMILATED IMPORTS FINAL RULE
-
-        if word in si_sb_es_is:
-            return word[:-2] + "is"
-
-        # OTHERWISE JUST REMOVE ...s
-
-        if words.lowered[-1] == "s":
-            return word[:-1]
-
-        # COULD NOT FIND SINGULAR
-
-        return False
-
-    # ADJECTIVES
-
-    @typechecked
-    def a(self, text: Word, count: Optional[Union[int, str, Any]] = 1) -> str:
-        """
-        Return the appropriate indefinite article followed by text.
-
-        The indefinite article is either 'a' or 'an'.
-
-        If count is not one, then return count followed by text
-        instead of 'a' or 'an'.
-
-        Whitespace at the start and end is preserved.
-
-        """
-        mo = INDEFINITE_ARTICLE_TEST.search(text)
-        if mo:
-            word = mo.group(2)
-            if not word:
-                return text
-            pre = mo.group(1)
-            post = mo.group(3)
-            result = self._indef_article(word, count)
-            return f"{pre}{result}{post}"
-        return ""
-
-    an = a
-
-    _indef_article_cases = (
-        # HANDLE ORDINAL FORMS
-        (A_ordinal_a, "a"),
-        (A_ordinal_an, "an"),
-        # HANDLE SPECIAL CASES
-        (A_explicit_an, "an"),
-        (SPECIAL_AN, "an"),
-        (SPECIAL_A, "a"),
-        # HANDLE ABBREVIATIONS
-        (A_abbrev, "an"),
-        (SPECIAL_ABBREV_AN, "an"),
-        (SPECIAL_ABBREV_A, "a"),
-        # HANDLE CONSONANTS
-        (CONSONANTS, "a"),
-        # HANDLE SPECIAL VOWEL-FORMS
-        (ARTICLE_SPECIAL_EU, "a"),
-        (ARTICLE_SPECIAL_ONCE, "a"),
-        (ARTICLE_SPECIAL_ONETIME, "a"),
-        (ARTICLE_SPECIAL_UNIT, "a"),
-        (ARTICLE_SPECIAL_UBA, "a"),
-        (ARTICLE_SPECIAL_UKR, "a"),
-        (A_explicit_a, "a"),
-        # HANDLE SPECIAL CAPITALS
-        (SPECIAL_CAPITALS, "a"),
-        # HANDLE VOWELS
-        (VOWELS, "an"),
-        # HANDLE y...
-        # (BEFORE CERTAIN CONSONANTS IMPLIES (UNNATURALIZED) "i.." SOUND)
-        (A_y_cons, "an"),
-    )
-
-    def _indef_article(self, word: str, count: Union[int, str, Any]) -> str:
-        mycount = self.get_count(count)
-
-        if mycount != 1:
-            return f"{count} {word}"
-
-        # HANDLE USER-DEFINED VARIANTS
-
-        value = self.ud_match(word, self.A_a_user_defined)
-        if value is not None:
-            return f"{value} {word}"
-
-        matches = (
-            f'{article} {word}'
-            for regexen, article in self._indef_article_cases
-            if regexen.search(word)
-        )
-
-        # OTHERWISE, GUESS "a"
-        fallback = f'a {word}'
-        return next(matches, fallback)
-
-    # 2. TRANSLATE ZERO-QUANTIFIED $word TO "no plural($word)"
-
-    @typechecked
-    def no(self, text: Word, count: Optional[Union[int, str]] = None) -> str:
-        """
-        If count is 0, no, zero or nil, return 'no' followed by the plural
-        of text.
-
-        If count is one of:
-            1, a, an, one, each, every, this, that
-            return count followed by text.
-
-        Otherwise return count follow by the plural of text.
-
-        In the return value count is always followed by a space.
-
-        Whitespace at the start and end is preserved.
-
-        """
-        if count is None and self.persistent_count is not None:
-            count = self.persistent_count
-
-        if count is None:
-            count = 0
-        mo = PARTITION_WORD.search(text)
-        if mo:
-            pre = mo.group(1)
-            word = mo.group(2)
-            post = mo.group(3)
-        else:
-            pre = ""
-            word = ""
-            post = ""
-
-        if str(count).lower() in pl_count_zero:
-            count = 'no'
-        return f"{pre}{count} {self.plural(word, count)}{post}"
-
-    # PARTICIPLES
-
-    @typechecked
-    def present_participle(self, word: Word) -> str:
-        """
-        Return the present participle for word.
-
-        word is the 3rd person singular verb.
-
-        """
-        plv = self.plural_verb(word, 2)
-        ans = plv
-
-        for regexen, repl in PRESENT_PARTICIPLE_REPLACEMENTS:
-            ans, num = regexen.subn(repl, plv)
-            if num:
-                return f"{ans}ing"
-        return f"{ans}ing"
-
-    # NUMERICAL INFLECTIONS
-
-    @typechecked
-    def ordinal(self, num: Union[Number, Word]) -> str:
-        """
-        Return the ordinal of num.
-
-        >>> ordinal = engine().ordinal
-        >>> ordinal(1)
-        '1st'
-        >>> ordinal('one')
-        'first'
-        """
-        if DIGIT.match(str(num)):
-            if isinstance(num, (float, int)) and int(num) == num:
-                n = int(num)
-            else:
-                if "." in str(num):
-                    try:
-                        # numbers after decimal,
-                        # so only need last one for ordinal
-                        n = int(str(num)[-1])
-
-                    except ValueError:  # ends with '.', so need to use whole string
-                        n = int(str(num)[:-1])
-                else:
-                    n = int(num)  # type: ignore
-            try:
-                post = nth[n % 100]
-            except KeyError:
-                post = nth[n % 10]
-            return f"{num}{post}"
-        else:
-            return self._sub_ord(num)
-
-    def millfn(self, ind: int = 0) -> str:
-        if ind > len(mill) - 1:
-            raise NumOutOfRangeError
-        return mill[ind]
-
-    def unitfn(self, units: int, mindex: int = 0) -> str:
-        return f"{unit[units]}{self.millfn(mindex)}"
-
-    def tenfn(self, tens, units, mindex=0) -> str:
-        if tens != 1:
-            tens_part = ten[tens]
-            if tens and units:
-                hyphen = "-"
-            else:
-                hyphen = ""
-            unit_part = unit[units]
-            mill_part = self.millfn(mindex)
-            return f"{tens_part}{hyphen}{unit_part}{mill_part}"
-        return f"{teen[units]}{mill[mindex]}"
-
-    def hundfn(self, hundreds: int, tens: int, units: int, mindex: int) -> str:
-        if hundreds:
-            andword = f" {self._number_args['andword']} " if tens or units else ""
-            # use unit not unitfn as simpler
-            return (
-                f"{unit[hundreds]} hundred{andword}"
-                f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
-            )
-        if tens or units:
-            return f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
-        return ""
-
-    def group1sub(self, mo: Match) -> str:
-        units = int(mo.group(1))
-        if units == 1:
-            return f" {self._number_args['one']}, "
-        elif units:
-            return f"{unit[units]}, "
-        else:
-            return f" {self._number_args['zero']}, "
-
-    def group1bsub(self, mo: Match) -> str:
-        units = int(mo.group(1))
-        if units:
-            return f"{unit[units]}, "
-        else:
-            return f" {self._number_args['zero']}, "
-
-    def group2sub(self, mo: Match) -> str:
-        tens = int(mo.group(1))
-        units = int(mo.group(2))
-        if tens:
-            return f"{self.tenfn(tens, units)}, "
-        if units:
-            return f" {self._number_args['zero']} {unit[units]}, "
-        return f" {self._number_args['zero']} {self._number_args['zero']}, "
-
-    def group3sub(self, mo: Match) -> str:
-        hundreds = int(mo.group(1))
-        tens = int(mo.group(2))
-        units = int(mo.group(3))
-        if hundreds == 1:
-            hunword = f" {self._number_args['one']}"
-        elif hundreds:
-            hunword = str(unit[hundreds])
-        else:
-            hunword = f" {self._number_args['zero']}"
-        if tens:
-            tenword = self.tenfn(tens, units)
-        elif units:
-            tenword = f" {self._number_args['zero']} {unit[units]}"
-        else:
-            tenword = f" {self._number_args['zero']} {self._number_args['zero']}"
-        return f"{hunword} {tenword}, "
-
-    def hundsub(self, mo: Match) -> str:
-        ret = self.hundfn(
-            int(mo.group(1)), int(mo.group(2)), int(mo.group(3)), self.mill_count
-        )
-        self.mill_count += 1
-        return ret
-
-    def tensub(self, mo: Match) -> str:
-        return f"{self.tenfn(int(mo.group(1)), int(mo.group(2)), self.mill_count)}, "
-
-    def unitsub(self, mo: Match) -> str:
-        return f"{self.unitfn(int(mo.group(1)), self.mill_count)}, "
-
-    def enword(self, num: str, group: int) -> str:
-        # import pdb
-        # pdb.set_trace()
-
-        if group == 1:
-            num = DIGIT_GROUP.sub(self.group1sub, num)
-        elif group == 2:
-            num = TWO_DIGITS.sub(self.group2sub, num)
-            num = DIGIT_GROUP.sub(self.group1bsub, num, 1)
-        elif group == 3:
-            num = THREE_DIGITS.sub(self.group3sub, num)
-            num = TWO_DIGITS.sub(self.group2sub, num, 1)
-            num = DIGIT_GROUP.sub(self.group1sub, num, 1)
-        elif int(num) == 0:
-            num = self._number_args["zero"]
-        elif int(num) == 1:
-            num = self._number_args["one"]
-        else:
-            num = num.lstrip().lstrip("0")
-            self.mill_count = 0
-            # surely there's a better way to do the next bit
-            mo = THREE_DIGITS_WORD.search(num)
-            while mo:
-                num = THREE_DIGITS_WORD.sub(self.hundsub, num, 1)
-                mo = THREE_DIGITS_WORD.search(num)
-            num = TWO_DIGITS_WORD.sub(self.tensub, num, 1)
-            num = ONE_DIGIT_WORD.sub(self.unitsub, num, 1)
-        return num
-
-    @staticmethod
-    def _sub_ord(val):
-        new = ordinal_suff.sub(lambda match: ordinal[match.group(1)], val)
-        return new + "th" * (new == val)
-
-    @classmethod
-    def _chunk_num(cls, num, decimal, group):
-        if decimal:
-            max_split = -1 if group != 0 else 1
-            chunks = num.split(".", max_split)
-        else:
-            chunks = [num]
-        return cls._remove_last_blank(chunks)
-
-    @staticmethod
-    def _remove_last_blank(chunks):
-        """
-        Remove the last item from chunks if it's a blank string.
-
-        Return the resultant chunks and whether the last item was removed.
-        """
-        removed = chunks[-1] == ""
-        result = chunks[:-1] if removed else chunks
-        return result, removed
-
-    @staticmethod
-    def _get_sign(num):
-        return {'+': 'plus', '-': 'minus'}.get(num.lstrip()[0], '')
-
-    @typechecked
-    def number_to_words(  # noqa: C901
-        self,
-        num: Union[Number, Word],
-        wantlist: bool = False,
-        group: int = 0,
-        comma: Union[Falsish, str] = ",",
-        andword: str = "and",
-        zero: str = "zero",
-        one: str = "one",
-        decimal: Union[Falsish, str] = "point",
-        threshold: Optional[int] = None,
-    ) -> Union[str, List[str]]:
-        """
-        Return a number in words.
-
-        group = 1, 2 or 3 to group numbers before turning into words
-        comma: define comma
-
-        andword:
-            word for 'and'. Can be set to ''.
-            e.g. "one hundred and one" vs "one hundred one"
-
-        zero: word for '0'
-        one: word for '1'
-        decimal: word for decimal point
-        threshold: numbers above threshold not turned into words
-
-        parameters not remembered from last call. Departure from Perl version.
-        """
-        self._number_args = {"andword": andword, "zero": zero, "one": one}
-        num = str(num)
-
-        # Handle "stylistic" conversions (up to a given threshold)...
-        if threshold is not None and float(num) > threshold:
-            spnum = num.split(".", 1)
-            while comma:
-                (spnum[0], n) = FOUR_DIGIT_COMMA.subn(r"\1,\2", spnum[0])
-                if n == 0:
-                    break
-            try:
-                return f"{spnum[0]}.{spnum[1]}"
-            except IndexError:
-                return str(spnum[0])
-
-        if group < 0 or group > 3:
-            raise BadChunkingOptionError
-
-        sign = self._get_sign(num)
-
-        if num in nth_suff:
-            num = zero
-
-        myord = num[-2:] in nth_suff
-        if myord:
-            num = num[:-2]
-
-        chunks, finalpoint = self._chunk_num(num, decimal, group)
-
-        loopstart = chunks[0] == ""
-        first: bool | None = not loopstart
-
-        def _handle_chunk(chunk):
-            nonlocal first
-
-            # remove all non numeric \D
-            chunk = NON_DIGIT.sub("", chunk)
-            if chunk == "":
-                chunk = "0"
-
-            if group == 0 and not first:
-                chunk = self.enword(chunk, 1)
-            else:
-                chunk = self.enword(chunk, group)
-
-            if chunk[-2:] == ", ":
-                chunk = chunk[:-2]
-            chunk = WHITESPACES_COMMA.sub(",", chunk)
-
-            if group == 0 and first:
-                chunk = COMMA_WORD.sub(f" {andword} \\1", chunk)
-            chunk = WHITESPACES.sub(" ", chunk)
-            # chunk = re.sub(r"(\A\s|\s\Z)", self.blankfn, chunk)
-            chunk = chunk.strip()
-            if first:
-                first = None
-            return chunk
-
-        chunks[loopstart:] = map(_handle_chunk, chunks[loopstart:])
-
-        numchunks = []
-        if first != 0:
-            numchunks = chunks[0].split(f"{comma} ")
-
-        if myord and numchunks:
-            numchunks[-1] = self._sub_ord(numchunks[-1])
-
-        for chunk in chunks[1:]:
-            numchunks.append(decimal)
-            numchunks.extend(chunk.split(f"{comma} "))
-
-        if finalpoint:
-            numchunks.append(decimal)
-
-        if wantlist:
-            return [sign] * bool(sign) + numchunks
-
-        signout = f"{sign} " if sign else ""
-        valout = (
-            ', '.join(numchunks)
-            if group
-            else ''.join(self._render(numchunks, decimal, comma))
-        )
-        return signout + valout
-
-    @staticmethod
-    def _render(chunks, decimal, comma):
-        first_item = chunks.pop(0)
-        yield first_item
-        first = decimal is None or not first_item.endswith(decimal)
-        for nc in chunks:
-            if nc == decimal:
-                first = False
-            elif first:
-                yield comma
-            yield f" {nc}"
-
-    @typechecked
-    def join(
-        self,
-        words: Optional[Sequence[Word]],
-        sep: Optional[str] = None,
-        sep_spaced: bool = True,
-        final_sep: Optional[str] = None,
-        conj: str = "and",
-        conj_spaced: bool = True,
-    ) -> str:
-        """
-        Join words into a list.
-
-        e.g. join(['ant', 'bee', 'fly']) returns 'ant, bee, and fly'
-
-        options:
-        conj: replacement for 'and'
-        sep: separator. default ',', unless ',' is in the list then ';'
-        final_sep: final separator. default ',', unless ',' is in the list then ';'
-        conj_spaced: boolean. Should conj have spaces around it
-
-        """
-        if not words:
-            return ""
-        if len(words) == 1:
-            return words[0]
-
-        if conj_spaced:
-            if conj == "":
-                conj = " "
-            else:
-                conj = f" {conj} "
-
-        if len(words) == 2:
-            return f"{words[0]}{conj}{words[1]}"
-
-        if sep is None:
-            if "," in "".join(words):
-                sep = ";"
-            else:
-                sep = ","
-        if final_sep is None:
-            final_sep = sep
-
-        final_sep = f"{final_sep}{conj}"
-
-        if sep_spaced:
-            sep += " "
-
-        return f"{sep.join(words[0:-1])}{final_sep}{words[-1]}"
diff --git a/pkg_resources/_vendor/inflect/compat/__init__.py b/pkg_resources/_vendor/inflect/compat/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/inflect/compat/py38.py b/pkg_resources/_vendor/inflect/compat/py38.py
deleted file mode 100644
index a2d01bd98f..0000000000
--- a/pkg_resources/_vendor/inflect/compat/py38.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import sys
-
-
-if sys.version_info > (3, 9):
-    from typing import Annotated
-else:  # pragma: no cover
-    from typing_extensions import Annotated  # noqa: F401
diff --git a/pkg_resources/_vendor/inflect/py.typed b/pkg_resources/_vendor/inflect/py.typed
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER b/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/LICENSE b/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/LICENSE
deleted file mode 100644
index 1bb5a44356..0000000000
--- a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-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/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/METADATA b/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/METADATA
deleted file mode 100644
index a36f7c5e82..0000000000
--- a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/METADATA
+++ /dev/null
@@ -1,75 +0,0 @@
-Metadata-Version: 2.1
-Name: jaraco.context
-Version: 5.3.0
-Summary: Useful decorators and context managers
-Home-page: https://github.com/jaraco/jaraco.context
-Author: Jason R. Coombs
-Author-email: jaraco@jaraco.com
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.8
-License-File: LICENSE
-Requires-Dist: backports.tarfile ; python_version < "3.12"
-Provides-Extra: docs
-Requires-Dist: sphinx >=3.5 ; extra == 'docs'
-Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
-Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
-Requires-Dist: furo ; extra == 'docs'
-Requires-Dist: sphinx-lint ; extra == 'docs'
-Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest !=8.1.1,>=6 ; extra == 'testing'
-Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-mypy ; extra == 'testing'
-Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
-Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
-Requires-Dist: portend ; extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/jaraco.context.svg
-   :target: https://pypi.org/project/jaraco.context
-
-.. image:: https://img.shields.io/pypi/pyversions/jaraco.context.svg
-
-.. image:: https://github.com/jaraco/jaraco.context/actions/workflows/main.yml/badge.svg
-   :target: https://github.com/jaraco/jaraco.context/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
-    :target: https://github.com/astral-sh/ruff
-    :alt: Ruff
-
-.. image:: https://readthedocs.org/projects/jaracocontext/badge/?version=latest
-   :target: https://jaracocontext.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2024-informational
-   :target: https://blog.jaraco.com/skeleton
-
-.. image:: https://tidelift.com/badges/package/pypi/jaraco.context
-   :target: https://tidelift.com/subscription/pkg/pypi-jaraco.context?utm_source=pypi-jaraco.context&utm_medium=readme
-
-
-Highlights
-==========
-
-See the docs linked from the badge above for the full details, but here are some features that may be of interest.
-
-- ``ExceptionTrap`` provides a general-purpose wrapper for trapping exceptions and then acting on the outcome. Includes ``passes`` and ``raises`` decorators to replace the result of a wrapped function by a boolean indicating the outcome of the exception trap. See `this keyring commit `_ for an example of it in production.
-- ``suppress`` simply enables ``contextlib.suppress`` as a decorator.
-- ``on_interrupt`` is a decorator used by CLI entry points to affect the handling of a ``KeyboardInterrupt``. Inspired by `Lucretiel/autocommand#18 `_.
-- ``pushd`` is similar to pytest's ``monkeypatch.chdir`` or path's `default context `_, changes the current working directory for the duration of the context.
-- ``tarball`` will download a tarball, extract it, change directory, yield, then clean up after. Convenient when working with web assets.
-- ``null`` is there for those times when one code branch needs a context and the other doesn't; this null context provides symmetry across those branches.
-
-
-For Enterprise
-==============
-
-Available as part of the Tidelift Subscription.
-
-This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
-
-`Learn more `_.
diff --git a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/RECORD b/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/RECORD
deleted file mode 100644
index 09d191f214..0000000000
--- a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/RECORD
+++ /dev/null
@@ -1,8 +0,0 @@
-jaraco.context-5.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-jaraco.context-5.3.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-jaraco.context-5.3.0.dist-info/METADATA,sha256=xDtguJej0tN9iEXCUvxEJh2a7xceIRVBEakBLSr__tY,4020
-jaraco.context-5.3.0.dist-info/RECORD,,
-jaraco.context-5.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-jaraco.context-5.3.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
-jaraco/__pycache__/context.cpython-312.pyc,,
-jaraco/context.py,sha256=REoLIxDkO5MfEYowt_WoupNCRoxBS5v7YX2PbW8lIcs,9552
diff --git a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/WHEEL b/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/WHEEL
deleted file mode 100644
index bab98d6758..0000000000
--- a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.43.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt b/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt
deleted file mode 100644
index f6205a5f19..0000000000
--- a/pkg_resources/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-jaraco
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
deleted file mode 100644
index 1bb5a44356..0000000000
--- a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-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/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/METADATA b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
deleted file mode 100644
index c865140ab2..0000000000
--- a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
+++ /dev/null
@@ -1,64 +0,0 @@
-Metadata-Version: 2.1
-Name: jaraco.functools
-Version: 4.0.1
-Summary: Functools like those found in stdlib
-Author-email: "Jason R. Coombs" 
-Project-URL: Homepage, https://github.com/jaraco/jaraco.functools
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.8
-Description-Content-Type: text/x-rst
-License-File: LICENSE
-Requires-Dist: more-itertools
-Provides-Extra: docs
-Requires-Dist: sphinx >=3.5 ; extra == 'docs'
-Requires-Dist: sphinx <7.2.5 ; extra == 'docs'
-Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
-Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
-Requires-Dist: furo ; extra == 'docs'
-Requires-Dist: sphinx-lint ; extra == 'docs'
-Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'docs'
-Provides-Extra: testing
-Requires-Dist: pytest >=6 ; extra == 'testing'
-Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
-Requires-Dist: pytest-cov ; extra == 'testing'
-Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
-Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
-Requires-Dist: jaraco.classes ; extra == 'testing'
-Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
-
-.. image:: https://img.shields.io/pypi/v/jaraco.functools.svg
-   :target: https://pypi.org/project/jaraco.functools
-
-.. image:: https://img.shields.io/pypi/pyversions/jaraco.functools.svg
-
-.. image:: https://github.com/jaraco/jaraco.functools/actions/workflows/main.yml/badge.svg
-   :target: https://github.com/jaraco/jaraco.functools/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
-    :target: https://github.com/astral-sh/ruff
-    :alt: Ruff
-
-.. image:: https://readthedocs.org/projects/jaracofunctools/badge/?version=latest
-   :target: https://jaracofunctools.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2024-informational
-   :target: https://blog.jaraco.com/skeleton
-
-.. image:: https://tidelift.com/badges/package/pypi/jaraco.functools
-   :target: https://tidelift.com/subscription/pkg/pypi-jaraco.functools?utm_source=pypi-jaraco.functools&utm_medium=readme
-
-Additional functools in the spirit of stdlib's functools.
-
-For Enterprise
-==============
-
-Available as part of the Tidelift Subscription.
-
-This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
-
-`Learn more `_.
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
deleted file mode 100644
index ef3bc21e92..0000000000
--- a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
+++ /dev/null
@@ -1,10 +0,0 @@
-jaraco.functools-4.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-jaraco.functools-4.0.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-jaraco.functools-4.0.1.dist-info/METADATA,sha256=i4aUaQDX-jjdEQK5wevhegyx8JyLfin2HyvaSk3FHso,2891
-jaraco.functools-4.0.1.dist-info/RECORD,,
-jaraco.functools-4.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-jaraco.functools-4.0.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
-jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642
-jaraco/functools/__init__.pyi,sha256=gk3dsgHzo5F_U74HzAvpNivFAPCkPJ1b2-yCd62dfnw,3878
-jaraco/functools/__pycache__/__init__.cpython-312.pyc,,
-jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
deleted file mode 100644
index bab98d6758..0000000000
--- a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.43.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt b/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
deleted file mode 100644
index f6205a5f19..0000000000
--- a/pkg_resources/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-jaraco
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/LICENSE b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
deleted file mode 100644
index 1bb5a44356..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-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/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA
deleted file mode 100644
index 0258a380f4..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/METADATA
+++ /dev/null
@@ -1,95 +0,0 @@
-Metadata-Version: 2.1
-Name: jaraco.text
-Version: 3.12.1
-Summary: Module for text manipulation
-Author-email: "Jason R. Coombs" 
-Project-URL: Homepage, https://github.com/jaraco/jaraco.text
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.8
-Description-Content-Type: text/x-rst
-License-File: LICENSE
-Requires-Dist: jaraco.functools
-Requires-Dist: jaraco.context >=4.1
-Requires-Dist: autocommand
-Requires-Dist: inflect
-Requires-Dist: more-itertools
-Requires-Dist: importlib-resources ; python_version < "3.9"
-Provides-Extra: doc
-Requires-Dist: sphinx >=3.5 ; extra == 'doc'
-Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
-Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
-Requires-Dist: furo ; extra == 'doc'
-Requires-Dist: sphinx-lint ; extra == 'doc'
-Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
-Provides-Extra: test
-Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
-Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
-Requires-Dist: pytest-cov ; extra == 'test'
-Requires-Dist: pytest-mypy ; extra == 'test'
-Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
-Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
-Requires-Dist: pathlib2 ; (python_version < "3.10") and extra == 'test'
-
-.. image:: https://img.shields.io/pypi/v/jaraco.text.svg
-   :target: https://pypi.org/project/jaraco.text
-
-.. image:: https://img.shields.io/pypi/pyversions/jaraco.text.svg
-
-.. image:: https://github.com/jaraco/jaraco.text/actions/workflows/main.yml/badge.svg
-   :target: https://github.com/jaraco/jaraco.text/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
-    :target: https://github.com/astral-sh/ruff
-    :alt: Ruff
-
-.. image:: https://readthedocs.org/projects/jaracotext/badge/?version=latest
-   :target: https://jaracotext.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2024-informational
-   :target: https://blog.jaraco.com/skeleton
-
-.. image:: https://tidelift.com/badges/package/pypi/jaraco.text
-   :target: https://tidelift.com/subscription/pkg/pypi-jaraco.text?utm_source=pypi-jaraco.text&utm_medium=readme
-
-
-This package provides handy routines for dealing with text, such as
-wrapping, substitution, trimming, stripping, prefix and suffix removal,
-line continuation, indentation, comment processing, identifier processing,
-values parsing, case insensitive comparison, and more. See the docs
-(linked in the badge above) for the detailed documentation and examples.
-
-Layouts
-=======
-
-One of the features of this package is the layouts module, which
-provides a simple example of translating keystrokes from one keyboard
-layout to another::
-
-    echo qwerty | python -m jaraco.text.to-dvorak
-    ',.pyf
-    echo  "',.pyf" | python -m jaraco.text.to-qwerty
-    qwerty
-
-Newline Reporting
-=================
-
-Need to know what newlines appear in a file?
-
-::
-
-    $ python -m jaraco.text.show-newlines README.rst
-    newline is '\n'
-
-For Enterprise
-==============
-
-Available as part of the Tidelift Subscription.
-
-This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
-
-`Learn more `_.
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD
deleted file mode 100644
index 19e2d8402a..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/RECORD
+++ /dev/null
@@ -1,20 +0,0 @@
-jaraco.text-3.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-jaraco.text-3.12.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-jaraco.text-3.12.1.dist-info/METADATA,sha256=AzWdm6ViMfDOPoQMfLWn2zgBQSGJScyqeN29TcuWXVI,3658
-jaraco.text-3.12.1.dist-info/RECORD,,
-jaraco.text-3.12.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-jaraco.text-3.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-jaraco.text-3.12.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
-jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
-jaraco/text/__init__.py,sha256=Y2YUqXR_orUoDaY4SkPRe6ZZhb5HUHB_Ah9RCNsVyho,16250
-jaraco/text/__pycache__/__init__.cpython-312.pyc,,
-jaraco/text/__pycache__/layouts.cpython-312.pyc,,
-jaraco/text/__pycache__/show-newlines.cpython-312.pyc,,
-jaraco/text/__pycache__/strip-prefix.cpython-312.pyc,,
-jaraco/text/__pycache__/to-dvorak.cpython-312.pyc,,
-jaraco/text/__pycache__/to-qwerty.cpython-312.pyc,,
-jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643
-jaraco/text/show-newlines.py,sha256=WGQa65e8lyhb92LUOLqVn6KaCtoeVgVws6WtSRmLk6w,904
-jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412
-jaraco/text/to-dvorak.py,sha256=1SNcbSsvISpXXg-LnybIHHY-RUFOQr36zcHkY1pWFqw,119
-jaraco/text/to-qwerty.py,sha256=s4UMQUnPwFn_dB5uZC27BurHOQcYondBfzIpVL5pEzw,119
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
deleted file mode 100644
index bab98d6758..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.43.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt b/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
deleted file mode 100644
index f6205a5f19..0000000000
--- a/pkg_resources/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-jaraco
diff --git a/pkg_resources/_vendor/jaraco/context.py b/pkg_resources/_vendor/jaraco/context.py
deleted file mode 100644
index 61b27135df..0000000000
--- a/pkg_resources/_vendor/jaraco/context.py
+++ /dev/null
@@ -1,361 +0,0 @@
-from __future__ import annotations
-
-import contextlib
-import functools
-import operator
-import os
-import shutil
-import subprocess
-import sys
-import tempfile
-import urllib.request
-import warnings
-from typing import Iterator
-
-
-if sys.version_info < (3, 12):
-    from backports import tarfile
-else:
-    import tarfile
-
-
-@contextlib.contextmanager
-def pushd(dir: str | os.PathLike) -> Iterator[str | os.PathLike]:
-    """
-    >>> tmp_path = getfixture('tmp_path')
-    >>> with pushd(tmp_path):
-    ...     assert os.getcwd() == os.fspath(tmp_path)
-    >>> assert os.getcwd() != os.fspath(tmp_path)
-    """
-
-    orig = os.getcwd()
-    os.chdir(dir)
-    try:
-        yield dir
-    finally:
-        os.chdir(orig)
-
-
-@contextlib.contextmanager
-def tarball(
-    url, target_dir: str | os.PathLike | None = None
-) -> Iterator[str | os.PathLike]:
-    """
-    Get a tarball, extract it, yield, then clean up.
-
-    >>> import urllib.request
-    >>> url = getfixture('tarfile_served')
-    >>> target = getfixture('tmp_path') / 'out'
-    >>> tb = tarball(url, target_dir=target)
-    >>> import pathlib
-    >>> with tb as extracted:
-    ...     contents = pathlib.Path(extracted, 'contents.txt').read_text(encoding='utf-8')
-    >>> assert not os.path.exists(extracted)
-    """
-    if target_dir is None:
-        target_dir = os.path.basename(url).replace('.tar.gz', '').replace('.tgz', '')
-    # In the tar command, use --strip-components=1 to strip the first path and
-    #  then
-    #  use -C to cause the files to be extracted to {target_dir}. This ensures
-    #  that we always know where the files were extracted.
-    os.mkdir(target_dir)
-    try:
-        req = urllib.request.urlopen(url)
-        with tarfile.open(fileobj=req, mode='r|*') as tf:
-            tf.extractall(path=target_dir, filter=strip_first_component)
-        yield target_dir
-    finally:
-        shutil.rmtree(target_dir)
-
-
-def strip_first_component(
-    member: tarfile.TarInfo,
-    path,
-) -> tarfile.TarInfo:
-    _, member.name = member.name.split('/', 1)
-    return member
-
-
-def _compose(*cmgrs):
-    """
-    Compose any number of dependent context managers into a single one.
-
-    The last, innermost context manager may take arbitrary arguments, but
-    each successive context manager should accept the result from the
-    previous as a single parameter.
-
-    Like :func:`jaraco.functools.compose`, behavior works from right to
-    left, so the context manager should be indicated from outermost to
-    innermost.
-
-    Example, to create a context manager to change to a temporary
-    directory:
-
-    >>> temp_dir_as_cwd = _compose(pushd, temp_dir)
-    >>> with temp_dir_as_cwd() as dir:
-    ...     assert os.path.samefile(os.getcwd(), dir)
-    """
-
-    def compose_two(inner, outer):
-        def composed(*args, **kwargs):
-            with inner(*args, **kwargs) as saved, outer(saved) as res:
-                yield res
-
-        return contextlib.contextmanager(composed)
-
-    return functools.reduce(compose_two, reversed(cmgrs))
-
-
-tarball_cwd = _compose(pushd, tarball)
-
-
-@contextlib.contextmanager
-def tarball_context(*args, **kwargs):
-    warnings.warn(
-        "tarball_context is deprecated. Use tarball or tarball_cwd instead.",
-        DeprecationWarning,
-        stacklevel=2,
-    )
-    pushd_ctx = kwargs.pop('pushd', pushd)
-    with tarball(*args, **kwargs) as tball, pushd_ctx(tball) as dir:
-        yield dir
-
-
-def infer_compression(url):
-    """
-    Given a URL or filename, infer the compression code for tar.
-
-    >>> infer_compression('http://foo/bar.tar.gz')
-    'z'
-    >>> infer_compression('http://foo/bar.tgz')
-    'z'
-    >>> infer_compression('file.bz')
-    'j'
-    >>> infer_compression('file.xz')
-    'J'
-    """
-    warnings.warn(
-        "infer_compression is deprecated with no replacement",
-        DeprecationWarning,
-        stacklevel=2,
-    )
-    # cheat and just assume it's the last two characters
-    compression_indicator = url[-2:]
-    mapping = dict(gz='z', bz='j', xz='J')
-    # Assume 'z' (gzip) if no match
-    return mapping.get(compression_indicator, 'z')
-
-
-@contextlib.contextmanager
-def temp_dir(remover=shutil.rmtree):
-    """
-    Create a temporary directory context. Pass a custom remover
-    to override the removal behavior.
-
-    >>> import pathlib
-    >>> with temp_dir() as the_dir:
-    ...     assert os.path.isdir(the_dir)
-    ...     _ = pathlib.Path(the_dir).joinpath('somefile').write_text('contents', encoding='utf-8')
-    >>> assert not os.path.exists(the_dir)
-    """
-    temp_dir = tempfile.mkdtemp()
-    try:
-        yield temp_dir
-    finally:
-        remover(temp_dir)
-
-
-@contextlib.contextmanager
-def repo_context(url, branch=None, quiet=True, dest_ctx=temp_dir):
-    """
-    Check out the repo indicated by url.
-
-    If dest_ctx is supplied, it should be a context manager
-    to yield the target directory for the check out.
-    """
-    exe = 'git' if 'git' in url else 'hg'
-    with dest_ctx() as repo_dir:
-        cmd = [exe, 'clone', url, repo_dir]
-        if branch:
-            cmd.extend(['--branch', branch])
-        devnull = open(os.path.devnull, 'w')
-        stdout = devnull if quiet else None
-        subprocess.check_call(cmd, stdout=stdout)
-        yield repo_dir
-
-
-def null():
-    """
-    A null context suitable to stand in for a meaningful context.
-
-    >>> with null() as value:
-    ...     assert value is None
-
-    This context is most useful when dealing with two or more code
-    branches but only some need a context. Wrap the others in a null
-    context to provide symmetry across all options.
-    """
-    warnings.warn(
-        "null is deprecated. Use contextlib.nullcontext",
-        DeprecationWarning,
-        stacklevel=2,
-    )
-    return contextlib.nullcontext()
-
-
-class ExceptionTrap:
-    """
-    A context manager that will catch certain exceptions and provide an
-    indication they occurred.
-
-    >>> with ExceptionTrap() as trap:
-    ...     raise Exception()
-    >>> bool(trap)
-    True
-
-    >>> with ExceptionTrap() as trap:
-    ...     pass
-    >>> bool(trap)
-    False
-
-    >>> with ExceptionTrap(ValueError) as trap:
-    ...     raise ValueError("1 + 1 is not 3")
-    >>> bool(trap)
-    True
-    >>> trap.value
-    ValueError('1 + 1 is not 3')
-    >>> trap.tb
-    
-
-    >>> with ExceptionTrap(ValueError) as trap:
-    ...     raise Exception()
-    Traceback (most recent call last):
-    ...
-    Exception
-
-    >>> bool(trap)
-    False
-    """
-
-    exc_info = None, None, None
-
-    def __init__(self, exceptions=(Exception,)):
-        self.exceptions = exceptions
-
-    def __enter__(self):
-        return self
-
-    @property
-    def type(self):
-        return self.exc_info[0]
-
-    @property
-    def value(self):
-        return self.exc_info[1]
-
-    @property
-    def tb(self):
-        return self.exc_info[2]
-
-    def __exit__(self, *exc_info):
-        type = exc_info[0]
-        matches = type and issubclass(type, self.exceptions)
-        if matches:
-            self.exc_info = exc_info
-        return matches
-
-    def __bool__(self):
-        return bool(self.type)
-
-    def raises(self, func, *, _test=bool):
-        """
-        Wrap func and replace the result with the truth
-        value of the trap (True if an exception occurred).
-
-        First, give the decorator an alias to support Python 3.8
-        Syntax.
-
-        >>> raises = ExceptionTrap(ValueError).raises
-
-        Now decorate a function that always fails.
-
-        >>> @raises
-        ... def fail():
-        ...     raise ValueError('failed')
-        >>> fail()
-        True
-        """
-
-        @functools.wraps(func)
-        def wrapper(*args, **kwargs):
-            with ExceptionTrap(self.exceptions) as trap:
-                func(*args, **kwargs)
-            return _test(trap)
-
-        return wrapper
-
-    def passes(self, func):
-        """
-        Wrap func and replace the result with the truth
-        value of the trap (True if no exception).
-
-        First, give the decorator an alias to support Python 3.8
-        Syntax.
-
-        >>> passes = ExceptionTrap(ValueError).passes
-
-        Now decorate a function that always fails.
-
-        >>> @passes
-        ... def fail():
-        ...     raise ValueError('failed')
-
-        >>> fail()
-        False
-        """
-        return self.raises(func, _test=operator.not_)
-
-
-class suppress(contextlib.suppress, contextlib.ContextDecorator):
-    """
-    A version of contextlib.suppress with decorator support.
-
-    >>> @suppress(KeyError)
-    ... def key_error():
-    ...     {}['']
-    >>> key_error()
-    """
-
-
-class on_interrupt(contextlib.ContextDecorator):
-    """
-    Replace a KeyboardInterrupt with SystemExit(1)
-
-    >>> def do_interrupt():
-    ...     raise KeyboardInterrupt()
-    >>> on_interrupt('error')(do_interrupt)()
-    Traceback (most recent call last):
-    ...
-    SystemExit: 1
-    >>> on_interrupt('error', code=255)(do_interrupt)()
-    Traceback (most recent call last):
-    ...
-    SystemExit: 255
-    >>> on_interrupt('suppress')(do_interrupt)()
-    >>> with __import__('pytest').raises(KeyboardInterrupt):
-    ...     on_interrupt('ignore')(do_interrupt)()
-    """
-
-    def __init__(self, action='error', /, code=1):
-        self.action = action
-        self.code = code
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, exctype, excinst, exctb):
-        if exctype is not KeyboardInterrupt or self.action == 'ignore':
-            return
-        elif self.action == 'error':
-            raise SystemExit(self.code) from excinst
-        return self.action == 'suppress'
diff --git a/pkg_resources/_vendor/jaraco/functools/__init__.py b/pkg_resources/_vendor/jaraco/functools/__init__.py
deleted file mode 100644
index ca6c22fa9b..0000000000
--- a/pkg_resources/_vendor/jaraco/functools/__init__.py
+++ /dev/null
@@ -1,633 +0,0 @@
-import collections.abc
-import functools
-import inspect
-import itertools
-import operator
-import time
-import types
-import warnings
-
-import more_itertools
-
-
-def compose(*funcs):
-    """
-    Compose any number of unary functions into a single unary function.
-
-    >>> import textwrap
-    >>> expected = str.strip(textwrap.dedent(compose.__doc__))
-    >>> strip_and_dedent = compose(str.strip, textwrap.dedent)
-    >>> strip_and_dedent(compose.__doc__) == expected
-    True
-
-    Compose also allows the innermost function to take arbitrary arguments.
-
-    >>> round_three = lambda x: round(x, ndigits=3)
-    >>> f = compose(round_three, int.__truediv__)
-    >>> [f(3*x, x+1) for x in range(1,10)]
-    [1.5, 2.0, 2.25, 2.4, 2.5, 2.571, 2.625, 2.667, 2.7]
-    """
-
-    def compose_two(f1, f2):
-        return lambda *args, **kwargs: f1(f2(*args, **kwargs))
-
-    return functools.reduce(compose_two, funcs)
-
-
-def once(func):
-    """
-    Decorate func so it's only ever called the first time.
-
-    This decorator can ensure that an expensive or non-idempotent function
-    will not be expensive on subsequent calls and is idempotent.
-
-    >>> add_three = once(lambda a: a+3)
-    >>> add_three(3)
-    6
-    >>> add_three(9)
-    6
-    >>> add_three('12')
-    6
-
-    To reset the stored value, simply clear the property ``saved_result``.
-
-    >>> del add_three.saved_result
-    >>> add_three(9)
-    12
-    >>> add_three(8)
-    12
-
-    Or invoke 'reset()' on it.
-
-    >>> add_three.reset()
-    >>> add_three(-3)
-    0
-    >>> add_three(0)
-    0
-    """
-
-    @functools.wraps(func)
-    def wrapper(*args, **kwargs):
-        if not hasattr(wrapper, 'saved_result'):
-            wrapper.saved_result = func(*args, **kwargs)
-        return wrapper.saved_result
-
-    wrapper.reset = lambda: vars(wrapper).__delitem__('saved_result')
-    return wrapper
-
-
-def method_cache(method, cache_wrapper=functools.lru_cache()):
-    """
-    Wrap lru_cache to support storing the cache data in the object instances.
-
-    Abstracts the common paradigm where the method explicitly saves an
-    underscore-prefixed protected property on first call and returns that
-    subsequently.
-
-    >>> class MyClass:
-    ...     calls = 0
-    ...
-    ...     @method_cache
-    ...     def method(self, value):
-    ...         self.calls += 1
-    ...         return value
-
-    >>> a = MyClass()
-    >>> a.method(3)
-    3
-    >>> for x in range(75):
-    ...     res = a.method(x)
-    >>> a.calls
-    75
-
-    Note that the apparent behavior will be exactly like that of lru_cache
-    except that the cache is stored on each instance, so values in one
-    instance will not flush values from another, and when an instance is
-    deleted, so are the cached values for that instance.
-
-    >>> b = MyClass()
-    >>> for x in range(35):
-    ...     res = b.method(x)
-    >>> b.calls
-    35
-    >>> a.method(0)
-    0
-    >>> a.calls
-    75
-
-    Note that if method had been decorated with ``functools.lru_cache()``,
-    a.calls would have been 76 (due to the cached value of 0 having been
-    flushed by the 'b' instance).
-
-    Clear the cache with ``.cache_clear()``
-
-    >>> a.method.cache_clear()
-
-    Same for a method that hasn't yet been called.
-
-    >>> c = MyClass()
-    >>> c.method.cache_clear()
-
-    Another cache wrapper may be supplied:
-
-    >>> cache = functools.lru_cache(maxsize=2)
-    >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
-    >>> a = MyClass()
-    >>> a.method2()
-    3
-
-    Caution - do not subsequently wrap the method with another decorator, such
-    as ``@property``, which changes the semantics of the function.
-
-    See also
-    http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
-    for another implementation and additional justification.
-    """
-
-    def wrapper(self, *args, **kwargs):
-        # it's the first call, replace the method with a cached, bound method
-        bound_method = types.MethodType(method, self)
-        cached_method = cache_wrapper(bound_method)
-        setattr(self, method.__name__, cached_method)
-        return cached_method(*args, **kwargs)
-
-    # Support cache clear even before cache has been created.
-    wrapper.cache_clear = lambda: None
-
-    return _special_method_cache(method, cache_wrapper) or wrapper
-
-
-def _special_method_cache(method, cache_wrapper):
-    """
-    Because Python treats special methods differently, it's not
-    possible to use instance attributes to implement the cached
-    methods.
-
-    Instead, install the wrapper method under a different name
-    and return a simple proxy to that wrapper.
-
-    https://github.com/jaraco/jaraco.functools/issues/5
-    """
-    name = method.__name__
-    special_names = '__getattr__', '__getitem__'
-
-    if name not in special_names:
-        return None
-
-    wrapper_name = '__cached' + name
-
-    def proxy(self, /, *args, **kwargs):
-        if wrapper_name not in vars(self):
-            bound = types.MethodType(method, self)
-            cache = cache_wrapper(bound)
-            setattr(self, wrapper_name, cache)
-        else:
-            cache = getattr(self, wrapper_name)
-        return cache(*args, **kwargs)
-
-    return proxy
-
-
-def apply(transform):
-    """
-    Decorate a function with a transform function that is
-    invoked on results returned from the decorated function.
-
-    >>> @apply(reversed)
-    ... def get_numbers(start):
-    ...     "doc for get_numbers"
-    ...     return range(start, start+3)
-    >>> list(get_numbers(4))
-    [6, 5, 4]
-    >>> get_numbers.__doc__
-    'doc for get_numbers'
-    """
-
-    def wrap(func):
-        return functools.wraps(func)(compose(transform, func))
-
-    return wrap
-
-
-def result_invoke(action):
-    r"""
-    Decorate a function with an action function that is
-    invoked on the results returned from the decorated
-    function (for its side effect), then return the original
-    result.
-
-    >>> @result_invoke(print)
-    ... def add_two(a, b):
-    ...     return a + b
-    >>> x = add_two(2, 3)
-    5
-    >>> x
-    5
-    """
-
-    def wrap(func):
-        @functools.wraps(func)
-        def wrapper(*args, **kwargs):
-            result = func(*args, **kwargs)
-            action(result)
-            return result
-
-        return wrapper
-
-    return wrap
-
-
-def invoke(f, /, *args, **kwargs):
-    """
-    Call a function for its side effect after initialization.
-
-    The benefit of using the decorator instead of simply invoking a function
-    after defining it is that it makes explicit the author's intent for the
-    function to be called immediately. Whereas if one simply calls the
-    function immediately, it's less obvious if that was intentional or
-    incidental. It also avoids repeating the name - the two actions, defining
-    the function and calling it immediately are modeled separately, but linked
-    by the decorator construct.
-
-    The benefit of having a function construct (opposed to just invoking some
-    behavior inline) is to serve as a scope in which the behavior occurs. It
-    avoids polluting the global namespace with local variables, provides an
-    anchor on which to attach documentation (docstring), keeps the behavior
-    logically separated (instead of conceptually separated or not separated at
-    all), and provides potential to re-use the behavior for testing or other
-    purposes.
-
-    This function is named as a pithy way to communicate, "call this function
-    primarily for its side effect", or "while defining this function, also
-    take it aside and call it". It exists because there's no Python construct
-    for "define and call" (nor should there be, as decorators serve this need
-    just fine). The behavior happens immediately and synchronously.
-
-    >>> @invoke
-    ... def func(): print("called")
-    called
-    >>> func()
-    called
-
-    Use functools.partial to pass parameters to the initial call
-
-    >>> @functools.partial(invoke, name='bingo')
-    ... def func(name): print('called with', name)
-    called with bingo
-    """
-    f(*args, **kwargs)
-    return f
-
-
-class Throttler:
-    """Rate-limit a function (or other callable)."""
-
-    def __init__(self, func, max_rate=float('Inf')):
-        if isinstance(func, Throttler):
-            func = func.func
-        self.func = func
-        self.max_rate = max_rate
-        self.reset()
-
-    def reset(self):
-        self.last_called = 0
-
-    def __call__(self, *args, **kwargs):
-        self._wait()
-        return self.func(*args, **kwargs)
-
-    def _wait(self):
-        """Ensure at least 1/max_rate seconds from last call."""
-        elapsed = time.time() - self.last_called
-        must_wait = 1 / self.max_rate - elapsed
-        time.sleep(max(0, must_wait))
-        self.last_called = time.time()
-
-    def __get__(self, obj, owner=None):
-        return first_invoke(self._wait, functools.partial(self.func, obj))
-
-
-def first_invoke(func1, func2):
-    """
-    Return a function that when invoked will invoke func1 without
-    any parameters (for its side effect) and then invoke func2
-    with whatever parameters were passed, returning its result.
-    """
-
-    def wrapper(*args, **kwargs):
-        func1()
-        return func2(*args, **kwargs)
-
-    return wrapper
-
-
-method_caller = first_invoke(
-    lambda: warnings.warn(
-        '`jaraco.functools.method_caller` is deprecated, '
-        'use `operator.methodcaller` instead',
-        DeprecationWarning,
-        stacklevel=3,
-    ),
-    operator.methodcaller,
-)
-
-
-def retry_call(func, cleanup=lambda: None, retries=0, trap=()):
-    """
-    Given a callable func, trap the indicated exceptions
-    for up to 'retries' times, invoking cleanup on the
-    exception. On the final attempt, allow any exceptions
-    to propagate.
-    """
-    attempts = itertools.count() if retries == float('inf') else range(retries)
-    for _ in attempts:
-        try:
-            return func()
-        except trap:
-            cleanup()
-
-    return func()
-
-
-def retry(*r_args, **r_kwargs):
-    """
-    Decorator wrapper for retry_call. Accepts arguments to retry_call
-    except func and then returns a decorator for the decorated function.
-
-    Ex:
-
-    >>> @retry(retries=3)
-    ... def my_func(a, b):
-    ...     "this is my funk"
-    ...     print(a, b)
-    >>> my_func.__doc__
-    'this is my funk'
-    """
-
-    def decorate(func):
-        @functools.wraps(func)
-        def wrapper(*f_args, **f_kwargs):
-            bound = functools.partial(func, *f_args, **f_kwargs)
-            return retry_call(bound, *r_args, **r_kwargs)
-
-        return wrapper
-
-    return decorate
-
-
-def print_yielded(func):
-    """
-    Convert a generator into a function that prints all yielded elements.
-
-    >>> @print_yielded
-    ... def x():
-    ...     yield 3; yield None
-    >>> x()
-    3
-    None
-    """
-    print_all = functools.partial(map, print)
-    print_results = compose(more_itertools.consume, print_all, func)
-    return functools.wraps(func)(print_results)
-
-
-def pass_none(func):
-    """
-    Wrap func so it's not called if its first param is None.
-
-    >>> print_text = pass_none(print)
-    >>> print_text('text')
-    text
-    >>> print_text(None)
-    """
-
-    @functools.wraps(func)
-    def wrapper(param, /, *args, **kwargs):
-        if param is not None:
-            return func(param, *args, **kwargs)
-        return None
-
-    return wrapper
-
-
-def assign_params(func, namespace):
-    """
-    Assign parameters from namespace where func solicits.
-
-    >>> def func(x, y=3):
-    ...     print(x, y)
-    >>> assigned = assign_params(func, dict(x=2, z=4))
-    >>> assigned()
-    2 3
-
-    The usual errors are raised if a function doesn't receive
-    its required parameters:
-
-    >>> assigned = assign_params(func, dict(y=3, z=4))
-    >>> assigned()
-    Traceback (most recent call last):
-    TypeError: func() ...argument...
-
-    It even works on methods:
-
-    >>> class Handler:
-    ...     def meth(self, arg):
-    ...         print(arg)
-    >>> assign_params(Handler().meth, dict(arg='crystal', foo='clear'))()
-    crystal
-    """
-    sig = inspect.signature(func)
-    params = sig.parameters.keys()
-    call_ns = {k: namespace[k] for k in params if k in namespace}
-    return functools.partial(func, **call_ns)
-
-
-def save_method_args(method):
-    """
-    Wrap a method such that when it is called, the args and kwargs are
-    saved on the method.
-
-    >>> class MyClass:
-    ...     @save_method_args
-    ...     def method(self, a, b):
-    ...         print(a, b)
-    >>> my_ob = MyClass()
-    >>> my_ob.method(1, 2)
-    1 2
-    >>> my_ob._saved_method.args
-    (1, 2)
-    >>> my_ob._saved_method.kwargs
-    {}
-    >>> my_ob.method(a=3, b='foo')
-    3 foo
-    >>> my_ob._saved_method.args
-    ()
-    >>> my_ob._saved_method.kwargs == dict(a=3, b='foo')
-    True
-
-    The arguments are stored on the instance, allowing for
-    different instance to save different args.
-
-    >>> your_ob = MyClass()
-    >>> your_ob.method({str('x'): 3}, b=[4])
-    {'x': 3} [4]
-    >>> your_ob._saved_method.args
-    ({'x': 3},)
-    >>> my_ob._saved_method.args
-    ()
-    """
-    args_and_kwargs = collections.namedtuple('args_and_kwargs', 'args kwargs')
-
-    @functools.wraps(method)
-    def wrapper(self, /, *args, **kwargs):
-        attr_name = '_saved_' + method.__name__
-        attr = args_and_kwargs(args, kwargs)
-        setattr(self, attr_name, attr)
-        return method(self, *args, **kwargs)
-
-    return wrapper
-
-
-def except_(*exceptions, replace=None, use=None):
-    """
-    Replace the indicated exceptions, if raised, with the indicated
-    literal replacement or evaluated expression (if present).
-
-    >>> safe_int = except_(ValueError)(int)
-    >>> safe_int('five')
-    >>> safe_int('5')
-    5
-
-    Specify a literal replacement with ``replace``.
-
-    >>> safe_int_r = except_(ValueError, replace=0)(int)
-    >>> safe_int_r('five')
-    0
-
-    Provide an expression to ``use`` to pass through particular parameters.
-
-    >>> safe_int_pt = except_(ValueError, use='args[0]')(int)
-    >>> safe_int_pt('five')
-    'five'
-
-    """
-
-    def decorate(func):
-        @functools.wraps(func)
-        def wrapper(*args, **kwargs):
-            try:
-                return func(*args, **kwargs)
-            except exceptions:
-                try:
-                    return eval(use)
-                except TypeError:
-                    return replace
-
-        return wrapper
-
-    return decorate
-
-
-def identity(x):
-    """
-    Return the argument.
-
-    >>> o = object()
-    >>> identity(o) is o
-    True
-    """
-    return x
-
-
-def bypass_when(check, *, _op=identity):
-    """
-    Decorate a function to return its parameter when ``check``.
-
-    >>> bypassed = []  # False
-
-    >>> @bypass_when(bypassed)
-    ... def double(x):
-    ...     return x * 2
-    >>> double(2)
-    4
-    >>> bypassed[:] = [object()]  # True
-    >>> double(2)
-    2
-    """
-
-    def decorate(func):
-        @functools.wraps(func)
-        def wrapper(param, /):
-            return param if _op(check) else func(param)
-
-        return wrapper
-
-    return decorate
-
-
-def bypass_unless(check):
-    """
-    Decorate a function to return its parameter unless ``check``.
-
-    >>> enabled = [object()]  # True
-
-    >>> @bypass_unless(enabled)
-    ... def double(x):
-    ...     return x * 2
-    >>> double(2)
-    4
-    >>> del enabled[:]  # False
-    >>> double(2)
-    2
-    """
-    return bypass_when(check, _op=operator.not_)
-
-
-@functools.singledispatch
-def _splat_inner(args, func):
-    """Splat args to func."""
-    return func(*args)
-
-
-@_splat_inner.register
-def _(args: collections.abc.Mapping, func):
-    """Splat kargs to func as kwargs."""
-    return func(**args)
-
-
-def splat(func):
-    """
-    Wrap func to expect its parameters to be passed positionally in a tuple.
-
-    Has a similar effect to that of ``itertools.starmap`` over
-    simple ``map``.
-
-    >>> pairs = [(-1, 1), (0, 2)]
-    >>> more_itertools.consume(itertools.starmap(print, pairs))
-    -1 1
-    0 2
-    >>> more_itertools.consume(map(splat(print), pairs))
-    -1 1
-    0 2
-
-    The approach generalizes to other iterators that don't have a "star"
-    equivalent, such as a "starfilter".
-
-    >>> list(filter(splat(operator.add), pairs))
-    [(0, 2)]
-
-    Splat also accepts a mapping argument.
-
-    >>> def is_nice(msg, code):
-    ...     return "smile" in msg or code == 0
-    >>> msgs = [
-    ...     dict(msg='smile!', code=20),
-    ...     dict(msg='error :(', code=1),
-    ...     dict(msg='unknown', code=0),
-    ... ]
-    >>> for msg in filter(splat(is_nice), msgs):
-    ...     print(msg)
-    {'msg': 'smile!', 'code': 20}
-    {'msg': 'unknown', 'code': 0}
-    """
-    return functools.wraps(func)(functools.partial(_splat_inner, func=func))
diff --git a/pkg_resources/_vendor/jaraco/functools/__init__.pyi b/pkg_resources/_vendor/jaraco/functools/__init__.pyi
deleted file mode 100644
index 19191bf93e..0000000000
--- a/pkg_resources/_vendor/jaraco/functools/__init__.pyi
+++ /dev/null
@@ -1,125 +0,0 @@
-from collections.abc import Callable, Hashable, Iterator
-from functools import partial
-from operator import methodcaller
-import sys
-from typing import (
-    Any,
-    Generic,
-    Protocol,
-    TypeVar,
-    overload,
-)
-
-if sys.version_info >= (3, 10):
-    from typing import Concatenate, ParamSpec
-else:
-    from typing_extensions import Concatenate, ParamSpec
-
-_P = ParamSpec('_P')
-_R = TypeVar('_R')
-_T = TypeVar('_T')
-_R1 = TypeVar('_R1')
-_R2 = TypeVar('_R2')
-_V = TypeVar('_V')
-_S = TypeVar('_S')
-_R_co = TypeVar('_R_co', covariant=True)
-
-class _OnceCallable(Protocol[_P, _R]):
-    saved_result: _R
-    reset: Callable[[], None]
-    def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
-
-class _ProxyMethodCacheWrapper(Protocol[_R_co]):
-    cache_clear: Callable[[], None]
-    def __call__(self, *args: Hashable, **kwargs: Hashable) -> _R_co: ...
-
-class _MethodCacheWrapper(Protocol[_R_co]):
-    def cache_clear(self) -> None: ...
-    def __call__(self, *args: Hashable, **kwargs: Hashable) -> _R_co: ...
-
-# `compose()` overloads below will cover most use cases.
-
-@overload
-def compose(
-    __func1: Callable[[_R], _T],
-    __func2: Callable[_P, _R],
-    /,
-) -> Callable[_P, _T]: ...
-@overload
-def compose(
-    __func1: Callable[[_R], _T],
-    __func2: Callable[[_R1], _R],
-    __func3: Callable[_P, _R1],
-    /,
-) -> Callable[_P, _T]: ...
-@overload
-def compose(
-    __func1: Callable[[_R], _T],
-    __func2: Callable[[_R2], _R],
-    __func3: Callable[[_R1], _R2],
-    __func4: Callable[_P, _R1],
-    /,
-) -> Callable[_P, _T]: ...
-def once(func: Callable[_P, _R]) -> _OnceCallable[_P, _R]: ...
-def method_cache(
-    method: Callable[..., _R],
-    cache_wrapper: Callable[[Callable[..., _R]], _MethodCacheWrapper[_R]] = ...,
-) -> _MethodCacheWrapper[_R] | _ProxyMethodCacheWrapper[_R]: ...
-def apply(
-    transform: Callable[[_R], _T]
-) -> Callable[[Callable[_P, _R]], Callable[_P, _T]]: ...
-def result_invoke(
-    action: Callable[[_R], Any]
-) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
-def invoke(
-    f: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs
-) -> Callable[_P, _R]: ...
-
-class Throttler(Generic[_R]):
-    last_called: float
-    func: Callable[..., _R]
-    max_rate: float
-    def __init__(
-        self, func: Callable[..., _R] | Throttler[_R], max_rate: float = ...
-    ) -> None: ...
-    def reset(self) -> None: ...
-    def __call__(self, *args: Any, **kwargs: Any) -> _R: ...
-    def __get__(self, obj: Any, owner: type[Any] | None = ...) -> Callable[..., _R]: ...
-
-def first_invoke(
-    func1: Callable[..., Any], func2: Callable[_P, _R]
-) -> Callable[_P, _R]: ...
-
-method_caller: Callable[..., methodcaller]
-
-def retry_call(
-    func: Callable[..., _R],
-    cleanup: Callable[..., None] = ...,
-    retries: int | float = ...,
-    trap: type[BaseException] | tuple[type[BaseException], ...] = ...,
-) -> _R: ...
-def retry(
-    cleanup: Callable[..., None] = ...,
-    retries: int | float = ...,
-    trap: type[BaseException] | tuple[type[BaseException], ...] = ...,
-) -> Callable[[Callable[..., _R]], Callable[..., _R]]: ...
-def print_yielded(func: Callable[_P, Iterator[Any]]) -> Callable[_P, None]: ...
-def pass_none(
-    func: Callable[Concatenate[_T, _P], _R]
-) -> Callable[Concatenate[_T, _P], _R]: ...
-def assign_params(
-    func: Callable[..., _R], namespace: dict[str, Any]
-) -> partial[_R]: ...
-def save_method_args(
-    method: Callable[Concatenate[_S, _P], _R]
-) -> Callable[Concatenate[_S, _P], _R]: ...
-def except_(
-    *exceptions: type[BaseException], replace: Any = ..., use: Any = ...
-) -> Callable[[Callable[_P, Any]], Callable[_P, Any]]: ...
-def identity(x: _T) -> _T: ...
-def bypass_when(
-    check: _V, *, _op: Callable[[_V], Any] = ...
-) -> Callable[[Callable[[_T], _R]], Callable[[_T], _T | _R]]: ...
-def bypass_unless(
-    check: Any,
-) -> Callable[[Callable[[_T], _R]], Callable[[_T], _T | _R]]: ...
diff --git a/pkg_resources/_vendor/jaraco/functools/py.typed b/pkg_resources/_vendor/jaraco/functools/py.typed
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/jaraco/text/Lorem ipsum.txt b/pkg_resources/_vendor/jaraco/text/Lorem ipsum.txt
deleted file mode 100644
index 986f944b60..0000000000
--- a/pkg_resources/_vendor/jaraco/text/Lorem ipsum.txt	
+++ /dev/null
@@ -1,2 +0,0 @@
-Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
diff --git a/pkg_resources/_vendor/jaraco/text/__init__.py b/pkg_resources/_vendor/jaraco/text/__init__.py
deleted file mode 100644
index 0fabd0c3f0..0000000000
--- a/pkg_resources/_vendor/jaraco/text/__init__.py
+++ /dev/null
@@ -1,624 +0,0 @@
-import re
-import itertools
-import textwrap
-import functools
-
-try:
-    from importlib.resources import files  # type: ignore
-except ImportError:  # pragma: nocover
-    from importlib_resources import files  # type: ignore
-
-from jaraco.functools import compose, method_cache
-from jaraco.context import ExceptionTrap
-
-
-def substitution(old, new):
-    """
-    Return a function that will perform a substitution on a string
-    """
-    return lambda s: s.replace(old, new)
-
-
-def multi_substitution(*substitutions):
-    """
-    Take a sequence of pairs specifying substitutions, and create
-    a function that performs those substitutions.
-
-    >>> multi_substitution(('foo', 'bar'), ('bar', 'baz'))('foo')
-    'baz'
-    """
-    substitutions = itertools.starmap(substitution, substitutions)
-    # compose function applies last function first, so reverse the
-    #  substitutions to get the expected order.
-    substitutions = reversed(tuple(substitutions))
-    return compose(*substitutions)
-
-
-class FoldedCase(str):
-    """
-    A case insensitive string class; behaves just like str
-    except compares equal when the only variation is case.
-
-    >>> s = FoldedCase('hello world')
-
-    >>> s == 'Hello World'
-    True
-
-    >>> 'Hello World' == s
-    True
-
-    >>> s != 'Hello World'
-    False
-
-    >>> s.index('O')
-    4
-
-    >>> s.split('O')
-    ['hell', ' w', 'rld']
-
-    >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
-    ['alpha', 'Beta', 'GAMMA']
-
-    Sequence membership is straightforward.
-
-    >>> "Hello World" in [s]
-    True
-    >>> s in ["Hello World"]
-    True
-
-    Allows testing for set inclusion, but candidate and elements
-    must both be folded.
-
-    >>> FoldedCase("Hello World") in {s}
-    True
-    >>> s in {FoldedCase("Hello World")}
-    True
-
-    String inclusion works as long as the FoldedCase object
-    is on the right.
-
-    >>> "hello" in FoldedCase("Hello World")
-    True
-
-    But not if the FoldedCase object is on the left:
-
-    >>> FoldedCase('hello') in 'Hello World'
-    False
-
-    In that case, use ``in_``:
-
-    >>> FoldedCase('hello').in_('Hello World')
-    True
-
-    >>> FoldedCase('hello') > FoldedCase('Hello')
-    False
-
-    >>> FoldedCase('ß') == FoldedCase('ss')
-    True
-    """
-
-    def __lt__(self, other):
-        return self.casefold() < other.casefold()
-
-    def __gt__(self, other):
-        return self.casefold() > other.casefold()
-
-    def __eq__(self, other):
-        return self.casefold() == other.casefold()
-
-    def __ne__(self, other):
-        return self.casefold() != other.casefold()
-
-    def __hash__(self):
-        return hash(self.casefold())
-
-    def __contains__(self, other):
-        return super().casefold().__contains__(other.casefold())
-
-    def in_(self, other):
-        "Does self appear in other?"
-        return self in FoldedCase(other)
-
-    # cache casefold since it's likely to be called frequently.
-    @method_cache
-    def casefold(self):
-        return super().casefold()
-
-    def index(self, sub):
-        return self.casefold().index(sub.casefold())
-
-    def split(self, splitter=' ', maxsplit=0):
-        pattern = re.compile(re.escape(splitter), re.I)
-        return pattern.split(self, maxsplit)
-
-
-# Python 3.8 compatibility
-_unicode_trap = ExceptionTrap(UnicodeDecodeError)
-
-
-@_unicode_trap.passes
-def is_decodable(value):
-    r"""
-    Return True if the supplied value is decodable (using the default
-    encoding).
-
-    >>> is_decodable(b'\xff')
-    False
-    >>> is_decodable(b'\x32')
-    True
-    """
-    value.decode()
-
-
-def is_binary(value):
-    r"""
-    Return True if the value appears to be binary (that is, it's a byte
-    string and isn't decodable).
-
-    >>> is_binary(b'\xff')
-    True
-    >>> is_binary('\xff')
-    False
-    """
-    return isinstance(value, bytes) and not is_decodable(value)
-
-
-def trim(s):
-    r"""
-    Trim something like a docstring to remove the whitespace that
-    is common due to indentation and formatting.
-
-    >>> trim("\n\tfoo = bar\n\t\tbar = baz\n")
-    'foo = bar\n\tbar = baz'
-    """
-    return textwrap.dedent(s).strip()
-
-
-def wrap(s):
-    """
-    Wrap lines of text, retaining existing newlines as
-    paragraph markers.
-
-    >>> print(wrap(lorem_ipsum))
-    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
-    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
-    minim veniam, quis nostrud exercitation ullamco laboris nisi ut
-    aliquip ex ea commodo consequat. Duis aute irure dolor in
-    reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
-    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
-    culpa qui officia deserunt mollit anim id est laborum.
-    
-    Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
-    varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus
-    magna felis sollicitudin mauris. Integer in mauris eu nibh euismod
-    gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis
-    risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue,
-    eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas
-    fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla
-    a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis,
-    neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing
-    sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque
-    nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus
-    quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis,
-    molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
-    """
-    paragraphs = s.splitlines()
-    wrapped = ('\n'.join(textwrap.wrap(para)) for para in paragraphs)
-    return '\n\n'.join(wrapped)
-
-
-def unwrap(s):
-    r"""
-    Given a multi-line string, return an unwrapped version.
-
-    >>> wrapped = wrap(lorem_ipsum)
-    >>> wrapped.count('\n')
-    20
-    >>> unwrapped = unwrap(wrapped)
-    >>> unwrapped.count('\n')
-    1
-    >>> print(unwrapped)
-    Lorem ipsum dolor sit amet, consectetur adipiscing ...
-    Curabitur pretium tincidunt lacus. Nulla gravida orci ...
-
-    """
-    paragraphs = re.split(r'\n\n+', s)
-    cleaned = (para.replace('\n', ' ') for para in paragraphs)
-    return '\n'.join(cleaned)
-
-
-lorem_ipsum: str = (
-    files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
-)
-
-
-class Splitter:
-    """object that will split a string with the given arguments for each call
-
-    >>> s = Splitter(',')
-    >>> s('hello, world, this is your, master calling')
-    ['hello', ' world', ' this is your', ' master calling']
-    """
-
-    def __init__(self, *args):
-        self.args = args
-
-    def __call__(self, s):
-        return s.split(*self.args)
-
-
-def indent(string, prefix=' ' * 4):
-    """
-    >>> indent('foo')
-    '    foo'
-    """
-    return prefix + string
-
-
-class WordSet(tuple):
-    """
-    Given an identifier, return the words that identifier represents,
-    whether in camel case, underscore-separated, etc.
-
-    >>> WordSet.parse("camelCase")
-    ('camel', 'Case')
-
-    >>> WordSet.parse("under_sep")
-    ('under', 'sep')
-
-    Acronyms should be retained
-
-    >>> WordSet.parse("firstSNL")
-    ('first', 'SNL')
-
-    >>> WordSet.parse("you_and_I")
-    ('you', 'and', 'I')
-
-    >>> WordSet.parse("A simple test")
-    ('A', 'simple', 'test')
-
-    Multiple caps should not interfere with the first cap of another word.
-
-    >>> WordSet.parse("myABCClass")
-    ('my', 'ABC', 'Class')
-
-    The result is a WordSet, providing access to other forms.
-
-    >>> WordSet.parse("myABCClass").underscore_separated()
-    'my_ABC_Class'
-
-    >>> WordSet.parse('a-command').camel_case()
-    'ACommand'
-
-    >>> WordSet.parse('someIdentifier').lowered().space_separated()
-    'some identifier'
-
-    Slices of the result should return another WordSet.
-
-    >>> WordSet.parse('taken-out-of-context')[1:].underscore_separated()
-    'out_of_context'
-
-    >>> WordSet.from_class_name(WordSet()).lowered().space_separated()
-    'word set'
-
-    >>> example = WordSet.parse('figured it out')
-    >>> example.headless_camel_case()
-    'figuredItOut'
-    >>> example.dash_separated()
-    'figured-it-out'
-
-    """
-
-    _pattern = re.compile('([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))')
-
-    def capitalized(self):
-        return WordSet(word.capitalize() for word in self)
-
-    def lowered(self):
-        return WordSet(word.lower() for word in self)
-
-    def camel_case(self):
-        return ''.join(self.capitalized())
-
-    def headless_camel_case(self):
-        words = iter(self)
-        first = next(words).lower()
-        new_words = itertools.chain((first,), WordSet(words).camel_case())
-        return ''.join(new_words)
-
-    def underscore_separated(self):
-        return '_'.join(self)
-
-    def dash_separated(self):
-        return '-'.join(self)
-
-    def space_separated(self):
-        return ' '.join(self)
-
-    def trim_right(self, item):
-        """
-        Remove the item from the end of the set.
-
-        >>> WordSet.parse('foo bar').trim_right('foo')
-        ('foo', 'bar')
-        >>> WordSet.parse('foo bar').trim_right('bar')
-        ('foo',)
-        >>> WordSet.parse('').trim_right('bar')
-        ()
-        """
-        return self[:-1] if self and self[-1] == item else self
-
-    def trim_left(self, item):
-        """
-        Remove the item from the beginning of the set.
-
-        >>> WordSet.parse('foo bar').trim_left('foo')
-        ('bar',)
-        >>> WordSet.parse('foo bar').trim_left('bar')
-        ('foo', 'bar')
-        >>> WordSet.parse('').trim_left('bar')
-        ()
-        """
-        return self[1:] if self and self[0] == item else self
-
-    def trim(self, item):
-        """
-        >>> WordSet.parse('foo bar').trim('foo')
-        ('bar',)
-        """
-        return self.trim_left(item).trim_right(item)
-
-    def __getitem__(self, item):
-        result = super().__getitem__(item)
-        if isinstance(item, slice):
-            result = WordSet(result)
-        return result
-
-    @classmethod
-    def parse(cls, identifier):
-        matches = cls._pattern.finditer(identifier)
-        return WordSet(match.group(0) for match in matches)
-
-    @classmethod
-    def from_class_name(cls, subject):
-        return cls.parse(subject.__class__.__name__)
-
-
-# for backward compatibility
-words = WordSet.parse
-
-
-def simple_html_strip(s):
-    r"""
-    Remove HTML from the string `s`.
-
-    >>> str(simple_html_strip(''))
-    ''
-
-    >>> print(simple_html_strip('A stormy day in paradise'))
-    A stormy day in paradise
-
-    >>> print(simple_html_strip('Somebody  tell the truth.'))
-    Somebody  tell the truth.
-
-    >>> print(simple_html_strip('What about
\nmultiple lines?')) - What about - multiple lines? - """ - html_stripper = re.compile('()|(<[^>]*>)|([^<]+)', re.DOTALL) - texts = (match.group(3) or '' for match in html_stripper.finditer(s)) - return ''.join(texts) - - -class SeparatedValues(str): - """ - A string separated by a separator. Overrides __iter__ for getting - the values. - - >>> list(SeparatedValues('a,b,c')) - ['a', 'b', 'c'] - - Whitespace is stripped and empty values are discarded. - - >>> list(SeparatedValues(' a, b , c, ')) - ['a', 'b', 'c'] - """ - - separator = ',' - - def __iter__(self): - parts = self.split(self.separator) - return filter(None, (part.strip() for part in parts)) - - -class Stripper: - r""" - Given a series of lines, find the common prefix and strip it from them. - - >>> lines = [ - ... 'abcdefg\n', - ... 'abc\n', - ... 'abcde\n', - ... ] - >>> res = Stripper.strip_prefix(lines) - >>> res.prefix - 'abc' - >>> list(res.lines) - ['defg\n', '\n', 'de\n'] - - If no prefix is common, nothing should be stripped. - - >>> lines = [ - ... 'abcd\n', - ... '1234\n', - ... ] - >>> res = Stripper.strip_prefix(lines) - >>> res.prefix = '' - >>> list(res.lines) - ['abcd\n', '1234\n'] - """ - - def __init__(self, prefix, lines): - self.prefix = prefix - self.lines = map(self, lines) - - @classmethod - def strip_prefix(cls, lines): - prefix_lines, lines = itertools.tee(lines) - prefix = functools.reduce(cls.common_prefix, prefix_lines) - return cls(prefix, lines) - - def __call__(self, line): - if not self.prefix: - return line - null, prefix, rest = line.partition(self.prefix) - return rest - - @staticmethod - def common_prefix(s1, s2): - """ - Return the common prefix of two lines. - """ - index = min(len(s1), len(s2)) - while s1[:index] != s2[:index]: - index -= 1 - return s1[:index] - - -def remove_prefix(text, prefix): - """ - Remove the prefix from the text if it exists. - - >>> remove_prefix('underwhelming performance', 'underwhelming ') - 'performance' - - >>> remove_prefix('something special', 'sample') - 'something special' - """ - null, prefix, rest = text.rpartition(prefix) - return rest - - -def remove_suffix(text, suffix): - """ - Remove the suffix from the text if it exists. - - >>> remove_suffix('name.git', '.git') - 'name' - - >>> remove_suffix('something special', 'sample') - 'something special' - """ - rest, suffix, null = text.partition(suffix) - return rest - - -def normalize_newlines(text): - r""" - Replace alternate newlines with the canonical newline. - - >>> normalize_newlines('Lorem Ipsum\u2029') - 'Lorem Ipsum\n' - >>> normalize_newlines('Lorem Ipsum\r\n') - 'Lorem Ipsum\n' - >>> normalize_newlines('Lorem Ipsum\x85') - 'Lorem Ipsum\n' - """ - newlines = ['\r\n', '\r', '\n', '\u0085', '\u2028', '\u2029'] - pattern = '|'.join(newlines) - return re.sub(pattern, '\n', text) - - -def _nonblank(str): - return str and not str.startswith('#') - - -@functools.singledispatch -def yield_lines(iterable): - r""" - Yield valid lines of a string or iterable. - - >>> list(yield_lines('')) - [] - >>> list(yield_lines(['foo', 'bar'])) - ['foo', 'bar'] - >>> list(yield_lines('foo\nbar')) - ['foo', 'bar'] - >>> list(yield_lines('\nfoo\n#bar\nbaz #comment')) - ['foo', 'baz #comment'] - >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n'])) - ['foo', 'bar', 'baz', 'bing'] - """ - return itertools.chain.from_iterable(map(yield_lines, iterable)) - - -@yield_lines.register(str) -def _(text): - return filter(_nonblank, map(str.strip, text.splitlines())) - - -def drop_comment(line): - """ - Drop comments. - - >>> drop_comment('foo # bar') - 'foo' - - A hash without a space may be in a URL. - - >>> drop_comment('http://example.com/foo#bar') - 'http://example.com/foo#bar' - """ - return line.partition(' #')[0] - - -def join_continuation(lines): - r""" - Join lines continued by a trailing backslash. - - >>> list(join_continuation(['foo \\', 'bar', 'baz'])) - ['foobar', 'baz'] - >>> list(join_continuation(['foo \\', 'bar', 'baz'])) - ['foobar', 'baz'] - >>> list(join_continuation(['foo \\', 'bar \\', 'baz'])) - ['foobarbaz'] - - Not sure why, but... - The character preceding the backslash is also elided. - - >>> list(join_continuation(['goo\\', 'dly'])) - ['godly'] - - A terrible idea, but... - If no line is available to continue, suppress the lines. - - >>> list(join_continuation(['foo', 'bar\\', 'baz\\'])) - ['foo'] - """ - lines = iter(lines) - for item in lines: - while item.endswith('\\'): - try: - item = item[:-2].strip() + next(lines) - except StopIteration: - return - yield item - - -def read_newlines(filename, limit=1024): - r""" - >>> tmp_path = getfixture('tmp_path') - >>> filename = tmp_path / 'out.txt' - >>> _ = filename.write_text('foo\n', newline='', encoding='utf-8') - >>> read_newlines(filename) - '\n' - >>> _ = filename.write_text('foo\r\n', newline='', encoding='utf-8') - >>> read_newlines(filename) - '\r\n' - >>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='', encoding='utf-8') - >>> read_newlines(filename) - ('\r', '\n', '\r\n') - """ - with open(filename, encoding='utf-8') as fp: - fp.read(limit) - return fp.newlines diff --git a/pkg_resources/_vendor/jaraco/text/layouts.py b/pkg_resources/_vendor/jaraco/text/layouts.py deleted file mode 100644 index 9636f0f7b5..0000000000 --- a/pkg_resources/_vendor/jaraco/text/layouts.py +++ /dev/null @@ -1,25 +0,0 @@ -qwerty = "-=qwertyuiop[]asdfghjkl;'zxcvbnm,./_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?" -dvorak = "[]',.pyfgcrl/=aoeuidhtns-;qjkxbmwvz{}\"<>PYFGCRL?+AOEUIDHTNS_:QJKXBMWVZ" - - -to_dvorak = str.maketrans(qwerty, dvorak) -to_qwerty = str.maketrans(dvorak, qwerty) - - -def translate(input, translation): - """ - >>> translate('dvorak', to_dvorak) - 'ekrpat' - >>> translate('qwerty', to_qwerty) - 'x,dokt' - """ - return input.translate(translation) - - -def _translate_stream(stream, translation): - """ - >>> import io - >>> _translate_stream(io.StringIO('foo'), to_dvorak) - urr - """ - print(translate(stream.read(), translation)) diff --git a/pkg_resources/_vendor/jaraco/text/show-newlines.py b/pkg_resources/_vendor/jaraco/text/show-newlines.py deleted file mode 100644 index e11d1ba428..0000000000 --- a/pkg_resources/_vendor/jaraco/text/show-newlines.py +++ /dev/null @@ -1,33 +0,0 @@ -import autocommand -import inflect - -from more_itertools import always_iterable - -import jaraco.text - - -def report_newlines(filename): - r""" - Report the newlines in the indicated file. - - >>> tmp_path = getfixture('tmp_path') - >>> filename = tmp_path / 'out.txt' - >>> _ = filename.write_text('foo\nbar\n', newline='', encoding='utf-8') - >>> report_newlines(filename) - newline is '\n' - >>> filename = tmp_path / 'out.txt' - >>> _ = filename.write_text('foo\nbar\r\n', newline='', encoding='utf-8') - >>> report_newlines(filename) - newlines are ('\n', '\r\n') - """ - newlines = jaraco.text.read_newlines(filename) - count = len(tuple(always_iterable(newlines))) - engine = inflect.engine() - print( - engine.plural_noun("newline", count), - engine.plural_verb("is", count), - repr(newlines), - ) - - -autocommand.autocommand(__name__)(report_newlines) diff --git a/pkg_resources/_vendor/jaraco/text/strip-prefix.py b/pkg_resources/_vendor/jaraco/text/strip-prefix.py deleted file mode 100644 index 761717a9b9..0000000000 --- a/pkg_resources/_vendor/jaraco/text/strip-prefix.py +++ /dev/null @@ -1,21 +0,0 @@ -import sys - -import autocommand - -from jaraco.text import Stripper - - -def strip_prefix(): - r""" - Strip any common prefix from stdin. - - >>> import io, pytest - >>> getfixture('monkeypatch').setattr('sys.stdin', io.StringIO('abcdef\nabc123')) - >>> strip_prefix() - def - 123 - """ - sys.stdout.writelines(Stripper.strip_prefix(sys.stdin).lines) - - -autocommand.autocommand(__name__)(strip_prefix) diff --git a/pkg_resources/_vendor/jaraco/text/to-dvorak.py b/pkg_resources/_vendor/jaraco/text/to-dvorak.py deleted file mode 100644 index a6d5da80b3..0000000000 --- a/pkg_resources/_vendor/jaraco/text/to-dvorak.py +++ /dev/null @@ -1,6 +0,0 @@ -import sys - -from . import layouts - - -__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_dvorak) diff --git a/pkg_resources/_vendor/jaraco/text/to-qwerty.py b/pkg_resources/_vendor/jaraco/text/to-qwerty.py deleted file mode 100644 index abe2728662..0000000000 --- a/pkg_resources/_vendor/jaraco/text/to-qwerty.py +++ /dev/null @@ -1,6 +0,0 @@ -import sys - -from . import layouts - - -__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_qwerty) diff --git a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/INSTALLER b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a..0000000000 --- a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/LICENSE b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/LICENSE deleted file mode 100644 index 0a523bece3..0000000000 --- a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Erik Rose - -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/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/METADATA b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/METADATA deleted file mode 100644 index fb41b0cfe6..0000000000 --- a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/METADATA +++ /dev/null @@ -1,266 +0,0 @@ -Metadata-Version: 2.1 -Name: more-itertools -Version: 10.3.0 -Summary: More routines for operating on iterables, beyond itertools -Keywords: itertools,iterator,iteration,filter,peek,peekable,chunk,chunked -Author-email: Erik Rose -Requires-Python: >=3.8 -Description-Content-Type: text/x-rst -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: Natural Language :: English -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: Programming Language :: Python :: 3.12 -Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Software Development :: Libraries -Project-URL: Homepage, https://github.com/more-itertools/more-itertools - -============== -More Itertools -============== - -.. image:: https://readthedocs.org/projects/more-itertools/badge/?version=latest - :target: https://more-itertools.readthedocs.io/en/stable/ - -Python's ``itertools`` library is a gem - you can compose elegant solutions -for a variety of problems with the functions it provides. In ``more-itertools`` -we collect additional building blocks, recipes, and routines for working with -Python iterables. - -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Grouping | `chunked `_, | -| | `ichunked `_, | -| | `chunked_even `_, | -| | `sliced `_, | -| | `constrained_batches `_, | -| | `distribute `_, | -| | `divide `_, | -| | `split_at `_, | -| | `split_before `_, | -| | `split_after `_, | -| | `split_into `_, | -| | `split_when `_, | -| | `bucket `_, | -| | `unzip `_, | -| | `batched `_, | -| | `grouper `_, | -| | `partition `_, | -| | `transpose `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Lookahead and lookback | `spy `_, | -| | `peekable `_, | -| | `seekable `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Windowing | `windowed `_, | -| | `substrings `_, | -| | `substrings_indexes `_, | -| | `stagger `_, | -| | `windowed_complete `_, | -| | `pairwise `_, | -| | `triplewise `_, | -| | `sliding_window `_, | -| | `subslices `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Augmenting | `count_cycle `_, | -| | `intersperse `_, | -| | `padded `_, | -| | `repeat_each `_, | -| | `mark_ends `_, | -| | `repeat_last `_, | -| | `adjacent `_, | -| | `groupby_transform `_, | -| | `pad_none `_, | -| | `ncycles `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Combining | `collapse `_, | -| | `sort_together `_, | -| | `interleave `_, | -| | `interleave_longest `_, | -| | `interleave_evenly `_, | -| | `zip_offset `_, | -| | `zip_equal `_, | -| | `zip_broadcast `_, | -| | `flatten `_, | -| | `roundrobin `_, | -| | `prepend `_, | -| | `value_chain `_, | -| | `partial_product `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Summarizing | `ilen `_, | -| | `unique_to_each `_, | -| | `sample `_, | -| | `consecutive_groups `_, | -| | `run_length `_, | -| | `map_reduce `_, | -| | `join_mappings `_, | -| | `exactly_n `_, | -| | `is_sorted `_, | -| | `all_equal `_, | -| | `all_unique `_, | -| | `minmax `_, | -| | `first_true `_, | -| | `quantify `_, | -| | `iequals `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Selecting | `islice_extended `_, | -| | `first `_, | -| | `last `_, | -| | `one `_, | -| | `only `_, | -| | `strictly_n `_, | -| | `strip `_, | -| | `lstrip `_, | -| | `rstrip `_, | -| | `filter_except `_, | -| | `map_except `_, | -| | `filter_map `_, | -| | `iter_suppress `_, | -| | `nth_or_last `_, | -| | `unique_in_window `_, | -| | `before_and_after `_, | -| | `nth `_, | -| | `take `_, | -| | `tail `_, | -| | `unique_everseen `_, | -| | `unique_justseen `_, | -| | `unique `_, | -| | `duplicates_everseen `_, | -| | `duplicates_justseen `_, | -| | `classify_unique `_, | -| | `longest_common_prefix `_, | -| | `takewhile_inclusive `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Math | `dft `_, | -| | `idft `_, | -| | `convolve `_, | -| | `dotproduct `_, | -| | `factor `_, | -| | `matmul `_, | -| | `polynomial_from_roots `_, | -| | `polynomial_derivative `_, | -| | `polynomial_eval `_, | -| | `sieve `_, | -| | `sum_of_squares `_, | -| | `totient `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Combinatorics | `distinct_permutations `_, | -| | `distinct_combinations `_, | -| | `circular_shifts `_, | -| | `partitions `_, | -| | `set_partitions `_, | -| | `product_index `_, | -| | `combination_index `_, | -| | `permutation_index `_, | -| | `combination_with_replacement_index `_, | -| | `gray_product `_, | -| | `outer_product `_, | -| | `powerset `_, | -| | `powerset_of_sets `_, | -| | `random_product `_, | -| | `random_permutation `_, | -| | `random_combination `_, | -| | `random_combination_with_replacement `_, | -| | `nth_product `_, | -| | `nth_permutation `_, | -| | `nth_combination `_, | -| | `nth_combination_with_replacement `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Wrapping | `always_iterable `_, | -| | `always_reversible `_, | -| | `countable `_, | -| | `consumer `_, | -| | `with_iter `_, | -| | `iter_except `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Others | `locate `_, | -| | `rlocate `_, | -| | `replace `_, | -| | `numeric_range `_, | -| | `side_effect `_, | -| | `iterate `_, | -| | `difference `_, | -| | `make_decorator `_, | -| | `SequenceView `_, | -| | `time_limited `_, | -| | `map_if `_, | -| | `iter_index `_, | -| | `consume `_, | -| | `tabulate `_, | -| | `repeatfunc `_, | -| | `reshape `_ | -| | `doublestarmap `_ | -+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - - -Getting started -=============== - -To get started, install the library with `pip `_: - -.. code-block:: shell - - pip install more-itertools - -The recipes from the `itertools docs `_ -are included in the top-level package: - -.. code-block:: python - - >>> from more_itertools import flatten - >>> iterable = [(0, 1), (2, 3)] - >>> list(flatten(iterable)) - [0, 1, 2, 3] - -Several new recipes are available as well: - -.. code-block:: python - - >>> from more_itertools import chunked - >>> iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8] - >>> list(chunked(iterable, 3)) - [[0, 1, 2], [3, 4, 5], [6, 7, 8]] - - >>> from more_itertools import spy - >>> iterable = (x * x for x in range(1, 6)) - >>> head, iterable = spy(iterable, n=3) - >>> list(head) - [1, 4, 9] - >>> list(iterable) - [1, 4, 9, 16, 25] - - - -For the full listing of functions, see the `API documentation `_. - - -Links elsewhere -=============== - -Blog posts about ``more-itertools``: - -* `Yo, I heard you like decorators `__ -* `Tour of Python Itertools `__ (`Alternate `__) -* `Real-World Python More Itertools `_ - - -Development -=========== - -``more-itertools`` is maintained by `@erikrose `_ -and `@bbayles `_, with help from `many others `_. -If you have a problem or suggestion, please file a bug or pull request in this -repository. Thanks for contributing! - - -Version History -=============== - -The version history can be found in `documentation `_. - diff --git a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD deleted file mode 100644 index 53183bfb30..0000000000 --- a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/RECORD +++ /dev/null @@ -1,15 +0,0 @@ -more_itertools-10.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -more_itertools-10.3.0.dist-info/LICENSE,sha256=CfHIyelBrz5YTVlkHqm4fYPAyw_QB-te85Gn4mQ8GkY,1053 -more_itertools-10.3.0.dist-info/METADATA,sha256=BFO90O-fLNiVQMpj7oIS5ztzgJUUQZ3TA32P5HH3N-A,36293 -more_itertools-10.3.0.dist-info/RECORD,, -more_itertools-10.3.0.dist-info/WHEEL,sha256=rSgq_JpHF9fHR1lx53qwg_1-2LypZE_qmcuXbVUq948,81 -more_itertools/__init__.py,sha256=dtAbGjTDmn_ghiU5YXfhyDy0phAlXVdt5klZA5fUa-Q,149 -more_itertools/__init__.pyi,sha256=5B3eTzON1BBuOLob1vCflyEb2lSd6usXQQ-Cv-hXkeA,43 -more_itertools/__pycache__/__init__.cpython-312.pyc,, -more_itertools/__pycache__/more.cpython-312.pyc,, -more_itertools/__pycache__/recipes.cpython-312.pyc,, -more_itertools/more.py,sha256=1E5kzFncRKTDw0cYv1yRXMgDdunstLQd1QStcnL6U90,148370 -more_itertools/more.pyi,sha256=iXXeqt48Nxe8VGmIWpkVXuKpR2FYNuu2DU8nQLWCCu0,21484 -more_itertools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -more_itertools/recipes.py,sha256=WedhhfhGVgr6zii8fIbGJVmRTw0ZKRiLKnYBDGJv4nY,28591 -more_itertools/recipes.pyi,sha256=T_mdGpcFdfrP3JSWbwzYP9JyNV-Go-7RPfpxfftAWlA,4617 diff --git a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/WHEEL b/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/WHEEL deleted file mode 100644 index db4a255f3a..0000000000 --- a/pkg_resources/_vendor/more_itertools-10.3.0.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.8.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/pkg_resources/_vendor/more_itertools/__init__.py b/pkg_resources/_vendor/more_itertools/__init__.py deleted file mode 100644 index 9c4662fc31..0000000000 --- a/pkg_resources/_vendor/more_itertools/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""More routines for operating on iterables, beyond itertools""" - -from .more import * # noqa -from .recipes import * # noqa - -__version__ = '10.3.0' diff --git a/pkg_resources/_vendor/more_itertools/__init__.pyi b/pkg_resources/_vendor/more_itertools/__init__.pyi deleted file mode 100644 index 96f6e36c7f..0000000000 --- a/pkg_resources/_vendor/more_itertools/__init__.pyi +++ /dev/null @@ -1,2 +0,0 @@ -from .more import * -from .recipes import * diff --git a/pkg_resources/_vendor/more_itertools/more.py b/pkg_resources/_vendor/more_itertools/more.py deleted file mode 100755 index 7b481907da..0000000000 --- a/pkg_resources/_vendor/more_itertools/more.py +++ /dev/null @@ -1,4806 +0,0 @@ -import math -import warnings - -from collections import Counter, defaultdict, deque, abc -from collections.abc import Sequence -from functools import cached_property, partial, reduce, wraps -from heapq import heapify, heapreplace, heappop -from itertools import ( - chain, - combinations, - compress, - count, - cycle, - dropwhile, - groupby, - islice, - repeat, - starmap, - takewhile, - tee, - zip_longest, - product, -) -from math import comb, e, exp, factorial, floor, fsum, log, perm, tau -from queue import Empty, Queue -from random import random, randrange, uniform -from operator import itemgetter, mul, sub, gt, lt, ge, le -from sys import hexversion, maxsize -from time import monotonic - -from .recipes import ( - _marker, - _zip_equal, - UnequalIterablesError, - consume, - flatten, - pairwise, - powerset, - take, - unique_everseen, - all_equal, - batched, -) - -__all__ = [ - 'AbortThread', - 'SequenceView', - 'UnequalIterablesError', - 'adjacent', - 'all_unique', - 'always_iterable', - 'always_reversible', - 'bucket', - 'callback_iter', - 'chunked', - 'chunked_even', - 'circular_shifts', - 'collapse', - 'combination_index', - 'combination_with_replacement_index', - 'consecutive_groups', - 'constrained_batches', - 'consumer', - 'count_cycle', - 'countable', - 'dft', - 'difference', - 'distinct_combinations', - 'distinct_permutations', - 'distribute', - 'divide', - 'doublestarmap', - 'duplicates_everseen', - 'duplicates_justseen', - 'classify_unique', - 'exactly_n', - 'filter_except', - 'filter_map', - 'first', - 'gray_product', - 'groupby_transform', - 'ichunked', - 'iequals', - 'idft', - 'ilen', - 'interleave', - 'interleave_evenly', - 'interleave_longest', - 'intersperse', - 'is_sorted', - 'islice_extended', - 'iterate', - 'iter_suppress', - 'join_mappings', - 'last', - 'locate', - 'longest_common_prefix', - 'lstrip', - 'make_decorator', - 'map_except', - 'map_if', - 'map_reduce', - 'mark_ends', - 'minmax', - 'nth_or_last', - 'nth_permutation', - 'nth_product', - 'nth_combination_with_replacement', - 'numeric_range', - 'one', - 'only', - 'outer_product', - 'padded', - 'partial_product', - 'partitions', - 'peekable', - 'permutation_index', - 'powerset_of_sets', - 'product_index', - 'raise_', - 'repeat_each', - 'repeat_last', - 'replace', - 'rlocate', - 'rstrip', - 'run_length', - 'sample', - 'seekable', - 'set_partitions', - 'side_effect', - 'sliced', - 'sort_together', - 'split_after', - 'split_at', - 'split_before', - 'split_into', - 'split_when', - 'spy', - 'stagger', - 'strip', - 'strictly_n', - 'substrings', - 'substrings_indexes', - 'takewhile_inclusive', - 'time_limited', - 'unique_in_window', - 'unique_to_each', - 'unzip', - 'value_chain', - 'windowed', - 'windowed_complete', - 'with_iter', - 'zip_broadcast', - 'zip_equal', - 'zip_offset', -] - -# math.sumprod is available for Python 3.12+ -_fsumprod = getattr(math, 'sumprod', lambda x, y: fsum(map(mul, x, y))) - - -def chunked(iterable, n, strict=False): - """Break *iterable* into lists of length *n*: - - >>> list(chunked([1, 2, 3, 4, 5, 6], 3)) - [[1, 2, 3], [4, 5, 6]] - - By the default, the last yielded list will have fewer than *n* elements - if the length of *iterable* is not divisible by *n*: - - >>> list(chunked([1, 2, 3, 4, 5, 6, 7, 8], 3)) - [[1, 2, 3], [4, 5, 6], [7, 8]] - - To use a fill-in value instead, see the :func:`grouper` recipe. - - If the length of *iterable* is not divisible by *n* and *strict* is - ``True``, then ``ValueError`` will be raised before the last - list is yielded. - - """ - iterator = iter(partial(take, n, iter(iterable)), []) - if strict: - if n is None: - raise ValueError('n must not be None when using strict mode.') - - def ret(): - for chunk in iterator: - if len(chunk) != n: - raise ValueError('iterable is not divisible by n.') - yield chunk - - return iter(ret()) - else: - return iterator - - -def first(iterable, default=_marker): - """Return the first item of *iterable*, or *default* if *iterable* is - empty. - - >>> first([0, 1, 2, 3]) - 0 - >>> first([], 'some default') - 'some default' - - If *default* is not provided and there are no items in the iterable, - raise ``ValueError``. - - :func:`first` is useful when you have a generator of expensive-to-retrieve - values and want any arbitrary one. It is marginally shorter than - ``next(iter(iterable), default)``. - - """ - for item in iterable: - return item - if default is _marker: - raise ValueError( - 'first() was called on an empty iterable, and no ' - 'default value was provided.' - ) - return default - - -def last(iterable, default=_marker): - """Return the last item of *iterable*, or *default* if *iterable* is - empty. - - >>> last([0, 1, 2, 3]) - 3 - >>> last([], 'some default') - 'some default' - - If *default* is not provided and there are no items in the iterable, - raise ``ValueError``. - """ - try: - if isinstance(iterable, Sequence): - return iterable[-1] - # Work around https://bugs.python.org/issue38525 - elif hasattr(iterable, '__reversed__') and (hexversion != 0x030800F0): - return next(reversed(iterable)) - else: - return deque(iterable, maxlen=1)[-1] - except (IndexError, TypeError, StopIteration): - if default is _marker: - raise ValueError( - 'last() was called on an empty iterable, and no default was ' - 'provided.' - ) - return default - - -def nth_or_last(iterable, n, default=_marker): - """Return the nth or the last item of *iterable*, - or *default* if *iterable* is empty. - - >>> nth_or_last([0, 1, 2, 3], 2) - 2 - >>> nth_or_last([0, 1], 2) - 1 - >>> nth_or_last([], 0, 'some default') - 'some default' - - If *default* is not provided and there are no items in the iterable, - raise ``ValueError``. - """ - return last(islice(iterable, n + 1), default=default) - - -class peekable: - """Wrap an iterator to allow lookahead and prepending elements. - - Call :meth:`peek` on the result to get the value that will be returned - by :func:`next`. This won't advance the iterator: - - >>> p = peekable(['a', 'b']) - >>> p.peek() - 'a' - >>> next(p) - 'a' - - Pass :meth:`peek` a default value to return that instead of raising - ``StopIteration`` when the iterator is exhausted. - - >>> p = peekable([]) - >>> p.peek('hi') - 'hi' - - peekables also offer a :meth:`prepend` method, which "inserts" items - at the head of the iterable: - - >>> p = peekable([1, 2, 3]) - >>> p.prepend(10, 11, 12) - >>> next(p) - 10 - >>> p.peek() - 11 - >>> list(p) - [11, 12, 1, 2, 3] - - peekables can be indexed. Index 0 is the item that will be returned by - :func:`next`, index 1 is the item after that, and so on: - The values up to the given index will be cached. - - >>> p = peekable(['a', 'b', 'c', 'd']) - >>> p[0] - 'a' - >>> p[1] - 'b' - >>> next(p) - 'a' - - Negative indexes are supported, but be aware that they will cache the - remaining items in the source iterator, which may require significant - storage. - - To check whether a peekable is exhausted, check its truth value: - - >>> p = peekable(['a', 'b']) - >>> if p: # peekable has items - ... list(p) - ['a', 'b'] - >>> if not p: # peekable is exhausted - ... list(p) - [] - - """ - - def __init__(self, iterable): - self._it = iter(iterable) - self._cache = deque() - - def __iter__(self): - return self - - def __bool__(self): - try: - self.peek() - except StopIteration: - return False - return True - - def peek(self, default=_marker): - """Return the item that will be next returned from ``next()``. - - Return ``default`` if there are no items left. If ``default`` is not - provided, raise ``StopIteration``. - - """ - if not self._cache: - try: - self._cache.append(next(self._it)) - except StopIteration: - if default is _marker: - raise - return default - return self._cache[0] - - def prepend(self, *items): - """Stack up items to be the next ones returned from ``next()`` or - ``self.peek()``. The items will be returned in - first in, first out order:: - - >>> p = peekable([1, 2, 3]) - >>> p.prepend(10, 11, 12) - >>> next(p) - 10 - >>> list(p) - [11, 12, 1, 2, 3] - - It is possible, by prepending items, to "resurrect" a peekable that - previously raised ``StopIteration``. - - >>> p = peekable([]) - >>> next(p) - Traceback (most recent call last): - ... - StopIteration - >>> p.prepend(1) - >>> next(p) - 1 - >>> next(p) - Traceback (most recent call last): - ... - StopIteration - - """ - self._cache.extendleft(reversed(items)) - - def __next__(self): - if self._cache: - return self._cache.popleft() - - return next(self._it) - - def _get_slice(self, index): - # Normalize the slice's arguments - step = 1 if (index.step is None) else index.step - if step > 0: - start = 0 if (index.start is None) else index.start - stop = maxsize if (index.stop is None) else index.stop - elif step < 0: - start = -1 if (index.start is None) else index.start - stop = (-maxsize - 1) if (index.stop is None) else index.stop - else: - raise ValueError('slice step cannot be zero') - - # If either the start or stop index is negative, we'll need to cache - # the rest of the iterable in order to slice from the right side. - if (start < 0) or (stop < 0): - self._cache.extend(self._it) - # Otherwise we'll need to find the rightmost index and cache to that - # point. - else: - n = min(max(start, stop) + 1, maxsize) - cache_len = len(self._cache) - if n >= cache_len: - self._cache.extend(islice(self._it, n - cache_len)) - - return list(self._cache)[index] - - def __getitem__(self, index): - if isinstance(index, slice): - return self._get_slice(index) - - cache_len = len(self._cache) - if index < 0: - self._cache.extend(self._it) - elif index >= cache_len: - self._cache.extend(islice(self._it, index + 1 - cache_len)) - - return self._cache[index] - - -def consumer(func): - """Decorator that automatically advances a PEP-342-style "reverse iterator" - to its first yield point so you don't have to call ``next()`` on it - manually. - - >>> @consumer - ... def tally(): - ... i = 0 - ... while True: - ... print('Thing number %s is %s.' % (i, (yield))) - ... i += 1 - ... - >>> t = tally() - >>> t.send('red') - Thing number 0 is red. - >>> t.send('fish') - Thing number 1 is fish. - - Without the decorator, you would have to call ``next(t)`` before - ``t.send()`` could be used. - - """ - - @wraps(func) - def wrapper(*args, **kwargs): - gen = func(*args, **kwargs) - next(gen) - return gen - - return wrapper - - -def ilen(iterable): - """Return the number of items in *iterable*. - - >>> ilen(x for x in range(1000000) if x % 3 == 0) - 333334 - - This consumes the iterable, so handle with care. - - """ - # This approach was selected because benchmarks showed it's likely the - # fastest of the known implementations at the time of writing. - # See GitHub tracker: #236, #230. - counter = count() - deque(zip(iterable, counter), maxlen=0) - return next(counter) - - -def iterate(func, start): - """Return ``start``, ``func(start)``, ``func(func(start))``, ... - - >>> from itertools import islice - >>> list(islice(iterate(lambda x: 2*x, 1), 10)) - [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] - - """ - while True: - yield start - try: - start = func(start) - except StopIteration: - break - - -def with_iter(context_manager): - """Wrap an iterable in a ``with`` statement, so it closes once exhausted. - - For example, this will close the file when the iterator is exhausted:: - - upper_lines = (line.upper() for line in with_iter(open('foo'))) - - Any context manager which returns an iterable is a candidate for - ``with_iter``. - - """ - with context_manager as iterable: - yield from iterable - - -def one(iterable, too_short=None, too_long=None): - """Return the first item from *iterable*, which is expected to contain only - that item. Raise an exception if *iterable* is empty or has more than one - item. - - :func:`one` is useful for ensuring that an iterable contains only one item. - For example, it can be used to retrieve the result of a database query - that is expected to return a single row. - - If *iterable* is empty, ``ValueError`` will be raised. You may specify a - different exception with the *too_short* keyword: - - >>> it = [] - >>> one(it) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - ValueError: too many items in iterable (expected 1)' - >>> too_short = IndexError('too few items') - >>> one(it, too_short=too_short) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - IndexError: too few items - - Similarly, if *iterable* contains more than one item, ``ValueError`` will - be raised. You may specify a different exception with the *too_long* - keyword: - - >>> it = ['too', 'many'] - >>> one(it) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - ValueError: Expected exactly one item in iterable, but got 'too', - 'many', and perhaps more. - >>> too_long = RuntimeError - >>> one(it, too_long=too_long) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - RuntimeError - - Note that :func:`one` attempts to advance *iterable* twice to ensure there - is only one item. See :func:`spy` or :func:`peekable` to check iterable - contents less destructively. - - """ - it = iter(iterable) - - try: - first_value = next(it) - except StopIteration as exc: - raise ( - too_short or ValueError('too few items in iterable (expected 1)') - ) from exc - - try: - second_value = next(it) - except StopIteration: - pass - else: - msg = ( - 'Expected exactly one item in iterable, but got {!r}, {!r}, ' - 'and perhaps more.'.format(first_value, second_value) - ) - raise too_long or ValueError(msg) - - return first_value - - -def raise_(exception, *args): - raise exception(*args) - - -def strictly_n(iterable, n, too_short=None, too_long=None): - """Validate that *iterable* has exactly *n* items and return them if - it does. If it has fewer than *n* items, call function *too_short* - with those items. If it has more than *n* items, call function - *too_long* with the first ``n + 1`` items. - - >>> iterable = ['a', 'b', 'c', 'd'] - >>> n = 4 - >>> list(strictly_n(iterable, n)) - ['a', 'b', 'c', 'd'] - - Note that the returned iterable must be consumed in order for the check to - be made. - - By default, *too_short* and *too_long* are functions that raise - ``ValueError``. - - >>> list(strictly_n('ab', 3)) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - ValueError: too few items in iterable (got 2) - - >>> list(strictly_n('abc', 2)) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - ValueError: too many items in iterable (got at least 3) - - You can instead supply functions that do something else. - *too_short* will be called with the number of items in *iterable*. - *too_long* will be called with `n + 1`. - - >>> def too_short(item_count): - ... raise RuntimeError - >>> it = strictly_n('abcd', 6, too_short=too_short) - >>> list(it) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - RuntimeError - - >>> def too_long(item_count): - ... print('The boss is going to hear about this') - >>> it = strictly_n('abcdef', 4, too_long=too_long) - >>> list(it) - The boss is going to hear about this - ['a', 'b', 'c', 'd'] - - """ - if too_short is None: - too_short = lambda item_count: raise_( - ValueError, - 'Too few items in iterable (got {})'.format(item_count), - ) - - if too_long is None: - too_long = lambda item_count: raise_( - ValueError, - 'Too many items in iterable (got at least {})'.format(item_count), - ) - - it = iter(iterable) - for i in range(n): - try: - item = next(it) - except StopIteration: - too_short(i) - return - else: - yield item - - try: - next(it) - except StopIteration: - pass - else: - too_long(n + 1) - - -def distinct_permutations(iterable, r=None): - """Yield successive distinct permutations of the elements in *iterable*. - - >>> sorted(distinct_permutations([1, 0, 1])) - [(0, 1, 1), (1, 0, 1), (1, 1, 0)] - - Equivalent to ``set(permutations(iterable))``, except duplicates are not - generated and thrown away. For larger input sequences this is much more - efficient. - - Duplicate permutations arise when there are duplicated elements in the - input iterable. The number of items returned is - `n! / (x_1! * x_2! * ... * x_n!)`, where `n` is the total number of - items input, and each `x_i` is the count of a distinct item in the input - sequence. - - If *r* is given, only the *r*-length permutations are yielded. - - >>> sorted(distinct_permutations([1, 0, 1], r=2)) - [(0, 1), (1, 0), (1, 1)] - >>> sorted(distinct_permutations(range(3), r=2)) - [(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)] - - """ - - # Algorithm: https://w.wiki/Qai - def _full(A): - while True: - # Yield the permutation we have - yield tuple(A) - - # Find the largest index i such that A[i] < A[i + 1] - for i in range(size - 2, -1, -1): - if A[i] < A[i + 1]: - break - # If no such index exists, this permutation is the last one - else: - return - - # Find the largest index j greater than j such that A[i] < A[j] - for j in range(size - 1, i, -1): - if A[i] < A[j]: - break - - # Swap the value of A[i] with that of A[j], then reverse the - # sequence from A[i + 1] to form the new permutation - A[i], A[j] = A[j], A[i] - A[i + 1 :] = A[: i - size : -1] # A[i + 1:][::-1] - - # Algorithm: modified from the above - def _partial(A, r): - # Split A into the first r items and the last r items - head, tail = A[:r], A[r:] - right_head_indexes = range(r - 1, -1, -1) - left_tail_indexes = range(len(tail)) - - while True: - # Yield the permutation we have - yield tuple(head) - - # Starting from the right, find the first index of the head with - # value smaller than the maximum value of the tail - call it i. - pivot = tail[-1] - for i in right_head_indexes: - if head[i] < pivot: - break - pivot = head[i] - else: - return - - # Starting from the left, find the first value of the tail - # with a value greater than head[i] and swap. - for j in left_tail_indexes: - if tail[j] > head[i]: - head[i], tail[j] = tail[j], head[i] - break - # If we didn't find one, start from the right and find the first - # index of the head with a value greater than head[i] and swap. - else: - for j in right_head_indexes: - if head[j] > head[i]: - head[i], head[j] = head[j], head[i] - break - - # Reverse head[i + 1:] and swap it with tail[:r - (i + 1)] - tail += head[: i - r : -1] # head[i + 1:][::-1] - i += 1 - head[i:], tail[:] = tail[: r - i], tail[r - i :] - - items = sorted(iterable) - - size = len(items) - if r is None: - r = size - - if 0 < r <= size: - return _full(items) if (r == size) else _partial(items, r) - - return iter(() if r else ((),)) - - -def intersperse(e, iterable, n=1): - """Intersperse filler element *e* among the items in *iterable*, leaving - *n* items between each filler element. - - >>> list(intersperse('!', [1, 2, 3, 4, 5])) - [1, '!', 2, '!', 3, '!', 4, '!', 5] - - >>> list(intersperse(None, [1, 2, 3, 4, 5], n=2)) - [1, 2, None, 3, 4, None, 5] - - """ - if n == 0: - raise ValueError('n must be > 0') - elif n == 1: - # interleave(repeat(e), iterable) -> e, x_0, e, x_1, e, x_2... - # islice(..., 1, None) -> x_0, e, x_1, e, x_2... - return islice(interleave(repeat(e), iterable), 1, None) - else: - # interleave(filler, chunks) -> [e], [x_0, x_1], [e], [x_2, x_3]... - # islice(..., 1, None) -> [x_0, x_1], [e], [x_2, x_3]... - # flatten(...) -> x_0, x_1, e, x_2, x_3... - filler = repeat([e]) - chunks = chunked(iterable, n) - return flatten(islice(interleave(filler, chunks), 1, None)) - - -def unique_to_each(*iterables): - """Return the elements from each of the input iterables that aren't in the - other input iterables. - - For example, suppose you have a set of packages, each with a set of - dependencies:: - - {'pkg_1': {'A', 'B'}, 'pkg_2': {'B', 'C'}, 'pkg_3': {'B', 'D'}} - - If you remove one package, which dependencies can also be removed? - - If ``pkg_1`` is removed, then ``A`` is no longer necessary - it is not - associated with ``pkg_2`` or ``pkg_3``. Similarly, ``C`` is only needed for - ``pkg_2``, and ``D`` is only needed for ``pkg_3``:: - - >>> unique_to_each({'A', 'B'}, {'B', 'C'}, {'B', 'D'}) - [['A'], ['C'], ['D']] - - If there are duplicates in one input iterable that aren't in the others - they will be duplicated in the output. Input order is preserved:: - - >>> unique_to_each("mississippi", "missouri") - [['p', 'p'], ['o', 'u', 'r']] - - It is assumed that the elements of each iterable are hashable. - - """ - pool = [list(it) for it in iterables] - counts = Counter(chain.from_iterable(map(set, pool))) - uniques = {element for element in counts if counts[element] == 1} - return [list(filter(uniques.__contains__, it)) for it in pool] - - -def windowed(seq, n, fillvalue=None, step=1): - """Return a sliding window of width *n* over the given iterable. - - >>> all_windows = windowed([1, 2, 3, 4, 5], 3) - >>> list(all_windows) - [(1, 2, 3), (2, 3, 4), (3, 4, 5)] - - When the window is larger than the iterable, *fillvalue* is used in place - of missing values: - - >>> list(windowed([1, 2, 3], 4)) - [(1, 2, 3, None)] - - Each window will advance in increments of *step*: - - >>> list(windowed([1, 2, 3, 4, 5, 6], 3, fillvalue='!', step=2)) - [(1, 2, 3), (3, 4, 5), (5, 6, '!')] - - To slide into the iterable's items, use :func:`chain` to add filler items - to the left: - - >>> iterable = [1, 2, 3, 4] - >>> n = 3 - >>> padding = [None] * (n - 1) - >>> list(windowed(chain(padding, iterable), 3)) - [(None, None, 1), (None, 1, 2), (1, 2, 3), (2, 3, 4)] - """ - if n < 0: - raise ValueError('n must be >= 0') - if n == 0: - yield () - return - if step < 1: - raise ValueError('step must be >= 1') - - iterable = iter(seq) - - # Generate first window - window = deque(islice(iterable, n), maxlen=n) - - # Deal with the first window not being full - if not window: - return - if len(window) < n: - yield tuple(window) + ((fillvalue,) * (n - len(window))) - return - yield tuple(window) - - # Create the filler for the next windows. The padding ensures - # we have just enough elements to fill the last window. - padding = (fillvalue,) * (n - 1 if step >= n else step - 1) - filler = map(window.append, chain(iterable, padding)) - - # Generate the rest of the windows - for _ in islice(filler, step - 1, None, step): - yield tuple(window) - - -def substrings(iterable): - """Yield all of the substrings of *iterable*. - - >>> [''.join(s) for s in substrings('more')] - ['m', 'o', 'r', 'e', 'mo', 'or', 're', 'mor', 'ore', 'more'] - - Note that non-string iterables can also be subdivided. - - >>> list(substrings([0, 1, 2])) - [(0,), (1,), (2,), (0, 1), (1, 2), (0, 1, 2)] - - """ - # The length-1 substrings - seq = [] - for item in iter(iterable): - seq.append(item) - yield (item,) - seq = tuple(seq) - item_count = len(seq) - - # And the rest - for n in range(2, item_count + 1): - for i in range(item_count - n + 1): - yield seq[i : i + n] - - -def substrings_indexes(seq, reverse=False): - """Yield all substrings and their positions in *seq* - - The items yielded will be a tuple of the form ``(substr, i, j)``, where - ``substr == seq[i:j]``. - - This function only works for iterables that support slicing, such as - ``str`` objects. - - >>> for item in substrings_indexes('more'): - ... print(item) - ('m', 0, 1) - ('o', 1, 2) - ('r', 2, 3) - ('e', 3, 4) - ('mo', 0, 2) - ('or', 1, 3) - ('re', 2, 4) - ('mor', 0, 3) - ('ore', 1, 4) - ('more', 0, 4) - - Set *reverse* to ``True`` to yield the same items in the opposite order. - - - """ - r = range(1, len(seq) + 1) - if reverse: - r = reversed(r) - return ( - (seq[i : i + L], i, i + L) for L in r for i in range(len(seq) - L + 1) - ) - - -class bucket: - """Wrap *iterable* and return an object that buckets the iterable into - child iterables based on a *key* function. - - >>> iterable = ['a1', 'b1', 'c1', 'a2', 'b2', 'c2', 'b3'] - >>> s = bucket(iterable, key=lambda x: x[0]) # Bucket by 1st character - >>> sorted(list(s)) # Get the keys - ['a', 'b', 'c'] - >>> a_iterable = s['a'] - >>> next(a_iterable) - 'a1' - >>> next(a_iterable) - 'a2' - >>> list(s['b']) - ['b1', 'b2', 'b3'] - - The original iterable will be advanced and its items will be cached until - they are used by the child iterables. This may require significant storage. - - By default, attempting to select a bucket to which no items belong will - exhaust the iterable and cache all values. - If you specify a *validator* function, selected buckets will instead be - checked against it. - - >>> from itertools import count - >>> it = count(1, 2) # Infinite sequence of odd numbers - >>> key = lambda x: x % 10 # Bucket by last digit - >>> validator = lambda x: x in {1, 3, 5, 7, 9} # Odd digits only - >>> s = bucket(it, key=key, validator=validator) - >>> 2 in s - False - >>> list(s[2]) - [] - - """ - - def __init__(self, iterable, key, validator=None): - self._it = iter(iterable) - self._key = key - self._cache = defaultdict(deque) - self._validator = validator or (lambda x: True) - - def __contains__(self, value): - if not self._validator(value): - return False - - try: - item = next(self[value]) - except StopIteration: - return False - else: - self._cache[value].appendleft(item) - - return True - - def _get_values(self, value): - """ - Helper to yield items from the parent iterator that match *value*. - Items that don't match are stored in the local cache as they - are encountered. - """ - while True: - # If we've cached some items that match the target value, emit - # the first one and evict it from the cache. - if self._cache[value]: - yield self._cache[value].popleft() - # Otherwise we need to advance the parent iterator to search for - # a matching item, caching the rest. - else: - while True: - try: - item = next(self._it) - except StopIteration: - return - item_value = self._key(item) - if item_value == value: - yield item - break - elif self._validator(item_value): - self._cache[item_value].append(item) - - def __iter__(self): - for item in self._it: - item_value = self._key(item) - if self._validator(item_value): - self._cache[item_value].append(item) - - yield from self._cache.keys() - - def __getitem__(self, value): - if not self._validator(value): - return iter(()) - - return self._get_values(value) - - -def spy(iterable, n=1): - """Return a 2-tuple with a list containing the first *n* elements of - *iterable*, and an iterator with the same items as *iterable*. - This allows you to "look ahead" at the items in the iterable without - advancing it. - - There is one item in the list by default: - - >>> iterable = 'abcdefg' - >>> head, iterable = spy(iterable) - >>> head - ['a'] - >>> list(iterable) - ['a', 'b', 'c', 'd', 'e', 'f', 'g'] - - You may use unpacking to retrieve items instead of lists: - - >>> (head,), iterable = spy('abcdefg') - >>> head - 'a' - >>> (first, second), iterable = spy('abcdefg', 2) - >>> first - 'a' - >>> second - 'b' - - The number of items requested can be larger than the number of items in - the iterable: - - >>> iterable = [1, 2, 3, 4, 5] - >>> head, iterable = spy(iterable, 10) - >>> head - [1, 2, 3, 4, 5] - >>> list(iterable) - [1, 2, 3, 4, 5] - - """ - it = iter(iterable) - head = take(n, it) - - return head.copy(), chain(head, it) - - -def interleave(*iterables): - """Return a new iterable yielding from each iterable in turn, - until the shortest is exhausted. - - >>> list(interleave([1, 2, 3], [4, 5], [6, 7, 8])) - [1, 4, 6, 2, 5, 7] - - For a version that doesn't terminate after the shortest iterable is - exhausted, see :func:`interleave_longest`. - - """ - return chain.from_iterable(zip(*iterables)) - - -def interleave_longest(*iterables): - """Return a new iterable yielding from each iterable in turn, - skipping any that are exhausted. - - >>> list(interleave_longest([1, 2, 3], [4, 5], [6, 7, 8])) - [1, 4, 6, 2, 5, 7, 3, 8] - - This function produces the same output as :func:`roundrobin`, but may - perform better for some inputs (in particular when the number of iterables - is large). - - """ - i = chain.from_iterable(zip_longest(*iterables, fillvalue=_marker)) - return (x for x in i if x is not _marker) - - -def interleave_evenly(iterables, lengths=None): - """ - Interleave multiple iterables so that their elements are evenly distributed - throughout the output sequence. - - >>> iterables = [1, 2, 3, 4, 5], ['a', 'b'] - >>> list(interleave_evenly(iterables)) - [1, 2, 'a', 3, 4, 'b', 5] - - >>> iterables = [[1, 2, 3], [4, 5], [6, 7, 8]] - >>> list(interleave_evenly(iterables)) - [1, 6, 4, 2, 7, 3, 8, 5] - - This function requires iterables of known length. Iterables without - ``__len__()`` can be used by manually specifying lengths with *lengths*: - - >>> from itertools import combinations, repeat - >>> iterables = [combinations(range(4), 2), ['a', 'b', 'c']] - >>> lengths = [4 * (4 - 1) // 2, 3] - >>> list(interleave_evenly(iterables, lengths=lengths)) - [(0, 1), (0, 2), 'a', (0, 3), (1, 2), 'b', (1, 3), (2, 3), 'c'] - - Based on Bresenham's algorithm. - """ - if lengths is None: - try: - lengths = [len(it) for it in iterables] - except TypeError: - raise ValueError( - 'Iterable lengths could not be determined automatically. ' - 'Specify them with the lengths keyword.' - ) - elif len(iterables) != len(lengths): - raise ValueError('Mismatching number of iterables and lengths.') - - dims = len(lengths) - - # sort iterables by length, descending - lengths_permute = sorted( - range(dims), key=lambda i: lengths[i], reverse=True - ) - lengths_desc = [lengths[i] for i in lengths_permute] - iters_desc = [iter(iterables[i]) for i in lengths_permute] - - # the longest iterable is the primary one (Bresenham: the longest - # distance along an axis) - delta_primary, deltas_secondary = lengths_desc[0], lengths_desc[1:] - iter_primary, iters_secondary = iters_desc[0], iters_desc[1:] - errors = [delta_primary // dims] * len(deltas_secondary) - - to_yield = sum(lengths) - while to_yield: - yield next(iter_primary) - to_yield -= 1 - # update errors for each secondary iterable - errors = [e - delta for e, delta in zip(errors, deltas_secondary)] - - # those iterables for which the error is negative are yielded - # ("diagonal step" in Bresenham) - for i, e_ in enumerate(errors): - if e_ < 0: - yield next(iters_secondary[i]) - to_yield -= 1 - errors[i] += delta_primary - - -def collapse(iterable, base_type=None, levels=None): - """Flatten an iterable with multiple levels of nesting (e.g., a list of - lists of tuples) into non-iterable types. - - >>> iterable = [(1, 2), ([3, 4], [[5], [6]])] - >>> list(collapse(iterable)) - [1, 2, 3, 4, 5, 6] - - Binary and text strings are not considered iterable and - will not be collapsed. - - To avoid collapsing other types, specify *base_type*: - - >>> iterable = ['ab', ('cd', 'ef'), ['gh', 'ij']] - >>> list(collapse(iterable, base_type=tuple)) - ['ab', ('cd', 'ef'), 'gh', 'ij'] - - Specify *levels* to stop flattening after a certain level: - - >>> iterable = [('a', ['b']), ('c', ['d'])] - >>> list(collapse(iterable)) # Fully flattened - ['a', 'b', 'c', 'd'] - >>> list(collapse(iterable, levels=1)) # Only one level flattened - ['a', ['b'], 'c', ['d']] - - """ - stack = deque() - # Add our first node group, treat the iterable as a single node - stack.appendleft((0, repeat(iterable, 1))) - - while stack: - node_group = stack.popleft() - level, nodes = node_group - - # Check if beyond max level - if levels is not None and level > levels: - yield from nodes - continue - - for node in nodes: - # Check if done iterating - if isinstance(node, (str, bytes)) or ( - (base_type is not None) and isinstance(node, base_type) - ): - yield node - # Otherwise try to create child nodes - else: - try: - tree = iter(node) - except TypeError: - yield node - else: - # Save our current location - stack.appendleft(node_group) - # Append the new child node - stack.appendleft((level + 1, tree)) - # Break to process child node - break - - -def side_effect(func, iterable, chunk_size=None, before=None, after=None): - """Invoke *func* on each item in *iterable* (or on each *chunk_size* group - of items) before yielding the item. - - `func` must be a function that takes a single argument. Its return value - will be discarded. - - *before* and *after* are optional functions that take no arguments. They - will be executed before iteration starts and after it ends, respectively. - - `side_effect` can be used for logging, updating progress bars, or anything - that is not functionally "pure." - - Emitting a status message: - - >>> from more_itertools import consume - >>> func = lambda item: print('Received {}'.format(item)) - >>> consume(side_effect(func, range(2))) - Received 0 - Received 1 - - Operating on chunks of items: - - >>> pair_sums = [] - >>> func = lambda chunk: pair_sums.append(sum(chunk)) - >>> list(side_effect(func, [0, 1, 2, 3, 4, 5], 2)) - [0, 1, 2, 3, 4, 5] - >>> list(pair_sums) - [1, 5, 9] - - Writing to a file-like object: - - >>> from io import StringIO - >>> from more_itertools import consume - >>> f = StringIO() - >>> func = lambda x: print(x, file=f) - >>> before = lambda: print(u'HEADER', file=f) - >>> after = f.close - >>> it = [u'a', u'b', u'c'] - >>> consume(side_effect(func, it, before=before, after=after)) - >>> f.closed - True - - """ - try: - if before is not None: - before() - - if chunk_size is None: - for item in iterable: - func(item) - yield item - else: - for chunk in chunked(iterable, chunk_size): - func(chunk) - yield from chunk - finally: - if after is not None: - after() - - -def sliced(seq, n, strict=False): - """Yield slices of length *n* from the sequence *seq*. - - >>> list(sliced((1, 2, 3, 4, 5, 6), 3)) - [(1, 2, 3), (4, 5, 6)] - - By the default, the last yielded slice will have fewer than *n* elements - if the length of *seq* is not divisible by *n*: - - >>> list(sliced((1, 2, 3, 4, 5, 6, 7, 8), 3)) - [(1, 2, 3), (4, 5, 6), (7, 8)] - - If the length of *seq* is not divisible by *n* and *strict* is - ``True``, then ``ValueError`` will be raised before the last - slice is yielded. - - This function will only work for iterables that support slicing. - For non-sliceable iterables, see :func:`chunked`. - - """ - iterator = takewhile(len, (seq[i : i + n] for i in count(0, n))) - if strict: - - def ret(): - for _slice in iterator: - if len(_slice) != n: - raise ValueError("seq is not divisible by n.") - yield _slice - - return iter(ret()) - else: - return iterator - - -def split_at(iterable, pred, maxsplit=-1, keep_separator=False): - """Yield lists of items from *iterable*, where each list is delimited by - an item where callable *pred* returns ``True``. - - >>> list(split_at('abcdcba', lambda x: x == 'b')) - [['a'], ['c', 'd', 'c'], ['a']] - - >>> list(split_at(range(10), lambda n: n % 2 == 1)) - [[0], [2], [4], [6], [8], []] - - At most *maxsplit* splits are done. If *maxsplit* is not specified or -1, - then there is no limit on the number of splits: - - >>> list(split_at(range(10), lambda n: n % 2 == 1, maxsplit=2)) - [[0], [2], [4, 5, 6, 7, 8, 9]] - - By default, the delimiting items are not included in the output. - To include them, set *keep_separator* to ``True``. - - >>> list(split_at('abcdcba', lambda x: x == 'b', keep_separator=True)) - [['a'], ['b'], ['c', 'd', 'c'], ['b'], ['a']] - - """ - if maxsplit == 0: - yield list(iterable) - return - - buf = [] - it = iter(iterable) - for item in it: - if pred(item): - yield buf - if keep_separator: - yield [item] - if maxsplit == 1: - yield list(it) - return - buf = [] - maxsplit -= 1 - else: - buf.append(item) - yield buf - - -def split_before(iterable, pred, maxsplit=-1): - """Yield lists of items from *iterable*, where each list ends just before - an item for which callable *pred* returns ``True``: - - >>> list(split_before('OneTwo', lambda s: s.isupper())) - [['O', 'n', 'e'], ['T', 'w', 'o']] - - >>> list(split_before(range(10), lambda n: n % 3 == 0)) - [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] - - At most *maxsplit* splits are done. If *maxsplit* is not specified or -1, - then there is no limit on the number of splits: - - >>> list(split_before(range(10), lambda n: n % 3 == 0, maxsplit=2)) - [[0, 1, 2], [3, 4, 5], [6, 7, 8, 9]] - """ - if maxsplit == 0: - yield list(iterable) - return - - buf = [] - it = iter(iterable) - for item in it: - if pred(item) and buf: - yield buf - if maxsplit == 1: - yield [item] + list(it) - return - buf = [] - maxsplit -= 1 - buf.append(item) - if buf: - yield buf - - -def split_after(iterable, pred, maxsplit=-1): - """Yield lists of items from *iterable*, where each list ends with an - item where callable *pred* returns ``True``: - - >>> list(split_after('one1two2', lambda s: s.isdigit())) - [['o', 'n', 'e', '1'], ['t', 'w', 'o', '2']] - - >>> list(split_after(range(10), lambda n: n % 3 == 0)) - [[0], [1, 2, 3], [4, 5, 6], [7, 8, 9]] - - At most *maxsplit* splits are done. If *maxsplit* is not specified or -1, - then there is no limit on the number of splits: - - >>> list(split_after(range(10), lambda n: n % 3 == 0, maxsplit=2)) - [[0], [1, 2, 3], [4, 5, 6, 7, 8, 9]] - - """ - if maxsplit == 0: - yield list(iterable) - return - - buf = [] - it = iter(iterable) - for item in it: - buf.append(item) - if pred(item) and buf: - yield buf - if maxsplit == 1: - buf = list(it) - if buf: - yield buf - return - buf = [] - maxsplit -= 1 - if buf: - yield buf - - -def split_when(iterable, pred, maxsplit=-1): - """Split *iterable* into pieces based on the output of *pred*. - *pred* should be a function that takes successive pairs of items and - returns ``True`` if the iterable should be split in between them. - - For example, to find runs of increasing numbers, split the iterable when - element ``i`` is larger than element ``i + 1``: - - >>> list(split_when([1, 2, 3, 3, 2, 5, 2, 4, 2], lambda x, y: x > y)) - [[1, 2, 3, 3], [2, 5], [2, 4], [2]] - - At most *maxsplit* splits are done. If *maxsplit* is not specified or -1, - then there is no limit on the number of splits: - - >>> list(split_when([1, 2, 3, 3, 2, 5, 2, 4, 2], - ... lambda x, y: x > y, maxsplit=2)) - [[1, 2, 3, 3], [2, 5], [2, 4, 2]] - - """ - if maxsplit == 0: - yield list(iterable) - return - - it = iter(iterable) - try: - cur_item = next(it) - except StopIteration: - return - - buf = [cur_item] - for next_item in it: - if pred(cur_item, next_item): - yield buf - if maxsplit == 1: - yield [next_item] + list(it) - return - buf = [] - maxsplit -= 1 - - buf.append(next_item) - cur_item = next_item - - yield buf - - -def split_into(iterable, sizes): - """Yield a list of sequential items from *iterable* of length 'n' for each - integer 'n' in *sizes*. - - >>> list(split_into([1,2,3,4,5,6], [1,2,3])) - [[1], [2, 3], [4, 5, 6]] - - If the sum of *sizes* is smaller than the length of *iterable*, then the - remaining items of *iterable* will not be returned. - - >>> list(split_into([1,2,3,4,5,6], [2,3])) - [[1, 2], [3, 4, 5]] - - If the sum of *sizes* is larger than the length of *iterable*, fewer items - will be returned in the iteration that overruns *iterable* and further - lists will be empty: - - >>> list(split_into([1,2,3,4], [1,2,3,4])) - [[1], [2, 3], [4], []] - - When a ``None`` object is encountered in *sizes*, the returned list will - contain items up to the end of *iterable* the same way that itertools.slice - does: - - >>> list(split_into([1,2,3,4,5,6,7,8,9,0], [2,3,None])) - [[1, 2], [3, 4, 5], [6, 7, 8, 9, 0]] - - :func:`split_into` can be useful for grouping a series of items where the - sizes of the groups are not uniform. An example would be where in a row - from a table, multiple columns represent elements of the same feature - (e.g. a point represented by x,y,z) but, the format is not the same for - all columns. - """ - # convert the iterable argument into an iterator so its contents can - # be consumed by islice in case it is a generator - it = iter(iterable) - - for size in sizes: - if size is None: - yield list(it) - return - else: - yield list(islice(it, size)) - - -def padded(iterable, fillvalue=None, n=None, next_multiple=False): - """Yield the elements from *iterable*, followed by *fillvalue*, such that - at least *n* items are emitted. - - >>> list(padded([1, 2, 3], '?', 5)) - [1, 2, 3, '?', '?'] - - If *next_multiple* is ``True``, *fillvalue* will be emitted until the - number of items emitted is a multiple of *n*: - - >>> list(padded([1, 2, 3, 4], n=3, next_multiple=True)) - [1, 2, 3, 4, None, None] - - If *n* is ``None``, *fillvalue* will be emitted indefinitely. - - To create an *iterable* of exactly size *n*, you can truncate with - :func:`islice`. - - >>> list(islice(padded([1, 2, 3], '?'), 5)) - [1, 2, 3, '?', '?'] - >>> list(islice(padded([1, 2, 3, 4, 5, 6, 7, 8], '?'), 5)) - [1, 2, 3, 4, 5] - - """ - iterable = iter(iterable) - iterable_with_repeat = chain(iterable, repeat(fillvalue)) - - if n is None: - return iterable_with_repeat - elif n < 1: - raise ValueError('n must be at least 1') - elif next_multiple: - - def slice_generator(): - for first in iterable: - yield (first,) - yield islice(iterable_with_repeat, n - 1) - - # While elements exist produce slices of size n - return chain.from_iterable(slice_generator()) - else: - # Ensure the first batch is at least size n then iterate - return chain(islice(iterable_with_repeat, n), iterable) - - -def repeat_each(iterable, n=2): - """Repeat each element in *iterable* *n* times. - - >>> list(repeat_each('ABC', 3)) - ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C'] - """ - return chain.from_iterable(map(repeat, iterable, repeat(n))) - - -def repeat_last(iterable, default=None): - """After the *iterable* is exhausted, keep yielding its last element. - - >>> list(islice(repeat_last(range(3)), 5)) - [0, 1, 2, 2, 2] - - If the iterable is empty, yield *default* forever:: - - >>> list(islice(repeat_last(range(0), 42), 5)) - [42, 42, 42, 42, 42] - - """ - item = _marker - for item in iterable: - yield item - final = default if item is _marker else item - yield from repeat(final) - - -def distribute(n, iterable): - """Distribute the items from *iterable* among *n* smaller iterables. - - >>> group_1, group_2 = distribute(2, [1, 2, 3, 4, 5, 6]) - >>> list(group_1) - [1, 3, 5] - >>> list(group_2) - [2, 4, 6] - - If the length of *iterable* is not evenly divisible by *n*, then the - length of the returned iterables will not be identical: - - >>> children = distribute(3, [1, 2, 3, 4, 5, 6, 7]) - >>> [list(c) for c in children] - [[1, 4, 7], [2, 5], [3, 6]] - - If the length of *iterable* is smaller than *n*, then the last returned - iterables will be empty: - - >>> children = distribute(5, [1, 2, 3]) - >>> [list(c) for c in children] - [[1], [2], [3], [], []] - - This function uses :func:`itertools.tee` and may require significant - storage. - - If you need the order items in the smaller iterables to match the - original iterable, see :func:`divide`. - - """ - if n < 1: - raise ValueError('n must be at least 1') - - children = tee(iterable, n) - return [islice(it, index, None, n) for index, it in enumerate(children)] - - -def stagger(iterable, offsets=(-1, 0, 1), longest=False, fillvalue=None): - """Yield tuples whose elements are offset from *iterable*. - The amount by which the `i`-th item in each tuple is offset is given by - the `i`-th item in *offsets*. - - >>> list(stagger([0, 1, 2, 3])) - [(None, 0, 1), (0, 1, 2), (1, 2, 3)] - >>> list(stagger(range(8), offsets=(0, 2, 4))) - [(0, 2, 4), (1, 3, 5), (2, 4, 6), (3, 5, 7)] - - By default, the sequence will end when the final element of a tuple is the - last item in the iterable. To continue until the first element of a tuple - is the last item in the iterable, set *longest* to ``True``:: - - >>> list(stagger([0, 1, 2, 3], longest=True)) - [(None, 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, None), (3, None, None)] - - By default, ``None`` will be used to replace offsets beyond the end of the - sequence. Specify *fillvalue* to use some other value. - - """ - children = tee(iterable, len(offsets)) - - return zip_offset( - *children, offsets=offsets, longest=longest, fillvalue=fillvalue - ) - - -def zip_equal(*iterables): - """``zip`` the input *iterables* together, but raise - ``UnequalIterablesError`` if they aren't all the same length. - - >>> it_1 = range(3) - >>> it_2 = iter('abc') - >>> list(zip_equal(it_1, it_2)) - [(0, 'a'), (1, 'b'), (2, 'c')] - - >>> it_1 = range(3) - >>> it_2 = iter('abcd') - >>> list(zip_equal(it_1, it_2)) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - more_itertools.more.UnequalIterablesError: Iterables have different - lengths - - """ - if hexversion >= 0x30A00A6: - warnings.warn( - ( - 'zip_equal will be removed in a future version of ' - 'more-itertools. Use the builtin zip function with ' - 'strict=True instead.' - ), - DeprecationWarning, - ) - - return _zip_equal(*iterables) - - -def zip_offset(*iterables, offsets, longest=False, fillvalue=None): - """``zip`` the input *iterables* together, but offset the `i`-th iterable - by the `i`-th item in *offsets*. - - >>> list(zip_offset('0123', 'abcdef', offsets=(0, 1))) - [('0', 'b'), ('1', 'c'), ('2', 'd'), ('3', 'e')] - - This can be used as a lightweight alternative to SciPy or pandas to analyze - data sets in which some series have a lead or lag relationship. - - By default, the sequence will end when the shortest iterable is exhausted. - To continue until the longest iterable is exhausted, set *longest* to - ``True``. - - >>> list(zip_offset('0123', 'abcdef', offsets=(0, 1), longest=True)) - [('0', 'b'), ('1', 'c'), ('2', 'd'), ('3', 'e'), (None, 'f')] - - By default, ``None`` will be used to replace offsets beyond the end of the - sequence. Specify *fillvalue* to use some other value. - - """ - if len(iterables) != len(offsets): - raise ValueError("Number of iterables and offsets didn't match") - - staggered = [] - for it, n in zip(iterables, offsets): - if n < 0: - staggered.append(chain(repeat(fillvalue, -n), it)) - elif n > 0: - staggered.append(islice(it, n, None)) - else: - staggered.append(it) - - if longest: - return zip_longest(*staggered, fillvalue=fillvalue) - - return zip(*staggered) - - -def sort_together(iterables, key_list=(0,), key=None, reverse=False): - """Return the input iterables sorted together, with *key_list* as the - priority for sorting. All iterables are trimmed to the length of the - shortest one. - - This can be used like the sorting function in a spreadsheet. If each - iterable represents a column of data, the key list determines which - columns are used for sorting. - - By default, all iterables are sorted using the ``0``-th iterable:: - - >>> iterables = [(4, 3, 2, 1), ('a', 'b', 'c', 'd')] - >>> sort_together(iterables) - [(1, 2, 3, 4), ('d', 'c', 'b', 'a')] - - Set a different key list to sort according to another iterable. - Specifying multiple keys dictates how ties are broken:: - - >>> iterables = [(3, 1, 2), (0, 1, 0), ('c', 'b', 'a')] - >>> sort_together(iterables, key_list=(1, 2)) - [(2, 3, 1), (0, 0, 1), ('a', 'c', 'b')] - - To sort by a function of the elements of the iterable, pass a *key* - function. Its arguments are the elements of the iterables corresponding to - the key list:: - - >>> names = ('a', 'b', 'c') - >>> lengths = (1, 2, 3) - >>> widths = (5, 2, 1) - >>> def area(length, width): - ... return length * width - >>> sort_together([names, lengths, widths], key_list=(1, 2), key=area) - [('c', 'b', 'a'), (3, 2, 1), (1, 2, 5)] - - Set *reverse* to ``True`` to sort in descending order. - - >>> sort_together([(1, 2, 3), ('c', 'b', 'a')], reverse=True) - [(3, 2, 1), ('a', 'b', 'c')] - - """ - if key is None: - # if there is no key function, the key argument to sorted is an - # itemgetter - key_argument = itemgetter(*key_list) - else: - # if there is a key function, call it with the items at the offsets - # specified by the key function as arguments - key_list = list(key_list) - if len(key_list) == 1: - # if key_list contains a single item, pass the item at that offset - # as the only argument to the key function - key_offset = key_list[0] - key_argument = lambda zipped_items: key(zipped_items[key_offset]) - else: - # if key_list contains multiple items, use itemgetter to return a - # tuple of items, which we pass as *args to the key function - get_key_items = itemgetter(*key_list) - key_argument = lambda zipped_items: key( - *get_key_items(zipped_items) - ) - - return list( - zip(*sorted(zip(*iterables), key=key_argument, reverse=reverse)) - ) - - -def unzip(iterable): - """The inverse of :func:`zip`, this function disaggregates the elements - of the zipped *iterable*. - - The ``i``-th iterable contains the ``i``-th element from each element - of the zipped iterable. The first element is used to determine the - length of the remaining elements. - - >>> iterable = [('a', 1), ('b', 2), ('c', 3), ('d', 4)] - >>> letters, numbers = unzip(iterable) - >>> list(letters) - ['a', 'b', 'c', 'd'] - >>> list(numbers) - [1, 2, 3, 4] - - This is similar to using ``zip(*iterable)``, but it avoids reading - *iterable* into memory. Note, however, that this function uses - :func:`itertools.tee` and thus may require significant storage. - - """ - head, iterable = spy(iter(iterable)) - if not head: - # empty iterable, e.g. zip([], [], []) - return () - # spy returns a one-length iterable as head - head = head[0] - iterables = tee(iterable, len(head)) - - def itemgetter(i): - def getter(obj): - try: - return obj[i] - except IndexError: - # basically if we have an iterable like - # iter([(1, 2, 3), (4, 5), (6,)]) - # the second unzipped iterable would fail at the third tuple - # since it would try to access tup[1] - # same with the third unzipped iterable and the second tuple - # to support these "improperly zipped" iterables, - # we create a custom itemgetter - # which just stops the unzipped iterables - # at first length mismatch - raise StopIteration - - return getter - - return tuple(map(itemgetter(i), it) for i, it in enumerate(iterables)) - - -def divide(n, iterable): - """Divide the elements from *iterable* into *n* parts, maintaining - order. - - >>> group_1, group_2 = divide(2, [1, 2, 3, 4, 5, 6]) - >>> list(group_1) - [1, 2, 3] - >>> list(group_2) - [4, 5, 6] - - If the length of *iterable* is not evenly divisible by *n*, then the - length of the returned iterables will not be identical: - - >>> children = divide(3, [1, 2, 3, 4, 5, 6, 7]) - >>> [list(c) for c in children] - [[1, 2, 3], [4, 5], [6, 7]] - - If the length of the iterable is smaller than n, then the last returned - iterables will be empty: - - >>> children = divide(5, [1, 2, 3]) - >>> [list(c) for c in children] - [[1], [2], [3], [], []] - - This function will exhaust the iterable before returning. - If order is not important, see :func:`distribute`, which does not first - pull the iterable into memory. - - """ - if n < 1: - raise ValueError('n must be at least 1') - - try: - iterable[:0] - except TypeError: - seq = tuple(iterable) - else: - seq = iterable - - q, r = divmod(len(seq), n) - - ret = [] - stop = 0 - for i in range(1, n + 1): - start = stop - stop += q + 1 if i <= r else q - ret.append(iter(seq[start:stop])) - - return ret - - -def always_iterable(obj, base_type=(str, bytes)): - """If *obj* is iterable, return an iterator over its items:: - - >>> obj = (1, 2, 3) - >>> list(always_iterable(obj)) - [1, 2, 3] - - If *obj* is not iterable, return a one-item iterable containing *obj*:: - - >>> obj = 1 - >>> list(always_iterable(obj)) - [1] - - If *obj* is ``None``, return an empty iterable: - - >>> obj = None - >>> list(always_iterable(None)) - [] - - By default, binary and text strings are not considered iterable:: - - >>> obj = 'foo' - >>> list(always_iterable(obj)) - ['foo'] - - If *base_type* is set, objects for which ``isinstance(obj, base_type)`` - returns ``True`` won't be considered iterable. - - >>> obj = {'a': 1} - >>> list(always_iterable(obj)) # Iterate over the dict's keys - ['a'] - >>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit - [{'a': 1}] - - Set *base_type* to ``None`` to avoid any special handling and treat objects - Python considers iterable as iterable: - - >>> obj = 'foo' - >>> list(always_iterable(obj, base_type=None)) - ['f', 'o', 'o'] - """ - if obj is None: - return iter(()) - - if (base_type is not None) and isinstance(obj, base_type): - return iter((obj,)) - - try: - return iter(obj) - except TypeError: - return iter((obj,)) - - -def adjacent(predicate, iterable, distance=1): - """Return an iterable over `(bool, item)` tuples where the `item` is - drawn from *iterable* and the `bool` indicates whether - that item satisfies the *predicate* or is adjacent to an item that does. - - For example, to find whether items are adjacent to a ``3``:: - - >>> list(adjacent(lambda x: x == 3, range(6))) - [(False, 0), (False, 1), (True, 2), (True, 3), (True, 4), (False, 5)] - - Set *distance* to change what counts as adjacent. For example, to find - whether items are two places away from a ``3``: - - >>> list(adjacent(lambda x: x == 3, range(6), distance=2)) - [(False, 0), (True, 1), (True, 2), (True, 3), (True, 4), (True, 5)] - - This is useful for contextualizing the results of a search function. - For example, a code comparison tool might want to identify lines that - have changed, but also surrounding lines to give the viewer of the diff - context. - - The predicate function will only be called once for each item in the - iterable. - - See also :func:`groupby_transform`, which can be used with this function - to group ranges of items with the same `bool` value. - - """ - # Allow distance=0 mainly for testing that it reproduces results with map() - if distance < 0: - raise ValueError('distance must be at least 0') - - i1, i2 = tee(iterable) - padding = [False] * distance - selected = chain(padding, map(predicate, i1), padding) - adjacent_to_selected = map(any, windowed(selected, 2 * distance + 1)) - return zip(adjacent_to_selected, i2) - - -def groupby_transform(iterable, keyfunc=None, valuefunc=None, reducefunc=None): - """An extension of :func:`itertools.groupby` that can apply transformations - to the grouped data. - - * *keyfunc* is a function computing a key value for each item in *iterable* - * *valuefunc* is a function that transforms the individual items from - *iterable* after grouping - * *reducefunc* is a function that transforms each group of items - - >>> iterable = 'aAAbBBcCC' - >>> keyfunc = lambda k: k.upper() - >>> valuefunc = lambda v: v.lower() - >>> reducefunc = lambda g: ''.join(g) - >>> list(groupby_transform(iterable, keyfunc, valuefunc, reducefunc)) - [('A', 'aaa'), ('B', 'bbb'), ('C', 'ccc')] - - Each optional argument defaults to an identity function if not specified. - - :func:`groupby_transform` is useful when grouping elements of an iterable - using a separate iterable as the key. To do this, :func:`zip` the iterables - and pass a *keyfunc* that extracts the first element and a *valuefunc* - that extracts the second element:: - - >>> from operator import itemgetter - >>> keys = [0, 0, 1, 1, 1, 2, 2, 2, 3] - >>> values = 'abcdefghi' - >>> iterable = zip(keys, values) - >>> grouper = groupby_transform(iterable, itemgetter(0), itemgetter(1)) - >>> [(k, ''.join(g)) for k, g in grouper] - [(0, 'ab'), (1, 'cde'), (2, 'fgh'), (3, 'i')] - - Note that the order of items in the iterable is significant. - Only adjacent items are grouped together, so if you don't want any - duplicate groups, you should sort the iterable by the key function. - - """ - ret = groupby(iterable, keyfunc) - if valuefunc: - ret = ((k, map(valuefunc, g)) for k, g in ret) - if reducefunc: - ret = ((k, reducefunc(g)) for k, g in ret) - - return ret - - -class numeric_range(abc.Sequence, abc.Hashable): - """An extension of the built-in ``range()`` function whose arguments can - be any orderable numeric type. - - With only *stop* specified, *start* defaults to ``0`` and *step* - defaults to ``1``. The output items will match the type of *stop*: - - >>> list(numeric_range(3.5)) - [0.0, 1.0, 2.0, 3.0] - - With only *start* and *stop* specified, *step* defaults to ``1``. The - output items will match the type of *start*: - - >>> from decimal import Decimal - >>> start = Decimal('2.1') - >>> stop = Decimal('5.1') - >>> list(numeric_range(start, stop)) - [Decimal('2.1'), Decimal('3.1'), Decimal('4.1')] - - With *start*, *stop*, and *step* specified the output items will match - the type of ``start + step``: - - >>> from fractions import Fraction - >>> start = Fraction(1, 2) # Start at 1/2 - >>> stop = Fraction(5, 2) # End at 5/2 - >>> step = Fraction(1, 2) # Count by 1/2 - >>> list(numeric_range(start, stop, step)) - [Fraction(1, 2), Fraction(1, 1), Fraction(3, 2), Fraction(2, 1)] - - If *step* is zero, ``ValueError`` is raised. Negative steps are supported: - - >>> list(numeric_range(3, -1, -1.0)) - [3.0, 2.0, 1.0, 0.0] - - Be aware of the limitations of floating point numbers; the representation - of the yielded numbers may be surprising. - - ``datetime.datetime`` objects can be used for *start* and *stop*, if *step* - is a ``datetime.timedelta`` object: - - >>> import datetime - >>> start = datetime.datetime(2019, 1, 1) - >>> stop = datetime.datetime(2019, 1, 3) - >>> step = datetime.timedelta(days=1) - >>> items = iter(numeric_range(start, stop, step)) - >>> next(items) - datetime.datetime(2019, 1, 1, 0, 0) - >>> next(items) - datetime.datetime(2019, 1, 2, 0, 0) - - """ - - _EMPTY_HASH = hash(range(0, 0)) - - def __init__(self, *args): - argc = len(args) - if argc == 1: - (self._stop,) = args - self._start = type(self._stop)(0) - self._step = type(self._stop - self._start)(1) - elif argc == 2: - self._start, self._stop = args - self._step = type(self._stop - self._start)(1) - elif argc == 3: - self._start, self._stop, self._step = args - elif argc == 0: - raise TypeError( - 'numeric_range expected at least ' - '1 argument, got {}'.format(argc) - ) - else: - raise TypeError( - 'numeric_range expected at most ' - '3 arguments, got {}'.format(argc) - ) - - self._zero = type(self._step)(0) - if self._step == self._zero: - raise ValueError('numeric_range() arg 3 must not be zero') - self._growing = self._step > self._zero - - def __bool__(self): - if self._growing: - return self._start < self._stop - else: - return self._start > self._stop - - def __contains__(self, elem): - if self._growing: - if self._start <= elem < self._stop: - return (elem - self._start) % self._step == self._zero - else: - if self._start >= elem > self._stop: - return (self._start - elem) % (-self._step) == self._zero - - return False - - def __eq__(self, other): - if isinstance(other, numeric_range): - empty_self = not bool(self) - empty_other = not bool(other) - if empty_self or empty_other: - return empty_self and empty_other # True if both empty - else: - return ( - self._start == other._start - and self._step == other._step - and self._get_by_index(-1) == other._get_by_index(-1) - ) - else: - return False - - def __getitem__(self, key): - if isinstance(key, int): - return self._get_by_index(key) - elif isinstance(key, slice): - step = self._step if key.step is None else key.step * self._step - - if key.start is None or key.start <= -self._len: - start = self._start - elif key.start >= self._len: - start = self._stop - else: # -self._len < key.start < self._len - start = self._get_by_index(key.start) - - if key.stop is None or key.stop >= self._len: - stop = self._stop - elif key.stop <= -self._len: - stop = self._start - else: # -self._len < key.stop < self._len - stop = self._get_by_index(key.stop) - - return numeric_range(start, stop, step) - else: - raise TypeError( - 'numeric range indices must be ' - 'integers or slices, not {}'.format(type(key).__name__) - ) - - def __hash__(self): - if self: - return hash((self._start, self._get_by_index(-1), self._step)) - else: - return self._EMPTY_HASH - - def __iter__(self): - values = (self._start + (n * self._step) for n in count()) - if self._growing: - return takewhile(partial(gt, self._stop), values) - else: - return takewhile(partial(lt, self._stop), values) - - def __len__(self): - return self._len - - @cached_property - def _len(self): - if self._growing: - start = self._start - stop = self._stop - step = self._step - else: - start = self._stop - stop = self._start - step = -self._step - distance = stop - start - if distance <= self._zero: - return 0 - else: # distance > 0 and step > 0: regular euclidean division - q, r = divmod(distance, step) - return int(q) + int(r != self._zero) - - def __reduce__(self): - return numeric_range, (self._start, self._stop, self._step) - - def __repr__(self): - if self._step == 1: - return "numeric_range({}, {})".format( - repr(self._start), repr(self._stop) - ) - else: - return "numeric_range({}, {}, {})".format( - repr(self._start), repr(self._stop), repr(self._step) - ) - - def __reversed__(self): - return iter( - numeric_range( - self._get_by_index(-1), self._start - self._step, -self._step - ) - ) - - def count(self, value): - return int(value in self) - - def index(self, value): - if self._growing: - if self._start <= value < self._stop: - q, r = divmod(value - self._start, self._step) - if r == self._zero: - return int(q) - else: - if self._start >= value > self._stop: - q, r = divmod(self._start - value, -self._step) - if r == self._zero: - return int(q) - - raise ValueError("{} is not in numeric range".format(value)) - - def _get_by_index(self, i): - if i < 0: - i += self._len - if i < 0 or i >= self._len: - raise IndexError("numeric range object index out of range") - return self._start + i * self._step - - -def count_cycle(iterable, n=None): - """Cycle through the items from *iterable* up to *n* times, yielding - the number of completed cycles along with each item. If *n* is omitted the - process repeats indefinitely. - - >>> list(count_cycle('AB', 3)) - [(0, 'A'), (0, 'B'), (1, 'A'), (1, 'B'), (2, 'A'), (2, 'B')] - - """ - iterable = tuple(iterable) - if not iterable: - return iter(()) - counter = count() if n is None else range(n) - return ((i, item) for i in counter for item in iterable) - - -def mark_ends(iterable): - """Yield 3-tuples of the form ``(is_first, is_last, item)``. - - >>> list(mark_ends('ABC')) - [(True, False, 'A'), (False, False, 'B'), (False, True, 'C')] - - Use this when looping over an iterable to take special action on its first - and/or last items: - - >>> iterable = ['Header', 100, 200, 'Footer'] - >>> total = 0 - >>> for is_first, is_last, item in mark_ends(iterable): - ... if is_first: - ... continue # Skip the header - ... if is_last: - ... continue # Skip the footer - ... total += item - >>> print(total) - 300 - """ - it = iter(iterable) - - try: - b = next(it) - except StopIteration: - return - - try: - for i in count(): - a = b - b = next(it) - yield i == 0, False, a - - except StopIteration: - yield i == 0, True, a - - -def locate(iterable, pred=bool, window_size=None): - """Yield the index of each item in *iterable* for which *pred* returns - ``True``. - - *pred* defaults to :func:`bool`, which will select truthy items: - - >>> list(locate([0, 1, 1, 0, 1, 0, 0])) - [1, 2, 4] - - Set *pred* to a custom function to, e.g., find the indexes for a particular - item. - - >>> list(locate(['a', 'b', 'c', 'b'], lambda x: x == 'b')) - [1, 3] - - If *window_size* is given, then the *pred* function will be called with - that many items. This enables searching for sub-sequences: - - >>> iterable = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] - >>> pred = lambda *args: args == (1, 2, 3) - >>> list(locate(iterable, pred=pred, window_size=3)) - [1, 5, 9] - - Use with :func:`seekable` to find indexes and then retrieve the associated - items: - - >>> from itertools import count - >>> from more_itertools import seekable - >>> source = (3 * n + 1 if (n % 2) else n // 2 for n in count()) - >>> it = seekable(source) - >>> pred = lambda x: x > 100 - >>> indexes = locate(it, pred=pred) - >>> i = next(indexes) - >>> it.seek(i) - >>> next(it) - 106 - - """ - if window_size is None: - return compress(count(), map(pred, iterable)) - - if window_size < 1: - raise ValueError('window size must be at least 1') - - it = windowed(iterable, window_size, fillvalue=_marker) - return compress(count(), starmap(pred, it)) - - -def longest_common_prefix(iterables): - """Yield elements of the longest common prefix amongst given *iterables*. - - >>> ''.join(longest_common_prefix(['abcd', 'abc', 'abf'])) - 'ab' - - """ - return (c[0] for c in takewhile(all_equal, zip(*iterables))) - - -def lstrip(iterable, pred): - """Yield the items from *iterable*, but strip any from the beginning - for which *pred* returns ``True``. - - For example, to remove a set of items from the start of an iterable: - - >>> iterable = (None, False, None, 1, 2, None, 3, False, None) - >>> pred = lambda x: x in {None, False, ''} - >>> list(lstrip(iterable, pred)) - [1, 2, None, 3, False, None] - - This function is analogous to to :func:`str.lstrip`, and is essentially - an wrapper for :func:`itertools.dropwhile`. - - """ - return dropwhile(pred, iterable) - - -def rstrip(iterable, pred): - """Yield the items from *iterable*, but strip any from the end - for which *pred* returns ``True``. - - For example, to remove a set of items from the end of an iterable: - - >>> iterable = (None, False, None, 1, 2, None, 3, False, None) - >>> pred = lambda x: x in {None, False, ''} - >>> list(rstrip(iterable, pred)) - [None, False, None, 1, 2, None, 3] - - This function is analogous to :func:`str.rstrip`. - - """ - cache = [] - cache_append = cache.append - cache_clear = cache.clear - for x in iterable: - if pred(x): - cache_append(x) - else: - yield from cache - cache_clear() - yield x - - -def strip(iterable, pred): - """Yield the items from *iterable*, but strip any from the - beginning and end for which *pred* returns ``True``. - - For example, to remove a set of items from both ends of an iterable: - - >>> iterable = (None, False, None, 1, 2, None, 3, False, None) - >>> pred = lambda x: x in {None, False, ''} - >>> list(strip(iterable, pred)) - [1, 2, None, 3] - - This function is analogous to :func:`str.strip`. - - """ - return rstrip(lstrip(iterable, pred), pred) - - -class islice_extended: - """An extension of :func:`itertools.islice` that supports negative values - for *stop*, *start*, and *step*. - - >>> iterable = iter('abcdefgh') - >>> list(islice_extended(iterable, -4, -1)) - ['e', 'f', 'g'] - - Slices with negative values require some caching of *iterable*, but this - function takes care to minimize the amount of memory required. - - For example, you can use a negative step with an infinite iterator: - - >>> from itertools import count - >>> list(islice_extended(count(), 110, 99, -2)) - [110, 108, 106, 104, 102, 100] - - You can also use slice notation directly: - - >>> iterable = map(str, count()) - >>> it = islice_extended(iterable)[10:20:2] - >>> list(it) - ['10', '12', '14', '16', '18'] - - """ - - def __init__(self, iterable, *args): - it = iter(iterable) - if args: - self._iterable = _islice_helper(it, slice(*args)) - else: - self._iterable = it - - def __iter__(self): - return self - - def __next__(self): - return next(self._iterable) - - def __getitem__(self, key): - if isinstance(key, slice): - return islice_extended(_islice_helper(self._iterable, key)) - - raise TypeError('islice_extended.__getitem__ argument must be a slice') - - -def _islice_helper(it, s): - start = s.start - stop = s.stop - if s.step == 0: - raise ValueError('step argument must be a non-zero integer or None.') - step = s.step or 1 - - if step > 0: - start = 0 if (start is None) else start - - if start < 0: - # Consume all but the last -start items - cache = deque(enumerate(it, 1), maxlen=-start) - len_iter = cache[-1][0] if cache else 0 - - # Adjust start to be positive - i = max(len_iter + start, 0) - - # Adjust stop to be positive - if stop is None: - j = len_iter - elif stop >= 0: - j = min(stop, len_iter) - else: - j = max(len_iter + stop, 0) - - # Slice the cache - n = j - i - if n <= 0: - return - - for index, item in islice(cache, 0, n, step): - yield item - elif (stop is not None) and (stop < 0): - # Advance to the start position - next(islice(it, start, start), None) - - # When stop is negative, we have to carry -stop items while - # iterating - cache = deque(islice(it, -stop), maxlen=-stop) - - for index, item in enumerate(it): - cached_item = cache.popleft() - if index % step == 0: - yield cached_item - cache.append(item) - else: - # When both start and stop are positive we have the normal case - yield from islice(it, start, stop, step) - else: - start = -1 if (start is None) else start - - if (stop is not None) and (stop < 0): - # Consume all but the last items - n = -stop - 1 - cache = deque(enumerate(it, 1), maxlen=n) - len_iter = cache[-1][0] if cache else 0 - - # If start and stop are both negative they are comparable and - # we can just slice. Otherwise we can adjust start to be negative - # and then slice. - if start < 0: - i, j = start, stop - else: - i, j = min(start - len_iter, -1), None - - for index, item in list(cache)[i:j:step]: - yield item - else: - # Advance to the stop position - if stop is not None: - m = stop + 1 - next(islice(it, m, m), None) - - # stop is positive, so if start is negative they are not comparable - # and we need the rest of the items. - if start < 0: - i = start - n = None - # stop is None and start is positive, so we just need items up to - # the start index. - elif stop is None: - i = None - n = start + 1 - # Both stop and start are positive, so they are comparable. - else: - i = None - n = start - stop - if n <= 0: - return - - cache = list(islice(it, n)) - - yield from cache[i::step] - - -def always_reversible(iterable): - """An extension of :func:`reversed` that supports all iterables, not - just those which implement the ``Reversible`` or ``Sequence`` protocols. - - >>> print(*always_reversible(x for x in range(3))) - 2 1 0 - - If the iterable is already reversible, this function returns the - result of :func:`reversed()`. If the iterable is not reversible, - this function will cache the remaining items in the iterable and - yield them in reverse order, which may require significant storage. - """ - try: - return reversed(iterable) - except TypeError: - return reversed(list(iterable)) - - -def consecutive_groups(iterable, ordering=lambda x: x): - """Yield groups of consecutive items using :func:`itertools.groupby`. - The *ordering* function determines whether two items are adjacent by - returning their position. - - By default, the ordering function is the identity function. This is - suitable for finding runs of numbers: - - >>> iterable = [1, 10, 11, 12, 20, 30, 31, 32, 33, 40] - >>> for group in consecutive_groups(iterable): - ... print(list(group)) - [1] - [10, 11, 12] - [20] - [30, 31, 32, 33] - [40] - - For finding runs of adjacent letters, try using the :meth:`index` method - of a string of letters: - - >>> from string import ascii_lowercase - >>> iterable = 'abcdfgilmnop' - >>> ordering = ascii_lowercase.index - >>> for group in consecutive_groups(iterable, ordering): - ... print(list(group)) - ['a', 'b', 'c', 'd'] - ['f', 'g'] - ['i'] - ['l', 'm', 'n', 'o', 'p'] - - Each group of consecutive items is an iterator that shares it source with - *iterable*. When an an output group is advanced, the previous group is - no longer available unless its elements are copied (e.g., into a ``list``). - - >>> iterable = [1, 2, 11, 12, 21, 22] - >>> saved_groups = [] - >>> for group in consecutive_groups(iterable): - ... saved_groups.append(list(group)) # Copy group elements - >>> saved_groups - [[1, 2], [11, 12], [21, 22]] - - """ - for k, g in groupby( - enumerate(iterable), key=lambda x: x[0] - ordering(x[1]) - ): - yield map(itemgetter(1), g) - - -def difference(iterable, func=sub, *, initial=None): - """This function is the inverse of :func:`itertools.accumulate`. By default - it will compute the first difference of *iterable* using - :func:`operator.sub`: - - >>> from itertools import accumulate - >>> iterable = accumulate([0, 1, 2, 3, 4]) # produces 0, 1, 3, 6, 10 - >>> list(difference(iterable)) - [0, 1, 2, 3, 4] - - *func* defaults to :func:`operator.sub`, but other functions can be - specified. They will be applied as follows:: - - A, B, C, D, ... --> A, func(B, A), func(C, B), func(D, C), ... - - For example, to do progressive division: - - >>> iterable = [1, 2, 6, 24, 120] - >>> func = lambda x, y: x // y - >>> list(difference(iterable, func)) - [1, 2, 3, 4, 5] - - If the *initial* keyword is set, the first element will be skipped when - computing successive differences. - - >>> it = [10, 11, 13, 16] # from accumulate([1, 2, 3], initial=10) - >>> list(difference(it, initial=10)) - [1, 2, 3] - - """ - a, b = tee(iterable) - try: - first = [next(b)] - except StopIteration: - return iter([]) - - if initial is not None: - first = [] - - return chain(first, map(func, b, a)) - - -class SequenceView(Sequence): - """Return a read-only view of the sequence object *target*. - - :class:`SequenceView` objects are analogous to Python's built-in - "dictionary view" types. They provide a dynamic view of a sequence's items, - meaning that when the sequence updates, so does the view. - - >>> seq = ['0', '1', '2'] - >>> view = SequenceView(seq) - >>> view - SequenceView(['0', '1', '2']) - >>> seq.append('3') - >>> view - SequenceView(['0', '1', '2', '3']) - - Sequence views support indexing, slicing, and length queries. They act - like the underlying sequence, except they don't allow assignment: - - >>> view[1] - '1' - >>> view[1:-1] - ['1', '2'] - >>> len(view) - 4 - - Sequence views are useful as an alternative to copying, as they don't - require (much) extra storage. - - """ - - def __init__(self, target): - if not isinstance(target, Sequence): - raise TypeError - self._target = target - - def __getitem__(self, index): - return self._target[index] - - def __len__(self): - return len(self._target) - - def __repr__(self): - return '{}({})'.format(self.__class__.__name__, repr(self._target)) - - -class seekable: - """Wrap an iterator to allow for seeking backward and forward. This - progressively caches the items in the source iterable so they can be - re-visited. - - Call :meth:`seek` with an index to seek to that position in the source - iterable. - - To "reset" an iterator, seek to ``0``: - - >>> from itertools import count - >>> it = seekable((str(n) for n in count())) - >>> next(it), next(it), next(it) - ('0', '1', '2') - >>> it.seek(0) - >>> next(it), next(it), next(it) - ('0', '1', '2') - >>> next(it) - '3' - - You can also seek forward: - - >>> it = seekable((str(n) for n in range(20))) - >>> it.seek(10) - >>> next(it) - '10' - >>> it.relative_seek(-2) # Seeking relative to the current position - >>> next(it) - '9' - >>> it.seek(20) # Seeking past the end of the source isn't a problem - >>> list(it) - [] - >>> it.seek(0) # Resetting works even after hitting the end - >>> next(it), next(it), next(it) - ('0', '1', '2') - - Call :meth:`peek` to look ahead one item without advancing the iterator: - - >>> it = seekable('1234') - >>> it.peek() - '1' - >>> list(it) - ['1', '2', '3', '4'] - >>> it.peek(default='empty') - 'empty' - - Before the iterator is at its end, calling :func:`bool` on it will return - ``True``. After it will return ``False``: - - >>> it = seekable('5678') - >>> bool(it) - True - >>> list(it) - ['5', '6', '7', '8'] - >>> bool(it) - False - - You may view the contents of the cache with the :meth:`elements` method. - That returns a :class:`SequenceView`, a view that updates automatically: - - >>> it = seekable((str(n) for n in range(10))) - >>> next(it), next(it), next(it) - ('0', '1', '2') - >>> elements = it.elements() - >>> elements - SequenceView(['0', '1', '2']) - >>> next(it) - '3' - >>> elements - SequenceView(['0', '1', '2', '3']) - - By default, the cache grows as the source iterable progresses, so beware of - wrapping very large or infinite iterables. Supply *maxlen* to limit the - size of the cache (this of course limits how far back you can seek). - - >>> from itertools import count - >>> it = seekable((str(n) for n in count()), maxlen=2) - >>> next(it), next(it), next(it), next(it) - ('0', '1', '2', '3') - >>> list(it.elements()) - ['2', '3'] - >>> it.seek(0) - >>> next(it), next(it), next(it), next(it) - ('2', '3', '4', '5') - >>> next(it) - '6' - - """ - - def __init__(self, iterable, maxlen=None): - self._source = iter(iterable) - if maxlen is None: - self._cache = [] - else: - self._cache = deque([], maxlen) - self._index = None - - def __iter__(self): - return self - - def __next__(self): - if self._index is not None: - try: - item = self._cache[self._index] - except IndexError: - self._index = None - else: - self._index += 1 - return item - - item = next(self._source) - self._cache.append(item) - return item - - def __bool__(self): - try: - self.peek() - except StopIteration: - return False - return True - - def peek(self, default=_marker): - try: - peeked = next(self) - except StopIteration: - if default is _marker: - raise - return default - if self._index is None: - self._index = len(self._cache) - self._index -= 1 - return peeked - - def elements(self): - return SequenceView(self._cache) - - def seek(self, index): - self._index = index - remainder = index - len(self._cache) - if remainder > 0: - consume(self, remainder) - - def relative_seek(self, count): - index = len(self._cache) - self.seek(max(index + count, 0)) - - -class run_length: - """ - :func:`run_length.encode` compresses an iterable with run-length encoding. - It yields groups of repeated items with the count of how many times they - were repeated: - - >>> uncompressed = 'abbcccdddd' - >>> list(run_length.encode(uncompressed)) - [('a', 1), ('b', 2), ('c', 3), ('d', 4)] - - :func:`run_length.decode` decompresses an iterable that was previously - compressed with run-length encoding. It yields the items of the - decompressed iterable: - - >>> compressed = [('a', 1), ('b', 2), ('c', 3), ('d', 4)] - >>> list(run_length.decode(compressed)) - ['a', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd', 'd'] - - """ - - @staticmethod - def encode(iterable): - return ((k, ilen(g)) for k, g in groupby(iterable)) - - @staticmethod - def decode(iterable): - return chain.from_iterable(repeat(k, n) for k, n in iterable) - - -def exactly_n(iterable, n, predicate=bool): - """Return ``True`` if exactly ``n`` items in the iterable are ``True`` - according to the *predicate* function. - - >>> exactly_n([True, True, False], 2) - True - >>> exactly_n([True, True, False], 1) - False - >>> exactly_n([0, 1, 2, 3, 4, 5], 3, lambda x: x < 3) - True - - The iterable will be advanced until ``n + 1`` truthy items are encountered, - so avoid calling it on infinite iterables. - - """ - return len(take(n + 1, filter(predicate, iterable))) == n - - -def circular_shifts(iterable): - """Return a list of circular shifts of *iterable*. - - >>> circular_shifts(range(4)) - [(0, 1, 2, 3), (1, 2, 3, 0), (2, 3, 0, 1), (3, 0, 1, 2)] - """ - lst = list(iterable) - return take(len(lst), windowed(cycle(lst), len(lst))) - - -def make_decorator(wrapping_func, result_index=0): - """Return a decorator version of *wrapping_func*, which is a function that - modifies an iterable. *result_index* is the position in that function's - signature where the iterable goes. - - This lets you use itertools on the "production end," i.e. at function - definition. This can augment what the function returns without changing the - function's code. - - For example, to produce a decorator version of :func:`chunked`: - - >>> from more_itertools import chunked - >>> chunker = make_decorator(chunked, result_index=0) - >>> @chunker(3) - ... def iter_range(n): - ... return iter(range(n)) - ... - >>> list(iter_range(9)) - [[0, 1, 2], [3, 4, 5], [6, 7, 8]] - - To only allow truthy items to be returned: - - >>> truth_serum = make_decorator(filter, result_index=1) - >>> @truth_serum(bool) - ... def boolean_test(): - ... return [0, 1, '', ' ', False, True] - ... - >>> list(boolean_test()) - [1, ' ', True] - - The :func:`peekable` and :func:`seekable` wrappers make for practical - decorators: - - >>> from more_itertools import peekable - >>> peekable_function = make_decorator(peekable) - >>> @peekable_function() - ... def str_range(*args): - ... return (str(x) for x in range(*args)) - ... - >>> it = str_range(1, 20, 2) - >>> next(it), next(it), next(it) - ('1', '3', '5') - >>> it.peek() - '7' - >>> next(it) - '7' - - """ - - # See https://sites.google.com/site/bbayles/index/decorator_factory for - # notes on how this works. - def decorator(*wrapping_args, **wrapping_kwargs): - def outer_wrapper(f): - def inner_wrapper(*args, **kwargs): - result = f(*args, **kwargs) - wrapping_args_ = list(wrapping_args) - wrapping_args_.insert(result_index, result) - return wrapping_func(*wrapping_args_, **wrapping_kwargs) - - return inner_wrapper - - return outer_wrapper - - return decorator - - -def map_reduce(iterable, keyfunc, valuefunc=None, reducefunc=None): - """Return a dictionary that maps the items in *iterable* to categories - defined by *keyfunc*, transforms them with *valuefunc*, and - then summarizes them by category with *reducefunc*. - - *valuefunc* defaults to the identity function if it is unspecified. - If *reducefunc* is unspecified, no summarization takes place: - - >>> keyfunc = lambda x: x.upper() - >>> result = map_reduce('abbccc', keyfunc) - >>> sorted(result.items()) - [('A', ['a']), ('B', ['b', 'b']), ('C', ['c', 'c', 'c'])] - - Specifying *valuefunc* transforms the categorized items: - - >>> keyfunc = lambda x: x.upper() - >>> valuefunc = lambda x: 1 - >>> result = map_reduce('abbccc', keyfunc, valuefunc) - >>> sorted(result.items()) - [('A', [1]), ('B', [1, 1]), ('C', [1, 1, 1])] - - Specifying *reducefunc* summarizes the categorized items: - - >>> keyfunc = lambda x: x.upper() - >>> valuefunc = lambda x: 1 - >>> reducefunc = sum - >>> result = map_reduce('abbccc', keyfunc, valuefunc, reducefunc) - >>> sorted(result.items()) - [('A', 1), ('B', 2), ('C', 3)] - - You may want to filter the input iterable before applying the map/reduce - procedure: - - >>> all_items = range(30) - >>> items = [x for x in all_items if 10 <= x <= 20] # Filter - >>> keyfunc = lambda x: x % 2 # Evens map to 0; odds to 1 - >>> categories = map_reduce(items, keyfunc=keyfunc) - >>> sorted(categories.items()) - [(0, [10, 12, 14, 16, 18, 20]), (1, [11, 13, 15, 17, 19])] - >>> summaries = map_reduce(items, keyfunc=keyfunc, reducefunc=sum) - >>> sorted(summaries.items()) - [(0, 90), (1, 75)] - - Note that all items in the iterable are gathered into a list before the - summarization step, which may require significant storage. - - The returned object is a :obj:`collections.defaultdict` with the - ``default_factory`` set to ``None``, such that it behaves like a normal - dictionary. - - """ - valuefunc = (lambda x: x) if (valuefunc is None) else valuefunc - - ret = defaultdict(list) - for item in iterable: - key = keyfunc(item) - value = valuefunc(item) - ret[key].append(value) - - if reducefunc is not None: - for key, value_list in ret.items(): - ret[key] = reducefunc(value_list) - - ret.default_factory = None - return ret - - -def rlocate(iterable, pred=bool, window_size=None): - """Yield the index of each item in *iterable* for which *pred* returns - ``True``, starting from the right and moving left. - - *pred* defaults to :func:`bool`, which will select truthy items: - - >>> list(rlocate([0, 1, 1, 0, 1, 0, 0])) # Truthy at 1, 2, and 4 - [4, 2, 1] - - Set *pred* to a custom function to, e.g., find the indexes for a particular - item: - - >>> iterable = iter('abcb') - >>> pred = lambda x: x == 'b' - >>> list(rlocate(iterable, pred)) - [3, 1] - - If *window_size* is given, then the *pred* function will be called with - that many items. This enables searching for sub-sequences: - - >>> iterable = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] - >>> pred = lambda *args: args == (1, 2, 3) - >>> list(rlocate(iterable, pred=pred, window_size=3)) - [9, 5, 1] - - Beware, this function won't return anything for infinite iterables. - If *iterable* is reversible, ``rlocate`` will reverse it and search from - the right. Otherwise, it will search from the left and return the results - in reverse order. - - See :func:`locate` to for other example applications. - - """ - if window_size is None: - try: - len_iter = len(iterable) - return (len_iter - i - 1 for i in locate(reversed(iterable), pred)) - except TypeError: - pass - - return reversed(list(locate(iterable, pred, window_size))) - - -def replace(iterable, pred, substitutes, count=None, window_size=1): - """Yield the items from *iterable*, replacing the items for which *pred* - returns ``True`` with the items from the iterable *substitutes*. - - >>> iterable = [1, 1, 0, 1, 1, 0, 1, 1] - >>> pred = lambda x: x == 0 - >>> substitutes = (2, 3) - >>> list(replace(iterable, pred, substitutes)) - [1, 1, 2, 3, 1, 1, 2, 3, 1, 1] - - If *count* is given, the number of replacements will be limited: - - >>> iterable = [1, 1, 0, 1, 1, 0, 1, 1, 0] - >>> pred = lambda x: x == 0 - >>> substitutes = [None] - >>> list(replace(iterable, pred, substitutes, count=2)) - [1, 1, None, 1, 1, None, 1, 1, 0] - - Use *window_size* to control the number of items passed as arguments to - *pred*. This allows for locating and replacing subsequences. - - >>> iterable = [0, 1, 2, 5, 0, 1, 2, 5] - >>> window_size = 3 - >>> pred = lambda *args: args == (0, 1, 2) # 3 items passed to pred - >>> substitutes = [3, 4] # Splice in these items - >>> list(replace(iterable, pred, substitutes, window_size=window_size)) - [3, 4, 5, 3, 4, 5] - - """ - if window_size < 1: - raise ValueError('window_size must be at least 1') - - # Save the substitutes iterable, since it's used more than once - substitutes = tuple(substitutes) - - # Add padding such that the number of windows matches the length of the - # iterable - it = chain(iterable, [_marker] * (window_size - 1)) - windows = windowed(it, window_size) - - n = 0 - for w in windows: - # If the current window matches our predicate (and we haven't hit - # our maximum number of replacements), splice in the substitutes - # and then consume the following windows that overlap with this one. - # For example, if the iterable is (0, 1, 2, 3, 4...) - # and the window size is 2, we have (0, 1), (1, 2), (2, 3)... - # If the predicate matches on (0, 1), we need to zap (0, 1) and (1, 2) - if pred(*w): - if (count is None) or (n < count): - n += 1 - yield from substitutes - consume(windows, window_size - 1) - continue - - # If there was no match (or we've reached the replacement limit), - # yield the first item from the window. - if w and (w[0] is not _marker): - yield w[0] - - -def partitions(iterable): - """Yield all possible order-preserving partitions of *iterable*. - - >>> iterable = 'abc' - >>> for part in partitions(iterable): - ... print([''.join(p) for p in part]) - ['abc'] - ['a', 'bc'] - ['ab', 'c'] - ['a', 'b', 'c'] - - This is unrelated to :func:`partition`. - - """ - sequence = list(iterable) - n = len(sequence) - for i in powerset(range(1, n)): - yield [sequence[i:j] for i, j in zip((0,) + i, i + (n,))] - - -def set_partitions(iterable, k=None): - """ - Yield the set partitions of *iterable* into *k* parts. Set partitions are - not order-preserving. - - >>> iterable = 'abc' - >>> for part in set_partitions(iterable, 2): - ... print([''.join(p) for p in part]) - ['a', 'bc'] - ['ab', 'c'] - ['b', 'ac'] - - - If *k* is not given, every set partition is generated. - - >>> iterable = 'abc' - >>> for part in set_partitions(iterable): - ... print([''.join(p) for p in part]) - ['abc'] - ['a', 'bc'] - ['ab', 'c'] - ['b', 'ac'] - ['a', 'b', 'c'] - - """ - L = list(iterable) - n = len(L) - if k is not None: - if k < 1: - raise ValueError( - "Can't partition in a negative or zero number of groups" - ) - elif k > n: - return - - def set_partitions_helper(L, k): - n = len(L) - if k == 1: - yield [L] - elif n == k: - yield [[s] for s in L] - else: - e, *M = L - for p in set_partitions_helper(M, k - 1): - yield [[e], *p] - for p in set_partitions_helper(M, k): - for i in range(len(p)): - yield p[:i] + [[e] + p[i]] + p[i + 1 :] - - if k is None: - for k in range(1, n + 1): - yield from set_partitions_helper(L, k) - else: - yield from set_partitions_helper(L, k) - - -class time_limited: - """ - Yield items from *iterable* until *limit_seconds* have passed. - If the time limit expires before all items have been yielded, the - ``timed_out`` parameter will be set to ``True``. - - >>> from time import sleep - >>> def generator(): - ... yield 1 - ... yield 2 - ... sleep(0.2) - ... yield 3 - >>> iterable = time_limited(0.1, generator()) - >>> list(iterable) - [1, 2] - >>> iterable.timed_out - True - - Note that the time is checked before each item is yielded, and iteration - stops if the time elapsed is greater than *limit_seconds*. If your time - limit is 1 second, but it takes 2 seconds to generate the first item from - the iterable, the function will run for 2 seconds and not yield anything. - As a special case, when *limit_seconds* is zero, the iterator never - returns anything. - - """ - - def __init__(self, limit_seconds, iterable): - if limit_seconds < 0: - raise ValueError('limit_seconds must be positive') - self.limit_seconds = limit_seconds - self._iterable = iter(iterable) - self._start_time = monotonic() - self.timed_out = False - - def __iter__(self): - return self - - def __next__(self): - if self.limit_seconds == 0: - self.timed_out = True - raise StopIteration - item = next(self._iterable) - if monotonic() - self._start_time > self.limit_seconds: - self.timed_out = True - raise StopIteration - - return item - - -def only(iterable, default=None, too_long=None): - """If *iterable* has only one item, return it. - If it has zero items, return *default*. - If it has more than one item, raise the exception given by *too_long*, - which is ``ValueError`` by default. - - >>> only([], default='missing') - 'missing' - >>> only([1]) - 1 - >>> only([1, 2]) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - ValueError: Expected exactly one item in iterable, but got 1, 2, - and perhaps more.' - >>> only([1, 2], too_long=TypeError) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - TypeError - - Note that :func:`only` attempts to advance *iterable* twice to ensure there - is only one item. See :func:`spy` or :func:`peekable` to check - iterable contents less destructively. - """ - it = iter(iterable) - first_value = next(it, default) - - try: - second_value = next(it) - except StopIteration: - pass - else: - msg = ( - 'Expected exactly one item in iterable, but got {!r}, {!r}, ' - 'and perhaps more.'.format(first_value, second_value) - ) - raise too_long or ValueError(msg) - - return first_value - - -def _ichunk(iterable, n): - cache = deque() - chunk = islice(iterable, n) - - def generator(): - while True: - if cache: - yield cache.popleft() - else: - try: - item = next(chunk) - except StopIteration: - return - else: - yield item - - def materialize_next(n=1): - # if n not specified materialize everything - if n is None: - cache.extend(chunk) - return len(cache) - - to_cache = n - len(cache) - - # materialize up to n - if to_cache > 0: - cache.extend(islice(chunk, to_cache)) - - # return number materialized up to n - return min(n, len(cache)) - - return (generator(), materialize_next) - - -def ichunked(iterable, n): - """Break *iterable* into sub-iterables with *n* elements each. - :func:`ichunked` is like :func:`chunked`, but it yields iterables - instead of lists. - - If the sub-iterables are read in order, the elements of *iterable* - won't be stored in memory. - If they are read out of order, :func:`itertools.tee` is used to cache - elements as necessary. - - >>> from itertools import count - >>> all_chunks = ichunked(count(), 4) - >>> c_1, c_2, c_3 = next(all_chunks), next(all_chunks), next(all_chunks) - >>> list(c_2) # c_1's elements have been cached; c_3's haven't been - [4, 5, 6, 7] - >>> list(c_1) - [0, 1, 2, 3] - >>> list(c_3) - [8, 9, 10, 11] - - """ - iterable = iter(iterable) - while True: - # Create new chunk - chunk, materialize_next = _ichunk(iterable, n) - - # Check to see whether we're at the end of the source iterable - if not materialize_next(): - return - - yield chunk - - # Fill previous chunk's cache - materialize_next(None) - - -def iequals(*iterables): - """Return ``True`` if all given *iterables* are equal to each other, - which means that they contain the same elements in the same order. - - The function is useful for comparing iterables of different data types - or iterables that do not support equality checks. - - >>> iequals("abc", ['a', 'b', 'c'], ('a', 'b', 'c'), iter("abc")) - True - - >>> iequals("abc", "acb") - False - - Not to be confused with :func:`all_equal`, which checks whether all - elements of iterable are equal to each other. - - """ - return all(map(all_equal, zip_longest(*iterables, fillvalue=object()))) - - -def distinct_combinations(iterable, r): - """Yield the distinct combinations of *r* items taken from *iterable*. - - >>> list(distinct_combinations([0, 0, 1], 2)) - [(0, 0), (0, 1)] - - Equivalent to ``set(combinations(iterable))``, except duplicates are not - generated and thrown away. For larger input sequences this is much more - efficient. - - """ - if r < 0: - raise ValueError('r must be non-negative') - elif r == 0: - yield () - return - pool = tuple(iterable) - generators = [unique_everseen(enumerate(pool), key=itemgetter(1))] - current_combo = [None] * r - level = 0 - while generators: - try: - cur_idx, p = next(generators[-1]) - except StopIteration: - generators.pop() - level -= 1 - continue - current_combo[level] = p - if level + 1 == r: - yield tuple(current_combo) - else: - generators.append( - unique_everseen( - enumerate(pool[cur_idx + 1 :], cur_idx + 1), - key=itemgetter(1), - ) - ) - level += 1 - - -def filter_except(validator, iterable, *exceptions): - """Yield the items from *iterable* for which the *validator* function does - not raise one of the specified *exceptions*. - - *validator* is called for each item in *iterable*. - It should be a function that accepts one argument and raises an exception - if that item is not valid. - - >>> iterable = ['1', '2', 'three', '4', None] - >>> list(filter_except(int, iterable, ValueError, TypeError)) - ['1', '2', '4'] - - If an exception other than one given by *exceptions* is raised by - *validator*, it is raised like normal. - """ - for item in iterable: - try: - validator(item) - except exceptions: - pass - else: - yield item - - -def map_except(function, iterable, *exceptions): - """Transform each item from *iterable* with *function* and yield the - result, unless *function* raises one of the specified *exceptions*. - - *function* is called to transform each item in *iterable*. - It should accept one argument. - - >>> iterable = ['1', '2', 'three', '4', None] - >>> list(map_except(int, iterable, ValueError, TypeError)) - [1, 2, 4] - - If an exception other than one given by *exceptions* is raised by - *function*, it is raised like normal. - """ - for item in iterable: - try: - yield function(item) - except exceptions: - pass - - -def map_if(iterable, pred, func, func_else=lambda x: x): - """Evaluate each item from *iterable* using *pred*. If the result is - equivalent to ``True``, transform the item with *func* and yield it. - Otherwise, transform the item with *func_else* and yield it. - - *pred*, *func*, and *func_else* should each be functions that accept - one argument. By default, *func_else* is the identity function. - - >>> from math import sqrt - >>> iterable = list(range(-5, 5)) - >>> iterable - [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4] - >>> list(map_if(iterable, lambda x: x > 3, lambda x: 'toobig')) - [-5, -4, -3, -2, -1, 0, 1, 2, 3, 'toobig'] - >>> list(map_if(iterable, lambda x: x >= 0, - ... lambda x: f'{sqrt(x):.2f}', lambda x: None)) - [None, None, None, None, None, '0.00', '1.00', '1.41', '1.73', '2.00'] - """ - for item in iterable: - yield func(item) if pred(item) else func_else(item) - - -def _sample_unweighted(iterable, k): - # Implementation of "Algorithm L" from the 1994 paper by Kim-Hung Li: - # "Reservoir-Sampling Algorithms of Time Complexity O(n(1+log(N/n)))". - - # Fill up the reservoir (collection of samples) with the first `k` samples - reservoir = take(k, iterable) - - # Generate random number that's the largest in a sample of k U(0,1) numbers - # Largest order statistic: https://en.wikipedia.org/wiki/Order_statistic - W = exp(log(random()) / k) - - # The number of elements to skip before changing the reservoir is a random - # number with a geometric distribution. Sample it using random() and logs. - next_index = k + floor(log(random()) / log(1 - W)) - - for index, element in enumerate(iterable, k): - if index == next_index: - reservoir[randrange(k)] = element - # The new W is the largest in a sample of k U(0, `old_W`) numbers - W *= exp(log(random()) / k) - next_index += floor(log(random()) / log(1 - W)) + 1 - - return reservoir - - -def _sample_weighted(iterable, k, weights): - # Implementation of "A-ExpJ" from the 2006 paper by Efraimidis et al. : - # "Weighted random sampling with a reservoir". - - # Log-transform for numerical stability for weights that are small/large - weight_keys = (log(random()) / weight for weight in weights) - - # Fill up the reservoir (collection of samples) with the first `k` - # weight-keys and elements, then heapify the list. - reservoir = take(k, zip(weight_keys, iterable)) - heapify(reservoir) - - # The number of jumps before changing the reservoir is a random variable - # with an exponential distribution. Sample it using random() and logs. - smallest_weight_key, _ = reservoir[0] - weights_to_skip = log(random()) / smallest_weight_key - - for weight, element in zip(weights, iterable): - if weight >= weights_to_skip: - # The notation here is consistent with the paper, but we store - # the weight-keys in log-space for better numerical stability. - smallest_weight_key, _ = reservoir[0] - t_w = exp(weight * smallest_weight_key) - r_2 = uniform(t_w, 1) # generate U(t_w, 1) - weight_key = log(r_2) / weight - heapreplace(reservoir, (weight_key, element)) - smallest_weight_key, _ = reservoir[0] - weights_to_skip = log(random()) / smallest_weight_key - else: - weights_to_skip -= weight - - # Equivalent to [element for weight_key, element in sorted(reservoir)] - return [heappop(reservoir)[1] for _ in range(k)] - - -def sample(iterable, k, weights=None): - """Return a *k*-length list of elements chosen (without replacement) - from the *iterable*. Like :func:`random.sample`, but works on iterables - of unknown length. - - >>> iterable = range(100) - >>> sample(iterable, 5) # doctest: +SKIP - [81, 60, 96, 16, 4] - - An iterable with *weights* may also be given: - - >>> iterable = range(100) - >>> weights = (i * i + 1 for i in range(100)) - >>> sampled = sample(iterable, 5, weights=weights) # doctest: +SKIP - [79, 67, 74, 66, 78] - - The algorithm can also be used to generate weighted random permutations. - The relative weight of each item determines the probability that it - appears late in the permutation. - - >>> data = "abcdefgh" - >>> weights = range(1, len(data) + 1) - >>> sample(data, k=len(data), weights=weights) # doctest: +SKIP - ['c', 'a', 'b', 'e', 'g', 'd', 'h', 'f'] - """ - if k == 0: - return [] - - iterable = iter(iterable) - if weights is None: - return _sample_unweighted(iterable, k) - else: - weights = iter(weights) - return _sample_weighted(iterable, k, weights) - - -def is_sorted(iterable, key=None, reverse=False, strict=False): - """Returns ``True`` if the items of iterable are in sorted order, and - ``False`` otherwise. *key* and *reverse* have the same meaning that they do - in the built-in :func:`sorted` function. - - >>> is_sorted(['1', '2', '3', '4', '5'], key=int) - True - >>> is_sorted([5, 4, 3, 1, 2], reverse=True) - False - - If *strict*, tests for strict sorting, that is, returns ``False`` if equal - elements are found: - - >>> is_sorted([1, 2, 2]) - True - >>> is_sorted([1, 2, 2], strict=True) - False - - The function returns ``False`` after encountering the first out-of-order - item. If there are no out-of-order items, the iterable is exhausted. - """ - - compare = (le if reverse else ge) if strict else (lt if reverse else gt) - it = iterable if key is None else map(key, iterable) - return not any(starmap(compare, pairwise(it))) - - -class AbortThread(BaseException): - pass - - -class callback_iter: - """Convert a function that uses callbacks to an iterator. - - Let *func* be a function that takes a `callback` keyword argument. - For example: - - >>> def func(callback=None): - ... for i, c in [(1, 'a'), (2, 'b'), (3, 'c')]: - ... if callback: - ... callback(i, c) - ... return 4 - - - Use ``with callback_iter(func)`` to get an iterator over the parameters - that are delivered to the callback. - - >>> with callback_iter(func) as it: - ... for args, kwargs in it: - ... print(args) - (1, 'a') - (2, 'b') - (3, 'c') - - The function will be called in a background thread. The ``done`` property - indicates whether it has completed execution. - - >>> it.done - True - - If it completes successfully, its return value will be available - in the ``result`` property. - - >>> it.result - 4 - - Notes: - - * If the function uses some keyword argument besides ``callback``, supply - *callback_kwd*. - * If it finished executing, but raised an exception, accessing the - ``result`` property will raise the same exception. - * If it hasn't finished executing, accessing the ``result`` - property from within the ``with`` block will raise ``RuntimeError``. - * If it hasn't finished executing, accessing the ``result`` property from - outside the ``with`` block will raise a - ``more_itertools.AbortThread`` exception. - * Provide *wait_seconds* to adjust how frequently the it is polled for - output. - - """ - - def __init__(self, func, callback_kwd='callback', wait_seconds=0.1): - self._func = func - self._callback_kwd = callback_kwd - self._aborted = False - self._future = None - self._wait_seconds = wait_seconds - # Lazily import concurrent.future - self._executor = __import__( - 'concurrent.futures' - ).futures.ThreadPoolExecutor(max_workers=1) - self._iterator = self._reader() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - self._aborted = True - self._executor.shutdown() - - def __iter__(self): - return self - - def __next__(self): - return next(self._iterator) - - @property - def done(self): - if self._future is None: - return False - return self._future.done() - - @property - def result(self): - if not self.done: - raise RuntimeError('Function has not yet completed') - - return self._future.result() - - def _reader(self): - q = Queue() - - def callback(*args, **kwargs): - if self._aborted: - raise AbortThread('canceled by user') - - q.put((args, kwargs)) - - self._future = self._executor.submit( - self._func, **{self._callback_kwd: callback} - ) - - while True: - try: - item = q.get(timeout=self._wait_seconds) - except Empty: - pass - else: - q.task_done() - yield item - - if self._future.done(): - break - - remaining = [] - while True: - try: - item = q.get_nowait() - except Empty: - break - else: - q.task_done() - remaining.append(item) - q.join() - yield from remaining - - -def windowed_complete(iterable, n): - """ - Yield ``(beginning, middle, end)`` tuples, where: - - * Each ``middle`` has *n* items from *iterable* - * Each ``beginning`` has the items before the ones in ``middle`` - * Each ``end`` has the items after the ones in ``middle`` - - >>> iterable = range(7) - >>> n = 3 - >>> for beginning, middle, end in windowed_complete(iterable, n): - ... print(beginning, middle, end) - () (0, 1, 2) (3, 4, 5, 6) - (0,) (1, 2, 3) (4, 5, 6) - (0, 1) (2, 3, 4) (5, 6) - (0, 1, 2) (3, 4, 5) (6,) - (0, 1, 2, 3) (4, 5, 6) () - - Note that *n* must be at least 0 and most equal to the length of - *iterable*. - - This function will exhaust the iterable and may require significant - storage. - """ - if n < 0: - raise ValueError('n must be >= 0') - - seq = tuple(iterable) - size = len(seq) - - if n > size: - raise ValueError('n must be <= len(seq)') - - for i in range(size - n + 1): - beginning = seq[:i] - middle = seq[i : i + n] - end = seq[i + n :] - yield beginning, middle, end - - -def all_unique(iterable, key=None): - """ - Returns ``True`` if all the elements of *iterable* are unique (no two - elements are equal). - - >>> all_unique('ABCB') - False - - If a *key* function is specified, it will be used to make comparisons. - - >>> all_unique('ABCb') - True - >>> all_unique('ABCb', str.lower) - False - - The function returns as soon as the first non-unique element is - encountered. Iterables with a mix of hashable and unhashable items can - be used, but the function will be slower for unhashable items. - """ - seenset = set() - seenset_add = seenset.add - seenlist = [] - seenlist_add = seenlist.append - for element in map(key, iterable) if key else iterable: - try: - if element in seenset: - return False - seenset_add(element) - except TypeError: - if element in seenlist: - return False - seenlist_add(element) - return True - - -def nth_product(index, *args): - """Equivalent to ``list(product(*args))[index]``. - - The products of *args* can be ordered lexicographically. - :func:`nth_product` computes the product at sort position *index* without - computing the previous products. - - >>> nth_product(8, range(2), range(2), range(2), range(2)) - (1, 0, 0, 0) - - ``IndexError`` will be raised if the given *index* is invalid. - """ - pools = list(map(tuple, reversed(args))) - ns = list(map(len, pools)) - - c = reduce(mul, ns) - - if index < 0: - index += c - - if not 0 <= index < c: - raise IndexError - - result = [] - for pool, n in zip(pools, ns): - result.append(pool[index % n]) - index //= n - - return tuple(reversed(result)) - - -def nth_permutation(iterable, r, index): - """Equivalent to ``list(permutations(iterable, r))[index]``` - - The subsequences of *iterable* that are of length *r* where order is - important can be ordered lexicographically. :func:`nth_permutation` - computes the subsequence at sort position *index* directly, without - computing the previous subsequences. - - >>> nth_permutation('ghijk', 2, 5) - ('h', 'i') - - ``ValueError`` will be raised If *r* is negative or greater than the length - of *iterable*. - ``IndexError`` will be raised if the given *index* is invalid. - """ - pool = list(iterable) - n = len(pool) - - if r is None or r == n: - r, c = n, factorial(n) - elif not 0 <= r < n: - raise ValueError - else: - c = perm(n, r) - assert c > 0 # factortial(n)>0, and r>> nth_combination_with_replacement(range(5), 3, 5) - (0, 1, 1) - - ``ValueError`` will be raised If *r* is negative or greater than the length - of *iterable*. - ``IndexError`` will be raised if the given *index* is invalid. - """ - pool = tuple(iterable) - n = len(pool) - if (r < 0) or (r > n): - raise ValueError - - c = comb(n + r - 1, r) - - if index < 0: - index += c - - if (index < 0) or (index >= c): - raise IndexError - - result = [] - i = 0 - while r: - r -= 1 - while n >= 0: - num_combs = comb(n + r - 1, r) - if index < num_combs: - break - n -= 1 - i += 1 - index -= num_combs - result.append(pool[i]) - - return tuple(result) - - -def value_chain(*args): - """Yield all arguments passed to the function in the same order in which - they were passed. If an argument itself is iterable then iterate over its - values. - - >>> list(value_chain(1, 2, 3, [4, 5, 6])) - [1, 2, 3, 4, 5, 6] - - Binary and text strings are not considered iterable and are emitted - as-is: - - >>> list(value_chain('12', '34', ['56', '78'])) - ['12', '34', '56', '78'] - - Pre- or postpend a single element to an iterable: - - >>> list(value_chain(1, [2, 3, 4, 5, 6])) - [1, 2, 3, 4, 5, 6] - >>> list(value_chain([1, 2, 3, 4, 5], 6)) - [1, 2, 3, 4, 5, 6] - - Multiple levels of nesting are not flattened. - - """ - for value in args: - if isinstance(value, (str, bytes)): - yield value - continue - try: - yield from value - except TypeError: - yield value - - -def product_index(element, *args): - """Equivalent to ``list(product(*args)).index(element)`` - - The products of *args* can be ordered lexicographically. - :func:`product_index` computes the first index of *element* without - computing the previous products. - - >>> product_index([8, 2], range(10), range(5)) - 42 - - ``ValueError`` will be raised if the given *element* isn't in the product - of *args*. - """ - index = 0 - - for x, pool in zip_longest(element, args, fillvalue=_marker): - if x is _marker or pool is _marker: - raise ValueError('element is not a product of args') - - pool = tuple(pool) - index = index * len(pool) + pool.index(x) - - return index - - -def combination_index(element, iterable): - """Equivalent to ``list(combinations(iterable, r)).index(element)`` - - The subsequences of *iterable* that are of length *r* can be ordered - lexicographically. :func:`combination_index` computes the index of the - first *element*, without computing the previous combinations. - - >>> combination_index('adf', 'abcdefg') - 10 - - ``ValueError`` will be raised if the given *element* isn't one of the - combinations of *iterable*. - """ - element = enumerate(element) - k, y = next(element, (None, None)) - if k is None: - return 0 - - indexes = [] - pool = enumerate(iterable) - for n, x in pool: - if x == y: - indexes.append(n) - tmp, y = next(element, (None, None)) - if tmp is None: - break - else: - k = tmp - else: - raise ValueError('element is not a combination of iterable') - - n, _ = last(pool, default=(n, None)) - - # Python versions below 3.8 don't have math.comb - index = 1 - for i, j in enumerate(reversed(indexes), start=1): - j = n - j - if i <= j: - index += comb(j, i) - - return comb(n + 1, k + 1) - index - - -def combination_with_replacement_index(element, iterable): - """Equivalent to - ``list(combinations_with_replacement(iterable, r)).index(element)`` - - The subsequences with repetition of *iterable* that are of length *r* can - be ordered lexicographically. :func:`combination_with_replacement_index` - computes the index of the first *element*, without computing the previous - combinations with replacement. - - >>> combination_with_replacement_index('adf', 'abcdefg') - 20 - - ``ValueError`` will be raised if the given *element* isn't one of the - combinations with replacement of *iterable*. - """ - element = tuple(element) - l = len(element) - element = enumerate(element) - - k, y = next(element, (None, None)) - if k is None: - return 0 - - indexes = [] - pool = tuple(iterable) - for n, x in enumerate(pool): - while x == y: - indexes.append(n) - tmp, y = next(element, (None, None)) - if tmp is None: - break - else: - k = tmp - if y is None: - break - else: - raise ValueError( - 'element is not a combination with replacement of iterable' - ) - - n = len(pool) - occupations = [0] * n - for p in indexes: - occupations[p] += 1 - - index = 0 - cumulative_sum = 0 - for k in range(1, n): - cumulative_sum += occupations[k - 1] - j = l + n - 1 - k - cumulative_sum - i = n - k - if i <= j: - index += comb(j, i) - - return index - - -def permutation_index(element, iterable): - """Equivalent to ``list(permutations(iterable, r)).index(element)``` - - The subsequences of *iterable* that are of length *r* where order is - important can be ordered lexicographically. :func:`permutation_index` - computes the index of the first *element* directly, without computing - the previous permutations. - - >>> permutation_index([1, 3, 2], range(5)) - 19 - - ``ValueError`` will be raised if the given *element* isn't one of the - permutations of *iterable*. - """ - index = 0 - pool = list(iterable) - for i, x in zip(range(len(pool), -1, -1), element): - r = pool.index(x) - index = index * i + r - del pool[r] - - return index - - -class countable: - """Wrap *iterable* and keep a count of how many items have been consumed. - - The ``items_seen`` attribute starts at ``0`` and increments as the iterable - is consumed: - - >>> iterable = map(str, range(10)) - >>> it = countable(iterable) - >>> it.items_seen - 0 - >>> next(it), next(it) - ('0', '1') - >>> list(it) - ['2', '3', '4', '5', '6', '7', '8', '9'] - >>> it.items_seen - 10 - """ - - def __init__(self, iterable): - self._it = iter(iterable) - self.items_seen = 0 - - def __iter__(self): - return self - - def __next__(self): - item = next(self._it) - self.items_seen += 1 - - return item - - -def chunked_even(iterable, n): - """Break *iterable* into lists of approximately length *n*. - Items are distributed such the lengths of the lists differ by at most - 1 item. - - >>> iterable = [1, 2, 3, 4, 5, 6, 7] - >>> n = 3 - >>> list(chunked_even(iterable, n)) # List lengths: 3, 2, 2 - [[1, 2, 3], [4, 5], [6, 7]] - >>> list(chunked(iterable, n)) # List lengths: 3, 3, 1 - [[1, 2, 3], [4, 5, 6], [7]] - - """ - iterable = iter(iterable) - - # Initialize a buffer to process the chunks while keeping - # some back to fill any underfilled chunks - min_buffer = (n - 1) * (n - 2) - buffer = list(islice(iterable, min_buffer)) - - # Append items until we have a completed chunk - for _ in islice(map(buffer.append, iterable), n, None, n): - yield buffer[:n] - del buffer[:n] - - # Check if any chunks need addition processing - if not buffer: - return - length = len(buffer) - - # Chunks are either size `full_size <= n` or `partial_size = full_size - 1` - q, r = divmod(length, n) - num_lists = q + (1 if r > 0 else 0) - q, r = divmod(length, num_lists) - full_size = q + (1 if r > 0 else 0) - partial_size = full_size - 1 - num_full = length - partial_size * num_lists - - # Yield chunks of full size - partial_start_idx = num_full * full_size - if full_size > 0: - for i in range(0, partial_start_idx, full_size): - yield buffer[i : i + full_size] - - # Yield chunks of partial size - if partial_size > 0: - for i in range(partial_start_idx, length, partial_size): - yield buffer[i : i + partial_size] - - -def zip_broadcast(*objects, scalar_types=(str, bytes), strict=False): - """A version of :func:`zip` that "broadcasts" any scalar - (i.e., non-iterable) items into output tuples. - - >>> iterable_1 = [1, 2, 3] - >>> iterable_2 = ['a', 'b', 'c'] - >>> scalar = '_' - >>> list(zip_broadcast(iterable_1, iterable_2, scalar)) - [(1, 'a', '_'), (2, 'b', '_'), (3, 'c', '_')] - - The *scalar_types* keyword argument determines what types are considered - scalar. It is set to ``(str, bytes)`` by default. Set it to ``None`` to - treat strings and byte strings as iterable: - - >>> list(zip_broadcast('abc', 0, 'xyz', scalar_types=None)) - [('a', 0, 'x'), ('b', 0, 'y'), ('c', 0, 'z')] - - If the *strict* keyword argument is ``True``, then - ``UnequalIterablesError`` will be raised if any of the iterables have - different lengths. - """ - - def is_scalar(obj): - if scalar_types and isinstance(obj, scalar_types): - return True - try: - iter(obj) - except TypeError: - return True - else: - return False - - size = len(objects) - if not size: - return - - new_item = [None] * size - iterables, iterable_positions = [], [] - for i, obj in enumerate(objects): - if is_scalar(obj): - new_item[i] = obj - else: - iterables.append(iter(obj)) - iterable_positions.append(i) - - if not iterables: - yield tuple(objects) - return - - zipper = _zip_equal if strict else zip - for item in zipper(*iterables): - for i, new_item[i] in zip(iterable_positions, item): - pass - yield tuple(new_item) - - -def unique_in_window(iterable, n, key=None): - """Yield the items from *iterable* that haven't been seen recently. - *n* is the size of the lookback window. - - >>> iterable = [0, 1, 0, 2, 3, 0] - >>> n = 3 - >>> list(unique_in_window(iterable, n)) - [0, 1, 2, 3, 0] - - The *key* function, if provided, will be used to determine uniqueness: - - >>> list(unique_in_window('abAcda', 3, key=lambda x: x.lower())) - ['a', 'b', 'c', 'd', 'a'] - - The items in *iterable* must be hashable. - - """ - if n <= 0: - raise ValueError('n must be greater than 0') - - window = deque(maxlen=n) - counts = defaultdict(int) - use_key = key is not None - - for item in iterable: - if len(window) == n: - to_discard = window[0] - if counts[to_discard] == 1: - del counts[to_discard] - else: - counts[to_discard] -= 1 - - k = key(item) if use_key else item - if k not in counts: - yield item - counts[k] += 1 - window.append(k) - - -def duplicates_everseen(iterable, key=None): - """Yield duplicate elements after their first appearance. - - >>> list(duplicates_everseen('mississippi')) - ['s', 'i', 's', 's', 'i', 'p', 'i'] - >>> list(duplicates_everseen('AaaBbbCccAaa', str.lower)) - ['a', 'a', 'b', 'b', 'c', 'c', 'A', 'a', 'a'] - - This function is analogous to :func:`unique_everseen` and is subject to - the same performance considerations. - - """ - seen_set = set() - seen_list = [] - use_key = key is not None - - for element in iterable: - k = key(element) if use_key else element - try: - if k not in seen_set: - seen_set.add(k) - else: - yield element - except TypeError: - if k not in seen_list: - seen_list.append(k) - else: - yield element - - -def duplicates_justseen(iterable, key=None): - """Yields serially-duplicate elements after their first appearance. - - >>> list(duplicates_justseen('mississippi')) - ['s', 's', 'p'] - >>> list(duplicates_justseen('AaaBbbCccAaa', str.lower)) - ['a', 'a', 'b', 'b', 'c', 'c', 'a', 'a'] - - This function is analogous to :func:`unique_justseen`. - - """ - return flatten(g for _, g in groupby(iterable, key) for _ in g) - - -def classify_unique(iterable, key=None): - """Classify each element in terms of its uniqueness. - - For each element in the input iterable, return a 3-tuple consisting of: - - 1. The element itself - 2. ``False`` if the element is equal to the one preceding it in the input, - ``True`` otherwise (i.e. the equivalent of :func:`unique_justseen`) - 3. ``False`` if this element has been seen anywhere in the input before, - ``True`` otherwise (i.e. the equivalent of :func:`unique_everseen`) - - >>> list(classify_unique('otto')) # doctest: +NORMALIZE_WHITESPACE - [('o', True, True), - ('t', True, True), - ('t', False, False), - ('o', True, False)] - - This function is analogous to :func:`unique_everseen` and is subject to - the same performance considerations. - - """ - seen_set = set() - seen_list = [] - use_key = key is not None - previous = None - - for i, element in enumerate(iterable): - k = key(element) if use_key else element - is_unique_justseen = not i or previous != k - previous = k - is_unique_everseen = False - try: - if k not in seen_set: - seen_set.add(k) - is_unique_everseen = True - except TypeError: - if k not in seen_list: - seen_list.append(k) - is_unique_everseen = True - yield element, is_unique_justseen, is_unique_everseen - - -def minmax(iterable_or_value, *others, key=None, default=_marker): - """Returns both the smallest and largest items in an iterable - or the largest of two or more arguments. - - >>> minmax([3, 1, 5]) - (1, 5) - - >>> minmax(4, 2, 6) - (2, 6) - - If a *key* function is provided, it will be used to transform the input - items for comparison. - - >>> minmax([5, 30], key=str) # '30' sorts before '5' - (30, 5) - - If a *default* value is provided, it will be returned if there are no - input items. - - >>> minmax([], default=(0, 0)) - (0, 0) - - Otherwise ``ValueError`` is raised. - - This function is based on the - `recipe `__ by - Raymond Hettinger and takes care to minimize the number of comparisons - performed. - """ - iterable = (iterable_or_value, *others) if others else iterable_or_value - - it = iter(iterable) - - try: - lo = hi = next(it) - except StopIteration as exc: - if default is _marker: - raise ValueError( - '`minmax()` argument is an empty iterable. ' - 'Provide a `default` value to suppress this error.' - ) from exc - return default - - # Different branches depending on the presence of key. This saves a lot - # of unimportant copies which would slow the "key=None" branch - # significantly down. - if key is None: - for x, y in zip_longest(it, it, fillvalue=lo): - if y < x: - x, y = y, x - if x < lo: - lo = x - if hi < y: - hi = y - - else: - lo_key = hi_key = key(lo) - - for x, y in zip_longest(it, it, fillvalue=lo): - x_key, y_key = key(x), key(y) - - if y_key < x_key: - x, y, x_key, y_key = y, x, y_key, x_key - if x_key < lo_key: - lo, lo_key = x, x_key - if hi_key < y_key: - hi, hi_key = y, y_key - - return lo, hi - - -def constrained_batches( - iterable, max_size, max_count=None, get_len=len, strict=True -): - """Yield batches of items from *iterable* with a combined size limited by - *max_size*. - - >>> iterable = [b'12345', b'123', b'12345678', b'1', b'1', b'12', b'1'] - >>> list(constrained_batches(iterable, 10)) - [(b'12345', b'123'), (b'12345678', b'1', b'1'), (b'12', b'1')] - - If a *max_count* is supplied, the number of items per batch is also - limited: - - >>> iterable = [b'12345', b'123', b'12345678', b'1', b'1', b'12', b'1'] - >>> list(constrained_batches(iterable, 10, max_count = 2)) - [(b'12345', b'123'), (b'12345678', b'1'), (b'1', b'12'), (b'1',)] - - If a *get_len* function is supplied, use that instead of :func:`len` to - determine item size. - - If *strict* is ``True``, raise ``ValueError`` if any single item is bigger - than *max_size*. Otherwise, allow single items to exceed *max_size*. - """ - if max_size <= 0: - raise ValueError('maximum size must be greater than zero') - - batch = [] - batch_size = 0 - batch_count = 0 - for item in iterable: - item_len = get_len(item) - if strict and item_len > max_size: - raise ValueError('item size exceeds maximum size') - - reached_count = batch_count == max_count - reached_size = item_len + batch_size > max_size - if batch_count and (reached_size or reached_count): - yield tuple(batch) - batch.clear() - batch_size = 0 - batch_count = 0 - - batch.append(item) - batch_size += item_len - batch_count += 1 - - if batch: - yield tuple(batch) - - -def gray_product(*iterables): - """Like :func:`itertools.product`, but return tuples in an order such - that only one element in the generated tuple changes from one iteration - to the next. - - >>> list(gray_product('AB','CD')) - [('A', 'C'), ('B', 'C'), ('B', 'D'), ('A', 'D')] - - This function consumes all of the input iterables before producing output. - If any of the input iterables have fewer than two items, ``ValueError`` - is raised. - - For information on the algorithm, see - `this section `__ - of Donald Knuth's *The Art of Computer Programming*. - """ - all_iterables = tuple(tuple(x) for x in iterables) - iterable_count = len(all_iterables) - for iterable in all_iterables: - if len(iterable) < 2: - raise ValueError("each iterable must have two or more items") - - # This is based on "Algorithm H" from section 7.2.1.1, page 20. - # a holds the indexes of the source iterables for the n-tuple to be yielded - # f is the array of "focus pointers" - # o is the array of "directions" - a = [0] * iterable_count - f = list(range(iterable_count + 1)) - o = [1] * iterable_count - while True: - yield tuple(all_iterables[i][a[i]] for i in range(iterable_count)) - j = f[0] - f[0] = 0 - if j == iterable_count: - break - a[j] = a[j] + o[j] - if a[j] == 0 or a[j] == len(all_iterables[j]) - 1: - o[j] = -o[j] - f[j] = f[j + 1] - f[j + 1] = j + 1 - - -def partial_product(*iterables): - """Yields tuples containing one item from each iterator, with subsequent - tuples changing a single item at a time by advancing each iterator until it - is exhausted. This sequence guarantees every value in each iterable is - output at least once without generating all possible combinations. - - This may be useful, for example, when testing an expensive function. - - >>> list(partial_product('AB', 'C', 'DEF')) - [('A', 'C', 'D'), ('B', 'C', 'D'), ('B', 'C', 'E'), ('B', 'C', 'F')] - """ - - iterators = list(map(iter, iterables)) - - try: - prod = [next(it) for it in iterators] - except StopIteration: - return - yield tuple(prod) - - for i, it in enumerate(iterators): - for prod[i] in it: - yield tuple(prod) - - -def takewhile_inclusive(predicate, iterable): - """A variant of :func:`takewhile` that yields one additional element. - - >>> list(takewhile_inclusive(lambda x: x < 5, [1, 4, 6, 4, 1])) - [1, 4, 6] - - :func:`takewhile` would return ``[1, 4]``. - """ - for x in iterable: - yield x - if not predicate(x): - break - - -def outer_product(func, xs, ys, *args, **kwargs): - """A generalized outer product that applies a binary function to all - pairs of items. Returns a 2D matrix with ``len(xs)`` rows and ``len(ys)`` - columns. - Also accepts ``*args`` and ``**kwargs`` that are passed to ``func``. - - Multiplication table: - - >>> list(outer_product(mul, range(1, 4), range(1, 6))) - [(1, 2, 3, 4, 5), (2, 4, 6, 8, 10), (3, 6, 9, 12, 15)] - - Cross tabulation: - - >>> xs = ['A', 'B', 'A', 'A', 'B', 'B', 'A', 'A', 'B', 'B'] - >>> ys = ['X', 'X', 'X', 'Y', 'Z', 'Z', 'Y', 'Y', 'Z', 'Z'] - >>> rows = list(zip(xs, ys)) - >>> count_rows = lambda x, y: rows.count((x, y)) - >>> list(outer_product(count_rows, sorted(set(xs)), sorted(set(ys)))) - [(2, 3, 0), (1, 0, 4)] - - Usage with ``*args`` and ``**kwargs``: - - >>> animals = ['cat', 'wolf', 'mouse'] - >>> list(outer_product(min, animals, animals, key=len)) - [('cat', 'cat', 'cat'), ('cat', 'wolf', 'wolf'), ('cat', 'wolf', 'mouse')] - """ - ys = tuple(ys) - return batched( - starmap(lambda x, y: func(x, y, *args, **kwargs), product(xs, ys)), - n=len(ys), - ) - - -def iter_suppress(iterable, *exceptions): - """Yield each of the items from *iterable*. If the iteration raises one of - the specified *exceptions*, that exception will be suppressed and iteration - will stop. - - >>> from itertools import chain - >>> def breaks_at_five(x): - ... while True: - ... if x >= 5: - ... raise RuntimeError - ... yield x - ... x += 1 - >>> it_1 = iter_suppress(breaks_at_five(1), RuntimeError) - >>> it_2 = iter_suppress(breaks_at_five(2), RuntimeError) - >>> list(chain(it_1, it_2)) - [1, 2, 3, 4, 2, 3, 4] - """ - try: - yield from iterable - except exceptions: - return - - -def filter_map(func, iterable): - """Apply *func* to every element of *iterable*, yielding only those which - are not ``None``. - - >>> elems = ['1', 'a', '2', 'b', '3'] - >>> list(filter_map(lambda s: int(s) if s.isnumeric() else None, elems)) - [1, 2, 3] - """ - for x in iterable: - y = func(x) - if y is not None: - yield y - - -def powerset_of_sets(iterable): - """Yields all possible subsets of the iterable. - - >>> list(powerset_of_sets([1, 2, 3])) # doctest: +SKIP - [set(), {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}] - >>> list(powerset_of_sets([1, 1, 0])) # doctest: +SKIP - [set(), {1}, {0}, {0, 1}] - - :func:`powerset_of_sets` takes care to minimize the number - of hash operations performed. - """ - sets = tuple(map(set, dict.fromkeys(map(frozenset, zip(iterable))))) - for r in range(len(sets) + 1): - yield from starmap(set().union, combinations(sets, r)) - - -def join_mappings(**field_to_map): - """ - Joins multiple mappings together using their common keys. - - >>> user_scores = {'elliot': 50, 'claris': 60} - >>> user_times = {'elliot': 30, 'claris': 40} - >>> join_mappings(score=user_scores, time=user_times) - {'elliot': {'score': 50, 'time': 30}, 'claris': {'score': 60, 'time': 40}} - """ - ret = defaultdict(dict) - - for field_name, mapping in field_to_map.items(): - for key, value in mapping.items(): - ret[key][field_name] = value - - return dict(ret) - - -def _complex_sumprod(v1, v2): - """High precision sumprod() for complex numbers. - Used by :func:`dft` and :func:`idft`. - """ - - r1 = chain((p.real for p in v1), (-p.imag for p in v1)) - r2 = chain((q.real for q in v2), (q.imag for q in v2)) - i1 = chain((p.real for p in v1), (p.imag for p in v1)) - i2 = chain((q.imag for q in v2), (q.real for q in v2)) - return complex(_fsumprod(r1, r2), _fsumprod(i1, i2)) - - -def dft(xarr): - """Discrete Fourier Tranform. *xarr* is a sequence of complex numbers. - Yields the components of the corresponding transformed output vector. - - >>> import cmath - >>> xarr = [1, 2-1j, -1j, -1+2j] - >>> Xarr = [2, -2-2j, -2j, 4+4j] - >>> all(map(cmath.isclose, dft(xarr), Xarr)) - True - - See :func:`idft` for the inverse Discrete Fourier Transform. - """ - N = len(xarr) - roots_of_unity = [e ** (n / N * tau * -1j) for n in range(N)] - for k in range(N): - coeffs = [roots_of_unity[k * n % N] for n in range(N)] - yield _complex_sumprod(xarr, coeffs) - - -def idft(Xarr): - """Inverse Discrete Fourier Tranform. *Xarr* is a sequence of - complex numbers. Yields the components of the corresponding - inverse-transformed output vector. - - >>> import cmath - >>> xarr = [1, 2-1j, -1j, -1+2j] - >>> Xarr = [2, -2-2j, -2j, 4+4j] - >>> all(map(cmath.isclose, idft(Xarr), xarr)) - True - - See :func:`dft` for the Discrete Fourier Transform. - """ - N = len(Xarr) - roots_of_unity = [e ** (n / N * tau * 1j) for n in range(N)] - for k in range(N): - coeffs = [roots_of_unity[k * n % N] for n in range(N)] - yield _complex_sumprod(Xarr, coeffs) / N - - -def doublestarmap(func, iterable): - """Apply *func* to every item of *iterable* by dictionary unpacking - the item into *func*. - - The difference between :func:`itertools.starmap` and :func:`doublestarmap` - parallels the distinction between ``func(*a)`` and ``func(**a)``. - - >>> iterable = [{'a': 1, 'b': 2}, {'a': 40, 'b': 60}] - >>> list(doublestarmap(lambda a, b: a + b, iterable)) - [3, 100] - - ``TypeError`` will be raised if *func*'s signature doesn't match the - mapping contained in *iterable* or if *iterable* does not contain mappings. - """ - for item in iterable: - yield func(**item) diff --git a/pkg_resources/_vendor/more_itertools/more.pyi b/pkg_resources/_vendor/more_itertools/more.pyi deleted file mode 100644 index e946023259..0000000000 --- a/pkg_resources/_vendor/more_itertools/more.pyi +++ /dev/null @@ -1,709 +0,0 @@ -"""Stubs for more_itertools.more""" - -from __future__ import annotations - -from types import TracebackType -from typing import ( - Any, - Callable, - Container, - ContextManager, - Generic, - Hashable, - Mapping, - Iterable, - Iterator, - Mapping, - overload, - Reversible, - Sequence, - Sized, - Type, - TypeVar, - type_check_only, -) -from typing_extensions import Protocol - -# Type and type variable definitions -_T = TypeVar('_T') -_T1 = TypeVar('_T1') -_T2 = TypeVar('_T2') -_U = TypeVar('_U') -_V = TypeVar('_V') -_W = TypeVar('_W') -_T_co = TypeVar('_T_co', covariant=True) -_GenFn = TypeVar('_GenFn', bound=Callable[..., Iterator[Any]]) -_Raisable = BaseException | Type[BaseException] - -@type_check_only -class _SizedIterable(Protocol[_T_co], Sized, Iterable[_T_co]): ... - -@type_check_only -class _SizedReversible(Protocol[_T_co], Sized, Reversible[_T_co]): ... - -@type_check_only -class _SupportsSlicing(Protocol[_T_co]): - def __getitem__(self, __k: slice) -> _T_co: ... - -def chunked( - iterable: Iterable[_T], n: int | None, strict: bool = ... -) -> Iterator[list[_T]]: ... -@overload -def first(iterable: Iterable[_T]) -> _T: ... -@overload -def first(iterable: Iterable[_T], default: _U) -> _T | _U: ... -@overload -def last(iterable: Iterable[_T]) -> _T: ... -@overload -def last(iterable: Iterable[_T], default: _U) -> _T | _U: ... -@overload -def nth_or_last(iterable: Iterable[_T], n: int) -> _T: ... -@overload -def nth_or_last(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ... - -class peekable(Generic[_T], Iterator[_T]): - def __init__(self, iterable: Iterable[_T]) -> None: ... - def __iter__(self) -> peekable[_T]: ... - def __bool__(self) -> bool: ... - @overload - def peek(self) -> _T: ... - @overload - def peek(self, default: _U) -> _T | _U: ... - def prepend(self, *items: _T) -> None: ... - def __next__(self) -> _T: ... - @overload - def __getitem__(self, index: int) -> _T: ... - @overload - def __getitem__(self, index: slice) -> list[_T]: ... - -def consumer(func: _GenFn) -> _GenFn: ... -def ilen(iterable: Iterable[_T]) -> int: ... -def iterate(func: Callable[[_T], _T], start: _T) -> Iterator[_T]: ... -def with_iter( - context_manager: ContextManager[Iterable[_T]], -) -> Iterator[_T]: ... -def one( - iterable: Iterable[_T], - too_short: _Raisable | None = ..., - too_long: _Raisable | None = ..., -) -> _T: ... -def raise_(exception: _Raisable, *args: Any) -> None: ... -def strictly_n( - iterable: Iterable[_T], - n: int, - too_short: _GenFn | None = ..., - too_long: _GenFn | None = ..., -) -> list[_T]: ... -def distinct_permutations( - iterable: Iterable[_T], r: int | None = ... -) -> Iterator[tuple[_T, ...]]: ... -def intersperse( - e: _U, iterable: Iterable[_T], n: int = ... -) -> Iterator[_T | _U]: ... -def unique_to_each(*iterables: Iterable[_T]) -> list[list[_T]]: ... -@overload -def windowed( - seq: Iterable[_T], n: int, *, step: int = ... -) -> Iterator[tuple[_T | None, ...]]: ... -@overload -def windowed( - seq: Iterable[_T], n: int, fillvalue: _U, step: int = ... -) -> Iterator[tuple[_T | _U, ...]]: ... -def substrings(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ... -def substrings_indexes( - seq: Sequence[_T], reverse: bool = ... -) -> Iterator[tuple[Sequence[_T], int, int]]: ... - -class bucket(Generic[_T, _U], Container[_U]): - def __init__( - self, - iterable: Iterable[_T], - key: Callable[[_T], _U], - validator: Callable[[_U], object] | None = ..., - ) -> None: ... - def __contains__(self, value: object) -> bool: ... - def __iter__(self) -> Iterator[_U]: ... - def __getitem__(self, value: object) -> Iterator[_T]: ... - -def spy( - iterable: Iterable[_T], n: int = ... -) -> tuple[list[_T], Iterator[_T]]: ... -def interleave(*iterables: Iterable[_T]) -> Iterator[_T]: ... -def interleave_longest(*iterables: Iterable[_T]) -> Iterator[_T]: ... -def interleave_evenly( - iterables: list[Iterable[_T]], lengths: list[int] | None = ... -) -> Iterator[_T]: ... -def collapse( - iterable: Iterable[Any], - base_type: type | None = ..., - levels: int | None = ..., -) -> Iterator[Any]: ... -@overload -def side_effect( - func: Callable[[_T], object], - iterable: Iterable[_T], - chunk_size: None = ..., - before: Callable[[], object] | None = ..., - after: Callable[[], object] | None = ..., -) -> Iterator[_T]: ... -@overload -def side_effect( - func: Callable[[list[_T]], object], - iterable: Iterable[_T], - chunk_size: int, - before: Callable[[], object] | None = ..., - after: Callable[[], object] | None = ..., -) -> Iterator[_T]: ... -def sliced( - seq: _SupportsSlicing[_T], n: int, strict: bool = ... -) -> Iterator[_T]: ... -def split_at( - iterable: Iterable[_T], - pred: Callable[[_T], object], - maxsplit: int = ..., - keep_separator: bool = ..., -) -> Iterator[list[_T]]: ... -def split_before( - iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ... -) -> Iterator[list[_T]]: ... -def split_after( - iterable: Iterable[_T], pred: Callable[[_T], object], maxsplit: int = ... -) -> Iterator[list[_T]]: ... -def split_when( - iterable: Iterable[_T], - pred: Callable[[_T, _T], object], - maxsplit: int = ..., -) -> Iterator[list[_T]]: ... -def split_into( - iterable: Iterable[_T], sizes: Iterable[int | None] -) -> Iterator[list[_T]]: ... -@overload -def padded( - iterable: Iterable[_T], - *, - n: int | None = ..., - next_multiple: bool = ..., -) -> Iterator[_T | None]: ... -@overload -def padded( - iterable: Iterable[_T], - fillvalue: _U, - n: int | None = ..., - next_multiple: bool = ..., -) -> Iterator[_T | _U]: ... -@overload -def repeat_last(iterable: Iterable[_T]) -> Iterator[_T]: ... -@overload -def repeat_last(iterable: Iterable[_T], default: _U) -> Iterator[_T | _U]: ... -def distribute(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ... -@overload -def stagger( - iterable: Iterable[_T], - offsets: _SizedIterable[int] = ..., - longest: bool = ..., -) -> Iterator[tuple[_T | None, ...]]: ... -@overload -def stagger( - iterable: Iterable[_T], - offsets: _SizedIterable[int] = ..., - longest: bool = ..., - fillvalue: _U = ..., -) -> Iterator[tuple[_T | _U, ...]]: ... - -class UnequalIterablesError(ValueError): - def __init__(self, details: tuple[int, int, int] | None = ...) -> None: ... - -@overload -def zip_equal(__iter1: Iterable[_T1]) -> Iterator[tuple[_T1]]: ... -@overload -def zip_equal( - __iter1: Iterable[_T1], __iter2: Iterable[_T2] -) -> Iterator[tuple[_T1, _T2]]: ... -@overload -def zip_equal( - __iter1: Iterable[_T], - __iter2: Iterable[_T], - __iter3: Iterable[_T], - *iterables: Iterable[_T], -) -> Iterator[tuple[_T, ...]]: ... -@overload -def zip_offset( - __iter1: Iterable[_T1], - *, - offsets: _SizedIterable[int], - longest: bool = ..., - fillvalue: None = None, -) -> Iterator[tuple[_T1 | None]]: ... -@overload -def zip_offset( - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - *, - offsets: _SizedIterable[int], - longest: bool = ..., - fillvalue: None = None, -) -> Iterator[tuple[_T1 | None, _T2 | None]]: ... -@overload -def zip_offset( - __iter1: Iterable[_T], - __iter2: Iterable[_T], - __iter3: Iterable[_T], - *iterables: Iterable[_T], - offsets: _SizedIterable[int], - longest: bool = ..., - fillvalue: None = None, -) -> Iterator[tuple[_T | None, ...]]: ... -@overload -def zip_offset( - __iter1: Iterable[_T1], - *, - offsets: _SizedIterable[int], - longest: bool = ..., - fillvalue: _U, -) -> Iterator[tuple[_T1 | _U]]: ... -@overload -def zip_offset( - __iter1: Iterable[_T1], - __iter2: Iterable[_T2], - *, - offsets: _SizedIterable[int], - longest: bool = ..., - fillvalue: _U, -) -> Iterator[tuple[_T1 | _U, _T2 | _U]]: ... -@overload -def zip_offset( - __iter1: Iterable[_T], - __iter2: Iterable[_T], - __iter3: Iterable[_T], - *iterables: Iterable[_T], - offsets: _SizedIterable[int], - longest: bool = ..., - fillvalue: _U, -) -> Iterator[tuple[_T | _U, ...]]: ... -def sort_together( - iterables: Iterable[Iterable[_T]], - key_list: Iterable[int] = ..., - key: Callable[..., Any] | None = ..., - reverse: bool = ..., -) -> list[tuple[_T, ...]]: ... -def unzip(iterable: Iterable[Sequence[_T]]) -> tuple[Iterator[_T], ...]: ... -def divide(n: int, iterable: Iterable[_T]) -> list[Iterator[_T]]: ... -def always_iterable( - obj: object, - base_type: type | tuple[type | tuple[Any, ...], ...] | None = ..., -) -> Iterator[Any]: ... -def adjacent( - predicate: Callable[[_T], bool], - iterable: Iterable[_T], - distance: int = ..., -) -> Iterator[tuple[bool, _T]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: None = None, - valuefunc: None = None, - reducefunc: None = None, -) -> Iterator[tuple[_T, Iterator[_T]]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: None, - reducefunc: None, -) -> Iterator[tuple[_U, Iterator[_T]]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: None, - valuefunc: Callable[[_T], _V], - reducefunc: None, -) -> Iterable[tuple[_T, Iterable[_V]]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: Callable[[_T], _V], - reducefunc: None, -) -> Iterable[tuple[_U, Iterator[_V]]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: None, - valuefunc: None, - reducefunc: Callable[[Iterator[_T]], _W], -) -> Iterable[tuple[_T, _W]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: None, - reducefunc: Callable[[Iterator[_T]], _W], -) -> Iterable[tuple[_U, _W]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: None, - valuefunc: Callable[[_T], _V], - reducefunc: Callable[[Iterable[_V]], _W], -) -> Iterable[tuple[_T, _W]]: ... -@overload -def groupby_transform( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: Callable[[_T], _V], - reducefunc: Callable[[Iterable[_V]], _W], -) -> Iterable[tuple[_U, _W]]: ... - -class numeric_range(Generic[_T, _U], Sequence[_T], Hashable, Reversible[_T]): - @overload - def __init__(self, __stop: _T) -> None: ... - @overload - def __init__(self, __start: _T, __stop: _T) -> None: ... - @overload - def __init__(self, __start: _T, __stop: _T, __step: _U) -> None: ... - def __bool__(self) -> bool: ... - def __contains__(self, elem: object) -> bool: ... - def __eq__(self, other: object) -> bool: ... - @overload - def __getitem__(self, key: int) -> _T: ... - @overload - def __getitem__(self, key: slice) -> numeric_range[_T, _U]: ... - def __hash__(self) -> int: ... - def __iter__(self) -> Iterator[_T]: ... - def __len__(self) -> int: ... - def __reduce__( - self, - ) -> tuple[Type[numeric_range[_T, _U]], tuple[_T, _T, _U]]: ... - def __repr__(self) -> str: ... - def __reversed__(self) -> Iterator[_T]: ... - def count(self, value: _T) -> int: ... - def index(self, value: _T) -> int: ... # type: ignore - -def count_cycle( - iterable: Iterable[_T], n: int | None = ... -) -> Iterable[tuple[int, _T]]: ... -def mark_ends( - iterable: Iterable[_T], -) -> Iterable[tuple[bool, bool, _T]]: ... -def locate( - iterable: Iterable[_T], - pred: Callable[..., Any] = ..., - window_size: int | None = ..., -) -> Iterator[int]: ... -def lstrip( - iterable: Iterable[_T], pred: Callable[[_T], object] -) -> Iterator[_T]: ... -def rstrip( - iterable: Iterable[_T], pred: Callable[[_T], object] -) -> Iterator[_T]: ... -def strip( - iterable: Iterable[_T], pred: Callable[[_T], object] -) -> Iterator[_T]: ... - -class islice_extended(Generic[_T], Iterator[_T]): - def __init__(self, iterable: Iterable[_T], *args: int | None) -> None: ... - def __iter__(self) -> islice_extended[_T]: ... - def __next__(self) -> _T: ... - def __getitem__(self, index: slice) -> islice_extended[_T]: ... - -def always_reversible(iterable: Iterable[_T]) -> Iterator[_T]: ... -def consecutive_groups( - iterable: Iterable[_T], ordering: Callable[[_T], int] = ... -) -> Iterator[Iterator[_T]]: ... -@overload -def difference( - iterable: Iterable[_T], - func: Callable[[_T, _T], _U] = ..., - *, - initial: None = ..., -) -> Iterator[_T | _U]: ... -@overload -def difference( - iterable: Iterable[_T], func: Callable[[_T, _T], _U] = ..., *, initial: _U -) -> Iterator[_U]: ... - -class SequenceView(Generic[_T], Sequence[_T]): - def __init__(self, target: Sequence[_T]) -> None: ... - @overload - def __getitem__(self, index: int) -> _T: ... - @overload - def __getitem__(self, index: slice) -> Sequence[_T]: ... - def __len__(self) -> int: ... - -class seekable(Generic[_T], Iterator[_T]): - def __init__( - self, iterable: Iterable[_T], maxlen: int | None = ... - ) -> None: ... - def __iter__(self) -> seekable[_T]: ... - def __next__(self) -> _T: ... - def __bool__(self) -> bool: ... - @overload - def peek(self) -> _T: ... - @overload - def peek(self, default: _U) -> _T | _U: ... - def elements(self) -> SequenceView[_T]: ... - def seek(self, index: int) -> None: ... - def relative_seek(self, count: int) -> None: ... - -class run_length: - @staticmethod - def encode(iterable: Iterable[_T]) -> Iterator[tuple[_T, int]]: ... - @staticmethod - def decode(iterable: Iterable[tuple[_T, int]]) -> Iterator[_T]: ... - -def exactly_n( - iterable: Iterable[_T], n: int, predicate: Callable[[_T], object] = ... -) -> bool: ... -def circular_shifts(iterable: Iterable[_T]) -> list[tuple[_T, ...]]: ... -def make_decorator( - wrapping_func: Callable[..., _U], result_index: int = ... -) -> Callable[..., Callable[[Callable[..., Any]], Callable[..., _U]]]: ... -@overload -def map_reduce( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: None = ..., - reducefunc: None = ..., -) -> dict[_U, list[_T]]: ... -@overload -def map_reduce( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: Callable[[_T], _V], - reducefunc: None = ..., -) -> dict[_U, list[_V]]: ... -@overload -def map_reduce( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: None = ..., - reducefunc: Callable[[list[_T]], _W] = ..., -) -> dict[_U, _W]: ... -@overload -def map_reduce( - iterable: Iterable[_T], - keyfunc: Callable[[_T], _U], - valuefunc: Callable[[_T], _V], - reducefunc: Callable[[list[_V]], _W], -) -> dict[_U, _W]: ... -def rlocate( - iterable: Iterable[_T], - pred: Callable[..., object] = ..., - window_size: int | None = ..., -) -> Iterator[int]: ... -def replace( - iterable: Iterable[_T], - pred: Callable[..., object], - substitutes: Iterable[_U], - count: int | None = ..., - window_size: int = ..., -) -> Iterator[_T | _U]: ... -def partitions(iterable: Iterable[_T]) -> Iterator[list[list[_T]]]: ... -def set_partitions( - iterable: Iterable[_T], k: int | None = ... -) -> Iterator[list[list[_T]]]: ... - -class time_limited(Generic[_T], Iterator[_T]): - def __init__( - self, limit_seconds: float, iterable: Iterable[_T] - ) -> None: ... - def __iter__(self) -> islice_extended[_T]: ... - def __next__(self) -> _T: ... - -@overload -def only( - iterable: Iterable[_T], *, too_long: _Raisable | None = ... -) -> _T | None: ... -@overload -def only( - iterable: Iterable[_T], default: _U, too_long: _Raisable | None = ... -) -> _T | _U: ... -def ichunked(iterable: Iterable[_T], n: int) -> Iterator[Iterator[_T]]: ... -def distinct_combinations( - iterable: Iterable[_T], r: int -) -> Iterator[tuple[_T, ...]]: ... -def filter_except( - validator: Callable[[Any], object], - iterable: Iterable[_T], - *exceptions: Type[BaseException], -) -> Iterator[_T]: ... -def map_except( - function: Callable[[Any], _U], - iterable: Iterable[_T], - *exceptions: Type[BaseException], -) -> Iterator[_U]: ... -def map_if( - iterable: Iterable[Any], - pred: Callable[[Any], bool], - func: Callable[[Any], Any], - func_else: Callable[[Any], Any] | None = ..., -) -> Iterator[Any]: ... -def sample( - iterable: Iterable[_T], - k: int, - weights: Iterable[float] | None = ..., -) -> list[_T]: ... -def is_sorted( - iterable: Iterable[_T], - key: Callable[[_T], _U] | None = ..., - reverse: bool = False, - strict: bool = False, -) -> bool: ... - -class AbortThread(BaseException): - pass - -class callback_iter(Generic[_T], Iterator[_T]): - def __init__( - self, - func: Callable[..., Any], - callback_kwd: str = ..., - wait_seconds: float = ..., - ) -> None: ... - def __enter__(self) -> callback_iter[_T]: ... - def __exit__( - self, - exc_type: Type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> bool | None: ... - def __iter__(self) -> callback_iter[_T]: ... - def __next__(self) -> _T: ... - def _reader(self) -> Iterator[_T]: ... - @property - def done(self) -> bool: ... - @property - def result(self) -> Any: ... - -def windowed_complete( - iterable: Iterable[_T], n: int -) -> Iterator[tuple[_T, ...]]: ... -def all_unique( - iterable: Iterable[_T], key: Callable[[_T], _U] | None = ... -) -> bool: ... -def nth_product(index: int, *args: Iterable[_T]) -> tuple[_T, ...]: ... -def nth_combination_with_replacement( - iterable: Iterable[_T], r: int, index: int -) -> tuple[_T, ...]: ... -def nth_permutation( - iterable: Iterable[_T], r: int, index: int -) -> tuple[_T, ...]: ... -def value_chain(*args: _T | Iterable[_T]) -> Iterable[_T]: ... -def product_index(element: Iterable[_T], *args: Iterable[_T]) -> int: ... -def combination_index( - element: Iterable[_T], iterable: Iterable[_T] -) -> int: ... -def combination_with_replacement_index( - element: Iterable[_T], iterable: Iterable[_T] -) -> int: ... -def permutation_index( - element: Iterable[_T], iterable: Iterable[_T] -) -> int: ... -def repeat_each(iterable: Iterable[_T], n: int = ...) -> Iterator[_T]: ... - -class countable(Generic[_T], Iterator[_T]): - def __init__(self, iterable: Iterable[_T]) -> None: ... - def __iter__(self) -> countable[_T]: ... - def __next__(self) -> _T: ... - items_seen: int - -def chunked_even(iterable: Iterable[_T], n: int) -> Iterator[list[_T]]: ... -def zip_broadcast( - *objects: _T | Iterable[_T], - scalar_types: type | tuple[type | tuple[Any, ...], ...] | None = ..., - strict: bool = ..., -) -> Iterable[tuple[_T, ...]]: ... -def unique_in_window( - iterable: Iterable[_T], n: int, key: Callable[[_T], _U] | None = ... -) -> Iterator[_T]: ... -def duplicates_everseen( - iterable: Iterable[_T], key: Callable[[_T], _U] | None = ... -) -> Iterator[_T]: ... -def duplicates_justseen( - iterable: Iterable[_T], key: Callable[[_T], _U] | None = ... -) -> Iterator[_T]: ... -def classify_unique( - iterable: Iterable[_T], key: Callable[[_T], _U] | None = ... -) -> Iterator[tuple[_T, bool, bool]]: ... - -class _SupportsLessThan(Protocol): - def __lt__(self, __other: Any) -> bool: ... - -_SupportsLessThanT = TypeVar("_SupportsLessThanT", bound=_SupportsLessThan) - -@overload -def minmax( - iterable_or_value: Iterable[_SupportsLessThanT], *, key: None = None -) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ... -@overload -def minmax( - iterable_or_value: Iterable[_T], *, key: Callable[[_T], _SupportsLessThan] -) -> tuple[_T, _T]: ... -@overload -def minmax( - iterable_or_value: Iterable[_SupportsLessThanT], - *, - key: None = None, - default: _U, -) -> _U | tuple[_SupportsLessThanT, _SupportsLessThanT]: ... -@overload -def minmax( - iterable_or_value: Iterable[_T], - *, - key: Callable[[_T], _SupportsLessThan], - default: _U, -) -> _U | tuple[_T, _T]: ... -@overload -def minmax( - iterable_or_value: _SupportsLessThanT, - __other: _SupportsLessThanT, - *others: _SupportsLessThanT, -) -> tuple[_SupportsLessThanT, _SupportsLessThanT]: ... -@overload -def minmax( - iterable_or_value: _T, - __other: _T, - *others: _T, - key: Callable[[_T], _SupportsLessThan], -) -> tuple[_T, _T]: ... -def longest_common_prefix( - iterables: Iterable[Iterable[_T]], -) -> Iterator[_T]: ... -def iequals(*iterables: Iterable[Any]) -> bool: ... -def constrained_batches( - iterable: Iterable[_T], - max_size: int, - max_count: int | None = ..., - get_len: Callable[[_T], object] = ..., - strict: bool = ..., -) -> Iterator[tuple[_T]]: ... -def gray_product(*iterables: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ... -def partial_product(*iterables: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ... -def takewhile_inclusive( - predicate: Callable[[_T], bool], iterable: Iterable[_T] -) -> Iterator[_T]: ... -def outer_product( - func: Callable[[_T, _U], _V], - xs: Iterable[_T], - ys: Iterable[_U], - *args: Any, - **kwargs: Any, -) -> Iterator[tuple[_V, ...]]: ... -def iter_suppress( - iterable: Iterable[_T], - *exceptions: Type[BaseException], -) -> Iterator[_T]: ... -def filter_map( - func: Callable[[_T], _V | None], - iterable: Iterable[_T], -) -> Iterator[_V]: ... -def powerset_of_sets(iterable: Iterable[_T]) -> Iterator[set[_T]]: ... -def join_mappings( - **field_to_map: Mapping[_T, _V] -) -> dict[_T, dict[str, _V]]: ... -def doublestarmap( - func: Callable[..., _T], - iterable: Iterable[Mapping[str, Any]], -) -> Iterator[_T]: ... -def dft(xarr: Sequence[complex]) -> Iterator[complex]: ... -def idft(Xarr: Sequence[complex]) -> Iterator[complex]: ... diff --git a/pkg_resources/_vendor/more_itertools/py.typed b/pkg_resources/_vendor/more_itertools/py.typed deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/pkg_resources/_vendor/more_itertools/recipes.py b/pkg_resources/_vendor/more_itertools/recipes.py deleted file mode 100644 index b32fa95533..0000000000 --- a/pkg_resources/_vendor/more_itertools/recipes.py +++ /dev/null @@ -1,1046 +0,0 @@ -"""Imported from the recipes section of the itertools documentation. - -All functions taken from the recipes section of the itertools library docs -[1]_. -Some backward-compatible usability improvements have been made. - -.. [1] http://docs.python.org/library/itertools.html#recipes - -""" - -import math -import operator - -from collections import deque -from collections.abc import Sized -from functools import partial, reduce -from itertools import ( - chain, - combinations, - compress, - count, - cycle, - groupby, - islice, - product, - repeat, - starmap, - tee, - zip_longest, -) -from random import randrange, sample, choice -from sys import hexversion - -__all__ = [ - 'all_equal', - 'batched', - 'before_and_after', - 'consume', - 'convolve', - 'dotproduct', - 'first_true', - 'factor', - 'flatten', - 'grouper', - 'iter_except', - 'iter_index', - 'matmul', - 'ncycles', - 'nth', - 'nth_combination', - 'padnone', - 'pad_none', - 'pairwise', - 'partition', - 'polynomial_eval', - 'polynomial_from_roots', - 'polynomial_derivative', - 'powerset', - 'prepend', - 'quantify', - 'reshape', - 'random_combination_with_replacement', - 'random_combination', - 'random_permutation', - 'random_product', - 'repeatfunc', - 'roundrobin', - 'sieve', - 'sliding_window', - 'subslices', - 'sum_of_squares', - 'tabulate', - 'tail', - 'take', - 'totient', - 'transpose', - 'triplewise', - 'unique', - 'unique_everseen', - 'unique_justseen', -] - -_marker = object() - - -# zip with strict is available for Python 3.10+ -try: - zip(strict=True) -except TypeError: - _zip_strict = zip -else: - _zip_strict = partial(zip, strict=True) - -# math.sumprod is available for Python 3.12+ -_sumprod = getattr(math, 'sumprod', lambda x, y: dotproduct(x, y)) - - -def take(n, iterable): - """Return first *n* items of the iterable as a list. - - >>> take(3, range(10)) - [0, 1, 2] - - If there are fewer than *n* items in the iterable, all of them are - returned. - - >>> take(10, range(3)) - [0, 1, 2] - - """ - return list(islice(iterable, n)) - - -def tabulate(function, start=0): - """Return an iterator over the results of ``func(start)``, - ``func(start + 1)``, ``func(start + 2)``... - - *func* should be a function that accepts one integer argument. - - If *start* is not specified it defaults to 0. It will be incremented each - time the iterator is advanced. - - >>> square = lambda x: x ** 2 - >>> iterator = tabulate(square, -3) - >>> take(4, iterator) - [9, 4, 1, 0] - - """ - return map(function, count(start)) - - -def tail(n, iterable): - """Return an iterator over the last *n* items of *iterable*. - - >>> t = tail(3, 'ABCDEFG') - >>> list(t) - ['E', 'F', 'G'] - - """ - # If the given iterable has a length, then we can use islice to get its - # final elements. Note that if the iterable is not actually Iterable, - # either islice or deque will throw a TypeError. This is why we don't - # check if it is Iterable. - if isinstance(iterable, Sized): - yield from islice(iterable, max(0, len(iterable) - n), None) - else: - yield from iter(deque(iterable, maxlen=n)) - - -def consume(iterator, n=None): - """Advance *iterable* by *n* steps. If *n* is ``None``, consume it - entirely. - - Efficiently exhausts an iterator without returning values. Defaults to - consuming the whole iterator, but an optional second argument may be - provided to limit consumption. - - >>> i = (x for x in range(10)) - >>> next(i) - 0 - >>> consume(i, 3) - >>> next(i) - 4 - >>> consume(i) - >>> next(i) - Traceback (most recent call last): - File "", line 1, in - StopIteration - - If the iterator has fewer items remaining than the provided limit, the - whole iterator will be consumed. - - >>> i = (x for x in range(3)) - >>> consume(i, 5) - >>> next(i) - Traceback (most recent call last): - File "", line 1, in - StopIteration - - """ - # Use functions that consume iterators at C speed. - if n is None: - # feed the entire iterator into a zero-length deque - deque(iterator, maxlen=0) - else: - # advance to the empty slice starting at position n - next(islice(iterator, n, n), None) - - -def nth(iterable, n, default=None): - """Returns the nth item or a default value. - - >>> l = range(10) - >>> nth(l, 3) - 3 - >>> nth(l, 20, "zebra") - 'zebra' - - """ - return next(islice(iterable, n, None), default) - - -def all_equal(iterable, key=None): - """ - Returns ``True`` if all the elements are equal to each other. - - >>> all_equal('aaaa') - True - >>> all_equal('aaab') - False - - A function that accepts a single argument and returns a transformed version - of each input item can be specified with *key*: - - >>> all_equal('AaaA', key=str.casefold) - True - >>> all_equal([1, 2, 3], key=lambda x: x < 10) - True - - """ - return len(list(islice(groupby(iterable, key), 2))) <= 1 - - -def quantify(iterable, pred=bool): - """Return the how many times the predicate is true. - - >>> quantify([True, False, True]) - 2 - - """ - return sum(map(pred, iterable)) - - -def pad_none(iterable): - """Returns the sequence of elements and then returns ``None`` indefinitely. - - >>> take(5, pad_none(range(3))) - [0, 1, 2, None, None] - - Useful for emulating the behavior of the built-in :func:`map` function. - - See also :func:`padded`. - - """ - return chain(iterable, repeat(None)) - - -padnone = pad_none - - -def ncycles(iterable, n): - """Returns the sequence elements *n* times - - >>> list(ncycles(["a", "b"], 3)) - ['a', 'b', 'a', 'b', 'a', 'b'] - - """ - return chain.from_iterable(repeat(tuple(iterable), n)) - - -def dotproduct(vec1, vec2): - """Returns the dot product of the two iterables. - - >>> dotproduct([10, 10], [20, 20]) - 400 - - """ - return sum(map(operator.mul, vec1, vec2)) - - -def flatten(listOfLists): - """Return an iterator flattening one level of nesting in a list of lists. - - >>> list(flatten([[0, 1], [2, 3]])) - [0, 1, 2, 3] - - See also :func:`collapse`, which can flatten multiple levels of nesting. - - """ - return chain.from_iterable(listOfLists) - - -def repeatfunc(func, times=None, *args): - """Call *func* with *args* repeatedly, returning an iterable over the - results. - - If *times* is specified, the iterable will terminate after that many - repetitions: - - >>> from operator import add - >>> times = 4 - >>> args = 3, 5 - >>> list(repeatfunc(add, times, *args)) - [8, 8, 8, 8] - - If *times* is ``None`` the iterable will not terminate: - - >>> from random import randrange - >>> times = None - >>> args = 1, 11 - >>> take(6, repeatfunc(randrange, times, *args)) # doctest:+SKIP - [2, 4, 8, 1, 8, 4] - - """ - if times is None: - return starmap(func, repeat(args)) - return starmap(func, repeat(args, times)) - - -def _pairwise(iterable): - """Returns an iterator of paired items, overlapping, from the original - - >>> take(4, pairwise(count())) - [(0, 1), (1, 2), (2, 3), (3, 4)] - - On Python 3.10 and above, this is an alias for :func:`itertools.pairwise`. - - """ - a, b = tee(iterable) - next(b, None) - return zip(a, b) - - -try: - from itertools import pairwise as itertools_pairwise -except ImportError: - pairwise = _pairwise -else: - - def pairwise(iterable): - return itertools_pairwise(iterable) - - pairwise.__doc__ = _pairwise.__doc__ - - -class UnequalIterablesError(ValueError): - def __init__(self, details=None): - msg = 'Iterables have different lengths' - if details is not None: - msg += (': index 0 has length {}; index {} has length {}').format( - *details - ) - - super().__init__(msg) - - -def _zip_equal_generator(iterables): - for combo in zip_longest(*iterables, fillvalue=_marker): - for val in combo: - if val is _marker: - raise UnequalIterablesError() - yield combo - - -def _zip_equal(*iterables): - # Check whether the iterables are all the same size. - try: - first_size = len(iterables[0]) - for i, it in enumerate(iterables[1:], 1): - size = len(it) - if size != first_size: - raise UnequalIterablesError(details=(first_size, i, size)) - # All sizes are equal, we can use the built-in zip. - return zip(*iterables) - # If any one of the iterables didn't have a length, start reading - # them until one runs out. - except TypeError: - return _zip_equal_generator(iterables) - - -def grouper(iterable, n, incomplete='fill', fillvalue=None): - """Group elements from *iterable* into fixed-length groups of length *n*. - - >>> list(grouper('ABCDEF', 3)) - [('A', 'B', 'C'), ('D', 'E', 'F')] - - The keyword arguments *incomplete* and *fillvalue* control what happens for - iterables whose length is not a multiple of *n*. - - When *incomplete* is `'fill'`, the last group will contain instances of - *fillvalue*. - - >>> list(grouper('ABCDEFG', 3, incomplete='fill', fillvalue='x')) - [('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'x', 'x')] - - When *incomplete* is `'ignore'`, the last group will not be emitted. - - >>> list(grouper('ABCDEFG', 3, incomplete='ignore', fillvalue='x')) - [('A', 'B', 'C'), ('D', 'E', 'F')] - - When *incomplete* is `'strict'`, a subclass of `ValueError` will be raised. - - >>> it = grouper('ABCDEFG', 3, incomplete='strict') - >>> list(it) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - UnequalIterablesError - - """ - args = [iter(iterable)] * n - if incomplete == 'fill': - return zip_longest(*args, fillvalue=fillvalue) - if incomplete == 'strict': - return _zip_equal(*args) - if incomplete == 'ignore': - return zip(*args) - else: - raise ValueError('Expected fill, strict, or ignore') - - -def roundrobin(*iterables): - """Yields an item from each iterable, alternating between them. - - >>> list(roundrobin('ABC', 'D', 'EF')) - ['A', 'D', 'E', 'B', 'F', 'C'] - - This function produces the same output as :func:`interleave_longest`, but - may perform better for some inputs (in particular when the number of - iterables is small). - - """ - # Algorithm credited to George Sakkis - iterators = map(iter, iterables) - for num_active in range(len(iterables), 0, -1): - iterators = cycle(islice(iterators, num_active)) - yield from map(next, iterators) - - -def partition(pred, iterable): - """ - Returns a 2-tuple of iterables derived from the input iterable. - The first yields the items that have ``pred(item) == False``. - The second yields the items that have ``pred(item) == True``. - - >>> is_odd = lambda x: x % 2 != 0 - >>> iterable = range(10) - >>> even_items, odd_items = partition(is_odd, iterable) - >>> list(even_items), list(odd_items) - ([0, 2, 4, 6, 8], [1, 3, 5, 7, 9]) - - If *pred* is None, :func:`bool` is used. - - >>> iterable = [0, 1, False, True, '', ' '] - >>> false_items, true_items = partition(None, iterable) - >>> list(false_items), list(true_items) - ([0, False, ''], [1, True, ' ']) - - """ - if pred is None: - pred = bool - - t1, t2, p = tee(iterable, 3) - p1, p2 = tee(map(pred, p)) - return (compress(t1, map(operator.not_, p1)), compress(t2, p2)) - - -def powerset(iterable): - """Yields all possible subsets of the iterable. - - >>> list(powerset([1, 2, 3])) - [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)] - - :func:`powerset` will operate on iterables that aren't :class:`set` - instances, so repeated elements in the input will produce repeated elements - in the output. - - >>> seq = [1, 1, 0] - >>> list(powerset(seq)) - [(), (1,), (1,), (0,), (1, 1), (1, 0), (1, 0), (1, 1, 0)] - - For a variant that efficiently yields actual :class:`set` instances, see - :func:`powerset_of_sets`. - """ - s = list(iterable) - return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1)) - - -def unique_everseen(iterable, key=None): - """ - Yield unique elements, preserving order. - - >>> list(unique_everseen('AAAABBBCCDAABBB')) - ['A', 'B', 'C', 'D'] - >>> list(unique_everseen('ABBCcAD', str.lower)) - ['A', 'B', 'C', 'D'] - - Sequences with a mix of hashable and unhashable items can be used. - The function will be slower (i.e., `O(n^2)`) for unhashable items. - - Remember that ``list`` objects are unhashable - you can use the *key* - parameter to transform the list to a tuple (which is hashable) to - avoid a slowdown. - - >>> iterable = ([1, 2], [2, 3], [1, 2]) - >>> list(unique_everseen(iterable)) # Slow - [[1, 2], [2, 3]] - >>> list(unique_everseen(iterable, key=tuple)) # Faster - [[1, 2], [2, 3]] - - Similarly, you may want to convert unhashable ``set`` objects with - ``key=frozenset``. For ``dict`` objects, - ``key=lambda x: frozenset(x.items())`` can be used. - - """ - seenset = set() - seenset_add = seenset.add - seenlist = [] - seenlist_add = seenlist.append - use_key = key is not None - - for element in iterable: - k = key(element) if use_key else element - try: - if k not in seenset: - seenset_add(k) - yield element - except TypeError: - if k not in seenlist: - seenlist_add(k) - yield element - - -def unique_justseen(iterable, key=None): - """Yields elements in order, ignoring serial duplicates - - >>> list(unique_justseen('AAAABBBCCDAABBB')) - ['A', 'B', 'C', 'D', 'A', 'B'] - >>> list(unique_justseen('ABBCcAD', str.lower)) - ['A', 'B', 'C', 'A', 'D'] - - """ - if key is None: - return map(operator.itemgetter(0), groupby(iterable)) - - return map(next, map(operator.itemgetter(1), groupby(iterable, key))) - - -def unique(iterable, key=None, reverse=False): - """Yields unique elements in sorted order. - - >>> list(unique([[1, 2], [3, 4], [1, 2]])) - [[1, 2], [3, 4]] - - *key* and *reverse* are passed to :func:`sorted`. - - >>> list(unique('ABBcCAD', str.casefold)) - ['A', 'B', 'c', 'D'] - >>> list(unique('ABBcCAD', str.casefold, reverse=True)) - ['D', 'c', 'B', 'A'] - - The elements in *iterable* need not be hashable, but they must be - comparable for sorting to work. - """ - return unique_justseen(sorted(iterable, key=key, reverse=reverse), key=key) - - -def iter_except(func, exception, first=None): - """Yields results from a function repeatedly until an exception is raised. - - Converts a call-until-exception interface to an iterator interface. - Like ``iter(func, sentinel)``, but uses an exception instead of a sentinel - to end the loop. - - >>> l = [0, 1, 2] - >>> list(iter_except(l.pop, IndexError)) - [2, 1, 0] - - Multiple exceptions can be specified as a stopping condition: - - >>> l = [1, 2, 3, '...', 4, 5, 6] - >>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError))) - [7, 6, 5] - >>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError))) - [4, 3, 2] - >>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError))) - [] - - """ - try: - if first is not None: - yield first() - while 1: - yield func() - except exception: - pass - - -def first_true(iterable, default=None, pred=None): - """ - Returns the first true value in the iterable. - - If no true value is found, returns *default* - - If *pred* is not None, returns the first item for which - ``pred(item) == True`` . - - >>> first_true(range(10)) - 1 - >>> first_true(range(10), pred=lambda x: x > 5) - 6 - >>> first_true(range(10), default='missing', pred=lambda x: x > 9) - 'missing' - - """ - return next(filter(pred, iterable), default) - - -def random_product(*args, repeat=1): - """Draw an item at random from each of the input iterables. - - >>> random_product('abc', range(4), 'XYZ') # doctest:+SKIP - ('c', 3, 'Z') - - If *repeat* is provided as a keyword argument, that many items will be - drawn from each iterable. - - >>> random_product('abcd', range(4), repeat=2) # doctest:+SKIP - ('a', 2, 'd', 3) - - This equivalent to taking a random selection from - ``itertools.product(*args, **kwarg)``. - - """ - pools = [tuple(pool) for pool in args] * repeat - return tuple(choice(pool) for pool in pools) - - -def random_permutation(iterable, r=None): - """Return a random *r* length permutation of the elements in *iterable*. - - If *r* is not specified or is ``None``, then *r* defaults to the length of - *iterable*. - - >>> random_permutation(range(5)) # doctest:+SKIP - (3, 4, 0, 1, 2) - - This equivalent to taking a random selection from - ``itertools.permutations(iterable, r)``. - - """ - pool = tuple(iterable) - r = len(pool) if r is None else r - return tuple(sample(pool, r)) - - -def random_combination(iterable, r): - """Return a random *r* length subsequence of the elements in *iterable*. - - >>> random_combination(range(5), 3) # doctest:+SKIP - (2, 3, 4) - - This equivalent to taking a random selection from - ``itertools.combinations(iterable, r)``. - - """ - pool = tuple(iterable) - n = len(pool) - indices = sorted(sample(range(n), r)) - return tuple(pool[i] for i in indices) - - -def random_combination_with_replacement(iterable, r): - """Return a random *r* length subsequence of elements in *iterable*, - allowing individual elements to be repeated. - - >>> random_combination_with_replacement(range(3), 5) # doctest:+SKIP - (0, 0, 1, 2, 2) - - This equivalent to taking a random selection from - ``itertools.combinations_with_replacement(iterable, r)``. - - """ - pool = tuple(iterable) - n = len(pool) - indices = sorted(randrange(n) for i in range(r)) - return tuple(pool[i] for i in indices) - - -def nth_combination(iterable, r, index): - """Equivalent to ``list(combinations(iterable, r))[index]``. - - The subsequences of *iterable* that are of length *r* can be ordered - lexicographically. :func:`nth_combination` computes the subsequence at - sort position *index* directly, without computing the previous - subsequences. - - >>> nth_combination(range(5), 3, 5) - (0, 3, 4) - - ``ValueError`` will be raised If *r* is negative or greater than the length - of *iterable*. - ``IndexError`` will be raised if the given *index* is invalid. - """ - pool = tuple(iterable) - n = len(pool) - if (r < 0) or (r > n): - raise ValueError - - c = 1 - k = min(r, n - r) - for i in range(1, k + 1): - c = c * (n - k + i) // i - - if index < 0: - index += c - - if (index < 0) or (index >= c): - raise IndexError - - result = [] - while r: - c, n, r = c * r // n, n - 1, r - 1 - while index >= c: - index -= c - c, n = c * (n - r) // n, n - 1 - result.append(pool[-1 - n]) - - return tuple(result) - - -def prepend(value, iterator): - """Yield *value*, followed by the elements in *iterator*. - - >>> value = '0' - >>> iterator = ['1', '2', '3'] - >>> list(prepend(value, iterator)) - ['0', '1', '2', '3'] - - To prepend multiple values, see :func:`itertools.chain` - or :func:`value_chain`. - - """ - return chain([value], iterator) - - -def convolve(signal, kernel): - """Convolve the iterable *signal* with the iterable *kernel*. - - >>> signal = (1, 2, 3, 4, 5) - >>> kernel = [3, 2, 1] - >>> list(convolve(signal, kernel)) - [3, 8, 14, 20, 26, 14, 5] - - Note: the input arguments are not interchangeable, as the *kernel* - is immediately consumed and stored. - - """ - # This implementation intentionally doesn't match the one in the itertools - # documentation. - kernel = tuple(kernel)[::-1] - n = len(kernel) - window = deque([0], maxlen=n) * n - for x in chain(signal, repeat(0, n - 1)): - window.append(x) - yield _sumprod(kernel, window) - - -def before_and_after(predicate, it): - """A variant of :func:`takewhile` that allows complete access to the - remainder of the iterator. - - >>> it = iter('ABCdEfGhI') - >>> all_upper, remainder = before_and_after(str.isupper, it) - >>> ''.join(all_upper) - 'ABC' - >>> ''.join(remainder) # takewhile() would lose the 'd' - 'dEfGhI' - - Note that the first iterator must be fully consumed before the second - iterator can generate valid results. - """ - it = iter(it) - transition = [] - - def true_iterator(): - for elem in it: - if predicate(elem): - yield elem - else: - transition.append(elem) - return - - # Note: this is different from itertools recipes to allow nesting - # before_and_after remainders into before_and_after again. See tests - # for an example. - remainder_iterator = chain(transition, it) - - return true_iterator(), remainder_iterator - - -def triplewise(iterable): - """Return overlapping triplets from *iterable*. - - >>> list(triplewise('ABCDE')) - [('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E')] - - """ - for (a, _), (b, c) in pairwise(pairwise(iterable)): - yield a, b, c - - -def sliding_window(iterable, n): - """Return a sliding window of width *n* over *iterable*. - - >>> list(sliding_window(range(6), 4)) - [(0, 1, 2, 3), (1, 2, 3, 4), (2, 3, 4, 5)] - - If *iterable* has fewer than *n* items, then nothing is yielded: - - >>> list(sliding_window(range(3), 4)) - [] - - For a variant with more features, see :func:`windowed`. - """ - it = iter(iterable) - window = deque(islice(it, n - 1), maxlen=n) - for x in it: - window.append(x) - yield tuple(window) - - -def subslices(iterable): - """Return all contiguous non-empty subslices of *iterable*. - - >>> list(subslices('ABC')) - [['A'], ['A', 'B'], ['A', 'B', 'C'], ['B'], ['B', 'C'], ['C']] - - This is similar to :func:`substrings`, but emits items in a different - order. - """ - seq = list(iterable) - slices = starmap(slice, combinations(range(len(seq) + 1), 2)) - return map(operator.getitem, repeat(seq), slices) - - -def polynomial_from_roots(roots): - """Compute a polynomial's coefficients from its roots. - - >>> roots = [5, -4, 3] # (x - 5) * (x + 4) * (x - 3) - >>> polynomial_from_roots(roots) # x^3 - 4 * x^2 - 17 * x + 60 - [1, -4, -17, 60] - """ - factors = zip(repeat(1), map(operator.neg, roots)) - return list(reduce(convolve, factors, [1])) - - -def iter_index(iterable, value, start=0, stop=None): - """Yield the index of each place in *iterable* that *value* occurs, - beginning with index *start* and ending before index *stop*. - - - >>> list(iter_index('AABCADEAF', 'A')) - [0, 1, 4, 7] - >>> list(iter_index('AABCADEAF', 'A', 1)) # start index is inclusive - [1, 4, 7] - >>> list(iter_index('AABCADEAF', 'A', 1, 7)) # stop index is not inclusive - [1, 4] - - The behavior for non-scalar *values* matches the built-in Python types. - - >>> list(iter_index('ABCDABCD', 'AB')) - [0, 4] - >>> list(iter_index([0, 1, 2, 3, 0, 1, 2, 3], [0, 1])) - [] - >>> list(iter_index([[0, 1], [2, 3], [0, 1], [2, 3]], [0, 1])) - [0, 2] - - See :func:`locate` for a more general means of finding the indexes - associated with particular values. - - """ - seq_index = getattr(iterable, 'index', None) - if seq_index is None: - # Slow path for general iterables - it = islice(iterable, start, stop) - for i, element in enumerate(it, start): - if element is value or element == value: - yield i - else: - # Fast path for sequences - stop = len(iterable) if stop is None else stop - i = start - 1 - try: - while True: - yield (i := seq_index(value, i + 1, stop)) - except ValueError: - pass - - -def sieve(n): - """Yield the primes less than n. - - >>> list(sieve(30)) - [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] - """ - if n > 2: - yield 2 - start = 3 - data = bytearray((0, 1)) * (n // 2) - limit = math.isqrt(n) + 1 - for p in iter_index(data, 1, start, limit): - yield from iter_index(data, 1, start, p * p) - data[p * p : n : p + p] = bytes(len(range(p * p, n, p + p))) - start = p * p - yield from iter_index(data, 1, start) - - -def _batched(iterable, n, *, strict=False): - """Batch data into tuples of length *n*. If the number of items in - *iterable* is not divisible by *n*: - * The last batch will be shorter if *strict* is ``False``. - * :exc:`ValueError` will be raised if *strict* is ``True``. - - >>> list(batched('ABCDEFG', 3)) - [('A', 'B', 'C'), ('D', 'E', 'F'), ('G',)] - - On Python 3.13 and above, this is an alias for :func:`itertools.batched`. - """ - if n < 1: - raise ValueError('n must be at least one') - it = iter(iterable) - while batch := tuple(islice(it, n)): - if strict and len(batch) != n: - raise ValueError('batched(): incomplete batch') - yield batch - - -if hexversion >= 0x30D00A2: - from itertools import batched as itertools_batched - - def batched(iterable, n, *, strict=False): - return itertools_batched(iterable, n, strict=strict) - -else: - batched = _batched - - batched.__doc__ = _batched.__doc__ - - -def transpose(it): - """Swap the rows and columns of the input matrix. - - >>> list(transpose([(1, 2, 3), (11, 22, 33)])) - [(1, 11), (2, 22), (3, 33)] - - The caller should ensure that the dimensions of the input are compatible. - If the input is empty, no output will be produced. - """ - return _zip_strict(*it) - - -def reshape(matrix, cols): - """Reshape the 2-D input *matrix* to have a column count given by *cols*. - - >>> matrix = [(0, 1), (2, 3), (4, 5)] - >>> cols = 3 - >>> list(reshape(matrix, cols)) - [(0, 1, 2), (3, 4, 5)] - """ - return batched(chain.from_iterable(matrix), cols) - - -def matmul(m1, m2): - """Multiply two matrices. - - >>> list(matmul([(7, 5), (3, 5)], [(2, 5), (7, 9)])) - [(49, 80), (41, 60)] - - The caller should ensure that the dimensions of the input matrices are - compatible with each other. - """ - n = len(m2[0]) - return batched(starmap(_sumprod, product(m1, transpose(m2))), n) - - -def factor(n): - """Yield the prime factors of n. - - >>> list(factor(360)) - [2, 2, 2, 3, 3, 5] - """ - for prime in sieve(math.isqrt(n) + 1): - while not n % prime: - yield prime - n //= prime - if n == 1: - return - if n > 1: - yield n - - -def polynomial_eval(coefficients, x): - """Evaluate a polynomial at a specific value. - - Example: evaluating x^3 - 4 * x^2 - 17 * x + 60 at x = 2.5: - - >>> coefficients = [1, -4, -17, 60] - >>> x = 2.5 - >>> polynomial_eval(coefficients, x) - 8.125 - """ - n = len(coefficients) - if n == 0: - return x * 0 # coerce zero to the type of x - powers = map(pow, repeat(x), reversed(range(n))) - return _sumprod(coefficients, powers) - - -def sum_of_squares(it): - """Return the sum of the squares of the input values. - - >>> sum_of_squares([10, 20, 30]) - 1400 - """ - return _sumprod(*tee(it)) - - -def polynomial_derivative(coefficients): - """Compute the first derivative of a polynomial. - - Example: evaluating the derivative of x^3 - 4 * x^2 - 17 * x + 60 - - >>> coefficients = [1, -4, -17, 60] - >>> derivative_coefficients = polynomial_derivative(coefficients) - >>> derivative_coefficients - [3, -8, -17] - """ - n = len(coefficients) - powers = reversed(range(1, n)) - return list(map(operator.mul, coefficients, powers)) - - -def totient(n): - """Return the count of natural numbers up to *n* that are coprime with *n*. - - >>> totient(9) - 6 - >>> totient(12) - 4 - """ - # The itertools docs use unique_justseen instead of set; see - # https://github.com/more-itertools/more-itertools/issues/823 - for p in set(factor(n)): - n = n // p * (p - 1) - - return n diff --git a/pkg_resources/_vendor/more_itertools/recipes.pyi b/pkg_resources/_vendor/more_itertools/recipes.pyi deleted file mode 100644 index 739acec05f..0000000000 --- a/pkg_resources/_vendor/more_itertools/recipes.pyi +++ /dev/null @@ -1,136 +0,0 @@ -"""Stubs for more_itertools.recipes""" - -from __future__ import annotations - -from typing import ( - Any, - Callable, - Iterable, - Iterator, - overload, - Sequence, - Type, - TypeVar, -) - -# Type and type variable definitions -_T = TypeVar('_T') -_T1 = TypeVar('_T1') -_T2 = TypeVar('_T2') -_U = TypeVar('_U') - -def take(n: int, iterable: Iterable[_T]) -> list[_T]: ... -def tabulate( - function: Callable[[int], _T], start: int = ... -) -> Iterator[_T]: ... -def tail(n: int, iterable: Iterable[_T]) -> Iterator[_T]: ... -def consume(iterator: Iterable[_T], n: int | None = ...) -> None: ... -@overload -def nth(iterable: Iterable[_T], n: int) -> _T | None: ... -@overload -def nth(iterable: Iterable[_T], n: int, default: _U) -> _T | _U: ... -def all_equal( - iterable: Iterable[_T], key: Callable[[_T], _U] | None = ... -) -> bool: ... -def quantify( - iterable: Iterable[_T], pred: Callable[[_T], bool] = ... -) -> int: ... -def pad_none(iterable: Iterable[_T]) -> Iterator[_T | None]: ... -def padnone(iterable: Iterable[_T]) -> Iterator[_T | None]: ... -def ncycles(iterable: Iterable[_T], n: int) -> Iterator[_T]: ... -def dotproduct(vec1: Iterable[_T1], vec2: Iterable[_T2]) -> Any: ... -def flatten(listOfLists: Iterable[Iterable[_T]]) -> Iterator[_T]: ... -def repeatfunc( - func: Callable[..., _U], times: int | None = ..., *args: Any -) -> Iterator[_U]: ... -def pairwise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T]]: ... -def grouper( - iterable: Iterable[_T], - n: int, - incomplete: str = ..., - fillvalue: _U = ..., -) -> Iterator[tuple[_T | _U, ...]]: ... -def roundrobin(*iterables: Iterable[_T]) -> Iterator[_T]: ... -def partition( - pred: Callable[[_T], object] | None, iterable: Iterable[_T] -) -> tuple[Iterator[_T], Iterator[_T]]: ... -def powerset(iterable: Iterable[_T]) -> Iterator[tuple[_T, ...]]: ... -def unique_everseen( - iterable: Iterable[_T], key: Callable[[_T], _U] | None = ... -) -> Iterator[_T]: ... -def unique_justseen( - iterable: Iterable[_T], key: Callable[[_T], object] | None = ... -) -> Iterator[_T]: ... -def unique( - iterable: Iterable[_T], - key: Callable[[_T], object] | None = ..., - reverse: bool = False, -) -> Iterator[_T]: ... -@overload -def iter_except( - func: Callable[[], _T], - exception: Type[BaseException] | tuple[Type[BaseException], ...], - first: None = ..., -) -> Iterator[_T]: ... -@overload -def iter_except( - func: Callable[[], _T], - exception: Type[BaseException] | tuple[Type[BaseException], ...], - first: Callable[[], _U], -) -> Iterator[_T | _U]: ... -@overload -def first_true( - iterable: Iterable[_T], *, pred: Callable[[_T], object] | None = ... -) -> _T | None: ... -@overload -def first_true( - iterable: Iterable[_T], - default: _U, - pred: Callable[[_T], object] | None = ..., -) -> _T | _U: ... -def random_product( - *args: Iterable[_T], repeat: int = ... -) -> tuple[_T, ...]: ... -def random_permutation( - iterable: Iterable[_T], r: int | None = ... -) -> tuple[_T, ...]: ... -def random_combination(iterable: Iterable[_T], r: int) -> tuple[_T, ...]: ... -def random_combination_with_replacement( - iterable: Iterable[_T], r: int -) -> tuple[_T, ...]: ... -def nth_combination( - iterable: Iterable[_T], r: int, index: int -) -> tuple[_T, ...]: ... -def prepend(value: _T, iterator: Iterable[_U]) -> Iterator[_T | _U]: ... -def convolve(signal: Iterable[_T], kernel: Iterable[_T]) -> Iterator[_T]: ... -def before_and_after( - predicate: Callable[[_T], bool], it: Iterable[_T] -) -> tuple[Iterator[_T], Iterator[_T]]: ... -def triplewise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T, _T]]: ... -def sliding_window( - iterable: Iterable[_T], n: int -) -> Iterator[tuple[_T, ...]]: ... -def subslices(iterable: Iterable[_T]) -> Iterator[list[_T]]: ... -def polynomial_from_roots(roots: Sequence[_T]) -> list[_T]: ... -def iter_index( - iterable: Iterable[_T], - value: Any, - start: int | None = ..., - stop: int | None = ..., -) -> Iterator[int]: ... -def sieve(n: int) -> Iterator[int]: ... -def batched( - iterable: Iterable[_T], n: int, *, strict: bool = False -) -> Iterator[tuple[_T]]: ... -def transpose( - it: Iterable[Iterable[_T]], -) -> Iterator[tuple[_T, ...]]: ... -def reshape( - matrix: Iterable[Iterable[_T]], cols: int -) -> Iterator[tuple[_T, ...]]: ... -def matmul(m1: Sequence[_T], m2: Sequence[_T]) -> Iterator[tuple[_T]]: ... -def factor(n: int) -> Iterator[int]: ... -def polynomial_eval(coefficients: Sequence[_T], x: _U) -> _U: ... -def sum_of_squares(it: Iterable[_T]) -> _T: ... -def polynomial_derivative(coefficients: Sequence[_T]) -> list[_T]: ... -def totient(n: int) -> int: ... diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/INSTALLER b/pkg_resources/_vendor/packaging-24.1.dist-info/INSTALLER deleted file mode 100644 index a1b589e38a..0000000000 --- a/pkg_resources/_vendor/packaging-24.1.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE b/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE deleted file mode 100644 index 6f62d44e4e..0000000000 --- a/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -This software is made available under the terms of *either* of the licenses -found in LICENSE.APACHE or LICENSE.BSD. Contributions to this software is made -under the terms of *both* these licenses. diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.APACHE b/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.APACHE deleted file mode 100644 index f433b1a53f..0000000000 --- a/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.APACHE +++ /dev/null @@ -1,177 +0,0 @@ - - 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 diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.BSD b/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.BSD deleted file mode 100644 index 42ce7b75c9..0000000000 --- a/pkg_resources/_vendor/packaging-24.1.dist-info/LICENSE.BSD +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) Donald Stufft and individual contributors. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/METADATA b/pkg_resources/_vendor/packaging-24.1.dist-info/METADATA deleted file mode 100644 index 255dc46e0e..0000000000 --- a/pkg_resources/_vendor/packaging-24.1.dist-info/METADATA +++ /dev/null @@ -1,102 +0,0 @@ -Metadata-Version: 2.1 -Name: packaging -Version: 24.1 -Summary: Core utilities for Python packages -Author-email: Donald Stufft -Requires-Python: >=3.8 -Description-Content-Type: text/x-rst -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Apache Software License -Classifier: License :: OSI Approved :: BSD License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3 :: Only -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 :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Typing :: Typed -Project-URL: Documentation, https://packaging.pypa.io/ -Project-URL: Source, https://github.com/pypa/packaging - -packaging -========= - -.. start-intro - -Reusable core utilities for various Python Packaging -`interoperability specifications `_. - -This library provides utilities that implement the interoperability -specifications which have clearly one correct behaviour (eg: :pep:`440`) -or benefit greatly from having a single shared implementation (eg: :pep:`425`). - -.. end-intro - -The ``packaging`` project includes the following: version handling, specifiers, -markers, requirements, tags, utilities. - -Documentation -------------- - -The `documentation`_ provides information and the API for the following: - -- Version Handling -- Specifiers -- Markers -- Requirements -- Tags -- Utilities - -Installation ------------- - -Use ``pip`` to install these utilities:: - - pip install packaging - -The ``packaging`` library uses calendar-based versioning (``YY.N``). - -Discussion ----------- - -If you run into bugs, you can file them in our `issue tracker`_. - -You can also join ``#pypa`` on Freenode to ask questions or get involved. - - -.. _`documentation`: https://packaging.pypa.io/ -.. _`issue tracker`: https://github.com/pypa/packaging/issues - - -Code of Conduct ---------------- - -Everyone interacting in the packaging project's codebases, issue trackers, chat -rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. - -.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md - -Contributing ------------- - -The ``CONTRIBUTING.rst`` file outlines how to contribute to this project as -well as how to report a potential security issue. The documentation for this -project also covers information about `project development`_ and `security`_. - -.. _`project development`: https://packaging.pypa.io/en/latest/development/ -.. _`security`: https://packaging.pypa.io/en/latest/security/ - -Project History ---------------- - -Please review the ``CHANGELOG.rst`` file or the `Changelog documentation`_ for -recent changes and project history. - -.. _`Changelog documentation`: https://packaging.pypa.io/en/latest/changelog/ - diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/RECORD b/pkg_resources/_vendor/packaging-24.1.dist-info/RECORD deleted file mode 100644 index 2b1e6bd4db..0000000000 --- a/pkg_resources/_vendor/packaging-24.1.dist-info/RECORD +++ /dev/null @@ -1,37 +0,0 @@ -packaging-24.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -packaging-24.1.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197 -packaging-24.1.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174 -packaging-24.1.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344 -packaging-24.1.dist-info/METADATA,sha256=X3ooO3WnCfzNSBrqQjefCD1POAF1M2WSLmsHMgQlFdk,3204 -packaging-24.1.dist-info/RECORD,, -packaging-24.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -packaging-24.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81 -packaging/__init__.py,sha256=dtw2bNmWCQ9WnMoK3bk_elL1svSlikXtLpZhCFIB9SE,496 -packaging/__pycache__/__init__.cpython-312.pyc,, -packaging/__pycache__/_elffile.cpython-312.pyc,, -packaging/__pycache__/_manylinux.cpython-312.pyc,, -packaging/__pycache__/_musllinux.cpython-312.pyc,, -packaging/__pycache__/_parser.cpython-312.pyc,, -packaging/__pycache__/_structures.cpython-312.pyc,, -packaging/__pycache__/_tokenizer.cpython-312.pyc,, -packaging/__pycache__/markers.cpython-312.pyc,, -packaging/__pycache__/metadata.cpython-312.pyc,, -packaging/__pycache__/requirements.cpython-312.pyc,, -packaging/__pycache__/specifiers.cpython-312.pyc,, -packaging/__pycache__/tags.cpython-312.pyc,, -packaging/__pycache__/utils.cpython-312.pyc,, -packaging/__pycache__/version.cpython-312.pyc,, -packaging/_elffile.py,sha256=_LcJW4YNKywYsl4169B2ukKRqwxjxst_8H0FRVQKlz8,3282 -packaging/_manylinux.py,sha256=Xo4V0PZz8sbuVCbTni0t1CR0AHeir_7ib4lTmV8scD4,9586 -packaging/_musllinux.py,sha256=p9ZqNYiOItGee8KcZFeHF_YcdhVwGHdK6r-8lgixvGQ,2694 -packaging/_parser.py,sha256=s_TvTvDNK0NrM2QB3VKThdWFM4Nc0P6JnkObkl3MjpM,10236 -packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431 -packaging/_tokenizer.py,sha256=J6v5H7Jzvb-g81xp_2QACKwO7LxHQA6ikryMU7zXwN8,5273 -packaging/markers.py,sha256=dWKSqn5Sp-jDmOG-W3GfLHKjwhf1IsznbT71VlBoB5M,10671 -packaging/metadata.py,sha256=KINuSkJ12u-SyoKNTy_pHNGAfMUtxNvZ53qA1zAKcKI,32349 -packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -packaging/requirements.py,sha256=gYyRSAdbrIyKDY66ugIDUQjRMvxkH2ALioTmX3tnL6o,2947 -packaging/specifiers.py,sha256=rjpc3hoJuunRIT6DdH7gLTnQ5j5QKSuWjoTC5sdHtHI,39714 -packaging/tags.py,sha256=y8EbheOu9WS7s-MebaXMcHMF-jzsA_C1Lz5XRTiSy4w,18883 -packaging/utils.py,sha256=NAdYUwnlAOpkat_RthavX8a07YuVxgGL_vwrx73GSDM,5287 -packaging/version.py,sha256=V0H3SOj_8werrvorrb6QDLRhlcqSErNTTkCvvfszhDI,16198 diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/REQUESTED b/pkg_resources/_vendor/packaging-24.1.dist-info/REQUESTED deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/pkg_resources/_vendor/packaging-24.1.dist-info/WHEEL b/pkg_resources/_vendor/packaging-24.1.dist-info/WHEEL deleted file mode 100644 index 3b5e64b5e6..0000000000 --- a/pkg_resources/_vendor/packaging-24.1.dist-info/WHEEL +++ /dev/null @@ -1,4 +0,0 @@ -Wheel-Version: 1.0 -Generator: flit 3.9.0 -Root-Is-Purelib: true -Tag: py3-none-any diff --git a/pkg_resources/_vendor/packaging/__init__.py b/pkg_resources/_vendor/packaging/__init__.py deleted file mode 100644 index 9ba41d8357..0000000000 --- a/pkg_resources/_vendor/packaging/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -__title__ = "packaging" -__summary__ = "Core utilities for Python packages" -__uri__ = "https://github.com/pypa/packaging" - -__version__ = "24.1" - -__author__ = "Donald Stufft and individual contributors" -__email__ = "donald@stufft.io" - -__license__ = "BSD-2-Clause or Apache-2.0" -__copyright__ = "2014 %s" % __author__ diff --git a/pkg_resources/_vendor/packaging/_elffile.py b/pkg_resources/_vendor/packaging/_elffile.py deleted file mode 100644 index f7a02180bf..0000000000 --- a/pkg_resources/_vendor/packaging/_elffile.py +++ /dev/null @@ -1,110 +0,0 @@ -""" -ELF file parser. - -This provides a class ``ELFFile`` that parses an ELF executable in a similar -interface to ``ZipFile``. Only the read interface is implemented. - -Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca -ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html -""" - -from __future__ import annotations - -import enum -import os -import struct -from typing import IO - - -class ELFInvalid(ValueError): - pass - - -class EIClass(enum.IntEnum): - C32 = 1 - C64 = 2 - - -class EIData(enum.IntEnum): - Lsb = 1 - Msb = 2 - - -class EMachine(enum.IntEnum): - I386 = 3 - S390 = 22 - Arm = 40 - X8664 = 62 - AArc64 = 183 - - -class ELFFile: - """ - Representation of an ELF executable. - """ - - def __init__(self, f: IO[bytes]) -> None: - self._f = f - - try: - ident = self._read("16B") - except struct.error: - raise ELFInvalid("unable to parse identification") - magic = bytes(ident[:4]) - if magic != b"\x7fELF": - raise ELFInvalid(f"invalid magic: {magic!r}") - - self.capacity = ident[4] # Format for program header (bitness). - self.encoding = ident[5] # Data structure encoding (endianness). - - try: - # e_fmt: Format for program header. - # p_fmt: Format for section header. - # p_idx: Indexes to find p_type, p_offset, and p_filesz. - e_fmt, self._p_fmt, self._p_idx = { - (1, 1): ("HHIIIIIHHH", ">IIIIIIII", (0, 1, 4)), # 32-bit MSB. - (2, 1): ("HHIQQQIHHH", ">IIQQQQQQ", (0, 2, 5)), # 64-bit MSB. - }[(self.capacity, self.encoding)] - except KeyError: - raise ELFInvalid( - f"unrecognized capacity ({self.capacity}) or " - f"encoding ({self.encoding})" - ) - - try: - ( - _, - self.machine, # Architecture type. - _, - _, - self._e_phoff, # Offset of program header. - _, - self.flags, # Processor-specific flags. - _, - self._e_phentsize, # Size of section. - self._e_phnum, # Number of sections. - ) = self._read(e_fmt) - except struct.error as e: - raise ELFInvalid("unable to parse machine and section information") from e - - def _read(self, fmt: str) -> tuple[int, ...]: - return struct.unpack(fmt, self._f.read(struct.calcsize(fmt))) - - @property - def interpreter(self) -> str | None: - """ - The path recorded in the ``PT_INTERP`` section header. - """ - for index in range(self._e_phnum): - self._f.seek(self._e_phoff + self._e_phentsize * index) - try: - data = self._read(self._p_fmt) - except struct.error: - continue - if data[self._p_idx[0]] != 3: # Not PT_INTERP. - continue - self._f.seek(data[self._p_idx[1]]) - return os.fsdecode(self._f.read(data[self._p_idx[2]])).strip("\0") - return None diff --git a/pkg_resources/_vendor/packaging/_manylinux.py b/pkg_resources/_vendor/packaging/_manylinux.py deleted file mode 100644 index 08f651fbd8..0000000000 --- a/pkg_resources/_vendor/packaging/_manylinux.py +++ /dev/null @@ -1,262 +0,0 @@ -from __future__ import annotations - -import collections -import contextlib -import functools -import os -import re -import sys -import warnings -from typing import Generator, Iterator, NamedTuple, Sequence - -from ._elffile import EIClass, EIData, ELFFile, EMachine - -EF_ARM_ABIMASK = 0xFF000000 -EF_ARM_ABI_VER5 = 0x05000000 -EF_ARM_ABI_FLOAT_HARD = 0x00000400 - - -# `os.PathLike` not a generic type until Python 3.9, so sticking with `str` -# as the type for `path` until then. -@contextlib.contextmanager -def _parse_elf(path: str) -> Generator[ELFFile | None, None, None]: - try: - with open(path, "rb") as f: - yield ELFFile(f) - except (OSError, TypeError, ValueError): - yield None - - -def _is_linux_armhf(executable: str) -> bool: - # hard-float ABI can be detected from the ELF header of the running - # process - # https://static.docs.arm.com/ihi0044/g/aaelf32.pdf - with _parse_elf(executable) as f: - return ( - f is not None - and f.capacity == EIClass.C32 - and f.encoding == EIData.Lsb - and f.machine == EMachine.Arm - and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5 - and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD - ) - - -def _is_linux_i686(executable: str) -> bool: - with _parse_elf(executable) as f: - return ( - f is not None - and f.capacity == EIClass.C32 - and f.encoding == EIData.Lsb - and f.machine == EMachine.I386 - ) - - -def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool: - if "armv7l" in archs: - return _is_linux_armhf(executable) - if "i686" in archs: - return _is_linux_i686(executable) - allowed_archs = { - "x86_64", - "aarch64", - "ppc64", - "ppc64le", - "s390x", - "loongarch64", - "riscv64", - } - return any(arch in allowed_archs for arch in archs) - - -# If glibc ever changes its major version, we need to know what the last -# minor version was, so we can build the complete list of all versions. -# For now, guess what the highest minor version might be, assume it will -# be 50 for testing. Once this actually happens, update the dictionary -# with the actual value. -_LAST_GLIBC_MINOR: dict[int, int] = collections.defaultdict(lambda: 50) - - -class _GLibCVersion(NamedTuple): - major: int - minor: int - - -def _glibc_version_string_confstr() -> str | None: - """ - Primary implementation of glibc_version_string using os.confstr. - """ - # os.confstr is quite a bit faster than ctypes.DLL. It's also less likely - # to be broken or missing. This strategy is used in the standard library - # platform module. - # https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183 - try: - # Should be a string like "glibc 2.17". - version_string: str | None = os.confstr("CS_GNU_LIBC_VERSION") - assert version_string is not None - _, version = version_string.rsplit() - except (AssertionError, AttributeError, OSError, ValueError): - # os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)... - return None - return version - - -def _glibc_version_string_ctypes() -> str | None: - """ - Fallback implementation of glibc_version_string using ctypes. - """ - try: - import ctypes - except ImportError: - return None - - # ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen - # manpage says, "If filename is NULL, then the returned handle is for the - # main program". This way we can let the linker do the work to figure out - # which libc our process is actually using. - # - # We must also handle the special case where the executable is not a - # dynamically linked executable. This can occur when using musl libc, - # for example. In this situation, dlopen() will error, leading to an - # OSError. Interestingly, at least in the case of musl, there is no - # errno set on the OSError. The single string argument used to construct - # OSError comes from libc itself and is therefore not portable to - # hard code here. In any case, failure to call dlopen() means we - # can proceed, so we bail on our attempt. - try: - process_namespace = ctypes.CDLL(None) - except OSError: - return None - - try: - gnu_get_libc_version = process_namespace.gnu_get_libc_version - except AttributeError: - # Symbol doesn't exist -> therefore, we are not linked to - # glibc. - return None - - # Call gnu_get_libc_version, which returns a string like "2.5" - gnu_get_libc_version.restype = ctypes.c_char_p - version_str: str = gnu_get_libc_version() - # py2 / py3 compatibility: - if not isinstance(version_str, str): - version_str = version_str.decode("ascii") - - return version_str - - -def _glibc_version_string() -> str | None: - """Returns glibc version string, or None if not using glibc.""" - return _glibc_version_string_confstr() or _glibc_version_string_ctypes() - - -def _parse_glibc_version(version_str: str) -> tuple[int, int]: - """Parse glibc version. - - We use a regexp instead of str.split because we want to discard any - random junk that might come after the minor version -- this might happen - in patched/forked versions of glibc (e.g. Linaro's version of glibc - uses version strings like "2.20-2014.11"). See gh-3588. - """ - m = re.match(r"(?P[0-9]+)\.(?P[0-9]+)", version_str) - if not m: - warnings.warn( - f"Expected glibc version with 2 components major.minor," - f" got: {version_str}", - RuntimeWarning, - ) - return -1, -1 - return int(m.group("major")), int(m.group("minor")) - - -@functools.lru_cache -def _get_glibc_version() -> tuple[int, int]: - version_str = _glibc_version_string() - if version_str is None: - return (-1, -1) - return _parse_glibc_version(version_str) - - -# From PEP 513, PEP 600 -def _is_compatible(arch: str, version: _GLibCVersion) -> bool: - sys_glibc = _get_glibc_version() - if sys_glibc < version: - return False - # Check for presence of _manylinux module. - try: - import _manylinux - except ImportError: - return True - if hasattr(_manylinux, "manylinux_compatible"): - result = _manylinux.manylinux_compatible(version[0], version[1], arch) - if result is not None: - return bool(result) - return True - if version == _GLibCVersion(2, 5): - if hasattr(_manylinux, "manylinux1_compatible"): - return bool(_manylinux.manylinux1_compatible) - if version == _GLibCVersion(2, 12): - if hasattr(_manylinux, "manylinux2010_compatible"): - return bool(_manylinux.manylinux2010_compatible) - if version == _GLibCVersion(2, 17): - if hasattr(_manylinux, "manylinux2014_compatible"): - return bool(_manylinux.manylinux2014_compatible) - return True - - -_LEGACY_MANYLINUX_MAP = { - # CentOS 7 w/ glibc 2.17 (PEP 599) - (2, 17): "manylinux2014", - # CentOS 6 w/ glibc 2.12 (PEP 571) - (2, 12): "manylinux2010", - # CentOS 5 w/ glibc 2.5 (PEP 513) - (2, 5): "manylinux1", -} - - -def platform_tags(archs: Sequence[str]) -> Iterator[str]: - """Generate manylinux tags compatible to the current platform. - - :param archs: Sequence of compatible architectures. - The first one shall be the closest to the actual architecture and be the part of - platform tag after the ``linux_`` prefix, e.g. ``x86_64``. - The ``linux_`` prefix is assumed as a prerequisite for the current platform to - be manylinux-compatible. - - :returns: An iterator of compatible manylinux tags. - """ - if not _have_compatible_abi(sys.executable, archs): - return - # Oldest glibc to be supported regardless of architecture is (2, 17). - too_old_glibc2 = _GLibCVersion(2, 16) - if set(archs) & {"x86_64", "i686"}: - # On x86/i686 also oldest glibc to be supported is (2, 5). - too_old_glibc2 = _GLibCVersion(2, 4) - current_glibc = _GLibCVersion(*_get_glibc_version()) - glibc_max_list = [current_glibc] - # We can assume compatibility across glibc major versions. - # https://sourceware.org/bugzilla/show_bug.cgi?id=24636 - # - # Build a list of maximum glibc versions so that we can - # output the canonical list of all glibc from current_glibc - # down to too_old_glibc2, including all intermediary versions. - for glibc_major in range(current_glibc.major - 1, 1, -1): - glibc_minor = _LAST_GLIBC_MINOR[glibc_major] - glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor)) - for arch in archs: - for glibc_max in glibc_max_list: - if glibc_max.major == too_old_glibc2.major: - min_minor = too_old_glibc2.minor - else: - # For other glibc major versions oldest supported is (x, 0). - min_minor = -1 - for glibc_minor in range(glibc_max.minor, min_minor, -1): - glibc_version = _GLibCVersion(glibc_max.major, glibc_minor) - tag = "manylinux_{}_{}".format(*glibc_version) - if _is_compatible(arch, glibc_version): - yield f"{tag}_{arch}" - # Handle the legacy manylinux1, manylinux2010, manylinux2014 tags. - if glibc_version in _LEGACY_MANYLINUX_MAP: - legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version] - if _is_compatible(arch, glibc_version): - yield f"{legacy_tag}_{arch}" diff --git a/pkg_resources/_vendor/packaging/_musllinux.py b/pkg_resources/_vendor/packaging/_musllinux.py deleted file mode 100644 index d2bf30b563..0000000000 --- a/pkg_resources/_vendor/packaging/_musllinux.py +++ /dev/null @@ -1,85 +0,0 @@ -"""PEP 656 support. - -This module implements logic to detect if the currently running Python is -linked against musl, and what musl version is used. -""" - -from __future__ import annotations - -import functools -import re -import subprocess -import sys -from typing import Iterator, NamedTuple, Sequence - -from ._elffile import ELFFile - - -class _MuslVersion(NamedTuple): - major: int - minor: int - - -def _parse_musl_version(output: str) -> _MuslVersion | None: - lines = [n for n in (n.strip() for n in output.splitlines()) if n] - if len(lines) < 2 or lines[0][:4] != "musl": - return None - m = re.match(r"Version (\d+)\.(\d+)", lines[1]) - if not m: - return None - return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2))) - - -@functools.lru_cache -def _get_musl_version(executable: str) -> _MuslVersion | None: - """Detect currently-running musl runtime version. - - This is done by checking the specified executable's dynamic linking - information, and invoking the loader to parse its output for a version - string. If the loader is musl, the output would be something like:: - - musl libc (x86_64) - Version 1.2.2 - Dynamic Program Loader - """ - try: - with open(executable, "rb") as f: - ld = ELFFile(f).interpreter - except (OSError, TypeError, ValueError): - return None - if ld is None or "musl" not in ld: - return None - proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True) - return _parse_musl_version(proc.stderr) - - -def platform_tags(archs: Sequence[str]) -> Iterator[str]: - """Generate musllinux tags compatible to the current platform. - - :param archs: Sequence of compatible architectures. - The first one shall be the closest to the actual architecture and be the part of - platform tag after the ``linux_`` prefix, e.g. ``x86_64``. - The ``linux_`` prefix is assumed as a prerequisite for the current platform to - be musllinux-compatible. - - :returns: An iterator of compatible musllinux tags. - """ - sys_musl = _get_musl_version(sys.executable) - if sys_musl is None: # Python not dynamically linked against musl. - return - for arch in archs: - for minor in range(sys_musl.minor, -1, -1): - yield f"musllinux_{sys_musl.major}_{minor}_{arch}" - - -if __name__ == "__main__": # pragma: no cover - import sysconfig - - plat = sysconfig.get_platform() - assert plat.startswith("linux-"), "not linux" - - print("plat:", plat) - print("musl:", _get_musl_version(sys.executable)) - print("tags:", end=" ") - for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])): - print(t, end="\n ") diff --git a/pkg_resources/_vendor/packaging/_parser.py b/pkg_resources/_vendor/packaging/_parser.py deleted file mode 100644 index c1238c06ea..0000000000 --- a/pkg_resources/_vendor/packaging/_parser.py +++ /dev/null @@ -1,354 +0,0 @@ -"""Handwritten parser of dependency specifiers. - -The docstring for each __parse_* function contains EBNF-inspired grammar representing -the implementation. -""" - -from __future__ import annotations - -import ast -from typing import NamedTuple, Sequence, Tuple, Union - -from ._tokenizer import DEFAULT_RULES, Tokenizer - - -class Node: - def __init__(self, value: str) -> None: - self.value = value - - def __str__(self) -> str: - return self.value - - def __repr__(self) -> str: - return f"<{self.__class__.__name__}('{self}')>" - - def serialize(self) -> str: - raise NotImplementedError - - -class Variable(Node): - def serialize(self) -> str: - return str(self) - - -class Value(Node): - def serialize(self) -> str: - return f'"{self}"' - - -class Op(Node): - def serialize(self) -> str: - return str(self) - - -MarkerVar = Union[Variable, Value] -MarkerItem = Tuple[MarkerVar, Op, MarkerVar] -MarkerAtom = Union[MarkerItem, Sequence["MarkerAtom"]] -MarkerList = Sequence[Union["MarkerList", MarkerAtom, str]] - - -class ParsedRequirement(NamedTuple): - name: str - url: str - extras: list[str] - specifier: str - marker: MarkerList | None - - -# -------------------------------------------------------------------------------------- -# Recursive descent parser for dependency specifier -# -------------------------------------------------------------------------------------- -def parse_requirement(source: str) -> ParsedRequirement: - return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES)) - - -def _parse_requirement(tokenizer: Tokenizer) -> ParsedRequirement: - """ - requirement = WS? IDENTIFIER WS? extras WS? requirement_details - """ - tokenizer.consume("WS") - - name_token = tokenizer.expect( - "IDENTIFIER", expected="package name at the start of dependency specifier" - ) - name = name_token.text - tokenizer.consume("WS") - - extras = _parse_extras(tokenizer) - tokenizer.consume("WS") - - url, specifier, marker = _parse_requirement_details(tokenizer) - tokenizer.expect("END", expected="end of dependency specifier") - - return ParsedRequirement(name, url, extras, specifier, marker) - - -def _parse_requirement_details( - tokenizer: Tokenizer, -) -> tuple[str, str, MarkerList | None]: - """ - requirement_details = AT URL (WS requirement_marker?)? - | specifier WS? (requirement_marker)? - """ - - specifier = "" - url = "" - marker = None - - if tokenizer.check("AT"): - tokenizer.read() - tokenizer.consume("WS") - - url_start = tokenizer.position - url = tokenizer.expect("URL", expected="URL after @").text - if tokenizer.check("END", peek=True): - return (url, specifier, marker) - - tokenizer.expect("WS", expected="whitespace after URL") - - # The input might end after whitespace. - if tokenizer.check("END", peek=True): - return (url, specifier, marker) - - marker = _parse_requirement_marker( - tokenizer, span_start=url_start, after="URL and whitespace" - ) - else: - specifier_start = tokenizer.position - specifier = _parse_specifier(tokenizer) - tokenizer.consume("WS") - - if tokenizer.check("END", peek=True): - return (url, specifier, marker) - - marker = _parse_requirement_marker( - tokenizer, - span_start=specifier_start, - after=( - "version specifier" - if specifier - else "name and no valid version specifier" - ), - ) - - return (url, specifier, marker) - - -def _parse_requirement_marker( - tokenizer: Tokenizer, *, span_start: int, after: str -) -> MarkerList: - """ - requirement_marker = SEMICOLON marker WS? - """ - - if not tokenizer.check("SEMICOLON"): - tokenizer.raise_syntax_error( - f"Expected end or semicolon (after {after})", - span_start=span_start, - ) - tokenizer.read() - - marker = _parse_marker(tokenizer) - tokenizer.consume("WS") - - return marker - - -def _parse_extras(tokenizer: Tokenizer) -> list[str]: - """ - extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)? - """ - if not tokenizer.check("LEFT_BRACKET", peek=True): - return [] - - with tokenizer.enclosing_tokens( - "LEFT_BRACKET", - "RIGHT_BRACKET", - around="extras", - ): - tokenizer.consume("WS") - extras = _parse_extras_list(tokenizer) - tokenizer.consume("WS") - - return extras - - -def _parse_extras_list(tokenizer: Tokenizer) -> list[str]: - """ - extras_list = identifier (wsp* ',' wsp* identifier)* - """ - extras: list[str] = [] - - if not tokenizer.check("IDENTIFIER"): - return extras - - extras.append(tokenizer.read().text) - - while True: - tokenizer.consume("WS") - if tokenizer.check("IDENTIFIER", peek=True): - tokenizer.raise_syntax_error("Expected comma between extra names") - elif not tokenizer.check("COMMA"): - break - - tokenizer.read() - tokenizer.consume("WS") - - extra_token = tokenizer.expect("IDENTIFIER", expected="extra name after comma") - extras.append(extra_token.text) - - return extras - - -def _parse_specifier(tokenizer: Tokenizer) -> str: - """ - specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS - | WS? version_many WS? - """ - with tokenizer.enclosing_tokens( - "LEFT_PARENTHESIS", - "RIGHT_PARENTHESIS", - around="version specifier", - ): - tokenizer.consume("WS") - parsed_specifiers = _parse_version_many(tokenizer) - tokenizer.consume("WS") - - return parsed_specifiers - - -def _parse_version_many(tokenizer: Tokenizer) -> str: - """ - version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)? - """ - parsed_specifiers = "" - while tokenizer.check("SPECIFIER"): - span_start = tokenizer.position - parsed_specifiers += tokenizer.read().text - if tokenizer.check("VERSION_PREFIX_TRAIL", peek=True): - tokenizer.raise_syntax_error( - ".* suffix can only be used with `==` or `!=` operators", - span_start=span_start, - span_end=tokenizer.position + 1, - ) - if tokenizer.check("VERSION_LOCAL_LABEL_TRAIL", peek=True): - tokenizer.raise_syntax_error( - "Local version label can only be used with `==` or `!=` operators", - span_start=span_start, - span_end=tokenizer.position, - ) - tokenizer.consume("WS") - if not tokenizer.check("COMMA"): - break - parsed_specifiers += tokenizer.read().text - tokenizer.consume("WS") - - return parsed_specifiers - - -# -------------------------------------------------------------------------------------- -# Recursive descent parser for marker expression -# -------------------------------------------------------------------------------------- -def parse_marker(source: str) -> MarkerList: - return _parse_full_marker(Tokenizer(source, rules=DEFAULT_RULES)) - - -def _parse_full_marker(tokenizer: Tokenizer) -> MarkerList: - retval = _parse_marker(tokenizer) - tokenizer.expect("END", expected="end of marker expression") - return retval - - -def _parse_marker(tokenizer: Tokenizer) -> MarkerList: - """ - marker = marker_atom (BOOLOP marker_atom)+ - """ - expression = [_parse_marker_atom(tokenizer)] - while tokenizer.check("BOOLOP"): - token = tokenizer.read() - expr_right = _parse_marker_atom(tokenizer) - expression.extend((token.text, expr_right)) - return expression - - -def _parse_marker_atom(tokenizer: Tokenizer) -> MarkerAtom: - """ - marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS? - | WS? marker_item WS? - """ - - tokenizer.consume("WS") - if tokenizer.check("LEFT_PARENTHESIS", peek=True): - with tokenizer.enclosing_tokens( - "LEFT_PARENTHESIS", - "RIGHT_PARENTHESIS", - around="marker expression", - ): - tokenizer.consume("WS") - marker: MarkerAtom = _parse_marker(tokenizer) - tokenizer.consume("WS") - else: - marker = _parse_marker_item(tokenizer) - tokenizer.consume("WS") - return marker - - -def _parse_marker_item(tokenizer: Tokenizer) -> MarkerItem: - """ - marker_item = WS? marker_var WS? marker_op WS? marker_var WS? - """ - tokenizer.consume("WS") - marker_var_left = _parse_marker_var(tokenizer) - tokenizer.consume("WS") - marker_op = _parse_marker_op(tokenizer) - tokenizer.consume("WS") - marker_var_right = _parse_marker_var(tokenizer) - tokenizer.consume("WS") - return (marker_var_left, marker_op, marker_var_right) - - -def _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar: - """ - marker_var = VARIABLE | QUOTED_STRING - """ - if tokenizer.check("VARIABLE"): - return process_env_var(tokenizer.read().text.replace(".", "_")) - elif tokenizer.check("QUOTED_STRING"): - return process_python_str(tokenizer.read().text) - else: - tokenizer.raise_syntax_error( - message="Expected a marker variable or quoted string" - ) - - -def process_env_var(env_var: str) -> Variable: - if env_var in ("platform_python_implementation", "python_implementation"): - return Variable("platform_python_implementation") - else: - return Variable(env_var) - - -def process_python_str(python_str: str) -> Value: - value = ast.literal_eval(python_str) - return Value(str(value)) - - -def _parse_marker_op(tokenizer: Tokenizer) -> Op: - """ - marker_op = IN | NOT IN | OP - """ - if tokenizer.check("IN"): - tokenizer.read() - return Op("in") - elif tokenizer.check("NOT"): - tokenizer.read() - tokenizer.expect("WS", expected="whitespace after 'not'") - tokenizer.expect("IN", expected="'in' after 'not'") - return Op("not in") - elif tokenizer.check("OP"): - return Op(tokenizer.read().text) - else: - return tokenizer.raise_syntax_error( - "Expected marker operator, one of " - "<=, <, !=, ==, >=, >, ~=, ===, in, not in" - ) diff --git a/pkg_resources/_vendor/packaging/_structures.py b/pkg_resources/_vendor/packaging/_structures.py deleted file mode 100644 index 90a6465f96..0000000000 --- a/pkg_resources/_vendor/packaging/_structures.py +++ /dev/null @@ -1,61 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - - -class InfinityType: - def __repr__(self) -> str: - return "Infinity" - - def __hash__(self) -> int: - return hash(repr(self)) - - def __lt__(self, other: object) -> bool: - return False - - def __le__(self, other: object) -> bool: - return False - - def __eq__(self, other: object) -> bool: - return isinstance(other, self.__class__) - - def __gt__(self, other: object) -> bool: - return True - - def __ge__(self, other: object) -> bool: - return True - - def __neg__(self: object) -> "NegativeInfinityType": - return NegativeInfinity - - -Infinity = InfinityType() - - -class NegativeInfinityType: - def __repr__(self) -> str: - return "-Infinity" - - def __hash__(self) -> int: - return hash(repr(self)) - - def __lt__(self, other: object) -> bool: - return True - - def __le__(self, other: object) -> bool: - return True - - def __eq__(self, other: object) -> bool: - return isinstance(other, self.__class__) - - def __gt__(self, other: object) -> bool: - return False - - def __ge__(self, other: object) -> bool: - return False - - def __neg__(self: object) -> InfinityType: - return Infinity - - -NegativeInfinity = NegativeInfinityType() diff --git a/pkg_resources/_vendor/packaging/_tokenizer.py b/pkg_resources/_vendor/packaging/_tokenizer.py deleted file mode 100644 index 89d041605c..0000000000 --- a/pkg_resources/_vendor/packaging/_tokenizer.py +++ /dev/null @@ -1,194 +0,0 @@ -from __future__ import annotations - -import contextlib -import re -from dataclasses import dataclass -from typing import Iterator, NoReturn - -from .specifiers import Specifier - - -@dataclass -class Token: - name: str - text: str - position: int - - -class ParserSyntaxError(Exception): - """The provided source text could not be parsed correctly.""" - - def __init__( - self, - message: str, - *, - source: str, - span: tuple[int, int], - ) -> None: - self.span = span - self.message = message - self.source = source - - super().__init__() - - def __str__(self) -> str: - marker = " " * self.span[0] + "~" * (self.span[1] - self.span[0]) + "^" - return "\n ".join([self.message, self.source, marker]) - - -DEFAULT_RULES: dict[str, str | re.Pattern[str]] = { - "LEFT_PARENTHESIS": r"\(", - "RIGHT_PARENTHESIS": r"\)", - "LEFT_BRACKET": r"\[", - "RIGHT_BRACKET": r"\]", - "SEMICOLON": r";", - "COMMA": r",", - "QUOTED_STRING": re.compile( - r""" - ( - ('[^']*') - | - ("[^"]*") - ) - """, - re.VERBOSE, - ), - "OP": r"(===|==|~=|!=|<=|>=|<|>)", - "BOOLOP": r"\b(or|and)\b", - "IN": r"\bin\b", - "NOT": r"\bnot\b", - "VARIABLE": re.compile( - r""" - \b( - python_version - |python_full_version - |os[._]name - |sys[._]platform - |platform_(release|system) - |platform[._](version|machine|python_implementation) - |python_implementation - |implementation_(name|version) - |extra - )\b - """, - re.VERBOSE, - ), - "SPECIFIER": re.compile( - Specifier._operator_regex_str + Specifier._version_regex_str, - re.VERBOSE | re.IGNORECASE, - ), - "AT": r"\@", - "URL": r"[^ \t]+", - "IDENTIFIER": r"\b[a-zA-Z0-9][a-zA-Z0-9._-]*\b", - "VERSION_PREFIX_TRAIL": r"\.\*", - "VERSION_LOCAL_LABEL_TRAIL": r"\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*", - "WS": r"[ \t]+", - "END": r"$", -} - - -class Tokenizer: - """Context-sensitive token parsing. - - Provides methods to examine the input stream to check whether the next token - matches. - """ - - def __init__( - self, - source: str, - *, - rules: dict[str, str | re.Pattern[str]], - ) -> None: - self.source = source - self.rules: dict[str, re.Pattern[str]] = { - name: re.compile(pattern) for name, pattern in rules.items() - } - self.next_token: Token | None = None - self.position = 0 - - def consume(self, name: str) -> None: - """Move beyond provided token name, if at current position.""" - if self.check(name): - self.read() - - def check(self, name: str, *, peek: bool = False) -> bool: - """Check whether the next token has the provided name. - - By default, if the check succeeds, the token *must* be read before - another check. If `peek` is set to `True`, the token is not loaded and - would need to be checked again. - """ - assert ( - self.next_token is None - ), f"Cannot check for {name!r}, already have {self.next_token!r}" - assert name in self.rules, f"Unknown token name: {name!r}" - - expression = self.rules[name] - - match = expression.match(self.source, self.position) - if match is None: - return False - if not peek: - self.next_token = Token(name, match[0], self.position) - return True - - def expect(self, name: str, *, expected: str) -> Token: - """Expect a certain token name next, failing with a syntax error otherwise. - - The token is *not* read. - """ - if not self.check(name): - raise self.raise_syntax_error(f"Expected {expected}") - return self.read() - - def read(self) -> Token: - """Consume the next token and return it.""" - token = self.next_token - assert token is not None - - self.position += len(token.text) - self.next_token = None - - return token - - def raise_syntax_error( - self, - message: str, - *, - span_start: int | None = None, - span_end: int | None = None, - ) -> NoReturn: - """Raise ParserSyntaxError at the given position.""" - span = ( - self.position if span_start is None else span_start, - self.position if span_end is None else span_end, - ) - raise ParserSyntaxError( - message, - source=self.source, - span=span, - ) - - @contextlib.contextmanager - def enclosing_tokens( - self, open_token: str, close_token: str, *, around: str - ) -> Iterator[None]: - if self.check(open_token): - open_position = self.position - self.read() - else: - open_position = None - - yield - - if open_position is None: - return - - if not self.check(close_token): - self.raise_syntax_error( - f"Expected matching {close_token} for {open_token}, after {around}", - span_start=open_position, - ) - - self.read() diff --git a/pkg_resources/_vendor/packaging/markers.py b/pkg_resources/_vendor/packaging/markers.py deleted file mode 100644 index 7ac7bb69a5..0000000000 --- a/pkg_resources/_vendor/packaging/markers.py +++ /dev/null @@ -1,325 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -from __future__ import annotations - -import operator -import os -import platform -import sys -from typing import Any, Callable, TypedDict, cast - -from ._parser import MarkerAtom, MarkerList, Op, Value, Variable -from ._parser import parse_marker as _parse_marker -from ._tokenizer import ParserSyntaxError -from .specifiers import InvalidSpecifier, Specifier -from .utils import canonicalize_name - -__all__ = [ - "InvalidMarker", - "UndefinedComparison", - "UndefinedEnvironmentName", - "Marker", - "default_environment", -] - -Operator = Callable[[str, str], bool] - - -class InvalidMarker(ValueError): - """ - An invalid marker was found, users should refer to PEP 508. - """ - - -class UndefinedComparison(ValueError): - """ - An invalid operation was attempted on a value that doesn't support it. - """ - - -class UndefinedEnvironmentName(ValueError): - """ - A name was attempted to be used that does not exist inside of the - environment. - """ - - -class Environment(TypedDict): - implementation_name: str - """The implementation's identifier, e.g. ``'cpython'``.""" - - implementation_version: str - """ - The implementation's version, e.g. ``'3.13.0a2'`` for CPython 3.13.0a2, or - ``'7.3.13'`` for PyPy3.10 v7.3.13. - """ - - os_name: str - """ - The value of :py:data:`os.name`. The name of the operating system dependent module - imported, e.g. ``'posix'``. - """ - - platform_machine: str - """ - Returns the machine type, e.g. ``'i386'``. - - An empty string if the value cannot be determined. - """ - - platform_release: str - """ - The system's release, e.g. ``'2.2.0'`` or ``'NT'``. - - An empty string if the value cannot be determined. - """ - - platform_system: str - """ - The system/OS name, e.g. ``'Linux'``, ``'Windows'`` or ``'Java'``. - - An empty string if the value cannot be determined. - """ - - platform_version: str - """ - The system's release version, e.g. ``'#3 on degas'``. - - An empty string if the value cannot be determined. - """ - - python_full_version: str - """ - The Python version as string ``'major.minor.patchlevel'``. - - Note that unlike the Python :py:data:`sys.version`, this value will always include - the patchlevel (it defaults to 0). - """ - - platform_python_implementation: str - """ - A string identifying the Python implementation, e.g. ``'CPython'``. - """ - - python_version: str - """The Python version as string ``'major.minor'``.""" - - sys_platform: str - """ - This string contains a platform identifier that can be used to append - platform-specific components to :py:data:`sys.path`, for instance. - - For Unix systems, except on Linux and AIX, this is the lowercased OS name as - returned by ``uname -s`` with the first part of the version as returned by - ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, at the time when Python - was built. - """ - - -def _normalize_extra_values(results: Any) -> Any: - """ - Normalize extra values. - """ - if isinstance(results[0], tuple): - lhs, op, rhs = results[0] - if isinstance(lhs, Variable) and lhs.value == "extra": - normalized_extra = canonicalize_name(rhs.value) - rhs = Value(normalized_extra) - elif isinstance(rhs, Variable) and rhs.value == "extra": - normalized_extra = canonicalize_name(lhs.value) - lhs = Value(normalized_extra) - results[0] = lhs, op, rhs - return results - - -def _format_marker( - marker: list[str] | MarkerAtom | str, first: bool | None = True -) -> str: - assert isinstance(marker, (list, tuple, str)) - - # Sometimes we have a structure like [[...]] which is a single item list - # where the single item is itself it's own list. In that case we want skip - # the rest of this function so that we don't get extraneous () on the - # outside. - if ( - isinstance(marker, list) - and len(marker) == 1 - and isinstance(marker[0], (list, tuple)) - ): - return _format_marker(marker[0]) - - if isinstance(marker, list): - inner = (_format_marker(m, first=False) for m in marker) - if first: - return " ".join(inner) - else: - return "(" + " ".join(inner) + ")" - elif isinstance(marker, tuple): - return " ".join([m.serialize() for m in marker]) - else: - return marker - - -_operators: dict[str, Operator] = { - "in": lambda lhs, rhs: lhs in rhs, - "not in": lambda lhs, rhs: lhs not in rhs, - "<": operator.lt, - "<=": operator.le, - "==": operator.eq, - "!=": operator.ne, - ">=": operator.ge, - ">": operator.gt, -} - - -def _eval_op(lhs: str, op: Op, rhs: str) -> bool: - try: - spec = Specifier("".join([op.serialize(), rhs])) - except InvalidSpecifier: - pass - else: - return spec.contains(lhs, prereleases=True) - - oper: Operator | None = _operators.get(op.serialize()) - if oper is None: - raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.") - - return oper(lhs, rhs) - - -def _normalize(*values: str, key: str) -> tuple[str, ...]: - # PEP 685 – Comparison of extra names for optional distribution dependencies - # https://peps.python.org/pep-0685/ - # > When comparing extra names, tools MUST normalize the names being - # > compared using the semantics outlined in PEP 503 for names - if key == "extra": - return tuple(canonicalize_name(v) for v in values) - - # other environment markers don't have such standards - return values - - -def _evaluate_markers(markers: MarkerList, environment: dict[str, str]) -> bool: - groups: list[list[bool]] = [[]] - - for marker in markers: - assert isinstance(marker, (list, tuple, str)) - - if isinstance(marker, list): - groups[-1].append(_evaluate_markers(marker, environment)) - elif isinstance(marker, tuple): - lhs, op, rhs = marker - - if isinstance(lhs, Variable): - environment_key = lhs.value - lhs_value = environment[environment_key] - rhs_value = rhs.value - else: - lhs_value = lhs.value - environment_key = rhs.value - rhs_value = environment[environment_key] - - lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key) - groups[-1].append(_eval_op(lhs_value, op, rhs_value)) - else: - assert marker in ["and", "or"] - if marker == "or": - groups.append([]) - - return any(all(item) for item in groups) - - -def format_full_version(info: sys._version_info) -> str: - version = "{0.major}.{0.minor}.{0.micro}".format(info) - kind = info.releaselevel - if kind != "final": - version += kind[0] + str(info.serial) - return version - - -def default_environment() -> Environment: - iver = format_full_version(sys.implementation.version) - implementation_name = sys.implementation.name - return { - "implementation_name": implementation_name, - "implementation_version": iver, - "os_name": os.name, - "platform_machine": platform.machine(), - "platform_release": platform.release(), - "platform_system": platform.system(), - "platform_version": platform.version(), - "python_full_version": platform.python_version(), - "platform_python_implementation": platform.python_implementation(), - "python_version": ".".join(platform.python_version_tuple()[:2]), - "sys_platform": sys.platform, - } - - -class Marker: - def __init__(self, marker: str) -> None: - # Note: We create a Marker object without calling this constructor in - # packaging.requirements.Requirement. If any additional logic is - # added here, make sure to mirror/adapt Requirement. - try: - self._markers = _normalize_extra_values(_parse_marker(marker)) - # The attribute `_markers` can be described in terms of a recursive type: - # MarkerList = List[Union[Tuple[Node, ...], str, MarkerList]] - # - # For example, the following expression: - # python_version > "3.6" or (python_version == "3.6" and os_name == "unix") - # - # is parsed into: - # [ - # (, ')>, ), - # 'and', - # [ - # (, , ), - # 'or', - # (, , ) - # ] - # ] - except ParserSyntaxError as e: - raise InvalidMarker(str(e)) from e - - def __str__(self) -> str: - return _format_marker(self._markers) - - def __repr__(self) -> str: - return f"" - - def __hash__(self) -> int: - return hash((self.__class__.__name__, str(self))) - - def __eq__(self, other: Any) -> bool: - if not isinstance(other, Marker): - return NotImplemented - - return str(self) == str(other) - - def evaluate(self, environment: dict[str, str] | None = None) -> bool: - """Evaluate a marker. - - Return the boolean from evaluating the given marker against the - environment. environment is an optional argument to override all or - part of the determined environment. - - The environment is determined from the current Python process. - """ - current_environment = cast("dict[str, str]", default_environment()) - current_environment["extra"] = "" - # Work around platform.python_version() returning something that is not PEP 440 - # compliant for non-tagged Python builds. We preserve default_environment()'s - # behavior of returning platform.python_version() verbatim, and leave it to the - # caller to provide a syntactically valid version if they want to override it. - if current_environment["python_full_version"].endswith("+"): - current_environment["python_full_version"] += "local" - if environment is not None: - current_environment.update(environment) - # The API used to allow setting extra to None. We need to handle this - # case for backwards compatibility. - if current_environment["extra"] is None: - current_environment["extra"] = "" - - return _evaluate_markers(self._markers, current_environment) diff --git a/pkg_resources/_vendor/packaging/metadata.py b/pkg_resources/_vendor/packaging/metadata.py deleted file mode 100644 index eb8dc844d2..0000000000 --- a/pkg_resources/_vendor/packaging/metadata.py +++ /dev/null @@ -1,804 +0,0 @@ -from __future__ import annotations - -import email.feedparser -import email.header -import email.message -import email.parser -import email.policy -import typing -from typing import ( - Any, - Callable, - Generic, - Literal, - TypedDict, - cast, -) - -from . import requirements, specifiers, utils -from . import version as version_module - -T = typing.TypeVar("T") - - -try: - ExceptionGroup -except NameError: # pragma: no cover - - class ExceptionGroup(Exception): - """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11. - - If :external:exc:`ExceptionGroup` is already defined by Python itself, - that version is used instead. - """ - - message: str - exceptions: list[Exception] - - def __init__(self, message: str, exceptions: list[Exception]) -> None: - self.message = message - self.exceptions = exceptions - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({self.message!r}, {self.exceptions!r})" - -else: # pragma: no cover - ExceptionGroup = ExceptionGroup - - -class InvalidMetadata(ValueError): - """A metadata field contains invalid data.""" - - field: str - """The name of the field that contains invalid data.""" - - def __init__(self, field: str, message: str) -> None: - self.field = field - super().__init__(message) - - -# The RawMetadata class attempts to make as few assumptions about the underlying -# serialization formats as possible. The idea is that as long as a serialization -# formats offer some very basic primitives in *some* way then we can support -# serializing to and from that format. -class RawMetadata(TypedDict, total=False): - """A dictionary of raw core metadata. - - Each field in core metadata maps to a key of this dictionary (when data is - provided). The key is lower-case and underscores are used instead of dashes - compared to the equivalent core metadata field. Any core metadata field that - can be specified multiple times or can hold multiple values in a single - field have a key with a plural name. See :class:`Metadata` whose attributes - match the keys of this dictionary. - - Core metadata fields that can be specified multiple times are stored as a - list or dict depending on which is appropriate for the field. Any fields - which hold multiple values in a single field are stored as a list. - - """ - - # Metadata 1.0 - PEP 241 - metadata_version: str - name: str - version: str - platforms: list[str] - summary: str - description: str - keywords: list[str] - home_page: str - author: str - author_email: str - license: str - - # Metadata 1.1 - PEP 314 - supported_platforms: list[str] - download_url: str - classifiers: list[str] - requires: list[str] - provides: list[str] - obsoletes: list[str] - - # Metadata 1.2 - PEP 345 - maintainer: str - maintainer_email: str - requires_dist: list[str] - provides_dist: list[str] - obsoletes_dist: list[str] - requires_python: str - requires_external: list[str] - project_urls: dict[str, str] - - # Metadata 2.0 - # PEP 426 attempted to completely revamp the metadata format - # but got stuck without ever being able to build consensus on - # it and ultimately ended up withdrawn. - # - # However, a number of tools had started emitting METADATA with - # `2.0` Metadata-Version, so for historical reasons, this version - # was skipped. - - # Metadata 2.1 - PEP 566 - description_content_type: str - provides_extra: list[str] - - # Metadata 2.2 - PEP 643 - dynamic: list[str] - - # Metadata 2.3 - PEP 685 - # No new fields were added in PEP 685, just some edge case were - # tightened up to provide better interoptability. - - -_STRING_FIELDS = { - "author", - "author_email", - "description", - "description_content_type", - "download_url", - "home_page", - "license", - "maintainer", - "maintainer_email", - "metadata_version", - "name", - "requires_python", - "summary", - "version", -} - -_LIST_FIELDS = { - "classifiers", - "dynamic", - "obsoletes", - "obsoletes_dist", - "platforms", - "provides", - "provides_dist", - "provides_extra", - "requires", - "requires_dist", - "requires_external", - "supported_platforms", -} - -_DICT_FIELDS = { - "project_urls", -} - - -def _parse_keywords(data: str) -> list[str]: - """Split a string of comma-separate keyboards into a list of keywords.""" - return [k.strip() for k in data.split(",")] - - -def _parse_project_urls(data: list[str]) -> dict[str, str]: - """Parse a list of label/URL string pairings separated by a comma.""" - urls = {} - for pair in data: - # Our logic is slightly tricky here as we want to try and do - # *something* reasonable with malformed data. - # - # The main thing that we have to worry about, is data that does - # not have a ',' at all to split the label from the Value. There - # isn't a singular right answer here, and we will fail validation - # later on (if the caller is validating) so it doesn't *really* - # matter, but since the missing value has to be an empty str - # and our return value is dict[str, str], if we let the key - # be the missing value, then they'd have multiple '' values that - # overwrite each other in a accumulating dict. - # - # The other potentional issue is that it's possible to have the - # same label multiple times in the metadata, with no solid "right" - # answer with what to do in that case. As such, we'll do the only - # thing we can, which is treat the field as unparseable and add it - # to our list of unparsed fields. - parts = [p.strip() for p in pair.split(",", 1)] - parts.extend([""] * (max(0, 2 - len(parts)))) # Ensure 2 items - - # TODO: The spec doesn't say anything about if the keys should be - # considered case sensitive or not... logically they should - # be case-preserving and case-insensitive, but doing that - # would open up more cases where we might have duplicate - # entries. - label, url = parts - if label in urls: - # The label already exists in our set of urls, so this field - # is unparseable, and we can just add the whole thing to our - # unparseable data and stop processing it. - raise KeyError("duplicate labels in project urls") - urls[label] = url - - return urls - - -def _get_payload(msg: email.message.Message, source: bytes | str) -> str: - """Get the body of the message.""" - # If our source is a str, then our caller has managed encodings for us, - # and we don't need to deal with it. - if isinstance(source, str): - payload: str = msg.get_payload() - return payload - # If our source is a bytes, then we're managing the encoding and we need - # to deal with it. - else: - bpayload: bytes = msg.get_payload(decode=True) - try: - return bpayload.decode("utf8", "strict") - except UnicodeDecodeError: - raise ValueError("payload in an invalid encoding") - - -# The various parse_FORMAT functions here are intended to be as lenient as -# possible in their parsing, while still returning a correctly typed -# RawMetadata. -# -# To aid in this, we also generally want to do as little touching of the -# data as possible, except where there are possibly some historic holdovers -# that make valid data awkward to work with. -# -# While this is a lower level, intermediate format than our ``Metadata`` -# class, some light touch ups can make a massive difference in usability. - -# Map METADATA fields to RawMetadata. -_EMAIL_TO_RAW_MAPPING = { - "author": "author", - "author-email": "author_email", - "classifier": "classifiers", - "description": "description", - "description-content-type": "description_content_type", - "download-url": "download_url", - "dynamic": "dynamic", - "home-page": "home_page", - "keywords": "keywords", - "license": "license", - "maintainer": "maintainer", - "maintainer-email": "maintainer_email", - "metadata-version": "metadata_version", - "name": "name", - "obsoletes": "obsoletes", - "obsoletes-dist": "obsoletes_dist", - "platform": "platforms", - "project-url": "project_urls", - "provides": "provides", - "provides-dist": "provides_dist", - "provides-extra": "provides_extra", - "requires": "requires", - "requires-dist": "requires_dist", - "requires-external": "requires_external", - "requires-python": "requires_python", - "summary": "summary", - "supported-platform": "supported_platforms", - "version": "version", -} -_RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()} - - -def parse_email(data: bytes | str) -> tuple[RawMetadata, dict[str, list[str]]]: - """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``). - - This function returns a two-item tuple of dicts. The first dict is of - recognized fields from the core metadata specification. Fields that can be - parsed and translated into Python's built-in types are converted - appropriately. All other fields are left as-is. Fields that are allowed to - appear multiple times are stored as lists. - - The second dict contains all other fields from the metadata. This includes - any unrecognized fields. It also includes any fields which are expected to - be parsed into a built-in type but were not formatted appropriately. Finally, - any fields that are expected to appear only once but are repeated are - included in this dict. - - """ - raw: dict[str, str | list[str] | dict[str, str]] = {} - unparsed: dict[str, list[str]] = {} - - if isinstance(data, str): - parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data) - else: - parsed = email.parser.BytesParser(policy=email.policy.compat32).parsebytes(data) - - # We have to wrap parsed.keys() in a set, because in the case of multiple - # values for a key (a list), the key will appear multiple times in the - # list of keys, but we're avoiding that by using get_all(). - for name in frozenset(parsed.keys()): - # Header names in RFC are case insensitive, so we'll normalize to all - # lower case to make comparisons easier. - name = name.lower() - - # We use get_all() here, even for fields that aren't multiple use, - # because otherwise someone could have e.g. two Name fields, and we - # would just silently ignore it rather than doing something about it. - headers = parsed.get_all(name) or [] - - # The way the email module works when parsing bytes is that it - # unconditionally decodes the bytes as ascii using the surrogateescape - # handler. When you pull that data back out (such as with get_all() ), - # it looks to see if the str has any surrogate escapes, and if it does - # it wraps it in a Header object instead of returning the string. - # - # As such, we'll look for those Header objects, and fix up the encoding. - value = [] - # Flag if we have run into any issues processing the headers, thus - # signalling that the data belongs in 'unparsed'. - valid_encoding = True - for h in headers: - # It's unclear if this can return more types than just a Header or - # a str, so we'll just assert here to make sure. - assert isinstance(h, (email.header.Header, str)) - - # If it's a header object, we need to do our little dance to get - # the real data out of it. In cases where there is invalid data - # we're going to end up with mojibake, but there's no obvious, good - # way around that without reimplementing parts of the Header object - # ourselves. - # - # That should be fine since, if mojibacked happens, this key is - # going into the unparsed dict anyways. - if isinstance(h, email.header.Header): - # The Header object stores it's data as chunks, and each chunk - # can be independently encoded, so we'll need to check each - # of them. - chunks: list[tuple[bytes, str | None]] = [] - for bin, encoding in email.header.decode_header(h): - try: - bin.decode("utf8", "strict") - except UnicodeDecodeError: - # Enable mojibake. - encoding = "latin1" - valid_encoding = False - else: - encoding = "utf8" - chunks.append((bin, encoding)) - - # Turn our chunks back into a Header object, then let that - # Header object do the right thing to turn them into a - # string for us. - value.append(str(email.header.make_header(chunks))) - # This is already a string, so just add it. - else: - value.append(h) - - # We've processed all of our values to get them into a list of str, - # but we may have mojibake data, in which case this is an unparsed - # field. - if not valid_encoding: - unparsed[name] = value - continue - - raw_name = _EMAIL_TO_RAW_MAPPING.get(name) - if raw_name is None: - # This is a bit of a weird situation, we've encountered a key that - # we don't know what it means, so we don't know whether it's meant - # to be a list or not. - # - # Since we can't really tell one way or another, we'll just leave it - # as a list, even though it may be a single item list, because that's - # what makes the most sense for email headers. - unparsed[name] = value - continue - - # If this is one of our string fields, then we'll check to see if our - # value is a list of a single item. If it is then we'll assume that - # it was emitted as a single string, and unwrap the str from inside - # the list. - # - # If it's any other kind of data, then we haven't the faintest clue - # what we should parse it as, and we have to just add it to our list - # of unparsed stuff. - if raw_name in _STRING_FIELDS and len(value) == 1: - raw[raw_name] = value[0] - # If this is one of our list of string fields, then we can just assign - # the value, since email *only* has strings, and our get_all() call - # above ensures that this is a list. - elif raw_name in _LIST_FIELDS: - raw[raw_name] = value - # Special Case: Keywords - # The keywords field is implemented in the metadata spec as a str, - # but it conceptually is a list of strings, and is serialized using - # ", ".join(keywords), so we'll do some light data massaging to turn - # this into what it logically is. - elif raw_name == "keywords" and len(value) == 1: - raw[raw_name] = _parse_keywords(value[0]) - # Special Case: Project-URL - # The project urls is implemented in the metadata spec as a list of - # specially-formatted strings that represent a key and a value, which - # is fundamentally a mapping, however the email format doesn't support - # mappings in a sane way, so it was crammed into a list of strings - # instead. - # - # We will do a little light data massaging to turn this into a map as - # it logically should be. - elif raw_name == "project_urls": - try: - raw[raw_name] = _parse_project_urls(value) - except KeyError: - unparsed[name] = value - # Nothing that we've done has managed to parse this, so it'll just - # throw it in our unparseable data and move on. - else: - unparsed[name] = value - - # We need to support getting the Description from the message payload in - # addition to getting it from the the headers. This does mean, though, there - # is the possibility of it being set both ways, in which case we put both - # in 'unparsed' since we don't know which is right. - try: - payload = _get_payload(parsed, data) - except ValueError: - unparsed.setdefault("description", []).append( - parsed.get_payload(decode=isinstance(data, bytes)) - ) - else: - if payload: - # Check to see if we've already got a description, if so then both - # it, and this body move to unparseable. - if "description" in raw: - description_header = cast(str, raw.pop("description")) - unparsed.setdefault("description", []).extend( - [description_header, payload] - ) - elif "description" in unparsed: - unparsed["description"].append(payload) - else: - raw["description"] = payload - - # We need to cast our `raw` to a metadata, because a TypedDict only support - # literal key names, but we're computing our key names on purpose, but the - # way this function is implemented, our `TypedDict` can only have valid key - # names. - return cast(RawMetadata, raw), unparsed - - -_NOT_FOUND = object() - - -# Keep the two values in sync. -_VALID_METADATA_VERSIONS = ["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] -_MetadataVersion = Literal["1.0", "1.1", "1.2", "2.1", "2.2", "2.3"] - -_REQUIRED_ATTRS = frozenset(["metadata_version", "name", "version"]) - - -class _Validator(Generic[T]): - """Validate a metadata field. - - All _process_*() methods correspond to a core metadata field. The method is - called with the field's raw value. If the raw value is valid it is returned - in its "enriched" form (e.g. ``version.Version`` for the ``Version`` field). - If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause - as appropriate). - """ - - name: str - raw_name: str - added: _MetadataVersion - - def __init__( - self, - *, - added: _MetadataVersion = "1.0", - ) -> None: - self.added = added - - def __set_name__(self, _owner: Metadata, name: str) -> None: - self.name = name - self.raw_name = _RAW_TO_EMAIL_MAPPING[name] - - def __get__(self, instance: Metadata, _owner: type[Metadata]) -> T: - # With Python 3.8, the caching can be replaced with functools.cached_property(). - # No need to check the cache as attribute lookup will resolve into the - # instance's __dict__ before __get__ is called. - cache = instance.__dict__ - value = instance._raw.get(self.name) - - # To make the _process_* methods easier, we'll check if the value is None - # and if this field is NOT a required attribute, and if both of those - # things are true, we'll skip the the converter. This will mean that the - # converters never have to deal with the None union. - if self.name in _REQUIRED_ATTRS or value is not None: - try: - converter: Callable[[Any], T] = getattr(self, f"_process_{self.name}") - except AttributeError: - pass - else: - value = converter(value) - - cache[self.name] = value - try: - del instance._raw[self.name] # type: ignore[misc] - except KeyError: - pass - - return cast(T, value) - - def _invalid_metadata( - self, msg: str, cause: Exception | None = None - ) -> InvalidMetadata: - exc = InvalidMetadata( - self.raw_name, msg.format_map({"field": repr(self.raw_name)}) - ) - exc.__cause__ = cause - return exc - - def _process_metadata_version(self, value: str) -> _MetadataVersion: - # Implicitly makes Metadata-Version required. - if value not in _VALID_METADATA_VERSIONS: - raise self._invalid_metadata(f"{value!r} is not a valid metadata version") - return cast(_MetadataVersion, value) - - def _process_name(self, value: str) -> str: - if not value: - raise self._invalid_metadata("{field} is a required field") - # Validate the name as a side-effect. - try: - utils.canonicalize_name(value, validate=True) - except utils.InvalidName as exc: - raise self._invalid_metadata( - f"{value!r} is invalid for {{field}}", cause=exc - ) - else: - return value - - def _process_version(self, value: str) -> version_module.Version: - if not value: - raise self._invalid_metadata("{field} is a required field") - try: - return version_module.parse(value) - except version_module.InvalidVersion as exc: - raise self._invalid_metadata( - f"{value!r} is invalid for {{field}}", cause=exc - ) - - def _process_summary(self, value: str) -> str: - """Check the field contains no newlines.""" - if "\n" in value: - raise self._invalid_metadata("{field} must be a single line") - return value - - def _process_description_content_type(self, value: str) -> str: - content_types = {"text/plain", "text/x-rst", "text/markdown"} - message = email.message.EmailMessage() - message["content-type"] = value - - content_type, parameters = ( - # Defaults to `text/plain` if parsing failed. - message.get_content_type().lower(), - message["content-type"].params, - ) - # Check if content-type is valid or defaulted to `text/plain` and thus was - # not parseable. - if content_type not in content_types or content_type not in value.lower(): - raise self._invalid_metadata( - f"{{field}} must be one of {list(content_types)}, not {value!r}" - ) - - charset = parameters.get("charset", "UTF-8") - if charset != "UTF-8": - raise self._invalid_metadata( - f"{{field}} can only specify the UTF-8 charset, not {list(charset)}" - ) - - markdown_variants = {"GFM", "CommonMark"} - variant = parameters.get("variant", "GFM") # Use an acceptable default. - if content_type == "text/markdown" and variant not in markdown_variants: - raise self._invalid_metadata( - f"valid Markdown variants for {{field}} are {list(markdown_variants)}, " - f"not {variant!r}", - ) - return value - - def _process_dynamic(self, value: list[str]) -> list[str]: - for dynamic_field in map(str.lower, value): - if dynamic_field in {"name", "version", "metadata-version"}: - raise self._invalid_metadata( - f"{value!r} is not allowed as a dynamic field" - ) - elif dynamic_field not in _EMAIL_TO_RAW_MAPPING: - raise self._invalid_metadata(f"{value!r} is not a valid dynamic field") - return list(map(str.lower, value)) - - def _process_provides_extra( - self, - value: list[str], - ) -> list[utils.NormalizedName]: - normalized_names = [] - try: - for name in value: - normalized_names.append(utils.canonicalize_name(name, validate=True)) - except utils.InvalidName as exc: - raise self._invalid_metadata( - f"{name!r} is invalid for {{field}}", cause=exc - ) - else: - return normalized_names - - def _process_requires_python(self, value: str) -> specifiers.SpecifierSet: - try: - return specifiers.SpecifierSet(value) - except specifiers.InvalidSpecifier as exc: - raise self._invalid_metadata( - f"{value!r} is invalid for {{field}}", cause=exc - ) - - def _process_requires_dist( - self, - value: list[str], - ) -> list[requirements.Requirement]: - reqs = [] - try: - for req in value: - reqs.append(requirements.Requirement(req)) - except requirements.InvalidRequirement as exc: - raise self._invalid_metadata(f"{req!r} is invalid for {{field}}", cause=exc) - else: - return reqs - - -class Metadata: - """Representation of distribution metadata. - - Compared to :class:`RawMetadata`, this class provides objects representing - metadata fields instead of only using built-in types. Any invalid metadata - will cause :exc:`InvalidMetadata` to be raised (with a - :py:attr:`~BaseException.__cause__` attribute as appropriate). - """ - - _raw: RawMetadata - - @classmethod - def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> Metadata: - """Create an instance from :class:`RawMetadata`. - - If *validate* is true, all metadata will be validated. All exceptions - related to validation will be gathered and raised as an :class:`ExceptionGroup`. - """ - ins = cls() - ins._raw = data.copy() # Mutations occur due to caching enriched values. - - if validate: - exceptions: list[Exception] = [] - try: - metadata_version = ins.metadata_version - metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version) - except InvalidMetadata as metadata_version_exc: - exceptions.append(metadata_version_exc) - metadata_version = None - - # Make sure to check for the fields that are present, the required - # fields (so their absence can be reported). - fields_to_check = frozenset(ins._raw) | _REQUIRED_ATTRS - # Remove fields that have already been checked. - fields_to_check -= {"metadata_version"} - - for key in fields_to_check: - try: - if metadata_version: - # Can't use getattr() as that triggers descriptor protocol which - # will fail due to no value for the instance argument. - try: - field_metadata_version = cls.__dict__[key].added - except KeyError: - exc = InvalidMetadata(key, f"unrecognized field: {key!r}") - exceptions.append(exc) - continue - field_age = _VALID_METADATA_VERSIONS.index( - field_metadata_version - ) - if field_age > metadata_age: - field = _RAW_TO_EMAIL_MAPPING[key] - exc = InvalidMetadata( - field, - "{field} introduced in metadata version " - "{field_metadata_version}, not {metadata_version}", - ) - exceptions.append(exc) - continue - getattr(ins, key) - except InvalidMetadata as exc: - exceptions.append(exc) - - if exceptions: - raise ExceptionGroup("invalid metadata", exceptions) - - return ins - - @classmethod - def from_email(cls, data: bytes | str, *, validate: bool = True) -> Metadata: - """Parse metadata from email headers. - - If *validate* is true, the metadata will be validated. All exceptions - related to validation will be gathered and raised as an :class:`ExceptionGroup`. - """ - raw, unparsed = parse_email(data) - - if validate: - exceptions: list[Exception] = [] - for unparsed_key in unparsed: - if unparsed_key in _EMAIL_TO_RAW_MAPPING: - message = f"{unparsed_key!r} has invalid data" - else: - message = f"unrecognized field: {unparsed_key!r}" - exceptions.append(InvalidMetadata(unparsed_key, message)) - - if exceptions: - raise ExceptionGroup("unparsed", exceptions) - - try: - return cls.from_raw(raw, validate=validate) - except ExceptionGroup as exc_group: - raise ExceptionGroup( - "invalid or unparsed metadata", exc_group.exceptions - ) from None - - metadata_version: _Validator[_MetadataVersion] = _Validator() - """:external:ref:`core-metadata-metadata-version` - (required; validated to be a valid metadata version)""" - name: _Validator[str] = _Validator() - """:external:ref:`core-metadata-name` - (required; validated using :func:`~packaging.utils.canonicalize_name` and its - *validate* parameter)""" - version: _Validator[version_module.Version] = _Validator() - """:external:ref:`core-metadata-version` (required)""" - dynamic: _Validator[list[str] | None] = _Validator( - added="2.2", - ) - """:external:ref:`core-metadata-dynamic` - (validated against core metadata field names and lowercased)""" - platforms: _Validator[list[str] | None] = _Validator() - """:external:ref:`core-metadata-platform`""" - supported_platforms: _Validator[list[str] | None] = _Validator(added="1.1") - """:external:ref:`core-metadata-supported-platform`""" - summary: _Validator[str | None] = _Validator() - """:external:ref:`core-metadata-summary` (validated to contain no newlines)""" - description: _Validator[str | None] = _Validator() # TODO 2.1: can be in body - """:external:ref:`core-metadata-description`""" - description_content_type: _Validator[str | None] = _Validator(added="2.1") - """:external:ref:`core-metadata-description-content-type` (validated)""" - keywords: _Validator[list[str] | None] = _Validator() - """:external:ref:`core-metadata-keywords`""" - home_page: _Validator[str | None] = _Validator() - """:external:ref:`core-metadata-home-page`""" - download_url: _Validator[str | None] = _Validator(added="1.1") - """:external:ref:`core-metadata-download-url`""" - author: _Validator[str | None] = _Validator() - """:external:ref:`core-metadata-author`""" - author_email: _Validator[str | None] = _Validator() - """:external:ref:`core-metadata-author-email`""" - maintainer: _Validator[str | None] = _Validator(added="1.2") - """:external:ref:`core-metadata-maintainer`""" - maintainer_email: _Validator[str | None] = _Validator(added="1.2") - """:external:ref:`core-metadata-maintainer-email`""" - license: _Validator[str | None] = _Validator() - """:external:ref:`core-metadata-license`""" - classifiers: _Validator[list[str] | None] = _Validator(added="1.1") - """:external:ref:`core-metadata-classifier`""" - requires_dist: _Validator[list[requirements.Requirement] | None] = _Validator( - added="1.2" - ) - """:external:ref:`core-metadata-requires-dist`""" - requires_python: _Validator[specifiers.SpecifierSet | None] = _Validator( - added="1.2" - ) - """:external:ref:`core-metadata-requires-python`""" - # Because `Requires-External` allows for non-PEP 440 version specifiers, we - # don't do any processing on the values. - requires_external: _Validator[list[str] | None] = _Validator(added="1.2") - """:external:ref:`core-metadata-requires-external`""" - project_urls: _Validator[dict[str, str] | None] = _Validator(added="1.2") - """:external:ref:`core-metadata-project-url`""" - # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation - # regardless of metadata version. - provides_extra: _Validator[list[utils.NormalizedName] | None] = _Validator( - added="2.1", - ) - """:external:ref:`core-metadata-provides-extra`""" - provides_dist: _Validator[list[str] | None] = _Validator(added="1.2") - """:external:ref:`core-metadata-provides-dist`""" - obsoletes_dist: _Validator[list[str] | None] = _Validator(added="1.2") - """:external:ref:`core-metadata-obsoletes-dist`""" - requires: _Validator[list[str] | None] = _Validator(added="1.1") - """``Requires`` (deprecated)""" - provides: _Validator[list[str] | None] = _Validator(added="1.1") - """``Provides`` (deprecated)""" - obsoletes: _Validator[list[str] | None] = _Validator(added="1.1") - """``Obsoletes`` (deprecated)""" diff --git a/pkg_resources/_vendor/packaging/py.typed b/pkg_resources/_vendor/packaging/py.typed deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/pkg_resources/_vendor/packaging/requirements.py b/pkg_resources/_vendor/packaging/requirements.py deleted file mode 100644 index 4e068c9567..0000000000 --- a/pkg_resources/_vendor/packaging/requirements.py +++ /dev/null @@ -1,91 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -from __future__ import annotations - -from typing import Any, Iterator - -from ._parser import parse_requirement as _parse_requirement -from ._tokenizer import ParserSyntaxError -from .markers import Marker, _normalize_extra_values -from .specifiers import SpecifierSet -from .utils import canonicalize_name - - -class InvalidRequirement(ValueError): - """ - An invalid requirement was found, users should refer to PEP 508. - """ - - -class Requirement: - """Parse a requirement. - - Parse a given requirement string into its parts, such as name, specifier, - URL, and extras. Raises InvalidRequirement on a badly-formed requirement - string. - """ - - # TODO: Can we test whether something is contained within a requirement? - # If so how do we do that? Do we need to test against the _name_ of - # the thing as well as the version? What about the markers? - # TODO: Can we normalize the name and extra name? - - def __init__(self, requirement_string: str) -> None: - try: - parsed = _parse_requirement(requirement_string) - except ParserSyntaxError as e: - raise InvalidRequirement(str(e)) from e - - self.name: str = parsed.name - self.url: str | None = parsed.url or None - self.extras: set[str] = set(parsed.extras or []) - self.specifier: SpecifierSet = SpecifierSet(parsed.specifier) - self.marker: Marker | None = None - if parsed.marker is not None: - self.marker = Marker.__new__(Marker) - self.marker._markers = _normalize_extra_values(parsed.marker) - - def _iter_parts(self, name: str) -> Iterator[str]: - yield name - - if self.extras: - formatted_extras = ",".join(sorted(self.extras)) - yield f"[{formatted_extras}]" - - if self.specifier: - yield str(self.specifier) - - if self.url: - yield f"@ {self.url}" - if self.marker: - yield " " - - if self.marker: - yield f"; {self.marker}" - - def __str__(self) -> str: - return "".join(self._iter_parts(self.name)) - - def __repr__(self) -> str: - return f"" - - def __hash__(self) -> int: - return hash( - ( - self.__class__.__name__, - *self._iter_parts(canonicalize_name(self.name)), - ) - ) - - def __eq__(self, other: Any) -> bool: - if not isinstance(other, Requirement): - return NotImplemented - - return ( - canonicalize_name(self.name) == canonicalize_name(other.name) - and self.extras == other.extras - and self.specifier == other.specifier - and self.url == other.url - and self.marker == other.marker - ) diff --git a/pkg_resources/_vendor/packaging/specifiers.py b/pkg_resources/_vendor/packaging/specifiers.py deleted file mode 100644 index 2fa75f7abb..0000000000 --- a/pkg_resources/_vendor/packaging/specifiers.py +++ /dev/null @@ -1,1009 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -""" -.. testsetup:: - - from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier - from packaging.version import Version -""" - -from __future__ import annotations - -import abc -import itertools -import re -from typing import Callable, Iterable, Iterator, TypeVar, Union - -from .utils import canonicalize_version -from .version import Version - -UnparsedVersion = Union[Version, str] -UnparsedVersionVar = TypeVar("UnparsedVersionVar", bound=UnparsedVersion) -CallableOperator = Callable[[Version, str], bool] - - -def _coerce_version(version: UnparsedVersion) -> Version: - if not isinstance(version, Version): - version = Version(version) - return version - - -class InvalidSpecifier(ValueError): - """ - Raised when attempting to create a :class:`Specifier` with a specifier - string that is invalid. - - >>> Specifier("lolwat") - Traceback (most recent call last): - ... - packaging.specifiers.InvalidSpecifier: Invalid specifier: 'lolwat' - """ - - -class BaseSpecifier(metaclass=abc.ABCMeta): - @abc.abstractmethod - def __str__(self) -> str: - """ - Returns the str representation of this Specifier-like object. This - should be representative of the Specifier itself. - """ - - @abc.abstractmethod - def __hash__(self) -> int: - """ - Returns a hash value for this Specifier-like object. - """ - - @abc.abstractmethod - def __eq__(self, other: object) -> bool: - """ - Returns a boolean representing whether or not the two Specifier-like - objects are equal. - - :param other: The other object to check against. - """ - - @property - @abc.abstractmethod - def prereleases(self) -> bool | None: - """Whether or not pre-releases as a whole are allowed. - - This can be set to either ``True`` or ``False`` to explicitly enable or disable - prereleases or it can be set to ``None`` (the default) to use default semantics. - """ - - @prereleases.setter - def prereleases(self, value: bool) -> None: - """Setter for :attr:`prereleases`. - - :param value: The value to set. - """ - - @abc.abstractmethod - def contains(self, item: str, prereleases: bool | None = None) -> bool: - """ - Determines if the given item is contained within this specifier. - """ - - @abc.abstractmethod - def filter( - self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None - ) -> Iterator[UnparsedVersionVar]: - """ - Takes an iterable of items and filters them so that only items which - are contained within this specifier are allowed in it. - """ - - -class Specifier(BaseSpecifier): - """This class abstracts handling of version specifiers. - - .. tip:: - - It is generally not required to instantiate this manually. You should instead - prefer to work with :class:`SpecifierSet` instead, which can parse - comma-separated version specifiers (which is what package metadata contains). - """ - - _operator_regex_str = r""" - (?P(~=|==|!=|<=|>=|<|>|===)) - """ - _version_regex_str = r""" - (?P - (?: - # The identity operators allow for an escape hatch that will - # do an exact string match of the version you wish to install. - # This will not be parsed by PEP 440 and we cannot determine - # any semantic meaning from it. This operator is discouraged - # but included entirely as an escape hatch. - (?<====) # Only match for the identity operator - \s* - [^\s;)]* # The arbitrary version can be just about anything, - # we match everything except for whitespace, a - # semi-colon for marker support, and a closing paren - # since versions can be enclosed in them. - ) - | - (?: - # The (non)equality operators allow for wild card and local - # versions to be specified so we have to define these two - # operators separately to enable that. - (?<===|!=) # Only match for equals and not equals - - \s* - v? - (?:[0-9]+!)? # epoch - [0-9]+(?:\.[0-9]+)* # release - - # You cannot use a wild card and a pre-release, post-release, a dev or - # local version together so group them with a | and make them optional. - (?: - \.\* # Wild card syntax of .* - | - (?: # pre release - [-_\.]? - (alpha|beta|preview|pre|a|b|c|rc) - [-_\.]? - [0-9]* - )? - (?: # post release - (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) - )? - (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release - (?:\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*)? # local - )? - ) - | - (?: - # The compatible operator requires at least two digits in the - # release segment. - (?<=~=) # Only match for the compatible operator - - \s* - v? - (?:[0-9]+!)? # epoch - [0-9]+(?:\.[0-9]+)+ # release (We have a + instead of a *) - (?: # pre release - [-_\.]? - (alpha|beta|preview|pre|a|b|c|rc) - [-_\.]? - [0-9]* - )? - (?: # post release - (?:-[0-9]+)|(?:[-_\.]?(post|rev|r)[-_\.]?[0-9]*) - )? - (?:[-_\.]?dev[-_\.]?[0-9]*)? # dev release - ) - | - (?: - # All other operators only allow a sub set of what the - # (non)equality operators do. Specifically they do not allow - # local versions to be specified nor do they allow the prefix - # matching wild cards. - (?=": "greater_than_equal", - "<": "less_than", - ">": "greater_than", - "===": "arbitrary", - } - - def __init__(self, spec: str = "", prereleases: bool | None = None) -> None: - """Initialize a Specifier instance. - - :param spec: - The string representation of a specifier which will be parsed and - normalized before use. - :param prereleases: - This tells the specifier if it should accept prerelease versions if - applicable or not. The default of ``None`` will autodetect it from the - given specifiers. - :raises InvalidSpecifier: - If the given specifier is invalid (i.e. bad syntax). - """ - match = self._regex.search(spec) - if not match: - raise InvalidSpecifier(f"Invalid specifier: '{spec}'") - - self._spec: tuple[str, str] = ( - match.group("operator").strip(), - match.group("version").strip(), - ) - - # Store whether or not this Specifier should accept prereleases - self._prereleases = prereleases - - # https://github.com/python/mypy/pull/13475#pullrequestreview-1079784515 - @property # type: ignore[override] - def prereleases(self) -> bool: - # If there is an explicit prereleases set for this, then we'll just - # blindly use that. - if self._prereleases is not None: - return self._prereleases - - # Look at all of our specifiers and determine if they are inclusive - # operators, and if they are if they are including an explicit - # prerelease. - operator, version = self._spec - if operator in ["==", ">=", "<=", "~=", "==="]: - # The == specifier can include a trailing .*, if it does we - # want to remove before parsing. - if operator == "==" and version.endswith(".*"): - version = version[:-2] - - # Parse the version, and if it is a pre-release than this - # specifier allows pre-releases. - if Version(version).is_prerelease: - return True - - return False - - @prereleases.setter - def prereleases(self, value: bool) -> None: - self._prereleases = value - - @property - def operator(self) -> str: - """The operator of this specifier. - - >>> Specifier("==1.2.3").operator - '==' - """ - return self._spec[0] - - @property - def version(self) -> str: - """The version of this specifier. - - >>> Specifier("==1.2.3").version - '1.2.3' - """ - return self._spec[1] - - def __repr__(self) -> str: - """A representation of the Specifier that shows all internal state. - - >>> Specifier('>=1.0.0') - =1.0.0')> - >>> Specifier('>=1.0.0', prereleases=False) - =1.0.0', prereleases=False)> - >>> Specifier('>=1.0.0', prereleases=True) - =1.0.0', prereleases=True)> - """ - pre = ( - f", prereleases={self.prereleases!r}" - if self._prereleases is not None - else "" - ) - - return f"<{self.__class__.__name__}({str(self)!r}{pre})>" - - def __str__(self) -> str: - """A string representation of the Specifier that can be round-tripped. - - >>> str(Specifier('>=1.0.0')) - '>=1.0.0' - >>> str(Specifier('>=1.0.0', prereleases=False)) - '>=1.0.0' - """ - return "{}{}".format(*self._spec) - - @property - def _canonical_spec(self) -> tuple[str, str]: - canonical_version = canonicalize_version( - self._spec[1], - strip_trailing_zero=(self._spec[0] != "~="), - ) - return self._spec[0], canonical_version - - def __hash__(self) -> int: - return hash(self._canonical_spec) - - def __eq__(self, other: object) -> bool: - """Whether or not the two Specifier-like objects are equal. - - :param other: The other object to check against. - - The value of :attr:`prereleases` is ignored. - - >>> Specifier("==1.2.3") == Specifier("== 1.2.3.0") - True - >>> (Specifier("==1.2.3", prereleases=False) == - ... Specifier("==1.2.3", prereleases=True)) - True - >>> Specifier("==1.2.3") == "==1.2.3" - True - >>> Specifier("==1.2.3") == Specifier("==1.2.4") - False - >>> Specifier("==1.2.3") == Specifier("~=1.2.3") - False - """ - if isinstance(other, str): - try: - other = self.__class__(str(other)) - except InvalidSpecifier: - return NotImplemented - elif not isinstance(other, self.__class__): - return NotImplemented - - return self._canonical_spec == other._canonical_spec - - def _get_operator(self, op: str) -> CallableOperator: - operator_callable: CallableOperator = getattr( - self, f"_compare_{self._operators[op]}" - ) - return operator_callable - - def _compare_compatible(self, prospective: Version, spec: str) -> bool: - # Compatible releases have an equivalent combination of >= and ==. That - # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to - # implement this in terms of the other specifiers instead of - # implementing it ourselves. The only thing we need to do is construct - # the other specifiers. - - # We want everything but the last item in the version, but we want to - # ignore suffix segments. - prefix = _version_join( - list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1] - ) - - # Add the prefix notation to the end of our string - prefix += ".*" - - return self._get_operator(">=")(prospective, spec) and self._get_operator("==")( - prospective, prefix - ) - - def _compare_equal(self, prospective: Version, spec: str) -> bool: - # We need special logic to handle prefix matching - if spec.endswith(".*"): - # In the case of prefix matching we want to ignore local segment. - normalized_prospective = canonicalize_version( - prospective.public, strip_trailing_zero=False - ) - # Get the normalized version string ignoring the trailing .* - normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False) - # Split the spec out by bangs and dots, and pretend that there is - # an implicit dot in between a release segment and a pre-release segment. - split_spec = _version_split(normalized_spec) - - # Split the prospective version out by bangs and dots, and pretend - # that there is an implicit dot in between a release segment and - # a pre-release segment. - split_prospective = _version_split(normalized_prospective) - - # 0-pad the prospective version before shortening it to get the correct - # shortened version. - padded_prospective, _ = _pad_version(split_prospective, split_spec) - - # Shorten the prospective version to be the same length as the spec - # so that we can determine if the specifier is a prefix of the - # prospective version or not. - shortened_prospective = padded_prospective[: len(split_spec)] - - return shortened_prospective == split_spec - else: - # Convert our spec string into a Version - spec_version = Version(spec) - - # If the specifier does not have a local segment, then we want to - # act as if the prospective version also does not have a local - # segment. - if not spec_version.local: - prospective = Version(prospective.public) - - return prospective == spec_version - - def _compare_not_equal(self, prospective: Version, spec: str) -> bool: - return not self._compare_equal(prospective, spec) - - def _compare_less_than_equal(self, prospective: Version, spec: str) -> bool: - # NB: Local version identifiers are NOT permitted in the version - # specifier, so local version labels can be universally removed from - # the prospective version. - return Version(prospective.public) <= Version(spec) - - def _compare_greater_than_equal(self, prospective: Version, spec: str) -> bool: - # NB: Local version identifiers are NOT permitted in the version - # specifier, so local version labels can be universally removed from - # the prospective version. - return Version(prospective.public) >= Version(spec) - - def _compare_less_than(self, prospective: Version, spec_str: str) -> bool: - # Convert our spec to a Version instance, since we'll want to work with - # it as a version. - spec = Version(spec_str) - - # Check to see if the prospective version is less than the spec - # version. If it's not we can short circuit and just return False now - # instead of doing extra unneeded work. - if not prospective < spec: - return False - - # This special case is here so that, unless the specifier itself - # includes is a pre-release version, that we do not accept pre-release - # versions for the version mentioned in the specifier (e.g. <3.1 should - # not match 3.1.dev0, but should match 3.0.dev0). - if not spec.is_prerelease and prospective.is_prerelease: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # If we've gotten to here, it means that prospective version is both - # less than the spec version *and* it's not a pre-release of the same - # version in the spec. - return True - - def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool: - # Convert our spec to a Version instance, since we'll want to work with - # it as a version. - spec = Version(spec_str) - - # Check to see if the prospective version is greater than the spec - # version. If it's not we can short circuit and just return False now - # instead of doing extra unneeded work. - if not prospective > spec: - return False - - # This special case is here so that, unless the specifier itself - # includes is a post-release version, that we do not accept - # post-release versions for the version mentioned in the specifier - # (e.g. >3.1 should not match 3.0.post0, but should match 3.2.post0). - if not spec.is_postrelease and prospective.is_postrelease: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # Ensure that we do not allow a local version of the version mentioned - # in the specifier, which is technically greater than, to match. - if prospective.local is not None: - if Version(prospective.base_version) == Version(spec.base_version): - return False - - # If we've gotten to here, it means that prospective version is both - # greater than the spec version *and* it's not a pre-release of the - # same version in the spec. - return True - - def _compare_arbitrary(self, prospective: Version, spec: str) -> bool: - return str(prospective).lower() == str(spec).lower() - - def __contains__(self, item: str | Version) -> bool: - """Return whether or not the item is contained in this specifier. - - :param item: The item to check for. - - This is used for the ``in`` operator and behaves the same as - :meth:`contains` with no ``prereleases`` argument passed. - - >>> "1.2.3" in Specifier(">=1.2.3") - True - >>> Version("1.2.3") in Specifier(">=1.2.3") - True - >>> "1.0.0" in Specifier(">=1.2.3") - False - >>> "1.3.0a1" in Specifier(">=1.2.3") - False - >>> "1.3.0a1" in Specifier(">=1.2.3", prereleases=True) - True - """ - return self.contains(item) - - def contains(self, item: UnparsedVersion, prereleases: bool | None = None) -> bool: - """Return whether or not the item is contained in this specifier. - - :param item: - The item to check for, which can be a version string or a - :class:`Version` instance. - :param prereleases: - Whether or not to match prereleases with this Specifier. If set to - ``None`` (the default), it uses :attr:`prereleases` to determine - whether or not prereleases are allowed. - - >>> Specifier(">=1.2.3").contains("1.2.3") - True - >>> Specifier(">=1.2.3").contains(Version("1.2.3")) - True - >>> Specifier(">=1.2.3").contains("1.0.0") - False - >>> Specifier(">=1.2.3").contains("1.3.0a1") - False - >>> Specifier(">=1.2.3", prereleases=True).contains("1.3.0a1") - True - >>> Specifier(">=1.2.3").contains("1.3.0a1", prereleases=True) - True - """ - - # Determine if prereleases are to be allowed or not. - if prereleases is None: - prereleases = self.prereleases - - # Normalize item to a Version, this allows us to have a shortcut for - # "2.0" in Specifier(">=2") - normalized_item = _coerce_version(item) - - # Determine if we should be supporting prereleases in this specifier - # or not, if we do not support prereleases than we can short circuit - # logic if this version is a prereleases. - if normalized_item.is_prerelease and not prereleases: - return False - - # Actually do the comparison to determine if this item is contained - # within this Specifier or not. - operator_callable: CallableOperator = self._get_operator(self.operator) - return operator_callable(normalized_item, self.version) - - def filter( - self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None - ) -> Iterator[UnparsedVersionVar]: - """Filter items in the given iterable, that match the specifier. - - :param iterable: - An iterable that can contain version strings and :class:`Version` instances. - The items in the iterable will be filtered according to the specifier. - :param prereleases: - Whether or not to allow prereleases in the returned iterator. If set to - ``None`` (the default), it will be intelligently decide whether to allow - prereleases or not (based on the :attr:`prereleases` attribute, and - whether the only versions matching are prereleases). - - This method is smarter than just ``filter(Specifier().contains, [...])`` - because it implements the rule from :pep:`440` that a prerelease item - SHOULD be accepted if no other versions match the given specifier. - - >>> list(Specifier(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) - ['1.3'] - >>> list(Specifier(">=1.2.3").filter(["1.2", "1.2.3", "1.3", Version("1.4")])) - ['1.2.3', '1.3', ] - >>> list(Specifier(">=1.2.3").filter(["1.2", "1.5a1"])) - ['1.5a1'] - >>> list(Specifier(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) - ['1.3', '1.5a1'] - >>> list(Specifier(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) - ['1.3', '1.5a1'] - """ - - yielded = False - found_prereleases = [] - - kw = {"prereleases": prereleases if prereleases is not None else True} - - # Attempt to iterate over all the values in the iterable and if any of - # them match, yield them. - for version in iterable: - parsed_version = _coerce_version(version) - - if self.contains(parsed_version, **kw): - # If our version is a prerelease, and we were not set to allow - # prereleases, then we'll store it for later in case nothing - # else matches this specifier. - if parsed_version.is_prerelease and not ( - prereleases or self.prereleases - ): - found_prereleases.append(version) - # Either this is not a prerelease, or we should have been - # accepting prereleases from the beginning. - else: - yielded = True - yield version - - # Now that we've iterated over everything, determine if we've yielded - # any values, and if we have not and we have any prereleases stored up - # then we will go ahead and yield the prereleases. - if not yielded and found_prereleases: - for version in found_prereleases: - yield version - - -_prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$") - - -def _version_split(version: str) -> list[str]: - """Split version into components. - - The split components are intended for version comparison. The logic does - not attempt to retain the original version string, so joining the - components back with :func:`_version_join` may not produce the original - version string. - """ - result: list[str] = [] - - epoch, _, rest = version.rpartition("!") - result.append(epoch or "0") - - for item in rest.split("."): - match = _prefix_regex.search(item) - if match: - result.extend(match.groups()) - else: - result.append(item) - return result - - -def _version_join(components: list[str]) -> str: - """Join split version components into a version string. - - This function assumes the input came from :func:`_version_split`, where the - first component must be the epoch (either empty or numeric), and all other - components numeric. - """ - epoch, *rest = components - return f"{epoch}!{'.'.join(rest)}" - - -def _is_not_suffix(segment: str) -> bool: - return not any( - segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post") - ) - - -def _pad_version(left: list[str], right: list[str]) -> tuple[list[str], list[str]]: - left_split, right_split = [], [] - - # Get the release segment of our versions - left_split.append(list(itertools.takewhile(lambda x: x.isdigit(), left))) - right_split.append(list(itertools.takewhile(lambda x: x.isdigit(), right))) - - # Get the rest of our versions - left_split.append(left[len(left_split[0]) :]) - right_split.append(right[len(right_split[0]) :]) - - # Insert our padding - left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0]))) - right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0]))) - - return ( - list(itertools.chain.from_iterable(left_split)), - list(itertools.chain.from_iterable(right_split)), - ) - - -class SpecifierSet(BaseSpecifier): - """This class abstracts handling of a set of version specifiers. - - It can be passed a single specifier (``>=3.0``), a comma-separated list of - specifiers (``>=3.0,!=3.1``), or no specifier at all. - """ - - def __init__(self, specifiers: str = "", prereleases: bool | None = None) -> None: - """Initialize a SpecifierSet instance. - - :param specifiers: - The string representation of a specifier or a comma-separated list of - specifiers which will be parsed and normalized before use. - :param prereleases: - This tells the SpecifierSet if it should accept prerelease versions if - applicable or not. The default of ``None`` will autodetect it from the - given specifiers. - - :raises InvalidSpecifier: - If the given ``specifiers`` are not parseable than this exception will be - raised. - """ - - # Split on `,` to break each individual specifier into it's own item, and - # strip each item to remove leading/trailing whitespace. - split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()] - - # Make each individual specifier a Specifier and save in a frozen set for later. - self._specs = frozenset(map(Specifier, split_specifiers)) - - # Store our prereleases value so we can use it later to determine if - # we accept prereleases or not. - self._prereleases = prereleases - - @property - def prereleases(self) -> bool | None: - # If we have been given an explicit prerelease modifier, then we'll - # pass that through here. - if self._prereleases is not None: - return self._prereleases - - # If we don't have any specifiers, and we don't have a forced value, - # then we'll just return None since we don't know if this should have - # pre-releases or not. - if not self._specs: - return None - - # Otherwise we'll see if any of the given specifiers accept - # prereleases, if any of them do we'll return True, otherwise False. - return any(s.prereleases for s in self._specs) - - @prereleases.setter - def prereleases(self, value: bool) -> None: - self._prereleases = value - - def __repr__(self) -> str: - """A representation of the specifier set that shows all internal state. - - Note that the ordering of the individual specifiers within the set may not - match the input string. - - >>> SpecifierSet('>=1.0.0,!=2.0.0') - =1.0.0')> - >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=False) - =1.0.0', prereleases=False)> - >>> SpecifierSet('>=1.0.0,!=2.0.0', prereleases=True) - =1.0.0', prereleases=True)> - """ - pre = ( - f", prereleases={self.prereleases!r}" - if self._prereleases is not None - else "" - ) - - return f"" - - def __str__(self) -> str: - """A string representation of the specifier set that can be round-tripped. - - Note that the ordering of the individual specifiers within the set may not - match the input string. - - >>> str(SpecifierSet(">=1.0.0,!=1.0.1")) - '!=1.0.1,>=1.0.0' - >>> str(SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False)) - '!=1.0.1,>=1.0.0' - """ - return ",".join(sorted(str(s) for s in self._specs)) - - def __hash__(self) -> int: - return hash(self._specs) - - def __and__(self, other: SpecifierSet | str) -> SpecifierSet: - """Return a SpecifierSet which is a combination of the two sets. - - :param other: The other object to combine with. - - >>> SpecifierSet(">=1.0.0,!=1.0.1") & '<=2.0.0,!=2.0.1' - =1.0.0')> - >>> SpecifierSet(">=1.0.0,!=1.0.1") & SpecifierSet('<=2.0.0,!=2.0.1') - =1.0.0')> - """ - if isinstance(other, str): - other = SpecifierSet(other) - elif not isinstance(other, SpecifierSet): - return NotImplemented - - specifier = SpecifierSet() - specifier._specs = frozenset(self._specs | other._specs) - - if self._prereleases is None and other._prereleases is not None: - specifier._prereleases = other._prereleases - elif self._prereleases is not None and other._prereleases is None: - specifier._prereleases = self._prereleases - elif self._prereleases == other._prereleases: - specifier._prereleases = self._prereleases - else: - raise ValueError( - "Cannot combine SpecifierSets with True and False prerelease " - "overrides." - ) - - return specifier - - def __eq__(self, other: object) -> bool: - """Whether or not the two SpecifierSet-like objects are equal. - - :param other: The other object to check against. - - The value of :attr:`prereleases` is ignored. - - >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.1") - True - >>> (SpecifierSet(">=1.0.0,!=1.0.1", prereleases=False) == - ... SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True)) - True - >>> SpecifierSet(">=1.0.0,!=1.0.1") == ">=1.0.0,!=1.0.1" - True - >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0") - False - >>> SpecifierSet(">=1.0.0,!=1.0.1") == SpecifierSet(">=1.0.0,!=1.0.2") - False - """ - if isinstance(other, (str, Specifier)): - other = SpecifierSet(str(other)) - elif not isinstance(other, SpecifierSet): - return NotImplemented - - return self._specs == other._specs - - def __len__(self) -> int: - """Returns the number of specifiers in this specifier set.""" - return len(self._specs) - - def __iter__(self) -> Iterator[Specifier]: - """ - Returns an iterator over all the underlying :class:`Specifier` instances - in this specifier set. - - >>> sorted(SpecifierSet(">=1.0.0,!=1.0.1"), key=str) - [, =1.0.0')>] - """ - return iter(self._specs) - - def __contains__(self, item: UnparsedVersion) -> bool: - """Return whether or not the item is contained in this specifier. - - :param item: The item to check for. - - This is used for the ``in`` operator and behaves the same as - :meth:`contains` with no ``prereleases`` argument passed. - - >>> "1.2.3" in SpecifierSet(">=1.0.0,!=1.0.1") - True - >>> Version("1.2.3") in SpecifierSet(">=1.0.0,!=1.0.1") - True - >>> "1.0.1" in SpecifierSet(">=1.0.0,!=1.0.1") - False - >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1") - False - >>> "1.3.0a1" in SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True) - True - """ - return self.contains(item) - - def contains( - self, - item: UnparsedVersion, - prereleases: bool | None = None, - installed: bool | None = None, - ) -> bool: - """Return whether or not the item is contained in this SpecifierSet. - - :param item: - The item to check for, which can be a version string or a - :class:`Version` instance. - :param prereleases: - Whether or not to match prereleases with this SpecifierSet. If set to - ``None`` (the default), it uses :attr:`prereleases` to determine - whether or not prereleases are allowed. - - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.2.3") - True - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains(Version("1.2.3")) - True - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.0.1") - False - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1") - False - >>> SpecifierSet(">=1.0.0,!=1.0.1", prereleases=True).contains("1.3.0a1") - True - >>> SpecifierSet(">=1.0.0,!=1.0.1").contains("1.3.0a1", prereleases=True) - True - """ - # Ensure that our item is a Version instance. - if not isinstance(item, Version): - item = Version(item) - - # Determine if we're forcing a prerelease or not, if we're not forcing - # one for this particular filter call, then we'll use whatever the - # SpecifierSet thinks for whether or not we should support prereleases. - if prereleases is None: - prereleases = self.prereleases - - # We can determine if we're going to allow pre-releases by looking to - # see if any of the underlying items supports them. If none of them do - # and this item is a pre-release then we do not allow it and we can - # short circuit that here. - # Note: This means that 1.0.dev1 would not be contained in something - # like >=1.0.devabc however it would be in >=1.0.debabc,>0.0.dev0 - if not prereleases and item.is_prerelease: - return False - - if installed and item.is_prerelease: - item = Version(item.base_version) - - # We simply dispatch to the underlying specs here to make sure that the - # given version is contained within all of them. - # Note: This use of all() here means that an empty set of specifiers - # will always return True, this is an explicit design decision. - return all(s.contains(item, prereleases=prereleases) for s in self._specs) - - def filter( - self, iterable: Iterable[UnparsedVersionVar], prereleases: bool | None = None - ) -> Iterator[UnparsedVersionVar]: - """Filter items in the given iterable, that match the specifiers in this set. - - :param iterable: - An iterable that can contain version strings and :class:`Version` instances. - The items in the iterable will be filtered according to the specifier. - :param prereleases: - Whether or not to allow prereleases in the returned iterator. If set to - ``None`` (the default), it will be intelligently decide whether to allow - prereleases or not (based on the :attr:`prereleases` attribute, and - whether the only versions matching are prereleases). - - This method is smarter than just ``filter(SpecifierSet(...).contains, [...])`` - because it implements the rule from :pep:`440` that a prerelease item - SHOULD be accepted if no other versions match the given specifier. - - >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", "1.5a1"])) - ['1.3'] - >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.3", Version("1.4")])) - ['1.3', ] - >>> list(SpecifierSet(">=1.2.3").filter(["1.2", "1.5a1"])) - [] - >>> list(SpecifierSet(">=1.2.3").filter(["1.3", "1.5a1"], prereleases=True)) - ['1.3', '1.5a1'] - >>> list(SpecifierSet(">=1.2.3", prereleases=True).filter(["1.3", "1.5a1"])) - ['1.3', '1.5a1'] - - An "empty" SpecifierSet will filter items based on the presence of prerelease - versions in the set. - - >>> list(SpecifierSet("").filter(["1.3", "1.5a1"])) - ['1.3'] - >>> list(SpecifierSet("").filter(["1.5a1"])) - ['1.5a1'] - >>> list(SpecifierSet("", prereleases=True).filter(["1.3", "1.5a1"])) - ['1.3', '1.5a1'] - >>> list(SpecifierSet("").filter(["1.3", "1.5a1"], prereleases=True)) - ['1.3', '1.5a1'] - """ - # Determine if we're forcing a prerelease or not, if we're not forcing - # one for this particular filter call, then we'll use whatever the - # SpecifierSet thinks for whether or not we should support prereleases. - if prereleases is None: - prereleases = self.prereleases - - # If we have any specifiers, then we want to wrap our iterable in the - # filter method for each one, this will act as a logical AND amongst - # each specifier. - if self._specs: - for spec in self._specs: - iterable = spec.filter(iterable, prereleases=bool(prereleases)) - return iter(iterable) - # If we do not have any specifiers, then we need to have a rough filter - # which will filter out any pre-releases, unless there are no final - # releases. - else: - filtered: list[UnparsedVersionVar] = [] - found_prereleases: list[UnparsedVersionVar] = [] - - for item in iterable: - parsed_version = _coerce_version(item) - - # Store any item which is a pre-release for later unless we've - # already found a final version or we are accepting prereleases - if parsed_version.is_prerelease and not prereleases: - if not filtered: - found_prereleases.append(item) - else: - filtered.append(item) - - # If we've found no items except for pre-releases, then we'll go - # ahead and use the pre-releases - if not filtered and found_prereleases and prereleases is None: - return iter(found_prereleases) - - return iter(filtered) diff --git a/pkg_resources/_vendor/packaging/tags.py b/pkg_resources/_vendor/packaging/tags.py deleted file mode 100644 index 6667d29908..0000000000 --- a/pkg_resources/_vendor/packaging/tags.py +++ /dev/null @@ -1,568 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -from __future__ import annotations - -import logging -import platform -import re -import struct -import subprocess -import sys -import sysconfig -from importlib.machinery import EXTENSION_SUFFIXES -from typing import ( - Iterable, - Iterator, - Sequence, - Tuple, - cast, -) - -from . import _manylinux, _musllinux - -logger = logging.getLogger(__name__) - -PythonVersion = Sequence[int] -MacVersion = Tuple[int, int] - -INTERPRETER_SHORT_NAMES: dict[str, str] = { - "python": "py", # Generic. - "cpython": "cp", - "pypy": "pp", - "ironpython": "ip", - "jython": "jy", -} - - -_32_BIT_INTERPRETER = struct.calcsize("P") == 4 - - -class Tag: - """ - A representation of the tag triple for a wheel. - - Instances are considered immutable and thus are hashable. Equality checking - is also supported. - """ - - __slots__ = ["_interpreter", "_abi", "_platform", "_hash"] - - def __init__(self, interpreter: str, abi: str, platform: str) -> None: - self._interpreter = interpreter.lower() - self._abi = abi.lower() - self._platform = platform.lower() - # The __hash__ of every single element in a Set[Tag] will be evaluated each time - # that a set calls its `.disjoint()` method, which may be called hundreds of - # times when scanning a page of links for packages with tags matching that - # Set[Tag]. Pre-computing the value here produces significant speedups for - # downstream consumers. - self._hash = hash((self._interpreter, self._abi, self._platform)) - - @property - def interpreter(self) -> str: - return self._interpreter - - @property - def abi(self) -> str: - return self._abi - - @property - def platform(self) -> str: - return self._platform - - def __eq__(self, other: object) -> bool: - if not isinstance(other, Tag): - return NotImplemented - - return ( - (self._hash == other._hash) # Short-circuit ASAP for perf reasons. - and (self._platform == other._platform) - and (self._abi == other._abi) - and (self._interpreter == other._interpreter) - ) - - def __hash__(self) -> int: - return self._hash - - def __str__(self) -> str: - return f"{self._interpreter}-{self._abi}-{self._platform}" - - def __repr__(self) -> str: - return f"<{self} @ {id(self)}>" - - -def parse_tag(tag: str) -> frozenset[Tag]: - """ - Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances. - - Returning a set is required due to the possibility that the tag is a - compressed tag set. - """ - tags = set() - interpreters, abis, platforms = tag.split("-") - for interpreter in interpreters.split("."): - for abi in abis.split("."): - for platform_ in platforms.split("."): - tags.add(Tag(interpreter, abi, platform_)) - return frozenset(tags) - - -def _get_config_var(name: str, warn: bool = False) -> int | str | None: - value: int | str | None = sysconfig.get_config_var(name) - if value is None and warn: - logger.debug( - "Config variable '%s' is unset, Python ABI tag may be incorrect", name - ) - return value - - -def _normalize_string(string: str) -> str: - return string.replace(".", "_").replace("-", "_").replace(" ", "_") - - -def _is_threaded_cpython(abis: list[str]) -> bool: - """ - Determine if the ABI corresponds to a threaded (`--disable-gil`) build. - - The threaded builds are indicated by a "t" in the abiflags. - """ - if len(abis) == 0: - return False - # expect e.g., cp313 - m = re.match(r"cp\d+(.*)", abis[0]) - if not m: - return False - abiflags = m.group(1) - return "t" in abiflags - - -def _abi3_applies(python_version: PythonVersion, threading: bool) -> bool: - """ - Determine if the Python version supports abi3. - - PEP 384 was first implemented in Python 3.2. The threaded (`--disable-gil`) - builds do not support abi3. - """ - return len(python_version) > 1 and tuple(python_version) >= (3, 2) and not threading - - -def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> list[str]: - py_version = tuple(py_version) # To allow for version comparison. - abis = [] - version = _version_nodot(py_version[:2]) - threading = debug = pymalloc = ucs4 = "" - with_debug = _get_config_var("Py_DEBUG", warn) - has_refcount = hasattr(sys, "gettotalrefcount") - # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled - # extension modules is the best option. - # https://github.com/pypa/pip/issues/3383#issuecomment-173267692 - has_ext = "_d.pyd" in EXTENSION_SUFFIXES - if with_debug or (with_debug is None and (has_refcount or has_ext)): - debug = "d" - if py_version >= (3, 13) and _get_config_var("Py_GIL_DISABLED", warn): - threading = "t" - if py_version < (3, 8): - with_pymalloc = _get_config_var("WITH_PYMALLOC", warn) - if with_pymalloc or with_pymalloc is None: - pymalloc = "m" - if py_version < (3, 3): - unicode_size = _get_config_var("Py_UNICODE_SIZE", warn) - if unicode_size == 4 or ( - unicode_size is None and sys.maxunicode == 0x10FFFF - ): - ucs4 = "u" - elif debug: - # Debug builds can also load "normal" extension modules. - # We can also assume no UCS-4 or pymalloc requirement. - abis.append(f"cp{version}{threading}") - abis.insert(0, f"cp{version}{threading}{debug}{pymalloc}{ucs4}") - return abis - - -def cpython_tags( - python_version: PythonVersion | None = None, - abis: Iterable[str] | None = None, - platforms: Iterable[str] | None = None, - *, - warn: bool = False, -) -> Iterator[Tag]: - """ - Yields the tags for a CPython interpreter. - - The tags consist of: - - cp-- - - cp-abi3- - - cp-none- - - cp-abi3- # Older Python versions down to 3.2. - - If python_version only specifies a major version then user-provided ABIs and - the 'none' ABItag will be used. - - If 'abi3' or 'none' are specified in 'abis' then they will be yielded at - their normal position and not at the beginning. - """ - if not python_version: - python_version = sys.version_info[:2] - - interpreter = f"cp{_version_nodot(python_version[:2])}" - - if abis is None: - if len(python_version) > 1: - abis = _cpython_abis(python_version, warn) - else: - abis = [] - abis = list(abis) - # 'abi3' and 'none' are explicitly handled later. - for explicit_abi in ("abi3", "none"): - try: - abis.remove(explicit_abi) - except ValueError: - pass - - platforms = list(platforms or platform_tags()) - for abi in abis: - for platform_ in platforms: - yield Tag(interpreter, abi, platform_) - - threading = _is_threaded_cpython(abis) - use_abi3 = _abi3_applies(python_version, threading) - if use_abi3: - yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms) - yield from (Tag(interpreter, "none", platform_) for platform_ in platforms) - - if use_abi3: - for minor_version in range(python_version[1] - 1, 1, -1): - for platform_ in platforms: - interpreter = "cp{version}".format( - version=_version_nodot((python_version[0], minor_version)) - ) - yield Tag(interpreter, "abi3", platform_) - - -def _generic_abi() -> list[str]: - """ - Return the ABI tag based on EXT_SUFFIX. - """ - # The following are examples of `EXT_SUFFIX`. - # We want to keep the parts which are related to the ABI and remove the - # parts which are related to the platform: - # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310 - # - mac: '.cpython-310-darwin.so' => cp310 - # - win: '.cp310-win_amd64.pyd' => cp310 - # - win: '.pyd' => cp37 (uses _cpython_abis()) - # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73 - # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib' - # => graalpy_38_native - - ext_suffix = _get_config_var("EXT_SUFFIX", warn=True) - if not isinstance(ext_suffix, str) or ext_suffix[0] != ".": - raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')") - parts = ext_suffix.split(".") - if len(parts) < 3: - # CPython3.7 and earlier uses ".pyd" on Windows. - return _cpython_abis(sys.version_info[:2]) - soabi = parts[1] - if soabi.startswith("cpython"): - # non-windows - abi = "cp" + soabi.split("-")[1] - elif soabi.startswith("cp"): - # windows - abi = soabi.split("-")[0] - elif soabi.startswith("pypy"): - abi = "-".join(soabi.split("-")[:2]) - elif soabi.startswith("graalpy"): - abi = "-".join(soabi.split("-")[:3]) - elif soabi: - # pyston, ironpython, others? - abi = soabi - else: - return [] - return [_normalize_string(abi)] - - -def generic_tags( - interpreter: str | None = None, - abis: Iterable[str] | None = None, - platforms: Iterable[str] | None = None, - *, - warn: bool = False, -) -> Iterator[Tag]: - """ - Yields the tags for a generic interpreter. - - The tags consist of: - - -- - - The "none" ABI will be added if it was not explicitly provided. - """ - if not interpreter: - interp_name = interpreter_name() - interp_version = interpreter_version(warn=warn) - interpreter = "".join([interp_name, interp_version]) - if abis is None: - abis = _generic_abi() - else: - abis = list(abis) - platforms = list(platforms or platform_tags()) - if "none" not in abis: - abis.append("none") - for abi in abis: - for platform_ in platforms: - yield Tag(interpreter, abi, platform_) - - -def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]: - """ - Yields Python versions in descending order. - - After the latest version, the major-only version will be yielded, and then - all previous versions of that major version. - """ - if len(py_version) > 1: - yield f"py{_version_nodot(py_version[:2])}" - yield f"py{py_version[0]}" - if len(py_version) > 1: - for minor in range(py_version[1] - 1, -1, -1): - yield f"py{_version_nodot((py_version[0], minor))}" - - -def compatible_tags( - python_version: PythonVersion | None = None, - interpreter: str | None = None, - platforms: Iterable[str] | None = None, -) -> Iterator[Tag]: - """ - Yields the sequence of tags that are compatible with a specific version of Python. - - The tags consist of: - - py*-none- - - -none-any # ... if `interpreter` is provided. - - py*-none-any - """ - if not python_version: - python_version = sys.version_info[:2] - platforms = list(platforms or platform_tags()) - for version in _py_interpreter_range(python_version): - for platform_ in platforms: - yield Tag(version, "none", platform_) - if interpreter: - yield Tag(interpreter, "none", "any") - for version in _py_interpreter_range(python_version): - yield Tag(version, "none", "any") - - -def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str: - if not is_32bit: - return arch - - if arch.startswith("ppc"): - return "ppc" - - return "i386" - - -def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> list[str]: - formats = [cpu_arch] - if cpu_arch == "x86_64": - if version < (10, 4): - return [] - formats.extend(["intel", "fat64", "fat32"]) - - elif cpu_arch == "i386": - if version < (10, 4): - return [] - formats.extend(["intel", "fat32", "fat"]) - - elif cpu_arch == "ppc64": - # TODO: Need to care about 32-bit PPC for ppc64 through 10.2? - if version > (10, 5) or version < (10, 4): - return [] - formats.append("fat64") - - elif cpu_arch == "ppc": - if version > (10, 6): - return [] - formats.extend(["fat32", "fat"]) - - if cpu_arch in {"arm64", "x86_64"}: - formats.append("universal2") - - if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}: - formats.append("universal") - - return formats - - -def mac_platforms( - version: MacVersion | None = None, arch: str | None = None -) -> Iterator[str]: - """ - Yields the platform tags for a macOS system. - - The `version` parameter is a two-item tuple specifying the macOS version to - generate platform tags for. The `arch` parameter is the CPU architecture to - generate platform tags for. Both parameters default to the appropriate value - for the current system. - """ - version_str, _, cpu_arch = platform.mac_ver() - if version is None: - version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) - if version == (10, 16): - # When built against an older macOS SDK, Python will report macOS 10.16 - # instead of the real version. - version_str = subprocess.run( - [ - sys.executable, - "-sS", - "-c", - "import platform; print(platform.mac_ver()[0])", - ], - check=True, - env={"SYSTEM_VERSION_COMPAT": "0"}, - stdout=subprocess.PIPE, - text=True, - ).stdout - version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2]))) - else: - version = version - if arch is None: - arch = _mac_arch(cpu_arch) - else: - arch = arch - - if (10, 0) <= version and version < (11, 0): - # Prior to Mac OS 11, each yearly release of Mac OS bumped the - # "minor" version number. The major version was always 10. - for minor_version in range(version[1], -1, -1): - compat_version = 10, minor_version - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: - yield "macosx_{major}_{minor}_{binary_format}".format( - major=10, minor=minor_version, binary_format=binary_format - ) - - if version >= (11, 0): - # Starting with Mac OS 11, each yearly release bumps the major version - # number. The minor versions are now the midyear updates. - for major_version in range(version[0], 10, -1): - compat_version = major_version, 0 - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: - yield "macosx_{major}_{minor}_{binary_format}".format( - major=major_version, minor=0, binary_format=binary_format - ) - - if version >= (11, 0): - # Mac OS 11 on x86_64 is compatible with binaries from previous releases. - # Arm64 support was introduced in 11.0, so no Arm binaries from previous - # releases exist. - # - # However, the "universal2" binary format can have a - # macOS version earlier than 11.0 when the x86_64 part of the binary supports - # that version of macOS. - if arch == "x86_64": - for minor_version in range(16, 3, -1): - compat_version = 10, minor_version - binary_formats = _mac_binary_formats(compat_version, arch) - for binary_format in binary_formats: - yield "macosx_{major}_{minor}_{binary_format}".format( - major=compat_version[0], - minor=compat_version[1], - binary_format=binary_format, - ) - else: - for minor_version in range(16, 3, -1): - compat_version = 10, minor_version - binary_format = "universal2" - yield "macosx_{major}_{minor}_{binary_format}".format( - major=compat_version[0], - minor=compat_version[1], - binary_format=binary_format, - ) - - -def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]: - linux = _normalize_string(sysconfig.get_platform()) - if not linux.startswith("linux_"): - # we should never be here, just yield the sysconfig one and return - yield linux - return - if is_32bit: - if linux == "linux_x86_64": - linux = "linux_i686" - elif linux == "linux_aarch64": - linux = "linux_armv8l" - _, arch = linux.split("_", 1) - archs = {"armv8l": ["armv8l", "armv7l"]}.get(arch, [arch]) - yield from _manylinux.platform_tags(archs) - yield from _musllinux.platform_tags(archs) - for arch in archs: - yield f"linux_{arch}" - - -def _generic_platforms() -> Iterator[str]: - yield _normalize_string(sysconfig.get_platform()) - - -def platform_tags() -> Iterator[str]: - """ - Provides the platform tags for this installation. - """ - if platform.system() == "Darwin": - return mac_platforms() - elif platform.system() == "Linux": - return _linux_platforms() - else: - return _generic_platforms() - - -def interpreter_name() -> str: - """ - Returns the name of the running interpreter. - - Some implementations have a reserved, two-letter abbreviation which will - be returned when appropriate. - """ - name = sys.implementation.name - return INTERPRETER_SHORT_NAMES.get(name) or name - - -def interpreter_version(*, warn: bool = False) -> str: - """ - Returns the version of the running interpreter. - """ - version = _get_config_var("py_version_nodot", warn=warn) - if version: - version = str(version) - else: - version = _version_nodot(sys.version_info[:2]) - return version - - -def _version_nodot(version: PythonVersion) -> str: - return "".join(map(str, version)) - - -def sys_tags(*, warn: bool = False) -> Iterator[Tag]: - """ - Returns the sequence of tag triples for the running interpreter. - - The order of the sequence corresponds to priority order for the - interpreter, from most to least important. - """ - - interp_name = interpreter_name() - if interp_name == "cp": - yield from cpython_tags(warn=warn) - else: - yield from generic_tags() - - if interp_name == "pp": - interp = "pp3" - elif interp_name == "cp": - interp = "cp" + interpreter_version(warn=warn) - else: - interp = None - yield from compatible_tags(interpreter=interp) diff --git a/pkg_resources/_vendor/packaging/utils.py b/pkg_resources/_vendor/packaging/utils.py deleted file mode 100644 index d33da5bb8b..0000000000 --- a/pkg_resources/_vendor/packaging/utils.py +++ /dev/null @@ -1,174 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -from __future__ import annotations - -import re -from typing import NewType, Tuple, Union, cast - -from .tags import Tag, parse_tag -from .version import InvalidVersion, Version - -BuildTag = Union[Tuple[()], Tuple[int, str]] -NormalizedName = NewType("NormalizedName", str) - - -class InvalidName(ValueError): - """ - An invalid distribution name; users should refer to the packaging user guide. - """ - - -class InvalidWheelFilename(ValueError): - """ - An invalid wheel filename was found, users should refer to PEP 427. - """ - - -class InvalidSdistFilename(ValueError): - """ - An invalid sdist filename was found, users should refer to the packaging user guide. - """ - - -# Core metadata spec for `Name` -_validate_regex = re.compile( - r"^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$", re.IGNORECASE -) -_canonicalize_regex = re.compile(r"[-_.]+") -_normalized_regex = re.compile(r"^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$") -# PEP 427: The build number must start with a digit. -_build_tag_regex = re.compile(r"(\d+)(.*)") - - -def canonicalize_name(name: str, *, validate: bool = False) -> NormalizedName: - if validate and not _validate_regex.match(name): - raise InvalidName(f"name is invalid: {name!r}") - # This is taken from PEP 503. - value = _canonicalize_regex.sub("-", name).lower() - return cast(NormalizedName, value) - - -def is_normalized_name(name: str) -> bool: - return _normalized_regex.match(name) is not None - - -def canonicalize_version( - version: Version | str, *, strip_trailing_zero: bool = True -) -> str: - """ - This is very similar to Version.__str__, but has one subtle difference - with the way it handles the release segment. - """ - if isinstance(version, str): - try: - parsed = Version(version) - except InvalidVersion: - # Legacy versions cannot be normalized - return version - else: - parsed = version - - parts = [] - - # Epoch - if parsed.epoch != 0: - parts.append(f"{parsed.epoch}!") - - # Release segment - release_segment = ".".join(str(x) for x in parsed.release) - if strip_trailing_zero: - # NB: This strips trailing '.0's to normalize - release_segment = re.sub(r"(\.0)+$", "", release_segment) - parts.append(release_segment) - - # Pre-release - if parsed.pre is not None: - parts.append("".join(str(x) for x in parsed.pre)) - - # Post-release - if parsed.post is not None: - parts.append(f".post{parsed.post}") - - # Development release - if parsed.dev is not None: - parts.append(f".dev{parsed.dev}") - - # Local version segment - if parsed.local is not None: - parts.append(f"+{parsed.local}") - - return "".join(parts) - - -def parse_wheel_filename( - filename: str, -) -> tuple[NormalizedName, Version, BuildTag, frozenset[Tag]]: - if not filename.endswith(".whl"): - raise InvalidWheelFilename( - f"Invalid wheel filename (extension must be '.whl'): {filename}" - ) - - filename = filename[:-4] - dashes = filename.count("-") - if dashes not in (4, 5): - raise InvalidWheelFilename( - f"Invalid wheel filename (wrong number of parts): {filename}" - ) - - parts = filename.split("-", dashes - 2) - name_part = parts[0] - # See PEP 427 for the rules on escaping the project name. - if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is None: - raise InvalidWheelFilename(f"Invalid project name: {filename}") - name = canonicalize_name(name_part) - - try: - version = Version(parts[1]) - except InvalidVersion as e: - raise InvalidWheelFilename( - f"Invalid wheel filename (invalid version): {filename}" - ) from e - - if dashes == 5: - build_part = parts[2] - build_match = _build_tag_regex.match(build_part) - if build_match is None: - raise InvalidWheelFilename( - f"Invalid build number: {build_part} in '{filename}'" - ) - build = cast(BuildTag, (int(build_match.group(1)), build_match.group(2))) - else: - build = () - tags = parse_tag(parts[-1]) - return (name, version, build, tags) - - -def parse_sdist_filename(filename: str) -> tuple[NormalizedName, Version]: - if filename.endswith(".tar.gz"): - file_stem = filename[: -len(".tar.gz")] - elif filename.endswith(".zip"): - file_stem = filename[: -len(".zip")] - else: - raise InvalidSdistFilename( - f"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):" - f" {filename}" - ) - - # We are requiring a PEP 440 version, which cannot contain dashes, - # so we split on the last dash. - name_part, sep, version_part = file_stem.rpartition("-") - if not sep: - raise InvalidSdistFilename(f"Invalid sdist filename: {filename}") - - name = canonicalize_name(name_part) - - try: - version = Version(version_part) - except InvalidVersion as e: - raise InvalidSdistFilename( - f"Invalid sdist filename (invalid version): {filename}" - ) from e - - return (name, version) diff --git a/pkg_resources/_vendor/packaging/version.py b/pkg_resources/_vendor/packaging/version.py deleted file mode 100644 index 46bc261308..0000000000 --- a/pkg_resources/_vendor/packaging/version.py +++ /dev/null @@ -1,563 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. -""" -.. testsetup:: - - from packaging.version import parse, Version -""" - -from __future__ import annotations - -import itertools -import re -from typing import Any, Callable, NamedTuple, SupportsInt, Tuple, Union - -from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType - -__all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"] - -LocalType = Tuple[Union[int, str], ...] - -CmpPrePostDevType = Union[InfinityType, NegativeInfinityType, Tuple[str, int]] -CmpLocalType = Union[ - NegativeInfinityType, - Tuple[Union[Tuple[int, str], Tuple[NegativeInfinityType, Union[int, str]]], ...], -] -CmpKey = Tuple[ - int, - Tuple[int, ...], - CmpPrePostDevType, - CmpPrePostDevType, - CmpPrePostDevType, - CmpLocalType, -] -VersionComparisonMethod = Callable[[CmpKey, CmpKey], bool] - - -class _Version(NamedTuple): - epoch: int - release: tuple[int, ...] - dev: tuple[str, int] | None - pre: tuple[str, int] | None - post: tuple[str, int] | None - local: LocalType | None - - -def parse(version: str) -> Version: - """Parse the given version string. - - >>> parse('1.0.dev1') - - - :param version: The version string to parse. - :raises InvalidVersion: When the version string is not a valid version. - """ - return Version(version) - - -class InvalidVersion(ValueError): - """Raised when a version string is not a valid version. - - >>> Version("invalid") - Traceback (most recent call last): - ... - packaging.version.InvalidVersion: Invalid version: 'invalid' - """ - - -class _BaseVersion: - _key: tuple[Any, ...] - - def __hash__(self) -> int: - return hash(self._key) - - # Please keep the duplicated `isinstance` check - # in the six comparisons hereunder - # unless you find a way to avoid adding overhead function calls. - def __lt__(self, other: _BaseVersion) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key < other._key - - def __le__(self, other: _BaseVersion) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key <= other._key - - def __eq__(self, other: object) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key == other._key - - def __ge__(self, other: _BaseVersion) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key >= other._key - - def __gt__(self, other: _BaseVersion) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key > other._key - - def __ne__(self, other: object) -> bool: - if not isinstance(other, _BaseVersion): - return NotImplemented - - return self._key != other._key - - -# Deliberately not anchored to the start and end of the string, to make it -# easier for 3rd party code to reuse -_VERSION_PATTERN = r""" - v? - (?: - (?:(?P[0-9]+)!)? # epoch - (?P[0-9]+(?:\.[0-9]+)*) # release segment - (?P
                                          # pre-release
-            [-_\.]?
-            (?Palpha|a|beta|b|preview|pre|c|rc)
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-        (?P                                         # post release
-            (?:-(?P[0-9]+))
-            |
-            (?:
-                [-_\.]?
-                (?Ppost|rev|r)
-                [-_\.]?
-                (?P[0-9]+)?
-            )
-        )?
-        (?P                                          # dev release
-            [-_\.]?
-            (?Pdev)
-            [-_\.]?
-            (?P[0-9]+)?
-        )?
-    )
-    (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))?       # local version
-"""
-
-VERSION_PATTERN = _VERSION_PATTERN
-"""
-A string containing the regular expression used to match a valid version.
-
-The pattern is not anchored at either end, and is intended for embedding in larger
-expressions (for example, matching a version number as part of a file name). The
-regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
-flags set.
-
-:meta hide-value:
-"""
-
-
-class Version(_BaseVersion):
-    """This class abstracts handling of a project's versions.
-
-    A :class:`Version` instance is comparison aware and can be compared and
-    sorted using the standard Python interfaces.
-
-    >>> v1 = Version("1.0a5")
-    >>> v2 = Version("1.0")
-    >>> v1
-    
-    >>> v2
-    
-    >>> v1 < v2
-    True
-    >>> v1 == v2
-    False
-    >>> v1 > v2
-    False
-    >>> v1 >= v2
-    False
-    >>> v1 <= v2
-    True
-    """
-
-    _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
-    _key: CmpKey
-
-    def __init__(self, version: str) -> None:
-        """Initialize a Version object.
-
-        :param version:
-            The string representation of a version which will be parsed and normalized
-            before use.
-        :raises InvalidVersion:
-            If the ``version`` does not conform to PEP 440 in any way then this
-            exception will be raised.
-        """
-
-        # Validate the version and parse it into pieces
-        match = self._regex.search(version)
-        if not match:
-            raise InvalidVersion(f"Invalid version: '{version}'")
-
-        # Store the parsed out pieces of the version
-        self._version = _Version(
-            epoch=int(match.group("epoch")) if match.group("epoch") else 0,
-            release=tuple(int(i) for i in match.group("release").split(".")),
-            pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
-            post=_parse_letter_version(
-                match.group("post_l"), match.group("post_n1") or match.group("post_n2")
-            ),
-            dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
-            local=_parse_local_version(match.group("local")),
-        )
-
-        # Generate a key which will be used for sorting
-        self._key = _cmpkey(
-            self._version.epoch,
-            self._version.release,
-            self._version.pre,
-            self._version.post,
-            self._version.dev,
-            self._version.local,
-        )
-
-    def __repr__(self) -> str:
-        """A representation of the Version that shows all internal state.
-
-        >>> Version('1.0.0')
-        
-        """
-        return f""
-
-    def __str__(self) -> str:
-        """A string representation of the version that can be rounded-tripped.
-
-        >>> str(Version("1.0a5"))
-        '1.0a5'
-        """
-        parts = []
-
-        # Epoch
-        if self.epoch != 0:
-            parts.append(f"{self.epoch}!")
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self.release))
-
-        # Pre-release
-        if self.pre is not None:
-            parts.append("".join(str(x) for x in self.pre))
-
-        # Post-release
-        if self.post is not None:
-            parts.append(f".post{self.post}")
-
-        # Development release
-        if self.dev is not None:
-            parts.append(f".dev{self.dev}")
-
-        # Local version segment
-        if self.local is not None:
-            parts.append(f"+{self.local}")
-
-        return "".join(parts)
-
-    @property
-    def epoch(self) -> int:
-        """The epoch of the version.
-
-        >>> Version("2.0.0").epoch
-        0
-        >>> Version("1!2.0.0").epoch
-        1
-        """
-        return self._version.epoch
-
-    @property
-    def release(self) -> tuple[int, ...]:
-        """The components of the "release" segment of the version.
-
-        >>> Version("1.2.3").release
-        (1, 2, 3)
-        >>> Version("2.0.0").release
-        (2, 0, 0)
-        >>> Version("1!2.0.0.post0").release
-        (2, 0, 0)
-
-        Includes trailing zeroes but not the epoch or any pre-release / development /
-        post-release suffixes.
-        """
-        return self._version.release
-
-    @property
-    def pre(self) -> tuple[str, int] | None:
-        """The pre-release segment of the version.
-
-        >>> print(Version("1.2.3").pre)
-        None
-        >>> Version("1.2.3a1").pre
-        ('a', 1)
-        >>> Version("1.2.3b1").pre
-        ('b', 1)
-        >>> Version("1.2.3rc1").pre
-        ('rc', 1)
-        """
-        return self._version.pre
-
-    @property
-    def post(self) -> int | None:
-        """The post-release number of the version.
-
-        >>> print(Version("1.2.3").post)
-        None
-        >>> Version("1.2.3.post1").post
-        1
-        """
-        return self._version.post[1] if self._version.post else None
-
-    @property
-    def dev(self) -> int | None:
-        """The development number of the version.
-
-        >>> print(Version("1.2.3").dev)
-        None
-        >>> Version("1.2.3.dev1").dev
-        1
-        """
-        return self._version.dev[1] if self._version.dev else None
-
-    @property
-    def local(self) -> str | None:
-        """The local version segment of the version.
-
-        >>> print(Version("1.2.3").local)
-        None
-        >>> Version("1.2.3+abc").local
-        'abc'
-        """
-        if self._version.local:
-            return ".".join(str(x) for x in self._version.local)
-        else:
-            return None
-
-    @property
-    def public(self) -> str:
-        """The public portion of the version.
-
-        >>> Version("1.2.3").public
-        '1.2.3'
-        >>> Version("1.2.3+abc").public
-        '1.2.3'
-        >>> Version("1.2.3+abc.dev1").public
-        '1.2.3'
-        """
-        return str(self).split("+", 1)[0]
-
-    @property
-    def base_version(self) -> str:
-        """The "base version" of the version.
-
-        >>> Version("1.2.3").base_version
-        '1.2.3'
-        >>> Version("1.2.3+abc").base_version
-        '1.2.3'
-        >>> Version("1!1.2.3+abc.dev1").base_version
-        '1!1.2.3'
-
-        The "base version" is the public version of the project without any pre or post
-        release markers.
-        """
-        parts = []
-
-        # Epoch
-        if self.epoch != 0:
-            parts.append(f"{self.epoch}!")
-
-        # Release segment
-        parts.append(".".join(str(x) for x in self.release))
-
-        return "".join(parts)
-
-    @property
-    def is_prerelease(self) -> bool:
-        """Whether this version is a pre-release.
-
-        >>> Version("1.2.3").is_prerelease
-        False
-        >>> Version("1.2.3a1").is_prerelease
-        True
-        >>> Version("1.2.3b1").is_prerelease
-        True
-        >>> Version("1.2.3rc1").is_prerelease
-        True
-        >>> Version("1.2.3dev1").is_prerelease
-        True
-        """
-        return self.dev is not None or self.pre is not None
-
-    @property
-    def is_postrelease(self) -> bool:
-        """Whether this version is a post-release.
-
-        >>> Version("1.2.3").is_postrelease
-        False
-        >>> Version("1.2.3.post1").is_postrelease
-        True
-        """
-        return self.post is not None
-
-    @property
-    def is_devrelease(self) -> bool:
-        """Whether this version is a development release.
-
-        >>> Version("1.2.3").is_devrelease
-        False
-        >>> Version("1.2.3.dev1").is_devrelease
-        True
-        """
-        return self.dev is not None
-
-    @property
-    def major(self) -> int:
-        """The first item of :attr:`release` or ``0`` if unavailable.
-
-        >>> Version("1.2.3").major
-        1
-        """
-        return self.release[0] if len(self.release) >= 1 else 0
-
-    @property
-    def minor(self) -> int:
-        """The second item of :attr:`release` or ``0`` if unavailable.
-
-        >>> Version("1.2.3").minor
-        2
-        >>> Version("1").minor
-        0
-        """
-        return self.release[1] if len(self.release) >= 2 else 0
-
-    @property
-    def micro(self) -> int:
-        """The third item of :attr:`release` or ``0`` if unavailable.
-
-        >>> Version("1.2.3").micro
-        3
-        >>> Version("1").micro
-        0
-        """
-        return self.release[2] if len(self.release) >= 3 else 0
-
-
-def _parse_letter_version(
-    letter: str | None, number: str | bytes | SupportsInt | None
-) -> tuple[str, int] | None:
-    if letter:
-        # We consider there to be an implicit 0 in a pre-release if there is
-        # not a numeral associated with it.
-        if number is None:
-            number = 0
-
-        # We normalize any letters to their lower case form
-        letter = letter.lower()
-
-        # We consider some words to be alternate spellings of other words and
-        # in those cases we want to normalize the spellings to our preferred
-        # spelling.
-        if letter == "alpha":
-            letter = "a"
-        elif letter == "beta":
-            letter = "b"
-        elif letter in ["c", "pre", "preview"]:
-            letter = "rc"
-        elif letter in ["rev", "r"]:
-            letter = "post"
-
-        return letter, int(number)
-    if not letter and number:
-        # We assume if we are given a number, but we are not given a letter
-        # then this is using the implicit post release syntax (e.g. 1.0-1)
-        letter = "post"
-
-        return letter, int(number)
-
-    return None
-
-
-_local_version_separators = re.compile(r"[\._-]")
-
-
-def _parse_local_version(local: str | None) -> LocalType | None:
-    """
-    Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
-    """
-    if local is not None:
-        return tuple(
-            part.lower() if not part.isdigit() else int(part)
-            for part in _local_version_separators.split(local)
-        )
-    return None
-
-
-def _cmpkey(
-    epoch: int,
-    release: tuple[int, ...],
-    pre: tuple[str, int] | None,
-    post: tuple[str, int] | None,
-    dev: tuple[str, int] | None,
-    local: LocalType | None,
-) -> CmpKey:
-    # When we compare a release version, we want to compare it with all of the
-    # trailing zeros removed. So we'll use a reverse the list, drop all the now
-    # leading zeros until we come to something non zero, then take the rest
-    # re-reverse it back into the correct order and make it a tuple and use
-    # that for our sorting key.
-    _release = tuple(
-        reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
-    )
-
-    # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
-    # We'll do this by abusing the pre segment, but we _only_ want to do this
-    # if there is not a pre or a post segment. If we have one of those then
-    # the normal sorting rules will handle this case correctly.
-    if pre is None and post is None and dev is not None:
-        _pre: CmpPrePostDevType = NegativeInfinity
-    # Versions without a pre-release (except as noted above) should sort after
-    # those with one.
-    elif pre is None:
-        _pre = Infinity
-    else:
-        _pre = pre
-
-    # Versions without a post segment should sort before those with one.
-    if post is None:
-        _post: CmpPrePostDevType = NegativeInfinity
-
-    else:
-        _post = post
-
-    # Versions without a development segment should sort after those with one.
-    if dev is None:
-        _dev: CmpPrePostDevType = Infinity
-
-    else:
-        _dev = dev
-
-    if local is None:
-        # Versions without a local segment should sort before those with one.
-        _local: CmpLocalType = NegativeInfinity
-    else:
-        # Versions with a local segment need that segment parsed to implement
-        # the sorting rules in PEP440.
-        # - Alpha numeric segments sort before numeric segments
-        # - Alpha numeric segments sort lexicographically
-        # - Numeric segments sort numerically
-        # - Shorter versions sort before longer versions when the prefixes
-        #   match exactly
-        _local = tuple(
-            (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
-        )
-
-    return epoch, _release, _pre, _post, _dev, _local
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/METADATA b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/METADATA
deleted file mode 100644
index ab51ef36ad..0000000000
--- a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/METADATA
+++ /dev/null
@@ -1,319 +0,0 @@
-Metadata-Version: 2.3
-Name: platformdirs
-Version: 4.2.2
-Summary: A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`.
-Project-URL: Documentation, https://platformdirs.readthedocs.io
-Project-URL: Homepage, https://github.com/platformdirs/platformdirs
-Project-URL: Source, https://github.com/platformdirs/platformdirs
-Project-URL: Tracker, https://github.com/platformdirs/platformdirs/issues
-Maintainer-email: Bernát Gábor , Julian Berman , Ofek Lev , Ronny Pfannschmidt 
-License-Expression: MIT
-License-File: LICENSE
-Keywords: appdirs,application,cache,directory,log,user
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 3 :: Only
-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 :: Implementation :: CPython
-Classifier: Programming Language :: Python :: Implementation :: PyPy
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=3.8
-Provides-Extra: docs
-Requires-Dist: furo>=2023.9.10; extra == 'docs'
-Requires-Dist: proselint>=0.13; extra == 'docs'
-Requires-Dist: sphinx-autodoc-typehints>=1.25.2; extra == 'docs'
-Requires-Dist: sphinx>=7.2.6; extra == 'docs'
-Provides-Extra: test
-Requires-Dist: appdirs==1.4.4; extra == 'test'
-Requires-Dist: covdefaults>=2.3; extra == 'test'
-Requires-Dist: pytest-cov>=4.1; extra == 'test'
-Requires-Dist: pytest-mock>=3.12; extra == 'test'
-Requires-Dist: pytest>=7.4.3; extra == 'test'
-Provides-Extra: type
-Requires-Dist: mypy>=1.8; extra == 'type'
-Description-Content-Type: text/x-rst
-
-The problem
-===========
-
-.. image:: https://github.com/platformdirs/platformdirs/actions/workflows/check.yml/badge.svg
-   :target: https://github.com/platformdirs/platformdirs/actions
-
-When writing desktop application, finding the right location to store user data
-and configuration varies per platform. Even for single-platform apps, there
-may by plenty of nuances in figuring out the right location.
-
-For example, if running on macOS, you should use::
-
-    ~/Library/Application Support/
-
-If on Windows (at least English Win) that should be::
-
-    C:\Documents and Settings\\Application Data\Local Settings\\
-
-or possibly::
-
-    C:\Documents and Settings\\Application Data\\
-
-for `roaming profiles `_ but that is another story.
-
-On Linux (and other Unices), according to the `XDG Basedir Spec`_, it should be::
-
-    ~/.local/share/
-
-.. _XDG Basedir Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
-
-``platformdirs`` to the rescue
-==============================
-
-This kind of thing is what the ``platformdirs`` package is for.
-``platformdirs`` will help you choose an appropriate:
-
-- user data dir (``user_data_dir``)
-- user config dir (``user_config_dir``)
-- user cache dir (``user_cache_dir``)
-- site data dir (``site_data_dir``)
-- site config dir (``site_config_dir``)
-- user log dir (``user_log_dir``)
-- user documents dir (``user_documents_dir``)
-- user downloads dir (``user_downloads_dir``)
-- user pictures dir (``user_pictures_dir``)
-- user videos dir (``user_videos_dir``)
-- user music dir (``user_music_dir``)
-- user desktop dir (``user_desktop_dir``)
-- user runtime dir (``user_runtime_dir``)
-
-And also:
-
-- Is slightly opinionated on the directory names used. Look for "OPINION" in
-  documentation and code for when an opinion is being applied.
-
-Example output
-==============
-
-On macOS:
-
-.. code-block:: pycon
-
-    >>> from platformdirs import *
-    >>> appname = "SuperApp"
-    >>> appauthor = "Acme"
-    >>> user_data_dir(appname, appauthor)
-    '/Users/trentm/Library/Application Support/SuperApp'
-    >>> site_data_dir(appname, appauthor)
-    '/Library/Application Support/SuperApp'
-    >>> user_cache_dir(appname, appauthor)
-    '/Users/trentm/Library/Caches/SuperApp'
-    >>> user_log_dir(appname, appauthor)
-    '/Users/trentm/Library/Logs/SuperApp'
-    >>> user_documents_dir()
-    '/Users/trentm/Documents'
-    >>> user_downloads_dir()
-    '/Users/trentm/Downloads'
-    >>> user_pictures_dir()
-    '/Users/trentm/Pictures'
-    >>> user_videos_dir()
-    '/Users/trentm/Movies'
-    >>> user_music_dir()
-    '/Users/trentm/Music'
-    >>> user_desktop_dir()
-    '/Users/trentm/Desktop'
-    >>> user_runtime_dir(appname, appauthor)
-    '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
-
-On Windows:
-
-.. code-block:: pycon
-
-    >>> from platformdirs import *
-    >>> appname = "SuperApp"
-    >>> appauthor = "Acme"
-    >>> user_data_dir(appname, appauthor)
-    'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp'
-    >>> user_data_dir(appname, appauthor, roaming=True)
-    'C:\\Users\\trentm\\AppData\\Roaming\\Acme\\SuperApp'
-    >>> user_cache_dir(appname, appauthor)
-    'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Cache'
-    >>> user_log_dir(appname, appauthor)
-    'C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs'
-    >>> user_documents_dir()
-    'C:\\Users\\trentm\\Documents'
-    >>> user_downloads_dir()
-    'C:\\Users\\trentm\\Downloads'
-    >>> user_pictures_dir()
-    'C:\\Users\\trentm\\Pictures'
-    >>> user_videos_dir()
-    'C:\\Users\\trentm\\Videos'
-    >>> user_music_dir()
-    'C:\\Users\\trentm\\Music'
-    >>> user_desktop_dir()
-    'C:\\Users\\trentm\\Desktop'
-    >>> user_runtime_dir(appname, appauthor)
-    'C:\\Users\\trentm\\AppData\\Local\\Temp\\Acme\\SuperApp'
-
-On Linux:
-
-.. code-block:: pycon
-
-    >>> from platformdirs import *
-    >>> appname = "SuperApp"
-    >>> appauthor = "Acme"
-    >>> user_data_dir(appname, appauthor)
-    '/home/trentm/.local/share/SuperApp'
-    >>> site_data_dir(appname, appauthor)
-    '/usr/local/share/SuperApp'
-    >>> site_data_dir(appname, appauthor, multipath=True)
-    '/usr/local/share/SuperApp:/usr/share/SuperApp'
-    >>> user_cache_dir(appname, appauthor)
-    '/home/trentm/.cache/SuperApp'
-    >>> user_log_dir(appname, appauthor)
-    '/home/trentm/.local/state/SuperApp/log'
-    >>> user_config_dir(appname)
-    '/home/trentm/.config/SuperApp'
-    >>> user_documents_dir()
-    '/home/trentm/Documents'
-    >>> user_downloads_dir()
-    '/home/trentm/Downloads'
-    >>> user_pictures_dir()
-    '/home/trentm/Pictures'
-    >>> user_videos_dir()
-    '/home/trentm/Videos'
-    >>> user_music_dir()
-    '/home/trentm/Music'
-    >>> user_desktop_dir()
-    '/home/trentm/Desktop'
-    >>> user_runtime_dir(appname, appauthor)
-    '/run/user/{os.getuid()}/SuperApp'
-    >>> site_config_dir(appname)
-    '/etc/xdg/SuperApp'
-    >>> os.environ["XDG_CONFIG_DIRS"] = "/etc:/usr/local/etc"
-    >>> site_config_dir(appname, multipath=True)
-    '/etc/SuperApp:/usr/local/etc/SuperApp'
-
-On Android::
-
-    >>> from platformdirs import *
-    >>> appname = "SuperApp"
-    >>> appauthor = "Acme"
-    >>> user_data_dir(appname, appauthor)
-    '/data/data/com.myApp/files/SuperApp'
-    >>> user_cache_dir(appname, appauthor)
-    '/data/data/com.myApp/cache/SuperApp'
-    >>> user_log_dir(appname, appauthor)
-    '/data/data/com.myApp/cache/SuperApp/log'
-    >>> user_config_dir(appname)
-    '/data/data/com.myApp/shared_prefs/SuperApp'
-    >>> user_documents_dir()
-    '/storage/emulated/0/Documents'
-    >>> user_downloads_dir()
-    '/storage/emulated/0/Downloads'
-    >>> user_pictures_dir()
-    '/storage/emulated/0/Pictures'
-    >>> user_videos_dir()
-    '/storage/emulated/0/DCIM/Camera'
-    >>> user_music_dir()
-    '/storage/emulated/0/Music'
-    >>> user_desktop_dir()
-    '/storage/emulated/0/Desktop'
-    >>> user_runtime_dir(appname, appauthor)
-    '/data/data/com.myApp/cache/SuperApp/tmp'
-
-Note: Some android apps like Termux and Pydroid are used as shells. These
-apps are used by the end user to emulate Linux environment. Presence of
-``SHELL`` environment variable is used by Platformdirs to differentiate
-between general android apps and android apps used as shells. Shell android
-apps also support ``XDG_*`` environment variables.
-
-
-``PlatformDirs`` for convenience
-================================
-
-.. code-block:: pycon
-
-    >>> from platformdirs import PlatformDirs
-    >>> dirs = PlatformDirs("SuperApp", "Acme")
-    >>> dirs.user_data_dir
-    '/Users/trentm/Library/Application Support/SuperApp'
-    >>> dirs.site_data_dir
-    '/Library/Application Support/SuperApp'
-    >>> dirs.user_cache_dir
-    '/Users/trentm/Library/Caches/SuperApp'
-    >>> dirs.user_log_dir
-    '/Users/trentm/Library/Logs/SuperApp'
-    >>> dirs.user_documents_dir
-    '/Users/trentm/Documents'
-    >>> dirs.user_downloads_dir
-    '/Users/trentm/Downloads'
-    >>> dirs.user_pictures_dir
-    '/Users/trentm/Pictures'
-    >>> dirs.user_videos_dir
-    '/Users/trentm/Movies'
-    >>> dirs.user_music_dir
-    '/Users/trentm/Music'
-    >>> dirs.user_desktop_dir
-    '/Users/trentm/Desktop'
-    >>> dirs.user_runtime_dir
-    '/Users/trentm/Library/Caches/TemporaryItems/SuperApp'
-
-Per-version isolation
-=====================
-
-If you have multiple versions of your app in use that you want to be
-able to run side-by-side, then you may want version-isolation for these
-dirs::
-
-    >>> from platformdirs import PlatformDirs
-    >>> dirs = PlatformDirs("SuperApp", "Acme", version="1.0")
-    >>> dirs.user_data_dir
-    '/Users/trentm/Library/Application Support/SuperApp/1.0'
-    >>> dirs.site_data_dir
-    '/Library/Application Support/SuperApp/1.0'
-    >>> dirs.user_cache_dir
-    '/Users/trentm/Library/Caches/SuperApp/1.0'
-    >>> dirs.user_log_dir
-    '/Users/trentm/Library/Logs/SuperApp/1.0'
-    >>> dirs.user_documents_dir
-    '/Users/trentm/Documents'
-    >>> dirs.user_downloads_dir
-    '/Users/trentm/Downloads'
-    >>> dirs.user_pictures_dir
-    '/Users/trentm/Pictures'
-    >>> dirs.user_videos_dir
-    '/Users/trentm/Movies'
-    >>> dirs.user_music_dir
-    '/Users/trentm/Music'
-    >>> dirs.user_desktop_dir
-    '/Users/trentm/Desktop'
-    >>> dirs.user_runtime_dir
-    '/Users/trentm/Library/Caches/TemporaryItems/SuperApp/1.0'
-
-Be wary of using this for configuration files though; you'll need to handle
-migrating configuration files manually.
-
-Why this Fork?
-==============
-
-This repository is a friendly fork of the wonderful work started by
-`ActiveState `_ who created
-``appdirs``, this package's ancestor.
-
-Maintaining an open source project is no easy task, particularly
-from within an organization, and the Python community is indebted
-to ``appdirs`` (and to Trent Mick and Jeff Rouse in particular) for
-creating an incredibly useful simple module, as evidenced by the wide
-number of users it has attracted over the years.
-
-Nonetheless, given the number of long-standing open issues
-and pull requests, and no clear path towards `ensuring
-that maintenance of the package would continue or grow
-`_, this fork was
-created.
-
-Contributions are most welcome.
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD
deleted file mode 100644
index 64c0c8ea2e..0000000000
--- a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/RECORD
+++ /dev/null
@@ -1,23 +0,0 @@
-platformdirs-4.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-platformdirs-4.2.2.dist-info/METADATA,sha256=zmsie01G1MtXR0wgIv5XpVeTO7idr0WWvfmxKsKWuGk,11429
-platformdirs-4.2.2.dist-info/RECORD,,
-platformdirs-4.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-platformdirs-4.2.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
-platformdirs-4.2.2.dist-info/licenses/LICENSE,sha256=KeD9YukphQ6G6yjD_czwzv30-pSHkBHP-z0NS-1tTbY,1089
-platformdirs/__init__.py,sha256=EMGE8qeHRR9CzDFr8kL3tA8hdZZniYjXBVZd0UGTWK0,22225
-platformdirs/__main__.py,sha256=HnsUQHpiBaiTxwcmwVw-nFaPdVNZtQIdi1eWDtI-MzI,1493
-platformdirs/__pycache__/__init__.cpython-312.pyc,,
-platformdirs/__pycache__/__main__.cpython-312.pyc,,
-platformdirs/__pycache__/android.cpython-312.pyc,,
-platformdirs/__pycache__/api.cpython-312.pyc,,
-platformdirs/__pycache__/macos.cpython-312.pyc,,
-platformdirs/__pycache__/unix.cpython-312.pyc,,
-platformdirs/__pycache__/version.cpython-312.pyc,,
-platformdirs/__pycache__/windows.cpython-312.pyc,,
-platformdirs/android.py,sha256=xZXY9Jd46WOsxT2U6-5HsNtDZ-IQqxcEUrBLl3hYk4o,9016
-platformdirs/api.py,sha256=QBYdUac2eC521ek_y53uD1Dcq-lJX8IgSRVd4InC6uc,8996
-platformdirs/macos.py,sha256=wftsbsvq6nZ0WORXSiCrZNkRHz_WKuktl0a6mC7MFkI,5580
-platformdirs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-platformdirs/unix.py,sha256=Cci9Wqt35dAMsg6HT9nRGHSBW5obb0pR3AE1JJnsCXg,10643
-platformdirs/version.py,sha256=r7F76tZRjgQKzrpx_I0_ZMQOMU-PS7eGnHD7zEK3KB0,411
-platformdirs/windows.py,sha256=IFpiohUBwxPtCzlyKwNtxyW4Jk8haa6W8o59mfrDXVo,10125
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/REQUESTED b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/REQUESTED
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/WHEEL b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/WHEEL
deleted file mode 100644
index 516596c767..0000000000
--- a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/WHEEL
+++ /dev/null
@@ -1,4 +0,0 @@
-Wheel-Version: 1.0
-Generator: hatchling 1.24.2
-Root-Is-Purelib: true
-Tag: py3-none-any
diff --git a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE b/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
deleted file mode 100644
index f35fed9191..0000000000
--- a/pkg_resources/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2010-202x The platformdirs developers
-
-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/pkg_resources/_vendor/platformdirs/__init__.py b/pkg_resources/_vendor/platformdirs/__init__.py
deleted file mode 100644
index 3f7d9490d1..0000000000
--- a/pkg_resources/_vendor/platformdirs/__init__.py
+++ /dev/null
@@ -1,627 +0,0 @@
-"""
-Utilities for determining application-specific dirs.
-
-See  for details and usage.
-
-"""
-
-from __future__ import annotations
-
-import os
-import sys
-from typing import TYPE_CHECKING
-
-from .api import PlatformDirsABC
-from .version import __version__
-from .version import __version_tuple__ as __version_info__
-
-if TYPE_CHECKING:
-    from pathlib import Path
-    from typing import Literal
-
-
-def _set_platform_dir_class() -> type[PlatformDirsABC]:
-    if sys.platform == "win32":
-        from platformdirs.windows import Windows as Result  # noqa: PLC0415
-    elif sys.platform == "darwin":
-        from platformdirs.macos import MacOS as Result  # noqa: PLC0415
-    else:
-        from platformdirs.unix import Unix as Result  # noqa: PLC0415
-
-    if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
-        if os.getenv("SHELL") or os.getenv("PREFIX"):
-            return Result
-
-        from platformdirs.android import _android_folder  # noqa: PLC0415
-
-        if _android_folder() is not None:
-            from platformdirs.android import Android  # noqa: PLC0415
-
-            return Android  # return to avoid redefinition of a result
-
-    return Result
-
-
-PlatformDirs = _set_platform_dir_class()  #: Currently active platform
-AppDirs = PlatformDirs  #: Backwards compatibility with appdirs
-
-
-def user_data_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    roaming: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param roaming: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: data directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        roaming=roaming,
-        ensure_exists=ensure_exists,
-    ).user_data_dir
-
-
-def site_data_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    multipath: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param multipath: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: data directory shared by users
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        multipath=multipath,
-        ensure_exists=ensure_exists,
-    ).site_data_dir
-
-
-def user_config_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    roaming: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param roaming: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: config directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        roaming=roaming,
-        ensure_exists=ensure_exists,
-    ).user_config_dir
-
-
-def site_config_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    multipath: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param multipath: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: config directory shared by the users
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        multipath=multipath,
-        ensure_exists=ensure_exists,
-    ).site_config_dir
-
-
-def user_cache_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: cache directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).user_cache_dir
-
-
-def site_cache_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `opinion `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: cache directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).site_cache_dir
-
-
-def user_state_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    roaming: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param roaming: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: state directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        roaming=roaming,
-        ensure_exists=ensure_exists,
-    ).user_state_dir
-
-
-def user_log_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: log directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).user_log_dir
-
-
-def user_documents_dir() -> str:
-    """:returns: documents directory tied to the user"""
-    return PlatformDirs().user_documents_dir
-
-
-def user_downloads_dir() -> str:
-    """:returns: downloads directory tied to the user"""
-    return PlatformDirs().user_downloads_dir
-
-
-def user_pictures_dir() -> str:
-    """:returns: pictures directory tied to the user"""
-    return PlatformDirs().user_pictures_dir
-
-
-def user_videos_dir() -> str:
-    """:returns: videos directory tied to the user"""
-    return PlatformDirs().user_videos_dir
-
-
-def user_music_dir() -> str:
-    """:returns: music directory tied to the user"""
-    return PlatformDirs().user_music_dir
-
-
-def user_desktop_dir() -> str:
-    """:returns: desktop directory tied to the user"""
-    return PlatformDirs().user_desktop_dir
-
-
-def user_runtime_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `opinion `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: runtime directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).user_runtime_dir
-
-
-def site_runtime_dir(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> str:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `opinion `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: runtime directory shared by users
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).site_runtime_dir
-
-
-def user_data_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    roaming: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param roaming: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: data path tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        roaming=roaming,
-        ensure_exists=ensure_exists,
-    ).user_data_path
-
-
-def site_data_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    multipath: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param multipath: See `multipath `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: data path shared by users
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        multipath=multipath,
-        ensure_exists=ensure_exists,
-    ).site_data_path
-
-
-def user_config_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    roaming: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param roaming: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: config path tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        roaming=roaming,
-        ensure_exists=ensure_exists,
-    ).user_config_path
-
-
-def site_config_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    multipath: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param multipath: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: config path shared by the users
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        multipath=multipath,
-        ensure_exists=ensure_exists,
-    ).site_config_path
-
-
-def site_cache_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `opinion `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: cache directory tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).site_cache_path
-
-
-def user_cache_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: cache path tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).user_cache_path
-
-
-def user_state_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    roaming: bool = False,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param roaming: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: state path tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        roaming=roaming,
-        ensure_exists=ensure_exists,
-    ).user_state_path
-
-
-def user_log_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `roaming `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: log path tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).user_log_path
-
-
-def user_documents_path() -> Path:
-    """:returns: documents a path tied to the user"""
-    return PlatformDirs().user_documents_path
-
-
-def user_downloads_path() -> Path:
-    """:returns: downloads path tied to the user"""
-    return PlatformDirs().user_downloads_path
-
-
-def user_pictures_path() -> Path:
-    """:returns: pictures path tied to the user"""
-    return PlatformDirs().user_pictures_path
-
-
-def user_videos_path() -> Path:
-    """:returns: videos path tied to the user"""
-    return PlatformDirs().user_videos_path
-
-
-def user_music_path() -> Path:
-    """:returns: music path tied to the user"""
-    return PlatformDirs().user_music_path
-
-
-def user_desktop_path() -> Path:
-    """:returns: desktop path tied to the user"""
-    return PlatformDirs().user_desktop_path
-
-
-def user_runtime_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `opinion `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: runtime path tied to the user
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).user_runtime_path
-
-
-def site_runtime_path(
-    appname: str | None = None,
-    appauthor: str | None | Literal[False] = None,
-    version: str | None = None,
-    opinion: bool = True,  # noqa: FBT001, FBT002
-    ensure_exists: bool = False,  # noqa: FBT001, FBT002
-) -> Path:
-    """
-    :param appname: See `appname `.
-    :param appauthor: See `appauthor `.
-    :param version: See `version `.
-    :param opinion: See `opinion `.
-    :param ensure_exists: See `ensure_exists `.
-    :returns: runtime path shared by users
-    """
-    return PlatformDirs(
-        appname=appname,
-        appauthor=appauthor,
-        version=version,
-        opinion=opinion,
-        ensure_exists=ensure_exists,
-    ).site_runtime_path
-
-
-__all__ = [
-    "AppDirs",
-    "PlatformDirs",
-    "PlatformDirsABC",
-    "__version__",
-    "__version_info__",
-    "site_cache_dir",
-    "site_cache_path",
-    "site_config_dir",
-    "site_config_path",
-    "site_data_dir",
-    "site_data_path",
-    "site_runtime_dir",
-    "site_runtime_path",
-    "user_cache_dir",
-    "user_cache_path",
-    "user_config_dir",
-    "user_config_path",
-    "user_data_dir",
-    "user_data_path",
-    "user_desktop_dir",
-    "user_desktop_path",
-    "user_documents_dir",
-    "user_documents_path",
-    "user_downloads_dir",
-    "user_downloads_path",
-    "user_log_dir",
-    "user_log_path",
-    "user_music_dir",
-    "user_music_path",
-    "user_pictures_dir",
-    "user_pictures_path",
-    "user_runtime_dir",
-    "user_runtime_path",
-    "user_state_dir",
-    "user_state_path",
-    "user_videos_dir",
-    "user_videos_path",
-]
diff --git a/pkg_resources/_vendor/platformdirs/__main__.py b/pkg_resources/_vendor/platformdirs/__main__.py
deleted file mode 100644
index 922c521358..0000000000
--- a/pkg_resources/_vendor/platformdirs/__main__.py
+++ /dev/null
@@ -1,55 +0,0 @@
-"""Main entry point."""
-
-from __future__ import annotations
-
-from platformdirs import PlatformDirs, __version__
-
-PROPS = (
-    "user_data_dir",
-    "user_config_dir",
-    "user_cache_dir",
-    "user_state_dir",
-    "user_log_dir",
-    "user_documents_dir",
-    "user_downloads_dir",
-    "user_pictures_dir",
-    "user_videos_dir",
-    "user_music_dir",
-    "user_runtime_dir",
-    "site_data_dir",
-    "site_config_dir",
-    "site_cache_dir",
-    "site_runtime_dir",
-)
-
-
-def main() -> None:
-    """Run the main entry point."""
-    app_name = "MyApp"
-    app_author = "MyCompany"
-
-    print(f"-- platformdirs {__version__} --")  # noqa: T201
-
-    print("-- app dirs (with optional 'version')")  # noqa: T201
-    dirs = PlatformDirs(app_name, app_author, version="1.0")
-    for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
-
-    print("\n-- app dirs (without optional 'version')")  # noqa: T201
-    dirs = PlatformDirs(app_name, app_author)
-    for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
-
-    print("\n-- app dirs (without optional 'appauthor')")  # noqa: T201
-    dirs = PlatformDirs(app_name)
-    for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
-
-    print("\n-- app dirs (with disabled 'appauthor')")  # noqa: T201
-    dirs = PlatformDirs(app_name, appauthor=False)
-    for prop in PROPS:
-        print(f"{prop}: {getattr(dirs, prop)}")  # noqa: T201
-
-
-if __name__ == "__main__":
-    main()
diff --git a/pkg_resources/_vendor/platformdirs/android.py b/pkg_resources/_vendor/platformdirs/android.py
deleted file mode 100644
index afd3141c72..0000000000
--- a/pkg_resources/_vendor/platformdirs/android.py
+++ /dev/null
@@ -1,249 +0,0 @@
-"""Android."""
-
-from __future__ import annotations
-
-import os
-import re
-import sys
-from functools import lru_cache
-from typing import TYPE_CHECKING, cast
-
-from .api import PlatformDirsABC
-
-
-class Android(PlatformDirsABC):
-    """
-    Follows the guidance `from here `_.
-
-    Makes use of the `appname `, `version
-    `, `ensure_exists `.
-
-    """
-
-    @property
-    def user_data_dir(self) -> str:
-        """:return: data directory tied to the user, e.g. ``/data/user///files/``"""
-        return self._append_app_name_and_version(cast(str, _android_folder()), "files")
-
-    @property
-    def site_data_dir(self) -> str:
-        """:return: data directory shared by users, same as `user_data_dir`"""
-        return self.user_data_dir
-
-    @property
-    def user_config_dir(self) -> str:
-        """
-        :return: config directory tied to the user, e.g. \
-        ``/data/user///shared_prefs/``
-        """
-        return self._append_app_name_and_version(cast(str, _android_folder()), "shared_prefs")
-
-    @property
-    def site_config_dir(self) -> str:
-        """:return: config directory shared by the users, same as `user_config_dir`"""
-        return self.user_config_dir
-
-    @property
-    def user_cache_dir(self) -> str:
-        """:return: cache directory tied to the user, e.g.,``/data/user///cache/``"""
-        return self._append_app_name_and_version(cast(str, _android_folder()), "cache")
-
-    @property
-    def site_cache_dir(self) -> str:
-        """:return: cache directory shared by users, same as `user_cache_dir`"""
-        return self.user_cache_dir
-
-    @property
-    def user_state_dir(self) -> str:
-        """:return: state directory tied to the user, same as `user_data_dir`"""
-        return self.user_data_dir
-
-    @property
-    def user_log_dir(self) -> str:
-        """
-        :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it,
-          e.g. ``/data/user///cache//log``
-        """
-        path = self.user_cache_dir
-        if self.opinion:
-            path = os.path.join(path, "log")  # noqa: PTH118
-        return path
-
-    @property
-    def user_documents_dir(self) -> str:
-        """:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``"""
-        return _android_documents_folder()
-
-    @property
-    def user_downloads_dir(self) -> str:
-        """:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``"""
-        return _android_downloads_folder()
-
-    @property
-    def user_pictures_dir(self) -> str:
-        """:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``"""
-        return _android_pictures_folder()
-
-    @property
-    def user_videos_dir(self) -> str:
-        """:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``"""
-        return _android_videos_folder()
-
-    @property
-    def user_music_dir(self) -> str:
-        """:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``"""
-        return _android_music_folder()
-
-    @property
-    def user_desktop_dir(self) -> str:
-        """:return: desktop directory tied to the user e.g. ``/storage/emulated/0/Desktop``"""
-        return "/storage/emulated/0/Desktop"
-
-    @property
-    def user_runtime_dir(self) -> str:
-        """
-        :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it,
-          e.g. ``/data/user///cache//tmp``
-        """
-        path = self.user_cache_dir
-        if self.opinion:
-            path = os.path.join(path, "tmp")  # noqa: PTH118
-        return path
-
-    @property
-    def site_runtime_dir(self) -> str:
-        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
-        return self.user_runtime_dir
-
-
-@lru_cache(maxsize=1)
-def _android_folder() -> str | None:  # noqa: C901, PLR0912
-    """:return: base folder for the Android OS or None if it cannot be found"""
-    result: str | None = None
-    # type checker isn't happy with our "import android", just don't do this when type checking see
-    # https://stackoverflow.com/a/61394121
-    if not TYPE_CHECKING:
-        try:
-            # First try to get a path to android app using python4android (if available)...
-            from android import mActivity  # noqa: PLC0415
-
-            context = cast("android.content.Context", mActivity.getApplicationContext())  # noqa: F821
-            result = context.getFilesDir().getParentFile().getAbsolutePath()
-        except Exception:  # noqa: BLE001
-            result = None
-    if result is None:
-        try:
-            # ...and fall back to using plain pyjnius, if python4android isn't available or doesn't deliver any useful
-            # result...
-            from jnius import autoclass  # noqa: PLC0415
-
-            context = autoclass("android.content.Context")
-            result = context.getFilesDir().getParentFile().getAbsolutePath()
-        except Exception:  # noqa: BLE001
-            result = None
-    if result is None:
-        # and if that fails, too, find an android folder looking at path on the sys.path
-        # warning: only works for apps installed under /data, not adopted storage etc.
-        pattern = re.compile(r"/data/(data|user/\d+)/(.+)/files")
-        for path in sys.path:
-            if pattern.match(path):
-                result = path.split("/files")[0]
-                break
-        else:
-            result = None
-    if result is None:
-        # one last try: find an android folder looking at path on the sys.path taking adopted storage paths into
-        # account
-        pattern = re.compile(r"/mnt/expand/[a-fA-F0-9-]{36}/(data|user/\d+)/(.+)/files")
-        for path in sys.path:
-            if pattern.match(path):
-                result = path.split("/files")[0]
-                break
-        else:
-            result = None
-    return result
-
-
-@lru_cache(maxsize=1)
-def _android_documents_folder() -> str:
-    """:return: documents folder for the Android OS"""
-    # Get directories with pyjnius
-    try:
-        from jnius import autoclass  # noqa: PLC0415
-
-        context = autoclass("android.content.Context")
-        environment = autoclass("android.os.Environment")
-        documents_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOCUMENTS).getAbsolutePath()
-    except Exception:  # noqa: BLE001
-        documents_dir = "/storage/emulated/0/Documents"
-
-    return documents_dir
-
-
-@lru_cache(maxsize=1)
-def _android_downloads_folder() -> str:
-    """:return: downloads folder for the Android OS"""
-    # Get directories with pyjnius
-    try:
-        from jnius import autoclass  # noqa: PLC0415
-
-        context = autoclass("android.content.Context")
-        environment = autoclass("android.os.Environment")
-        downloads_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DOWNLOADS).getAbsolutePath()
-    except Exception:  # noqa: BLE001
-        downloads_dir = "/storage/emulated/0/Downloads"
-
-    return downloads_dir
-
-
-@lru_cache(maxsize=1)
-def _android_pictures_folder() -> str:
-    """:return: pictures folder for the Android OS"""
-    # Get directories with pyjnius
-    try:
-        from jnius import autoclass  # noqa: PLC0415
-
-        context = autoclass("android.content.Context")
-        environment = autoclass("android.os.Environment")
-        pictures_dir: str = context.getExternalFilesDir(environment.DIRECTORY_PICTURES).getAbsolutePath()
-    except Exception:  # noqa: BLE001
-        pictures_dir = "/storage/emulated/0/Pictures"
-
-    return pictures_dir
-
-
-@lru_cache(maxsize=1)
-def _android_videos_folder() -> str:
-    """:return: videos folder for the Android OS"""
-    # Get directories with pyjnius
-    try:
-        from jnius import autoclass  # noqa: PLC0415
-
-        context = autoclass("android.content.Context")
-        environment = autoclass("android.os.Environment")
-        videos_dir: str = context.getExternalFilesDir(environment.DIRECTORY_DCIM).getAbsolutePath()
-    except Exception:  # noqa: BLE001
-        videos_dir = "/storage/emulated/0/DCIM/Camera"
-
-    return videos_dir
-
-
-@lru_cache(maxsize=1)
-def _android_music_folder() -> str:
-    """:return: music folder for the Android OS"""
-    # Get directories with pyjnius
-    try:
-        from jnius import autoclass  # noqa: PLC0415
-
-        context = autoclass("android.content.Context")
-        environment = autoclass("android.os.Environment")
-        music_dir: str = context.getExternalFilesDir(environment.DIRECTORY_MUSIC).getAbsolutePath()
-    except Exception:  # noqa: BLE001
-        music_dir = "/storage/emulated/0/Music"
-
-    return music_dir
-
-
-__all__ = [
-    "Android",
-]
diff --git a/pkg_resources/_vendor/platformdirs/api.py b/pkg_resources/_vendor/platformdirs/api.py
deleted file mode 100644
index c50caa648a..0000000000
--- a/pkg_resources/_vendor/platformdirs/api.py
+++ /dev/null
@@ -1,292 +0,0 @@
-"""Base API."""
-
-from __future__ import annotations
-
-import os
-from abc import ABC, abstractmethod
-from pathlib import Path
-from typing import TYPE_CHECKING
-
-if TYPE_CHECKING:
-    from typing import Iterator, Literal
-
-
-class PlatformDirsABC(ABC):  # noqa: PLR0904
-    """Abstract base class for platform directories."""
-
-    def __init__(  # noqa: PLR0913, PLR0917
-        self,
-        appname: str | None = None,
-        appauthor: str | None | Literal[False] = None,
-        version: str | None = None,
-        roaming: bool = False,  # noqa: FBT001, FBT002
-        multipath: bool = False,  # noqa: FBT001, FBT002
-        opinion: bool = True,  # noqa: FBT001, FBT002
-        ensure_exists: bool = False,  # noqa: FBT001, FBT002
-    ) -> None:
-        """
-        Create a new platform directory.
-
-        :param appname: See `appname`.
-        :param appauthor: See `appauthor`.
-        :param version: See `version`.
-        :param roaming: See `roaming`.
-        :param multipath: See `multipath`.
-        :param opinion: See `opinion`.
-        :param ensure_exists: See `ensure_exists`.
-
-        """
-        self.appname = appname  #: The name of application.
-        self.appauthor = appauthor
-        """
-        The name of the app author or distributing body for this application.
-
-        Typically, it is the owning company name. Defaults to `appname`. You may pass ``False`` to disable it.
-
-        """
-        self.version = version
-        """
-        An optional version path element to append to the path.
-
-        You might want to use this if you want multiple versions of your app to be able to run independently. If used,
-        this would typically be ``.``.
-
-        """
-        self.roaming = roaming
-        """
-        Whether to use the roaming appdata directory on Windows.
-
-        That means that for users on a Windows network setup for roaming profiles, this user data will be synced on
-        login (see
-        `here `_).
-
-        """
-        self.multipath = multipath
-        """
-        An optional parameter which indicates that the entire list of data dirs should be returned.
-
-        By default, the first item would only be returned.
-
-        """
-        self.opinion = opinion  #: A flag to indicating to use opinionated values.
-        self.ensure_exists = ensure_exists
-        """
-        Optionally create the directory (and any missing parents) upon access if it does not exist.
-
-        By default, no directories are created.
-
-        """
-
-    def _append_app_name_and_version(self, *base: str) -> str:
-        params = list(base[1:])
-        if self.appname:
-            params.append(self.appname)
-            if self.version:
-                params.append(self.version)
-        path = os.path.join(base[0], *params)  # noqa: PTH118
-        self._optionally_create_directory(path)
-        return path
-
-    def _optionally_create_directory(self, path: str) -> None:
-        if self.ensure_exists:
-            Path(path).mkdir(parents=True, exist_ok=True)
-
-    @property
-    @abstractmethod
-    def user_data_dir(self) -> str:
-        """:return: data directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def site_data_dir(self) -> str:
-        """:return: data directory shared by users"""
-
-    @property
-    @abstractmethod
-    def user_config_dir(self) -> str:
-        """:return: config directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def site_config_dir(self) -> str:
-        """:return: config directory shared by the users"""
-
-    @property
-    @abstractmethod
-    def user_cache_dir(self) -> str:
-        """:return: cache directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def site_cache_dir(self) -> str:
-        """:return: cache directory shared by users"""
-
-    @property
-    @abstractmethod
-    def user_state_dir(self) -> str:
-        """:return: state directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_log_dir(self) -> str:
-        """:return: log directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_documents_dir(self) -> str:
-        """:return: documents directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_downloads_dir(self) -> str:
-        """:return: downloads directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_pictures_dir(self) -> str:
-        """:return: pictures directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_videos_dir(self) -> str:
-        """:return: videos directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_music_dir(self) -> str:
-        """:return: music directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_desktop_dir(self) -> str:
-        """:return: desktop directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def user_runtime_dir(self) -> str:
-        """:return: runtime directory tied to the user"""
-
-    @property
-    @abstractmethod
-    def site_runtime_dir(self) -> str:
-        """:return: runtime directory shared by users"""
-
-    @property
-    def user_data_path(self) -> Path:
-        """:return: data path tied to the user"""
-        return Path(self.user_data_dir)
-
-    @property
-    def site_data_path(self) -> Path:
-        """:return: data path shared by users"""
-        return Path(self.site_data_dir)
-
-    @property
-    def user_config_path(self) -> Path:
-        """:return: config path tied to the user"""
-        return Path(self.user_config_dir)
-
-    @property
-    def site_config_path(self) -> Path:
-        """:return: config path shared by the users"""
-        return Path(self.site_config_dir)
-
-    @property
-    def user_cache_path(self) -> Path:
-        """:return: cache path tied to the user"""
-        return Path(self.user_cache_dir)
-
-    @property
-    def site_cache_path(self) -> Path:
-        """:return: cache path shared by users"""
-        return Path(self.site_cache_dir)
-
-    @property
-    def user_state_path(self) -> Path:
-        """:return: state path tied to the user"""
-        return Path(self.user_state_dir)
-
-    @property
-    def user_log_path(self) -> Path:
-        """:return: log path tied to the user"""
-        return Path(self.user_log_dir)
-
-    @property
-    def user_documents_path(self) -> Path:
-        """:return: documents a path tied to the user"""
-        return Path(self.user_documents_dir)
-
-    @property
-    def user_downloads_path(self) -> Path:
-        """:return: downloads path tied to the user"""
-        return Path(self.user_downloads_dir)
-
-    @property
-    def user_pictures_path(self) -> Path:
-        """:return: pictures path tied to the user"""
-        return Path(self.user_pictures_dir)
-
-    @property
-    def user_videos_path(self) -> Path:
-        """:return: videos path tied to the user"""
-        return Path(self.user_videos_dir)
-
-    @property
-    def user_music_path(self) -> Path:
-        """:return: music path tied to the user"""
-        return Path(self.user_music_dir)
-
-    @property
-    def user_desktop_path(self) -> Path:
-        """:return: desktop path tied to the user"""
-        return Path(self.user_desktop_dir)
-
-    @property
-    def user_runtime_path(self) -> Path:
-        """:return: runtime path tied to the user"""
-        return Path(self.user_runtime_dir)
-
-    @property
-    def site_runtime_path(self) -> Path:
-        """:return: runtime path shared by users"""
-        return Path(self.site_runtime_dir)
-
-    def iter_config_dirs(self) -> Iterator[str]:
-        """:yield: all user and site configuration directories."""
-        yield self.user_config_dir
-        yield self.site_config_dir
-
-    def iter_data_dirs(self) -> Iterator[str]:
-        """:yield: all user and site data directories."""
-        yield self.user_data_dir
-        yield self.site_data_dir
-
-    def iter_cache_dirs(self) -> Iterator[str]:
-        """:yield: all user and site cache directories."""
-        yield self.user_cache_dir
-        yield self.site_cache_dir
-
-    def iter_runtime_dirs(self) -> Iterator[str]:
-        """:yield: all user and site runtime directories."""
-        yield self.user_runtime_dir
-        yield self.site_runtime_dir
-
-    def iter_config_paths(self) -> Iterator[Path]:
-        """:yield: all user and site configuration paths."""
-        for path in self.iter_config_dirs():
-            yield Path(path)
-
-    def iter_data_paths(self) -> Iterator[Path]:
-        """:yield: all user and site data paths."""
-        for path in self.iter_data_dirs():
-            yield Path(path)
-
-    def iter_cache_paths(self) -> Iterator[Path]:
-        """:yield: all user and site cache paths."""
-        for path in self.iter_cache_dirs():
-            yield Path(path)
-
-    def iter_runtime_paths(self) -> Iterator[Path]:
-        """:yield: all user and site runtime paths."""
-        for path in self.iter_runtime_dirs():
-            yield Path(path)
diff --git a/pkg_resources/_vendor/platformdirs/macos.py b/pkg_resources/_vendor/platformdirs/macos.py
deleted file mode 100644
index eb1ba5df1d..0000000000
--- a/pkg_resources/_vendor/platformdirs/macos.py
+++ /dev/null
@@ -1,130 +0,0 @@
-"""macOS."""
-
-from __future__ import annotations
-
-import os.path
-import sys
-
-from .api import PlatformDirsABC
-
-
-class MacOS(PlatformDirsABC):
-    """
-    Platform directories for the macOS operating system.
-
-    Follows the guidance from
-    `Apple documentation `_.
-    Makes use of the `appname `,
-    `version `,
-    `ensure_exists `.
-
-    """
-
-    @property
-    def user_data_dir(self) -> str:
-        """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support"))  # noqa: PTH111
-
-    @property
-    def site_data_dir(self) -> str:
-        """
-        :return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``.
-          If we're using a Python binary managed by `Homebrew `_, the directory
-          will be under the Homebrew prefix, e.g. ``/opt/homebrew/share/$appname/$version``.
-          If `multipath ` is enabled, and we're in Homebrew,
-          the response is a multi-path string separated by ":", e.g.
-          ``/opt/homebrew/share/$appname/$version:/Library/Application Support/$appname/$version``
-        """
-        is_homebrew = sys.prefix.startswith("/opt/homebrew")
-        path_list = [self._append_app_name_and_version("/opt/homebrew/share")] if is_homebrew else []
-        path_list.append(self._append_app_name_and_version("/Library/Application Support"))
-        if self.multipath:
-            return os.pathsep.join(path_list)
-        return path_list[0]
-
-    @property
-    def user_config_dir(self) -> str:
-        """:return: config directory tied to the user, same as `user_data_dir`"""
-        return self.user_data_dir
-
-    @property
-    def site_config_dir(self) -> str:
-        """:return: config directory shared by the users, same as `site_data_dir`"""
-        return self.site_data_dir
-
-    @property
-    def user_cache_dir(self) -> str:
-        """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))  # noqa: PTH111
-
-    @property
-    def site_cache_dir(self) -> str:
-        """
-        :return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``.
-          If we're using a Python binary managed by `Homebrew `_, the directory
-          will be under the Homebrew prefix, e.g. ``/opt/homebrew/var/cache/$appname/$version``.
-          If `multipath ` is enabled, and we're in Homebrew,
-          the response is a multi-path string separated by ":", e.g.
-          ``/opt/homebrew/var/cache/$appname/$version:/Library/Caches/$appname/$version``
-        """
-        is_homebrew = sys.prefix.startswith("/opt/homebrew")
-        path_list = [self._append_app_name_and_version("/opt/homebrew/var/cache")] if is_homebrew else []
-        path_list.append(self._append_app_name_and_version("/Library/Caches"))
-        if self.multipath:
-            return os.pathsep.join(path_list)
-        return path_list[0]
-
-    @property
-    def user_state_dir(self) -> str:
-        """:return: state directory tied to the user, same as `user_data_dir`"""
-        return self.user_data_dir
-
-    @property
-    def user_log_dir(self) -> str:
-        """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))  # noqa: PTH111
-
-    @property
-    def user_documents_dir(self) -> str:
-        """:return: documents directory tied to the user, e.g. ``~/Documents``"""
-        return os.path.expanduser("~/Documents")  # noqa: PTH111
-
-    @property
-    def user_downloads_dir(self) -> str:
-        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
-        return os.path.expanduser("~/Downloads")  # noqa: PTH111
-
-    @property
-    def user_pictures_dir(self) -> str:
-        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
-        return os.path.expanduser("~/Pictures")  # noqa: PTH111
-
-    @property
-    def user_videos_dir(self) -> str:
-        """:return: videos directory tied to the user, e.g. ``~/Movies``"""
-        return os.path.expanduser("~/Movies")  # noqa: PTH111
-
-    @property
-    def user_music_dir(self) -> str:
-        """:return: music directory tied to the user, e.g. ``~/Music``"""
-        return os.path.expanduser("~/Music")  # noqa: PTH111
-
-    @property
-    def user_desktop_dir(self) -> str:
-        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
-        return os.path.expanduser("~/Desktop")  # noqa: PTH111
-
-    @property
-    def user_runtime_dir(self) -> str:
-        """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
-        return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))  # noqa: PTH111
-
-    @property
-    def site_runtime_dir(self) -> str:
-        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
-        return self.user_runtime_dir
-
-
-__all__ = [
-    "MacOS",
-]
diff --git a/pkg_resources/_vendor/platformdirs/py.typed b/pkg_resources/_vendor/platformdirs/py.typed
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/platformdirs/unix.py b/pkg_resources/_vendor/platformdirs/unix.py
deleted file mode 100644
index 9500ade614..0000000000
--- a/pkg_resources/_vendor/platformdirs/unix.py
+++ /dev/null
@@ -1,275 +0,0 @@
-"""Unix."""
-
-from __future__ import annotations
-
-import os
-import sys
-from configparser import ConfigParser
-from pathlib import Path
-from typing import Iterator, NoReturn
-
-from .api import PlatformDirsABC
-
-if sys.platform == "win32":
-
-    def getuid() -> NoReturn:
-        msg = "should only be used on Unix"
-        raise RuntimeError(msg)
-
-else:
-    from os import getuid
-
-
-class Unix(PlatformDirsABC):  # noqa: PLR0904
-    """
-    On Unix/Linux, we follow the `XDG Basedir Spec `_.
-
-    The spec allows overriding directories with environment variables. The examples shown are the default values,
-    alongside the name of the environment variable that overrides them. Makes use of the `appname
-    `, `version `, `multipath
-    `, `opinion `, `ensure_exists
-    `.
-
-    """
-
-    @property
-    def user_data_dir(self) -> str:
-        """
-        :return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or
-         ``$XDG_DATA_HOME/$appname/$version``
-        """
-        path = os.environ.get("XDG_DATA_HOME", "")
-        if not path.strip():
-            path = os.path.expanduser("~/.local/share")  # noqa: PTH111
-        return self._append_app_name_and_version(path)
-
-    @property
-    def _site_data_dirs(self) -> list[str]:
-        path = os.environ.get("XDG_DATA_DIRS", "")
-        if not path.strip():
-            path = f"/usr/local/share{os.pathsep}/usr/share"
-        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]
-
-    @property
-    def site_data_dir(self) -> str:
-        """
-        :return: data directories shared by users (if `multipath ` is
-         enabled and ``XDG_DATA_DIRS`` is set and a multi path the response is also a multi path separated by the
-         OS path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
-        """
-        # XDG default for $XDG_DATA_DIRS; only first, if multipath is False
-        dirs = self._site_data_dirs
-        if not self.multipath:
-            return dirs[0]
-        return os.pathsep.join(dirs)
-
-    @property
-    def user_config_dir(self) -> str:
-        """
-        :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
-         ``$XDG_CONFIG_HOME/$appname/$version``
-        """
-        path = os.environ.get("XDG_CONFIG_HOME", "")
-        if not path.strip():
-            path = os.path.expanduser("~/.config")  # noqa: PTH111
-        return self._append_app_name_and_version(path)
-
-    @property
-    def _site_config_dirs(self) -> list[str]:
-        path = os.environ.get("XDG_CONFIG_DIRS", "")
-        if not path.strip():
-            path = "/etc/xdg"
-        return [self._append_app_name_and_version(p) for p in path.split(os.pathsep)]
-
-    @property
-    def site_config_dir(self) -> str:
-        """
-        :return: config directories shared by users (if `multipath `
-         is enabled and ``XDG_CONFIG_DIRS`` is set and a multi path the response is also a multi path separated by
-         the OS path separator), e.g. ``/etc/xdg/$appname/$version``
-        """
-        # XDG default for $XDG_CONFIG_DIRS only first, if multipath is False
-        dirs = self._site_config_dirs
-        if not self.multipath:
-            return dirs[0]
-        return os.pathsep.join(dirs)
-
-    @property
-    def user_cache_dir(self) -> str:
-        """
-        :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
-         ``~/$XDG_CACHE_HOME/$appname/$version``
-        """
-        path = os.environ.get("XDG_CACHE_HOME", "")
-        if not path.strip():
-            path = os.path.expanduser("~/.cache")  # noqa: PTH111
-        return self._append_app_name_and_version(path)
-
-    @property
-    def site_cache_dir(self) -> str:
-        """:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``"""
-        return self._append_app_name_and_version("/var/cache")
-
-    @property
-    def user_state_dir(self) -> str:
-        """
-        :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
-         ``$XDG_STATE_HOME/$appname/$version``
-        """
-        path = os.environ.get("XDG_STATE_HOME", "")
-        if not path.strip():
-            path = os.path.expanduser("~/.local/state")  # noqa: PTH111
-        return self._append_app_name_and_version(path)
-
-    @property
-    def user_log_dir(self) -> str:
-        """:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it"""
-        path = self.user_state_dir
-        if self.opinion:
-            path = os.path.join(path, "log")  # noqa: PTH118
-            self._optionally_create_directory(path)
-        return path
-
-    @property
-    def user_documents_dir(self) -> str:
-        """:return: documents directory tied to the user, e.g. ``~/Documents``"""
-        return _get_user_media_dir("XDG_DOCUMENTS_DIR", "~/Documents")
-
-    @property
-    def user_downloads_dir(self) -> str:
-        """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
-        return _get_user_media_dir("XDG_DOWNLOAD_DIR", "~/Downloads")
-
-    @property
-    def user_pictures_dir(self) -> str:
-        """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
-        return _get_user_media_dir("XDG_PICTURES_DIR", "~/Pictures")
-
-    @property
-    def user_videos_dir(self) -> str:
-        """:return: videos directory tied to the user, e.g. ``~/Videos``"""
-        return _get_user_media_dir("XDG_VIDEOS_DIR", "~/Videos")
-
-    @property
-    def user_music_dir(self) -> str:
-        """:return: music directory tied to the user, e.g. ``~/Music``"""
-        return _get_user_media_dir("XDG_MUSIC_DIR", "~/Music")
-
-    @property
-    def user_desktop_dir(self) -> str:
-        """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
-        return _get_user_media_dir("XDG_DESKTOP_DIR", "~/Desktop")
-
-    @property
-    def user_runtime_dir(self) -> str:
-        """
-        :return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or
-         ``$XDG_RUNTIME_DIR/$appname/$version``.
-
-         For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/user/$(id -u)/$appname/$version`` if
-         exists, otherwise ``/tmp/runtime-$(id -u)/$appname/$version``, if``$XDG_RUNTIME_DIR``
-         is not set.
-        """
-        path = os.environ.get("XDG_RUNTIME_DIR", "")
-        if not path.strip():
-            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
-                path = f"/var/run/user/{getuid()}"
-                if not Path(path).exists():
-                    path = f"/tmp/runtime-{getuid()}"  # noqa: S108
-            else:
-                path = f"/run/user/{getuid()}"
-        return self._append_app_name_and_version(path)
-
-    @property
-    def site_runtime_dir(self) -> str:
-        """
-        :return: runtime directory shared by users, e.g. ``/run/$appname/$version`` or \
-        ``$XDG_RUNTIME_DIR/$appname/$version``.
-
-        Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will
-        fall back to paths associated to the root user instead of a regular logged-in user if it's not set.
-
-        If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir`
-        instead.
-
-        For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set.
-        """
-        path = os.environ.get("XDG_RUNTIME_DIR", "")
-        if not path.strip():
-            if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
-                path = "/var/run"
-            else:
-                path = "/run"
-        return self._append_app_name_and_version(path)
-
-    @property
-    def site_data_path(self) -> Path:
-        """:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
-        return self._first_item_as_path_if_multipath(self.site_data_dir)
-
-    @property
-    def site_config_path(self) -> Path:
-        """:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``"""
-        return self._first_item_as_path_if_multipath(self.site_config_dir)
-
-    @property
-    def site_cache_path(self) -> Path:
-        """:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``"""
-        return self._first_item_as_path_if_multipath(self.site_cache_dir)
-
-    def _first_item_as_path_if_multipath(self, directory: str) -> Path:
-        if self.multipath:
-            # If multipath is True, the first path is returned.
-            directory = directory.split(os.pathsep)[0]
-        return Path(directory)
-
-    def iter_config_dirs(self) -> Iterator[str]:
-        """:yield: all user and site configuration directories."""
-        yield self.user_config_dir
-        yield from self._site_config_dirs
-
-    def iter_data_dirs(self) -> Iterator[str]:
-        """:yield: all user and site data directories."""
-        yield self.user_data_dir
-        yield from self._site_data_dirs
-
-
-def _get_user_media_dir(env_var: str, fallback_tilde_path: str) -> str:
-    media_dir = _get_user_dirs_folder(env_var)
-    if media_dir is None:
-        media_dir = os.environ.get(env_var, "").strip()
-        if not media_dir:
-            media_dir = os.path.expanduser(fallback_tilde_path)  # noqa: PTH111
-
-    return media_dir
-
-
-def _get_user_dirs_folder(key: str) -> str | None:
-    """
-    Return directory from user-dirs.dirs config file.
-
-    See https://freedesktop.org/wiki/Software/xdg-user-dirs/.
-
-    """
-    user_dirs_config_path = Path(Unix().user_config_dir) / "user-dirs.dirs"
-    if user_dirs_config_path.exists():
-        parser = ConfigParser()
-
-        with user_dirs_config_path.open() as stream:
-            # Add fake section header, so ConfigParser doesn't complain
-            parser.read_string(f"[top]\n{stream.read()}")
-
-        if key not in parser["top"]:
-            return None
-
-        path = parser["top"][key].strip('"')
-        # Handle relative home paths
-        return path.replace("$HOME", os.path.expanduser("~"))  # noqa: PTH111
-
-    return None
-
-
-__all__ = [
-    "Unix",
-]
diff --git a/pkg_resources/_vendor/platformdirs/version.py b/pkg_resources/_vendor/platformdirs/version.py
deleted file mode 100644
index 6483ddce0b..0000000000
--- a/pkg_resources/_vendor/platformdirs/version.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# file generated by setuptools_scm
-# don't change, don't track in version control
-TYPE_CHECKING = False
-if TYPE_CHECKING:
-    from typing import Tuple, Union
-    VERSION_TUPLE = Tuple[Union[int, str], ...]
-else:
-    VERSION_TUPLE = object
-
-version: str
-__version__: str
-__version_tuple__: VERSION_TUPLE
-version_tuple: VERSION_TUPLE
-
-__version__ = version = '4.2.2'
-__version_tuple__ = version_tuple = (4, 2, 2)
diff --git a/pkg_resources/_vendor/platformdirs/windows.py b/pkg_resources/_vendor/platformdirs/windows.py
deleted file mode 100644
index d7bc96091a..0000000000
--- a/pkg_resources/_vendor/platformdirs/windows.py
+++ /dev/null
@@ -1,272 +0,0 @@
-"""Windows."""
-
-from __future__ import annotations
-
-import os
-import sys
-from functools import lru_cache
-from typing import TYPE_CHECKING
-
-from .api import PlatformDirsABC
-
-if TYPE_CHECKING:
-    from collections.abc import Callable
-
-
-class Windows(PlatformDirsABC):
-    """
-    `MSDN on where to store app data files `_.
-
-    Makes use of the `appname `, `appauthor
-    `, `version `, `roaming
-    `, `opinion `, `ensure_exists
-    `.
-
-    """
-
-    @property
-    def user_data_dir(self) -> str:
-        """
-        :return: data directory tied to the user, e.g.
-         ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname`` (not roaming) or
-         ``%USERPROFILE%\\AppData\\Roaming\\$appauthor\\$appname`` (roaming)
-        """
-        const = "CSIDL_APPDATA" if self.roaming else "CSIDL_LOCAL_APPDATA"
-        path = os.path.normpath(get_win_folder(const))
-        return self._append_parts(path)
-
-    def _append_parts(self, path: str, *, opinion_value: str | None = None) -> str:
-        params = []
-        if self.appname:
-            if self.appauthor is not False:
-                author = self.appauthor or self.appname
-                params.append(author)
-            params.append(self.appname)
-            if opinion_value is not None and self.opinion:
-                params.append(opinion_value)
-            if self.version:
-                params.append(self.version)
-        path = os.path.join(path, *params)  # noqa: PTH118
-        self._optionally_create_directory(path)
-        return path
-
-    @property
-    def site_data_dir(self) -> str:
-        """:return: data directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname``"""
-        path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
-        return self._append_parts(path)
-
-    @property
-    def user_config_dir(self) -> str:
-        """:return: config directory tied to the user, same as `user_data_dir`"""
-        return self.user_data_dir
-
-    @property
-    def site_config_dir(self) -> str:
-        """:return: config directory shared by the users, same as `site_data_dir`"""
-        return self.site_data_dir
-
-    @property
-    def user_cache_dir(self) -> str:
-        """
-        :return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g.
-         ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname\\Cache\\$version``
-        """
-        path = os.path.normpath(get_win_folder("CSIDL_LOCAL_APPDATA"))
-        return self._append_parts(path, opinion_value="Cache")
-
-    @property
-    def site_cache_dir(self) -> str:
-        """:return: cache directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname\\Cache\\$version``"""
-        path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
-        return self._append_parts(path, opinion_value="Cache")
-
-    @property
-    def user_state_dir(self) -> str:
-        """:return: state directory tied to the user, same as `user_data_dir`"""
-        return self.user_data_dir
-
-    @property
-    def user_log_dir(self) -> str:
-        """:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it"""
-        path = self.user_data_dir
-        if self.opinion:
-            path = os.path.join(path, "Logs")  # noqa: PTH118
-            self._optionally_create_directory(path)
-        return path
-
-    @property
-    def user_documents_dir(self) -> str:
-        """:return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``"""
-        return os.path.normpath(get_win_folder("CSIDL_PERSONAL"))
-
-    @property
-    def user_downloads_dir(self) -> str:
-        """:return: downloads directory tied to the user e.g. ``%USERPROFILE%\\Downloads``"""
-        return os.path.normpath(get_win_folder("CSIDL_DOWNLOADS"))
-
-    @property
-    def user_pictures_dir(self) -> str:
-        """:return: pictures directory tied to the user e.g. ``%USERPROFILE%\\Pictures``"""
-        return os.path.normpath(get_win_folder("CSIDL_MYPICTURES"))
-
-    @property
-    def user_videos_dir(self) -> str:
-        """:return: videos directory tied to the user e.g. ``%USERPROFILE%\\Videos``"""
-        return os.path.normpath(get_win_folder("CSIDL_MYVIDEO"))
-
-    @property
-    def user_music_dir(self) -> str:
-        """:return: music directory tied to the user e.g. ``%USERPROFILE%\\Music``"""
-        return os.path.normpath(get_win_folder("CSIDL_MYMUSIC"))
-
-    @property
-    def user_desktop_dir(self) -> str:
-        """:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\\Desktop``"""
-        return os.path.normpath(get_win_folder("CSIDL_DESKTOPDIRECTORY"))
-
-    @property
-    def user_runtime_dir(self) -> str:
-        """
-        :return: runtime directory tied to the user, e.g.
-         ``%USERPROFILE%\\AppData\\Local\\Temp\\$appauthor\\$appname``
-        """
-        path = os.path.normpath(os.path.join(get_win_folder("CSIDL_LOCAL_APPDATA"), "Temp"))  # noqa: PTH118
-        return self._append_parts(path)
-
-    @property
-    def site_runtime_dir(self) -> str:
-        """:return: runtime directory shared by users, same as `user_runtime_dir`"""
-        return self.user_runtime_dir
-
-
-def get_win_folder_from_env_vars(csidl_name: str) -> str:
-    """Get folder from environment variables."""
-    result = get_win_folder_if_csidl_name_not_env_var(csidl_name)
-    if result is not None:
-        return result
-
-    env_var_name = {
-        "CSIDL_APPDATA": "APPDATA",
-        "CSIDL_COMMON_APPDATA": "ALLUSERSPROFILE",
-        "CSIDL_LOCAL_APPDATA": "LOCALAPPDATA",
-    }.get(csidl_name)
-    if env_var_name is None:
-        msg = f"Unknown CSIDL name: {csidl_name}"
-        raise ValueError(msg)
-    result = os.environ.get(env_var_name)
-    if result is None:
-        msg = f"Unset environment variable: {env_var_name}"
-        raise ValueError(msg)
-    return result
-
-
-def get_win_folder_if_csidl_name_not_env_var(csidl_name: str) -> str | None:
-    """Get a folder for a CSIDL name that does not exist as an environment variable."""
-    if csidl_name == "CSIDL_PERSONAL":
-        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Documents")  # noqa: PTH118
-
-    if csidl_name == "CSIDL_DOWNLOADS":
-        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Downloads")  # noqa: PTH118
-
-    if csidl_name == "CSIDL_MYPICTURES":
-        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Pictures")  # noqa: PTH118
-
-    if csidl_name == "CSIDL_MYVIDEO":
-        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Videos")  # noqa: PTH118
-
-    if csidl_name == "CSIDL_MYMUSIC":
-        return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Music")  # noqa: PTH118
-    return None
-
-
-def get_win_folder_from_registry(csidl_name: str) -> str:
-    """
-    Get folder from the registry.
-
-    This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer
-    for all CSIDL_* names.
-
-    """
-    shell_folder_name = {
-        "CSIDL_APPDATA": "AppData",
-        "CSIDL_COMMON_APPDATA": "Common AppData",
-        "CSIDL_LOCAL_APPDATA": "Local AppData",
-        "CSIDL_PERSONAL": "Personal",
-        "CSIDL_DOWNLOADS": "{374DE290-123F-4565-9164-39C4925E467B}",
-        "CSIDL_MYPICTURES": "My Pictures",
-        "CSIDL_MYVIDEO": "My Video",
-        "CSIDL_MYMUSIC": "My Music",
-    }.get(csidl_name)
-    if shell_folder_name is None:
-        msg = f"Unknown CSIDL name: {csidl_name}"
-        raise ValueError(msg)
-    if sys.platform != "win32":  # only needed for mypy type checker to know that this code runs only on Windows
-        raise NotImplementedError
-    import winreg  # noqa: PLC0415
-
-    key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
-    directory, _ = winreg.QueryValueEx(key, shell_folder_name)
-    return str(directory)
-
-
-def get_win_folder_via_ctypes(csidl_name: str) -> str:
-    """Get folder with ctypes."""
-    # There is no 'CSIDL_DOWNLOADS'.
-    # Use 'CSIDL_PROFILE' (40) and append the default folder 'Downloads' instead.
-    # https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid
-
-    import ctypes  # noqa: PLC0415
-
-    csidl_const = {
-        "CSIDL_APPDATA": 26,
-        "CSIDL_COMMON_APPDATA": 35,
-        "CSIDL_LOCAL_APPDATA": 28,
-        "CSIDL_PERSONAL": 5,
-        "CSIDL_MYPICTURES": 39,
-        "CSIDL_MYVIDEO": 14,
-        "CSIDL_MYMUSIC": 13,
-        "CSIDL_DOWNLOADS": 40,
-        "CSIDL_DESKTOPDIRECTORY": 16,
-    }.get(csidl_name)
-    if csidl_const is None:
-        msg = f"Unknown CSIDL name: {csidl_name}"
-        raise ValueError(msg)
-
-    buf = ctypes.create_unicode_buffer(1024)
-    windll = getattr(ctypes, "windll")  # noqa: B009 # using getattr to avoid false positive with mypy type checker
-    windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
-
-    # Downgrade to short path name if it has high-bit chars.
-    if any(ord(c) > 255 for c in buf):  # noqa: PLR2004
-        buf2 = ctypes.create_unicode_buffer(1024)
-        if windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
-            buf = buf2
-
-    if csidl_name == "CSIDL_DOWNLOADS":
-        return os.path.join(buf.value, "Downloads")  # noqa: PTH118
-
-    return buf.value
-
-
-def _pick_get_win_folder() -> Callable[[str], str]:
-    try:
-        import ctypes  # noqa: PLC0415
-    except ImportError:
-        pass
-    else:
-        if hasattr(ctypes, "windll"):
-            return get_win_folder_via_ctypes
-    try:
-        import winreg  # noqa: PLC0415, F401
-    except ImportError:
-        return get_win_folder_from_env_vars
-    else:
-        return get_win_folder_from_registry
-
-
-get_win_folder = lru_cache(maxsize=None)(_pick_get_win_folder())
-
-__all__ = [
-    "Windows",
-]
diff --git a/pkg_resources/_vendor/ruff.toml b/pkg_resources/_vendor/ruff.toml
deleted file mode 100644
index 00fee625a5..0000000000
--- a/pkg_resources/_vendor/ruff.toml
+++ /dev/null
@@ -1 +0,0 @@
-exclude = ["*"]
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE
deleted file mode 100644
index 07806f8af9..0000000000
--- a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-This is the MIT license: http://www.opensource.org/licenses/mit-license.php
-
-Copyright (c) Alex Grönholm
-
-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/pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA
deleted file mode 100644
index 6e5750b485..0000000000
--- a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/METADATA
+++ /dev/null
@@ -1,81 +0,0 @@
-Metadata-Version: 2.1
-Name: typeguard
-Version: 4.3.0
-Summary: Run-time type checker for Python
-Author-email: Alex Grönholm 
-License: MIT
-Project-URL: Documentation, https://typeguard.readthedocs.io/en/latest/
-Project-URL: Change log, https://typeguard.readthedocs.io/en/latest/versionhistory.html
-Project-URL: Source code, https://github.com/agronholm/typeguard
-Project-URL: Issue tracker, https://github.com/agronholm/typeguard/issues
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python
-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
-Requires-Python: >=3.8
-Description-Content-Type: text/x-rst
-License-File: LICENSE
-Requires-Dist: typing-extensions >=4.10.0
-Requires-Dist: importlib-metadata >=3.6 ; python_version < "3.10"
-Provides-Extra: doc
-Requires-Dist: packaging ; extra == 'doc'
-Requires-Dist: Sphinx >=7 ; extra == 'doc'
-Requires-Dist: sphinx-autodoc-typehints >=1.2.0 ; extra == 'doc'
-Requires-Dist: sphinx-rtd-theme >=1.3.0 ; extra == 'doc'
-Provides-Extra: test
-Requires-Dist: coverage[toml] >=7 ; extra == 'test'
-Requires-Dist: pytest >=7 ; extra == 'test'
-Requires-Dist: mypy >=1.2.0 ; (platform_python_implementation != "PyPy") and extra == 'test'
-
-.. image:: https://github.com/agronholm/typeguard/actions/workflows/test.yml/badge.svg
-  :target: https://github.com/agronholm/typeguard/actions/workflows/test.yml
-  :alt: Build Status
-.. image:: https://coveralls.io/repos/agronholm/typeguard/badge.svg?branch=master&service=github
-  :target: https://coveralls.io/github/agronholm/typeguard?branch=master
-  :alt: Code Coverage
-.. image:: https://readthedocs.org/projects/typeguard/badge/?version=latest
-  :target: https://typeguard.readthedocs.io/en/latest/?badge=latest
-  :alt: Documentation
-
-This library provides run-time type checking for functions defined with
-`PEP 484 `_ argument (and return) type
-annotations, and any arbitrary objects. It can be used together with static type
-checkers as an additional layer of type safety, to catch type violations that could only
-be detected at run time.
-
-Two principal ways to do type checking are provided:
-
-#. The ``check_type`` function:
-
-   * like ``isinstance()``, but supports arbitrary type annotations (within limits)
-   * can be used as a ``cast()`` replacement, but with actual checking of the value
-#. Code instrumentation:
-
-   * entire modules, or individual functions (via ``@typechecked``) are recompiled, with
-     type checking code injected into them
-   * automatically checks function arguments, return values and assignments to annotated
-     local variables
-   * for generator functions (regular and async), checks yield and send values
-   * requires the original source code of the instrumented module(s) to be accessible
-
-Two options are provided for code instrumentation:
-
-#. the ``@typechecked`` function:
-
-   * can be applied to functions individually
-#. the import hook (``typeguard.install_import_hook()``):
-
-   * automatically instruments targeted modules on import
-   * no manual code changes required in the target modules
-   * requires the import hook to be installed before the targeted modules are imported
-   * may clash with other import hooks
-
-See the documentation_ for further information.
-
-.. _documentation: https://typeguard.readthedocs.io/en/latest/
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD
deleted file mode 100644
index 801e73347c..0000000000
--- a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/RECORD
+++ /dev/null
@@ -1,34 +0,0 @@
-typeguard-4.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-typeguard-4.3.0.dist-info/LICENSE,sha256=YWP3mH37ONa8MgzitwsvArhivEESZRbVUu8c1DJH51g,1130
-typeguard-4.3.0.dist-info/METADATA,sha256=z2dcHAp0TwhYCFU5Deh8x31nazElgujUz9tbuP0pjSE,3717
-typeguard-4.3.0.dist-info/RECORD,,
-typeguard-4.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-typeguard-4.3.0.dist-info/entry_points.txt,sha256=qp7NQ1aLtiSgMQqo6gWlfGpy0IIXzoMJmeQTLpzqFZQ,48
-typeguard-4.3.0.dist-info/top_level.txt,sha256=4z28AhuDodwRS_c1J_l8H51t5QuwfTseskYzlxp6grs,10
-typeguard/__init__.py,sha256=Onh4w38elPCjtlcU3JY9k3h70NjsxXIkAflmQn-Z0FY,2071
-typeguard/__pycache__/__init__.cpython-312.pyc,,
-typeguard/__pycache__/_checkers.cpython-312.pyc,,
-typeguard/__pycache__/_config.cpython-312.pyc,,
-typeguard/__pycache__/_decorators.cpython-312.pyc,,
-typeguard/__pycache__/_exceptions.cpython-312.pyc,,
-typeguard/__pycache__/_functions.cpython-312.pyc,,
-typeguard/__pycache__/_importhook.cpython-312.pyc,,
-typeguard/__pycache__/_memo.cpython-312.pyc,,
-typeguard/__pycache__/_pytest_plugin.cpython-312.pyc,,
-typeguard/__pycache__/_suppression.cpython-312.pyc,,
-typeguard/__pycache__/_transformer.cpython-312.pyc,,
-typeguard/__pycache__/_union_transformer.cpython-312.pyc,,
-typeguard/__pycache__/_utils.cpython-312.pyc,,
-typeguard/_checkers.py,sha256=JRrgKicdOEfIBoNEtegYCEIlhpad-a1u1Em7GCj0WCI,31360
-typeguard/_config.py,sha256=nIz8QwDa-oFO3L9O8_6srzlmd99pSby2wOM4Wb7F_B0,2846
-typeguard/_decorators.py,sha256=v6dsIeWvPhExGLP_wXF-RmDUyjZf_Ak28g7gBJ_v0-0,9033
-typeguard/_exceptions.py,sha256=ZIPeiV-FBd5Emw2EaWd2Fvlsrwi4ocwT2fVGBIAtHcQ,1121
-typeguard/_functions.py,sha256=ibgSAKa5ptIm1eR9ARG0BSozAFJPFNASZqhPVyQeqig,10393
-typeguard/_importhook.py,sha256=ugjCDvFcdWMU7UugqlJG91IpVNpEIxtRr-99s0h1k7M,6389
-typeguard/_memo.py,sha256=1juQV_vxnD2JYKbSrebiQuj4oKHz6n67v9pYA-CCISg,1303
-typeguard/_pytest_plugin.py,sha256=-fcSqkv54rIfIF8pDavY5YQPkj4OX8GMt_lL7CQSD4I,4416
-typeguard/_suppression.py,sha256=VQfzxcwIbu3if0f7VBkKM7hkYOA7tNFw9a7jMBsmMg4,2266
-typeguard/_transformer.py,sha256=9Ha7_QhdwoUni_6hvdY-hZbuEergowHrNL2vzHIakFY,44937
-typeguard/_union_transformer.py,sha256=v_42r7-6HuRX2SoFwnyJ-E5PlxXpVeUJPJR1-HU9qSo,1354
-typeguard/_utils.py,sha256=5HhO1rPn5f1M6ymkVAEv7Xmlz1cX-j0OnTMlyHqqrR8,5270
-typeguard/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL
deleted file mode 100644
index bab98d6758..0000000000
--- a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.43.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
deleted file mode 100644
index 47c9d0bd91..0000000000
--- a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/entry_points.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-[pytest11]
-typeguard = typeguard._pytest_plugin
diff --git a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt b/pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt
deleted file mode 100644
index be5ec23ea2..0000000000
--- a/pkg_resources/_vendor/typeguard-4.3.0.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-typeguard
diff --git a/pkg_resources/_vendor/typeguard/__init__.py b/pkg_resources/_vendor/typeguard/__init__.py
deleted file mode 100644
index 6781cad094..0000000000
--- a/pkg_resources/_vendor/typeguard/__init__.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import os
-from typing import Any
-
-from ._checkers import TypeCheckerCallable as TypeCheckerCallable
-from ._checkers import TypeCheckLookupCallback as TypeCheckLookupCallback
-from ._checkers import check_type_internal as check_type_internal
-from ._checkers import checker_lookup_functions as checker_lookup_functions
-from ._checkers import load_plugins as load_plugins
-from ._config import CollectionCheckStrategy as CollectionCheckStrategy
-from ._config import ForwardRefPolicy as ForwardRefPolicy
-from ._config import TypeCheckConfiguration as TypeCheckConfiguration
-from ._decorators import typechecked as typechecked
-from ._decorators import typeguard_ignore as typeguard_ignore
-from ._exceptions import InstrumentationWarning as InstrumentationWarning
-from ._exceptions import TypeCheckError as TypeCheckError
-from ._exceptions import TypeCheckWarning as TypeCheckWarning
-from ._exceptions import TypeHintWarning as TypeHintWarning
-from ._functions import TypeCheckFailCallback as TypeCheckFailCallback
-from ._functions import check_type as check_type
-from ._functions import warn_on_error as warn_on_error
-from ._importhook import ImportHookManager as ImportHookManager
-from ._importhook import TypeguardFinder as TypeguardFinder
-from ._importhook import install_import_hook as install_import_hook
-from ._memo import TypeCheckMemo as TypeCheckMemo
-from ._suppression import suppress_type_checks as suppress_type_checks
-from ._utils import Unset as Unset
-
-# Re-export imports so they look like they live directly in this package
-for value in list(locals().values()):
-    if getattr(value, "__module__", "").startswith(f"{__name__}."):
-        value.__module__ = __name__
-
-
-config: TypeCheckConfiguration
-
-
-def __getattr__(name: str) -> Any:
-    if name == "config":
-        from ._config import global_config
-
-        return global_config
-
-    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
-
-
-# Automatically load checker lookup functions unless explicitly disabled
-if "TYPEGUARD_DISABLE_PLUGIN_AUTOLOAD" not in os.environ:
-    load_plugins()
diff --git a/pkg_resources/_vendor/typeguard/_checkers.py b/pkg_resources/_vendor/typeguard/_checkers.py
deleted file mode 100644
index 67dd5ad4dc..0000000000
--- a/pkg_resources/_vendor/typeguard/_checkers.py
+++ /dev/null
@@ -1,993 +0,0 @@
-from __future__ import annotations
-
-import collections.abc
-import inspect
-import sys
-import types
-import typing
-import warnings
-from enum import Enum
-from inspect import Parameter, isclass, isfunction
-from io import BufferedIOBase, IOBase, RawIOBase, TextIOBase
-from textwrap import indent
-from typing import (
-    IO,
-    AbstractSet,
-    Any,
-    BinaryIO,
-    Callable,
-    Dict,
-    ForwardRef,
-    List,
-    Mapping,
-    MutableMapping,
-    NewType,
-    Optional,
-    Sequence,
-    Set,
-    TextIO,
-    Tuple,
-    Type,
-    TypeVar,
-    Union,
-)
-from unittest.mock import Mock
-from weakref import WeakKeyDictionary
-
-try:
-    import typing_extensions
-except ImportError:
-    typing_extensions = None  # type: ignore[assignment]
-
-# Must use this because typing.is_typeddict does not recognize
-# TypedDict from typing_extensions, and as of version 4.12.0
-# typing_extensions.TypedDict is different from typing.TypedDict
-# on all versions.
-from typing_extensions import is_typeddict
-
-from ._config import ForwardRefPolicy
-from ._exceptions import TypeCheckError, TypeHintWarning
-from ._memo import TypeCheckMemo
-from ._utils import evaluate_forwardref, get_stacklevel, get_type_name, qualified_name
-
-if sys.version_info >= (3, 11):
-    from typing import (
-        Annotated,
-        NotRequired,
-        TypeAlias,
-        get_args,
-        get_origin,
-    )
-
-    SubclassableAny = Any
-else:
-    from typing_extensions import (
-        Annotated,
-        NotRequired,
-        TypeAlias,
-        get_args,
-        get_origin,
-    )
-    from typing_extensions import Any as SubclassableAny
-
-if sys.version_info >= (3, 10):
-    from importlib.metadata import entry_points
-    from typing import ParamSpec
-else:
-    from importlib_metadata import entry_points
-    from typing_extensions import ParamSpec
-
-TypeCheckerCallable: TypeAlias = Callable[
-    [Any, Any, Tuple[Any, ...], TypeCheckMemo], Any
-]
-TypeCheckLookupCallback: TypeAlias = Callable[
-    [Any, Tuple[Any, ...], Tuple[Any, ...]], Optional[TypeCheckerCallable]
-]
-
-checker_lookup_functions: list[TypeCheckLookupCallback] = []
-generic_alias_types: tuple[type, ...] = (type(List), type(List[Any]))
-if sys.version_info >= (3, 9):
-    generic_alias_types += (types.GenericAlias,)
-
-protocol_check_cache: WeakKeyDictionary[
-    type[Any], dict[type[Any], TypeCheckError | None]
-] = WeakKeyDictionary()
-
-# Sentinel
-_missing = object()
-
-# Lifted from mypy.sharedparse
-BINARY_MAGIC_METHODS = {
-    "__add__",
-    "__and__",
-    "__cmp__",
-    "__divmod__",
-    "__div__",
-    "__eq__",
-    "__floordiv__",
-    "__ge__",
-    "__gt__",
-    "__iadd__",
-    "__iand__",
-    "__idiv__",
-    "__ifloordiv__",
-    "__ilshift__",
-    "__imatmul__",
-    "__imod__",
-    "__imul__",
-    "__ior__",
-    "__ipow__",
-    "__irshift__",
-    "__isub__",
-    "__itruediv__",
-    "__ixor__",
-    "__le__",
-    "__lshift__",
-    "__lt__",
-    "__matmul__",
-    "__mod__",
-    "__mul__",
-    "__ne__",
-    "__or__",
-    "__pow__",
-    "__radd__",
-    "__rand__",
-    "__rdiv__",
-    "__rfloordiv__",
-    "__rlshift__",
-    "__rmatmul__",
-    "__rmod__",
-    "__rmul__",
-    "__ror__",
-    "__rpow__",
-    "__rrshift__",
-    "__rshift__",
-    "__rsub__",
-    "__rtruediv__",
-    "__rxor__",
-    "__sub__",
-    "__truediv__",
-    "__xor__",
-}
-
-
-def check_callable(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not callable(value):
-        raise TypeCheckError("is not callable")
-
-    if args:
-        try:
-            signature = inspect.signature(value)
-        except (TypeError, ValueError):
-            return
-
-        argument_types = args[0]
-        if isinstance(argument_types, list) and not any(
-            type(item) is ParamSpec for item in argument_types
-        ):
-            # The callable must not have keyword-only arguments without defaults
-            unfulfilled_kwonlyargs = [
-                param.name
-                for param in signature.parameters.values()
-                if param.kind == Parameter.KEYWORD_ONLY
-                and param.default == Parameter.empty
-            ]
-            if unfulfilled_kwonlyargs:
-                raise TypeCheckError(
-                    f"has mandatory keyword-only arguments in its declaration: "
-                    f'{", ".join(unfulfilled_kwonlyargs)}'
-                )
-
-            num_positional_args = num_mandatory_pos_args = 0
-            has_varargs = False
-            for param in signature.parameters.values():
-                if param.kind in (
-                    Parameter.POSITIONAL_ONLY,
-                    Parameter.POSITIONAL_OR_KEYWORD,
-                ):
-                    num_positional_args += 1
-                    if param.default is Parameter.empty:
-                        num_mandatory_pos_args += 1
-                elif param.kind == Parameter.VAR_POSITIONAL:
-                    has_varargs = True
-
-            if num_mandatory_pos_args > len(argument_types):
-                raise TypeCheckError(
-                    f"has too many mandatory positional arguments in its declaration; "
-                    f"expected {len(argument_types)} but {num_mandatory_pos_args} "
-                    f"mandatory positional argument(s) declared"
-                )
-            elif not has_varargs and num_positional_args < len(argument_types):
-                raise TypeCheckError(
-                    f"has too few arguments in its declaration; expected "
-                    f"{len(argument_types)} but {num_positional_args} argument(s) "
-                    f"declared"
-                )
-
-
-def check_mapping(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if origin_type is Dict or origin_type is dict:
-        if not isinstance(value, dict):
-            raise TypeCheckError("is not a dict")
-    if origin_type is MutableMapping or origin_type is collections.abc.MutableMapping:
-        if not isinstance(value, collections.abc.MutableMapping):
-            raise TypeCheckError("is not a mutable mapping")
-    elif not isinstance(value, collections.abc.Mapping):
-        raise TypeCheckError("is not a mapping")
-
-    if args:
-        key_type, value_type = args
-        if key_type is not Any or value_type is not Any:
-            samples = memo.config.collection_check_strategy.iterate_samples(
-                value.items()
-            )
-            for k, v in samples:
-                try:
-                    check_type_internal(k, key_type, memo)
-                except TypeCheckError as exc:
-                    exc.append_path_element(f"key {k!r}")
-                    raise
-
-                try:
-                    check_type_internal(v, value_type, memo)
-                except TypeCheckError as exc:
-                    exc.append_path_element(f"value of key {k!r}")
-                    raise
-
-
-def check_typed_dict(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not isinstance(value, dict):
-        raise TypeCheckError("is not a dict")
-
-    declared_keys = frozenset(origin_type.__annotations__)
-    if hasattr(origin_type, "__required_keys__"):
-        required_keys = set(origin_type.__required_keys__)
-    else:  # py3.8 and lower
-        required_keys = set(declared_keys) if origin_type.__total__ else set()
-
-    existing_keys = set(value)
-    extra_keys = existing_keys - declared_keys
-    if extra_keys:
-        keys_formatted = ", ".join(f'"{key}"' for key in sorted(extra_keys, key=repr))
-        raise TypeCheckError(f"has unexpected extra key(s): {keys_formatted}")
-
-    # Detect NotRequired fields which are hidden by get_type_hints()
-    type_hints: dict[str, type] = {}
-    for key, annotation in origin_type.__annotations__.items():
-        if isinstance(annotation, ForwardRef):
-            annotation = evaluate_forwardref(annotation, memo)
-            if get_origin(annotation) is NotRequired:
-                required_keys.discard(key)
-                annotation = get_args(annotation)[0]
-
-        type_hints[key] = annotation
-
-    missing_keys = required_keys - existing_keys
-    if missing_keys:
-        keys_formatted = ", ".join(f'"{key}"' for key in sorted(missing_keys, key=repr))
-        raise TypeCheckError(f"is missing required key(s): {keys_formatted}")
-
-    for key, argtype in type_hints.items():
-        argvalue = value.get(key, _missing)
-        if argvalue is not _missing:
-            try:
-                check_type_internal(argvalue, argtype, memo)
-            except TypeCheckError as exc:
-                exc.append_path_element(f"value of key {key!r}")
-                raise
-
-
-def check_list(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not isinstance(value, list):
-        raise TypeCheckError("is not a list")
-
-    if args and args != (Any,):
-        samples = memo.config.collection_check_strategy.iterate_samples(value)
-        for i, v in enumerate(samples):
-            try:
-                check_type_internal(v, args[0], memo)
-            except TypeCheckError as exc:
-                exc.append_path_element(f"item {i}")
-                raise
-
-
-def check_sequence(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not isinstance(value, collections.abc.Sequence):
-        raise TypeCheckError("is not a sequence")
-
-    if args and args != (Any,):
-        samples = memo.config.collection_check_strategy.iterate_samples(value)
-        for i, v in enumerate(samples):
-            try:
-                check_type_internal(v, args[0], memo)
-            except TypeCheckError as exc:
-                exc.append_path_element(f"item {i}")
-                raise
-
-
-def check_set(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if origin_type is frozenset:
-        if not isinstance(value, frozenset):
-            raise TypeCheckError("is not a frozenset")
-    elif not isinstance(value, AbstractSet):
-        raise TypeCheckError("is not a set")
-
-    if args and args != (Any,):
-        samples = memo.config.collection_check_strategy.iterate_samples(value)
-        for v in samples:
-            try:
-                check_type_internal(v, args[0], memo)
-            except TypeCheckError as exc:
-                exc.append_path_element(f"[{v}]")
-                raise
-
-
-def check_tuple(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    # Specialized check for NamedTuples
-    if field_types := getattr(origin_type, "__annotations__", None):
-        if not isinstance(value, origin_type):
-            raise TypeCheckError(
-                f"is not a named tuple of type {qualified_name(origin_type)}"
-            )
-
-        for name, field_type in field_types.items():
-            try:
-                check_type_internal(getattr(value, name), field_type, memo)
-            except TypeCheckError as exc:
-                exc.append_path_element(f"attribute {name!r}")
-                raise
-
-        return
-    elif not isinstance(value, tuple):
-        raise TypeCheckError("is not a tuple")
-
-    if args:
-        use_ellipsis = args[-1] is Ellipsis
-        tuple_params = args[: -1 if use_ellipsis else None]
-    else:
-        # Unparametrized Tuple or plain tuple
-        return
-
-    if use_ellipsis:
-        element_type = tuple_params[0]
-        samples = memo.config.collection_check_strategy.iterate_samples(value)
-        for i, element in enumerate(samples):
-            try:
-                check_type_internal(element, element_type, memo)
-            except TypeCheckError as exc:
-                exc.append_path_element(f"item {i}")
-                raise
-    elif tuple_params == ((),):
-        if value != ():
-            raise TypeCheckError("is not an empty tuple")
-    else:
-        if len(value) != len(tuple_params):
-            raise TypeCheckError(
-                f"has wrong number of elements (expected {len(tuple_params)}, got "
-                f"{len(value)} instead)"
-            )
-
-        for i, (element, element_type) in enumerate(zip(value, tuple_params)):
-            try:
-                check_type_internal(element, element_type, memo)
-            except TypeCheckError as exc:
-                exc.append_path_element(f"item {i}")
-                raise
-
-
-def check_union(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    errors: dict[str, TypeCheckError] = {}
-    try:
-        for type_ in args:
-            try:
-                check_type_internal(value, type_, memo)
-                return
-            except TypeCheckError as exc:
-                errors[get_type_name(type_)] = exc
-
-        formatted_errors = indent(
-            "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
-        )
-    finally:
-        del errors  # avoid creating ref cycle
-    raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
-
-
-def check_uniontype(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    errors: dict[str, TypeCheckError] = {}
-    for type_ in args:
-        try:
-            check_type_internal(value, type_, memo)
-            return
-        except TypeCheckError as exc:
-            errors[get_type_name(type_)] = exc
-
-    formatted_errors = indent(
-        "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
-    )
-    raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
-
-
-def check_class(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not isclass(value) and not isinstance(value, generic_alias_types):
-        raise TypeCheckError("is not a class")
-
-    if not args:
-        return
-
-    if isinstance(args[0], ForwardRef):
-        expected_class = evaluate_forwardref(args[0], memo)
-    else:
-        expected_class = args[0]
-
-    if expected_class is Any:
-        return
-    elif getattr(expected_class, "_is_protocol", False):
-        check_protocol(value, expected_class, (), memo)
-    elif isinstance(expected_class, TypeVar):
-        check_typevar(value, expected_class, (), memo, subclass_check=True)
-    elif get_origin(expected_class) is Union:
-        errors: dict[str, TypeCheckError] = {}
-        for arg in get_args(expected_class):
-            if arg is Any:
-                return
-
-            try:
-                check_class(value, type, (arg,), memo)
-                return
-            except TypeCheckError as exc:
-                errors[get_type_name(arg)] = exc
-        else:
-            formatted_errors = indent(
-                "\n".join(f"{key}: {error}" for key, error in errors.items()), "  "
-            )
-            raise TypeCheckError(
-                f"did not match any element in the union:\n{formatted_errors}"
-            )
-    elif not issubclass(value, expected_class):  # type: ignore[arg-type]
-        raise TypeCheckError(f"is not a subclass of {qualified_name(expected_class)}")
-
-
-def check_newtype(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    check_type_internal(value, origin_type.__supertype__, memo)
-
-
-def check_instance(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not isinstance(value, origin_type):
-        raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
-
-
-def check_typevar(
-    value: Any,
-    origin_type: TypeVar,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-    *,
-    subclass_check: bool = False,
-) -> None:
-    if origin_type.__bound__ is not None:
-        annotation = (
-            Type[origin_type.__bound__] if subclass_check else origin_type.__bound__
-        )
-        check_type_internal(value, annotation, memo)
-    elif origin_type.__constraints__:
-        for constraint in origin_type.__constraints__:
-            annotation = Type[constraint] if subclass_check else constraint
-            try:
-                check_type_internal(value, annotation, memo)
-            except TypeCheckError:
-                pass
-            else:
-                break
-        else:
-            formatted_constraints = ", ".join(
-                get_type_name(constraint) for constraint in origin_type.__constraints__
-            )
-            raise TypeCheckError(
-                f"does not match any of the constraints " f"({formatted_constraints})"
-            )
-
-
-if typing_extensions is None:
-
-    def _is_literal_type(typ: object) -> bool:
-        return typ is typing.Literal
-
-else:
-
-    def _is_literal_type(typ: object) -> bool:
-        return typ is typing.Literal or typ is typing_extensions.Literal
-
-
-def check_literal(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    def get_literal_args(literal_args: tuple[Any, ...]) -> tuple[Any, ...]:
-        retval: list[Any] = []
-        for arg in literal_args:
-            if _is_literal_type(get_origin(arg)):
-                retval.extend(get_literal_args(arg.__args__))
-            elif arg is None or isinstance(arg, (int, str, bytes, bool, Enum)):
-                retval.append(arg)
-            else:
-                raise TypeError(
-                    f"Illegal literal value: {arg}"
-                )  # TypeError here is deliberate
-
-        return tuple(retval)
-
-    final_args = tuple(get_literal_args(args))
-    try:
-        index = final_args.index(value)
-    except ValueError:
-        pass
-    else:
-        if type(final_args[index]) is type(value):
-            return
-
-    formatted_args = ", ".join(repr(arg) for arg in final_args)
-    raise TypeCheckError(f"is not any of ({formatted_args})") from None
-
-
-def check_literal_string(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    check_type_internal(value, str, memo)
-
-
-def check_typeguard(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    check_type_internal(value, bool, memo)
-
-
-def check_none(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if value is not None:
-        raise TypeCheckError("is not None")
-
-
-def check_number(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if origin_type is complex and not isinstance(value, (complex, float, int)):
-        raise TypeCheckError("is neither complex, float or int")
-    elif origin_type is float and not isinstance(value, (float, int)):
-        raise TypeCheckError("is neither float or int")
-
-
-def check_io(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if origin_type is TextIO or (origin_type is IO and args == (str,)):
-        if not isinstance(value, TextIOBase):
-            raise TypeCheckError("is not a text based I/O object")
-    elif origin_type is BinaryIO or (origin_type is IO and args == (bytes,)):
-        if not isinstance(value, (RawIOBase, BufferedIOBase)):
-            raise TypeCheckError("is not a binary I/O object")
-    elif not isinstance(value, IOBase):
-        raise TypeCheckError("is not an I/O object")
-
-
-def check_protocol(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    subject: type[Any] = value if isclass(value) else type(value)
-
-    if subject in protocol_check_cache:
-        result_map = protocol_check_cache[subject]
-        if origin_type in result_map:
-            if exc := result_map[origin_type]:
-                raise exc
-            else:
-                return
-
-    # Collect a set of methods and non-method attributes present in the protocol
-    ignored_attrs = set(dir(typing.Protocol)) | {
-        "__annotations__",
-        "__non_callable_proto_members__",
-    }
-    expected_methods: dict[str, tuple[Any, Any]] = {}
-    expected_noncallable_members: dict[str, Any] = {}
-    for attrname in dir(origin_type):
-        # Skip attributes present in typing.Protocol
-        if attrname in ignored_attrs:
-            continue
-
-        member = getattr(origin_type, attrname)
-        if callable(member):
-            signature = inspect.signature(member)
-            argtypes = [
-                (p.annotation if p.annotation is not Parameter.empty else Any)
-                for p in signature.parameters.values()
-                if p.kind is not Parameter.KEYWORD_ONLY
-            ] or Ellipsis
-            return_annotation = (
-                signature.return_annotation
-                if signature.return_annotation is not Parameter.empty
-                else Any
-            )
-            expected_methods[attrname] = argtypes, return_annotation
-        else:
-            expected_noncallable_members[attrname] = member
-
-    for attrname, annotation in typing.get_type_hints(origin_type).items():
-        expected_noncallable_members[attrname] = annotation
-
-    subject_annotations = typing.get_type_hints(subject)
-
-    # Check that all required methods are present and their signatures are compatible
-    result_map = protocol_check_cache.setdefault(subject, {})
-    try:
-        for attrname, callable_args in expected_methods.items():
-            try:
-                method = getattr(subject, attrname)
-            except AttributeError:
-                if attrname in subject_annotations:
-                    raise TypeCheckError(
-                        f"is not compatible with the {origin_type.__qualname__} protocol "
-                        f"because its {attrname!r} attribute is not a method"
-                    ) from None
-                else:
-                    raise TypeCheckError(
-                        f"is not compatible with the {origin_type.__qualname__} protocol "
-                        f"because it has no method named {attrname!r}"
-                    ) from None
-
-            if not callable(method):
-                raise TypeCheckError(
-                    f"is not compatible with the {origin_type.__qualname__} protocol "
-                    f"because its {attrname!r} attribute is not a callable"
-                )
-
-            # TODO: raise exception on added keyword-only arguments without defaults
-            try:
-                check_callable(method, Callable, callable_args, memo)
-            except TypeCheckError as exc:
-                raise TypeCheckError(
-                    f"is not compatible with the {origin_type.__qualname__} protocol "
-                    f"because its {attrname!r} method {exc}"
-                ) from None
-
-        # Check that all required non-callable members are present
-        for attrname in expected_noncallable_members:
-            # TODO: implement assignability checks for non-callable members
-            if attrname not in subject_annotations and not hasattr(subject, attrname):
-                raise TypeCheckError(
-                    f"is not compatible with the {origin_type.__qualname__} protocol "
-                    f"because it has no attribute named {attrname!r}"
-                )
-    except TypeCheckError as exc:
-        result_map[origin_type] = exc
-        raise
-    else:
-        result_map[origin_type] = None
-
-
-def check_byteslike(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not isinstance(value, (bytearray, bytes, memoryview)):
-        raise TypeCheckError("is not bytes-like")
-
-
-def check_self(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if memo.self_type is None:
-        raise TypeCheckError("cannot be checked against Self outside of a method call")
-
-    if isclass(value):
-        if not issubclass(value, memo.self_type):
-            raise TypeCheckError(
-                f"is not an instance of the self type "
-                f"({qualified_name(memo.self_type)})"
-            )
-    elif not isinstance(value, memo.self_type):
-        raise TypeCheckError(
-            f"is not an instance of the self type ({qualified_name(memo.self_type)})"
-        )
-
-
-def check_paramspec(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    pass  # No-op for now
-
-
-def check_instanceof(
-    value: Any,
-    origin_type: Any,
-    args: tuple[Any, ...],
-    memo: TypeCheckMemo,
-) -> None:
-    if not isinstance(value, origin_type):
-        raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
-
-
-def check_type_internal(
-    value: Any,
-    annotation: Any,
-    memo: TypeCheckMemo,
-) -> None:
-    """
-    Check that the given object is compatible with the given type annotation.
-
-    This function should only be used by type checker callables. Applications should use
-    :func:`~.check_type` instead.
-
-    :param value: the value to check
-    :param annotation: the type annotation to check against
-    :param memo: a memo object containing configuration and information necessary for
-        looking up forward references
-    """
-
-    if isinstance(annotation, ForwardRef):
-        try:
-            annotation = evaluate_forwardref(annotation, memo)
-        except NameError:
-            if memo.config.forward_ref_policy is ForwardRefPolicy.ERROR:
-                raise
-            elif memo.config.forward_ref_policy is ForwardRefPolicy.WARN:
-                warnings.warn(
-                    f"Cannot resolve forward reference {annotation.__forward_arg__!r}",
-                    TypeHintWarning,
-                    stacklevel=get_stacklevel(),
-                )
-
-            return
-
-    if annotation is Any or annotation is SubclassableAny or isinstance(value, Mock):
-        return
-
-    # Skip type checks if value is an instance of a class that inherits from Any
-    if not isclass(value) and SubclassableAny in type(value).__bases__:
-        return
-
-    extras: tuple[Any, ...]
-    origin_type = get_origin(annotation)
-    if origin_type is Annotated:
-        annotation, *extras_ = get_args(annotation)
-        extras = tuple(extras_)
-        origin_type = get_origin(annotation)
-    else:
-        extras = ()
-
-    if origin_type is not None:
-        args = get_args(annotation)
-
-        # Compatibility hack to distinguish between unparametrized and empty tuple
-        # (tuple[()]), necessary due to https://github.com/python/cpython/issues/91137
-        if origin_type in (tuple, Tuple) and annotation is not Tuple and not args:
-            args = ((),)
-    else:
-        origin_type = annotation
-        args = ()
-
-    for lookup_func in checker_lookup_functions:
-        checker = lookup_func(origin_type, args, extras)
-        if checker:
-            checker(value, origin_type, args, memo)
-            return
-
-    if isclass(origin_type):
-        if not isinstance(value, origin_type):
-            raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
-    elif type(origin_type) is str:  # noqa: E721
-        warnings.warn(
-            f"Skipping type check against {origin_type!r}; this looks like a "
-            f"string-form forward reference imported from another module",
-            TypeHintWarning,
-            stacklevel=get_stacklevel(),
-        )
-
-
-# Equality checks are applied to these
-origin_type_checkers = {
-    bytes: check_byteslike,
-    AbstractSet: check_set,
-    BinaryIO: check_io,
-    Callable: check_callable,
-    collections.abc.Callable: check_callable,
-    complex: check_number,
-    dict: check_mapping,
-    Dict: check_mapping,
-    float: check_number,
-    frozenset: check_set,
-    IO: check_io,
-    list: check_list,
-    List: check_list,
-    typing.Literal: check_literal,
-    Mapping: check_mapping,
-    MutableMapping: check_mapping,
-    None: check_none,
-    collections.abc.Mapping: check_mapping,
-    collections.abc.MutableMapping: check_mapping,
-    Sequence: check_sequence,
-    collections.abc.Sequence: check_sequence,
-    collections.abc.Set: check_set,
-    set: check_set,
-    Set: check_set,
-    TextIO: check_io,
-    tuple: check_tuple,
-    Tuple: check_tuple,
-    type: check_class,
-    Type: check_class,
-    Union: check_union,
-}
-if sys.version_info >= (3, 10):
-    origin_type_checkers[types.UnionType] = check_uniontype
-    origin_type_checkers[typing.TypeGuard] = check_typeguard
-if sys.version_info >= (3, 11):
-    origin_type_checkers.update(
-        {typing.LiteralString: check_literal_string, typing.Self: check_self}
-    )
-if typing_extensions is not None:
-    # On some Python versions, these may simply be re-exports from typing,
-    # but exactly which Python versions is subject to change,
-    # so it's best to err on the safe side
-    # and update the dictionary on all Python versions
-    # if typing_extensions is installed
-    origin_type_checkers[typing_extensions.Literal] = check_literal
-    origin_type_checkers[typing_extensions.LiteralString] = check_literal_string
-    origin_type_checkers[typing_extensions.Self] = check_self
-    origin_type_checkers[typing_extensions.TypeGuard] = check_typeguard
-
-
-def builtin_checker_lookup(
-    origin_type: Any, args: tuple[Any, ...], extras: tuple[Any, ...]
-) -> TypeCheckerCallable | None:
-    checker = origin_type_checkers.get(origin_type)
-    if checker is not None:
-        return checker
-    elif is_typeddict(origin_type):
-        return check_typed_dict
-    elif isclass(origin_type) and issubclass(
-        origin_type,
-        Tuple,  # type: ignore[arg-type]
-    ):
-        # NamedTuple
-        return check_tuple
-    elif getattr(origin_type, "_is_protocol", False):
-        return check_protocol
-    elif isinstance(origin_type, ParamSpec):
-        return check_paramspec
-    elif isinstance(origin_type, TypeVar):
-        return check_typevar
-    elif origin_type.__class__ is NewType:
-        # typing.NewType on Python 3.10+
-        return check_newtype
-    elif (
-        isfunction(origin_type)
-        and getattr(origin_type, "__module__", None) == "typing"
-        and getattr(origin_type, "__qualname__", "").startswith("NewType.")
-        and hasattr(origin_type, "__supertype__")
-    ):
-        # typing.NewType on Python 3.9 and below
-        return check_newtype
-
-    return None
-
-
-checker_lookup_functions.append(builtin_checker_lookup)
-
-
-def load_plugins() -> None:
-    """
-    Load all type checker lookup functions from entry points.
-
-    All entry points from the ``typeguard.checker_lookup`` group are loaded, and the
-    returned lookup functions are added to :data:`typeguard.checker_lookup_functions`.
-
-    .. note:: This function is called implicitly on import, unless the
-        ``TYPEGUARD_DISABLE_PLUGIN_AUTOLOAD`` environment variable is present.
-    """
-
-    for ep in entry_points(group="typeguard.checker_lookup"):
-        try:
-            plugin = ep.load()
-        except Exception as exc:
-            warnings.warn(
-                f"Failed to load plugin {ep.name!r}: " f"{qualified_name(exc)}: {exc}",
-                stacklevel=2,
-            )
-            continue
-
-        if not callable(plugin):
-            warnings.warn(
-                f"Plugin {ep} returned a non-callable object: {plugin!r}", stacklevel=2
-            )
-            continue
-
-        checker_lookup_functions.insert(0, plugin)
diff --git a/pkg_resources/_vendor/typeguard/_config.py b/pkg_resources/_vendor/typeguard/_config.py
deleted file mode 100644
index 36efad5396..0000000000
--- a/pkg_resources/_vendor/typeguard/_config.py
+++ /dev/null
@@ -1,108 +0,0 @@
-from __future__ import annotations
-
-from collections.abc import Iterable
-from dataclasses import dataclass
-from enum import Enum, auto
-from typing import TYPE_CHECKING, TypeVar
-
-if TYPE_CHECKING:
-    from ._functions import TypeCheckFailCallback
-
-T = TypeVar("T")
-
-
-class ForwardRefPolicy(Enum):
-    """
-    Defines how unresolved forward references are handled.
-
-    Members:
-
-    * ``ERROR``: propagate the :exc:`NameError` when the forward reference lookup fails
-    * ``WARN``: emit a :class:`~.TypeHintWarning` if the forward reference lookup fails
-    * ``IGNORE``: silently skip checks for unresolveable forward references
-    """
-
-    ERROR = auto()
-    WARN = auto()
-    IGNORE = auto()
-
-
-class CollectionCheckStrategy(Enum):
-    """
-    Specifies how thoroughly the contents of collections are type checked.
-
-    This has an effect on the following built-in checkers:
-
-    * ``AbstractSet``
-    * ``Dict``
-    * ``List``
-    * ``Mapping``
-    * ``Set``
-    * ``Tuple[, ...]`` (arbitrarily sized tuples)
-
-    Members:
-
-    * ``FIRST_ITEM``: check only the first item
-    * ``ALL_ITEMS``: check all items
-    """
-
-    FIRST_ITEM = auto()
-    ALL_ITEMS = auto()
-
-    def iterate_samples(self, collection: Iterable[T]) -> Iterable[T]:
-        if self is CollectionCheckStrategy.FIRST_ITEM:
-            try:
-                return [next(iter(collection))]
-            except StopIteration:
-                return ()
-        else:
-            return collection
-
-
-@dataclass
-class TypeCheckConfiguration:
-    """
-     You can change Typeguard's behavior with these settings.
-
-    .. attribute:: typecheck_fail_callback
-       :type: Callable[[TypeCheckError, TypeCheckMemo], Any]
-
-         Callable that is called when type checking fails.
-
-         Default: ``None`` (the :exc:`~.TypeCheckError` is raised directly)
-
-    .. attribute:: forward_ref_policy
-       :type: ForwardRefPolicy
-
-         Specifies what to do when a forward reference fails to resolve.
-
-         Default: ``WARN``
-
-    .. attribute:: collection_check_strategy
-       :type: CollectionCheckStrategy
-
-         Specifies how thoroughly the contents of collections (list, dict, etc.) are
-         type checked.
-
-         Default: ``FIRST_ITEM``
-
-    .. attribute:: debug_instrumentation
-       :type: bool
-
-         If set to ``True``, the code of modules or functions instrumented by typeguard
-         is printed to ``sys.stderr`` after the instrumentation is done
-
-         Requires Python 3.9 or newer.
-
-         Default: ``False``
-    """
-
-    forward_ref_policy: ForwardRefPolicy = ForwardRefPolicy.WARN
-    typecheck_fail_callback: TypeCheckFailCallback | None = None
-    collection_check_strategy: CollectionCheckStrategy = (
-        CollectionCheckStrategy.FIRST_ITEM
-    )
-    debug_instrumentation: bool = False
-
-
-global_config = TypeCheckConfiguration()
diff --git a/pkg_resources/_vendor/typeguard/_decorators.py b/pkg_resources/_vendor/typeguard/_decorators.py
deleted file mode 100644
index cf3253351f..0000000000
--- a/pkg_resources/_vendor/typeguard/_decorators.py
+++ /dev/null
@@ -1,235 +0,0 @@
-from __future__ import annotations
-
-import ast
-import inspect
-import sys
-from collections.abc import Sequence
-from functools import partial
-from inspect import isclass, isfunction
-from types import CodeType, FrameType, FunctionType
-from typing import TYPE_CHECKING, Any, Callable, ForwardRef, TypeVar, cast, overload
-from warnings import warn
-
-from ._config import CollectionCheckStrategy, ForwardRefPolicy, global_config
-from ._exceptions import InstrumentationWarning
-from ._functions import TypeCheckFailCallback
-from ._transformer import TypeguardTransformer
-from ._utils import Unset, function_name, get_stacklevel, is_method_of, unset
-
-if TYPE_CHECKING:
-    from typeshed.stdlib.types import _Cell
-
-    _F = TypeVar("_F")
-
-    def typeguard_ignore(f: _F) -> _F:
-        """This decorator is a noop during static type-checking."""
-        return f
-
-else:
-    from typing import no_type_check as typeguard_ignore  # noqa: F401
-
-T_CallableOrType = TypeVar("T_CallableOrType", bound=Callable[..., Any])
-
-
-def make_cell(value: object) -> _Cell:
-    return (lambda: value).__closure__[0]  # type: ignore[index]
-
-
-def find_target_function(
-    new_code: CodeType, target_path: Sequence[str], firstlineno: int
-) -> CodeType | None:
-    target_name = target_path[0]
-    for const in new_code.co_consts:
-        if isinstance(const, CodeType):
-            if const.co_name == target_name:
-                if const.co_firstlineno == firstlineno:
-                    return const
-                elif len(target_path) > 1:
-                    target_code = find_target_function(
-                        const, target_path[1:], firstlineno
-                    )
-                    if target_code:
-                        return target_code
-
-    return None
-
-
-def instrument(f: T_CallableOrType) -> FunctionType | str:
-    if not getattr(f, "__code__", None):
-        return "no code associated"
-    elif not getattr(f, "__module__", None):
-        return "__module__ attribute is not set"
-    elif f.__code__.co_filename == "":
-        return "cannot instrument functions defined in a REPL"
-    elif hasattr(f, "__wrapped__"):
-        return (
-            "@typechecked only supports instrumenting functions wrapped with "
-            "@classmethod, @staticmethod or @property"
-        )
-
-    target_path = [item for item in f.__qualname__.split(".") if item != ""]
-    module_source = inspect.getsource(sys.modules[f.__module__])
-    module_ast = ast.parse(module_source)
-    instrumentor = TypeguardTransformer(target_path, f.__code__.co_firstlineno)
-    instrumentor.visit(module_ast)
-
-    if not instrumentor.target_node or instrumentor.target_lineno is None:
-        return "instrumentor did not find the target function"
-
-    module_code = compile(module_ast, f.__code__.co_filename, "exec", dont_inherit=True)
-    new_code = find_target_function(
-        module_code, target_path, instrumentor.target_lineno
-    )
-    if not new_code:
-        return "cannot find the target function in the AST"
-
-    if global_config.debug_instrumentation and sys.version_info >= (3, 9):
-        # Find the matching AST node, then unparse it to source and print to stdout
-        print(
-            f"Source code of {f.__qualname__}() after instrumentation:"
-            "\n----------------------------------------------",
-            file=sys.stderr,
-        )
-        print(ast.unparse(instrumentor.target_node), file=sys.stderr)
-        print(
-            "----------------------------------------------",
-            file=sys.stderr,
-        )
-
-    closure = f.__closure__
-    if new_code.co_freevars != f.__code__.co_freevars:
-        # Create a new closure and find values for the new free variables
-        frame = cast(FrameType, inspect.currentframe())
-        frame = cast(FrameType, frame.f_back)
-        frame_locals = cast(FrameType, frame.f_back).f_locals
-        cells: list[_Cell] = []
-        for key in new_code.co_freevars:
-            if key in instrumentor.names_used_in_annotations:
-                # Find the value and make a new cell from it
-                value = frame_locals.get(key) or ForwardRef(key)
-                cells.append(make_cell(value))
-            else:
-                # Reuse the cell from the existing closure
-                assert f.__closure__
-                cells.append(f.__closure__[f.__code__.co_freevars.index(key)])
-
-        closure = tuple(cells)
-
-    new_function = FunctionType(new_code, f.__globals__, f.__name__, closure=closure)
-    new_function.__module__ = f.__module__
-    new_function.__name__ = f.__name__
-    new_function.__qualname__ = f.__qualname__
-    new_function.__annotations__ = f.__annotations__
-    new_function.__doc__ = f.__doc__
-    new_function.__defaults__ = f.__defaults__
-    new_function.__kwdefaults__ = f.__kwdefaults__
-    return new_function
-
-
-@overload
-def typechecked(
-    *,
-    forward_ref_policy: ForwardRefPolicy | Unset = unset,
-    typecheck_fail_callback: TypeCheckFailCallback | Unset = unset,
-    collection_check_strategy: CollectionCheckStrategy | Unset = unset,
-    debug_instrumentation: bool | Unset = unset,
-) -> Callable[[T_CallableOrType], T_CallableOrType]: ...
-
-
-@overload
-def typechecked(target: T_CallableOrType) -> T_CallableOrType: ...
-
-
-def typechecked(
-    target: T_CallableOrType | None = None,
-    *,
-    forward_ref_policy: ForwardRefPolicy | Unset = unset,
-    typecheck_fail_callback: TypeCheckFailCallback | Unset = unset,
-    collection_check_strategy: CollectionCheckStrategy | Unset = unset,
-    debug_instrumentation: bool | Unset = unset,
-) -> Any:
-    """
-    Instrument the target function to perform run-time type checking.
-
-    This decorator recompiles the target function, injecting code to type check
-    arguments, return values, yield values (excluding ``yield from``) and assignments to
-    annotated local variables.
-
-    This can also be used as a class decorator. This will instrument all type annotated
-    methods, including :func:`@classmethod `,
-    :func:`@staticmethod `,  and :class:`@property ` decorated
-    methods in the class.
-
-    .. note:: When Python is run in optimized mode (``-O`` or ``-OO``, this decorator
-        is a no-op). This is a feature meant for selectively introducing type checking
-        into a code base where the checks aren't meant to be run in production.
-
-    :param target: the function or class to enable type checking for
-    :param forward_ref_policy: override for
-        :attr:`.TypeCheckConfiguration.forward_ref_policy`
-    :param typecheck_fail_callback: override for
-        :attr:`.TypeCheckConfiguration.typecheck_fail_callback`
-    :param collection_check_strategy: override for
-        :attr:`.TypeCheckConfiguration.collection_check_strategy`
-    :param debug_instrumentation: override for
-        :attr:`.TypeCheckConfiguration.debug_instrumentation`
-
-    """
-    if target is None:
-        return partial(
-            typechecked,
-            forward_ref_policy=forward_ref_policy,
-            typecheck_fail_callback=typecheck_fail_callback,
-            collection_check_strategy=collection_check_strategy,
-            debug_instrumentation=debug_instrumentation,
-        )
-
-    if not __debug__:
-        return target
-
-    if isclass(target):
-        for key, attr in target.__dict__.items():
-            if is_method_of(attr, target):
-                retval = instrument(attr)
-                if isfunction(retval):
-                    setattr(target, key, retval)
-            elif isinstance(attr, (classmethod, staticmethod)):
-                if is_method_of(attr.__func__, target):
-                    retval = instrument(attr.__func__)
-                    if isfunction(retval):
-                        wrapper = attr.__class__(retval)
-                        setattr(target, key, wrapper)
-            elif isinstance(attr, property):
-                kwargs: dict[str, Any] = dict(doc=attr.__doc__)
-                for name in ("fset", "fget", "fdel"):
-                    property_func = kwargs[name] = getattr(attr, name)
-                    if is_method_of(property_func, target):
-                        retval = instrument(property_func)
-                        if isfunction(retval):
-                            kwargs[name] = retval
-
-                setattr(target, key, attr.__class__(**kwargs))
-
-        return target
-
-    # Find either the first Python wrapper or the actual function
-    wrapper_class: (
-        type[classmethod[Any, Any, Any]] | type[staticmethod[Any, Any]] | None
-    ) = None
-    if isinstance(target, (classmethod, staticmethod)):
-        wrapper_class = target.__class__
-        target = target.__func__
-
-    retval = instrument(target)
-    if isinstance(retval, str):
-        warn(
-            f"{retval} -- not typechecking {function_name(target)}",
-            InstrumentationWarning,
-            stacklevel=get_stacklevel(),
-        )
-        return target
-
-    if wrapper_class is None:
-        return retval
-    else:
-        return wrapper_class(retval)
diff --git a/pkg_resources/_vendor/typeguard/_exceptions.py b/pkg_resources/_vendor/typeguard/_exceptions.py
deleted file mode 100644
index 625437a649..0000000000
--- a/pkg_resources/_vendor/typeguard/_exceptions.py
+++ /dev/null
@@ -1,42 +0,0 @@
-from collections import deque
-from typing import Deque
-
-
-class TypeHintWarning(UserWarning):
-    """
-    A warning that is emitted when a type hint in string form could not be resolved to
-    an actual type.
-    """
-
-
-class TypeCheckWarning(UserWarning):
-    """Emitted by typeguard's type checkers when a type mismatch is detected."""
-
-    def __init__(self, message: str):
-        super().__init__(message)
-
-
-class InstrumentationWarning(UserWarning):
-    """Emitted when there's a problem with instrumenting a function for type checks."""
-
-    def __init__(self, message: str):
-        super().__init__(message)
-
-
-class TypeCheckError(Exception):
-    """
-    Raised by typeguard's type checkers when a type mismatch is detected.
-    """
-
-    def __init__(self, message: str):
-        super().__init__(message)
-        self._path: Deque[str] = deque()
-
-    def append_path_element(self, element: str) -> None:
-        self._path.append(element)
-
-    def __str__(self) -> str:
-        if self._path:
-            return " of ".join(self._path) + " " + str(self.args[0])
-        else:
-            return str(self.args[0])
diff --git a/pkg_resources/_vendor/typeguard/_functions.py b/pkg_resources/_vendor/typeguard/_functions.py
deleted file mode 100644
index 28497856a3..0000000000
--- a/pkg_resources/_vendor/typeguard/_functions.py
+++ /dev/null
@@ -1,308 +0,0 @@
-from __future__ import annotations
-
-import sys
-import warnings
-from typing import Any, Callable, NoReturn, TypeVar, Union, overload
-
-from . import _suppression
-from ._checkers import BINARY_MAGIC_METHODS, check_type_internal
-from ._config import (
-    CollectionCheckStrategy,
-    ForwardRefPolicy,
-    TypeCheckConfiguration,
-)
-from ._exceptions import TypeCheckError, TypeCheckWarning
-from ._memo import TypeCheckMemo
-from ._utils import get_stacklevel, qualified_name
-
-if sys.version_info >= (3, 11):
-    from typing import Literal, Never, TypeAlias
-else:
-    from typing_extensions import Literal, Never, TypeAlias
-
-T = TypeVar("T")
-TypeCheckFailCallback: TypeAlias = Callable[[TypeCheckError, TypeCheckMemo], Any]
-
-
-@overload
-def check_type(
-    value: object,
-    expected_type: type[T],
-    *,
-    forward_ref_policy: ForwardRefPolicy = ...,
-    typecheck_fail_callback: TypeCheckFailCallback | None = ...,
-    collection_check_strategy: CollectionCheckStrategy = ...,
-) -> T: ...
-
-
-@overload
-def check_type(
-    value: object,
-    expected_type: Any,
-    *,
-    forward_ref_policy: ForwardRefPolicy = ...,
-    typecheck_fail_callback: TypeCheckFailCallback | None = ...,
-    collection_check_strategy: CollectionCheckStrategy = ...,
-) -> Any: ...
-
-
-def check_type(
-    value: object,
-    expected_type: Any,
-    *,
-    forward_ref_policy: ForwardRefPolicy = TypeCheckConfiguration().forward_ref_policy,
-    typecheck_fail_callback: TypeCheckFailCallback | None = (
-        TypeCheckConfiguration().typecheck_fail_callback
-    ),
-    collection_check_strategy: CollectionCheckStrategy = (
-        TypeCheckConfiguration().collection_check_strategy
-    ),
-) -> Any:
-    """
-    Ensure that ``value`` matches ``expected_type``.
-
-    The types from the :mod:`typing` module do not support :func:`isinstance` or
-    :func:`issubclass` so a number of type specific checks are required. This function
-    knows which checker to call for which type.
-
-    This function wraps :func:`~.check_type_internal` in the following ways:
-
-    * Respects type checking suppression (:func:`~.suppress_type_checks`)
-    * Forms a :class:`~.TypeCheckMemo` from the current stack frame
-    * Calls the configured type check fail callback if the check fails
-
-    Note that this function is independent of the globally shared configuration in
-    :data:`typeguard.config`. This means that usage within libraries is safe from being
-    affected configuration changes made by other libraries or by the integrating
-    application. Instead, configuration options have the same default values as their
-    corresponding fields in :class:`TypeCheckConfiguration`.
-
-    :param value: value to be checked against ``expected_type``
-    :param expected_type: a class or generic type instance, or a tuple of such things
-    :param forward_ref_policy: see :attr:`TypeCheckConfiguration.forward_ref_policy`
-    :param typecheck_fail_callback:
-        see :attr`TypeCheckConfiguration.typecheck_fail_callback`
-    :param collection_check_strategy:
-        see :attr:`TypeCheckConfiguration.collection_check_strategy`
-    :return: ``value``, unmodified
-    :raises TypeCheckError: if there is a type mismatch
-
-    """
-    if type(expected_type) is tuple:
-        expected_type = Union[expected_type]
-
-    config = TypeCheckConfiguration(
-        forward_ref_policy=forward_ref_policy,
-        typecheck_fail_callback=typecheck_fail_callback,
-        collection_check_strategy=collection_check_strategy,
-    )
-
-    if _suppression.type_checks_suppressed or expected_type is Any:
-        return value
-
-    frame = sys._getframe(1)
-    memo = TypeCheckMemo(frame.f_globals, frame.f_locals, config=config)
-    try:
-        check_type_internal(value, expected_type, memo)
-    except TypeCheckError as exc:
-        exc.append_path_element(qualified_name(value, add_class_prefix=True))
-        if config.typecheck_fail_callback:
-            config.typecheck_fail_callback(exc, memo)
-        else:
-            raise
-
-    return value
-
-
-def check_argument_types(
-    func_name: str,
-    arguments: dict[str, tuple[Any, Any]],
-    memo: TypeCheckMemo,
-) -> Literal[True]:
-    if _suppression.type_checks_suppressed:
-        return True
-
-    for argname, (value, annotation) in arguments.items():
-        if annotation is NoReturn or annotation is Never:
-            exc = TypeCheckError(
-                f"{func_name}() was declared never to be called but it was"
-            )
-            if memo.config.typecheck_fail_callback:
-                memo.config.typecheck_fail_callback(exc, memo)
-            else:
-                raise exc
-
-        try:
-            check_type_internal(value, annotation, memo)
-        except TypeCheckError as exc:
-            qualname = qualified_name(value, add_class_prefix=True)
-            exc.append_path_element(f'argument "{argname}" ({qualname})')
-            if memo.config.typecheck_fail_callback:
-                memo.config.typecheck_fail_callback(exc, memo)
-            else:
-                raise
-
-    return True
-
-
-def check_return_type(
-    func_name: str,
-    retval: T,
-    annotation: Any,
-    memo: TypeCheckMemo,
-) -> T:
-    if _suppression.type_checks_suppressed:
-        return retval
-
-    if annotation is NoReturn or annotation is Never:
-        exc = TypeCheckError(f"{func_name}() was declared never to return but it did")
-        if memo.config.typecheck_fail_callback:
-            memo.config.typecheck_fail_callback(exc, memo)
-        else:
-            raise exc
-
-    try:
-        check_type_internal(retval, annotation, memo)
-    except TypeCheckError as exc:
-        # Allow NotImplemented if this is a binary magic method (__eq__() et al)
-        if retval is NotImplemented and annotation is bool:
-            # This does (and cannot) not check if it's actually a method
-            func_name = func_name.rsplit(".", 1)[-1]
-            if func_name in BINARY_MAGIC_METHODS:
-                return retval
-
-        qualname = qualified_name(retval, add_class_prefix=True)
-        exc.append_path_element(f"the return value ({qualname})")
-        if memo.config.typecheck_fail_callback:
-            memo.config.typecheck_fail_callback(exc, memo)
-        else:
-            raise
-
-    return retval
-
-
-def check_send_type(
-    func_name: str,
-    sendval: T,
-    annotation: Any,
-    memo: TypeCheckMemo,
-) -> T:
-    if _suppression.type_checks_suppressed:
-        return sendval
-
-    if annotation is NoReturn or annotation is Never:
-        exc = TypeCheckError(
-            f"{func_name}() was declared never to be sent a value to but it was"
-        )
-        if memo.config.typecheck_fail_callback:
-            memo.config.typecheck_fail_callback(exc, memo)
-        else:
-            raise exc
-
-    try:
-        check_type_internal(sendval, annotation, memo)
-    except TypeCheckError as exc:
-        qualname = qualified_name(sendval, add_class_prefix=True)
-        exc.append_path_element(f"the value sent to generator ({qualname})")
-        if memo.config.typecheck_fail_callback:
-            memo.config.typecheck_fail_callback(exc, memo)
-        else:
-            raise
-
-    return sendval
-
-
-def check_yield_type(
-    func_name: str,
-    yieldval: T,
-    annotation: Any,
-    memo: TypeCheckMemo,
-) -> T:
-    if _suppression.type_checks_suppressed:
-        return yieldval
-
-    if annotation is NoReturn or annotation is Never:
-        exc = TypeCheckError(f"{func_name}() was declared never to yield but it did")
-        if memo.config.typecheck_fail_callback:
-            memo.config.typecheck_fail_callback(exc, memo)
-        else:
-            raise exc
-
-    try:
-        check_type_internal(yieldval, annotation, memo)
-    except TypeCheckError as exc:
-        qualname = qualified_name(yieldval, add_class_prefix=True)
-        exc.append_path_element(f"the yielded value ({qualname})")
-        if memo.config.typecheck_fail_callback:
-            memo.config.typecheck_fail_callback(exc, memo)
-        else:
-            raise
-
-    return yieldval
-
-
-def check_variable_assignment(
-    value: object, varname: str, annotation: Any, memo: TypeCheckMemo
-) -> Any:
-    if _suppression.type_checks_suppressed:
-        return value
-
-    try:
-        check_type_internal(value, annotation, memo)
-    except TypeCheckError as exc:
-        qualname = qualified_name(value, add_class_prefix=True)
-        exc.append_path_element(f"value assigned to {varname} ({qualname})")
-        if memo.config.typecheck_fail_callback:
-            memo.config.typecheck_fail_callback(exc, memo)
-        else:
-            raise
-
-    return value
-
-
-def check_multi_variable_assignment(
-    value: Any, targets: list[dict[str, Any]], memo: TypeCheckMemo
-) -> Any:
-    if max(len(target) for target in targets) == 1:
-        iterated_values = [value]
-    else:
-        iterated_values = list(value)
-
-    if not _suppression.type_checks_suppressed:
-        for expected_types in targets:
-            value_index = 0
-            for ann_index, (varname, expected_type) in enumerate(
-                expected_types.items()
-            ):
-                if varname.startswith("*"):
-                    varname = varname[1:]
-                    keys_left = len(expected_types) - 1 - ann_index
-                    next_value_index = len(iterated_values) - keys_left
-                    obj: object = iterated_values[value_index:next_value_index]
-                    value_index = next_value_index
-                else:
-                    obj = iterated_values[value_index]
-                    value_index += 1
-
-                try:
-                    check_type_internal(obj, expected_type, memo)
-                except TypeCheckError as exc:
-                    qualname = qualified_name(obj, add_class_prefix=True)
-                    exc.append_path_element(f"value assigned to {varname} ({qualname})")
-                    if memo.config.typecheck_fail_callback:
-                        memo.config.typecheck_fail_callback(exc, memo)
-                    else:
-                        raise
-
-    return iterated_values[0] if len(iterated_values) == 1 else iterated_values
-
-
-def warn_on_error(exc: TypeCheckError, memo: TypeCheckMemo) -> None:
-    """
-    Emit a warning on a type mismatch.
-
-    This is intended to be used as an error handler in
-    :attr:`TypeCheckConfiguration.typecheck_fail_callback`.
-
-    """
-    warnings.warn(TypeCheckWarning(str(exc)), stacklevel=get_stacklevel())
diff --git a/pkg_resources/_vendor/typeguard/_importhook.py b/pkg_resources/_vendor/typeguard/_importhook.py
deleted file mode 100644
index 8590540a5a..0000000000
--- a/pkg_resources/_vendor/typeguard/_importhook.py
+++ /dev/null
@@ -1,213 +0,0 @@
-from __future__ import annotations
-
-import ast
-import sys
-import types
-from collections.abc import Callable, Iterable
-from importlib.abc import MetaPathFinder
-from importlib.machinery import ModuleSpec, SourceFileLoader
-from importlib.util import cache_from_source, decode_source
-from inspect import isclass
-from os import PathLike
-from types import CodeType, ModuleType, TracebackType
-from typing import Sequence, TypeVar
-from unittest.mock import patch
-
-from ._config import global_config
-from ._transformer import TypeguardTransformer
-
-if sys.version_info >= (3, 12):
-    from collections.abc import Buffer
-else:
-    from typing_extensions import Buffer
-
-if sys.version_info >= (3, 11):
-    from typing import ParamSpec
-else:
-    from typing_extensions import ParamSpec
-
-if sys.version_info >= (3, 10):
-    from importlib.metadata import PackageNotFoundError, version
-else:
-    from importlib_metadata import PackageNotFoundError, version
-
-try:
-    OPTIMIZATION = "typeguard" + "".join(version("typeguard").split(".")[:3])
-except PackageNotFoundError:
-    OPTIMIZATION = "typeguard"
-
-P = ParamSpec("P")
-T = TypeVar("T")
-
-
-# The name of this function is magical
-def _call_with_frames_removed(
-    f: Callable[P, T], *args: P.args, **kwargs: P.kwargs
-) -> T:
-    return f(*args, **kwargs)
-
-
-def optimized_cache_from_source(path: str, debug_override: bool | None = None) -> str:
-    return cache_from_source(path, debug_override, optimization=OPTIMIZATION)
-
-
-class TypeguardLoader(SourceFileLoader):
-    @staticmethod
-    def source_to_code(
-        data: Buffer | str | ast.Module | ast.Expression | ast.Interactive,
-        path: Buffer | str | PathLike[str] = "",
-    ) -> CodeType:
-        if isinstance(data, (ast.Module, ast.Expression, ast.Interactive)):
-            tree = data
-        else:
-            if isinstance(data, str):
-                source = data
-            else:
-                source = decode_source(data)
-
-            tree = _call_with_frames_removed(
-                ast.parse,
-                source,
-                path,
-                "exec",
-            )
-
-        tree = TypeguardTransformer().visit(tree)
-        ast.fix_missing_locations(tree)
-
-        if global_config.debug_instrumentation and sys.version_info >= (3, 9):
-            print(
-                f"Source code of {path!r} after instrumentation:\n"
-                "----------------------------------------------",
-                file=sys.stderr,
-            )
-            print(ast.unparse(tree), file=sys.stderr)
-            print("----------------------------------------------", file=sys.stderr)
-
-        return _call_with_frames_removed(
-            compile, tree, path, "exec", 0, dont_inherit=True
-        )
-
-    def exec_module(self, module: ModuleType) -> None:
-        # Use a custom optimization marker – the import lock should make this monkey
-        # patch safe
-        with patch(
-            "importlib._bootstrap_external.cache_from_source",
-            optimized_cache_from_source,
-        ):
-            super().exec_module(module)
-
-
-class TypeguardFinder(MetaPathFinder):
-    """
-    Wraps another path finder and instruments the module with
-    :func:`@typechecked ` if :meth:`should_instrument` returns
-    ``True``.
-
-    Should not be used directly, but rather via :func:`~.install_import_hook`.
-
-    .. versionadded:: 2.6
-    """
-
-    def __init__(self, packages: list[str] | None, original_pathfinder: MetaPathFinder):
-        self.packages = packages
-        self._original_pathfinder = original_pathfinder
-
-    def find_spec(
-        self,
-        fullname: str,
-        path: Sequence[str] | None,
-        target: types.ModuleType | None = None,
-    ) -> ModuleSpec | None:
-        if self.should_instrument(fullname):
-            spec = self._original_pathfinder.find_spec(fullname, path, target)
-            if spec is not None and isinstance(spec.loader, SourceFileLoader):
-                spec.loader = TypeguardLoader(spec.loader.name, spec.loader.path)
-                return spec
-
-        return None
-
-    def should_instrument(self, module_name: str) -> bool:
-        """
-        Determine whether the module with the given name should be instrumented.
-
-        :param module_name: full name of the module that is about to be imported (e.g.
-            ``xyz.abc``)
-
-        """
-        if self.packages is None:
-            return True
-
-        for package in self.packages:
-            if module_name == package or module_name.startswith(package + "."):
-                return True
-
-        return False
-
-
-class ImportHookManager:
-    """
-    A handle that can be used to uninstall the Typeguard import hook.
-    """
-
-    def __init__(self, hook: MetaPathFinder):
-        self.hook = hook
-
-    def __enter__(self) -> None:
-        pass
-
-    def __exit__(
-        self,
-        exc_type: type[BaseException],
-        exc_val: BaseException,
-        exc_tb: TracebackType,
-    ) -> None:
-        self.uninstall()
-
-    def uninstall(self) -> None:
-        """Uninstall the import hook."""
-        try:
-            sys.meta_path.remove(self.hook)
-        except ValueError:
-            pass  # already removed
-
-
-def install_import_hook(
-    packages: Iterable[str] | None = None,
-    *,
-    cls: type[TypeguardFinder] = TypeguardFinder,
-) -> ImportHookManager:
-    """
-    Install an import hook that instruments functions for automatic type checking.
-
-    This only affects modules loaded **after** this hook has been installed.
-
-    :param packages: an iterable of package names to instrument, or ``None`` to
-        instrument all packages
-    :param cls: a custom meta path finder class
-    :return: a context manager that uninstalls the hook on exit (or when you call
-        ``.uninstall()``)
-
-    .. versionadded:: 2.6
-
-    """
-    if packages is None:
-        target_packages: list[str] | None = None
-    elif isinstance(packages, str):
-        target_packages = [packages]
-    else:
-        target_packages = list(packages)
-
-    for finder in sys.meta_path:
-        if (
-            isclass(finder)
-            and finder.__name__ == "PathFinder"
-            and hasattr(finder, "find_spec")
-        ):
-            break
-    else:
-        raise RuntimeError("Cannot find a PathFinder in sys.meta_path")
-
-    hook = cls(target_packages, finder)
-    sys.meta_path.insert(0, hook)
-    return ImportHookManager(hook)
diff --git a/pkg_resources/_vendor/typeguard/_memo.py b/pkg_resources/_vendor/typeguard/_memo.py
deleted file mode 100644
index 1d0d80c66d..0000000000
--- a/pkg_resources/_vendor/typeguard/_memo.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from __future__ import annotations
-
-from typing import Any
-
-from typeguard._config import TypeCheckConfiguration, global_config
-
-
-class TypeCheckMemo:
-    """
-    Contains information necessary for type checkers to do their work.
-
-    .. attribute:: globals
-       :type: dict[str, Any]
-
-        Dictionary of global variables to use for resolving forward references.
-
-    .. attribute:: locals
-       :type: dict[str, Any]
-
-        Dictionary of local variables to use for resolving forward references.
-
-    .. attribute:: self_type
-       :type: type | None
-
-        When running type checks within an instance method or class method, this is the
-        class object that the first argument (usually named ``self`` or ``cls``) refers
-        to.
-
-    .. attribute:: config
-       :type: TypeCheckConfiguration
-
-         Contains the configuration for a particular set of type checking operations.
-    """
-
-    __slots__ = "globals", "locals", "self_type", "config"
-
-    def __init__(
-        self,
-        globals: dict[str, Any],
-        locals: dict[str, Any],
-        *,
-        self_type: type | None = None,
-        config: TypeCheckConfiguration = global_config,
-    ):
-        self.globals = globals
-        self.locals = locals
-        self.self_type = self_type
-        self.config = config
diff --git a/pkg_resources/_vendor/typeguard/_pytest_plugin.py b/pkg_resources/_vendor/typeguard/_pytest_plugin.py
deleted file mode 100644
index 7b2f494ec7..0000000000
--- a/pkg_resources/_vendor/typeguard/_pytest_plugin.py
+++ /dev/null
@@ -1,127 +0,0 @@
-from __future__ import annotations
-
-import sys
-import warnings
-from typing import TYPE_CHECKING, Any, Literal
-
-from typeguard._config import CollectionCheckStrategy, ForwardRefPolicy, global_config
-from typeguard._exceptions import InstrumentationWarning
-from typeguard._importhook import install_import_hook
-from typeguard._utils import qualified_name, resolve_reference
-
-if TYPE_CHECKING:
-    from pytest import Config, Parser
-
-
-def pytest_addoption(parser: Parser) -> None:
-    def add_ini_option(
-        opt_type: (
-            Literal["string", "paths", "pathlist", "args", "linelist", "bool"] | None
-        ),
-    ) -> None:
-        parser.addini(
-            group.options[-1].names()[0][2:],
-            group.options[-1].attrs()["help"],
-            opt_type,
-        )
-
-    group = parser.getgroup("typeguard")
-    group.addoption(
-        "--typeguard-packages",
-        action="store",
-        help="comma separated name list of packages and modules to instrument for "
-        "type checking, or :all: to instrument all modules loaded after typeguard",
-    )
-    add_ini_option("linelist")
-
-    group.addoption(
-        "--typeguard-debug-instrumentation",
-        action="store_true",
-        help="print all instrumented code to stderr",
-    )
-    add_ini_option("bool")
-
-    group.addoption(
-        "--typeguard-typecheck-fail-callback",
-        action="store",
-        help=(
-            "a module:varname (e.g. typeguard:warn_on_error) reference to a function "
-            "that is called (with the exception, and memo object as arguments) to "
-            "handle a TypeCheckError"
-        ),
-    )
-    add_ini_option("string")
-
-    group.addoption(
-        "--typeguard-forward-ref-policy",
-        action="store",
-        choices=list(ForwardRefPolicy.__members__),
-        help=(
-            "determines how to deal with unresolveable forward references in type "
-            "annotations"
-        ),
-    )
-    add_ini_option("string")
-
-    group.addoption(
-        "--typeguard-collection-check-strategy",
-        action="store",
-        choices=list(CollectionCheckStrategy.__members__),
-        help="determines how thoroughly to check collections (list, dict, etc)",
-    )
-    add_ini_option("string")
-
-
-def pytest_configure(config: Config) -> None:
-    def getoption(name: str) -> Any:
-        return config.getoption(name.replace("-", "_")) or config.getini(name)
-
-    packages: list[str] | None = []
-    if packages_option := config.getoption("typeguard_packages"):
-        packages = [pkg.strip() for pkg in packages_option.split(",")]
-    elif packages_ini := config.getini("typeguard-packages"):
-        packages = packages_ini
-
-    if packages:
-        if packages == [":all:"]:
-            packages = None
-        else:
-            already_imported_packages = sorted(
-                package for package in packages if package in sys.modules
-            )
-            if already_imported_packages:
-                warnings.warn(
-                    f"typeguard cannot check these packages because they are already "
-                    f"imported: {', '.join(already_imported_packages)}",
-                    InstrumentationWarning,
-                    stacklevel=1,
-                )
-
-        install_import_hook(packages=packages)
-
-    debug_option = getoption("typeguard-debug-instrumentation")
-    if debug_option:
-        global_config.debug_instrumentation = True
-
-    fail_callback_option = getoption("typeguard-typecheck-fail-callback")
-    if fail_callback_option:
-        callback = resolve_reference(fail_callback_option)
-        if not callable(callback):
-            raise TypeError(
-                f"{fail_callback_option} ({qualified_name(callback.__class__)}) is not "
-                f"a callable"
-            )
-
-        global_config.typecheck_fail_callback = callback
-
-    forward_ref_policy_option = getoption("typeguard-forward-ref-policy")
-    if forward_ref_policy_option:
-        forward_ref_policy = ForwardRefPolicy.__members__[forward_ref_policy_option]
-        global_config.forward_ref_policy = forward_ref_policy
-
-    collection_check_strategy_option = getoption("typeguard-collection-check-strategy")
-    if collection_check_strategy_option:
-        collection_check_strategy = CollectionCheckStrategy.__members__[
-            collection_check_strategy_option
-        ]
-        global_config.collection_check_strategy = collection_check_strategy
diff --git a/pkg_resources/_vendor/typeguard/_suppression.py b/pkg_resources/_vendor/typeguard/_suppression.py
deleted file mode 100644
index bbbfbfbe8e..0000000000
--- a/pkg_resources/_vendor/typeguard/_suppression.py
+++ /dev/null
@@ -1,86 +0,0 @@
-from __future__ import annotations
-
-import sys
-from collections.abc import Callable, Generator
-from contextlib import contextmanager
-from functools import update_wrapper
-from threading import Lock
-from typing import ContextManager, TypeVar, overload
-
-if sys.version_info >= (3, 10):
-    from typing import ParamSpec
-else:
-    from typing_extensions import ParamSpec
-
-P = ParamSpec("P")
-T = TypeVar("T")
-
-type_checks_suppressed = 0
-type_checks_suppress_lock = Lock()
-
-
-@overload
-def suppress_type_checks(func: Callable[P, T]) -> Callable[P, T]: ...
-
-
-@overload
-def suppress_type_checks() -> ContextManager[None]: ...
-
-
-def suppress_type_checks(
-    func: Callable[P, T] | None = None,
-) -> Callable[P, T] | ContextManager[None]:
-    """
-    Temporarily suppress all type checking.
-
-    This function has two operating modes, based on how it's used:
-
-    #. as a context manager (``with suppress_type_checks(): ...``)
-    #. as a decorator (``@suppress_type_checks``)
-
-    When used as a context manager, :func:`check_type` and any automatically
-    instrumented functions skip the actual type checking. These context managers can be
-    nested.
-
-    When used as a decorator, all type checking is suppressed while the function is
-    running.
-
-    Type checking will resume once no more context managers are active and no decorated
-    functions are running.
-
-    Both operating modes are thread-safe.
-
-    """
-
-    def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
-        global type_checks_suppressed
-
-        with type_checks_suppress_lock:
-            type_checks_suppressed += 1
-
-        assert func is not None
-        try:
-            return func(*args, **kwargs)
-        finally:
-            with type_checks_suppress_lock:
-                type_checks_suppressed -= 1
-
-    def cm() -> Generator[None, None, None]:
-        global type_checks_suppressed
-
-        with type_checks_suppress_lock:
-            type_checks_suppressed += 1
-
-        try:
-            yield
-        finally:
-            with type_checks_suppress_lock:
-                type_checks_suppressed -= 1
-
-    if func is None:
-        # Context manager mode
-        return contextmanager(cm)()
-    else:
-        # Decorator mode
-        update_wrapper(wrapper, func)
-        return wrapper
diff --git a/pkg_resources/_vendor/typeguard/_transformer.py b/pkg_resources/_vendor/typeguard/_transformer.py
deleted file mode 100644
index 13ac3630e6..0000000000
--- a/pkg_resources/_vendor/typeguard/_transformer.py
+++ /dev/null
@@ -1,1229 +0,0 @@
-from __future__ import annotations
-
-import ast
-import builtins
-import sys
-import typing
-from ast import (
-    AST,
-    Add,
-    AnnAssign,
-    Assign,
-    AsyncFunctionDef,
-    Attribute,
-    AugAssign,
-    BinOp,
-    BitAnd,
-    BitOr,
-    BitXor,
-    Call,
-    ClassDef,
-    Constant,
-    Dict,
-    Div,
-    Expr,
-    Expression,
-    FloorDiv,
-    FunctionDef,
-    If,
-    Import,
-    ImportFrom,
-    Index,
-    List,
-    Load,
-    LShift,
-    MatMult,
-    Mod,
-    Module,
-    Mult,
-    Name,
-    NamedExpr,
-    NodeTransformer,
-    NodeVisitor,
-    Pass,
-    Pow,
-    Return,
-    RShift,
-    Starred,
-    Store,
-    Sub,
-    Subscript,
-    Tuple,
-    Yield,
-    YieldFrom,
-    alias,
-    copy_location,
-    expr,
-    fix_missing_locations,
-    keyword,
-    walk,
-)
-from collections import defaultdict
-from collections.abc import Generator, Sequence
-from contextlib import contextmanager
-from copy import deepcopy
-from dataclasses import dataclass, field
-from typing import Any, ClassVar, cast, overload
-
-generator_names = (
-    "typing.Generator",
-    "collections.abc.Generator",
-    "typing.Iterator",
-    "collections.abc.Iterator",
-    "typing.Iterable",
-    "collections.abc.Iterable",
-    "typing.AsyncIterator",
-    "collections.abc.AsyncIterator",
-    "typing.AsyncIterable",
-    "collections.abc.AsyncIterable",
-    "typing.AsyncGenerator",
-    "collections.abc.AsyncGenerator",
-)
-anytype_names = (
-    "typing.Any",
-    "typing_extensions.Any",
-)
-literal_names = (
-    "typing.Literal",
-    "typing_extensions.Literal",
-)
-annotated_names = (
-    "typing.Annotated",
-    "typing_extensions.Annotated",
-)
-ignore_decorators = (
-    "typing.no_type_check",
-    "typeguard.typeguard_ignore",
-)
-aug_assign_functions = {
-    Add: "iadd",
-    Sub: "isub",
-    Mult: "imul",
-    MatMult: "imatmul",
-    Div: "itruediv",
-    FloorDiv: "ifloordiv",
-    Mod: "imod",
-    Pow: "ipow",
-    LShift: "ilshift",
-    RShift: "irshift",
-    BitAnd: "iand",
-    BitXor: "ixor",
-    BitOr: "ior",
-}
-
-
-@dataclass
-class TransformMemo:
-    node: Module | ClassDef | FunctionDef | AsyncFunctionDef | None
-    parent: TransformMemo | None
-    path: tuple[str, ...]
-    joined_path: Constant = field(init=False)
-    return_annotation: expr | None = None
-    yield_annotation: expr | None = None
-    send_annotation: expr | None = None
-    is_async: bool = False
-    local_names: set[str] = field(init=False, default_factory=set)
-    imported_names: dict[str, str] = field(init=False, default_factory=dict)
-    ignored_names: set[str] = field(init=False, default_factory=set)
-    load_names: defaultdict[str, dict[str, Name]] = field(
-        init=False, default_factory=lambda: defaultdict(dict)
-    )
-    has_yield_expressions: bool = field(init=False, default=False)
-    has_return_expressions: bool = field(init=False, default=False)
-    memo_var_name: Name | None = field(init=False, default=None)
-    should_instrument: bool = field(init=False, default=True)
-    variable_annotations: dict[str, expr] = field(init=False, default_factory=dict)
-    configuration_overrides: dict[str, Any] = field(init=False, default_factory=dict)
-    code_inject_index: int = field(init=False, default=0)
-
-    def __post_init__(self) -> None:
-        elements: list[str] = []
-        memo = self
-        while isinstance(memo.node, (ClassDef, FunctionDef, AsyncFunctionDef)):
-            elements.insert(0, memo.node.name)
-            if not memo.parent:
-                break
-
-            memo = memo.parent
-            if isinstance(memo.node, (FunctionDef, AsyncFunctionDef)):
-                elements.insert(0, "")
-
-        self.joined_path = Constant(".".join(elements))
-
-        # Figure out where to insert instrumentation code
-        if self.node:
-            for index, child in enumerate(self.node.body):
-                if isinstance(child, ImportFrom) and child.module == "__future__":
-                    # (module only) __future__ imports must come first
-                    continue
-                elif (
-                    isinstance(child, Expr)
-                    and isinstance(child.value, Constant)
-                    and isinstance(child.value.value, str)
-                ):
-                    continue  # docstring
-
-                self.code_inject_index = index
-                break
-
-    def get_unused_name(self, name: str) -> str:
-        memo: TransformMemo | None = self
-        while memo is not None:
-            if name in memo.local_names:
-                memo = self
-                name += "_"
-            else:
-                memo = memo.parent
-
-        self.local_names.add(name)
-        return name
-
-    def is_ignored_name(self, expression: expr | Expr | None) -> bool:
-        top_expression = (
-            expression.value if isinstance(expression, Expr) else expression
-        )
-
-        if isinstance(top_expression, Attribute) and isinstance(
-            top_expression.value, Name
-        ):
-            name = top_expression.value.id
-        elif isinstance(top_expression, Name):
-            name = top_expression.id
-        else:
-            return False
-
-        memo: TransformMemo | None = self
-        while memo is not None:
-            if name in memo.ignored_names:
-                return True
-
-            memo = memo.parent
-
-        return False
-
-    def get_memo_name(self) -> Name:
-        if not self.memo_var_name:
-            self.memo_var_name = Name(id="memo", ctx=Load())
-
-        return self.memo_var_name
-
-    def get_import(self, module: str, name: str) -> Name:
-        if module in self.load_names and name in self.load_names[module]:
-            return self.load_names[module][name]
-
-        qualified_name = f"{module}.{name}"
-        if name in self.imported_names and self.imported_names[name] == qualified_name:
-            return Name(id=name, ctx=Load())
-
-        alias = self.get_unused_name(name)
-        node = self.load_names[module][name] = Name(id=alias, ctx=Load())
-        self.imported_names[name] = qualified_name
-        return node
-
-    def insert_imports(self, node: Module | FunctionDef | AsyncFunctionDef) -> None:
-        """Insert imports needed by injected code."""
-        if not self.load_names:
-            return
-
-        # Insert imports after any "from __future__ ..." imports and any docstring
-        for modulename, names in self.load_names.items():
-            aliases = [
-                alias(orig_name, new_name.id if orig_name != new_name.id else None)
-                for orig_name, new_name in sorted(names.items())
-            ]
-            node.body.insert(self.code_inject_index, ImportFrom(modulename, aliases, 0))
-
-    def name_matches(self, expression: expr | Expr | None, *names: str) -> bool:
-        if expression is None:
-            return False
-
-        path: list[str] = []
-        top_expression = (
-            expression.value if isinstance(expression, Expr) else expression
-        )
-
-        if isinstance(top_expression, Subscript):
-            top_expression = top_expression.value
-        elif isinstance(top_expression, Call):
-            top_expression = top_expression.func
-
-        while isinstance(top_expression, Attribute):
-            path.insert(0, top_expression.attr)
-            top_expression = top_expression.value
-
-        if not isinstance(top_expression, Name):
-            return False
-
-        if top_expression.id in self.imported_names:
-            translated = self.imported_names[top_expression.id]
-        elif hasattr(builtins, top_expression.id):
-            translated = "builtins." + top_expression.id
-        else:
-            translated = top_expression.id
-
-        path.insert(0, translated)
-        joined_path = ".".join(path)
-        if joined_path in names:
-            return True
-        elif self.parent:
-            return self.parent.name_matches(expression, *names)
-        else:
-            return False
-
-    def get_config_keywords(self) -> list[keyword]:
-        if self.parent and isinstance(self.parent.node, ClassDef):
-            overrides = self.parent.configuration_overrides.copy()
-        else:
-            overrides = {}
-
-        overrides.update(self.configuration_overrides)
-        return [keyword(key, value) for key, value in overrides.items()]
-
-
-class NameCollector(NodeVisitor):
-    def __init__(self) -> None:
-        self.names: set[str] = set()
-
-    def visit_Import(self, node: Import) -> None:
-        for name in node.names:
-            self.names.add(name.asname or name.name)
-
-    def visit_ImportFrom(self, node: ImportFrom) -> None:
-        for name in node.names:
-            self.names.add(name.asname or name.name)
-
-    def visit_Assign(self, node: Assign) -> None:
-        for target in node.targets:
-            if isinstance(target, Name):
-                self.names.add(target.id)
-
-    def visit_NamedExpr(self, node: NamedExpr) -> Any:
-        if isinstance(node.target, Name):
-            self.names.add(node.target.id)
-
-    def visit_FunctionDef(self, node: FunctionDef) -> None:
-        pass
-
-    def visit_ClassDef(self, node: ClassDef) -> None:
-        pass
-
-
-class GeneratorDetector(NodeVisitor):
-    """Detects if a function node is a generator function."""
-
-    contains_yields: bool = False
-    in_root_function: bool = False
-
-    def visit_Yield(self, node: Yield) -> Any:
-        self.contains_yields = True
-
-    def visit_YieldFrom(self, node: YieldFrom) -> Any:
-        self.contains_yields = True
-
-    def visit_ClassDef(self, node: ClassDef) -> Any:
-        pass
-
-    def visit_FunctionDef(self, node: FunctionDef | AsyncFunctionDef) -> Any:
-        if not self.in_root_function:
-            self.in_root_function = True
-            self.generic_visit(node)
-            self.in_root_function = False
-
-    def visit_AsyncFunctionDef(self, node: AsyncFunctionDef) -> Any:
-        self.visit_FunctionDef(node)
-
-
-class AnnotationTransformer(NodeTransformer):
-    type_substitutions: ClassVar[dict[str, tuple[str, str]]] = {
-        "builtins.dict": ("typing", "Dict"),
-        "builtins.list": ("typing", "List"),
-        "builtins.tuple": ("typing", "Tuple"),
-        "builtins.set": ("typing", "Set"),
-        "builtins.frozenset": ("typing", "FrozenSet"),
-    }
-
-    def __init__(self, transformer: TypeguardTransformer):
-        self.transformer = transformer
-        self._memo = transformer._memo
-        self._level = 0
-
-    def visit(self, node: AST) -> Any:
-        # Don't process Literals
-        if isinstance(node, expr) and self._memo.name_matches(node, *literal_names):
-            return node
-
-        self._level += 1
-        new_node = super().visit(node)
-        self._level -= 1
-
-        if isinstance(new_node, Expression) and not hasattr(new_node, "body"):
-            return None
-
-        # Return None if this new node matches a variation of typing.Any
-        if (
-            self._level == 0
-            and isinstance(new_node, expr)
-            and self._memo.name_matches(new_node, *anytype_names)
-        ):
-            return None
-
-        return new_node
-
-    def visit_BinOp(self, node: BinOp) -> Any:
-        self.generic_visit(node)
-
-        if isinstance(node.op, BitOr):
-            # If either branch of the BinOp has been transformed to `None`, it means
-            # that a type in the union was ignored, so the entire annotation should e
-            # ignored
-            if not hasattr(node, "left") or not hasattr(node, "right"):
-                return None
-
-            # Return Any if either side is Any
-            if self._memo.name_matches(node.left, *anytype_names):
-                return node.left
-            elif self._memo.name_matches(node.right, *anytype_names):
-                return node.right
-
-            if sys.version_info < (3, 10):
-                union_name = self.transformer._get_import("typing", "Union")
-                return Subscript(
-                    value=union_name,
-                    slice=Index(
-                        Tuple(elts=[node.left, node.right], ctx=Load()), ctx=Load()
-                    ),
-                    ctx=Load(),
-                )
-
-        return node
-
-    def visit_Attribute(self, node: Attribute) -> Any:
-        if self._memo.is_ignored_name(node):
-            return None
-
-        return node
-
-    def visit_Subscript(self, node: Subscript) -> Any:
-        if self._memo.is_ignored_name(node.value):
-            return None
-
-        # The subscript of typing(_extensions).Literal can be any arbitrary string, so
-        # don't try to evaluate it as code
-        if node.slice:
-            if isinstance(node.slice, Index):
-                # Python 3.8
-                slice_value = node.slice.value  # type: ignore[attr-defined]
-            else:
-                slice_value = node.slice
-
-            if isinstance(slice_value, Tuple):
-                if self._memo.name_matches(node.value, *annotated_names):
-                    # Only treat the first argument to typing.Annotated as a potential
-                    # forward reference
-                    items = cast(
-                        typing.List[expr],
-                        [self.visit(slice_value.elts[0])] + slice_value.elts[1:],
-                    )
-                else:
-                    items = cast(
-                        typing.List[expr],
-                        [self.visit(item) for item in slice_value.elts],
-                    )
-
-                # If this is a Union and any of the items is Any, erase the entire
-                # annotation
-                if self._memo.name_matches(node.value, "typing.Union") and any(
-                    item is None
-                    or (
-                        isinstance(item, expr)
-                        and self._memo.name_matches(item, *anytype_names)
-                    )
-                    for item in items
-                ):
-                    return None
-
-                # If all items in the subscript were Any, erase the subscript entirely
-                if all(item is None for item in items):
-                    return node.value
-
-                for index, item in enumerate(items):
-                    if item is None:
-                        items[index] = self.transformer._get_import("typing", "Any")
-
-                slice_value.elts = items
-            else:
-                self.generic_visit(node)
-
-                # If the transformer erased the slice entirely, just return the node
-                # value without the subscript (unless it's Optional, in which case erase
-                # the node entirely
-                if self._memo.name_matches(
-                    node.value, "typing.Optional"
-                ) and not hasattr(node, "slice"):
-                    return None
-                if sys.version_info >= (3, 9) and not hasattr(node, "slice"):
-                    return node.value
-                elif sys.version_info < (3, 9) and not hasattr(node.slice, "value"):
-                    return node.value
-
-        return node
-
-    def visit_Name(self, node: Name) -> Any:
-        if self._memo.is_ignored_name(node):
-            return None
-
-        if sys.version_info < (3, 9):
-            for typename, substitute in self.type_substitutions.items():
-                if self._memo.name_matches(node, typename):
-                    new_node = self.transformer._get_import(*substitute)
-                    return copy_location(new_node, node)
-
-        return node
-
-    def visit_Call(self, node: Call) -> Any:
-        # Don't recurse into calls
-        return node
-
-    def visit_Constant(self, node: Constant) -> Any:
-        if isinstance(node.value, str):
-            expression = ast.parse(node.value, mode="eval")
-            new_node = self.visit(expression)
-            if new_node:
-                return copy_location(new_node.body, node)
-            else:
-                return None
-
-        return node
-
-
-class TypeguardTransformer(NodeTransformer):
-    def __init__(
-        self, target_path: Sequence[str] | None = None, target_lineno: int | None = None
-    ) -> None:
-        self._target_path = tuple(target_path) if target_path else None
-        self._memo = self._module_memo = TransformMemo(None, None, ())
-        self.names_used_in_annotations: set[str] = set()
-        self.target_node: FunctionDef | AsyncFunctionDef | None = None
-        self.target_lineno = target_lineno
-
-    def generic_visit(self, node: AST) -> AST:
-        has_non_empty_body_initially = bool(getattr(node, "body", None))
-        initial_type = type(node)
-
-        node = super().generic_visit(node)
-
-        if (
-            type(node) is initial_type
-            and has_non_empty_body_initially
-            and hasattr(node, "body")
-            and not node.body
-        ):
-            # If we have still the same node type after transformation
-            # but we've optimised it's body away, we add a `pass` statement.
-            node.body = [Pass()]
-
-        return node
-
-    @contextmanager
-    def _use_memo(
-        self, node: ClassDef | FunctionDef | AsyncFunctionDef
-    ) -> Generator[None, Any, None]:
-        new_memo = TransformMemo(node, self._memo, self._memo.path + (node.name,))
-        old_memo = self._memo
-        self._memo = new_memo
-
-        if isinstance(node, (FunctionDef, AsyncFunctionDef)):
-            new_memo.should_instrument = (
-                self._target_path is None or new_memo.path == self._target_path
-            )
-            if new_memo.should_instrument:
-                # Check if the function is a generator function
-                detector = GeneratorDetector()
-                detector.visit(node)
-
-                # Extract yield, send and return types where possible from a subscripted
-                # annotation like Generator[int, str, bool]
-                return_annotation = deepcopy(node.returns)
-                if detector.contains_yields and new_memo.name_matches(
-                    return_annotation, *generator_names
-                ):
-                    if isinstance(return_annotation, Subscript):
-                        annotation_slice = return_annotation.slice
-
-                        # Python < 3.9
-                        if isinstance(annotation_slice, Index):
-                            annotation_slice = (
-                                annotation_slice.value  # type: ignore[attr-defined]
-                            )
-
-                        if isinstance(annotation_slice, Tuple):
-                            items = annotation_slice.elts
-                        else:
-                            items = [annotation_slice]
-
-                        if len(items) > 0:
-                            new_memo.yield_annotation = self._convert_annotation(
-                                items[0]
-                            )
-
-                        if len(items) > 1:
-                            new_memo.send_annotation = self._convert_annotation(
-                                items[1]
-                            )
-
-                        if len(items) > 2:
-                            new_memo.return_annotation = self._convert_annotation(
-                                items[2]
-                            )
-                else:
-                    new_memo.return_annotation = self._convert_annotation(
-                        return_annotation
-                    )
-
-        if isinstance(node, AsyncFunctionDef):
-            new_memo.is_async = True
-
-        yield
-        self._memo = old_memo
-
-    def _get_import(self, module: str, name: str) -> Name:
-        memo = self._memo if self._target_path else self._module_memo
-        return memo.get_import(module, name)
-
-    @overload
-    def _convert_annotation(self, annotation: None) -> None: ...
-
-    @overload
-    def _convert_annotation(self, annotation: expr) -> expr: ...
-
-    def _convert_annotation(self, annotation: expr | None) -> expr | None:
-        if annotation is None:
-            return None
-
-        # Convert PEP 604 unions (x | y) and generic built-in collections where
-        # necessary, and undo forward references
-        new_annotation = cast(expr, AnnotationTransformer(self).visit(annotation))
-        if isinstance(new_annotation, expr):
-            new_annotation = ast.copy_location(new_annotation, annotation)
-
-            # Store names used in the annotation
-            names = {node.id for node in walk(new_annotation) if isinstance(node, Name)}
-            self.names_used_in_annotations.update(names)
-
-        return new_annotation
-
-    def visit_Name(self, node: Name) -> Name:
-        self._memo.local_names.add(node.id)
-        return node
-
-    def visit_Module(self, node: Module) -> Module:
-        self._module_memo = self._memo = TransformMemo(node, None, ())
-        self.generic_visit(node)
-        self._module_memo.insert_imports(node)
-
-        fix_missing_locations(node)
-        return node
-
-    def visit_Import(self, node: Import) -> Import:
-        for name in node.names:
-            self._memo.local_names.add(name.asname or name.name)
-            self._memo.imported_names[name.asname or name.name] = name.name
-
-        return node
-
-    def visit_ImportFrom(self, node: ImportFrom) -> ImportFrom:
-        for name in node.names:
-            if name.name != "*":
-                alias = name.asname or name.name
-                self._memo.local_names.add(alias)
-                self._memo.imported_names[alias] = f"{node.module}.{name.name}"
-
-        return node
-
-    def visit_ClassDef(self, node: ClassDef) -> ClassDef | None:
-        self._memo.local_names.add(node.name)
-
-        # Eliminate top level classes not belonging to the target path
-        if (
-            self._target_path is not None
-            and not self._memo.path
-            and node.name != self._target_path[0]
-        ):
-            return None
-
-        with self._use_memo(node):
-            for decorator in node.decorator_list.copy():
-                if self._memo.name_matches(decorator, "typeguard.typechecked"):
-                    # Remove the decorator to prevent duplicate instrumentation
-                    node.decorator_list.remove(decorator)
-
-                    # Store any configuration overrides
-                    if isinstance(decorator, Call) and decorator.keywords:
-                        self._memo.configuration_overrides.update(
-                            {kw.arg: kw.value for kw in decorator.keywords if kw.arg}
-                        )
-
-            self.generic_visit(node)
-            return node
-
-    def visit_FunctionDef(
-        self, node: FunctionDef | AsyncFunctionDef
-    ) -> FunctionDef | AsyncFunctionDef | None:
-        """
-        Injects type checks for function arguments, and for a return of None if the
-        function is annotated to return something else than Any or None, and the body
-        ends without an explicit "return".
-
-        """
-        self._memo.local_names.add(node.name)
-
-        # Eliminate top level functions not belonging to the target path
-        if (
-            self._target_path is not None
-            and not self._memo.path
-            and node.name != self._target_path[0]
-        ):
-            return None
-
-        # Skip instrumentation if we're instrumenting the whole module and the function
-        # contains either @no_type_check or @typeguard_ignore
-        if self._target_path is None:
-            for decorator in node.decorator_list:
-                if self._memo.name_matches(decorator, *ignore_decorators):
-                    return node
-
-        with self._use_memo(node):
-            arg_annotations: dict[str, Any] = {}
-            if self._target_path is None or self._memo.path == self._target_path:
-                # Find line number we're supposed to match against
-                if node.decorator_list:
-                    first_lineno = node.decorator_list[0].lineno
-                else:
-                    first_lineno = node.lineno
-
-                for decorator in node.decorator_list.copy():
-                    if self._memo.name_matches(decorator, "typing.overload"):
-                        # Remove overloads entirely
-                        return None
-                    elif self._memo.name_matches(decorator, "typeguard.typechecked"):
-                        # Remove the decorator to prevent duplicate instrumentation
-                        node.decorator_list.remove(decorator)
-
-                        # Store any configuration overrides
-                        if isinstance(decorator, Call) and decorator.keywords:
-                            self._memo.configuration_overrides = {
-                                kw.arg: kw.value for kw in decorator.keywords if kw.arg
-                            }
-
-                if self.target_lineno == first_lineno:
-                    assert self.target_node is None
-                    self.target_node = node
-                    if node.decorator_list:
-                        self.target_lineno = node.decorator_list[0].lineno
-                    else:
-                        self.target_lineno = node.lineno
-
-                all_args = node.args.args + node.args.kwonlyargs + node.args.posonlyargs
-
-                # Ensure that any type shadowed by the positional or keyword-only
-                # argument names are ignored in this function
-                for arg in all_args:
-                    self._memo.ignored_names.add(arg.arg)
-
-                # Ensure that any type shadowed by the variable positional argument name
-                # (e.g. "args" in *args) is ignored this function
-                if node.args.vararg:
-                    self._memo.ignored_names.add(node.args.vararg.arg)
-
-                # Ensure that any type shadowed by the variable keywrod argument name
-                # (e.g. "kwargs" in *kwargs) is ignored this function
-                if node.args.kwarg:
-                    self._memo.ignored_names.add(node.args.kwarg.arg)
-
-                for arg in all_args:
-                    annotation = self._convert_annotation(deepcopy(arg.annotation))
-                    if annotation:
-                        arg_annotations[arg.arg] = annotation
-
-                if node.args.vararg:
-                    annotation_ = self._convert_annotation(node.args.vararg.annotation)
-                    if annotation_:
-                        if sys.version_info >= (3, 9):
-                            container = Name("tuple", ctx=Load())
-                        else:
-                            container = self._get_import("typing", "Tuple")
-
-                        subscript_slice: Tuple | Index = Tuple(
-                            [
-                                annotation_,
-                                Constant(Ellipsis),
-                            ],
-                            ctx=Load(),
-                        )
-                        if sys.version_info < (3, 9):
-                            subscript_slice = Index(subscript_slice, ctx=Load())
-
-                        arg_annotations[node.args.vararg.arg] = Subscript(
-                            container, subscript_slice, ctx=Load()
-                        )
-
-                if node.args.kwarg:
-                    annotation_ = self._convert_annotation(node.args.kwarg.annotation)
-                    if annotation_:
-                        if sys.version_info >= (3, 9):
-                            container = Name("dict", ctx=Load())
-                        else:
-                            container = self._get_import("typing", "Dict")
-
-                        subscript_slice = Tuple(
-                            [
-                                Name("str", ctx=Load()),
-                                annotation_,
-                            ],
-                            ctx=Load(),
-                        )
-                        if sys.version_info < (3, 9):
-                            subscript_slice = Index(subscript_slice, ctx=Load())
-
-                        arg_annotations[node.args.kwarg.arg] = Subscript(
-                            container, subscript_slice, ctx=Load()
-                        )
-
-                if arg_annotations:
-                    self._memo.variable_annotations.update(arg_annotations)
-
-            self.generic_visit(node)
-
-            if arg_annotations:
-                annotations_dict = Dict(
-                    keys=[Constant(key) for key in arg_annotations.keys()],
-                    values=[
-                        Tuple([Name(key, ctx=Load()), annotation], ctx=Load())
-                        for key, annotation in arg_annotations.items()
-                    ],
-                )
-                func_name = self._get_import(
-                    "typeguard._functions", "check_argument_types"
-                )
-                args = [
-                    self._memo.joined_path,
-                    annotations_dict,
-                    self._memo.get_memo_name(),
-                ]
-                node.body.insert(
-                    self._memo.code_inject_index, Expr(Call(func_name, args, []))
-                )
-
-            # Add a checked "return None" to the end if there's no explicit return
-            # Skip if the return annotation is None or Any
-            if (
-                self._memo.return_annotation
-                and (not self._memo.is_async or not self._memo.has_yield_expressions)
-                and not isinstance(node.body[-1], Return)
-                and (
-                    not isinstance(self._memo.return_annotation, Constant)
-                    or self._memo.return_annotation.value is not None
-                )
-            ):
-                func_name = self._get_import(
-                    "typeguard._functions", "check_return_type"
-                )
-                return_node = Return(
-                    Call(
-                        func_name,
-                        [
-                            self._memo.joined_path,
-                            Constant(None),
-                            self._memo.return_annotation,
-                            self._memo.get_memo_name(),
-                        ],
-                        [],
-                    )
-                )
-
-                # Replace a placeholder "pass" at the end
-                if isinstance(node.body[-1], Pass):
-                    copy_location(return_node, node.body[-1])
-                    del node.body[-1]
-
-                node.body.append(return_node)
-
-            # Insert code to create the call memo, if it was ever needed for this
-            # function
-            if self._memo.memo_var_name:
-                memo_kwargs: dict[str, Any] = {}
-                if self._memo.parent and isinstance(self._memo.parent.node, ClassDef):
-                    for decorator in node.decorator_list:
-                        if (
-                            isinstance(decorator, Name)
-                            and decorator.id == "staticmethod"
-                        ):
-                            break
-                        elif (
-                            isinstance(decorator, Name)
-                            and decorator.id == "classmethod"
-                        ):
-                            memo_kwargs["self_type"] = Name(
-                                id=node.args.args[0].arg, ctx=Load()
-                            )
-                            break
-                    else:
-                        if node.args.args:
-                            if node.name == "__new__":
-                                memo_kwargs["self_type"] = Name(
-                                    id=node.args.args[0].arg, ctx=Load()
-                                )
-                            else:
-                                memo_kwargs["self_type"] = Attribute(
-                                    Name(id=node.args.args[0].arg, ctx=Load()),
-                                    "__class__",
-                                    ctx=Load(),
-                                )
-
-                # Construct the function reference
-                # Nested functions get special treatment: the function name is added
-                # to free variables (and the closure of the resulting function)
-                names: list[str] = [node.name]
-                memo = self._memo.parent
-                while memo:
-                    if isinstance(memo.node, (FunctionDef, AsyncFunctionDef)):
-                        # This is a nested function. Use the function name as-is.
-                        del names[:-1]
-                        break
-                    elif not isinstance(memo.node, ClassDef):
-                        break
-
-                    names.insert(0, memo.node.name)
-                    memo = memo.parent
-
-                config_keywords = self._memo.get_config_keywords()
-                if config_keywords:
-                    memo_kwargs["config"] = Call(
-                        self._get_import("dataclasses", "replace"),
-                        [self._get_import("typeguard._config", "global_config")],
-                        config_keywords,
-                    )
-
-                self._memo.memo_var_name.id = self._memo.get_unused_name("memo")
-                memo_store_name = Name(id=self._memo.memo_var_name.id, ctx=Store())
-                globals_call = Call(Name(id="globals", ctx=Load()), [], [])
-                locals_call = Call(Name(id="locals", ctx=Load()), [], [])
-                memo_expr = Call(
-                    self._get_import("typeguard", "TypeCheckMemo"),
-                    [globals_call, locals_call],
-                    [keyword(key, value) for key, value in memo_kwargs.items()],
-                )
-                node.body.insert(
-                    self._memo.code_inject_index,
-                    Assign([memo_store_name], memo_expr),
-                )
-
-                self._memo.insert_imports(node)
-
-                # Special case the __new__() method to create a local alias from the
-                # class name to the first argument (usually "cls")
-                if (
-                    isinstance(node, FunctionDef)
-                    and node.args
-                    and self._memo.parent is not None
-                    and isinstance(self._memo.parent.node, ClassDef)
-                    and node.name == "__new__"
-                ):
-                    first_args_expr = Name(node.args.args[0].arg, ctx=Load())
-                    cls_name = Name(self._memo.parent.node.name, ctx=Store())
-                    node.body.insert(
-                        self._memo.code_inject_index,
-                        Assign([cls_name], first_args_expr),
-                    )
-
-                # Rmove any placeholder "pass" at the end
-                if isinstance(node.body[-1], Pass):
-                    del node.body[-1]
-
-        return node
-
-    def visit_AsyncFunctionDef(
-        self, node: AsyncFunctionDef
-    ) -> FunctionDef | AsyncFunctionDef | None:
-        return self.visit_FunctionDef(node)
-
-    def visit_Return(self, node: Return) -> Return:
-        """This injects type checks into "return" statements."""
-        self.generic_visit(node)
-        if (
-            self._memo.return_annotation
-            and self._memo.should_instrument
-            and not self._memo.is_ignored_name(self._memo.return_annotation)
-        ):
-            func_name = self._get_import("typeguard._functions", "check_return_type")
-            old_node = node
-            retval = old_node.value or Constant(None)
-            node = Return(
-                Call(
-                    func_name,
-                    [
-                        self._memo.joined_path,
-                        retval,
-                        self._memo.return_annotation,
-                        self._memo.get_memo_name(),
-                    ],
-                    [],
-                )
-            )
-            copy_location(node, old_node)
-
-        return node
-
-    def visit_Yield(self, node: Yield) -> Yield | Call:
-        """
-        This injects type checks into "yield" expressions, checking both the yielded
-        value and the value sent back to the generator, when appropriate.
-
-        """
-        self._memo.has_yield_expressions = True
-        self.generic_visit(node)
-
-        if (
-            self._memo.yield_annotation
-            and self._memo.should_instrument
-            and not self._memo.is_ignored_name(self._memo.yield_annotation)
-        ):
-            func_name = self._get_import("typeguard._functions", "check_yield_type")
-            yieldval = node.value or Constant(None)
-            node.value = Call(
-                func_name,
-                [
-                    self._memo.joined_path,
-                    yieldval,
-                    self._memo.yield_annotation,
-                    self._memo.get_memo_name(),
-                ],
-                [],
-            )
-
-        if (
-            self._memo.send_annotation
-            and self._memo.should_instrument
-            and not self._memo.is_ignored_name(self._memo.send_annotation)
-        ):
-            func_name = self._get_import("typeguard._functions", "check_send_type")
-            old_node = node
-            call_node = Call(
-                func_name,
-                [
-                    self._memo.joined_path,
-                    old_node,
-                    self._memo.send_annotation,
-                    self._memo.get_memo_name(),
-                ],
-                [],
-            )
-            copy_location(call_node, old_node)
-            return call_node
-
-        return node
-
-    def visit_AnnAssign(self, node: AnnAssign) -> Any:
-        """
-        This injects a type check into a local variable annotation-assignment within a
-        function body.
-
-        """
-        self.generic_visit(node)
-
-        if (
-            isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef))
-            and node.annotation
-            and isinstance(node.target, Name)
-        ):
-            self._memo.ignored_names.add(node.target.id)
-            annotation = self._convert_annotation(deepcopy(node.annotation))
-            if annotation:
-                self._memo.variable_annotations[node.target.id] = annotation
-                if node.value:
-                    func_name = self._get_import(
-                        "typeguard._functions", "check_variable_assignment"
-                    )
-                    node.value = Call(
-                        func_name,
-                        [
-                            node.value,
-                            Constant(node.target.id),
-                            annotation,
-                            self._memo.get_memo_name(),
-                        ],
-                        [],
-                    )
-
-        return node
-
-    def visit_Assign(self, node: Assign) -> Any:
-        """
-        This injects a type check into a local variable assignment within a function
-        body. The variable must have been annotated earlier in the function body.
-
-        """
-        self.generic_visit(node)
-
-        # Only instrument function-local assignments
-        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)):
-            targets: list[dict[Constant, expr | None]] = []
-            check_required = False
-            for target in node.targets:
-                elts: Sequence[expr]
-                if isinstance(target, Name):
-                    elts = [target]
-                elif isinstance(target, Tuple):
-                    elts = target.elts
-                else:
-                    continue
-
-                annotations_: dict[Constant, expr | None] = {}
-                for exp in elts:
-                    prefix = ""
-                    if isinstance(exp, Starred):
-                        exp = exp.value
-                        prefix = "*"
-
-                    if isinstance(exp, Name):
-                        self._memo.ignored_names.add(exp.id)
-                        name = prefix + exp.id
-                        annotation = self._memo.variable_annotations.get(exp.id)
-                        if annotation:
-                            annotations_[Constant(name)] = annotation
-                            check_required = True
-                        else:
-                            annotations_[Constant(name)] = None
-
-                targets.append(annotations_)
-
-            if check_required:
-                # Replace missing annotations with typing.Any
-                for item in targets:
-                    for key, expression in item.items():
-                        if expression is None:
-                            item[key] = self._get_import("typing", "Any")
-
-                if len(targets) == 1 and len(targets[0]) == 1:
-                    func_name = self._get_import(
-                        "typeguard._functions", "check_variable_assignment"
-                    )
-                    target_varname = next(iter(targets[0]))
-                    node.value = Call(
-                        func_name,
-                        [
-                            node.value,
-                            target_varname,
-                            targets[0][target_varname],
-                            self._memo.get_memo_name(),
-                        ],
-                        [],
-                    )
-                elif targets:
-                    func_name = self._get_import(
-                        "typeguard._functions", "check_multi_variable_assignment"
-                    )
-                    targets_arg = List(
-                        [
-                            Dict(keys=list(target), values=list(target.values()))
-                            for target in targets
-                        ],
-                        ctx=Load(),
-                    )
-                    node.value = Call(
-                        func_name,
-                        [node.value, targets_arg, self._memo.get_memo_name()],
-                        [],
-                    )
-
-        return node
-
-    def visit_NamedExpr(self, node: NamedExpr) -> Any:
-        """This injects a type check into an assignment expression (a := foo())."""
-        self.generic_visit(node)
-
-        # Only instrument function-local assignments
-        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)) and isinstance(
-            node.target, Name
-        ):
-            self._memo.ignored_names.add(node.target.id)
-
-            # Bail out if no matching annotation is found
-            annotation = self._memo.variable_annotations.get(node.target.id)
-            if annotation is None:
-                return node
-
-            func_name = self._get_import(
-                "typeguard._functions", "check_variable_assignment"
-            )
-            node.value = Call(
-                func_name,
-                [
-                    node.value,
-                    Constant(node.target.id),
-                    annotation,
-                    self._memo.get_memo_name(),
-                ],
-                [],
-            )
-
-        return node
-
-    def visit_AugAssign(self, node: AugAssign) -> Any:
-        """
-        This injects a type check into an augmented assignment expression (a += 1).
-
-        """
-        self.generic_visit(node)
-
-        # Only instrument function-local assignments
-        if isinstance(self._memo.node, (FunctionDef, AsyncFunctionDef)) and isinstance(
-            node.target, Name
-        ):
-            # Bail out if no matching annotation is found
-            annotation = self._memo.variable_annotations.get(node.target.id)
-            if annotation is None:
-                return node
-
-            # Bail out if the operator is not found (newer Python version?)
-            try:
-                operator_func_name = aug_assign_functions[node.op.__class__]
-            except KeyError:
-                return node
-
-            operator_func = self._get_import("operator", operator_func_name)
-            operator_call = Call(
-                operator_func, [Name(node.target.id, ctx=Load()), node.value], []
-            )
-            check_call = Call(
-                self._get_import("typeguard._functions", "check_variable_assignment"),
-                [
-                    operator_call,
-                    Constant(node.target.id),
-                    annotation,
-                    self._memo.get_memo_name(),
-                ],
-                [],
-            )
-            return Assign(targets=[node.target], value=check_call)
-
-        return node
-
-    def visit_If(self, node: If) -> Any:
-        """
-        This blocks names from being collected from a module-level
-        "if typing.TYPE_CHECKING:" block, so that they won't be type checked.
-
-        """
-        self.generic_visit(node)
-
-        if (
-            self._memo is self._module_memo
-            and isinstance(node.test, Name)
-            and self._memo.name_matches(node.test, "typing.TYPE_CHECKING")
-        ):
-            collector = NameCollector()
-            collector.visit(node)
-            self._memo.ignored_names.update(collector.names)
-
-        return node
diff --git a/pkg_resources/_vendor/typeguard/_union_transformer.py b/pkg_resources/_vendor/typeguard/_union_transformer.py
deleted file mode 100644
index 19617e6af5..0000000000
--- a/pkg_resources/_vendor/typeguard/_union_transformer.py
+++ /dev/null
@@ -1,55 +0,0 @@
-"""
-Transforms lazily evaluated PEP 604 unions into typing.Unions, for compatibility with
-Python versions older than 3.10.
-"""
-
-from __future__ import annotations
-
-from ast import (
-    BinOp,
-    BitOr,
-    Index,
-    Load,
-    Name,
-    NodeTransformer,
-    Subscript,
-    fix_missing_locations,
-    parse,
-)
-from ast import Tuple as ASTTuple
-from types import CodeType
-from typing import Any, Dict, FrozenSet, List, Set, Tuple, Union
-
-type_substitutions = {
-    "dict": Dict,
-    "list": List,
-    "tuple": Tuple,
-    "set": Set,
-    "frozenset": FrozenSet,
-    "Union": Union,
-}
-
-
-class UnionTransformer(NodeTransformer):
-    def __init__(self, union_name: Name | None = None):
-        self.union_name = union_name or Name(id="Union", ctx=Load())
-
-    def visit_BinOp(self, node: BinOp) -> Any:
-        self.generic_visit(node)
-        if isinstance(node.op, BitOr):
-            return Subscript(
-                value=self.union_name,
-                slice=Index(
-                    ASTTuple(elts=[node.left, node.right], ctx=Load()), ctx=Load()
-                ),
-                ctx=Load(),
-            )
-
-        return node
-
-
-def compile_type_hint(hint: str) -> CodeType:
-    parsed = parse(hint, "", "eval")
-    UnionTransformer().visit(parsed)
-    fix_missing_locations(parsed)
-    return compile(parsed, "", "eval", flags=0)
diff --git a/pkg_resources/_vendor/typeguard/_utils.py b/pkg_resources/_vendor/typeguard/_utils.py
deleted file mode 100644
index 9bcc8417f8..0000000000
--- a/pkg_resources/_vendor/typeguard/_utils.py
+++ /dev/null
@@ -1,173 +0,0 @@
-from __future__ import annotations
-
-import inspect
-import sys
-from importlib import import_module
-from inspect import currentframe
-from types import CodeType, FrameType, FunctionType
-from typing import TYPE_CHECKING, Any, Callable, ForwardRef, Union, cast, final
-from weakref import WeakValueDictionary
-
-if TYPE_CHECKING:
-    from ._memo import TypeCheckMemo
-
-if sys.version_info >= (3, 13):
-    from typing import get_args, get_origin
-
-    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
-        return forwardref._evaluate(
-            memo.globals, memo.locals, type_params=(), recursive_guard=frozenset()
-        )
-
-elif sys.version_info >= (3, 10):
-    from typing import get_args, get_origin
-
-    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
-        return forwardref._evaluate(
-            memo.globals, memo.locals, recursive_guard=frozenset()
-        )
-
-else:
-    from typing_extensions import get_args, get_origin
-
-    evaluate_extra_args: tuple[frozenset[Any], ...] = (
-        (frozenset(),) if sys.version_info >= (3, 9) else ()
-    )
-
-    def evaluate_forwardref(forwardref: ForwardRef, memo: TypeCheckMemo) -> Any:
-        from ._union_transformer import compile_type_hint, type_substitutions
-
-        if not forwardref.__forward_evaluated__:
-            forwardref.__forward_code__ = compile_type_hint(forwardref.__forward_arg__)
-
-        try:
-            return forwardref._evaluate(memo.globals, memo.locals, *evaluate_extra_args)
-        except NameError:
-            if sys.version_info < (3, 10):
-                # Try again, with the type substitutions (list -> List etc.) in place
-                new_globals = memo.globals.copy()
-                new_globals.setdefault("Union", Union)
-                if sys.version_info < (3, 9):
-                    new_globals.update(type_substitutions)
-
-                return forwardref._evaluate(
-                    new_globals, memo.locals or new_globals, *evaluate_extra_args
-                )
-
-            raise
-
-
-_functions_map: WeakValueDictionary[CodeType, FunctionType] = WeakValueDictionary()
-
-
-def get_type_name(type_: Any) -> str:
-    name: str
-    for attrname in "__name__", "_name", "__forward_arg__":
-        candidate = getattr(type_, attrname, None)
-        if isinstance(candidate, str):
-            name = candidate
-            break
-    else:
-        origin = get_origin(type_)
-        candidate = getattr(origin, "_name", None)
-        if candidate is None:
-            candidate = type_.__class__.__name__.strip("_")
-
-        if isinstance(candidate, str):
-            name = candidate
-        else:
-            return "(unknown)"
-
-    args = get_args(type_)
-    if args:
-        if name == "Literal":
-            formatted_args = ", ".join(repr(arg) for arg in args)
-        else:
-            formatted_args = ", ".join(get_type_name(arg) for arg in args)
-
-        name += f"[{formatted_args}]"
-
-    module = getattr(type_, "__module__", None)
-    if module and module not in (None, "typing", "typing_extensions", "builtins"):
-        name = module + "." + name
-
-    return name
-
-
-def qualified_name(obj: Any, *, add_class_prefix: bool = False) -> str:
-    """
-    Return the qualified name (e.g. package.module.Type) for the given object.
-
-    Builtins and types from the :mod:`typing` package get special treatment by having
-    the module name stripped from the generated name.
-
-    """
-    if obj is None:
-        return "None"
-    elif inspect.isclass(obj):
-        prefix = "class " if add_class_prefix else ""
-        type_ = obj
-    else:
-        prefix = ""
-        type_ = type(obj)
-
-    module = type_.__module__
-    qualname = type_.__qualname__
-    name = qualname if module in ("typing", "builtins") else f"{module}.{qualname}"
-    return prefix + name
-
-
-def function_name(func: Callable[..., Any]) -> str:
-    """
-    Return the qualified name of the given function.
-
-    Builtins and types from the :mod:`typing` package get special treatment by having
-    the module name stripped from the generated name.
-
-    """
-    # For partial functions and objects with __call__ defined, __qualname__ does not
-    # exist
-    module = getattr(func, "__module__", "")
-    qualname = (module + ".") if module not in ("builtins", "") else ""
-    return qualname + getattr(func, "__qualname__", repr(func))
-
-
-def resolve_reference(reference: str) -> Any:
-    modulename, varname = reference.partition(":")[::2]
-    if not modulename or not varname:
-        raise ValueError(f"{reference!r} is not a module:varname reference")
-
-    obj = import_module(modulename)
-    for attr in varname.split("."):
-        obj = getattr(obj, attr)
-
-    return obj
-
-
-def is_method_of(obj: object, cls: type) -> bool:
-    return (
-        inspect.isfunction(obj)
-        and obj.__module__ == cls.__module__
-        and obj.__qualname__.startswith(cls.__qualname__ + ".")
-    )
-
-
-def get_stacklevel() -> int:
-    level = 1
-    frame = cast(FrameType, currentframe()).f_back
-    while frame and frame.f_globals.get("__name__", "").startswith("typeguard."):
-        level += 1
-        frame = frame.f_back
-
-    return level
-
-
-@final
-class Unset:
-    __slots__ = ()
-
-    def __repr__(self) -> str:
-        return ""
-
-
-unset = Unset()
diff --git a/pkg_resources/_vendor/typeguard/py.typed b/pkg_resources/_vendor/typeguard/py.typed
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
deleted file mode 100644
index f26bcf4d2d..0000000000
--- a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
+++ /dev/null
@@ -1,279 +0,0 @@
-A. HISTORY OF THE SOFTWARE
-==========================
-
-Python was created in the early 1990s by Guido van Rossum at Stichting
-Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
-as a successor of a language called ABC.  Guido remains Python's
-principal author, although it includes many contributions from others.
-
-In 1995, Guido continued his work on Python at the Corporation for
-National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
-in Reston, Virginia where he released several versions of the
-software.
-
-In May 2000, Guido and the Python core development team moved to
-BeOpen.com to form the BeOpen PythonLabs team.  In October of the same
-year, the PythonLabs team moved to Digital Creations, which became
-Zope Corporation.  In 2001, the Python Software Foundation (PSF, see
-https://www.python.org/psf/) was formed, a non-profit organization
-created specifically to own Python-related Intellectual Property.
-Zope Corporation was a sponsoring member of the PSF.
-
-All Python releases are Open Source (see https://opensource.org for
-the Open Source Definition).  Historically, most, but not all, Python
-releases have also been GPL-compatible; the table below summarizes
-the various releases.
-
-    Release         Derived     Year        Owner       GPL-
-                    from                                compatible? (1)
-
-    0.9.0 thru 1.2              1991-1995   CWI         yes
-    1.3 thru 1.5.2  1.2         1995-1999   CNRI        yes
-    1.6             1.5.2       2000        CNRI        no
-    2.0             1.6         2000        BeOpen.com  no
-    1.6.1           1.6         2001        CNRI        yes (2)
-    2.1             2.0+1.6.1   2001        PSF         no
-    2.0.1           2.0+1.6.1   2001        PSF         yes
-    2.1.1           2.1+2.0.1   2001        PSF         yes
-    2.1.2           2.1.1       2002        PSF         yes
-    2.1.3           2.1.2       2002        PSF         yes
-    2.2 and above   2.1.1       2001-now    PSF         yes
-
-Footnotes:
-
-(1) GPL-compatible doesn't mean that we're distributing Python under
-    the GPL.  All Python licenses, unlike the GPL, let you distribute
-    a modified version without making your changes open source.  The
-    GPL-compatible licenses make it possible to combine Python with
-    other software that is released under the GPL; the others don't.
-
-(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
-    because its license has a choice of law clause.  According to
-    CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
-    is "not incompatible" with the GPL.
-
-Thanks to the many outside volunteers who have worked under Guido's
-direction to make these releases possible.
-
-
-B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
-===============================================================
-
-Python software and documentation are licensed under the
-Python Software Foundation License Version 2.
-
-Starting with Python 3.8.6, examples, recipes, and other code in
-the documentation are dual licensed under the PSF License Version 2
-and the Zero-Clause BSD license.
-
-Some software incorporated into Python is under different licenses.
-The licenses are listed with code falling under that license.
-
-
-PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
---------------------------------------------
-
-1. This LICENSE AGREEMENT is between the Python Software Foundation
-("PSF"), and the Individual or Organization ("Licensee") accessing and
-otherwise using this software ("Python") in source or binary form and
-its associated documentation.
-
-2. Subject to the terms and conditions of this License Agreement, PSF hereby
-grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
-analyze, test, perform and/or display publicly, prepare derivative works,
-distribute, and otherwise use Python alone or in any derivative version,
-provided, however, that PSF's License Agreement and PSF's notice of copyright,
-i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
-All Rights Reserved" are retained in Python alone or in any derivative version
-prepared by Licensee.
-
-3. In the event Licensee prepares a derivative work that is based on
-or incorporates Python or any part thereof, and wants to make
-the derivative work available to others as provided herein, then
-Licensee hereby agrees to include in any such work a brief summary of
-the changes made to Python.
-
-4. PSF is making Python available to Licensee on an "AS IS"
-basis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
-DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
-FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
-INFRINGE ANY THIRD PARTY RIGHTS.
-
-5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
-FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
-A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
-OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
-
-6. This License Agreement will automatically terminate upon a material
-breach of its terms and conditions.
-
-7. Nothing in this License Agreement shall be deemed to create any
-relationship of agency, partnership, or joint venture between PSF and
-Licensee.  This License Agreement does not grant permission to use PSF
-trademarks or trade name in a trademark sense to endorse or promote
-products or services of Licensee, or any third party.
-
-8. By copying, installing or otherwise using Python, Licensee
-agrees to be bound by the terms and conditions of this License
-Agreement.
-
-
-BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
--------------------------------------------
-
-BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
-
-1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
-office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
-Individual or Organization ("Licensee") accessing and otherwise using
-this software in source or binary form and its associated
-documentation ("the Software").
-
-2. Subject to the terms and conditions of this BeOpen Python License
-Agreement, BeOpen hereby grants Licensee a non-exclusive,
-royalty-free, world-wide license to reproduce, analyze, test, perform
-and/or display publicly, prepare derivative works, distribute, and
-otherwise use the Software alone or in any derivative version,
-provided, however, that the BeOpen Python License is retained in the
-Software, alone or in any derivative version prepared by Licensee.
-
-3. BeOpen is making the Software available to Licensee on an "AS IS"
-basis.  BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
-DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
-FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
-INFRINGE ANY THIRD PARTY RIGHTS.
-
-4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
-SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
-AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
-DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
-
-5. This License Agreement will automatically terminate upon a material
-breach of its terms and conditions.
-
-6. This License Agreement shall be governed by and interpreted in all
-respects by the law of the State of California, excluding conflict of
-law provisions.  Nothing in this License Agreement shall be deemed to
-create any relationship of agency, partnership, or joint venture
-between BeOpen and Licensee.  This License Agreement does not grant
-permission to use BeOpen trademarks or trade names in a trademark
-sense to endorse or promote products or services of Licensee, or any
-third party.  As an exception, the "BeOpen Python" logos available at
-http://www.pythonlabs.com/logos.html may be used according to the
-permissions granted on that web page.
-
-7. By copying, installing or otherwise using the software, Licensee
-agrees to be bound by the terms and conditions of this License
-Agreement.
-
-
-CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
----------------------------------------
-
-1. This LICENSE AGREEMENT is between the Corporation for National
-Research Initiatives, having an office at 1895 Preston White Drive,
-Reston, VA 20191 ("CNRI"), and the Individual or Organization
-("Licensee") accessing and otherwise using Python 1.6.1 software in
-source or binary form and its associated documentation.
-
-2. Subject to the terms and conditions of this License Agreement, CNRI
-hereby grants Licensee a nonexclusive, royalty-free, world-wide
-license to reproduce, analyze, test, perform and/or display publicly,
-prepare derivative works, distribute, and otherwise use Python 1.6.1
-alone or in any derivative version, provided, however, that CNRI's
-License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
-1995-2001 Corporation for National Research Initiatives; All Rights
-Reserved" are retained in Python 1.6.1 alone or in any derivative
-version prepared by Licensee.  Alternately, in lieu of CNRI's License
-Agreement, Licensee may substitute the following text (omitting the
-quotes): "Python 1.6.1 is made available subject to the terms and
-conditions in CNRI's License Agreement.  This Agreement together with
-Python 1.6.1 may be located on the internet using the following
-unique, persistent identifier (known as a handle): 1895.22/1013.  This
-Agreement may also be obtained from a proxy server on the internet
-using the following URL: http://hdl.handle.net/1895.22/1013".
-
-3. In the event Licensee prepares a derivative work that is based on
-or incorporates Python 1.6.1 or any part thereof, and wants to make
-the derivative work available to others as provided herein, then
-Licensee hereby agrees to include in any such work a brief summary of
-the changes made to Python 1.6.1.
-
-4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
-basis.  CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
-IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
-DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
-FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
-INFRINGE ANY THIRD PARTY RIGHTS.
-
-5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
-1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
-A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
-OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
-
-6. This License Agreement will automatically terminate upon a material
-breach of its terms and conditions.
-
-7. This License Agreement shall be governed by the federal
-intellectual property law of the United States, including without
-limitation the federal copyright law, and, to the extent such
-U.S. federal law does not apply, by the law of the Commonwealth of
-Virginia, excluding Virginia's conflict of law provisions.
-Notwithstanding the foregoing, with regard to derivative works based
-on Python 1.6.1 that incorporate non-separable material that was
-previously distributed under the GNU General Public License (GPL), the
-law of the Commonwealth of Virginia shall govern this License
-Agreement only as to issues arising under or with respect to
-Paragraphs 4, 5, and 7 of this License Agreement.  Nothing in this
-License Agreement shall be deemed to create any relationship of
-agency, partnership, or joint venture between CNRI and Licensee.  This
-License Agreement does not grant permission to use CNRI trademarks or
-trade name in a trademark sense to endorse or promote products or
-services of Licensee, or any third party.
-
-8. By clicking on the "ACCEPT" button where indicated, or by copying,
-installing or otherwise using Python 1.6.1, Licensee agrees to be
-bound by the terms and conditions of this License Agreement.
-
-        ACCEPT
-
-
-CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
---------------------------------------------------
-
-Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
-The Netherlands.  All rights reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Stichting Mathematisch
-Centrum or CWI not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
-THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
-FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
-----------------------------------------------------------------------
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA
deleted file mode 100644
index f15e2b3877..0000000000
--- a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/METADATA
+++ /dev/null
@@ -1,67 +0,0 @@
-Metadata-Version: 2.1
-Name: typing_extensions
-Version: 4.12.2
-Summary: Backported and Experimental Type Hints for Python 3.8+
-Keywords: annotations,backport,checker,checking,function,hinting,hints,type,typechecking,typehinting,typehints,typing
-Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" 
-Requires-Python: >=3.8
-Description-Content-Type: text/markdown
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Environment :: Console
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: Python Software Foundation License
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Classifier: Programming Language :: Python :: 3.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: Topic :: Software Development
-Project-URL: Bug Tracker, https://github.com/python/typing_extensions/issues
-Project-URL: Changes, https://github.com/python/typing_extensions/blob/main/CHANGELOG.md
-Project-URL: Documentation, https://typing-extensions.readthedocs.io/
-Project-URL: Home, https://github.com/python/typing_extensions
-Project-URL: Q & A, https://github.com/python/typing/discussions
-Project-URL: Repository, https://github.com/python/typing_extensions
-
-# Typing Extensions
-
-[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing)
-
-[Documentation](https://typing-extensions.readthedocs.io/en/latest/#) –
-[PyPI](https://pypi.org/project/typing-extensions/)
-
-## Overview
-
-The `typing_extensions` module serves two related purposes:
-
-- Enable use of new type system features on older Python versions. For example,
-  `typing.TypeGuard` is new in Python 3.10, but `typing_extensions` allows
-  users on previous Python versions to use it too.
-- Enable experimentation with new type system PEPs before they are accepted and
-  added to the `typing` module.
-
-`typing_extensions` is treated specially by static type checkers such as
-mypy and pyright. Objects defined in `typing_extensions` are treated the same
-way as equivalent forms in `typing`.
-
-`typing_extensions` uses
-[Semantic Versioning](https://semver.org/). The
-major version will be incremented only for backwards-incompatible changes.
-Therefore, it's safe to depend
-on `typing_extensions` like this: `typing_extensions >=x.y, <(x+1)`,
-where `x.y` is the first version that includes all features you need.
-
-## Included items
-
-See [the documentation](https://typing-extensions.readthedocs.io/en/latest/#) for a
-complete listing of module contents.
-
-## Contributing
-
-See [CONTRIBUTING.md](https://github.com/python/typing_extensions/blob/main/CONTRIBUTING.md)
-for how to contribute to `typing_extensions`.
-
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD
deleted file mode 100644
index bc7b45334d..0000000000
--- a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/RECORD
+++ /dev/null
@@ -1,7 +0,0 @@
-__pycache__/typing_extensions.cpython-312.pyc,,
-typing_extensions-4.12.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-typing_extensions-4.12.2.dist-info/LICENSE,sha256=Oy-B_iHRgcSZxZolbI4ZaEVdZonSaaqFNzv7avQdo78,13936
-typing_extensions-4.12.2.dist-info/METADATA,sha256=BeUQIa8cnYbrjWx-N8TOznM9UGW5Gm2DicVpDtRA8W0,3018
-typing_extensions-4.12.2.dist-info/RECORD,,
-typing_extensions-4.12.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
-typing_extensions.py,sha256=gwekpyG9DVG3lxWKX4ni8u7nk3We5slG98mA9F3DJQw,134451
diff --git a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/WHEEL b/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/WHEEL
deleted file mode 100644
index 3b5e64b5e6..0000000000
--- a/pkg_resources/_vendor/typing_extensions-4.12.2.dist-info/WHEEL
+++ /dev/null
@@ -1,4 +0,0 @@
-Wheel-Version: 1.0
-Generator: flit 3.9.0
-Root-Is-Purelib: true
-Tag: py3-none-any
diff --git a/pkg_resources/_vendor/typing_extensions.py b/pkg_resources/_vendor/typing_extensions.py
deleted file mode 100644
index dec429ca87..0000000000
--- a/pkg_resources/_vendor/typing_extensions.py
+++ /dev/null
@@ -1,3641 +0,0 @@
-import abc
-import collections
-import collections.abc
-import contextlib
-import functools
-import inspect
-import operator
-import sys
-import types as _types
-import typing
-import warnings
-
-__all__ = [
-    # Super-special typing primitives.
-    'Any',
-    'ClassVar',
-    'Concatenate',
-    'Final',
-    'LiteralString',
-    'ParamSpec',
-    'ParamSpecArgs',
-    'ParamSpecKwargs',
-    'Self',
-    'Type',
-    'TypeVar',
-    'TypeVarTuple',
-    'Unpack',
-
-    # ABCs (from collections.abc).
-    'Awaitable',
-    'AsyncIterator',
-    'AsyncIterable',
-    'Coroutine',
-    'AsyncGenerator',
-    'AsyncContextManager',
-    'Buffer',
-    'ChainMap',
-
-    # Concrete collection types.
-    'ContextManager',
-    'Counter',
-    'Deque',
-    'DefaultDict',
-    'NamedTuple',
-    'OrderedDict',
-    'TypedDict',
-
-    # Structural checks, a.k.a. protocols.
-    'SupportsAbs',
-    'SupportsBytes',
-    'SupportsComplex',
-    'SupportsFloat',
-    'SupportsIndex',
-    'SupportsInt',
-    'SupportsRound',
-
-    # One-off things.
-    'Annotated',
-    'assert_never',
-    'assert_type',
-    'clear_overloads',
-    'dataclass_transform',
-    'deprecated',
-    'Doc',
-    'get_overloads',
-    'final',
-    'get_args',
-    'get_origin',
-    'get_original_bases',
-    'get_protocol_members',
-    'get_type_hints',
-    'IntVar',
-    'is_protocol',
-    'is_typeddict',
-    'Literal',
-    'NewType',
-    'overload',
-    'override',
-    'Protocol',
-    'reveal_type',
-    'runtime',
-    'runtime_checkable',
-    'Text',
-    'TypeAlias',
-    'TypeAliasType',
-    'TypeGuard',
-    'TypeIs',
-    'TYPE_CHECKING',
-    'Never',
-    'NoReturn',
-    'ReadOnly',
-    'Required',
-    'NotRequired',
-
-    # Pure aliases, have always been in typing
-    'AbstractSet',
-    'AnyStr',
-    'BinaryIO',
-    'Callable',
-    'Collection',
-    'Container',
-    'Dict',
-    'ForwardRef',
-    'FrozenSet',
-    'Generator',
-    'Generic',
-    'Hashable',
-    'IO',
-    'ItemsView',
-    'Iterable',
-    'Iterator',
-    'KeysView',
-    'List',
-    'Mapping',
-    'MappingView',
-    'Match',
-    'MutableMapping',
-    'MutableSequence',
-    'MutableSet',
-    'NoDefault',
-    'Optional',
-    'Pattern',
-    'Reversible',
-    'Sequence',
-    'Set',
-    'Sized',
-    'TextIO',
-    'Tuple',
-    'Union',
-    'ValuesView',
-    'cast',
-    'no_type_check',
-    'no_type_check_decorator',
-]
-
-# for backward compatibility
-PEP_560 = True
-GenericMeta = type
-_PEP_696_IMPLEMENTED = sys.version_info >= (3, 13, 0, "beta")
-
-# The functions below are modified copies of typing internal helpers.
-# They are needed by _ProtocolMeta and they provide support for PEP 646.
-
-
-class _Sentinel:
-    def __repr__(self):
-        return ""
-
-
-_marker = _Sentinel()
-
-
-if sys.version_info >= (3, 10):
-    def _should_collect_from_parameters(t):
-        return isinstance(
-            t, (typing._GenericAlias, _types.GenericAlias, _types.UnionType)
-        )
-elif sys.version_info >= (3, 9):
-    def _should_collect_from_parameters(t):
-        return isinstance(t, (typing._GenericAlias, _types.GenericAlias))
-else:
-    def _should_collect_from_parameters(t):
-        return isinstance(t, typing._GenericAlias) and not t._special
-
-
-NoReturn = typing.NoReturn
-
-# Some unconstrained type variables.  These are used by the container types.
-# (These are not for export.)
-T = typing.TypeVar('T')  # Any type.
-KT = typing.TypeVar('KT')  # Key type.
-VT = typing.TypeVar('VT')  # Value type.
-T_co = typing.TypeVar('T_co', covariant=True)  # Any type covariant containers.
-T_contra = typing.TypeVar('T_contra', contravariant=True)  # Ditto contravariant.
-
-
-if sys.version_info >= (3, 11):
-    from typing import Any
-else:
-
-    class _AnyMeta(type):
-        def __instancecheck__(self, obj):
-            if self is Any:
-                raise TypeError("typing_extensions.Any cannot be used with isinstance()")
-            return super().__instancecheck__(obj)
-
-        def __repr__(self):
-            if self is Any:
-                return "typing_extensions.Any"
-            return super().__repr__()
-
-    class Any(metaclass=_AnyMeta):
-        """Special type indicating an unconstrained type.
-        - Any is compatible with every type.
-        - Any assumed to have all methods.
-        - All values assumed to be instances of Any.
-        Note that all the above statements are true from the point of view of
-        static type checkers. At runtime, Any should not be used with instance
-        checks.
-        """
-        def __new__(cls, *args, **kwargs):
-            if cls is Any:
-                raise TypeError("Any cannot be instantiated")
-            return super().__new__(cls, *args, **kwargs)
-
-
-ClassVar = typing.ClassVar
-
-
-class _ExtensionsSpecialForm(typing._SpecialForm, _root=True):
-    def __repr__(self):
-        return 'typing_extensions.' + self._name
-
-
-Final = typing.Final
-
-if sys.version_info >= (3, 11):
-    final = typing.final
-else:
-    # @final exists in 3.8+, but we backport it for all versions
-    # before 3.11 to keep support for the __final__ attribute.
-    # See https://bugs.python.org/issue46342
-    def final(f):
-        """This decorator can be used to indicate to type checkers that
-        the decorated method cannot be overridden, and decorated class
-        cannot be subclassed. For example:
-
-            class Base:
-                @final
-                def done(self) -> None:
-                    ...
-            class Sub(Base):
-                def done(self) -> None:  # Error reported by type checker
-                    ...
-            @final
-            class Leaf:
-                ...
-            class Other(Leaf):  # Error reported by type checker
-                ...
-
-        There is no runtime checking of these properties. The decorator
-        sets the ``__final__`` attribute to ``True`` on the decorated object
-        to allow runtime introspection.
-        """
-        try:
-            f.__final__ = True
-        except (AttributeError, TypeError):
-            # Skip the attribute silently if it is not writable.
-            # AttributeError happens if the object has __slots__ or a
-            # read-only property, TypeError if it's a builtin class.
-            pass
-        return f
-
-
-def IntVar(name):
-    return typing.TypeVar(name)
-
-
-# A Literal bug was fixed in 3.11.0, 3.10.1 and 3.9.8
-if sys.version_info >= (3, 10, 1):
-    Literal = typing.Literal
-else:
-    def _flatten_literal_params(parameters):
-        """An internal helper for Literal creation: flatten Literals among parameters"""
-        params = []
-        for p in parameters:
-            if isinstance(p, _LiteralGenericAlias):
-                params.extend(p.__args__)
-            else:
-                params.append(p)
-        return tuple(params)
-
-    def _value_and_type_iter(params):
-        for p in params:
-            yield p, type(p)
-
-    class _LiteralGenericAlias(typing._GenericAlias, _root=True):
-        def __eq__(self, other):
-            if not isinstance(other, _LiteralGenericAlias):
-                return NotImplemented
-            these_args_deduped = set(_value_and_type_iter(self.__args__))
-            other_args_deduped = set(_value_and_type_iter(other.__args__))
-            return these_args_deduped == other_args_deduped
-
-        def __hash__(self):
-            return hash(frozenset(_value_and_type_iter(self.__args__)))
-
-    class _LiteralForm(_ExtensionsSpecialForm, _root=True):
-        def __init__(self, doc: str):
-            self._name = 'Literal'
-            self._doc = self.__doc__ = doc
-
-        def __getitem__(self, parameters):
-            if not isinstance(parameters, tuple):
-                parameters = (parameters,)
-
-            parameters = _flatten_literal_params(parameters)
-
-            val_type_pairs = list(_value_and_type_iter(parameters))
-            try:
-                deduped_pairs = set(val_type_pairs)
-            except TypeError:
-                # unhashable parameters
-                pass
-            else:
-                # similar logic to typing._deduplicate on Python 3.9+
-                if len(deduped_pairs) < len(val_type_pairs):
-                    new_parameters = []
-                    for pair in val_type_pairs:
-                        if pair in deduped_pairs:
-                            new_parameters.append(pair[0])
-                            deduped_pairs.remove(pair)
-                    assert not deduped_pairs, deduped_pairs
-                    parameters = tuple(new_parameters)
-
-            return _LiteralGenericAlias(self, parameters)
-
-    Literal = _LiteralForm(doc="""\
-                           A type that can be used to indicate to type checkers
-                           that the corresponding value has a value literally equivalent
-                           to the provided parameter. For example:
-
-                               var: Literal[4] = 4
-
-                           The type checker understands that 'var' is literally equal to
-                           the value 4 and no other value.
-
-                           Literal[...] cannot be subclassed. There is no runtime
-                           checking verifying that the parameter is actually a value
-                           instead of a type.""")
-
-
-_overload_dummy = typing._overload_dummy
-
-
-if hasattr(typing, "get_overloads"):  # 3.11+
-    overload = typing.overload
-    get_overloads = typing.get_overloads
-    clear_overloads = typing.clear_overloads
-else:
-    # {module: {qualname: {firstlineno: func}}}
-    _overload_registry = collections.defaultdict(
-        functools.partial(collections.defaultdict, dict)
-    )
-
-    def overload(func):
-        """Decorator for overloaded functions/methods.
-
-        In a stub file, place two or more stub definitions for the same
-        function in a row, each decorated with @overload.  For example:
-
-        @overload
-        def utf8(value: None) -> None: ...
-        @overload
-        def utf8(value: bytes) -> bytes: ...
-        @overload
-        def utf8(value: str) -> bytes: ...
-
-        In a non-stub file (i.e. a regular .py file), do the same but
-        follow it with an implementation.  The implementation should *not*
-        be decorated with @overload.  For example:
-
-        @overload
-        def utf8(value: None) -> None: ...
-        @overload
-        def utf8(value: bytes) -> bytes: ...
-        @overload
-        def utf8(value: str) -> bytes: ...
-        def utf8(value):
-            # implementation goes here
-
-        The overloads for a function can be retrieved at runtime using the
-        get_overloads() function.
-        """
-        # classmethod and staticmethod
-        f = getattr(func, "__func__", func)
-        try:
-            _overload_registry[f.__module__][f.__qualname__][
-                f.__code__.co_firstlineno
-            ] = func
-        except AttributeError:
-            # Not a normal function; ignore.
-            pass
-        return _overload_dummy
-
-    def get_overloads(func):
-        """Return all defined overloads for *func* as a sequence."""
-        # classmethod and staticmethod
-        f = getattr(func, "__func__", func)
-        if f.__module__ not in _overload_registry:
-            return []
-        mod_dict = _overload_registry[f.__module__]
-        if f.__qualname__ not in mod_dict:
-            return []
-        return list(mod_dict[f.__qualname__].values())
-
-    def clear_overloads():
-        """Clear all overloads in the registry."""
-        _overload_registry.clear()
-
-
-# This is not a real generic class.  Don't use outside annotations.
-Type = typing.Type
-
-# Various ABCs mimicking those in collections.abc.
-# A few are simply re-exported for completeness.
-Awaitable = typing.Awaitable
-Coroutine = typing.Coroutine
-AsyncIterable = typing.AsyncIterable
-AsyncIterator = typing.AsyncIterator
-Deque = typing.Deque
-DefaultDict = typing.DefaultDict
-OrderedDict = typing.OrderedDict
-Counter = typing.Counter
-ChainMap = typing.ChainMap
-Text = typing.Text
-TYPE_CHECKING = typing.TYPE_CHECKING
-
-
-if sys.version_info >= (3, 13, 0, "beta"):
-    from typing import AsyncContextManager, AsyncGenerator, ContextManager, Generator
-else:
-    def _is_dunder(attr):
-        return attr.startswith('__') and attr.endswith('__')
-
-    # Python <3.9 doesn't have typing._SpecialGenericAlias
-    _special_generic_alias_base = getattr(
-        typing, "_SpecialGenericAlias", typing._GenericAlias
-    )
-
-    class _SpecialGenericAlias(_special_generic_alias_base, _root=True):
-        def __init__(self, origin, nparams, *, inst=True, name=None, defaults=()):
-            if _special_generic_alias_base is typing._GenericAlias:
-                # Python <3.9
-                self.__origin__ = origin
-                self._nparams = nparams
-                super().__init__(origin, nparams, special=True, inst=inst, name=name)
-            else:
-                # Python >= 3.9
-                super().__init__(origin, nparams, inst=inst, name=name)
-            self._defaults = defaults
-
-        def __setattr__(self, attr, val):
-            allowed_attrs = {'_name', '_inst', '_nparams', '_defaults'}
-            if _special_generic_alias_base is typing._GenericAlias:
-                # Python <3.9
-                allowed_attrs.add("__origin__")
-            if _is_dunder(attr) or attr in allowed_attrs:
-                object.__setattr__(self, attr, val)
-            else:
-                setattr(self.__origin__, attr, val)
-
-        @typing._tp_cache
-        def __getitem__(self, params):
-            if not isinstance(params, tuple):
-                params = (params,)
-            msg = "Parameters to generic types must be types."
-            params = tuple(typing._type_check(p, msg) for p in params)
-            if (
-                self._defaults
-                and len(params) < self._nparams
-                and len(params) + len(self._defaults) >= self._nparams
-            ):
-                params = (*params, *self._defaults[len(params) - self._nparams:])
-            actual_len = len(params)
-
-            if actual_len != self._nparams:
-                if self._defaults:
-                    expected = f"at least {self._nparams - len(self._defaults)}"
-                else:
-                    expected = str(self._nparams)
-                if not self._nparams:
-                    raise TypeError(f"{self} is not a generic class")
-                raise TypeError(
-                    f"Too {'many' if actual_len > self._nparams else 'few'}"
-                    f" arguments for {self};"
-                    f" actual {actual_len}, expected {expected}"
-                )
-            return self.copy_with(params)
-
-    _NoneType = type(None)
-    Generator = _SpecialGenericAlias(
-        collections.abc.Generator, 3, defaults=(_NoneType, _NoneType)
-    )
-    AsyncGenerator = _SpecialGenericAlias(
-        collections.abc.AsyncGenerator, 2, defaults=(_NoneType,)
-    )
-    ContextManager = _SpecialGenericAlias(
-        contextlib.AbstractContextManager,
-        2,
-        name="ContextManager",
-        defaults=(typing.Optional[bool],)
-    )
-    AsyncContextManager = _SpecialGenericAlias(
-        contextlib.AbstractAsyncContextManager,
-        2,
-        name="AsyncContextManager",
-        defaults=(typing.Optional[bool],)
-    )
-
-
-_PROTO_ALLOWLIST = {
-    'collections.abc': [
-        'Callable', 'Awaitable', 'Iterable', 'Iterator', 'AsyncIterable',
-        'Hashable', 'Sized', 'Container', 'Collection', 'Reversible', 'Buffer',
-    ],
-    'contextlib': ['AbstractContextManager', 'AbstractAsyncContextManager'],
-    'typing_extensions': ['Buffer'],
-}
-
-
-_EXCLUDED_ATTRS = frozenset(typing.EXCLUDED_ATTRIBUTES) | {
-    "__match_args__", "__protocol_attrs__", "__non_callable_proto_members__",
-    "__final__",
-}
-
-
-def _get_protocol_attrs(cls):
-    attrs = set()
-    for base in cls.__mro__[:-1]:  # without object
-        if base.__name__ in {'Protocol', 'Generic'}:
-            continue
-        annotations = getattr(base, '__annotations__', {})
-        for attr in (*base.__dict__, *annotations):
-            if (not attr.startswith('_abc_') and attr not in _EXCLUDED_ATTRS):
-                attrs.add(attr)
-    return attrs
-
-
-def _caller(depth=2):
-    try:
-        return sys._getframe(depth).f_globals.get('__name__', '__main__')
-    except (AttributeError, ValueError):  # For platforms without _getframe()
-        return None
-
-
-# `__match_args__` attribute was removed from protocol members in 3.13,
-# we want to backport this change to older Python versions.
-if sys.version_info >= (3, 13):
-    Protocol = typing.Protocol
-else:
-    def _allow_reckless_class_checks(depth=3):
-        """Allow instance and class checks for special stdlib modules.
-        The abc and functools modules indiscriminately call isinstance() and
-        issubclass() on the whole MRO of a user class, which may contain protocols.
-        """
-        return _caller(depth) in {'abc', 'functools', None}
-
-    def _no_init(self, *args, **kwargs):
-        if type(self)._is_protocol:
-            raise TypeError('Protocols cannot be instantiated')
-
-    def _type_check_issubclass_arg_1(arg):
-        """Raise TypeError if `arg` is not an instance of `type`
-        in `issubclass(arg, )`.
-
-        In most cases, this is verified by type.__subclasscheck__.
-        Checking it again unnecessarily would slow down issubclass() checks,
-        so, we don't perform this check unless we absolutely have to.
-
-        For various error paths, however,
-        we want to ensure that *this* error message is shown to the user
-        where relevant, rather than a typing.py-specific error message.
-        """
-        if not isinstance(arg, type):
-            # Same error message as for issubclass(1, int).
-            raise TypeError('issubclass() arg 1 must be a class')
-
-    # Inheriting from typing._ProtocolMeta isn't actually desirable,
-    # but is necessary to allow typing.Protocol and typing_extensions.Protocol
-    # to mix without getting TypeErrors about "metaclass conflict"
-    class _ProtocolMeta(type(typing.Protocol)):
-        # This metaclass is somewhat unfortunate,
-        # but is necessary for several reasons...
-        #
-        # NOTE: DO NOT call super() in any methods in this class
-        # That would call the methods on typing._ProtocolMeta on Python 3.8-3.11
-        # and those are slow
-        def __new__(mcls, name, bases, namespace, **kwargs):
-            if name == "Protocol" and len(bases) < 2:
-                pass
-            elif {Protocol, typing.Protocol} & set(bases):
-                for base in bases:
-                    if not (
-                        base in {object, typing.Generic, Protocol, typing.Protocol}
-                        or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__, [])
-                        or is_protocol(base)
-                    ):
-                        raise TypeError(
-                            f"Protocols can only inherit from other protocols, "
-                            f"got {base!r}"
-                        )
-            return abc.ABCMeta.__new__(mcls, name, bases, namespace, **kwargs)
-
-        def __init__(cls, *args, **kwargs):
-            abc.ABCMeta.__init__(cls, *args, **kwargs)
-            if getattr(cls, "_is_protocol", False):
-                cls.__protocol_attrs__ = _get_protocol_attrs(cls)
-
-        def __subclasscheck__(cls, other):
-            if cls is Protocol:
-                return type.__subclasscheck__(cls, other)
-            if (
-                getattr(cls, '_is_protocol', False)
-                and not _allow_reckless_class_checks()
-            ):
-                if not getattr(cls, '_is_runtime_protocol', False):
-                    _type_check_issubclass_arg_1(other)
-                    raise TypeError(
-                        "Instance and class checks can only be used with "
-                        "@runtime_checkable protocols"
-                    )
-                if (
-                    # this attribute is set by @runtime_checkable:
-                    cls.__non_callable_proto_members__
-                    and cls.__dict__.get("__subclasshook__") is _proto_hook
-                ):
-                    _type_check_issubclass_arg_1(other)
-                    non_method_attrs = sorted(cls.__non_callable_proto_members__)
-                    raise TypeError(
-                        "Protocols with non-method members don't support issubclass()."
-                        f" Non-method members: {str(non_method_attrs)[1:-1]}."
-                    )
-            return abc.ABCMeta.__subclasscheck__(cls, other)
-
-        def __instancecheck__(cls, instance):
-            # We need this method for situations where attributes are
-            # assigned in __init__.
-            if cls is Protocol:
-                return type.__instancecheck__(cls, instance)
-            if not getattr(cls, "_is_protocol", False):
-                # i.e., it's a concrete subclass of a protocol
-                return abc.ABCMeta.__instancecheck__(cls, instance)
-
-            if (
-                not getattr(cls, '_is_runtime_protocol', False) and
-                not _allow_reckless_class_checks()
-            ):
-                raise TypeError("Instance and class checks can only be used with"
-                                " @runtime_checkable protocols")
-
-            if abc.ABCMeta.__instancecheck__(cls, instance):
-                return True
-
-            for attr in cls.__protocol_attrs__:
-                try:
-                    val = inspect.getattr_static(instance, attr)
-                except AttributeError:
-                    break
-                # this attribute is set by @runtime_checkable:
-                if val is None and attr not in cls.__non_callable_proto_members__:
-                    break
-            else:
-                return True
-
-            return False
-
-        def __eq__(cls, other):
-            # Hack so that typing.Generic.__class_getitem__
-            # treats typing_extensions.Protocol
-            # as equivalent to typing.Protocol
-            if abc.ABCMeta.__eq__(cls, other) is True:
-                return True
-            return cls is Protocol and other is typing.Protocol
-
-        # This has to be defined, or the abc-module cache
-        # complains about classes with this metaclass being unhashable,
-        # if we define only __eq__!
-        def __hash__(cls) -> int:
-            return type.__hash__(cls)
-
-    @classmethod
-    def _proto_hook(cls, other):
-        if not cls.__dict__.get('_is_protocol', False):
-            return NotImplemented
-
-        for attr in cls.__protocol_attrs__:
-            for base in other.__mro__:
-                # Check if the members appears in the class dictionary...
-                if attr in base.__dict__:
-                    if base.__dict__[attr] is None:
-                        return NotImplemented
-                    break
-
-                # ...or in annotations, if it is a sub-protocol.
-                annotations = getattr(base, '__annotations__', {})
-                if (
-                    isinstance(annotations, collections.abc.Mapping)
-                    and attr in annotations
-                    and is_protocol(other)
-                ):
-                    break
-            else:
-                return NotImplemented
-        return True
-
-    class Protocol(typing.Generic, metaclass=_ProtocolMeta):
-        __doc__ = typing.Protocol.__doc__
-        __slots__ = ()
-        _is_protocol = True
-        _is_runtime_protocol = False
-
-        def __init_subclass__(cls, *args, **kwargs):
-            super().__init_subclass__(*args, **kwargs)
-
-            # Determine if this is a protocol or a concrete subclass.
-            if not cls.__dict__.get('_is_protocol', False):
-                cls._is_protocol = any(b is Protocol for b in cls.__bases__)
-
-            # Set (or override) the protocol subclass hook.
-            if '__subclasshook__' not in cls.__dict__:
-                cls.__subclasshook__ = _proto_hook
-
-            # Prohibit instantiation for protocol classes
-            if cls._is_protocol and cls.__init__ is Protocol.__init__:
-                cls.__init__ = _no_init
-
-
-if sys.version_info >= (3, 13):
-    runtime_checkable = typing.runtime_checkable
-else:
-    def runtime_checkable(cls):
-        """Mark a protocol class as a runtime protocol.
-
-        Such protocol can be used with isinstance() and issubclass().
-        Raise TypeError if applied to a non-protocol class.
-        This allows a simple-minded structural check very similar to
-        one trick ponies in collections.abc such as Iterable.
-
-        For example::
-
-            @runtime_checkable
-            class Closable(Protocol):
-                def close(self): ...
-
-            assert isinstance(open('/some/file'), Closable)
-
-        Warning: this will check only the presence of the required methods,
-        not their type signatures!
-        """
-        if not issubclass(cls, typing.Generic) or not getattr(cls, '_is_protocol', False):
-            raise TypeError(f'@runtime_checkable can be only applied to protocol classes,'
-                            f' got {cls!r}')
-        cls._is_runtime_protocol = True
-
-        # typing.Protocol classes on <=3.11 break if we execute this block,
-        # because typing.Protocol classes on <=3.11 don't have a
-        # `__protocol_attrs__` attribute, and this block relies on the
-        # `__protocol_attrs__` attribute. Meanwhile, typing.Protocol classes on 3.12.2+
-        # break if we *don't* execute this block, because *they* assume that all
-        # protocol classes have a `__non_callable_proto_members__` attribute
-        # (which this block sets)
-        if isinstance(cls, _ProtocolMeta) or sys.version_info >= (3, 12, 2):
-            # PEP 544 prohibits using issubclass()
-            # with protocols that have non-method members.
-            # See gh-113320 for why we compute this attribute here,
-            # rather than in `_ProtocolMeta.__init__`
-            cls.__non_callable_proto_members__ = set()
-            for attr in cls.__protocol_attrs__:
-                try:
-                    is_callable = callable(getattr(cls, attr, None))
-                except Exception as e:
-                    raise TypeError(
-                        f"Failed to determine whether protocol member {attr!r} "
-                        "is a method member"
-                    ) from e
-                else:
-                    if not is_callable:
-                        cls.__non_callable_proto_members__.add(attr)
-
-        return cls
-
-
-# The "runtime" alias exists for backwards compatibility.
-runtime = runtime_checkable
-
-
-# Our version of runtime-checkable protocols is faster on Python 3.8-3.11
-if sys.version_info >= (3, 12):
-    SupportsInt = typing.SupportsInt
-    SupportsFloat = typing.SupportsFloat
-    SupportsComplex = typing.SupportsComplex
-    SupportsBytes = typing.SupportsBytes
-    SupportsIndex = typing.SupportsIndex
-    SupportsAbs = typing.SupportsAbs
-    SupportsRound = typing.SupportsRound
-else:
-    @runtime_checkable
-    class SupportsInt(Protocol):
-        """An ABC with one abstract method __int__."""
-        __slots__ = ()
-
-        @abc.abstractmethod
-        def __int__(self) -> int:
-            pass
-
-    @runtime_checkable
-    class SupportsFloat(Protocol):
-        """An ABC with one abstract method __float__."""
-        __slots__ = ()
-
-        @abc.abstractmethod
-        def __float__(self) -> float:
-            pass
-
-    @runtime_checkable
-    class SupportsComplex(Protocol):
-        """An ABC with one abstract method __complex__."""
-        __slots__ = ()
-
-        @abc.abstractmethod
-        def __complex__(self) -> complex:
-            pass
-
-    @runtime_checkable
-    class SupportsBytes(Protocol):
-        """An ABC with one abstract method __bytes__."""
-        __slots__ = ()
-
-        @abc.abstractmethod
-        def __bytes__(self) -> bytes:
-            pass
-
-    @runtime_checkable
-    class SupportsIndex(Protocol):
-        __slots__ = ()
-
-        @abc.abstractmethod
-        def __index__(self) -> int:
-            pass
-
-    @runtime_checkable
-    class SupportsAbs(Protocol[T_co]):
-        """
-        An ABC with one abstract method __abs__ that is covariant in its return type.
-        """
-        __slots__ = ()
-
-        @abc.abstractmethod
-        def __abs__(self) -> T_co:
-            pass
-
-    @runtime_checkable
-    class SupportsRound(Protocol[T_co]):
-        """
-        An ABC with one abstract method __round__ that is covariant in its return type.
-        """
-        __slots__ = ()
-
-        @abc.abstractmethod
-        def __round__(self, ndigits: int = 0) -> T_co:
-            pass
-
-
-def _ensure_subclassable(mro_entries):
-    def inner(func):
-        if sys.implementation.name == "pypy" and sys.version_info < (3, 9):
-            cls_dict = {
-                "__call__": staticmethod(func),
-                "__mro_entries__": staticmethod(mro_entries)
-            }
-            t = type(func.__name__, (), cls_dict)
-            return functools.update_wrapper(t(), func)
-        else:
-            func.__mro_entries__ = mro_entries
-            return func
-    return inner
-
-
-# Update this to something like >=3.13.0b1 if and when
-# PEP 728 is implemented in CPython
-_PEP_728_IMPLEMENTED = False
-
-if _PEP_728_IMPLEMENTED:
-    # The standard library TypedDict in Python 3.8 does not store runtime information
-    # about which (if any) keys are optional.  See https://bugs.python.org/issue38834
-    # The standard library TypedDict in Python 3.9.0/1 does not honour the "total"
-    # keyword with old-style TypedDict().  See https://bugs.python.org/issue42059
-    # The standard library TypedDict below Python 3.11 does not store runtime
-    # information about optional and required keys when using Required or NotRequired.
-    # Generic TypedDicts are also impossible using typing.TypedDict on Python <3.11.
-    # Aaaand on 3.12 we add __orig_bases__ to TypedDict
-    # to enable better runtime introspection.
-    # On 3.13 we deprecate some odd ways of creating TypedDicts.
-    # Also on 3.13, PEP 705 adds the ReadOnly[] qualifier.
-    # PEP 728 (still pending) makes more changes.
-    TypedDict = typing.TypedDict
-    _TypedDictMeta = typing._TypedDictMeta
-    is_typeddict = typing.is_typeddict
-else:
-    # 3.10.0 and later
-    _TAKES_MODULE = "module" in inspect.signature(typing._type_check).parameters
-
-    def _get_typeddict_qualifiers(annotation_type):
-        while True:
-            annotation_origin = get_origin(annotation_type)
-            if annotation_origin is Annotated:
-                annotation_args = get_args(annotation_type)
-                if annotation_args:
-                    annotation_type = annotation_args[0]
-                else:
-                    break
-            elif annotation_origin is Required:
-                yield Required
-                annotation_type, = get_args(annotation_type)
-            elif annotation_origin is NotRequired:
-                yield NotRequired
-                annotation_type, = get_args(annotation_type)
-            elif annotation_origin is ReadOnly:
-                yield ReadOnly
-                annotation_type, = get_args(annotation_type)
-            else:
-                break
-
-    class _TypedDictMeta(type):
-        def __new__(cls, name, bases, ns, *, total=True, closed=False):
-            """Create new typed dict class object.
-
-            This method is called when TypedDict is subclassed,
-            or when TypedDict is instantiated. This way
-            TypedDict supports all three syntax forms described in its docstring.
-            Subclasses and instances of TypedDict return actual dictionaries.
-            """
-            for base in bases:
-                if type(base) is not _TypedDictMeta and base is not typing.Generic:
-                    raise TypeError('cannot inherit from both a TypedDict type '
-                                    'and a non-TypedDict base class')
-
-            if any(issubclass(b, typing.Generic) for b in bases):
-                generic_base = (typing.Generic,)
-            else:
-                generic_base = ()
-
-            # typing.py generally doesn't let you inherit from plain Generic, unless
-            # the name of the class happens to be "Protocol"
-            tp_dict = type.__new__(_TypedDictMeta, "Protocol", (*generic_base, dict), ns)
-            tp_dict.__name__ = name
-            if tp_dict.__qualname__ == "Protocol":
-                tp_dict.__qualname__ = name
-
-            if not hasattr(tp_dict, '__orig_bases__'):
-                tp_dict.__orig_bases__ = bases
-
-            annotations = {}
-            if "__annotations__" in ns:
-                own_annotations = ns["__annotations__"]
-            elif "__annotate__" in ns:
-                # TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
-                own_annotations = ns["__annotate__"](1)
-            else:
-                own_annotations = {}
-            msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type"
-            if _TAKES_MODULE:
-                own_annotations = {
-                    n: typing._type_check(tp, msg, module=tp_dict.__module__)
-                    for n, tp in own_annotations.items()
-                }
-            else:
-                own_annotations = {
-                    n: typing._type_check(tp, msg)
-                    for n, tp in own_annotations.items()
-                }
-            required_keys = set()
-            optional_keys = set()
-            readonly_keys = set()
-            mutable_keys = set()
-            extra_items_type = None
-
-            for base in bases:
-                base_dict = base.__dict__
-
-                annotations.update(base_dict.get('__annotations__', {}))
-                required_keys.update(base_dict.get('__required_keys__', ()))
-                optional_keys.update(base_dict.get('__optional_keys__', ()))
-                readonly_keys.update(base_dict.get('__readonly_keys__', ()))
-                mutable_keys.update(base_dict.get('__mutable_keys__', ()))
-                base_extra_items_type = base_dict.get('__extra_items__', None)
-                if base_extra_items_type is not None:
-                    extra_items_type = base_extra_items_type
-
-            if closed and extra_items_type is None:
-                extra_items_type = Never
-            if closed and "__extra_items__" in own_annotations:
-                annotation_type = own_annotations.pop("__extra_items__")
-                qualifiers = set(_get_typeddict_qualifiers(annotation_type))
-                if Required in qualifiers:
-                    raise TypeError(
-                        "Special key __extra_items__ does not support "
-                        "Required"
-                    )
-                if NotRequired in qualifiers:
-                    raise TypeError(
-                        "Special key __extra_items__ does not support "
-                        "NotRequired"
-                    )
-                extra_items_type = annotation_type
-
-            annotations.update(own_annotations)
-            for annotation_key, annotation_type in own_annotations.items():
-                qualifiers = set(_get_typeddict_qualifiers(annotation_type))
-
-                if Required in qualifiers:
-                    required_keys.add(annotation_key)
-                elif NotRequired in qualifiers:
-                    optional_keys.add(annotation_key)
-                elif total:
-                    required_keys.add(annotation_key)
-                else:
-                    optional_keys.add(annotation_key)
-                if ReadOnly in qualifiers:
-                    mutable_keys.discard(annotation_key)
-                    readonly_keys.add(annotation_key)
-                else:
-                    mutable_keys.add(annotation_key)
-                    readonly_keys.discard(annotation_key)
-
-            tp_dict.__annotations__ = annotations
-            tp_dict.__required_keys__ = frozenset(required_keys)
-            tp_dict.__optional_keys__ = frozenset(optional_keys)
-            tp_dict.__readonly_keys__ = frozenset(readonly_keys)
-            tp_dict.__mutable_keys__ = frozenset(mutable_keys)
-            if not hasattr(tp_dict, '__total__'):
-                tp_dict.__total__ = total
-            tp_dict.__closed__ = closed
-            tp_dict.__extra_items__ = extra_items_type
-            return tp_dict
-
-        __call__ = dict  # static method
-
-        def __subclasscheck__(cls, other):
-            # Typed dicts are only for static structural subtyping.
-            raise TypeError('TypedDict does not support instance and class checks')
-
-        __instancecheck__ = __subclasscheck__
-
-    _TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
-
-    @_ensure_subclassable(lambda bases: (_TypedDict,))
-    def TypedDict(typename, fields=_marker, /, *, total=True, closed=False, **kwargs):
-        """A simple typed namespace. At runtime it is equivalent to a plain dict.
-
-        TypedDict creates a dictionary type such that a type checker will expect all
-        instances to have a certain set of keys, where each key is
-        associated with a value of a consistent type. This expectation
-        is not checked at runtime.
-
-        Usage::
-
-            class Point2D(TypedDict):
-                x: int
-                y: int
-                label: str
-
-            a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
-            b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check
-
-            assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
-
-        The type info can be accessed via the Point2D.__annotations__ dict, and
-        the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets.
-        TypedDict supports an additional equivalent form::
-
-            Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
-
-        By default, all keys must be present in a TypedDict. It is possible
-        to override this by specifying totality::
-
-            class Point2D(TypedDict, total=False):
-                x: int
-                y: int
-
-        This means that a Point2D TypedDict can have any of the keys omitted. A type
-        checker is only expected to support a literal False or True as the value of
-        the total argument. True is the default, and makes all items defined in the
-        class body be required.
-
-        The Required and NotRequired special forms can also be used to mark
-        individual keys as being required or not required::
-
-            class Point2D(TypedDict):
-                x: int  # the "x" key must always be present (Required is the default)
-                y: NotRequired[int]  # the "y" key can be omitted
-
-        See PEP 655 for more details on Required and NotRequired.
-        """
-        if fields is _marker or fields is None:
-            if fields is _marker:
-                deprecated_thing = "Failing to pass a value for the 'fields' parameter"
-            else:
-                deprecated_thing = "Passing `None` as the 'fields' parameter"
-
-            example = f"`{typename} = TypedDict({typename!r}, {{}})`"
-            deprecation_msg = (
-                f"{deprecated_thing} is deprecated and will be disallowed in "
-                "Python 3.15. To create a TypedDict class with 0 fields "
-                "using the functional syntax, pass an empty dictionary, e.g. "
-            ) + example + "."
-            warnings.warn(deprecation_msg, DeprecationWarning, stacklevel=2)
-            if closed is not False and closed is not True:
-                kwargs["closed"] = closed
-                closed = False
-            fields = kwargs
-        elif kwargs:
-            raise TypeError("TypedDict takes either a dict or keyword arguments,"
-                            " but not both")
-        if kwargs:
-            if sys.version_info >= (3, 13):
-                raise TypeError("TypedDict takes no keyword arguments")
-            warnings.warn(
-                "The kwargs-based syntax for TypedDict definitions is deprecated "
-                "in Python 3.11, will be removed in Python 3.13, and may not be "
-                "understood by third-party type checkers.",
-                DeprecationWarning,
-                stacklevel=2,
-            )
-
-        ns = {'__annotations__': dict(fields)}
-        module = _caller()
-        if module is not None:
-            # Setting correct module is necessary to make typed dict classes pickleable.
-            ns['__module__'] = module
-
-        td = _TypedDictMeta(typename, (), ns, total=total, closed=closed)
-        td.__orig_bases__ = (TypedDict,)
-        return td
-
-    if hasattr(typing, "_TypedDictMeta"):
-        _TYPEDDICT_TYPES = (typing._TypedDictMeta, _TypedDictMeta)
-    else:
-        _TYPEDDICT_TYPES = (_TypedDictMeta,)
-
-    def is_typeddict(tp):
-        """Check if an annotation is a TypedDict class
-
-        For example::
-            class Film(TypedDict):
-                title: str
-                year: int
-
-            is_typeddict(Film)  # => True
-            is_typeddict(Union[list, str])  # => False
-        """
-        # On 3.8, this would otherwise return True
-        if hasattr(typing, "TypedDict") and tp is typing.TypedDict:
-            return False
-        return isinstance(tp, _TYPEDDICT_TYPES)
-
-
-if hasattr(typing, "assert_type"):
-    assert_type = typing.assert_type
-
-else:
-    def assert_type(val, typ, /):
-        """Assert (to the type checker) that the value is of the given type.
-
-        When the type checker encounters a call to assert_type(), it
-        emits an error if the value is not of the specified type::
-
-            def greet(name: str) -> None:
-                assert_type(name, str)  # ok
-                assert_type(name, int)  # type checker error
-
-        At runtime this returns the first argument unchanged and otherwise
-        does nothing.
-        """
-        return val
-
-
-if hasattr(typing, "ReadOnly"):  # 3.13+
-    get_type_hints = typing.get_type_hints
-else:  # <=3.13
-    # replaces _strip_annotations()
-    def _strip_extras(t):
-        """Strips Annotated, Required and NotRequired from a given type."""
-        if isinstance(t, _AnnotatedAlias):
-            return _strip_extras(t.__origin__)
-        if hasattr(t, "__origin__") and t.__origin__ in (Required, NotRequired, ReadOnly):
-            return _strip_extras(t.__args__[0])
-        if isinstance(t, typing._GenericAlias):
-            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
-            if stripped_args == t.__args__:
-                return t
-            return t.copy_with(stripped_args)
-        if hasattr(_types, "GenericAlias") and isinstance(t, _types.GenericAlias):
-            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
-            if stripped_args == t.__args__:
-                return t
-            return _types.GenericAlias(t.__origin__, stripped_args)
-        if hasattr(_types, "UnionType") and isinstance(t, _types.UnionType):
-            stripped_args = tuple(_strip_extras(a) for a in t.__args__)
-            if stripped_args == t.__args__:
-                return t
-            return functools.reduce(operator.or_, stripped_args)
-
-        return t
-
-    def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
-        """Return type hints for an object.
-
-        This is often the same as obj.__annotations__, but it handles
-        forward references encoded as string literals, adds Optional[t] if a
-        default value equal to None is set and recursively replaces all
-        'Annotated[T, ...]', 'Required[T]' or 'NotRequired[T]' with 'T'
-        (unless 'include_extras=True').
-
-        The argument may be a module, class, method, or function. The annotations
-        are returned as a dictionary. For classes, annotations include also
-        inherited members.
-
-        TypeError is raised if the argument is not of a type that can contain
-        annotations, and an empty dictionary is returned if no annotations are
-        present.
-
-        BEWARE -- the behavior of globalns and localns is counterintuitive
-        (unless you are familiar with how eval() and exec() work).  The
-        search order is locals first, then globals.
-
-        - If no dict arguments are passed, an attempt is made to use the
-          globals from obj (or the respective module's globals for classes),
-          and these are also used as the locals.  If the object does not appear
-          to have globals, an empty dictionary is used.
-
-        - If one dict argument is passed, it is used for both globals and
-          locals.
-
-        - If two dict arguments are passed, they specify globals and
-          locals, respectively.
-        """
-        if hasattr(typing, "Annotated"):  # 3.9+
-            hint = typing.get_type_hints(
-                obj, globalns=globalns, localns=localns, include_extras=True
-            )
-        else:  # 3.8
-            hint = typing.get_type_hints(obj, globalns=globalns, localns=localns)
-        if include_extras:
-            return hint
-        return {k: _strip_extras(t) for k, t in hint.items()}
-
-
-# Python 3.9+ has PEP 593 (Annotated)
-if hasattr(typing, 'Annotated'):
-    Annotated = typing.Annotated
-    # Not exported and not a public API, but needed for get_origin() and get_args()
-    # to work.
-    _AnnotatedAlias = typing._AnnotatedAlias
-# 3.8
-else:
-    class _AnnotatedAlias(typing._GenericAlias, _root=True):
-        """Runtime representation of an annotated type.
-
-        At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't'
-        with extra annotations. The alias behaves like a normal typing alias,
-        instantiating is the same as instantiating the underlying type, binding
-        it to types is also the same.
-        """
-        def __init__(self, origin, metadata):
-            if isinstance(origin, _AnnotatedAlias):
-                metadata = origin.__metadata__ + metadata
-                origin = origin.__origin__
-            super().__init__(origin, origin)
-            self.__metadata__ = metadata
-
-        def copy_with(self, params):
-            assert len(params) == 1
-            new_type = params[0]
-            return _AnnotatedAlias(new_type, self.__metadata__)
-
-        def __repr__(self):
-            return (f"typing_extensions.Annotated[{typing._type_repr(self.__origin__)}, "
-                    f"{', '.join(repr(a) for a in self.__metadata__)}]")
-
-        def __reduce__(self):
-            return operator.getitem, (
-                Annotated, (self.__origin__, *self.__metadata__)
-            )
-
-        def __eq__(self, other):
-            if not isinstance(other, _AnnotatedAlias):
-                return NotImplemented
-            if self.__origin__ != other.__origin__:
-                return False
-            return self.__metadata__ == other.__metadata__
-
-        def __hash__(self):
-            return hash((self.__origin__, self.__metadata__))
-
-    class Annotated:
-        """Add context specific metadata to a type.
-
-        Example: Annotated[int, runtime_check.Unsigned] indicates to the
-        hypothetical runtime_check module that this type is an unsigned int.
-        Every other consumer of this type can ignore this metadata and treat
-        this type as int.
-
-        The first argument to Annotated must be a valid type (and will be in
-        the __origin__ field), the remaining arguments are kept as a tuple in
-        the __extra__ field.
-
-        Details:
-
-        - It's an error to call `Annotated` with less than two arguments.
-        - Nested Annotated are flattened::
-
-            Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]
-
-        - Instantiating an annotated type is equivalent to instantiating the
-        underlying type::
-
-            Annotated[C, Ann1](5) == C(5)
-
-        - Annotated can be used as a generic type alias::
-
-            Optimized = Annotated[T, runtime.Optimize()]
-            Optimized[int] == Annotated[int, runtime.Optimize()]
-
-            OptimizedList = Annotated[List[T], runtime.Optimize()]
-            OptimizedList[int] == Annotated[List[int], runtime.Optimize()]
-        """
-
-        __slots__ = ()
-
-        def __new__(cls, *args, **kwargs):
-            raise TypeError("Type Annotated cannot be instantiated.")
-
-        @typing._tp_cache
-        def __class_getitem__(cls, params):
-            if not isinstance(params, tuple) or len(params) < 2:
-                raise TypeError("Annotated[...] should be used "
-                                "with at least two arguments (a type and an "
-                                "annotation).")
-            allowed_special_forms = (ClassVar, Final)
-            if get_origin(params[0]) in allowed_special_forms:
-                origin = params[0]
-            else:
-                msg = "Annotated[t, ...]: t must be a type."
-                origin = typing._type_check(params[0], msg)
-            metadata = tuple(params[1:])
-            return _AnnotatedAlias(origin, metadata)
-
-        def __init_subclass__(cls, *args, **kwargs):
-            raise TypeError(
-                f"Cannot subclass {cls.__module__}.Annotated"
-            )
-
-# Python 3.8 has get_origin() and get_args() but those implementations aren't
-# Annotated-aware, so we can't use those. Python 3.9's versions don't support
-# ParamSpecArgs and ParamSpecKwargs, so only Python 3.10's versions will do.
-if sys.version_info[:2] >= (3, 10):
-    get_origin = typing.get_origin
-    get_args = typing.get_args
-# 3.8-3.9
-else:
-    try:
-        # 3.9+
-        from typing import _BaseGenericAlias
-    except ImportError:
-        _BaseGenericAlias = typing._GenericAlias
-    try:
-        # 3.9+
-        from typing import GenericAlias as _typing_GenericAlias
-    except ImportError:
-        _typing_GenericAlias = typing._GenericAlias
-
-    def get_origin(tp):
-        """Get the unsubscripted version of a type.
-
-        This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar
-        and Annotated. Return None for unsupported types. Examples::
-
-            get_origin(Literal[42]) is Literal
-            get_origin(int) is None
-            get_origin(ClassVar[int]) is ClassVar
-            get_origin(Generic) is Generic
-            get_origin(Generic[T]) is Generic
-            get_origin(Union[T, int]) is Union
-            get_origin(List[Tuple[T, T]][int]) == list
-            get_origin(P.args) is P
-        """
-        if isinstance(tp, _AnnotatedAlias):
-            return Annotated
-        if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias, _BaseGenericAlias,
-                           ParamSpecArgs, ParamSpecKwargs)):
-            return tp.__origin__
-        if tp is typing.Generic:
-            return typing.Generic
-        return None
-
-    def get_args(tp):
-        """Get type arguments with all substitutions performed.
-
-        For unions, basic simplifications used by Union constructor are performed.
-        Examples::
-            get_args(Dict[str, int]) == (str, int)
-            get_args(int) == ()
-            get_args(Union[int, Union[T, int], str][int]) == (int, str)
-            get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
-            get_args(Callable[[], T][int]) == ([], int)
-        """
-        if isinstance(tp, _AnnotatedAlias):
-            return (tp.__origin__, *tp.__metadata__)
-        if isinstance(tp, (typing._GenericAlias, _typing_GenericAlias)):
-            if getattr(tp, "_special", False):
-                return ()
-            res = tp.__args__
-            if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis:
-                res = (list(res[:-1]), res[-1])
-            return res
-        return ()
-
-
-# 3.10+
-if hasattr(typing, 'TypeAlias'):
-    TypeAlias = typing.TypeAlias
-# 3.9
-elif sys.version_info[:2] >= (3, 9):
-    @_ExtensionsSpecialForm
-    def TypeAlias(self, parameters):
-        """Special marker indicating that an assignment should
-        be recognized as a proper type alias definition by type
-        checkers.
-
-        For example::
-
-            Predicate: TypeAlias = Callable[..., bool]
-
-        It's invalid when used anywhere except as in the example above.
-        """
-        raise TypeError(f"{self} is not subscriptable")
-# 3.8
-else:
-    TypeAlias = _ExtensionsSpecialForm(
-        'TypeAlias',
-        doc="""Special marker indicating that an assignment should
-        be recognized as a proper type alias definition by type
-        checkers.
-
-        For example::
-
-            Predicate: TypeAlias = Callable[..., bool]
-
-        It's invalid when used anywhere except as in the example
-        above."""
-    )
-
-
-if hasattr(typing, "NoDefault"):
-    NoDefault = typing.NoDefault
-else:
-    class NoDefaultTypeMeta(type):
-        def __setattr__(cls, attr, value):
-            # TypeError is consistent with the behavior of NoneType
-            raise TypeError(
-                f"cannot set {attr!r} attribute of immutable type {cls.__name__!r}"
-            )
-
-    class NoDefaultType(metaclass=NoDefaultTypeMeta):
-        """The type of the NoDefault singleton."""
-
-        __slots__ = ()
-
-        def __new__(cls):
-            return globals().get("NoDefault") or object.__new__(cls)
-
-        def __repr__(self):
-            return "typing_extensions.NoDefault"
-
-        def __reduce__(self):
-            return "NoDefault"
-
-    NoDefault = NoDefaultType()
-    del NoDefaultType, NoDefaultTypeMeta
-
-
-def _set_default(type_param, default):
-    type_param.has_default = lambda: default is not NoDefault
-    type_param.__default__ = default
-
-
-def _set_module(typevarlike):
-    # for pickling:
-    def_mod = _caller(depth=3)
-    if def_mod != 'typing_extensions':
-        typevarlike.__module__ = def_mod
-
-
-class _DefaultMixin:
-    """Mixin for TypeVarLike defaults."""
-
-    __slots__ = ()
-    __init__ = _set_default
-
-
-# Classes using this metaclass must provide a _backported_typevarlike ClassVar
-class _TypeVarLikeMeta(type):
-    def __instancecheck__(cls, __instance: Any) -> bool:
-        return isinstance(__instance, cls._backported_typevarlike)
-
-
-if _PEP_696_IMPLEMENTED:
-    from typing import TypeVar
-else:
-    # Add default and infer_variance parameters from PEP 696 and 695
-    class TypeVar(metaclass=_TypeVarLikeMeta):
-        """Type variable."""
-
-        _backported_typevarlike = typing.TypeVar
-
-        def __new__(cls, name, *constraints, bound=None,
-                    covariant=False, contravariant=False,
-                    default=NoDefault, infer_variance=False):
-            if hasattr(typing, "TypeAliasType"):
-                # PEP 695 implemented (3.12+), can pass infer_variance to typing.TypeVar
-                typevar = typing.TypeVar(name, *constraints, bound=bound,
-                                         covariant=covariant, contravariant=contravariant,
-                                         infer_variance=infer_variance)
-            else:
-                typevar = typing.TypeVar(name, *constraints, bound=bound,
-                                         covariant=covariant, contravariant=contravariant)
-                if infer_variance and (covariant or contravariant):
-                    raise ValueError("Variance cannot be specified with infer_variance.")
-                typevar.__infer_variance__ = infer_variance
-
-            _set_default(typevar, default)
-            _set_module(typevar)
-
-            def _tvar_prepare_subst(alias, args):
-                if (
-                    typevar.has_default()
-                    and alias.__parameters__.index(typevar) == len(args)
-                ):
-                    args += (typevar.__default__,)
-                return args
-
-            typevar.__typing_prepare_subst__ = _tvar_prepare_subst
-            return typevar
-
-        def __init_subclass__(cls) -> None:
-            raise TypeError(f"type '{__name__}.TypeVar' is not an acceptable base type")
-
-
-# Python 3.10+ has PEP 612
-if hasattr(typing, 'ParamSpecArgs'):
-    ParamSpecArgs = typing.ParamSpecArgs
-    ParamSpecKwargs = typing.ParamSpecKwargs
-# 3.8-3.9
-else:
-    class _Immutable:
-        """Mixin to indicate that object should not be copied."""
-        __slots__ = ()
-
-        def __copy__(self):
-            return self
-
-        def __deepcopy__(self, memo):
-            return self
-
-    class ParamSpecArgs(_Immutable):
-        """The args for a ParamSpec object.
-
-        Given a ParamSpec object P, P.args is an instance of ParamSpecArgs.
-
-        ParamSpecArgs objects have a reference back to their ParamSpec:
-
-        P.args.__origin__ is P
-
-        This type is meant for runtime introspection and has no special meaning to
-        static type checkers.
-        """
-        def __init__(self, origin):
-            self.__origin__ = origin
-
-        def __repr__(self):
-            return f"{self.__origin__.__name__}.args"
-
-        def __eq__(self, other):
-            if not isinstance(other, ParamSpecArgs):
-                return NotImplemented
-            return self.__origin__ == other.__origin__
-
-    class ParamSpecKwargs(_Immutable):
-        """The kwargs for a ParamSpec object.
-
-        Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs.
-
-        ParamSpecKwargs objects have a reference back to their ParamSpec:
-
-        P.kwargs.__origin__ is P
-
-        This type is meant for runtime introspection and has no special meaning to
-        static type checkers.
-        """
-        def __init__(self, origin):
-            self.__origin__ = origin
-
-        def __repr__(self):
-            return f"{self.__origin__.__name__}.kwargs"
-
-        def __eq__(self, other):
-            if not isinstance(other, ParamSpecKwargs):
-                return NotImplemented
-            return self.__origin__ == other.__origin__
-
-
-if _PEP_696_IMPLEMENTED:
-    from typing import ParamSpec
-
-# 3.10+
-elif hasattr(typing, 'ParamSpec'):
-
-    # Add default parameter - PEP 696
-    class ParamSpec(metaclass=_TypeVarLikeMeta):
-        """Parameter specification."""
-
-        _backported_typevarlike = typing.ParamSpec
-
-        def __new__(cls, name, *, bound=None,
-                    covariant=False, contravariant=False,
-                    infer_variance=False, default=NoDefault):
-            if hasattr(typing, "TypeAliasType"):
-                # PEP 695 implemented, can pass infer_variance to typing.TypeVar
-                paramspec = typing.ParamSpec(name, bound=bound,
-                                             covariant=covariant,
-                                             contravariant=contravariant,
-                                             infer_variance=infer_variance)
-            else:
-                paramspec = typing.ParamSpec(name, bound=bound,
-                                             covariant=covariant,
-                                             contravariant=contravariant)
-                paramspec.__infer_variance__ = infer_variance
-
-            _set_default(paramspec, default)
-            _set_module(paramspec)
-
-            def _paramspec_prepare_subst(alias, args):
-                params = alias.__parameters__
-                i = params.index(paramspec)
-                if i == len(args) and paramspec.has_default():
-                    args = [*args, paramspec.__default__]
-                if i >= len(args):
-                    raise TypeError(f"Too few arguments for {alias}")
-                # Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
-                if len(params) == 1 and not typing._is_param_expr(args[0]):
-                    assert i == 0
-                    args = (args,)
-                # Convert lists to tuples to help other libraries cache the results.
-                elif isinstance(args[i], list):
-                    args = (*args[:i], tuple(args[i]), *args[i + 1:])
-                return args
-
-            paramspec.__typing_prepare_subst__ = _paramspec_prepare_subst
-            return paramspec
-
-        def __init_subclass__(cls) -> None:
-            raise TypeError(f"type '{__name__}.ParamSpec' is not an acceptable base type")
-
-# 3.8-3.9
-else:
-
-    # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
-    class ParamSpec(list, _DefaultMixin):
-        """Parameter specification variable.
-
-        Usage::
-
-           P = ParamSpec('P')
-
-        Parameter specification variables exist primarily for the benefit of static
-        type checkers.  They are used to forward the parameter types of one
-        callable to another callable, a pattern commonly found in higher order
-        functions and decorators.  They are only valid when used in ``Concatenate``,
-        or s the first argument to ``Callable``. In Python 3.10 and higher,
-        they are also supported in user-defined Generics at runtime.
-        See class Generic for more information on generic types.  An
-        example for annotating a decorator::
-
-           T = TypeVar('T')
-           P = ParamSpec('P')
-
-           def add_logging(f: Callable[P, T]) -> Callable[P, T]:
-               '''A type-safe decorator to add logging to a function.'''
-               def inner(*args: P.args, **kwargs: P.kwargs) -> T:
-                   logging.info(f'{f.__name__} was called')
-                   return f(*args, **kwargs)
-               return inner
-
-           @add_logging
-           def add_two(x: float, y: float) -> float:
-               '''Add two numbers together.'''
-               return x + y
-
-        Parameter specification variables defined with covariant=True or
-        contravariant=True can be used to declare covariant or contravariant
-        generic types.  These keyword arguments are valid, but their actual semantics
-        are yet to be decided.  See PEP 612 for details.
-
-        Parameter specification variables can be introspected. e.g.:
-
-           P.__name__ == 'T'
-           P.__bound__ == None
-           P.__covariant__ == False
-           P.__contravariant__ == False
-
-        Note that only parameter specification variables defined in global scope can
-        be pickled.
-        """
-
-        # Trick Generic __parameters__.
-        __class__ = typing.TypeVar
-
-        @property
-        def args(self):
-            return ParamSpecArgs(self)
-
-        @property
-        def kwargs(self):
-            return ParamSpecKwargs(self)
-
-        def __init__(self, name, *, bound=None, covariant=False, contravariant=False,
-                     infer_variance=False, default=NoDefault):
-            list.__init__(self, [self])
-            self.__name__ = name
-            self.__covariant__ = bool(covariant)
-            self.__contravariant__ = bool(contravariant)
-            self.__infer_variance__ = bool(infer_variance)
-            if bound:
-                self.__bound__ = typing._type_check(bound, 'Bound must be a type.')
-            else:
-                self.__bound__ = None
-            _DefaultMixin.__init__(self, default)
-
-            # for pickling:
-            def_mod = _caller()
-            if def_mod != 'typing_extensions':
-                self.__module__ = def_mod
-
-        def __repr__(self):
-            if self.__infer_variance__:
-                prefix = ''
-            elif self.__covariant__:
-                prefix = '+'
-            elif self.__contravariant__:
-                prefix = '-'
-            else:
-                prefix = '~'
-            return prefix + self.__name__
-
-        def __hash__(self):
-            return object.__hash__(self)
-
-        def __eq__(self, other):
-            return self is other
-
-        def __reduce__(self):
-            return self.__name__
-
-        # Hack to get typing._type_check to pass.
-        def __call__(self, *args, **kwargs):
-            pass
-
-
-# 3.8-3.9
-if not hasattr(typing, 'Concatenate'):
-    # Inherits from list as a workaround for Callable checks in Python < 3.9.2.
-    class _ConcatenateGenericAlias(list):
-
-        # Trick Generic into looking into this for __parameters__.
-        __class__ = typing._GenericAlias
-
-        # Flag in 3.8.
-        _special = False
-
-        def __init__(self, origin, args):
-            super().__init__(args)
-            self.__origin__ = origin
-            self.__args__ = args
-
-        def __repr__(self):
-            _type_repr = typing._type_repr
-            return (f'{_type_repr(self.__origin__)}'
-                    f'[{", ".join(_type_repr(arg) for arg in self.__args__)}]')
-
-        def __hash__(self):
-            return hash((self.__origin__, self.__args__))
-
-        # Hack to get typing._type_check to pass in Generic.
-        def __call__(self, *args, **kwargs):
-            pass
-
-        @property
-        def __parameters__(self):
-            return tuple(
-                tp for tp in self.__args__ if isinstance(tp, (typing.TypeVar, ParamSpec))
-            )
-
-
-# 3.8-3.9
-@typing._tp_cache
-def _concatenate_getitem(self, parameters):
-    if parameters == ():
-        raise TypeError("Cannot take a Concatenate of no types.")
-    if not isinstance(parameters, tuple):
-        parameters = (parameters,)
-    if not isinstance(parameters[-1], ParamSpec):
-        raise TypeError("The last parameter to Concatenate should be a "
-                        "ParamSpec variable.")
-    msg = "Concatenate[arg, ...]: each arg must be a type."
-    parameters = tuple(typing._type_check(p, msg) for p in parameters)
-    return _ConcatenateGenericAlias(self, parameters)
-
-
-# 3.10+
-if hasattr(typing, 'Concatenate'):
-    Concatenate = typing.Concatenate
-    _ConcatenateGenericAlias = typing._ConcatenateGenericAlias
-# 3.9
-elif sys.version_info[:2] >= (3, 9):
-    @_ExtensionsSpecialForm
-    def Concatenate(self, parameters):
-        """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
-        higher order function which adds, removes or transforms parameters of a
-        callable.
-
-        For example::
-
-           Callable[Concatenate[int, P], int]
-
-        See PEP 612 for detailed information.
-        """
-        return _concatenate_getitem(self, parameters)
-# 3.8
-else:
-    class _ConcatenateForm(_ExtensionsSpecialForm, _root=True):
-        def __getitem__(self, parameters):
-            return _concatenate_getitem(self, parameters)
-
-    Concatenate = _ConcatenateForm(
-        'Concatenate',
-        doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
-        higher order function which adds, removes or transforms parameters of a
-        callable.
-
-        For example::
-
-           Callable[Concatenate[int, P], int]
-
-        See PEP 612 for detailed information.
-        """)
-
-# 3.10+
-if hasattr(typing, 'TypeGuard'):
-    TypeGuard = typing.TypeGuard
-# 3.9
-elif sys.version_info[:2] >= (3, 9):
-    @_ExtensionsSpecialForm
-    def TypeGuard(self, parameters):
-        """Special typing form used to annotate the return type of a user-defined
-        type guard function.  ``TypeGuard`` only accepts a single type argument.
-        At runtime, functions marked this way should return a boolean.
-
-        ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
-        type checkers to determine a more precise type of an expression within a
-        program's code flow.  Usually type narrowing is done by analyzing
-        conditional code flow and applying the narrowing to a block of code.  The
-        conditional expression here is sometimes referred to as a "type guard".
-
-        Sometimes it would be convenient to use a user-defined boolean function
-        as a type guard.  Such a function should use ``TypeGuard[...]`` as its
-        return type to alert static type checkers to this intention.
-
-        Using  ``-> TypeGuard`` tells the static type checker that for a given
-        function:
-
-        1. The return value is a boolean.
-        2. If the return value is ``True``, the type of its argument
-        is the type inside ``TypeGuard``.
-
-        For example::
-
-            def is_str(val: Union[str, float]):
-                # "isinstance" type guard
-                if isinstance(val, str):
-                    # Type of ``val`` is narrowed to ``str``
-                    ...
-                else:
-                    # Else, type of ``val`` is narrowed to ``float``.
-                    ...
-
-        Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
-        form of ``TypeA`` (it can even be a wider form) and this may lead to
-        type-unsafe results.  The main reason is to allow for things like
-        narrowing ``List[object]`` to ``List[str]`` even though the latter is not
-        a subtype of the former, since ``List`` is invariant.  The responsibility of
-        writing type-safe type guards is left to the user.
-
-        ``TypeGuard`` also works with type variables.  For more information, see
-        PEP 647 (User-Defined Type Guards).
-        """
-        item = typing._type_check(parameters, f'{self} accepts only a single type.')
-        return typing._GenericAlias(self, (item,))
-# 3.8
-else:
-    class _TypeGuardForm(_ExtensionsSpecialForm, _root=True):
-        def __getitem__(self, parameters):
-            item = typing._type_check(parameters,
-                                      f'{self._name} accepts only a single type')
-            return typing._GenericAlias(self, (item,))
-
-    TypeGuard = _TypeGuardForm(
-        'TypeGuard',
-        doc="""Special typing form used to annotate the return type of a user-defined
-        type guard function.  ``TypeGuard`` only accepts a single type argument.
-        At runtime, functions marked this way should return a boolean.
-
-        ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
-        type checkers to determine a more precise type of an expression within a
-        program's code flow.  Usually type narrowing is done by analyzing
-        conditional code flow and applying the narrowing to a block of code.  The
-        conditional expression here is sometimes referred to as a "type guard".
-
-        Sometimes it would be convenient to use a user-defined boolean function
-        as a type guard.  Such a function should use ``TypeGuard[...]`` as its
-        return type to alert static type checkers to this intention.
-
-        Using  ``-> TypeGuard`` tells the static type checker that for a given
-        function:
-
-        1. The return value is a boolean.
-        2. If the return value is ``True``, the type of its argument
-        is the type inside ``TypeGuard``.
-
-        For example::
-
-            def is_str(val: Union[str, float]):
-                # "isinstance" type guard
-                if isinstance(val, str):
-                    # Type of ``val`` is narrowed to ``str``
-                    ...
-                else:
-                    # Else, type of ``val`` is narrowed to ``float``.
-                    ...
-
-        Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
-        form of ``TypeA`` (it can even be a wider form) and this may lead to
-        type-unsafe results.  The main reason is to allow for things like
-        narrowing ``List[object]`` to ``List[str]`` even though the latter is not
-        a subtype of the former, since ``List`` is invariant.  The responsibility of
-        writing type-safe type guards is left to the user.
-
-        ``TypeGuard`` also works with type variables.  For more information, see
-        PEP 647 (User-Defined Type Guards).
-        """)
-
-# 3.13+
-if hasattr(typing, 'TypeIs'):
-    TypeIs = typing.TypeIs
-# 3.9
-elif sys.version_info[:2] >= (3, 9):
-    @_ExtensionsSpecialForm
-    def TypeIs(self, parameters):
-        """Special typing form used to annotate the return type of a user-defined
-        type narrower function.  ``TypeIs`` only accepts a single type argument.
-        At runtime, functions marked this way should return a boolean.
-
-        ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
-        type checkers to determine a more precise type of an expression within a
-        program's code flow.  Usually type narrowing is done by analyzing
-        conditional code flow and applying the narrowing to a block of code.  The
-        conditional expression here is sometimes referred to as a "type guard".
-
-        Sometimes it would be convenient to use a user-defined boolean function
-        as a type guard.  Such a function should use ``TypeIs[...]`` as its
-        return type to alert static type checkers to this intention.
-
-        Using  ``-> TypeIs`` tells the static type checker that for a given
-        function:
-
-        1. The return value is a boolean.
-        2. If the return value is ``True``, the type of its argument
-        is the intersection of the type inside ``TypeGuard`` and the argument's
-        previously known type.
-
-        For example::
-
-            def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
-                return hasattr(val, '__await__')
-
-            def f(val: Union[int, Awaitable[int]]) -> int:
-                if is_awaitable(val):
-                    assert_type(val, Awaitable[int])
-                else:
-                    assert_type(val, int)
-
-        ``TypeIs`` also works with type variables.  For more information, see
-        PEP 742 (Narrowing types with TypeIs).
-        """
-        item = typing._type_check(parameters, f'{self} accepts only a single type.')
-        return typing._GenericAlias(self, (item,))
-# 3.8
-else:
-    class _TypeIsForm(_ExtensionsSpecialForm, _root=True):
-        def __getitem__(self, parameters):
-            item = typing._type_check(parameters,
-                                      f'{self._name} accepts only a single type')
-            return typing._GenericAlias(self, (item,))
-
-    TypeIs = _TypeIsForm(
-        'TypeIs',
-        doc="""Special typing form used to annotate the return type of a user-defined
-        type narrower function.  ``TypeIs`` only accepts a single type argument.
-        At runtime, functions marked this way should return a boolean.
-
-        ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static
-        type checkers to determine a more precise type of an expression within a
-        program's code flow.  Usually type narrowing is done by analyzing
-        conditional code flow and applying the narrowing to a block of code.  The
-        conditional expression here is sometimes referred to as a "type guard".
-
-        Sometimes it would be convenient to use a user-defined boolean function
-        as a type guard.  Such a function should use ``TypeIs[...]`` as its
-        return type to alert static type checkers to this intention.
-
-        Using  ``-> TypeIs`` tells the static type checker that for a given
-        function:
-
-        1. The return value is a boolean.
-        2. If the return value is ``True``, the type of its argument
-        is the intersection of the type inside ``TypeGuard`` and the argument's
-        previously known type.
-
-        For example::
-
-            def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]:
-                return hasattr(val, '__await__')
-
-            def f(val: Union[int, Awaitable[int]]) -> int:
-                if is_awaitable(val):
-                    assert_type(val, Awaitable[int])
-                else:
-                    assert_type(val, int)
-
-        ``TypeIs`` also works with type variables.  For more information, see
-        PEP 742 (Narrowing types with TypeIs).
-        """)
-
-
-# Vendored from cpython typing._SpecialFrom
-class _SpecialForm(typing._Final, _root=True):
-    __slots__ = ('_name', '__doc__', '_getitem')
-
-    def __init__(self, getitem):
-        self._getitem = getitem
-        self._name = getitem.__name__
-        self.__doc__ = getitem.__doc__
-
-    def __getattr__(self, item):
-        if item in {'__name__', '__qualname__'}:
-            return self._name
-
-        raise AttributeError(item)
-
-    def __mro_entries__(self, bases):
-        raise TypeError(f"Cannot subclass {self!r}")
-
-    def __repr__(self):
-        return f'typing_extensions.{self._name}'
-
-    def __reduce__(self):
-        return self._name
-
-    def __call__(self, *args, **kwds):
-        raise TypeError(f"Cannot instantiate {self!r}")
-
-    def __or__(self, other):
-        return typing.Union[self, other]
-
-    def __ror__(self, other):
-        return typing.Union[other, self]
-
-    def __instancecheck__(self, obj):
-        raise TypeError(f"{self} cannot be used with isinstance()")
-
-    def __subclasscheck__(self, cls):
-        raise TypeError(f"{self} cannot be used with issubclass()")
-
-    @typing._tp_cache
-    def __getitem__(self, parameters):
-        return self._getitem(self, parameters)
-
-
-if hasattr(typing, "LiteralString"):  # 3.11+
-    LiteralString = typing.LiteralString
-else:
-    @_SpecialForm
-    def LiteralString(self, params):
-        """Represents an arbitrary literal string.
-
-        Example::
-
-          from typing_extensions import LiteralString
-
-          def query(sql: LiteralString) -> ...:
-              ...
-
-          query("SELECT * FROM table")  # ok
-          query(f"SELECT * FROM {input()}")  # not ok
-
-        See PEP 675 for details.
-
-        """
-        raise TypeError(f"{self} is not subscriptable")
-
-
-if hasattr(typing, "Self"):  # 3.11+
-    Self = typing.Self
-else:
-    @_SpecialForm
-    def Self(self, params):
-        """Used to spell the type of "self" in classes.
-
-        Example::
-
-          from typing import Self
-
-          class ReturnsSelf:
-              def parse(self, data: bytes) -> Self:
-                  ...
-                  return self
-
-        """
-
-        raise TypeError(f"{self} is not subscriptable")
-
-
-if hasattr(typing, "Never"):  # 3.11+
-    Never = typing.Never
-else:
-    @_SpecialForm
-    def Never(self, params):
-        """The bottom type, a type that has no members.
-
-        This can be used to define a function that should never be
-        called, or a function that never returns::
-
-            from typing_extensions import Never
-
-            def never_call_me(arg: Never) -> None:
-                pass
-
-            def int_or_str(arg: int | str) -> None:
-                never_call_me(arg)  # type checker error
-                match arg:
-                    case int():
-                        print("It's an int")
-                    case str():
-                        print("It's a str")
-                    case _:
-                        never_call_me(arg)  # ok, arg is of type Never
-
-        """
-
-        raise TypeError(f"{self} is not subscriptable")
-
-
-if hasattr(typing, 'Required'):  # 3.11+
-    Required = typing.Required
-    NotRequired = typing.NotRequired
-elif sys.version_info[:2] >= (3, 9):  # 3.9-3.10
-    @_ExtensionsSpecialForm
-    def Required(self, parameters):
-        """A special typing construct to mark a key of a total=False TypedDict
-        as required. For example:
-
-            class Movie(TypedDict, total=False):
-                title: Required[str]
-                year: int
-
-            m = Movie(
-                title='The Matrix',  # typechecker error if key is omitted
-                year=1999,
-            )
-
-        There is no runtime checking that a required key is actually provided
-        when instantiating a related TypedDict.
-        """
-        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
-        return typing._GenericAlias(self, (item,))
-
-    @_ExtensionsSpecialForm
-    def NotRequired(self, parameters):
-        """A special typing construct to mark a key of a TypedDict as
-        potentially missing. For example:
-
-            class Movie(TypedDict):
-                title: str
-                year: NotRequired[int]
-
-            m = Movie(
-                title='The Matrix',  # typechecker error if key is omitted
-                year=1999,
-            )
-        """
-        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
-        return typing._GenericAlias(self, (item,))
-
-else:  # 3.8
-    class _RequiredForm(_ExtensionsSpecialForm, _root=True):
-        def __getitem__(self, parameters):
-            item = typing._type_check(parameters,
-                                      f'{self._name} accepts only a single type.')
-            return typing._GenericAlias(self, (item,))
-
-    Required = _RequiredForm(
-        'Required',
-        doc="""A special typing construct to mark a key of a total=False TypedDict
-        as required. For example:
-
-            class Movie(TypedDict, total=False):
-                title: Required[str]
-                year: int
-
-            m = Movie(
-                title='The Matrix',  # typechecker error if key is omitted
-                year=1999,
-            )
-
-        There is no runtime checking that a required key is actually provided
-        when instantiating a related TypedDict.
-        """)
-    NotRequired = _RequiredForm(
-        'NotRequired',
-        doc="""A special typing construct to mark a key of a TypedDict as
-        potentially missing. For example:
-
-            class Movie(TypedDict):
-                title: str
-                year: NotRequired[int]
-
-            m = Movie(
-                title='The Matrix',  # typechecker error if key is omitted
-                year=1999,
-            )
-        """)
-
-
-if hasattr(typing, 'ReadOnly'):
-    ReadOnly = typing.ReadOnly
-elif sys.version_info[:2] >= (3, 9):  # 3.9-3.12
-    @_ExtensionsSpecialForm
-    def ReadOnly(self, parameters):
-        """A special typing construct to mark an item of a TypedDict as read-only.
-
-        For example:
-
-            class Movie(TypedDict):
-                title: ReadOnly[str]
-                year: int
-
-            def mutate_movie(m: Movie) -> None:
-                m["year"] = 1992  # allowed
-                m["title"] = "The Matrix"  # typechecker error
-
-        There is no runtime checking for this property.
-        """
-        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
-        return typing._GenericAlias(self, (item,))
-
-else:  # 3.8
-    class _ReadOnlyForm(_ExtensionsSpecialForm, _root=True):
-        def __getitem__(self, parameters):
-            item = typing._type_check(parameters,
-                                      f'{self._name} accepts only a single type.')
-            return typing._GenericAlias(self, (item,))
-
-    ReadOnly = _ReadOnlyForm(
-        'ReadOnly',
-        doc="""A special typing construct to mark a key of a TypedDict as read-only.
-
-        For example:
-
-            class Movie(TypedDict):
-                title: ReadOnly[str]
-                year: int
-
-            def mutate_movie(m: Movie) -> None:
-                m["year"] = 1992  # allowed
-                m["title"] = "The Matrix"  # typechecker error
-
-        There is no runtime checking for this propery.
-        """)
-
-
-_UNPACK_DOC = """\
-Type unpack operator.
-
-The type unpack operator takes the child types from some container type,
-such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For
-example:
-
-  # For some generic class `Foo`:
-  Foo[Unpack[tuple[int, str]]]  # Equivalent to Foo[int, str]
-
-  Ts = TypeVarTuple('Ts')
-  # Specifies that `Bar` is generic in an arbitrary number of types.
-  # (Think of `Ts` as a tuple of an arbitrary number of individual
-  #  `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
-  #  `Generic[]`.)
-  class Bar(Generic[Unpack[Ts]]): ...
-  Bar[int]  # Valid
-  Bar[int, str]  # Also valid
-
-From Python 3.11, this can also be done using the `*` operator:
-
-    Foo[*tuple[int, str]]
-    class Bar(Generic[*Ts]): ...
-
-The operator can also be used along with a `TypedDict` to annotate
-`**kwargs` in a function signature. For instance:
-
-  class Movie(TypedDict):
-    name: str
-    year: int
-
-  # This function expects two keyword arguments - *name* of type `str` and
-  # *year* of type `int`.
-  def foo(**kwargs: Unpack[Movie]): ...
-
-Note that there is only some runtime checking of this operator. Not
-everything the runtime allows may be accepted by static type checkers.
-
-For more information, see PEP 646 and PEP 692.
-"""
-
-
-if sys.version_info >= (3, 12):  # PEP 692 changed the repr of Unpack[]
-    Unpack = typing.Unpack
-
-    def _is_unpack(obj):
-        return get_origin(obj) is Unpack
-
-elif sys.version_info[:2] >= (3, 9):  # 3.9+
-    class _UnpackSpecialForm(_ExtensionsSpecialForm, _root=True):
-        def __init__(self, getitem):
-            super().__init__(getitem)
-            self.__doc__ = _UNPACK_DOC
-
-    class _UnpackAlias(typing._GenericAlias, _root=True):
-        __class__ = typing.TypeVar
-
-        @property
-        def __typing_unpacked_tuple_args__(self):
-            assert self.__origin__ is Unpack
-            assert len(self.__args__) == 1
-            arg, = self.__args__
-            if isinstance(arg, (typing._GenericAlias, _types.GenericAlias)):
-                if arg.__origin__ is not tuple:
-                    raise TypeError("Unpack[...] must be used with a tuple type")
-                return arg.__args__
-            return None
-
-    @_UnpackSpecialForm
-    def Unpack(self, parameters):
-        item = typing._type_check(parameters, f'{self._name} accepts only a single type.')
-        return _UnpackAlias(self, (item,))
-
-    def _is_unpack(obj):
-        return isinstance(obj, _UnpackAlias)
-
-else:  # 3.8
-    class _UnpackAlias(typing._GenericAlias, _root=True):
-        __class__ = typing.TypeVar
-
-    class _UnpackForm(_ExtensionsSpecialForm, _root=True):
-        def __getitem__(self, parameters):
-            item = typing._type_check(parameters,
-                                      f'{self._name} accepts only a single type.')
-            return _UnpackAlias(self, (item,))
-
-    Unpack = _UnpackForm('Unpack', doc=_UNPACK_DOC)
-
-    def _is_unpack(obj):
-        return isinstance(obj, _UnpackAlias)
-
-
-if _PEP_696_IMPLEMENTED:
-    from typing import TypeVarTuple
-
-elif hasattr(typing, "TypeVarTuple"):  # 3.11+
-
-    def _unpack_args(*args):
-        newargs = []
-        for arg in args:
-            subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
-            if subargs is not None and not (subargs and subargs[-1] is ...):
-                newargs.extend(subargs)
-            else:
-                newargs.append(arg)
-        return newargs
-
-    # Add default parameter - PEP 696
-    class TypeVarTuple(metaclass=_TypeVarLikeMeta):
-        """Type variable tuple."""
-
-        _backported_typevarlike = typing.TypeVarTuple
-
-        def __new__(cls, name, *, default=NoDefault):
-            tvt = typing.TypeVarTuple(name)
-            _set_default(tvt, default)
-            _set_module(tvt)
-
-            def _typevartuple_prepare_subst(alias, args):
-                params = alias.__parameters__
-                typevartuple_index = params.index(tvt)
-                for param in params[typevartuple_index + 1:]:
-                    if isinstance(param, TypeVarTuple):
-                        raise TypeError(
-                            f"More than one TypeVarTuple parameter in {alias}"
-                        )
-
-                alen = len(args)
-                plen = len(params)
-                left = typevartuple_index
-                right = plen - typevartuple_index - 1
-                var_tuple_index = None
-                fillarg = None
-                for k, arg in enumerate(args):
-                    if not isinstance(arg, type):
-                        subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
-                        if subargs and len(subargs) == 2 and subargs[-1] is ...:
-                            if var_tuple_index is not None:
-                                raise TypeError(
-                                    "More than one unpacked "
-                                    "arbitrary-length tuple argument"
-                                )
-                            var_tuple_index = k
-                            fillarg = subargs[0]
-                if var_tuple_index is not None:
-                    left = min(left, var_tuple_index)
-                    right = min(right, alen - var_tuple_index - 1)
-                elif left + right > alen:
-                    raise TypeError(f"Too few arguments for {alias};"
-                                    f" actual {alen}, expected at least {plen - 1}")
-                if left == alen - right and tvt.has_default():
-                    replacement = _unpack_args(tvt.__default__)
-                else:
-                    replacement = args[left: alen - right]
-
-                return (
-                    *args[:left],
-                    *([fillarg] * (typevartuple_index - left)),
-                    replacement,
-                    *([fillarg] * (plen - right - left - typevartuple_index - 1)),
-                    *args[alen - right:],
-                )
-
-            tvt.__typing_prepare_subst__ = _typevartuple_prepare_subst
-            return tvt
-
-        def __init_subclass__(self, *args, **kwds):
-            raise TypeError("Cannot subclass special typing classes")
-
-else:  # <=3.10
-    class TypeVarTuple(_DefaultMixin):
-        """Type variable tuple.
-
-        Usage::
-
-            Ts = TypeVarTuple('Ts')
-
-        In the same way that a normal type variable is a stand-in for a single
-        type such as ``int``, a type variable *tuple* is a stand-in for a *tuple*
-        type such as ``Tuple[int, str]``.
-
-        Type variable tuples can be used in ``Generic`` declarations.
-        Consider the following example::
-
-            class Array(Generic[*Ts]): ...
-
-        The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``,
-        where ``T1`` and ``T2`` are type variables. To use these type variables
-        as type parameters of ``Array``, we must *unpack* the type variable tuple using
-        the star operator: ``*Ts``. The signature of ``Array`` then behaves
-        as if we had simply written ``class Array(Generic[T1, T2]): ...``.
-        In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows
-        us to parameterise the class with an *arbitrary* number of type parameters.
-
-        Type variable tuples can be used anywhere a normal ``TypeVar`` can.
-        This includes class definitions, as shown above, as well as function
-        signatures and variable annotations::
-
-            class Array(Generic[*Ts]):
-
-                def __init__(self, shape: Tuple[*Ts]):
-                    self._shape: Tuple[*Ts] = shape
-
-                def get_shape(self) -> Tuple[*Ts]:
-                    return self._shape
-
-            shape = (Height(480), Width(640))
-            x: Array[Height, Width] = Array(shape)
-            y = abs(x)  # Inferred type is Array[Height, Width]
-            z = x + x   #        ...    is Array[Height, Width]
-            x.get_shape()  #     ...    is tuple[Height, Width]
-
-        """
-
-        # Trick Generic __parameters__.
-        __class__ = typing.TypeVar
-
-        def __iter__(self):
-            yield self.__unpacked__
-
-        def __init__(self, name, *, default=NoDefault):
-            self.__name__ = name
-            _DefaultMixin.__init__(self, default)
-
-            # for pickling:
-            def_mod = _caller()
-            if def_mod != 'typing_extensions':
-                self.__module__ = def_mod
-
-            self.__unpacked__ = Unpack[self]
-
-        def __repr__(self):
-            return self.__name__
-
-        def __hash__(self):
-            return object.__hash__(self)
-
-        def __eq__(self, other):
-            return self is other
-
-        def __reduce__(self):
-            return self.__name__
-
-        def __init_subclass__(self, *args, **kwds):
-            if '_root' not in kwds:
-                raise TypeError("Cannot subclass special typing classes")
-
-
-if hasattr(typing, "reveal_type"):  # 3.11+
-    reveal_type = typing.reveal_type
-else:  # <=3.10
-    def reveal_type(obj: T, /) -> T:
-        """Reveal the inferred type of a variable.
-
-        When a static type checker encounters a call to ``reveal_type()``,
-        it will emit the inferred type of the argument::
-
-            x: int = 1
-            reveal_type(x)
-
-        Running a static type checker (e.g., ``mypy``) on this example
-        will produce output similar to 'Revealed type is "builtins.int"'.
-
-        At runtime, the function prints the runtime type of the
-        argument and returns it unchanged.
-
-        """
-        print(f"Runtime type is {type(obj).__name__!r}", file=sys.stderr)
-        return obj
-
-
-if hasattr(typing, "_ASSERT_NEVER_REPR_MAX_LENGTH"):  # 3.11+
-    _ASSERT_NEVER_REPR_MAX_LENGTH = typing._ASSERT_NEVER_REPR_MAX_LENGTH
-else:  # <=3.10
-    _ASSERT_NEVER_REPR_MAX_LENGTH = 100
-
-
-if hasattr(typing, "assert_never"):  # 3.11+
-    assert_never = typing.assert_never
-else:  # <=3.10
-    def assert_never(arg: Never, /) -> Never:
-        """Assert to the type checker that a line of code is unreachable.
-
-        Example::
-
-            def int_or_str(arg: int | str) -> None:
-                match arg:
-                    case int():
-                        print("It's an int")
-                    case str():
-                        print("It's a str")
-                    case _:
-                        assert_never(arg)
-
-        If a type checker finds that a call to assert_never() is
-        reachable, it will emit an error.
-
-        At runtime, this throws an exception when called.
-
-        """
-        value = repr(arg)
-        if len(value) > _ASSERT_NEVER_REPR_MAX_LENGTH:
-            value = value[:_ASSERT_NEVER_REPR_MAX_LENGTH] + '...'
-        raise AssertionError(f"Expected code to be unreachable, but got: {value}")
-
-
-if sys.version_info >= (3, 12):  # 3.12+
-    # dataclass_transform exists in 3.11 but lacks the frozen_default parameter
-    dataclass_transform = typing.dataclass_transform
-else:  # <=3.11
-    def dataclass_transform(
-        *,
-        eq_default: bool = True,
-        order_default: bool = False,
-        kw_only_default: bool = False,
-        frozen_default: bool = False,
-        field_specifiers: typing.Tuple[
-            typing.Union[typing.Type[typing.Any], typing.Callable[..., typing.Any]],
-            ...
-        ] = (),
-        **kwargs: typing.Any,
-    ) -> typing.Callable[[T], T]:
-        """Decorator that marks a function, class, or metaclass as providing
-        dataclass-like behavior.
-
-        Example:
-
-            from typing_extensions import dataclass_transform
-
-            _T = TypeVar("_T")
-
-            # Used on a decorator function
-            @dataclass_transform()
-            def create_model(cls: type[_T]) -> type[_T]:
-                ...
-                return cls
-
-            @create_model
-            class CustomerModel:
-                id: int
-                name: str
-
-            # Used on a base class
-            @dataclass_transform()
-            class ModelBase: ...
-
-            class CustomerModel(ModelBase):
-                id: int
-                name: str
-
-            # Used on a metaclass
-            @dataclass_transform()
-            class ModelMeta(type): ...
-
-            class ModelBase(metaclass=ModelMeta): ...
-
-            class CustomerModel(ModelBase):
-                id: int
-                name: str
-
-        Each of the ``CustomerModel`` classes defined in this example will now
-        behave similarly to a dataclass created with the ``@dataclasses.dataclass``
-        decorator. For example, the type checker will synthesize an ``__init__``
-        method.
-
-        The arguments to this decorator can be used to customize this behavior:
-        - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be
-          True or False if it is omitted by the caller.
-        - ``order_default`` indicates whether the ``order`` parameter is
-          assumed to be True or False if it is omitted by the caller.
-        - ``kw_only_default`` indicates whether the ``kw_only`` parameter is
-          assumed to be True or False if it is omitted by the caller.
-        - ``frozen_default`` indicates whether the ``frozen`` parameter is
-          assumed to be True or False if it is omitted by the caller.
-        - ``field_specifiers`` specifies a static list of supported classes
-          or functions that describe fields, similar to ``dataclasses.field()``.
-
-        At runtime, this decorator records its arguments in the
-        ``__dataclass_transform__`` attribute on the decorated object.
-
-        See PEP 681 for details.
-
-        """
-        def decorator(cls_or_fn):
-            cls_or_fn.__dataclass_transform__ = {
-                "eq_default": eq_default,
-                "order_default": order_default,
-                "kw_only_default": kw_only_default,
-                "frozen_default": frozen_default,
-                "field_specifiers": field_specifiers,
-                "kwargs": kwargs,
-            }
-            return cls_or_fn
-        return decorator
-
-
-if hasattr(typing, "override"):  # 3.12+
-    override = typing.override
-else:  # <=3.11
-    _F = typing.TypeVar("_F", bound=typing.Callable[..., typing.Any])
-
-    def override(arg: _F, /) -> _F:
-        """Indicate that a method is intended to override a method in a base class.
-
-        Usage:
-
-            class Base:
-                def method(self) -> None:
-                    pass
-
-            class Child(Base):
-                @override
-                def method(self) -> None:
-                    super().method()
-
-        When this decorator is applied to a method, the type checker will
-        validate that it overrides a method with the same name on a base class.
-        This helps prevent bugs that may occur when a base class is changed
-        without an equivalent change to a child class.
-
-        There is no runtime checking of these properties. The decorator
-        sets the ``__override__`` attribute to ``True`` on the decorated object
-        to allow runtime introspection.
-
-        See PEP 698 for details.
-
-        """
-        try:
-            arg.__override__ = True
-        except (AttributeError, TypeError):
-            # Skip the attribute silently if it is not writable.
-            # AttributeError happens if the object has __slots__ or a
-            # read-only property, TypeError if it's a builtin class.
-            pass
-        return arg
-
-
-if hasattr(warnings, "deprecated"):
-    deprecated = warnings.deprecated
-else:
-    _T = typing.TypeVar("_T")
-
-    class deprecated:
-        """Indicate that a class, function or overload is deprecated.
-
-        When this decorator is applied to an object, the type checker
-        will generate a diagnostic on usage of the deprecated object.
-
-        Usage:
-
-            @deprecated("Use B instead")
-            class A:
-                pass
-
-            @deprecated("Use g instead")
-            def f():
-                pass
-
-            @overload
-            @deprecated("int support is deprecated")
-            def g(x: int) -> int: ...
-            @overload
-            def g(x: str) -> int: ...
-
-        The warning specified by *category* will be emitted at runtime
-        on use of deprecated objects. For functions, that happens on calls;
-        for classes, on instantiation and on creation of subclasses.
-        If the *category* is ``None``, no warning is emitted at runtime.
-        The *stacklevel* determines where the
-        warning is emitted. If it is ``1`` (the default), the warning
-        is emitted at the direct caller of the deprecated object; if it
-        is higher, it is emitted further up the stack.
-        Static type checker behavior is not affected by the *category*
-        and *stacklevel* arguments.
-
-        The deprecation message passed to the decorator is saved in the
-        ``__deprecated__`` attribute on the decorated object.
-        If applied to an overload, the decorator
-        must be after the ``@overload`` decorator for the attribute to
-        exist on the overload as returned by ``get_overloads()``.
-
-        See PEP 702 for details.
-
-        """
-        def __init__(
-            self,
-            message: str,
-            /,
-            *,
-            category: typing.Optional[typing.Type[Warning]] = DeprecationWarning,
-            stacklevel: int = 1,
-        ) -> None:
-            if not isinstance(message, str):
-                raise TypeError(
-                    "Expected an object of type str for 'message', not "
-                    f"{type(message).__name__!r}"
-                )
-            self.message = message
-            self.category = category
-            self.stacklevel = stacklevel
-
-        def __call__(self, arg: _T, /) -> _T:
-            # Make sure the inner functions created below don't
-            # retain a reference to self.
-            msg = self.message
-            category = self.category
-            stacklevel = self.stacklevel
-            if category is None:
-                arg.__deprecated__ = msg
-                return arg
-            elif isinstance(arg, type):
-                import functools
-                from types import MethodType
-
-                original_new = arg.__new__
-
-                @functools.wraps(original_new)
-                def __new__(cls, *args, **kwargs):
-                    if cls is arg:
-                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
-                    if original_new is not object.__new__:
-                        return original_new(cls, *args, **kwargs)
-                    # Mirrors a similar check in object.__new__.
-                    elif cls.__init__ is object.__init__ and (args or kwargs):
-                        raise TypeError(f"{cls.__name__}() takes no arguments")
-                    else:
-                        return original_new(cls)
-
-                arg.__new__ = staticmethod(__new__)
-
-                original_init_subclass = arg.__init_subclass__
-                # We need slightly different behavior if __init_subclass__
-                # is a bound method (likely if it was implemented in Python)
-                if isinstance(original_init_subclass, MethodType):
-                    original_init_subclass = original_init_subclass.__func__
-
-                    @functools.wraps(original_init_subclass)
-                    def __init_subclass__(*args, **kwargs):
-                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
-                        return original_init_subclass(*args, **kwargs)
-
-                    arg.__init_subclass__ = classmethod(__init_subclass__)
-                # Or otherwise, which likely means it's a builtin such as
-                # object's implementation of __init_subclass__.
-                else:
-                    @functools.wraps(original_init_subclass)
-                    def __init_subclass__(*args, **kwargs):
-                        warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
-                        return original_init_subclass(*args, **kwargs)
-
-                    arg.__init_subclass__ = __init_subclass__
-
-                arg.__deprecated__ = __new__.__deprecated__ = msg
-                __init_subclass__.__deprecated__ = msg
-                return arg
-            elif callable(arg):
-                import functools
-
-                @functools.wraps(arg)
-                def wrapper(*args, **kwargs):
-                    warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
-                    return arg(*args, **kwargs)
-
-                arg.__deprecated__ = wrapper.__deprecated__ = msg
-                return wrapper
-            else:
-                raise TypeError(
-                    "@deprecated decorator with non-None category must be applied to "
-                    f"a class or callable, not {arg!r}"
-                )
-
-
-# We have to do some monkey patching to deal with the dual nature of
-# Unpack/TypeVarTuple:
-# - We want Unpack to be a kind of TypeVar so it gets accepted in
-#   Generic[Unpack[Ts]]
-# - We want it to *not* be treated as a TypeVar for the purposes of
-#   counting generic parameters, so that when we subscript a generic,
-#   the runtime doesn't try to substitute the Unpack with the subscripted type.
-if not hasattr(typing, "TypeVarTuple"):
-    def _check_generic(cls, parameters, elen=_marker):
-        """Check correct count for parameters of a generic cls (internal helper).
-
-        This gives a nice error message in case of count mismatch.
-        """
-        if not elen:
-            raise TypeError(f"{cls} is not a generic class")
-        if elen is _marker:
-            if not hasattr(cls, "__parameters__") or not cls.__parameters__:
-                raise TypeError(f"{cls} is not a generic class")
-            elen = len(cls.__parameters__)
-        alen = len(parameters)
-        if alen != elen:
-            expect_val = elen
-            if hasattr(cls, "__parameters__"):
-                parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
-                num_tv_tuples = sum(isinstance(p, TypeVarTuple) for p in parameters)
-                if (num_tv_tuples > 0) and (alen >= elen - num_tv_tuples):
-                    return
-
-                # deal with TypeVarLike defaults
-                # required TypeVarLikes cannot appear after a defaulted one.
-                if alen < elen:
-                    # since we validate TypeVarLike default in _collect_type_vars
-                    # or _collect_parameters we can safely check parameters[alen]
-                    if (
-                        getattr(parameters[alen], '__default__', NoDefault)
-                        is not NoDefault
-                    ):
-                        return
-
-                    num_default_tv = sum(getattr(p, '__default__', NoDefault)
-                                         is not NoDefault for p in parameters)
-
-                    elen -= num_default_tv
-
-                    expect_val = f"at least {elen}"
-
-            things = "arguments" if sys.version_info >= (3, 10) else "parameters"
-            raise TypeError(f"Too {'many' if alen > elen else 'few'} {things}"
-                            f" for {cls}; actual {alen}, expected {expect_val}")
-else:
-    # Python 3.11+
-
-    def _check_generic(cls, parameters, elen):
-        """Check correct count for parameters of a generic cls (internal helper).
-
-        This gives a nice error message in case of count mismatch.
-        """
-        if not elen:
-            raise TypeError(f"{cls} is not a generic class")
-        alen = len(parameters)
-        if alen != elen:
-            expect_val = elen
-            if hasattr(cls, "__parameters__"):
-                parameters = [p for p in cls.__parameters__ if not _is_unpack(p)]
-
-                # deal with TypeVarLike defaults
-                # required TypeVarLikes cannot appear after a defaulted one.
-                if alen < elen:
-                    # since we validate TypeVarLike default in _collect_type_vars
-                    # or _collect_parameters we can safely check parameters[alen]
-                    if (
-                        getattr(parameters[alen], '__default__', NoDefault)
-                        is not NoDefault
-                    ):
-                        return
-
-                    num_default_tv = sum(getattr(p, '__default__', NoDefault)
-                                         is not NoDefault for p in parameters)
-
-                    elen -= num_default_tv
-
-                    expect_val = f"at least {elen}"
-
-            raise TypeError(f"Too {'many' if alen > elen else 'few'} arguments"
-                            f" for {cls}; actual {alen}, expected {expect_val}")
-
-if not _PEP_696_IMPLEMENTED:
-    typing._check_generic = _check_generic
-
-
-def _has_generic_or_protocol_as_origin() -> bool:
-    try:
-        frame = sys._getframe(2)
-    # - Catch AttributeError: not all Python implementations have sys._getframe()
-    # - Catch ValueError: maybe we're called from an unexpected module
-    #   and the call stack isn't deep enough
-    except (AttributeError, ValueError):
-        return False  # err on the side of leniency
-    else:
-        # If we somehow get invoked from outside typing.py,
-        # also err on the side of leniency
-        if frame.f_globals.get("__name__") != "typing":
-            return False
-        origin = frame.f_locals.get("origin")
-        # Cannot use "in" because origin may be an object with a buggy __eq__ that
-        # throws an error.
-        return origin is typing.Generic or origin is Protocol or origin is typing.Protocol
-
-
-_TYPEVARTUPLE_TYPES = {TypeVarTuple, getattr(typing, "TypeVarTuple", None)}
-
-
-def _is_unpacked_typevartuple(x) -> bool:
-    if get_origin(x) is not Unpack:
-        return False
-    args = get_args(x)
-    return (
-        bool(args)
-        and len(args) == 1
-        and type(args[0]) in _TYPEVARTUPLE_TYPES
-    )
-
-
-# Python 3.11+ _collect_type_vars was renamed to _collect_parameters
-if hasattr(typing, '_collect_type_vars'):
-    def _collect_type_vars(types, typevar_types=None):
-        """Collect all type variable contained in types in order of
-        first appearance (lexicographic order). For example::
-
-            _collect_type_vars((T, List[S, T])) == (T, S)
-        """
-        if typevar_types is None:
-            typevar_types = typing.TypeVar
-        tvars = []
-
-        # A required TypeVarLike cannot appear after a TypeVarLike with a default
-        # if it was a direct call to `Generic[]` or `Protocol[]`
-        enforce_default_ordering = _has_generic_or_protocol_as_origin()
-        default_encountered = False
-
-        # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
-        type_var_tuple_encountered = False
-
-        for t in types:
-            if _is_unpacked_typevartuple(t):
-                type_var_tuple_encountered = True
-            elif isinstance(t, typevar_types) and t not in tvars:
-                if enforce_default_ordering:
-                    has_default = getattr(t, '__default__', NoDefault) is not NoDefault
-                    if has_default:
-                        if type_var_tuple_encountered:
-                            raise TypeError('Type parameter with a default'
-                                            ' follows TypeVarTuple')
-                        default_encountered = True
-                    elif default_encountered:
-                        raise TypeError(f'Type parameter {t!r} without a default'
-                                        ' follows type parameter with a default')
-
-                tvars.append(t)
-            if _should_collect_from_parameters(t):
-                tvars.extend([t for t in t.__parameters__ if t not in tvars])
-        return tuple(tvars)
-
-    typing._collect_type_vars = _collect_type_vars
-else:
-    def _collect_parameters(args):
-        """Collect all type variables and parameter specifications in args
-        in order of first appearance (lexicographic order).
-
-        For example::
-
-            assert _collect_parameters((T, Callable[P, T])) == (T, P)
-        """
-        parameters = []
-
-        # A required TypeVarLike cannot appear after a TypeVarLike with default
-        # if it was a direct call to `Generic[]` or `Protocol[]`
-        enforce_default_ordering = _has_generic_or_protocol_as_origin()
-        default_encountered = False
-
-        # Also, a TypeVarLike with a default cannot appear after a TypeVarTuple
-        type_var_tuple_encountered = False
-
-        for t in args:
-            if isinstance(t, type):
-                # We don't want __parameters__ descriptor of a bare Python class.
-                pass
-            elif isinstance(t, tuple):
-                # `t` might be a tuple, when `ParamSpec` is substituted with
-                # `[T, int]`, or `[int, *Ts]`, etc.
-                for x in t:
-                    for collected in _collect_parameters([x]):
-                        if collected not in parameters:
-                            parameters.append(collected)
-            elif hasattr(t, '__typing_subst__'):
-                if t not in parameters:
-                    if enforce_default_ordering:
-                        has_default = (
-                            getattr(t, '__default__', NoDefault) is not NoDefault
-                        )
-
-                        if type_var_tuple_encountered and has_default:
-                            raise TypeError('Type parameter with a default'
-                                            ' follows TypeVarTuple')
-
-                        if has_default:
-                            default_encountered = True
-                        elif default_encountered:
-                            raise TypeError(f'Type parameter {t!r} without a default'
-                                            ' follows type parameter with a default')
-
-                    parameters.append(t)
-            else:
-                if _is_unpacked_typevartuple(t):
-                    type_var_tuple_encountered = True
-                for x in getattr(t, '__parameters__', ()):
-                    if x not in parameters:
-                        parameters.append(x)
-
-        return tuple(parameters)
-
-    if not _PEP_696_IMPLEMENTED:
-        typing._collect_parameters = _collect_parameters
-
-# Backport typing.NamedTuple as it exists in Python 3.13.
-# In 3.11, the ability to define generic `NamedTuple`s was supported.
-# This was explicitly disallowed in 3.9-3.10, and only half-worked in <=3.8.
-# On 3.12, we added __orig_bases__ to call-based NamedTuples
-# On 3.13, we deprecated kwargs-based NamedTuples
-if sys.version_info >= (3, 13):
-    NamedTuple = typing.NamedTuple
-else:
-    def _make_nmtuple(name, types, module, defaults=()):
-        fields = [n for n, t in types]
-        annotations = {n: typing._type_check(t, f"field {n} annotation must be a type")
-                       for n, t in types}
-        nm_tpl = collections.namedtuple(name, fields,
-                                        defaults=defaults, module=module)
-        nm_tpl.__annotations__ = nm_tpl.__new__.__annotations__ = annotations
-        # The `_field_types` attribute was removed in 3.9;
-        # in earlier versions, it is the same as the `__annotations__` attribute
-        if sys.version_info < (3, 9):
-            nm_tpl._field_types = annotations
-        return nm_tpl
-
-    _prohibited_namedtuple_fields = typing._prohibited
-    _special_namedtuple_fields = frozenset({'__module__', '__name__', '__annotations__'})
-
-    class _NamedTupleMeta(type):
-        def __new__(cls, typename, bases, ns):
-            assert _NamedTuple in bases
-            for base in bases:
-                if base is not _NamedTuple and base is not typing.Generic:
-                    raise TypeError(
-                        'can only inherit from a NamedTuple type and Generic')
-            bases = tuple(tuple if base is _NamedTuple else base for base in bases)
-            if "__annotations__" in ns:
-                types = ns["__annotations__"]
-            elif "__annotate__" in ns:
-                # TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
-                types = ns["__annotate__"](1)
-            else:
-                types = {}
-            default_names = []
-            for field_name in types:
-                if field_name in ns:
-                    default_names.append(field_name)
-                elif default_names:
-                    raise TypeError(f"Non-default namedtuple field {field_name} "
-                                    f"cannot follow default field"
-                                    f"{'s' if len(default_names) > 1 else ''} "
-                                    f"{', '.join(default_names)}")
-            nm_tpl = _make_nmtuple(
-                typename, types.items(),
-                defaults=[ns[n] for n in default_names],
-                module=ns['__module__']
-            )
-            nm_tpl.__bases__ = bases
-            if typing.Generic in bases:
-                if hasattr(typing, '_generic_class_getitem'):  # 3.12+
-                    nm_tpl.__class_getitem__ = classmethod(typing._generic_class_getitem)
-                else:
-                    class_getitem = typing.Generic.__class_getitem__.__func__
-                    nm_tpl.__class_getitem__ = classmethod(class_getitem)
-            # update from user namespace without overriding special namedtuple attributes
-            for key, val in ns.items():
-                if key in _prohibited_namedtuple_fields:
-                    raise AttributeError("Cannot overwrite NamedTuple attribute " + key)
-                elif key not in _special_namedtuple_fields:
-                    if key not in nm_tpl._fields:
-                        setattr(nm_tpl, key, ns[key])
-                    try:
-                        set_name = type(val).__set_name__
-                    except AttributeError:
-                        pass
-                    else:
-                        try:
-                            set_name(val, nm_tpl, key)
-                        except BaseException as e:
-                            msg = (
-                                f"Error calling __set_name__ on {type(val).__name__!r} "
-                                f"instance {key!r} in {typename!r}"
-                            )
-                            # BaseException.add_note() existed on py311,
-                            # but the __set_name__ machinery didn't start
-                            # using add_note() until py312.
-                            # Making sure exceptions are raised in the same way
-                            # as in "normal" classes seems most important here.
-                            if sys.version_info >= (3, 12):
-                                e.add_note(msg)
-                                raise
-                            else:
-                                raise RuntimeError(msg) from e
-
-            if typing.Generic in bases:
-                nm_tpl.__init_subclass__()
-            return nm_tpl
-
-    _NamedTuple = type.__new__(_NamedTupleMeta, 'NamedTuple', (), {})
-
-    def _namedtuple_mro_entries(bases):
-        assert NamedTuple in bases
-        return (_NamedTuple,)
-
-    @_ensure_subclassable(_namedtuple_mro_entries)
-    def NamedTuple(typename, fields=_marker, /, **kwargs):
-        """Typed version of namedtuple.
-
-        Usage::
-
-            class Employee(NamedTuple):
-                name: str
-                id: int
-
-        This is equivalent to::
-
-            Employee = collections.namedtuple('Employee', ['name', 'id'])
-
-        The resulting class has an extra __annotations__ attribute, giving a
-        dict that maps field names to types.  (The field names are also in
-        the _fields attribute, which is part of the namedtuple API.)
-        An alternative equivalent functional syntax is also accepted::
-
-            Employee = NamedTuple('Employee', [('name', str), ('id', int)])
-        """
-        if fields is _marker:
-            if kwargs:
-                deprecated_thing = "Creating NamedTuple classes using keyword arguments"
-                deprecation_msg = (
-                    "{name} is deprecated and will be disallowed in Python {remove}. "
-                    "Use the class-based or functional syntax instead."
-                )
-            else:
-                deprecated_thing = "Failing to pass a value for the 'fields' parameter"
-                example = f"`{typename} = NamedTuple({typename!r}, [])`"
-                deprecation_msg = (
-                    "{name} is deprecated and will be disallowed in Python {remove}. "
-                    "To create a NamedTuple class with 0 fields "
-                    "using the functional syntax, "
-                    "pass an empty list, e.g. "
-                ) + example + "."
-        elif fields is None:
-            if kwargs:
-                raise TypeError(
-                    "Cannot pass `None` as the 'fields' parameter "
-                    "and also specify fields using keyword arguments"
-                )
-            else:
-                deprecated_thing = "Passing `None` as the 'fields' parameter"
-                example = f"`{typename} = NamedTuple({typename!r}, [])`"
-                deprecation_msg = (
-                    "{name} is deprecated and will be disallowed in Python {remove}. "
-                    "To create a NamedTuple class with 0 fields "
-                    "using the functional syntax, "
-                    "pass an empty list, e.g. "
-                ) + example + "."
-        elif kwargs:
-            raise TypeError("Either list of fields or keywords"
-                            " can be provided to NamedTuple, not both")
-        if fields is _marker or fields is None:
-            warnings.warn(
-                deprecation_msg.format(name=deprecated_thing, remove="3.15"),
-                DeprecationWarning,
-                stacklevel=2,
-            )
-            fields = kwargs.items()
-        nt = _make_nmtuple(typename, fields, module=_caller())
-        nt.__orig_bases__ = (NamedTuple,)
-        return nt
-
-
-if hasattr(collections.abc, "Buffer"):
-    Buffer = collections.abc.Buffer
-else:
-    class Buffer(abc.ABC):  # noqa: B024
-        """Base class for classes that implement the buffer protocol.
-
-        The buffer protocol allows Python objects to expose a low-level
-        memory buffer interface. Before Python 3.12, it is not possible
-        to implement the buffer protocol in pure Python code, or even
-        to check whether a class implements the buffer protocol. In
-        Python 3.12 and higher, the ``__buffer__`` method allows access
-        to the buffer protocol from Python code, and the
-        ``collections.abc.Buffer`` ABC allows checking whether a class
-        implements the buffer protocol.
-
-        To indicate support for the buffer protocol in earlier versions,
-        inherit from this ABC, either in a stub file or at runtime,
-        or use ABC registration. This ABC provides no methods, because
-        there is no Python-accessible methods shared by pre-3.12 buffer
-        classes. It is useful primarily for static checks.
-
-        """
-
-    # As a courtesy, register the most common stdlib buffer classes.
-    Buffer.register(memoryview)
-    Buffer.register(bytearray)
-    Buffer.register(bytes)
-
-
-# Backport of types.get_original_bases, available on 3.12+ in CPython
-if hasattr(_types, "get_original_bases"):
-    get_original_bases = _types.get_original_bases
-else:
-    def get_original_bases(cls, /):
-        """Return the class's "original" bases prior to modification by `__mro_entries__`.
-
-        Examples::
-
-            from typing import TypeVar, Generic
-            from typing_extensions import NamedTuple, TypedDict
-
-            T = TypeVar("T")
-            class Foo(Generic[T]): ...
-            class Bar(Foo[int], float): ...
-            class Baz(list[str]): ...
-            Eggs = NamedTuple("Eggs", [("a", int), ("b", str)])
-            Spam = TypedDict("Spam", {"a": int, "b": str})
-
-            assert get_original_bases(Bar) == (Foo[int], float)
-            assert get_original_bases(Baz) == (list[str],)
-            assert get_original_bases(Eggs) == (NamedTuple,)
-            assert get_original_bases(Spam) == (TypedDict,)
-            assert get_original_bases(int) == (object,)
-        """
-        try:
-            return cls.__dict__.get("__orig_bases__", cls.__bases__)
-        except AttributeError:
-            raise TypeError(
-                f'Expected an instance of type, not {type(cls).__name__!r}'
-            ) from None
-
-
-# NewType is a class on Python 3.10+, making it pickleable
-# The error message for subclassing instances of NewType was improved on 3.11+
-if sys.version_info >= (3, 11):
-    NewType = typing.NewType
-else:
-    class NewType:
-        """NewType creates simple unique types with almost zero
-        runtime overhead. NewType(name, tp) is considered a subtype of tp
-        by static type checkers. At runtime, NewType(name, tp) returns
-        a dummy callable that simply returns its argument. Usage::
-            UserId = NewType('UserId', int)
-            def name_by_id(user_id: UserId) -> str:
-                ...
-            UserId('user')          # Fails type check
-            name_by_id(42)          # Fails type check
-            name_by_id(UserId(42))  # OK
-            num = UserId(5) + 1     # type: int
-        """
-
-        def __call__(self, obj, /):
-            return obj
-
-        def __init__(self, name, tp):
-            self.__qualname__ = name
-            if '.' in name:
-                name = name.rpartition('.')[-1]
-            self.__name__ = name
-            self.__supertype__ = tp
-            def_mod = _caller()
-            if def_mod != 'typing_extensions':
-                self.__module__ = def_mod
-
-        def __mro_entries__(self, bases):
-            # We defined __mro_entries__ to get a better error message
-            # if a user attempts to subclass a NewType instance. bpo-46170
-            supercls_name = self.__name__
-
-            class Dummy:
-                def __init_subclass__(cls):
-                    subcls_name = cls.__name__
-                    raise TypeError(
-                        f"Cannot subclass an instance of NewType. "
-                        f"Perhaps you were looking for: "
-                        f"`{subcls_name} = NewType({subcls_name!r}, {supercls_name})`"
-                    )
-
-            return (Dummy,)
-
-        def __repr__(self):
-            return f'{self.__module__}.{self.__qualname__}'
-
-        def __reduce__(self):
-            return self.__qualname__
-
-        if sys.version_info >= (3, 10):
-            # PEP 604 methods
-            # It doesn't make sense to have these methods on Python <3.10
-
-            def __or__(self, other):
-                return typing.Union[self, other]
-
-            def __ror__(self, other):
-                return typing.Union[other, self]
-
-
-if hasattr(typing, "TypeAliasType"):
-    TypeAliasType = typing.TypeAliasType
-else:
-    def _is_unionable(obj):
-        """Corresponds to is_unionable() in unionobject.c in CPython."""
-        return obj is None or isinstance(obj, (
-            type,
-            _types.GenericAlias,
-            _types.UnionType,
-            TypeAliasType,
-        ))
-
-    class TypeAliasType:
-        """Create named, parameterized type aliases.
-
-        This provides a backport of the new `type` statement in Python 3.12:
-
-            type ListOrSet[T] = list[T] | set[T]
-
-        is equivalent to:
-
-            T = TypeVar("T")
-            ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,))
-
-        The name ListOrSet can then be used as an alias for the type it refers to.
-
-        The type_params argument should contain all the type parameters used
-        in the value of the type alias. If the alias is not generic, this
-        argument is omitted.
-
-        Static type checkers should only support type aliases declared using
-        TypeAliasType that follow these rules:
-
-        - The first argument (the name) must be a string literal.
-        - The TypeAliasType instance must be immediately assigned to a variable
-          of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid,
-          as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)').
-
-        """
-
-        def __init__(self, name: str, value, *, type_params=()):
-            if not isinstance(name, str):
-                raise TypeError("TypeAliasType name must be a string")
-            self.__value__ = value
-            self.__type_params__ = type_params
-
-            parameters = []
-            for type_param in type_params:
-                if isinstance(type_param, TypeVarTuple):
-                    parameters.extend(type_param)
-                else:
-                    parameters.append(type_param)
-            self.__parameters__ = tuple(parameters)
-            def_mod = _caller()
-            if def_mod != 'typing_extensions':
-                self.__module__ = def_mod
-            # Setting this attribute closes the TypeAliasType from further modification
-            self.__name__ = name
-
-        def __setattr__(self, name: str, value: object, /) -> None:
-            if hasattr(self, "__name__"):
-                self._raise_attribute_error(name)
-            super().__setattr__(name, value)
-
-        def __delattr__(self, name: str, /) -> Never:
-            self._raise_attribute_error(name)
-
-        def _raise_attribute_error(self, name: str) -> Never:
-            # Match the Python 3.12 error messages exactly
-            if name == "__name__":
-                raise AttributeError("readonly attribute")
-            elif name in {"__value__", "__type_params__", "__parameters__", "__module__"}:
-                raise AttributeError(
-                    f"attribute '{name}' of 'typing.TypeAliasType' objects "
-                    "is not writable"
-                )
-            else:
-                raise AttributeError(
-                    f"'typing.TypeAliasType' object has no attribute '{name}'"
-                )
-
-        def __repr__(self) -> str:
-            return self.__name__
-
-        def __getitem__(self, parameters):
-            if not isinstance(parameters, tuple):
-                parameters = (parameters,)
-            parameters = [
-                typing._type_check(
-                    item, f'Subscripting {self.__name__} requires a type.'
-                )
-                for item in parameters
-            ]
-            return typing._GenericAlias(self, tuple(parameters))
-
-        def __reduce__(self):
-            return self.__name__
-
-        def __init_subclass__(cls, *args, **kwargs):
-            raise TypeError(
-                "type 'typing_extensions.TypeAliasType' is not an acceptable base type"
-            )
-
-        # The presence of this method convinces typing._type_check
-        # that TypeAliasTypes are types.
-        def __call__(self):
-            raise TypeError("Type alias is not callable")
-
-        if sys.version_info >= (3, 10):
-            def __or__(self, right):
-                # For forward compatibility with 3.12, reject Unions
-                # that are not accepted by the built-in Union.
-                if not _is_unionable(right):
-                    return NotImplemented
-                return typing.Union[self, right]
-
-            def __ror__(self, left):
-                if not _is_unionable(left):
-                    return NotImplemented
-                return typing.Union[left, self]
-
-
-if hasattr(typing, "is_protocol"):
-    is_protocol = typing.is_protocol
-    get_protocol_members = typing.get_protocol_members
-else:
-    def is_protocol(tp: type, /) -> bool:
-        """Return True if the given type is a Protocol.
-
-        Example::
-
-            >>> from typing_extensions import Protocol, is_protocol
-            >>> class P(Protocol):
-            ...     def a(self) -> str: ...
-            ...     b: int
-            >>> is_protocol(P)
-            True
-            >>> is_protocol(int)
-            False
-        """
-        return (
-            isinstance(tp, type)
-            and getattr(tp, '_is_protocol', False)
-            and tp is not Protocol
-            and tp is not typing.Protocol
-        )
-
-    def get_protocol_members(tp: type, /) -> typing.FrozenSet[str]:
-        """Return the set of members defined in a Protocol.
-
-        Example::
-
-            >>> from typing_extensions import Protocol, get_protocol_members
-            >>> class P(Protocol):
-            ...     def a(self) -> str: ...
-            ...     b: int
-            >>> get_protocol_members(P)
-            frozenset({'a', 'b'})
-
-        Raise a TypeError for arguments that are not Protocols.
-        """
-        if not is_protocol(tp):
-            raise TypeError(f'{tp!r} is not a Protocol')
-        if hasattr(tp, '__protocol_attrs__'):
-            return frozenset(tp.__protocol_attrs__)
-        return frozenset(_get_protocol_attrs(tp))
-
-
-if hasattr(typing, "Doc"):
-    Doc = typing.Doc
-else:
-    class Doc:
-        """Define the documentation of a type annotation using ``Annotated``, to be
-         used in class attributes, function and method parameters, return values,
-         and variables.
-
-        The value should be a positional-only string literal to allow static tools
-        like editors and documentation generators to use it.
-
-        This complements docstrings.
-
-        The string value passed is available in the attribute ``documentation``.
-
-        Example::
-
-            >>> from typing_extensions import Annotated, Doc
-            >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ...
-        """
-        def __init__(self, documentation: str, /) -> None:
-            self.documentation = documentation
-
-        def __repr__(self) -> str:
-            return f"Doc({self.documentation!r})"
-
-        def __hash__(self) -> int:
-            return hash(self.documentation)
-
-        def __eq__(self, other: object) -> bool:
-            if not isinstance(other, Doc):
-                return NotImplemented
-            return self.documentation == other.documentation
-
-
-_CapsuleType = getattr(_types, "CapsuleType", None)
-
-if _CapsuleType is None:
-    try:
-        import _socket
-    except ImportError:
-        pass
-    else:
-        _CAPI = getattr(_socket, "CAPI", None)
-        if _CAPI is not None:
-            _CapsuleType = type(_CAPI)
-
-if _CapsuleType is not None:
-    CapsuleType = _CapsuleType
-    __all__.append("CapsuleType")
-
-
-# Aliases for items that have always been in typing.
-# Explicitly assign these (rather than using `from typing import *` at the top),
-# so that we get a CI error if one of these is deleted from typing.py
-# in a future version of Python
-AbstractSet = typing.AbstractSet
-AnyStr = typing.AnyStr
-BinaryIO = typing.BinaryIO
-Callable = typing.Callable
-Collection = typing.Collection
-Container = typing.Container
-Dict = typing.Dict
-ForwardRef = typing.ForwardRef
-FrozenSet = typing.FrozenSet
-Generic = typing.Generic
-Hashable = typing.Hashable
-IO = typing.IO
-ItemsView = typing.ItemsView
-Iterable = typing.Iterable
-Iterator = typing.Iterator
-KeysView = typing.KeysView
-List = typing.List
-Mapping = typing.Mapping
-MappingView = typing.MappingView
-Match = typing.Match
-MutableMapping = typing.MutableMapping
-MutableSequence = typing.MutableSequence
-MutableSet = typing.MutableSet
-Optional = typing.Optional
-Pattern = typing.Pattern
-Reversible = typing.Reversible
-Sequence = typing.Sequence
-Set = typing.Set
-Sized = typing.Sized
-TextIO = typing.TextIO
-Tuple = typing.Tuple
-Union = typing.Union
-ValuesView = typing.ValuesView
-cast = typing.cast
-no_type_check = typing.no_type_check
-no_type_check_decorator = typing.no_type_check_decorator
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER b/pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER
deleted file mode 100644
index a1b589e38a..0000000000
--- a/pkg_resources/_vendor/zipp-3.19.2.dist-info/INSTALLER
+++ /dev/null
@@ -1 +0,0 @@
-pip
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE b/pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE
deleted file mode 100644
index 1bb5a44356..0000000000
--- a/pkg_resources/_vendor/zipp-3.19.2.dist-info/LICENSE
+++ /dev/null
@@ -1,17 +0,0 @@
-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/pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA b/pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA
deleted file mode 100644
index 1399281717..0000000000
--- a/pkg_resources/_vendor/zipp-3.19.2.dist-info/METADATA
+++ /dev/null
@@ -1,102 +0,0 @@
-Metadata-Version: 2.1
-Name: zipp
-Version: 3.19.2
-Summary: Backport of pathlib-compatible object wrapper for zip files
-Author-email: "Jason R. Coombs" 
-Project-URL: Homepage, https://github.com/jaraco/zipp
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: MIT License
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3 :: Only
-Requires-Python: >=3.8
-Description-Content-Type: text/x-rst
-License-File: LICENSE
-Provides-Extra: doc
-Requires-Dist: sphinx >=3.5 ; extra == 'doc'
-Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
-Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
-Requires-Dist: furo ; extra == 'doc'
-Requires-Dist: sphinx-lint ; extra == 'doc'
-Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
-Provides-Extra: test
-Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
-Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
-Requires-Dist: pytest-cov ; extra == 'test'
-Requires-Dist: pytest-mypy ; extra == 'test'
-Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
-Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
-Requires-Dist: jaraco.itertools ; extra == 'test'
-Requires-Dist: jaraco.functools ; extra == 'test'
-Requires-Dist: more-itertools ; extra == 'test'
-Requires-Dist: big-O ; extra == 'test'
-Requires-Dist: pytest-ignore-flaky ; extra == 'test'
-Requires-Dist: jaraco.test ; extra == 'test'
-Requires-Dist: importlib-resources ; (python_version < "3.9") and extra == 'test'
-
-.. image:: https://img.shields.io/pypi/v/zipp.svg
-   :target: https://pypi.org/project/zipp
-
-.. image:: https://img.shields.io/pypi/pyversions/zipp.svg
-
-.. image:: https://github.com/jaraco/zipp/actions/workflows/main.yml/badge.svg
-   :target: https://github.com/jaraco/zipp/actions?query=workflow%3A%22tests%22
-   :alt: tests
-
-.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
-    :target: https://github.com/astral-sh/ruff
-    :alt: Ruff
-
-.. .. image:: https://readthedocs.org/projects/PROJECT_RTD/badge/?version=latest
-..    :target: https://PROJECT_RTD.readthedocs.io/en/latest/?badge=latest
-
-.. image:: https://img.shields.io/badge/skeleton-2024-informational
-   :target: https://blog.jaraco.com/skeleton
-
-.. image:: https://tidelift.com/badges/package/pypi/zipp
-   :target: https://tidelift.com/subscription/pkg/pypi-zipp?utm_source=pypi-zipp&utm_medium=readme
-
-
-A pathlib-compatible Zipfile object wrapper. Official backport of the standard library
-`Path object `_.
-
-
-Compatibility
-=============
-
-New features are introduced in this third-party library and later merged
-into CPython. The following table indicates which versions of this library
-were contributed to different versions in the standard library:
-
-.. list-table::
-   :header-rows: 1
-
-   * - zipp
-     - stdlib
-   * - 3.18
-     - 3.13
-   * - 3.16
-     - 3.12
-   * - 3.5
-     - 3.11
-   * - 3.2
-     - 3.10
-   * - 3.3 ??
-     - 3.9
-   * - 1.0
-     - 3.8
-
-
-Usage
-=====
-
-Use ``zipp.Path`` in place of ``zipfile.Path`` on any Python.
-
-For Enterprise
-==============
-
-Available as part of the Tidelift Subscription.
-
-This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
-
-`Learn more `_.
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD b/pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD
deleted file mode 100644
index 77c02835d8..0000000000
--- a/pkg_resources/_vendor/zipp-3.19.2.dist-info/RECORD
+++ /dev/null
@@ -1,15 +0,0 @@
-zipp-3.19.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
-zipp-3.19.2.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
-zipp-3.19.2.dist-info/METADATA,sha256=UIrk_kMIHGSwsKKChYizqMw0MMZpPRZ2ZiVpQAsN_bE,3575
-zipp-3.19.2.dist-info/RECORD,,
-zipp-3.19.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-zipp-3.19.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
-zipp-3.19.2.dist-info/top_level.txt,sha256=iAbdoSHfaGqBfVb2XuR9JqSQHCoOsOtG6y9C_LSpqFw,5
-zipp/__init__.py,sha256=QuI1g00G4fRAcGt-HqbV0oWIkmSgedCGGYsHHYzNa8A,13412
-zipp/__pycache__/__init__.cpython-312.pyc,,
-zipp/__pycache__/glob.cpython-312.pyc,,
-zipp/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-zipp/compat/__pycache__/__init__.cpython-312.pyc,,
-zipp/compat/__pycache__/py310.cpython-312.pyc,,
-zipp/compat/py310.py,sha256=eZpkW0zRtunkhEh8jjX3gCGe22emoKCBJw72Zt4RkhA,219
-zipp/glob.py,sha256=etWpnfEoRyfUvrUsi6sTiGmErvPwe6HzY6pT8jg_lUI,3082
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/REQUESTED b/pkg_resources/_vendor/zipp-3.19.2.dist-info/REQUESTED
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL b/pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL
deleted file mode 100644
index bab98d6758..0000000000
--- a/pkg_resources/_vendor/zipp-3.19.2.dist-info/WHEEL
+++ /dev/null
@@ -1,5 +0,0 @@
-Wheel-Version: 1.0
-Generator: bdist_wheel (0.43.0)
-Root-Is-Purelib: true
-Tag: py3-none-any
-
diff --git a/pkg_resources/_vendor/zipp-3.19.2.dist-info/top_level.txt b/pkg_resources/_vendor/zipp-3.19.2.dist-info/top_level.txt
deleted file mode 100644
index e82f676f82..0000000000
--- a/pkg_resources/_vendor/zipp-3.19.2.dist-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-zipp
diff --git a/pkg_resources/_vendor/zipp/__init__.py b/pkg_resources/_vendor/zipp/__init__.py
deleted file mode 100644
index d65297b835..0000000000
--- a/pkg_resources/_vendor/zipp/__init__.py
+++ /dev/null
@@ -1,501 +0,0 @@
-import io
-import posixpath
-import zipfile
-import itertools
-import contextlib
-import pathlib
-import re
-import stat
-import sys
-
-from .compat.py310 import text_encoding
-from .glob import Translator
-
-
-__all__ = ['Path']
-
-
-def _parents(path):
-    """
-    Given a path with elements separated by
-    posixpath.sep, generate all parents of that path.
-
-    >>> list(_parents('b/d'))
-    ['b']
-    >>> list(_parents('/b/d/'))
-    ['/b']
-    >>> list(_parents('b/d/f/'))
-    ['b/d', 'b']
-    >>> list(_parents('b'))
-    []
-    >>> list(_parents(''))
-    []
-    """
-    return itertools.islice(_ancestry(path), 1, None)
-
-
-def _ancestry(path):
-    """
-    Given a path with elements separated by
-    posixpath.sep, generate all elements of that path
-
-    >>> list(_ancestry('b/d'))
-    ['b/d', 'b']
-    >>> list(_ancestry('/b/d/'))
-    ['/b/d', '/b']
-    >>> list(_ancestry('b/d/f/'))
-    ['b/d/f', 'b/d', 'b']
-    >>> list(_ancestry('b'))
-    ['b']
-    >>> list(_ancestry(''))
-    []
-    """
-    path = path.rstrip(posixpath.sep)
-    while path and path != posixpath.sep:
-        yield path
-        path, tail = posixpath.split(path)
-
-
-_dedupe = dict.fromkeys
-"""Deduplicate an iterable in original order"""
-
-
-def _difference(minuend, subtrahend):
-    """
-    Return items in minuend not in subtrahend, retaining order
-    with O(1) lookup.
-    """
-    return itertools.filterfalse(set(subtrahend).__contains__, minuend)
-
-
-class InitializedState:
-    """
-    Mix-in to save the initialization state for pickling.
-    """
-
-    def __init__(self, *args, **kwargs):
-        self.__args = args
-        self.__kwargs = kwargs
-        super().__init__(*args, **kwargs)
-
-    def __getstate__(self):
-        return self.__args, self.__kwargs
-
-    def __setstate__(self, state):
-        args, kwargs = state
-        super().__init__(*args, **kwargs)
-
-
-class SanitizedNames:
-    """
-    ZipFile mix-in to ensure names are sanitized.
-    """
-
-    def namelist(self):
-        return list(map(self._sanitize, super().namelist()))
-
-    @staticmethod
-    def _sanitize(name):
-        r"""
-        Ensure a relative path with posix separators and no dot names.
-
-        Modeled after
-        https://github.com/python/cpython/blob/bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c/Lib/zipfile/__init__.py#L1799-L1813
-        but provides consistent cross-platform behavior.
-
-        >>> san = SanitizedNames._sanitize
-        >>> san('/foo/bar')
-        'foo/bar'
-        >>> san('//foo.txt')
-        'foo.txt'
-        >>> san('foo/.././bar.txt')
-        'foo/bar.txt'
-        >>> san('foo../.bar.txt')
-        'foo../.bar.txt'
-        >>> san('\\foo\\bar.txt')
-        'foo/bar.txt'
-        >>> san('D:\\foo.txt')
-        'D/foo.txt'
-        >>> san('\\\\server\\share\\file.txt')
-        'server/share/file.txt'
-        >>> san('\\\\?\\GLOBALROOT\\Volume3')
-        '?/GLOBALROOT/Volume3'
-        >>> san('\\\\.\\PhysicalDrive1\\root')
-        'PhysicalDrive1/root'
-
-        Retain any trailing slash.
-        >>> san('abc/')
-        'abc/'
-
-        Raises a ValueError if the result is empty.
-        >>> san('../..')
-        Traceback (most recent call last):
-        ...
-        ValueError: Empty filename
-        """
-
-        def allowed(part):
-            return part and part not in {'..', '.'}
-
-        # Remove the drive letter.
-        # Don't use ntpath.splitdrive, because that also strips UNC paths
-        bare = re.sub('^([A-Z]):', r'\1', name, flags=re.IGNORECASE)
-        clean = bare.replace('\\', '/')
-        parts = clean.split('/')
-        joined = '/'.join(filter(allowed, parts))
-        if not joined:
-            raise ValueError("Empty filename")
-        return joined + '/' * name.endswith('/')
-
-
-class CompleteDirs(InitializedState, SanitizedNames, zipfile.ZipFile):
-    """
-    A ZipFile subclass that ensures that implied directories
-    are always included in the namelist.
-
-    >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt']))
-    ['foo/', 'foo/bar/']
-    >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt', 'foo/bar/']))
-    ['foo/']
-    """
-
-    @staticmethod
-    def _implied_dirs(names):
-        parents = itertools.chain.from_iterable(map(_parents, names))
-        as_dirs = (p + posixpath.sep for p in parents)
-        return _dedupe(_difference(as_dirs, names))
-
-    def namelist(self):
-        names = super().namelist()
-        return names + list(self._implied_dirs(names))
-
-    def _name_set(self):
-        return set(self.namelist())
-
-    def resolve_dir(self, name):
-        """
-        If the name represents a directory, return that name
-        as a directory (with the trailing slash).
-        """
-        names = self._name_set()
-        dirname = name + '/'
-        dir_match = name not in names and dirname in names
-        return dirname if dir_match else name
-
-    def getinfo(self, name):
-        """
-        Supplement getinfo for implied dirs.
-        """
-        try:
-            return super().getinfo(name)
-        except KeyError:
-            if not name.endswith('/') or name not in self._name_set():
-                raise
-            return zipfile.ZipInfo(filename=name)
-
-    @classmethod
-    def make(cls, source):
-        """
-        Given a source (filename or zipfile), return an
-        appropriate CompleteDirs subclass.
-        """
-        if isinstance(source, CompleteDirs):
-            return source
-
-        if not isinstance(source, zipfile.ZipFile):
-            return cls(source)
-
-        # Only allow for FastLookup when supplied zipfile is read-only
-        if 'r' not in source.mode:
-            cls = CompleteDirs
-
-        source.__class__ = cls
-        return source
-
-    @classmethod
-    def inject(cls, zf: zipfile.ZipFile) -> zipfile.ZipFile:
-        """
-        Given a writable zip file zf, inject directory entries for
-        any directories implied by the presence of children.
-        """
-        for name in cls._implied_dirs(zf.namelist()):
-            zf.writestr(name, b"")
-        return zf
-
-
-class FastLookup(CompleteDirs):
-    """
-    ZipFile subclass to ensure implicit
-    dirs exist and are resolved rapidly.
-    """
-
-    def namelist(self):
-        with contextlib.suppress(AttributeError):
-            return self.__names
-        self.__names = super().namelist()
-        return self.__names
-
-    def _name_set(self):
-        with contextlib.suppress(AttributeError):
-            return self.__lookup
-        self.__lookup = super()._name_set()
-        return self.__lookup
-
-
-def _extract_text_encoding(encoding=None, *args, **kwargs):
-    # compute stack level so that the caller of the caller sees any warning.
-    is_pypy = sys.implementation.name == 'pypy'
-    stack_level = 3 + is_pypy
-    return text_encoding(encoding, stack_level), args, kwargs
-
-
-class Path:
-    """
-    A :class:`importlib.resources.abc.Traversable` interface for zip files.
-
-    Implements many of the features users enjoy from
-    :class:`pathlib.Path`.
-
-    Consider a zip file with this structure::
-
-        .
-        ├── a.txt
-        └── b
-            ├── c.txt
-            └── d
-                └── e.txt
-
-    >>> data = io.BytesIO()
-    >>> zf = zipfile.ZipFile(data, 'w')
-    >>> zf.writestr('a.txt', 'content of a')
-    >>> zf.writestr('b/c.txt', 'content of c')
-    >>> zf.writestr('b/d/e.txt', 'content of e')
-    >>> zf.filename = 'mem/abcde.zip'
-
-    Path accepts the zipfile object itself or a filename
-
-    >>> path = Path(zf)
-
-    From there, several path operations are available.
-
-    Directory iteration (including the zip file itself):
-
-    >>> a, b = path.iterdir()
-    >>> a
-    Path('mem/abcde.zip', 'a.txt')
-    >>> b
-    Path('mem/abcde.zip', 'b/')
-
-    name property:
-
-    >>> b.name
-    'b'
-
-    join with divide operator:
-
-    >>> c = b / 'c.txt'
-    >>> c
-    Path('mem/abcde.zip', 'b/c.txt')
-    >>> c.name
-    'c.txt'
-
-    Read text:
-
-    >>> c.read_text(encoding='utf-8')
-    'content of c'
-
-    existence:
-
-    >>> c.exists()
-    True
-    >>> (b / 'missing.txt').exists()
-    False
-
-    Coercion to string:
-
-    >>> import os
-    >>> str(c).replace(os.sep, posixpath.sep)
-    'mem/abcde.zip/b/c.txt'
-
-    At the root, ``name``, ``filename``, and ``parent``
-    resolve to the zipfile.
-
-    >>> str(path)
-    'mem/abcde.zip/'
-    >>> path.name
-    'abcde.zip'
-    >>> path.filename == pathlib.Path('mem/abcde.zip')
-    True
-    >>> str(path.parent)
-    'mem'
-
-    If the zipfile has no filename, such attributes are not
-    valid and accessing them will raise an Exception.
-
-    >>> zf.filename = None
-    >>> path.name
-    Traceback (most recent call last):
-    ...
-    TypeError: ...
-
-    >>> path.filename
-    Traceback (most recent call last):
-    ...
-    TypeError: ...
-
-    >>> path.parent
-    Traceback (most recent call last):
-    ...
-    TypeError: ...
-
-    # workaround python/cpython#106763
-    >>> pass
-    """
-
-    __repr = "{self.__class__.__name__}({self.root.filename!r}, {self.at!r})"
-
-    def __init__(self, root, at=""):
-        """
-        Construct a Path from a ZipFile or filename.
-
-        Note: When the source is an existing ZipFile object,
-        its type (__class__) will be mutated to a
-        specialized type. If the caller wishes to retain the
-        original type, the caller should either create a
-        separate ZipFile object or pass a filename.
-        """
-        self.root = FastLookup.make(root)
-        self.at = at
-
-    def __eq__(self, other):
-        """
-        >>> Path(zipfile.ZipFile(io.BytesIO(), 'w')) == 'foo'
-        False
-        """
-        if self.__class__ is not other.__class__:
-            return NotImplemented
-        return (self.root, self.at) == (other.root, other.at)
-
-    def __hash__(self):
-        return hash((self.root, self.at))
-
-    def open(self, mode='r', *args, pwd=None, **kwargs):
-        """
-        Open this entry as text or binary following the semantics
-        of ``pathlib.Path.open()`` by passing arguments through
-        to io.TextIOWrapper().
-        """
-        if self.is_dir():
-            raise IsADirectoryError(self)
-        zip_mode = mode[0]
-        if not self.exists() and zip_mode == 'r':
-            raise FileNotFoundError(self)
-        stream = self.root.open(self.at, zip_mode, pwd=pwd)
-        if 'b' in mode:
-            if args or kwargs:
-                raise ValueError("encoding args invalid for binary operation")
-            return stream
-        # Text mode:
-        encoding, args, kwargs = _extract_text_encoding(*args, **kwargs)
-        return io.TextIOWrapper(stream, encoding, *args, **kwargs)
-
-    def _base(self):
-        return pathlib.PurePosixPath(self.at or self.root.filename)
-
-    @property
-    def name(self):
-        return self._base().name
-
-    @property
-    def suffix(self):
-        return self._base().suffix
-
-    @property
-    def suffixes(self):
-        return self._base().suffixes
-
-    @property
-    def stem(self):
-        return self._base().stem
-
-    @property
-    def filename(self):
-        return pathlib.Path(self.root.filename).joinpath(self.at)
-
-    def read_text(self, *args, **kwargs):
-        encoding, args, kwargs = _extract_text_encoding(*args, **kwargs)
-        with self.open('r', encoding, *args, **kwargs) as strm:
-            return strm.read()
-
-    def read_bytes(self):
-        with self.open('rb') as strm:
-            return strm.read()
-
-    def _is_child(self, path):
-        return posixpath.dirname(path.at.rstrip("/")) == self.at.rstrip("/")
-
-    def _next(self, at):
-        return self.__class__(self.root, at)
-
-    def is_dir(self):
-        return not self.at or self.at.endswith("/")
-
-    def is_file(self):
-        return self.exists() and not self.is_dir()
-
-    def exists(self):
-        return self.at in self.root._name_set()
-
-    def iterdir(self):
-        if not self.is_dir():
-            raise ValueError("Can't listdir a file")
-        subs = map(self._next, self.root.namelist())
-        return filter(self._is_child, subs)
-
-    def match(self, path_pattern):
-        return pathlib.PurePosixPath(self.at).match(path_pattern)
-
-    def is_symlink(self):
-        """
-        Return whether this path is a symlink.
-        """
-        info = self.root.getinfo(self.at)
-        mode = info.external_attr >> 16
-        return stat.S_ISLNK(mode)
-
-    def glob(self, pattern):
-        if not pattern:
-            raise ValueError(f"Unacceptable pattern: {pattern!r}")
-
-        prefix = re.escape(self.at)
-        tr = Translator(seps='/')
-        matches = re.compile(prefix + tr.translate(pattern)).fullmatch
-        names = (data.filename for data in self.root.filelist)
-        return map(self._next, filter(matches, names))
-
-    def rglob(self, pattern):
-        return self.glob(f'**/{pattern}')
-
-    def relative_to(self, other, *extra):
-        return posixpath.relpath(str(self), str(other.joinpath(*extra)))
-
-    def __str__(self):
-        return posixpath.join(self.root.filename, self.at)
-
-    def __repr__(self):
-        return self.__repr.format(self=self)
-
-    def joinpath(self, *other):
-        next = posixpath.join(self.at, *other)
-        return self._next(self.root.resolve_dir(next))
-
-    __truediv__ = joinpath
-
-    @property
-    def parent(self):
-        if not self.at:
-            return self.filename.parent
-        parent_at = posixpath.dirname(self.at.rstrip('/'))
-        if parent_at:
-            parent_at += '/'
-        return self._next(parent_at)
diff --git a/pkg_resources/_vendor/zipp/compat/__init__.py b/pkg_resources/_vendor/zipp/compat/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/pkg_resources/_vendor/zipp/compat/py310.py b/pkg_resources/_vendor/zipp/compat/py310.py
deleted file mode 100644
index d5ca53e037..0000000000
--- a/pkg_resources/_vendor/zipp/compat/py310.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import sys
-import io
-
-
-def _text_encoding(encoding, stacklevel=2, /):  # pragma: no cover
-    return encoding
-
-
-text_encoding = (
-    io.text_encoding if sys.version_info > (3, 10) else _text_encoding  # type: ignore
-)
diff --git a/pkg_resources/_vendor/zipp/glob.py b/pkg_resources/_vendor/zipp/glob.py
deleted file mode 100644
index 69c41d77c3..0000000000
--- a/pkg_resources/_vendor/zipp/glob.py
+++ /dev/null
@@ -1,106 +0,0 @@
-import os
-import re
-
-
-_default_seps = os.sep + str(os.altsep) * bool(os.altsep)
-
-
-class Translator:
-    """
-    >>> Translator('xyz')
-    Traceback (most recent call last):
-    ...
-    AssertionError: Invalid separators
-
-    >>> Translator('')
-    Traceback (most recent call last):
-    ...
-    AssertionError: Invalid separators
-    """
-
-    seps: str
-
-    def __init__(self, seps: str = _default_seps):
-        assert seps and set(seps) <= set(_default_seps), "Invalid separators"
-        self.seps = seps
-
-    def translate(self, pattern):
-        """
-        Given a glob pattern, produce a regex that matches it.
-        """
-        return self.extend(self.translate_core(pattern))
-
-    def extend(self, pattern):
-        r"""
-        Extend regex for pattern-wide concerns.
-
-        Apply '(?s:)' to create a non-matching group that
-        matches newlines (valid on Unix).
-
-        Append '\Z' to imply fullmatch even when match is used.
-        """
-        return rf'(?s:{pattern})\Z'
-
-    def translate_core(self, pattern):
-        r"""
-        Given a glob pattern, produce a regex that matches it.
-
-        >>> t = Translator()
-        >>> t.translate_core('*.txt').replace('\\\\', '')
-        '[^/]*\\.txt'
-        >>> t.translate_core('a?txt')
-        'a[^/]txt'
-        >>> t.translate_core('**/*').replace('\\\\', '')
-        '.*/[^/][^/]*'
-        """
-        self.restrict_rglob(pattern)
-        return ''.join(map(self.replace, separate(self.star_not_empty(pattern))))
-
-    def replace(self, match):
-        """
-        Perform the replacements for a match from :func:`separate`.
-        """
-        return match.group('set') or (
-            re.escape(match.group(0))
-            .replace('\\*\\*', r'.*')
-            .replace('\\*', rf'[^{re.escape(self.seps)}]*')
-            .replace('\\?', r'[^/]')
-        )
-
-    def restrict_rglob(self, pattern):
-        """
-        Raise ValueError if ** appears in anything but a full path segment.
-
-        >>> Translator().translate('**foo')
-        Traceback (most recent call last):
-        ...
-        ValueError: ** must appear alone in a path segment
-        """
-        seps_pattern = rf'[{re.escape(self.seps)}]+'
-        segments = re.split(seps_pattern, pattern)
-        if any('**' in segment and segment != '**' for segment in segments):
-            raise ValueError("** must appear alone in a path segment")
-
-    def star_not_empty(self, pattern):
-        """
-        Ensure that * will not match an empty segment.
-        """
-
-        def handle_segment(match):
-            segment = match.group(0)
-            return '?*' if segment == '*' else segment
-
-        not_seps_pattern = rf'[^{re.escape(self.seps)}]+'
-        return re.sub(not_seps_pattern, handle_segment, pattern)
-
-
-def separate(pattern):
-    """
-    Separate out character sets to avoid translating their contents.
-
-    >>> [m.group(0) for m in separate('*.txt')]
-    ['*.txt']
-    >>> [m.group(0) for m in separate('a[?]txt')]
-    ['a', '[?]', 'txt']
-    """
-    return re.finditer(r'([^\[]+)|(?P[\[].*?[\]])|([\[][^\]]*$)', pattern)
diff --git a/tools/vendored.py b/tools/vendored.py
index 22b18e50a4..6ac06db332 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -12,7 +12,6 @@ def remove_all(paths):
 
 
 def update_vendored():
-    update_pkg_resources()
     update_setuptools()
 
 
@@ -25,23 +24,6 @@ def clean(vendor):
     remove_all(path for path in vendor.glob('*') if path.basename() not in ignored)
 
 
-def update_pkg_resources():
-    deps = [
-        'packaging >= 24',
-        'platformdirs >= 2.6.2',
-        'jaraco.text >= 3.7',
-    ]
-    # workaround for https://github.com/pypa/pip/issues/12770
-    deps += [
-        'importlib_resources >= 5.10.2',
-        'zipp >= 3.7',
-        'backports.tarfile',
-    ]
-    vendor = Path('pkg_resources/_vendor')
-    clean(vendor)
-    install_deps(deps, vendor)
-
-
 @functools.cache
 def metadata():
     return jaraco.packaging.metadata.load('.')

From 1523957495248b3cd10cbcd27105ffd8523be319 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:28:51 -0400
Subject: [PATCH 125/151] Remove pkg_resources.extern.

---
 pkg_resources/extern/__init__.py | 104 -------------------------------
 1 file changed, 104 deletions(-)
 delete mode 100644 pkg_resources/extern/__init__.py

diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py
deleted file mode 100644
index daa978ff72..0000000000
--- a/pkg_resources/extern/__init__.py
+++ /dev/null
@@ -1,104 +0,0 @@
-from __future__ import annotations
-from importlib.machinery import ModuleSpec
-import importlib.util
-import sys
-from types import ModuleType
-from typing import Iterable, Sequence
-
-
-class VendorImporter:
-    """
-    A PEP 302 meta path importer for finding optionally-vendored
-    or otherwise naturally-installed packages from root_name.
-    """
-
-    def __init__(
-        self,
-        root_name: str,
-        vendored_names: Iterable[str] = (),
-        vendor_pkg: str | None = None,
-    ):
-        self.root_name = root_name
-        self.vendored_names = set(vendored_names)
-        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')
-
-    @property
-    def search_path(self):
-        """
-        Search first the vendor package then as a natural package.
-        """
-        yield self.vendor_pkg + '.'
-        yield ''
-
-    def _module_matches_namespace(self, fullname):
-        """Figure out if the target module is vendored."""
-        root, base, target = fullname.partition(self.root_name + '.')
-        return not root and any(map(target.startswith, self.vendored_names))
-
-    def load_module(self, fullname: str):
-        """
-        Iterate over the search path to locate and load fullname.
-        """
-        root, base, target = fullname.partition(self.root_name + '.')
-        for prefix in self.search_path:
-            extant = prefix + target
-            try:
-                __import__(extant)
-            except ImportError:
-                continue
-            mod = sys.modules[extant]
-            sys.modules[fullname] = mod
-            return mod
-        else:
-            raise ImportError(
-                "The '{target}' package is required; "
-                "normally this is bundled with this package so if you get "
-                "this warning, consult the packager of your "
-                "distribution.".format(**locals())
-            )
-
-    def create_module(self, spec: ModuleSpec):
-        return self.load_module(spec.name)
-
-    def exec_module(self, module: ModuleType):
-        pass
-
-    def find_spec(
-        self,
-        fullname: str,
-        path: Sequence[str] | None = None,
-        target: ModuleType | None = None,
-    ):
-        """Return a module spec for vendored names."""
-        return (
-            # This should fix itself next mypy release https://github.com/python/typeshed/pull/11890
-            importlib.util.spec_from_loader(fullname, self)  # type: ignore[arg-type]
-            if self._module_matches_namespace(fullname)
-            else None
-        )
-
-    def install(self):
-        """
-        Install this importer into sys.meta_path if not already present.
-        """
-        if self not in sys.meta_path:
-            sys.meta_path.append(self)
-
-
-# [[[cog
-# import cog
-# from tools.vendored import yield_top_level
-# names = "\n".join(f"    {x!r}," for x in yield_top_level('pkg_resources'))
-# cog.outl(f"names = (\n{names}\n)")
-# ]]]
-names = (
-    'backports',
-    'importlib_resources',
-    'jaraco',
-    'more_itertools',
-    'packaging',
-    'platformdirs',
-    'zipp',
-)
-# [[[end]]]
-VendorImporter(__name__, names).install()

From c4086b9e25fb10946d517770eb28662939d6d1e2 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:39:30 -0400
Subject: [PATCH 126/151] Clean up references to extern modules.

---
 conftest.py |  3 ---
 mypy.ini    | 10 ++++------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/conftest.py b/conftest.py
index 99d020b733..532e83112a 100644
--- a/conftest.py
+++ b/conftest.py
@@ -32,11 +32,8 @@ def pytest_configure(config):
     'setuptools/tests/mod_with_constant.py',
     'setuptools/_distutils',
     '_distutils_hack',
-    'setuptools/extern',
-    'pkg_resources/extern',
     'pkg_resources/tests/data',
     'setuptools/_vendor',
-    'pkg_resources/_vendor',
     'setuptools/config/_validate_pyproject',
     'setuptools/modified.py',
     'setuptools/tests/bdist_wheel_testdata',
diff --git a/mypy.ini b/mypy.ini
index 3581693038..7ca6de8eed 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -12,7 +12,7 @@ exclude = (?x)(
 	| ^.tox/
 	| ^.eggs/
 	| ^pkg_resources/tests/data/my-test-package-source/setup.py$ # Duplicate module name
-	| ^.+?/(_vendor|extern)/ # Vendored
+	| ^setuptools/_vendor/ # Vendored
 	| ^setuptools/_distutils/ # Vendored
 	| ^setuptools/config/_validate_pyproject/ # Auto-generated
     | ^setuptools/tests/bdist_wheel_testdata/  # Duplicate module name
@@ -31,15 +31,13 @@ disable_error_code = attr-defined
 [mypy-pkg_resources.tests.*]
 disable_error_code = import-not-found
 
-# - Avoid raising issues when importing from "extern" modules, as those are added to path dynamically.
-#   https://github.com/pypa/setuptools/pull/3979#discussion_r1367968993
 # - distutils._modified has different errors on Python 3.8 [import-untyped], on Python 3.9+ [import-not-found]
 # - All jaraco modules are still untyped
 # - _validate_project sometimes complains about trove_classifiers (#4296)
-[mypy-pkg_resources.extern.*,setuptools.extern.*,distutils._modified,jaraco.*,trove_classifiers]
+[mypy-distutils._modified,jaraco.*,trove_classifiers]
 ignore_missing_imports = True
 
-# Even when excluding vendored/generated modules, there might be problems: https://github.com/python/mypy/issues/11936#issuecomment-1466764006
-[mypy-setuptools._vendor.packaging._manylinux,setuptools.config._validate_pyproject.*]
+# Even when excluding generated modules, there might be problems: https://github.com/python/mypy/issues/11936#issuecomment-1466764006
+[mypy-setuptools.config._validate_pyproject.*]
 follow_imports = silent
 # silent => ignore errors when following imports

From ed15a3b1e278c22dcdd7b8a88f6ac05375c0e64a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:42:04 -0400
Subject: [PATCH 127/151] Add news fragment.

---
 newsfragments/2825.removal.rst | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 newsfragments/2825.removal.rst

diff --git a/newsfragments/2825.removal.rst b/newsfragments/2825.removal.rst
new file mode 100644
index 0000000000..38a9dac9b0
--- /dev/null
+++ b/newsfragments/2825.removal.rst
@@ -0,0 +1 @@
+Now setuptools declares its own dependencies. Dependencies are still vendored for bootstrapping purposes, but installed dependencies are preferred. Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.
\ No newline at end of file

From cb4b6708a0b5dc6db9e090595c79d8eb95fcbcdb Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:51:11 -0400
Subject: [PATCH 128/151] Suppress type errors around wheel.

---
 mypy.ini | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mypy.ini b/mypy.ini
index 7ca6de8eed..c4b30d1acd 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -34,7 +34,8 @@ disable_error_code = import-not-found
 # - distutils._modified has different errors on Python 3.8 [import-untyped], on Python 3.9+ [import-not-found]
 # - All jaraco modules are still untyped
 # - _validate_project sometimes complains about trove_classifiers (#4296)
-[mypy-distutils._modified,jaraco.*,trove_classifiers]
+# - wheel appears to be untyped
+[mypy-distutils._modified,jaraco.*,trove_classifiers,wheel.*]
 ignore_missing_imports = True
 
 # Even when excluding generated modules, there might be problems: https://github.com/python/mypy/issues/11936#issuecomment-1466764006

From e7c320b614d71b95a366a33a99296384b85b8527 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:52:23 -0400
Subject: [PATCH 129/151] Fix type error in vendored tool.

---
 tools/vendored.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/vendored.py b/tools/vendored.py
index 6ac06db332..5f8a6c0906 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -24,7 +24,7 @@ def clean(vendor):
     remove_all(path for path in vendor.glob('*') if path.basename() not in ignored)
 
 
-@functools.cache
+@functools.lru_cache
 def metadata():
     return jaraco.packaging.metadata.load('.')
 

From 3fd66b903901db002315055f8757dcbf8c4fa63f Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 2 Jul 2024 23:54:55 -0400
Subject: [PATCH 130/151] Fix incorrect type declaration in _python_requires.

---
 setuptools/config/_apply_pyprojecttoml.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setuptools/config/_apply_pyprojecttoml.py b/setuptools/config/_apply_pyprojecttoml.py
index 8c1a81dda5..6cc59d2b95 100644
--- a/setuptools/config/_apply_pyprojecttoml.py
+++ b/setuptools/config/_apply_pyprojecttoml.py
@@ -203,7 +203,7 @@ def _project_urls(dist: Distribution, val: dict, _root_dir):
     _set_config(dist, "project_urls", val)
 
 
-def _python_requires(dist: Distribution, val: dict, _root_dir):
+def _python_requires(dist: Distribution, val: str, _root_dir):
     from packaging.specifiers import SpecifierSet
 
     _set_config(dist, "python_requires", SpecifierSet(val))

From bb17215ed3fada4ca0ba513684e39511513c1bbb Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 3 Jul 2024 00:24:23 -0400
Subject: [PATCH 131/151] Fix type errors in pkg_resources, now that packaging
 types are recognized properly.

---
 pkg_resources/__init__.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index e53525032c..0fbd3c1765 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -540,8 +540,7 @@ def get_distribution(dist: Distribution | _PkgReqType) -> Distribution:
     if isinstance(dist, str):
         dist = Requirement.parse(dist)
     if isinstance(dist, Requirement):
-        # Bad type narrowing, dist has to be a Requirement here, so get_provider has to return Distribution
-        dist = get_provider(dist)  # type: ignore[assignment]
+        dist = get_provider(dist)
     if not isinstance(dist, Distribution):
         raise TypeError("Expected str, Requirement, or Distribution", dist)
     return dist
@@ -1120,7 +1119,7 @@ def markers_pass(self, req: Requirement, extras: tuple[str, ...] | None = None):
         evaluation. Otherwise, return True.
         """
         extra_evals = (
-            req.marker.evaluate({'extra': extra})
+            req.marker.evaluate({'extra': extra})  # type: ignore
             for extra in self.get(req, ()) + (extras or (None,))
         )
         return not req.marker or any(extra_evals)
@@ -3432,6 +3431,10 @@ class RequirementParseError(_packaging_requirements.InvalidRequirement):
 
 
 class Requirement(_packaging_requirements.Requirement):
+    # prefer variable length tuple to set (as found in
+    # packaging.requirements.Requirement)
+    extras: tuple[str, ...]  # type: ignore[assignment]
+
     def __init__(self, requirement_string: str):
         """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!"""
         super().__init__(requirement_string)
@@ -3439,8 +3442,7 @@ def __init__(self, requirement_string: str):
         project_name = safe_name(self.name)
         self.project_name, self.key = project_name, project_name.lower()
         self.specs = [(spec.operator, spec.version) for spec in self.specifier]
-        # packaging.requirements.Requirement uses a set for its extras. We use a variable-length tuple
-        self.extras: tuple[str] = tuple(map(safe_extra, self.extras))
+        self.extras = tuple(map(safe_extra, self.extras))
         self.hashCmp = (
             self.key,
             self.url,
@@ -3456,7 +3458,7 @@ def __eq__(self, other: object):
     def __ne__(self, other):
         return not self == other
 
-    def __contains__(self, item: Distribution | str | tuple[str, ...]) -> bool:
+    def __contains__(self, item: Distribution | str) -> bool:
         if isinstance(item, Distribution):
             if item.key != self.key:
                 return False
@@ -3466,7 +3468,10 @@ def __contains__(self, item: Distribution | str | tuple[str, ...]) -> bool:
         # Allow prereleases always in order to match the previous behavior of
         # this method. In the future this should be smarter and follow PEP 440
         # more accurately.
-        return self.specifier.contains(item, prereleases=True)
+        return self.specifier.contains(
+            item,  # type: ignore[arg-type]
+            prereleases=True,
+        )
 
     def __hash__(self):
         return self.__hash

From 242ef247e999bfe6e7a3a8eb4d984cb948ad0b4d Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 3 Jul 2024 00:32:30 -0400
Subject: [PATCH 132/151] Suppress coverage errors.

---
 setuptools/_importlib.py          | 4 ++--
 setuptools/command/bdist_wheel.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/setuptools/_importlib.py b/setuptools/_importlib.py
index 14384bef5d..b2d5b5b84a 100644
--- a/setuptools/_importlib.py
+++ b/setuptools/_importlib.py
@@ -2,12 +2,12 @@
 
 
 if sys.version_info < (3, 10):
-    import importlib_metadata as metadata
+    import importlib_metadata as metadata  # pragma: no cover
 else:
     import importlib.metadata as metadata  # noqa: F401
 
 
 if sys.version_info < (3, 9):
-    import importlib_resources as resources
+    import importlib_resources as resources  # pragma: no cover
 else:
     import importlib.resources as resources  # noqa: F401
diff --git a/setuptools/command/bdist_wheel.py b/setuptools/command/bdist_wheel.py
index 50248cdc25..14cdd6e934 100644
--- a/setuptools/command/bdist_wheel.py
+++ b/setuptools/command/bdist_wheel.py
@@ -67,7 +67,7 @@ def python_tag() -> str:
 def get_platform(archive_root: str | None) -> str:
     """Return our platform name 'win32', 'linux_x86_64'"""
     result = sysconfig.get_platform()
-    if result.startswith("macosx") and archive_root is not None:
+    if result.startswith("macosx") and archive_root is not None:  # pragma: no cover
         from wheel.macosx_libfile import calculate_macosx_platform_tag
 
         result = calculate_macosx_platform_tag(archive_root, result)

From d25f6d985b66b8153abee52ad7e6d00f5580d532 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 3 Jul 2024 11:22:23 -0400
Subject: [PATCH 133/151] Moved the dependencies to a 'core' extra to avoid
 dangers with cyclic dependencies at build time.

---
 newsfragments/2825.removal.rst |  2 +-
 pyproject.toml                 | 24 +++++++++++++-----------
 tools/vendored.py              | 12 ++++++++++--
 tox.ini                        |  1 +
 4 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/newsfragments/2825.removal.rst b/newsfragments/2825.removal.rst
index 38a9dac9b0..f7a2460d4b 100644
--- a/newsfragments/2825.removal.rst
+++ b/newsfragments/2825.removal.rst
@@ -1 +1 @@
-Now setuptools declares its own dependencies. Dependencies are still vendored for bootstrapping purposes, but installed dependencies are preferred. Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.
\ No newline at end of file
+Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but installed dependencies are preferred. Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.
diff --git a/pyproject.toml b/pyproject.toml
index 7c517943a4..b02f3930ae 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -25,17 +25,6 @@ classifiers = [
 keywords = ["CPAN PyPI distutils eggs package management"]
 requires-python = ">=3.8"
 dependencies = [
-	"packaging>=24",
-	"ordered-set>=3.1.1",
-	"more_itertools>=8.8",
-	"jaraco.text>=3.7",
-	"importlib_resources>=5.10.2",
-	"importlib_metadata>=6",
-	"tomli>=2.0.1",
-	"wheel>=0.43.0",
-
-	# pkg_resources
-	"platformdirs >= 2.6.2",
 ]
 
 [project.urls]
@@ -107,6 +96,19 @@ doc = [
 ]
 ssl = []
 certs = []
+core = [
+	"packaging>=24",
+	"ordered-set>=3.1.1",
+	"more_itertools>=8.8",
+	"jaraco.text>=3.7",
+	"importlib_resources>=5.10.2",
+	"importlib_metadata>=6",
+	"tomli>=2.0.1",
+	"wheel>=0.43.0",
+
+	# pkg_resources
+	"platformdirs >= 2.6.2",
+]
 
 [project.entry-points."distutils.commands"]
 alias = "setuptools.command.alias:alias"
diff --git a/tools/vendored.py b/tools/vendored.py
index 5f8a6c0906..2101e7c20f 100644
--- a/tools/vendored.py
+++ b/tools/vendored.py
@@ -1,4 +1,5 @@
 import functools
+import re
 import sys
 import subprocess
 
@@ -29,11 +30,18 @@ def metadata():
     return jaraco.packaging.metadata.load('.')
 
 
+def upgrade_core(dep):
+    """
+    Remove 'extra == "core"' from any dependency.
+    """
+    return re.sub('''(;| and) extra == ['"]core['"]''', '', dep)
+
+
 def load_deps():
     """
-    Read the dependencies from `.`.
+    Read the dependencies from `.[core]`.
     """
-    return metadata().get_all('Requires-Dist')
+    return list(map(upgrade_core, metadata().get_all('Requires-Dist')))
 
 
 def min_python():
diff --git a/tox.ini b/tox.ini
index 8a3f6260b7..00e38fbb9a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -10,6 +10,7 @@ commands =
 usedevelop = True
 extras =
 	test
+	core
 pass_env =
 	SETUPTOOLS_USE_DISTUTILS
 	SETUPTOOLS_ENFORCE_DEPRECATION

From fa7ee9130dd012ddfb4bf22e39e442a1e73ff0ed Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 3 Jul 2024 11:50:50 -0400
Subject: [PATCH 134/151] Ensure that package data from vendored packages gets
 installed.

---
 pyproject.toml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pyproject.toml b/pyproject.toml
index b02f3930ae..183c534e0a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -185,6 +185,10 @@ exclude = [
 ]
 namespaces = true
 
+[tool.setuptools.package-data]
+# ensure that `setuptools/_vendor/jaraco/text/Lorem ipsum.txt` is installed
+"*" = ["*.txt"]
+
 [tool.distutils.sdist]
 formats = "zip"
 

From 4a3406baf94b1ef8122364b417c9564344a52921 Mon Sep 17 00:00:00 2001
From: Christoph Reiter 
Date: Thu, 4 Jul 2024 22:53:21 +0200
Subject: [PATCH 135/151] CI: also set CC/CXX when pip installing with
 mingw+clang

Now that setuptools with mingw support is on pypi, this uncovered
the same issue as fixed in 23174730a61af359f when pip installing
MarkupSafe.

Apply the same work around here too.
---
 .github/workflows/main.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index b6b757dbf5..1f63867d85 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -143,6 +143,9 @@ jobs:
             git
       - name: Install Dependencies
         shell: msys2 {0}
+        env:
+          CC: ${{ matrix.cc }}
+          CXX: ${{ matrix.cxx }}
         run: |
           export VIRTUALENV_NO_SETUPTOOLS=1
 

From bacd9c6f92ed1926644f5743d7139d16ee65801b Mon Sep 17 00:00:00 2001
From: Christoph Reiter 
Date: Thu, 4 Jul 2024 22:25:54 +0200
Subject: [PATCH 136/151] sysconfig: skip customize_compiler() with MSVC Python
 again

By enabling customize_compiler() when using the mingw compiler class
in 2ad8784dfeb81682 this also enabled it for when the mingw compiler
class was used with a MSVC built CPython.

MSVC CPython doesn't have any of the config vars that are required in
customize_compiler() though. And while it would be nice if all the env
vars would be considered in that scenario too, it's not clear how this
should be implemented without any sysconfig provided fallbacks
(if CC isn't set but CFLAGS is, there is no way to pass things to
set_executables() etc.)

Given that, just restore the previous behaviour, skip customize_compiler()
with MSVC Python in all cases, and add a test.

Fixes https://github.com/pypa/setuptools/issues/4456
---
 distutils/sysconfig.py                 |  4 +++-
 distutils/tests/test_mingwccompiler.py | 10 ++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py
index 4ba0be5602..7ebe67687e 100644
--- a/distutils/sysconfig.py
+++ b/distutils/sysconfig.py
@@ -293,7 +293,9 @@ def customize_compiler(compiler):  # noqa: C901
     Mainly needed on Unix, so we can plug in the information that
     varies across Unices and is stored in Python's Makefile.
     """
-    if compiler.compiler_type in ["unix", "cygwin", "mingw32"]:
+    if compiler.compiler_type in ["unix", "cygwin"] or (
+        compiler.compiler_type == "mingw32" and is_mingw()
+    ):
         _customize_macos()
 
         (
diff --git a/distutils/tests/test_mingwccompiler.py b/distutils/tests/test_mingwccompiler.py
index d81360e782..fd201cd773 100644
--- a/distutils/tests/test_mingwccompiler.py
+++ b/distutils/tests/test_mingwccompiler.py
@@ -2,6 +2,7 @@
 
 from distutils.util import split_quoted, is_mingw
 from distutils.errors import DistutilsPlatformError, CCompilerError
+from distutils import sysconfig
 
 
 class TestMingw32CCompiler:
@@ -43,3 +44,12 @@ def test_cygwincc_error(self, monkeypatch):
 
         with pytest.raises(CCompilerError):
             distutils.cygwinccompiler.Mingw32CCompiler()
+
+    def test_customize_compiler_with_msvc_python(self):
+        from distutils.cygwinccompiler import Mingw32CCompiler
+
+        # In case we have an MSVC Python build, but still want to use
+        # Mingw32CCompiler, then customize_compiler() shouldn't fail at least.
+        # https://github.com/pypa/setuptools/issues/4456
+        compiler = Mingw32CCompiler()
+        sysconfig.customize_compiler(compiler)

From a2a64ec4795d8c441e0602bdf0b3feca5d4fd263 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Mon, 8 Jul 2024 14:37:33 -0400
Subject: [PATCH 137/151] Explicitly declare the 'core' extra as 'for
 informational purposes'

---
 newsfragments/2825.removal.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newsfragments/2825.removal.rst b/newsfragments/2825.removal.rst
index f7a2460d4b..e775fcf318 100644
--- a/newsfragments/2825.removal.rst
+++ b/newsfragments/2825.removal.rst
@@ -1 +1 @@
-Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but installed dependencies are preferred. Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.
+Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but setuptools will prefer installed dependencies if present. The ``core`` extra is used for informational purposes and should *not* be declared in package metadata (e.g. ``build-requires``). Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.

From c4e64c194285e73895a858fa226cd5225beebfed Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 9 Jul 2024 11:44:04 -0400
Subject: [PATCH 138/151] Add news fragment.

---
 newsfragments/+4571b0f4.bugfix.rst | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 newsfragments/+4571b0f4.bugfix.rst

diff --git a/newsfragments/+4571b0f4.bugfix.rst b/newsfragments/+4571b0f4.bugfix.rst
new file mode 100644
index 0000000000..94c7cacdb7
--- /dev/null
+++ b/newsfragments/+4571b0f4.bugfix.rst
@@ -0,0 +1 @@
+Bugfix for building Cython extension on Windows (pypa/distutils#268).
\ No newline at end of file

From 356e9a00c4f04c1c6cf76a4a5f97325d0ab4df46 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 9 Jul 2024 11:49:44 -0400
Subject: [PATCH 139/151] =?UTF-8?q?Bump=20version:=2070.2.0=20=E2=86=92=20?=
 =?UTF-8?q?70.3.0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .bumpversion.cfg                   |  2 +-
 NEWS.rst                           | 15 +++++++++++++++
 newsfragments/+4571b0f4.bugfix.rst |  1 -
 newsfragments/4137.feature.rst     |  1 -
 pyproject.toml                     |  2 +-
 5 files changed, 17 insertions(+), 4 deletions(-)
 delete mode 100644 newsfragments/+4571b0f4.bugfix.rst
 delete mode 100644 newsfragments/4137.feature.rst

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 96806f9494..2149b39451 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 70.2.0
+current_version = 70.3.0
 commit = True
 tag = True
 
diff --git a/NEWS.rst b/NEWS.rst
index df3c50f6a2..565b1f4b80 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,18 @@
+v70.3.0
+=======
+
+Features
+--------
+
+- Support for loading distutils from the standard library is now deprecated, including use of SETUPTOOLS_USE_DISTUTILS=stdlib and importing distutils before importing setuptools. (#4137)
+
+
+Bugfixes
+--------
+
+- Bugfix for building Cython extension on Windows (pypa/distutils#268).
+
+
 v70.2.0
 =======
 
diff --git a/newsfragments/+4571b0f4.bugfix.rst b/newsfragments/+4571b0f4.bugfix.rst
deleted file mode 100644
index 94c7cacdb7..0000000000
--- a/newsfragments/+4571b0f4.bugfix.rst
+++ /dev/null
@@ -1 +0,0 @@
-Bugfix for building Cython extension on Windows (pypa/distutils#268).
\ No newline at end of file
diff --git a/newsfragments/4137.feature.rst b/newsfragments/4137.feature.rst
deleted file mode 100644
index 89ca0cb758..0000000000
--- a/newsfragments/4137.feature.rst
+++ /dev/null
@@ -1 +0,0 @@
-Support for loading distutils from the standard library is now deprecated, including use of SETUPTOOLS_USE_DISTUTILS=stdlib and importing distutils before importing setuptools.
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 00e7ee169f..2672b0d97c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,7 +5,7 @@ backend-path = ["."]
 
 [project]
 name = "setuptools"
-version = "70.2.0"
+version = "70.3.0"
 authors = [
 	{ name = "Python Packaging Authority", email = "distutils-sig@python.org" },
 ]

From 225f7fe32f5a07b99ff3fb403f517e6dbf208d68 Mon Sep 17 00:00:00 2001
From: Avasam 
Date: Tue, 9 Jul 2024 14:43:09 -0400
Subject: [PATCH 140/151] Rewrite marker evaluation to address two type check
 failures.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

1. The early `req.marker` works around a limitation that mypy can't detect that `not req.marker` is evaluated prior to entering the generator.

2. The `None` → `""` honors the type spec (`dict-item`) and avoids relying on the [deprecated code path](https://github.com/pypa/packaging/blob/793ee28b4c70886e8de5731e24e444388916b3ee/src/packaging/markers.py#L322-L323) allowing `None`.
---
 pkg_resources/__init__.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 0fbd3c1765..8aa190cab2 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -1118,11 +1118,10 @@ def markers_pass(self, req: Requirement, extras: tuple[str, ...] | None = None):
         Return False if the req has a marker and fails
         evaluation. Otherwise, return True.
         """
-        extra_evals = (
-            req.marker.evaluate({'extra': extra})  # type: ignore
-            for extra in self.get(req, ()) + (extras or (None,))
+        return not req.marker or any(
+            req.marker.evaluate({'extra': extra})
+            for extra in self.get(req, ()) + (extras or ("",))
         )
-        return not req.marker or any(extra_evals)
 
 
 class Environment:

From 0e1e7078560708b450ff5fdd59b9c1f425b15595 Mon Sep 17 00:00:00 2001
From: Avasam 
Date: Tue, 9 Jul 2024 14:45:44 -0400
Subject: [PATCH 141/151] Update `Requirement.__contains__` type spec to accept
 `UnparsedVersion`.

---
 pkg_resources/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 8aa190cab2..b8cf28cdb5 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -89,6 +89,7 @@
     # no write support, probably under GAE
     WRITE_SUPPORT = False
 
+import packaging.specifiers
 from jaraco.text import (
     yield_lines,
     drop_comment,
@@ -3457,7 +3458,9 @@ def __eq__(self, other: object):
     def __ne__(self, other):
         return not self == other
 
-    def __contains__(self, item: Distribution | str) -> bool:
+    def __contains__(
+        self, item: Distribution | packaging.specifiers.UnparsedVersion
+    ) -> bool:
         if isinstance(item, Distribution):
             if item.key != self.key:
                 return False

From 930ebe55b0a68d9da16fed8a4fa5a305b47945cb Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 9 Jul 2024 15:52:32 -0400
Subject: [PATCH 142/151] Rely on os.path.join and os.path.dirname when adding
 the vendored path and only add it if it's not already present.

---
 pkg_resources/__init__.py | 2 +-
 setuptools/__init__.py    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index b8cf28cdb5..0857970fec 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -74,7 +74,7 @@
 
 import _imp
 
-sys.path.append(os.path.dirname(__file__) + '/../setuptools/_vendor')
+sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path])  # fmt: skip
 
 # capture these to bypass sandboxing
 from os import utime
diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index 2917c6a811..8b0e494f01 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -6,7 +6,7 @@
 import sys
 from typing import TYPE_CHECKING
 
-sys.path.append(os.path.dirname(__file__) + '/_vendor')
+sys.path.extend(((vendor_path := os.path.join(os.path.dirname(os.path.dirname(__file__)), 'setuptools', '_vendor')) not in sys.path) * [vendor_path])  # fmt: skip
 
 import _distutils_hack.override  # noqa: F401
 import distutils.core

From 9eb89def774d29239f5d01d95a33b6f84bbbc536 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Tue, 9 Jul 2024 15:59:32 -0400
Subject: [PATCH 143/151] Resolve a version from an item, addressing missed
 `arg-type` check.

---
 pkg_resources/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 0857970fec..822232a7fb 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -3465,13 +3465,15 @@ def __contains__(
             if item.key != self.key:
                 return False
 
-            item = item.version
+            version = item.version
+        else:
+            version = item
 
         # Allow prereleases always in order to match the previous behavior of
         # this method. In the future this should be smarter and follow PEP 440
         # more accurately.
         return self.specifier.contains(
-            item,  # type: ignore[arg-type]
+            version,
             prereleases=True,
         )
 

From 17d5d8ba9e4812eb07d20253078b3e3600ea0ba6 Mon Sep 17 00:00:00 2001
From: Dimitri Papadopoulos
 <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Tue, 9 Jul 2024 23:11:44 +0200
Subject: [PATCH 144/151] Fix 92989c2i / #4450

Restore the previous functionality, where the function did not return
explicitly in case of exceptions, and hence returned `None`.
---
 setuptools/tests/test_sdist.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 1be568d3fa..096cdc3924 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -124,6 +124,7 @@ def symlink_or_skip_test(src, dst):
         os.symlink(src, dst)
     except (OSError, NotImplementedError):
         pytest.skip("symlink not supported in OS")
+        return None
     return dst
 
 

From b7410ab911ad8faebe5f8be5f21b47bf2167c243 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 10 Jul 2024 14:38:24 -0400
Subject: [PATCH 145/151] Pin pytest-ruff on Windows.

Workaround for businho/pytest-ruff#28; Closes #4467.
---
 pyproject.toml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pyproject.toml b/pyproject.toml
index 2672b0d97c..b8d0116b54 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -70,6 +70,9 @@ test = [
 	"pyproject-hooks!=1.1",
 
 	"jaraco.test",
+
+	# workaround for businho/pytest-ruff#28
+	'pytest-ruff < 0.4; platform_system == "Windows"',
 ]
 doc = [
 	# upstream

From 7a810b97b706cc98f15de700d7666df7ebab38d9 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 10 Jul 2024 14:57:45 -0400
Subject: [PATCH 146/151] Move workaround for #3921 to the local section,
 restoring upstream to match upstream.

---
 pyproject.toml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index b8d0116b54..a584dd025c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -39,8 +39,7 @@ test = [
 	"pytest-cov",
 	"pytest-mypy",
 	"pytest-enabler >= 2.2",
-	# workaround for pypa/setuptools#3921
-	'pytest-ruff >= 0.3.2; sys_platform != "cygwin"',
+	"pytest-ruff >= 0.2.1",
 
 	# local
 	"virtualenv>=13.0.0",
@@ -66,6 +65,10 @@ test = [
 	"importlib_metadata",
 	"pytest-subprocess",
 
+	# require newer pytest-ruff than upstream for pypa/setuptools#4368
+	# also exclude cygwin for pypa/setuptools#3921
+	'pytest-ruff >= 0.3.2; sys_platform != "cygwin"',
+
 	# workaround for pypa/setuptools#4333
 	"pyproject-hooks!=1.1",
 

From 33c4896dbaeda2fd7a5fef701431dea05bb83bab Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 10 Jul 2024 15:34:09 -0400
Subject: [PATCH 147/151] Exclude pytest-ruff (and thus ruff), which cannot
 build on cygwin.

Ref pypa/setuptools#3921
---
 pyproject.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index ad67d3b12d..1307e1fa20 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,7 +32,7 @@ test = [
 	"pytest-cov",
 	"pytest-mypy",
 	"pytest-enabler >= 2.2",
-	"pytest-ruff >= 0.2.1",
+	"pytest-ruff >= 0.2.1; sys_platform != 'cygwin'",
 
 	# local
 ]

From d6abb6409b881ad13e232a61ead5facf761ee779 Mon Sep 17 00:00:00 2001
From: Marco Treglia 
Date: Thu, 11 Jul 2024 17:19:30 +0200
Subject: [PATCH 148/151] Rename arguments on _EditableFinder and
 _EditableNamespaceFinder

This commit rename the `find_spec` arguments in _EditableFinder and
_EditableNamespaceFinder to be compliant of the standard
`importlib.abc.MetaPathFinder` interface.

https://docs.python.org/3/library/importlib.html#importlib.machinery.PathFinder.find_spec
https://github.com/abravalheri/typeshed/blob/eecac02ef7fdbe82b9dc57fa3ca4bb9d341116d7/stdlib/_typeshed/importlib.pyi

The `find_module` arguments were not renamed because the method `find_module`
is deprecated starting from Pyhton3.10 and has been removed in Pyhton3.12

https://docs.python.org/3/reference/import.html#the-meta-path
---
 setuptools/command/editable_wheel.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py
index ae31bb4c79..d2ca2b48a6 100644
--- a/setuptools/command/editable_wheel.py
+++ b/setuptools/command/editable_wheel.py
@@ -805,7 +805,7 @@ def _get_root(self):
 
 class _EditableFinder:  # MetaPathFinder
     @classmethod
-    def find_spec(cls, fullname: str, _path=None, _target=None) -> ModuleSpec | None:
+    def find_spec(cls, fullname: str, path=None, target=None) -> ModuleSpec | None:  # type: ignore
         # Top-level packages and modules (we know these exist in the FS)
         if fullname in MAPPING:
             pkg_path = MAPPING[fullname]
@@ -851,7 +851,7 @@ def _paths(cls, fullname: str) -> list[str]:
         return [*paths, PATH_PLACEHOLDER]
 
     @classmethod
-    def find_spec(cls, fullname: str, _target=None) -> ModuleSpec | None:
+    def find_spec(cls, fullname: str, target=None) -> ModuleSpec | None:  # type: ignore
         if fullname in NAMESPACES:
             spec = ModuleSpec(fullname, None, is_package=True)
             spec.submodule_search_locations = cls._paths(fullname)

From 1b344658b9c406be8bb6cb48ee5d6c1b9ea7d765 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 17 Jul 2024 10:42:00 -0400
Subject: [PATCH 149/151] =?UTF-8?q?Bump=20version:=2070.3.0=20=E2=86=92=20?=
 =?UTF-8?q?71.0.0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .bumpversion.cfg               | 2 +-
 NEWS.rst                       | 9 +++++++++
 newsfragments/2825.removal.rst | 1 -
 pyproject.toml                 | 2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)
 delete mode 100644 newsfragments/2825.removal.rst

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index 2149b39451..24c407b586 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 70.3.0
+current_version = 71.0.0
 commit = True
 tag = True
 
diff --git a/NEWS.rst b/NEWS.rst
index 565b1f4b80..52b10f837b 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,12 @@
+v71.0.0
+=======
+
+Deprecations and Removals
+-------------------------
+
+- Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but setuptools will prefer installed dependencies if present. The ``core`` extra is used for informational purposes and should *not* be declared in package metadata (e.g. ``build-requires``). Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory. (#2825)
+
+
 v70.3.0
 =======
 
diff --git a/newsfragments/2825.removal.rst b/newsfragments/2825.removal.rst
deleted file mode 100644
index e775fcf318..0000000000
--- a/newsfragments/2825.removal.rst
+++ /dev/null
@@ -1 +0,0 @@
-Now setuptools declares its own dependencies in the ``core`` extra. Dependencies are still vendored for bootstrapping purposes, but setuptools will prefer installed dependencies if present. The ``core`` extra is used for informational purposes and should *not* be declared in package metadata (e.g. ``build-requires``). Downstream packagers can de-vendor by simply removing the ``setuptools/_vendor`` directory.
diff --git a/pyproject.toml b/pyproject.toml
index 5955df5287..54931e2ff2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,7 +5,7 @@ backend-path = ["."]
 
 [project]
 name = "setuptools"
-version = "70.3.0"
+version = "71.0.0"
 authors = [
 	{ name = "Python Packaging Authority", email = "distutils-sig@python.org" },
 ]

From 6c6e2e168eed329e3f0ca5089f8f5ad283dfd74a Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 17 Jul 2024 15:14:41 -0400
Subject: [PATCH 150/151] =?UTF-8?q?=F0=9F=91=B9=20Feed=20the=20hobgoblins?=
 =?UTF-8?q?=20(delint).?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #4473.
---
 pkg_resources/tests/test_pkg_resources.py | 2 +-
 setuptools/command/editable_wheel.py      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py
index 4c4c68dfff..424d5ac44b 100644
--- a/pkg_resources/tests/test_pkg_resources.py
+++ b/pkg_resources/tests/test_pkg_resources.py
@@ -279,7 +279,7 @@ def test_distribution_version_missing(
     assert expected_text in msg
     # Check that the message portion contains the path.
     assert metadata_path in msg, str((metadata_path, msg))
-    assert type(dist) == expected_dist_type
+    assert type(dist) is expected_dist_type
 
 
 @pytest.mark.xfail(
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py
index f6f0657e8c..13c450cb49 100644
--- a/setuptools/command/editable_wheel.py
+++ b/setuptools/command/editable_wheel.py
@@ -299,7 +299,7 @@ def _run_build_subcommands(self) -> None:
         build = self.get_finalized_command("build")
         for name in build.get_sub_commands():
             cmd = self.get_finalized_command(name)
-            if name == "build_py" and type(cmd) != build_py_cls:
+            if name == "build_py" and type(cmd) is not build_py_cls:
                 self._safely_run(name)
             else:
                 self.run_command(name)

From 9c53695500f496d91ba372e61668392d01a68a97 Mon Sep 17 00:00:00 2001
From: "Jason R. Coombs" 
Date: Wed, 17 Jul 2024 16:54:25 -0400
Subject: [PATCH 151/151] Update intersphinx link to point to redirected
 target.

---
 docs/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/conf.py b/docs/conf.py
index a0e3398d54..0f85661789 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -106,7 +106,7 @@
 
 intersphinx_mapping.update({
     'pip': ('https://pip.pypa.io/en/latest', None),
-    'build': ('https://pypa-build.readthedocs.io/en/latest', None),
+    'build': ('https://build.pypa.io/en/latest', None),
     'PyPUG': ('https://packaging.python.org/en/latest/', None),
     'packaging': ('https://packaging.pypa.io/en/latest/', None),
     'twine': ('https://twine.readthedocs.io/en/stable/', None),