Skip to content

Commit 578d630

Browse files
Manual fixes after ruff check --fix runs
1 parent 88861f9 commit 578d630

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
@@ -200,7 +200,9 @@ def get_supported_platform():
200200
m = macosVersionString.match(plat)
201201
if m is not None and sys.platform == "darwin":
202202
try:
203-
plat = 'macosx-{}-{}'.format('.'.join(_macos_vers()[:2]), m.group(3))
203+
major_minor = '.'.join(_macos_vers()[:2])
204+
build = m.group(3)
205+
plat = f'macosx-{major_minor}-{build}'
204206
except ValueError:
205207
# not macOS
206208
pass
@@ -2733,7 +2735,8 @@ def __str__(self) -> str:
27332735
if self.attrs:
27342736
s += ':' + '.'.join(self.attrs)
27352737
if self.extras:
2736-
s += ' [{}]'.format(','.join(self.extras))
2738+
extras = ','.join(self.extras)
2739+
s += f' [{extras}]'
27372740
return s
27382741

27392742
def __repr__(self) -> str:
@@ -3319,8 +3322,8 @@ def check_version_conflict(self):
33193322
):
33203323
continue
33213324
issue_warning(
3322-
f"Module {modname} was already imported from {fn}, but {self.location} is being added"
3323-
" to sys.path",
3325+
f"Module {modname} was already imported from {fn}, "
3326+
f"but {self.location} is being added to sys.path",
33243327
)
33253328

33263329
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
@@ -168,7 +168,7 @@ def get_ext_filename(self, fullname: str) -> str:
168168
if not isinstance(ext_suffix, str):
169169
raise OSError(
170170
"Configuration variable EXT_SUFFIX not found for this platform "
171-
+ "and environment variable SETUPTOOLS_EXT_SUFFIX is missing"
171+
"and environment variable SETUPTOOLS_EXT_SUFFIX is missing"
172172
)
173173
so_ext = ext_suffix
174174

setuptools/command/easy_install.py

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

setuptools/dist.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ def check_nsp(dist, attr, value):
110110
for nsp in ns_packages:
111111
if not dist.has_contents_for(nsp):
112112
raise DistutilsSetupError(
113-
"Distribution contains no modules or packages for "
114-
+ f"namespace package {nsp!r}"
113+
f"Distribution contains no modules or packages for namespace package {nsp!r}"
115114
)
116115
parent, _sep, _child = nsp.rpartition('.')
117116
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
@@ -286,8 +286,8 @@ def test_build_ext_config_handling(tmpdir_cwd):
286286
),
287287
}
288288
path.build(files)
289-
code, output = environment.run_setup_py(
289+
code, (stdout, stderr) = environment.run_setup_py(
290290
cmd=['build'],
291291
data_stream=(0, 2),
292292
)
293-
assert code == 0, '\nSTDOUT:\n{}\nSTDERR:\n{}'.format(*output)
293+
assert code == 0, f'\nSTDOUT:\n{stdout}\nSTDERR:\n{stderr}'

0 commit comments

Comments
 (0)