Skip to content

Commit e3fd384

Browse files
pre-commit-ci[bot]CoolCat467mikenerone
authored
[pre-commit.ci] pre-commit autoupdate ruff-pre-commit: v0.3.0 → v0.3.2
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.3.0 → v0.3.2](astral-sh/ruff-pre-commit@v0.3.0...v0.3.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks * [pre-commit.ci] auto fixes from pre-commit.com hooks * Remove unneeded extra lines Co-authored-by: Mike Nerone <[email protected]> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: CoolCat467 <[email protected]> Co-authored-by: Mike Nerone <[email protected]>
1 parent f890f8f commit e3fd384

File tree

8 files changed

+10
-26
lines changed

8 files changed

+10
-26
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
hooks:
2424
- id: black
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.3.0
26+
rev: v0.3.2
2727
hooks:
2828
- id: ruff
2929
types: [file]

src/trio/_channel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ def statistics(self) -> MemoryChannelStats:
299299
return self._state.statistics()
300300

301301
def __repr__(self) -> str:
302-
return "<receive channel at {:#x}, using buffer at {:#x}>".format(
303-
id(self), id(self._state)
302+
return (
303+
f"<receive channel at {id(self):#x}, using buffer at {id(self._state):#x}>"
304304
)
305305

306306
@enable_ki_protection

src/trio/_core/_mock_clock.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def __init__(self, rate: float = 0.0, autojump_threshold: float = inf):
7979
self.autojump_threshold = autojump_threshold
8080

8181
def __repr__(self) -> str:
82-
return "<MockClock, time={:.7f}, rate={} @ {:#x}>".format(
83-
self.current_time(), self._rate, id(self)
84-
)
82+
return f"<MockClock, time={self.current_time():.7f}, rate={self._rate} @ {id(self):#x}>"
8583

8684
@property
8785
def rate(self) -> float:

src/trio/_core/_run.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -585,13 +585,8 @@ def _close(self, exc: BaseException | None) -> BaseException | None:
585585
# we just need to make sure we don't let the error
586586
# pass silently.
587587
new_exc = RuntimeError(
588-
"Cancel scope stack corrupted: attempted to exit {!r} "
589-
"in {!r} that's still within its child {!r}\n{}".format(
590-
self,
591-
scope_task,
592-
scope_task._cancel_status._scope,
593-
MISNESTING_ADVICE,
594-
)
588+
f"Cancel scope stack corrupted: attempted to exit {self!r} "
589+
f"in {scope_task!r} that's still within its child {scope_task._cancel_status._scope!r}\n{MISNESTING_ADVICE}"
595590
)
596591
new_exc.__context__ = exc
597592
exc = new_exc

src/trio/_deprecate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ def wrapper(*args: ArgsT.args, **kwargs: ArgsT.kwargs) -> RetT:
9797
if instead is not None:
9898
doc += f" Use {_stringify(instead)} instead.\n"
9999
if issue is not None:
100-
doc += " For details, see `issue #{} <{}>`__.\n".format(
101-
issue, _url_for_issue(issue)
102-
)
100+
doc += f" For details, see `issue #{issue} <{_url_for_issue(issue)}>`__.\n"
103101
doc += "\n"
104102
wrapper.__doc__ = doc
105103

src/trio/_sync.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ def __init__(self, total_tokens: int | float): # noqa: PYI041
223223
assert self._total_tokens == total_tokens
224224

225225
def __repr__(self) -> str:
226-
return "<trio.CapacityLimiter at {:#x}, {}/{} with {} waiting>".format(
227-
id(self), len(self._borrowers), self._total_tokens, len(self._lot)
228-
)
226+
return f"<trio.CapacityLimiter at {id(self):#x}, {len(self._borrowers)}/{self._total_tokens} with {len(self._lot)} waiting>"
229227

230228
@property
231229
def total_tokens(self) -> int | float:

src/trio/_threads.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,7 @@ def abort(raise_cancel: RaiseCancelT) -> trio.lowlevel.Abort:
475475
msg_from_thread.run_sync()
476476
else: # pragma: no cover, internal debugging guard TODO: use assert_never
477477
raise TypeError(
478-
"trio.to_thread.run_sync received unrecognized thread message {!r}."
479-
"".format(msg_from_thread)
478+
f"trio.to_thread.run_sync received unrecognized thread message {msg_from_thread!r}."
480479
)
481480
del msg_from_thread
482481

src/trio/_util.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,7 @@ def decorator(func: CallT) -> CallT:
247247
func.__name__ = attr_name
248248
func.__qualname__ = ".".join((cls.__qualname__, attr_name))
249249

250-
func.__doc__ = """Like :meth:`~{}.{}.{}`, but async.
251-
252-
""".format(
253-
wrapped_cls.__module__, wrapped_cls.__qualname__, attr_name
254-
)
250+
func.__doc__ = f"Like :meth:`~{wrapped_cls.__module__}.{wrapped_cls.__qualname__}.{attr_name}`, but async."
255251

256252
return func
257253

0 commit comments

Comments
 (0)