Skip to content

Commit 566e47d

Browse files
authored
Remove unused vars or mark them explicitly (#4724)
2 parents ac0e4f8 + fcdf55e commit 566e47d

19 files changed

+49
-51
lines changed

pkg_resources/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ def _extract_resource(self, manager: ResourceManager, zip_path) -> str: # noqa:
20642064
# return the extracted directory name
20652065
return os.path.dirname(last)
20662066

2067-
timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
2067+
timestamp, _size = self._get_date_and_size(self.zipinfo[zip_path])
20682068

20692069
if not WRITE_SUPPORT:
20702070
raise OSError(

pkg_resources/tests/test_resources.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,11 @@ def test_requirements_with_markers(self):
693693
) != Requirement.parse("name[foo,bar]==1.0;python_version=='3.6'")
694694

695695
def test_local_version(self):
696-
(req,) = parse_requirements('foo==1.0+org1')
696+
parse_requirements('foo==1.0+org1')
697697

698698
def test_spaces_between_multiple_versions(self):
699-
(req,) = parse_requirements('foo>=1.0, <3')
700-
(req,) = parse_requirements('foo >= 1.0, < 3')
699+
parse_requirements('foo>=1.0, <3')
700+
parse_requirements('foo >= 1.0, < 3')
701701

702702
@pytest.mark.parametrize(
703703
("lower", "upper"),

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def pypi_link(pkg_filename):
3232
dependency link for PyPI.
3333
"""
3434
root = 'https://files.pythonhosted.org/packages/source'
35-
name, sep, rest = pkg_filename.partition('-')
35+
name, _sep, _rest = pkg_filename.partition('-')
3636
parts = root, name[0], name, pkg_filename
3737
return '/'.join(parts)
3838

setuptools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(self, attrs: Mapping[str, object]):
7070
def _get_project_config_files(self, filenames=None):
7171
"""Ignore ``pyproject.toml``, they are not related to setup_requires"""
7272
try:
73-
cfg, toml = super()._split_standard_project_metadata(filenames)
73+
cfg, _toml = super()._split_standard_project_metadata(filenames)
7474
except Exception:
7575
return filenames, ()
7676
return cfg, ()

setuptools/command/bdist_egg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def run(self): # noqa: C901 # is too complex (14) # FIXME
181181
self.stubs = []
182182
to_compile = []
183183
for p, ext_name in enumerate(ext_outputs):
184-
filename, ext = os.path.splitext(ext_name)
184+
filename, _ext = os.path.splitext(ext_name)
185185
pyfile = os.path.join(self.bdist_dir, strip_module(filename) + '.py')
186186
self.stubs.append(pyfile)
187187
log.info("creating stub loader for %s", ext_name)

setuptools/command/build_ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def link_shared_object(
460460

461461
assert output_dir is None # distutils build_ext doesn't pass this
462462
output_dir, filename = os.path.split(output_libname)
463-
basename, ext = os.path.splitext(filename)
463+
basename, _ext = os.path.splitext(filename)
464464
if self.library_filename("x").startswith('lib'):
465465
# strip 'lib' prefix; this is kludgy if some platform uses
466466
# a different prefix

setuptools/command/easy_install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,7 @@ def extract_wininst_cfg(dist_filename):
15471547
return None
15481548
f.seek(prepended - 12)
15491549

1550-
tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
1550+
tag, cfglen, _bmlen = struct.unpack("<iii", f.read(12))
15511551
if tag not in (0x1234567A, 0x1234567B):
15521552
return None # not a valid tag
15531553

setuptools/command/install_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _all_packages(pkg_name):
5252
"""
5353
while pkg_name:
5454
yield pkg_name
55-
pkg_name, sep, child = pkg_name.rpartition('.')
55+
pkg_name, _sep, _child = pkg_name.rpartition('.')
5656

5757
def _get_SVEM_NSPs(self):
5858
"""

setuptools/config/setupcfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def _section_options(
263263
cls, options: AllCommandOptions
264264
) -> Iterator[tuple[str, SingleCommandOptions]]:
265265
for full_name, value in options.items():
266-
pre, sep, name = full_name.partition(cls.section_prefix)
266+
pre, _sep, name = full_name.partition(cls.section_prefix)
267267
if pre:
268268
continue
269269
yield name.lstrip('.'), value

setuptools/depends.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def get_version(
7070

7171
if self.attribute is None:
7272
try:
73-
f, p, i = find_module(self.module, paths)
73+
f, _p, _i = find_module(self.module, paths)
7474
except ImportError:
7575
return None
7676
if f:
@@ -122,7 +122,7 @@ def get_module_constant(
122122
constant. Otherwise, return 'default'."""
123123

124124
try:
125-
f, path, (suffix, mode, kind) = info = find_module(module, paths)
125+
f, path, (_suffix, _mode, kind) = info = find_module(module, paths)
126126
except ImportError:
127127
# Module doesn't exist
128128
return None

0 commit comments

Comments
 (0)