Skip to content

Commit 9c449ca

Browse files
Manual fixes after ruff check --fix runs
1 parent 444a545 commit 9c449ca

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

pkg_resources/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ def get_supported_platform():
205205
m = macosVersionString.match(plat)
206206
if m is not None and sys.platform == "darwin":
207207
try:
208-
plat = 'macosx-{}-{}'.format('.'.join(_macos_vers()[:2]), m.group(3))
208+
major_minor = '.'.join(_macos_vers()[:2])
209+
build = m.group(3)
210+
plat = f'macosx-{major_minor}-{build}'
209211
except ValueError:
210212
# not macOS
211213
pass
@@ -2738,7 +2740,8 @@ def __str__(self) -> str:
27382740
if self.attrs:
27392741
s += ':' + '.'.join(self.attrs)
27402742
if self.extras:
2741-
s += ' [{}]'.format(','.join(self.extras))
2743+
extras = ','.join(self.extras)
2744+
s += f' [{extras}]'
27422745
return s
27432746

27442747
def __repr__(self) -> str:
@@ -3324,8 +3327,8 @@ def check_version_conflict(self):
33243327
):
33253328
continue
33263329
issue_warning(
3327-
f"Module {modname} was already imported from {fn}, but {self.location} is being added"
3328-
" to sys.path",
3330+
f"Module {modname} was already imported from {fn}, "
3331+
f"but {self.location} is being added to sys.path",
33293332
)
33303333

33313334
def has_version(self) -> bool:

setuptools/_core_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ def write_field(key, value):
178178
if license:
179179
write_field('License', rfc822_escape(license))
180180

181-
for project_url in self.project_urls.items():
182-
write_field('Project-URL', '{}, {}'.format(*project_url))
181+
for label, url in self.project_urls.items():
182+
write_field('Project-URL', f'{label}, {url}')
183183

184184
keywords = ','.join(self.get_keywords())
185185
if keywords:

setuptools/command/bdist_egg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __bootstrap__():
6969

7070

7171
class bdist_egg(Command):
72-
description = "create an \"egg\" distribution"
72+
description = 'create an "egg" distribution'
7373

7474
user_options = [
7575
('bdist-dir=', 'b', "temporary directory for creating the distribution"),

setuptools/command/build_ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def get_ext_filename(self, fullname: str) -> str:
167167
if not isinstance(ext_suffix, str):
168168
raise OSError(
169169
"Configuration variable EXT_SUFFIX not found for this platform "
170-
+ "and environment variable SETUPTOOLS_EXT_SUFFIX is missing"
170+
"and environment variable SETUPTOOLS_EXT_SUFFIX is missing"
171171
)
172172
so_ext = ext_suffix
173173

setuptools/command/easy_install.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class easy_install(Command):
133133
(
134134
'optimize=',
135135
'O',
136-
"also compile with optimization: -O1 for \"python -O\", "
137-
"-O2 for \"python -OO\", and -O0 to disable [default: -O0]",
136+
'also compile with optimization: -O1 for "python -O", '
137+
'-O2 for "python -OO", and -O0 to disable [default: -O0]',
138138
),
139139
('record=', None, "filename in which to record list of installed files"),
140140
('always-unzip', 'Z', "don't install as a zipfile, no matter what"),
@@ -1025,7 +1025,8 @@ def install_exe(self, dist_filename, tmpdir):
10251025
f.write('Metadata-Version: 1.0\n')
10261026
for k, v in cfg.items('metadata'):
10271027
if k != 'target_version':
1028-
f.write('{}: {}\n'.format(k.replace('_', '-').title(), v))
1028+
k = k.replace('_', '-').title()
1029+
f.write(f'{k}: {v}\n')
10291030
script_dir = os.path.join(_egg_info, 'scripts')
10301031
# delete entry-point scripts to avoid duping
10311032
self.delete_blockers([

setuptools/dist.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ def check_nsp(dist, attr, value):
119119
for nsp in ns_packages:
120120
if not dist.has_contents_for(nsp):
121121
raise DistutilsSetupError(
122-
"Distribution contains no modules or packages for "
123-
+ f"namespace package {nsp!r}"
122+
f"Distribution contains no modules or packages for namespace package {nsp!r}"
124123
)
125124
parent, sep, child = nsp.rpartition('.')
126125
if parent and parent not in ns_packages:

setuptools/tests/config/test_setupcfg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,24 @@ def test_basic(self, tmpdir):
8787
'[options]\n'
8888
'scripts = bin/a.py, bin/b.py\n',
8989
)
90-
config_dict = read_configuration(f'{config}')
90+
config_dict = read_configuration(str(config))
9191
assert config_dict['metadata']['version'] == '10.1.1'
9292
assert config_dict['metadata']['keywords'] == ['one', 'two']
9393
assert config_dict['options']['scripts'] == ['bin/a.py', 'bin/b.py']
9494

9595
def test_no_config(self, tmpdir):
9696
with pytest.raises(DistutilsFileError):
97-
read_configuration('{}'.format(tmpdir.join('setup.cfg')))
97+
read_configuration(str(tmpdir.join('setup.cfg')))
9898

9999
def test_ignore_errors(self, tmpdir):
100100
_, config = fake_env(
101101
tmpdir,
102102
'[metadata]\nversion = attr: none.VERSION\nkeywords = one, two\n',
103103
)
104104
with pytest.raises(ImportError):
105-
read_configuration(f'{config}')
105+
read_configuration(str(config))
106106

107-
config_dict = read_configuration(f'{config}', ignore_option_errors=True)
107+
config_dict = read_configuration(str(config), ignore_option_errors=True)
108108

109109
assert config_dict['metadata']['keywords'] == ['one', 'two']
110110
assert 'version' not in config_dict['metadata']

setuptools/tests/test_build_ext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ def test_build_ext_config_handling(tmpdir_cwd):
284284
),
285285
}
286286
path.build(files)
287-
code, output = environment.run_setup_py(
287+
code, (stdout, stderr) = environment.run_setup_py(
288288
cmd=['build'],
289289
data_stream=(0, 2),
290290
)
291-
assert code == 0, '\nSTDOUT:\n{}\nSTDERR:\n{}'.format(*output)
291+
assert code == 0, f'\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}'

0 commit comments

Comments
 (0)