Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate ruff-pre-commit: v0.3.0 → v0.3.2
Browse files Browse the repository at this point in the history
* [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 <mike@nerone.org>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: CoolCat467 <52022020+CoolCat467@users.noreply.github.com>
Co-authored-by: Mike Nerone <mike@nerone.org>
  • Loading branch information
3 people committed Mar 16, 2024
1 parent f890f8f commit e3fd384
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
rev: v0.3.2
hooks:
- id: ruff
types: [file]
Expand Down
4 changes: 2 additions & 2 deletions src/trio/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ def statistics(self) -> MemoryChannelStats:
return self._state.statistics()

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

@enable_ki_protection
Expand Down
4 changes: 1 addition & 3 deletions src/trio/_core/_mock_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ def __init__(self, rate: float = 0.0, autojump_threshold: float = inf):
self.autojump_threshold = autojump_threshold

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

@property
def rate(self) -> float:
Expand Down
9 changes: 2 additions & 7 deletions src/trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,8 @@ def _close(self, exc: BaseException | None) -> BaseException | None:
# we just need to make sure we don't let the error
# pass silently.
new_exc = RuntimeError(
"Cancel scope stack corrupted: attempted to exit {!r} "
"in {!r} that's still within its child {!r}\n{}".format(
self,
scope_task,
scope_task._cancel_status._scope,
MISNESTING_ADVICE,
)
f"Cancel scope stack corrupted: attempted to exit {self!r} "
f"in {scope_task!r} that's still within its child {scope_task._cancel_status._scope!r}\n{MISNESTING_ADVICE}"
)
new_exc.__context__ = exc
exc = new_exc
Expand Down
4 changes: 1 addition & 3 deletions src/trio/_deprecate.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ def wrapper(*args: ArgsT.args, **kwargs: ArgsT.kwargs) -> RetT:
if instead is not None:
doc += f" Use {_stringify(instead)} instead.\n"
if issue is not None:
doc += " For details, see `issue #{} <{}>`__.\n".format(
issue, _url_for_issue(issue)
)
doc += f" For details, see `issue #{issue} <{_url_for_issue(issue)}>`__.\n"
doc += "\n"
wrapper.__doc__ = doc

Expand Down
4 changes: 1 addition & 3 deletions src/trio/_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ def __init__(self, total_tokens: int | float): # noqa: PYI041
assert self._total_tokens == total_tokens

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

@property
def total_tokens(self) -> int | float:
Expand Down
3 changes: 1 addition & 2 deletions src/trio/_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,7 @@ def abort(raise_cancel: RaiseCancelT) -> trio.lowlevel.Abort:
msg_from_thread.run_sync()
else: # pragma: no cover, internal debugging guard TODO: use assert_never
raise TypeError(
"trio.to_thread.run_sync received unrecognized thread message {!r}."
"".format(msg_from_thread)
f"trio.to_thread.run_sync received unrecognized thread message {msg_from_thread!r}."
)
del msg_from_thread

Expand Down
6 changes: 1 addition & 5 deletions src/trio/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,7 @@ def decorator(func: CallT) -> CallT:
func.__name__ = attr_name
func.__qualname__ = ".".join((cls.__qualname__, attr_name))

func.__doc__ = """Like :meth:`~{}.{}.{}`, but async.
""".format(
wrapped_cls.__module__, wrapped_cls.__qualname__, attr_name
)
func.__doc__ = f"Like :meth:`~{wrapped_cls.__module__}.{wrapped_cls.__qualname__}.{attr_name}`, but async."

return func

Expand Down

0 comments on commit e3fd384

Please sign in to comment.