summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSviatoslav Sydorenko <wk@sydorenko.org.ua>2020-12-31 13:08:18 +0100
committerSviatoslav Sydorenko <wk@sydorenko.org.ua>2020-12-31 19:01:22 +0100
commitfc891f5cf6d93ad533e2afb5e15a2952408ab358 (patch)
treeebe67de5500e5be0891b0b64edd09e0177b74c80
parentc225c4c0f64bf044f2f82693df097ad07f9c12bd (diff)
downloadpython-setuptools-git-fc891f5cf6d93ad533e2afb5e15a2952408ab358.tar.gz
Apply noqa C901 comments to overly complex code
-rw-r--r--pkg_resources/__init__.py9
-rw-r--r--setuptools/command/bdist_egg.py2
-rw-r--r--setuptools/command/easy_install.py19
-rw-r--r--setuptools/command/egg_info.py2
-rw-r--r--setuptools/dist.py8
-rw-r--r--setuptools/installer.py2
-rw-r--r--setuptools/msvc.py4
-rw-r--r--setuptools/package_index.py8
-rw-r--r--setuptools/ssl_support.py2
9 files changed, 34 insertions, 22 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 737f4d5f..f4225777 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -696,7 +696,8 @@ class WorkingSet:
keys2.append(dist.key)
self._added_new(dist)
- def resolve(self, requirements, env=None, installer=None,
+ # FIXME: 'WorkingSet.resolve' is too complex (11)
+ def resolve(self, requirements, env=None, installer=None, # noqa: C901
replace_conflicting=False, extras=None):
"""List all distributions needed to (recursively) meet `requirements`
@@ -1745,7 +1746,8 @@ class ZipProvider(EggProvider):
timestamp = time.mktime(date_time)
return timestamp, size
- def _extract_resource(self, manager, zip_path):
+ # FIXME: 'ZipProvider._extract_resource' is too complex (12)
+ def _extract_resource(self, manager, zip_path): # noqa: C901
if zip_path in self._index():
for name in self._index()[zip_path]:
@@ -2858,7 +2860,8 @@ class Distribution:
"""Return the EntryPoint object for `group`+`name`, or ``None``"""
return self.get_entry_map(group).get(name)
- def insert_on(self, path, loc=None, replace=False):
+ # FIXME: 'Distribution.insert_on' is too complex (13)
+ def insert_on(self, path, loc=None, replace=False): # noqa: C901
"""Ensure self.location is on path
If replace=False (default):
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index a88efb45..206f2419 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -153,7 +153,7 @@ class bdist_egg(Command):
self.run_command(cmdname)
return cmd
- def run(self):
+ def run(self): # noqa: C901 # is too complex (14) # FIXME
# Generate metadata first
self.run_command("egg_info")
# We run install_lib before install_data, because some data hacks
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 6882efe0..f1e487d4 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -226,7 +226,7 @@ class easy_install(Command):
print(tmpl.format(**locals()))
raise SystemExit()
- def finalize_options(self):
+ def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME
self.version and self._render_version()
py_version = sys.version.split()[0]
@@ -437,7 +437,7 @@ class easy_install(Command):
def warn_deprecated_options(self):
pass
- def check_site_dir(self):
+ def check_site_dir(self): # noqa: C901 # is too complex (12) # FIXME
"""Verify that self.install_dir is .pth-capable dir, if needed"""
instdir = normalize_path(self.install_dir)
@@ -713,7 +713,10 @@ class easy_install(Command):
if getattr(self, attrname) is None:
setattr(self, attrname, scheme[key])
- def process_distribution(self, requirement, dist, deps=True, *info):
+ # FIXME: 'easy_install.process_distribution' is too complex (12)
+ def process_distribution( # noqa: C901
+ self, requirement, dist, deps=True, *info,
+ ):
self.update_pth(dist)
self.package_index.add(dist)
if dist in self.local_index[dist.key]:
@@ -894,7 +897,8 @@ class easy_install(Command):
metadata = EggMetadata(zipimport.zipimporter(egg_path))
return Distribution.from_filename(egg_path, metadata=metadata)
- def install_egg(self, egg_path, tmpdir):
+ # FIXME: 'easy_install.install_egg' is too complex (11)
+ def install_egg(self, egg_path, tmpdir): # noqa: C901
destination = os.path.join(
self.install_dir,
os.path.basename(egg_path),
@@ -993,7 +997,8 @@ class easy_install(Command):
# install the .egg
return self.install_egg(egg_path, tmpdir)
- def exe_to_egg(self, dist_filename, egg_tmp):
+ # FIXME: 'easy_install.exe_to_egg' is too complex (12)
+ def exe_to_egg(self, dist_filename, egg_tmp): # noqa: C901
"""Extract a bdist_wininst to the directories an egg would use"""
# Check for .pth file and set up prefix translations
prefixes = get_exe_prefixes(dist_filename)
@@ -1191,7 +1196,7 @@ class easy_install(Command):
cfg_filename = os.path.join(base, 'setup.cfg')
setopt.edit_config(cfg_filename, settings)
- def update_pth(self, dist):
+ def update_pth(self, dist): # noqa: C901 # is too complex (11) # FIXME
if self.pth_file is None:
return
@@ -1427,7 +1432,7 @@ def get_site_dirs():
return sitedirs
-def expand_paths(inputs):
+def expand_paths(inputs): # noqa: C901 # is too complex (11) # FIXME
"""Yield sys.path directories that might contain "old-style" packages"""
seen = {}
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 8e34e4a2..1f120b67 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -32,7 +32,7 @@ from setuptools.extern import packaging
from setuptools import SetuptoolsDeprecationWarning
-def translate_pattern(glob):
+def translate_pattern(glob): # noqa: C901 # is too complex (14) # FIXME
"""
Translate a file path glob like '*.txt' in to a regular expression.
This differs from fnmatch.translate which allows wildcards to match
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 186a407c..662fbe67 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -119,7 +119,7 @@ def read_pkg_file(self, file):
# Based on Python 3.5 version
-def write_pkg_file(self, file):
+def write_pkg_file(self, file): # noqa: C901 # is too complex (14) # FIXME
"""Write the PKG-INFO format data to a file object.
"""
version = self.get_metadata_version()
@@ -548,7 +548,8 @@ class Distribution(_Distribution):
req.marker = None
return req
- def _parse_config_files(self, filenames=None):
+ # FIXME: 'Distribution._parse_config_files' is too complex (14)
+ def _parse_config_files(self, filenames=None): # noqa: C901
"""
Adapted from distutils.dist.Distribution.parse_config_files,
this method provides the same functionality in subtly-improved
@@ -612,7 +613,8 @@ class Distribution(_Distribution):
except ValueError as e:
raise DistutilsOptionError(e) from e
- def _set_command_options(self, command_obj, option_dict=None):
+ # FIXME: 'Distribution._set_command_options' is too complex (14)
+ def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
"""
Set the options for 'command_obj' from 'option_dict'. Basically
this means copying elements of a dictionary ('option_dict') to
diff --git a/setuptools/installer.py b/setuptools/installer.py
index ac2aba18..c5822a31 100644
--- a/setuptools/installer.py
+++ b/setuptools/installer.py
@@ -51,7 +51,7 @@ def _legacy_fetch_build_egg(dist, req):
return cmd.easy_install(req)
-def fetch_build_egg(dist, req):
+def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index 53d45e59..d5e0a952 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -921,8 +921,8 @@ class SystemInfo:
"""
return self._use_last_dir_name(join(self.WindowsSdkDir, 'lib'))
- @property
- def WindowsSdkDir(self):
+ @property # noqa: C901
+ def WindowsSdkDir(self): # noqa: C901 # is too complex (12) # FIXME
"""
Microsoft Windows SDK directory.
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 713391af..123e9582 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -320,7 +320,8 @@ class PackageIndex(Environment):
else:
self.opener = urllib.request.urlopen
- def process_url(self, url, retrieve=False):
+ # FIXME: 'PackageIndex.process_url' is too complex (14)
+ def process_url(self, url, retrieve=False): # noqa: C901
"""Evaluate a URL as a possible download, and maybe retrieve it"""
if url in self.scanned_urls and not retrieve:
return
@@ -595,7 +596,7 @@ class PackageIndex(Environment):
spec = parse_requirement_arg(spec)
return getattr(self.fetch_distribution(spec, tmpdir), 'location', None)
- def fetch_distribution(
+ def fetch_distribution( # noqa: C901 # is too complex (14) # FIXME
self, requirement, tmpdir, force_scan=False, source=False,
develop_ok=False, local_index=None):
"""Obtain a distribution suitable for fulfilling `requirement`
@@ -766,7 +767,8 @@ class PackageIndex(Environment):
def reporthook(self, url, filename, blocknum, blksize, size):
pass # no-op
- def open_url(self, url, warning=None):
+ # FIXME:
+ def open_url(self, url, warning=None): # noqa: C901 # is too complex (12)
if url.startswith('file:'):
return local_open(url)
try:
diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py
index eac5e656..b58cca37 100644
--- a/setuptools/ssl_support.py
+++ b/setuptools/ssl_support.py
@@ -56,7 +56,7 @@ if not CertificateError:
pass
-if not match_hostname:
+if not match_hostname: # noqa: C901 # 'If 59' is too complex (21) # FIXME
def _dnsname_match(dn, hostname, max_wildcards=1):
"""Matching according to RFC 6125, section 6.4.3