[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-04-13 00:00:18 +00:00
parent 72ad6dc953
commit f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions

View file

@ -34,18 +34,18 @@ def _raise_wrapfail(
) -> NoReturn:
co = wrap_controller.gi_code
raise RuntimeError(
"wrap_controller at %r %s:%d %s"
% (co.co_name, co.co_filename, co.co_firstlineno, msg)
'wrap_controller at %r %s:%d %s'
% (co.co_name, co.co_filename, co.co_firstlineno, msg),
)
def _warn_teardown_exception(
hook_name: str, hook_impl: HookImpl, e: BaseException
hook_name: str, hook_impl: HookImpl, e: BaseException,
) -> None:
msg = "A plugin raised an exception during an old-style hookwrapper teardown.\n"
msg += f"Plugin: {hook_impl.plugin_name}, Hook: {hook_name}\n"
msg += f"{type(e).__name__}: {e}\n"
msg += "For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning" # noqa: E501
msg = 'A plugin raised an exception during an old-style hookwrapper teardown.\n'
msg += f'Plugin: {hook_impl.plugin_name}, Hook: {hook_name}\n'
msg += f'{type(e).__name__}: {e}\n'
msg += 'For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning' # noqa: E501
warnings.warn(PluggyTeardownRaisedWarning(msg), stacklevel=5)
@ -74,7 +74,7 @@ def _multicall(
for argname in hook_impl.argnames:
if argname not in caller_kwargs:
raise HookCallError(
f"hook call must provide argument {argname!r}"
f'hook call must provide argument {argname!r}',
)
if hook_impl.hookwrapper:
@ -87,7 +87,7 @@ def _multicall(
next(wrapper_gen) # first yield
teardowns.append((wrapper_gen, hook_impl))
except StopIteration:
_raise_wrapfail(wrapper_gen, "did not yield")
_raise_wrapfail(wrapper_gen, 'did not yield')
elif hook_impl.wrapper:
try:
# If this cast is not valid, a type error is raised below,
@ -97,7 +97,7 @@ def _multicall(
next(function_gen) # first yield
teardowns.append(function_gen)
except StopIteration:
_raise_wrapfail(function_gen, "did not yield")
_raise_wrapfail(function_gen, 'did not yield')
else:
res = hook_impl.function(*args)
if res is not None:
@ -132,7 +132,7 @@ def _multicall(
except BaseException as e:
exception = e
continue
_raise_wrapfail(teardown, "has second yield") # type: ignore[arg-type]
_raise_wrapfail(teardown, 'has second yield') # type: ignore[arg-type]
if exception is not None:
raise exception.with_traceback(exception.__traceback__)
@ -143,7 +143,7 @@ def _multicall(
else:
if firstresult: # first result hooks return a single value
outcome: Result[object | list[object]] = Result(
results[0] if results else None, exception
results[0] if results else None, exception,
)
else:
outcome = Result(results, exception)
@ -159,7 +159,7 @@ def _multicall(
_warn_teardown_exception(hook_name, teardown[1], e)
raise
else:
_raise_wrapfail(teardown[0], "has second yield")
_raise_wrapfail(teardown[0], 'has second yield')
else:
try:
if outcome._exception is not None:
@ -176,6 +176,6 @@ def _multicall(
except BaseException as e:
outcome.force_exception(e)
continue
_raise_wrapfail(teardown, "has second yield")
_raise_wrapfail(teardown, 'has second yield')
return outcome.get_result()