Skip to content

Commit 4c5d666

Browse files
authored
Merge pull request #311 from bluetech/py36-pyupgrade
Run pyupgrade --py36
2 parents 5ca5220 + 80a4891 commit 4c5d666

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

docs/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
import sys
32

43
if sys.version_info >= (3, 8):
@@ -26,7 +25,7 @@
2625
# General information about the project.
2726

2827
project = "pluggy"
29-
copyright = u"2016, Holger Krekel"
28+
copyright = "2016, Holger Krekel"
3029
author = "Holger Krekel"
3130

3231
release = metadata.version(project)
@@ -58,7 +57,7 @@
5857

5958
# One entry per manual page. List of tuples
6059
# (source start file, name, description, authors, manual section).
61-
man_pages = [(master_doc, "pluggy", u"pluggy Documentation", [author], 1)]
60+
man_pages = [(master_doc, "pluggy", "pluggy Documentation", [author], 1)]
6261

6362

6463
# -- Options for Texinfo output -------------------------------------------
@@ -70,7 +69,7 @@
7069
(
7170
master_doc,
7271
"pluggy",
73-
u"pluggy Documentation",
72+
"pluggy Documentation",
7473
author,
7574
"pluggy",
7675
"One line description of project.",

src/pluggy/_tracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def _format_message(self, tags, args):
2222
content = " ".join(map(str, args))
2323
indent = " " * self.indent
2424

25-
lines = ["%s%s [%s]\n" % (indent, content, ":".join(tags))]
25+
lines = ["{}{} [{}]\n".format(indent, content, ":".join(tags))]
2626

2727
for name, value in extra.items():
28-
lines.append("%s %s: %s\n" % (indent, name, value))
28+
lines.append(f"{indent} {name}: {value}\n")
2929

3030
return "".join(lines)
3131

src/pluggy/callers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _multicall(hook_name, hook_impls, caller_kwargs, firstresult):
2525
for argname in hook_impl.argnames:
2626
if argname not in caller_kwargs:
2727
raise HookCallError(
28-
"hook call must provide argument %r" % (argname,)
28+
f"hook call must provide argument {argname!r}"
2929
)
3030

3131
if hook_impl.hookwrapper:

src/pluggy/hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def remove(wrappers):
214214

215215
if remove(self._wrappers) is None:
216216
if remove(self._nonwrappers) is None:
217-
raise ValueError("plugin %r not found" % (plugin,))
217+
raise ValueError(f"plugin {plugin!r} not found")
218218

219219
def get_hookimpls(self):
220220
# Order is important for _hookexec
@@ -240,7 +240,7 @@ def _add_hookimpl(self, hookimpl):
240240
methods.insert(i + 1, hookimpl)
241241

242242
def __repr__(self):
243-
return "<_HookCaller %r>" % (self.name,)
243+
return f"<_HookCaller {self.name!r}>"
244244

245245
def __call__(self, *args, **kwargs):
246246
if args:
@@ -314,7 +314,7 @@ def __init__(self, plugin, plugin_name, function, hook_impl_opts):
314314
self.__dict__.update(hook_impl_opts)
315315

316316
def __repr__(self):
317-
return "<HookImpl plugin_name=%r, plugin=%r>" % (self.plugin_name, self.plugin)
317+
return f"<HookImpl plugin_name={self.plugin_name!r}, plugin={self.plugin!r}>"
318318

319319

320320
class HookSpec:

src/pluggy/manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def add_hookspecs(self, module_or_class):
177177

178178
if not names:
179179
raise ValueError(
180-
"did not find any %r hooks in %r" % (self.project_name, module_or_class)
180+
f"did not find any {self.project_name!r} hooks in {module_or_class!r}"
181181
)
182182

183183
def parse_hookspec_opts(self, module_or_class, name):
@@ -369,4 +369,4 @@ def subset_hook_caller(self, name, remove_plugins):
369369

370370

371371
def _formatdef(func):
372-
return "%s%s" % (func.__name__, inspect.signature(func))
372+
return f"{func.__name__}{inspect.signature(func)}"

testing/test_details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,5 @@ def myhook(self):
131131
plugin = Plugin()
132132
pname = pm.register(plugin)
133133
assert repr(pm.hook.myhook._nonwrappers[0]) == (
134-
"<HookImpl plugin_name=%r, plugin=%r>" % (pname, plugin)
134+
f"<HookImpl plugin_name={pname!r}, plugin={plugin!r}>"
135135
)

0 commit comments

Comments
 (0)