[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-04-13 00:00:18 +00:00
parent 72ad6dc953
commit f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions

View file

@ -1,16 +1,20 @@
import sys
from __future__ import annotations
import importlib
import os
import re
import importlib
import sys
import warnings
is_pypy = '__pypy__' in sys.builtin_module_names
warnings.filterwarnings('ignore',
r'.+ distutils\b.+ deprecated',
DeprecationWarning)
warnings.filterwarnings(
'ignore',
r'.+ distutils\b.+ deprecated',
DeprecationWarning,
)
def warn_distutils_present():
@ -21,18 +25,19 @@ def warn_distutils_present():
# https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250
return
warnings.warn(
"Distutils was imported before Setuptools, but importing Setuptools "
"also replaces the `distutils` module in `sys.modules`. This may lead "
"to undesirable behaviors or errors. To avoid these issues, avoid "
"using distutils directly, ensure that setuptools is installed in the "
"traditional way (e.g. not an editable install), and/or make sure "
"that setuptools is always imported before distutils.")
'Distutils was imported before Setuptools, but importing Setuptools '
'also replaces the `distutils` module in `sys.modules`. This may lead '
'to undesirable behaviors or errors. To avoid these issues, avoid '
'using distutils directly, ensure that setuptools is installed in the '
'traditional way (e.g. not an editable install), and/or make sure '
'that setuptools is always imported before distutils.',
)
def clear_distutils():
if 'distutils' not in sys.modules:
return
warnings.warn("Setuptools is replacing distutils.")
warnings.warn('Setuptools is replacing distutils.')
mods = [name for name in sys.modules if re.match(r'distutils\b', name)]
for name in mods:
del sys.modules[name]
@ -74,7 +79,7 @@ class DistutilsMetaFinder:
if path is not None:
return
method_name = 'spec_for_{fullname}'.format(**locals())
method_name = f'spec_for_{fullname}'
method = getattr(self, method_name, lambda: None)
return method()

View file

@ -1 +1,2 @@
from __future__ import annotations
__import__('_distutils_hack').do_override()