# Buggy code
def to(self, raw: T, of_type: Type[V]) -> V:
    from_module = getattr(of_type, "__module__", None)
    if from_module in ("typing", "typing_extensions"):
        return self._to_typing(raw, of_type)  # type: ignore[return-value]
    elif issubclass(of_type, Path):
        return self.to_path(raw)  # type: ignore[return-value]
    elif issubclass(of_type, bool):
        return self.to_bool(raw)  # type: ignore[return-value]
    elif issubclass(of_type, Command):
        return self.to_command(raw)  # type: ignore[return-value]
    elif issubclass(of_type, EnvList):
        return self.to_env_list(raw)  # type: ignore[return-value]
    elif issubclass(of_type, str):
        return self.to_str(raw)  # type: ignore[return-value]
    elif isinstance(raw, of_type):
        return raw
    elif issubclass(of_type, Enum):
        return cast(V, getattr(of_type, str(raw)))
    return of_type(raw)  # type: ignore[call-arg]


# Traceback (ValueError)
ROOT: 221 D setup logging to DEBUG on pid 27538 [tox/report.py:211]
ROOT: 236 W remove tox env folder $project_root/.tox/4/py38 [tox/tox_env/api.py:190]
ROOT: 339 I find interpreter for spec PythonSpec(implementation=CPython, major=3, minor=8) [virtualenv/discovery/builtin.py:62]
ROOT: 339 D discover exe for PythonInfo(spec=CPython3.9.0.final.0-64, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) in $sys_prefix [virtualenv/discovery/py_info.py:371]
ROOT: 340 D filesystem is case-sensitive [virtualenv/info.py:28]
ROOT: 342 D Attempting to acquire lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:270]
ROOT: 342 D Lock 4490835328 acquired on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:274]
ROOT: 343 D got python info of $sys_prefix/bin/python3.9 from $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 344 D Attempting to release lock 4490835328 on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:315]
ROOT: 345 D Lock 4490835328 released on $libdir/virtualenv/py_info/1/0dd39cadf38d642f262c45befae072f4eba5242a64fcd0af3712cb7000099054.lock [filelock.py:318]
ROOT: 345 I proposed PythonInfo(spec=CPython3.9.0.final.0-64, system=$sys_prefix/bin/python3.9, exe=$tox_prefix/bin/python, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 345 D discover PATH[0]=$path0 [virtualenv/discovery/builtin.py:112]
ROOT: 346 D Attempting to acquire lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:270]
ROOT: 346 D Lock 4490834272 acquired on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:274]
ROOT: 347 D got python info of $path0/python3 from $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 348 D Attempting to release lock 4490834272 on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:315]
ROOT: 348 D Lock 4490834272 released on $libdir/virtualenv/py_info/1/72fa9ab46076656735501d364f18b4e0263de8642ccefb942f5c7ea68c4a2db8.lock [filelock.py:318]
ROOT: 348 I proposed PathPythonInfo(spec=CPython3.9.0.final.0-64, exe=$path0/python3, platform=darwin, version='3.9.0 (default, Nov 21 2020, 22:02:08) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 349 D discover PATH[1]=$path1 [virtualenv/discovery/builtin.py:112]
ROOT: 350 D Attempting to acquire lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:270]
ROOT: 350 D Lock 4490799088 acquired on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:274]
ROOT: 350 D got python info of $path1/python3.8 from $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.json [virtualenv/app_data/via_disk_folder.py:135]
ROOT: 351 D Attempting to release lock 4490799088 on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:315]
ROOT: 351 D Lock 4490799088 released on $libdir/virtualenv/py_info/1/ab0e10762c764739f09e25a792a6b8e56c3af9d63a034ef7bb1b5fa032ef6b5d.lock [filelock.py:318]
ROOT: 352 I proposed PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:68]
ROOT: 352 D accepted PathPythonInfo(spec=CPython3.8.6.final.0-64, exe=$path1/python3.8, platform=darwin, version='3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:70]
ROOT: 422 I create virtual environment via CPython3Posix(dest=$project_root/.tox/4/py38, clear=True, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:52]
ROOT: 422 D create folder $project_root/.tox/4/py38/bin [virtualenv/util/path/_sync.py:25]
ROOT: 423 D create folder $project_root/.tox/4/py38/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:25]
ROOT: 423 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 423 D 	home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D 	implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D 	version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D 	virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D 	include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D 	base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D 	base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 424 D 	base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 425 D symlink $path1/python3.8 to $project_root/.tox/4/py38/bin/python [virtualenv/util/path/_sync.py:44]
ROOT: 426 D create virtualenv import hook file $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:95]
ROOT: 427 D create $project_root/.tox/4/py38/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:98]
ROOT: 428 D ============================== target debug ============================== [virtualenv/run/session.py:54]
ROOT: 428 D debug via $project_root/.tox/4/py38/bin/python $tox_prefix/lib/python3.9/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:223]
ROOT: 428 D {
"sys": {
"executable": "$project_root/.tox/4/py38/bin/python",
"_base_executable": "$project_root/.tox/4/py38/bin/python",
"prefix": "$project_root/.tox/4/py38",
"base_prefix": "$sys_prefix",
"real_prefix": null,
"exec_prefix": "$project_root/.tox/4/py38",
"base_exec_prefix": "$sys_prefix",
"path": [
"$sys_prefix/lib/python38.zip",
"$sys_prefix/lib/python3.8",
"$sys_prefix/lib/python3.8/lib-dynload",
"$project_root/.tox/4/py38/lib/python3.8/site-packages"
],
"meta_path": [
"<class '_virtualenv._Finder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.8.6 (default, Oct 27 2020, 17:10:36) \n[Clang 12.0.0 (clang-1200.0.32.21)]",
"makefile_filename": "$sys_prefix/lib/python3.8/config-3.8-darwin/Makefile",
"os": "<module 'os' from '$sys_prefix/lib/python3.8/os.py'>",
"site": "<module 'site' from '$sys_prefix/lib/python3.8/site.py'>",
"datetime": "<module 'datetime' from '$sys_prefix/lib/python3.8/datetime.py'>",
"math": "<module 'math' from '$sys_prefix/lib/python3.8/lib-dynload/math.cpython-38-darwin.so'>",
"json": "<module 'json' from '$sys_prefix/lib/python3.8/json/__init__.py'>"
} [virtualenv/run/session.py:55]
ROOT: 544 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=$libdir/virtualenv) [virtualenv/run/session.py:59]
py38: 549 D got embed update of distribution pip from $libdir/virtualenv/wheel/3.8/embed/1/pip.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 550 D got embed update of distribution setuptools from $libdir/virtualenv/wheel/3.8/embed/1/setuptools.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 555 D got embed update of distribution wheel from $libdir/virtualenv/wheel/3.8/embed/1/wheel.json [virtualenv/app_data/via_disk_folder.py:135]
py38: 556 D install pip from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-20.3.3-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 556 D install setuptools from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/setuptools-51.1.2-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 557 D install wheel from wheel $tox_prefix/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/wheel-0.36.2-py2.py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
py38: 558 D Attempting to acquire lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:270]
py38: 558 D Lock 4494292928 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to acquire lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:270]
py38: 559 D Attempting to acquire lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:270]
py38: 559 D Lock 4494293984 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:274]
py38: 559 D Lock 4494294560 acquired on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:274]
py38: 559 D Attempting to release lock 4494292928 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494292928 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Attempting to release lock 4494293984 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:315]
py38: 560 D Attempting to release lock 4494294560 on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:315]
py38: 560 D Lock 4494293984 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any.lock [filelock.py:318]
py38: 560 D Lock 4494294560 released on $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any.lock [filelock.py:318]
py38: 561 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 561 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 562 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 563 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/easy_install.py to $project_root/.tox/4/py38/lib/python3.8/site-packages/easy_install.py [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools-51.1.2.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools-51.1.2.dist-info [virtualenv/util/path/_sync.py:52]
py38: 564 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:52]
py38: 574 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:52]
py38: 576 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/distutils-precedence.pth to $project_root/.tox/4/py38/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:52]
py38: 579 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/setuptools to $project_root/.tox/4/py38/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:52]
py38: 603 D copy $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.36.2-py2.py3-none-any/wheel-0.36.2.virtualenv to $project_root/.tox/4/py38/lib/python3.8/site-packages/wheel-0.36.2.virtualenv [virtualenv/util/path/_sync.py:52]
py38: 608 D changing mode of $project_root/.tox/4/py38/bin/wheel3 to 755 [distlib/util.py:566]
py38: 609 D changing mode of $project_root/.tox/4/py38/bin/wheel3.8 to 755 [distlib/util.py:566]
py38: 610 D changing mode of $project_root/.tox/4/py38/bin/wheel-3.8 to 755 [distlib/util.py:566]
py38: 611 D changing mode of $project_root/.tox/4/py38/bin/wheel to 755 [distlib/util.py:566]
py38: 612 D generated console scripts wheel3.8 wheel wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 740 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/pkg_resources to $project_root/.tox/4/py38/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:52]
py38: 759 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-51.1.2-py3-none-any/_distutils_hack to $project_root/.tox/4/py38/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:52]
py38: 763 D changing mode of $project_root/.tox/4/py38/bin/easy_install-3.8 to 755 [distlib/util.py:566]
py38: 764 D changing mode of $project_root/.tox/4/py38/bin/easy_install to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3 to 755 [distlib/util.py:566]
py38: 765 D changing mode of $project_root/.tox/4/py38/bin/easy_install3.8 to 755 [distlib/util.py:566]
py38: 765 D generated console scripts easy_install3.8 easy_install easy_install-3.8 easy_install3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
py38: 985 D copy directory $libdir/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-20.3.3-py2.py3-none-any/pip-20.3.3.dist-info to $project_root/.tox/4/py38/lib/python3.8/site-packages/pip-20.3.3.dist-info [virtualenv/util/path/_sync.py:52]
py38: 994 D changing mode of $project_root/.tox/4/py38/bin/pip3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip-3.8 to 755 [distlib/util.py:566]
py38: 995 D changing mode of $project_root/.tox/4/py38/bin/pip to 755 [distlib/util.py:566]
py38: 996 D changing mode of $project_root/.tox/4/py38/bin/pip3 to 755 [distlib/util.py:566]
py38: 996 D generated console scripts pip3.8 pip3 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:48]
ROOT: 996 I add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [virtualenv/run/session.py:64]
ROOT: 1002 D write $project_root/.tox/4/py38/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:34]
ROOT: 1002 D 	home = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D 	implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1002 D 	version_info = 3.8.6.final.0 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D 	virtualenv = 20.3.1 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D 	include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D 	base-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D 	base-exec-prefix = $sys_prefix [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1003 D 	base-executable = $path1/python3.8 [virtualenv/create/pyenv_cfg.py:38]
ROOT: 1006 E internal error [tox/session/cmd/run/single.py:53]
Traceback (most recent call last):
File "$tox_prefix/lib/python3.9/site-packages/tox/session/cmd/run/single.py", line 41, in _evaluate
tox_env.ensure_setup(recreate=recreate)
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/api.py", line 167, in ensure_setup
self.setup()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 46, in setup
self.install_deps()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/runner.py", line 70, in install_deps
requirement_file_content = requirements_file.validate_and_expand()
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 126, in validate_and_expand
result.extend(req_file.validate_and_expand())
File "$tox_prefix/lib/python3.9/site-packages/tox/tox_env/python/req_file.py", line 130, in validate_and_expand
raise ValueError(line)
ValueError: --use-feature=2020-resolver
py38: FAIL ✖ in 0.78 seconds
py38: FAIL code 2 (0.78 seconds)
evaluation failed :( (0.82 seconds)
Exception: tox4 exited with 2

# Fixed code
def to(self, raw: T, of_type: Type[V], kwargs: Mapping[str, Any]) -> V:
    from_module = getattr(of_type, "__module__", None)
    if from_module in ("typing", "typing_extensions"):
        return self._to_typing(raw, of_type, kwargs)  # type: ignore[return-value]
    elif issubclass(of_type, Path):
        return self.to_path(raw)  # type: ignore[return-value]
    elif issubclass(of_type, bool):
        return self.to_bool(raw)  # type: ignore[return-value]
    elif issubclass(of_type, Command):
        return self.to_command(raw)  # type: ignore[return-value]
    elif issubclass(of_type, EnvList):
        return self.to_env_list(raw)  # type: ignore[return-value]
    elif issubclass(of_type, str):
        return self.to_str(raw)  # type: ignore[return-value]
    elif isinstance(raw, of_type):
        return raw
    elif issubclass(of_type, Enum):
        return cast(V, getattr(of_type, str(raw)))
    return of_type(raw, **kwargs)  # type: ignore[call-arg]