Skip to content

Commit

Permalink
run pyupgrade --py38-plus
Browse files Browse the repository at this point in the history
  • Loading branch information
jakkdl committed Jun 26, 2023
1 parent d759537 commit 9083fa8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions trio/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _open_memory_channel(
if TYPE_CHECKING:
# written as a class so you can say open_memory_channel[int](5)
# Need to use Tuple instead of tuple due to CI check running on 3.8
class open_memory_channel(Tuple[MemorySendChannel[T], MemoryReceiveChannel[T]]):
class open_memory_channel(tuple[MemorySendChannel[T], MemoryReceiveChannel[T]]):
def __new__( # type: ignore[misc] # "must return a subtype"
cls, max_buffer_size: int
) -> tuple[MemorySendChannel[T], MemoryReceiveChannel[T]]:
Expand Down Expand Up @@ -218,7 +218,7 @@ def abort_fn(_: RaiseCancelT) -> Abort:

# Return type must be stringified or use a TypeVar
@enable_ki_protection
def clone(self) -> "MemorySendChannel[SendType]":
def clone(self) -> MemorySendChannel[SendType]:
"""Clone this send channel object.
This returns a new `MemorySendChannel` object, which acts as a
Expand Down Expand Up @@ -361,7 +361,7 @@ def abort_fn(_: RaiseCancelT) -> Abort:
return await trio.lowlevel.wait_task_rescheduled(abort_fn) # type: ignore[no-any-return]

@enable_ki_protection
def clone(self) -> "MemoryReceiveChannel[ReceiveType]":
def clone(self) -> MemoryReceiveChannel[ReceiveType]:
"""Clone this receive channel object.
This returns a new `MemoryReceiveChannel` object, which acts as a
Expand Down
4 changes: 2 additions & 2 deletions trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

if TYPE_CHECKING:
# An unfortunate name collision here with trio._util.Final
from typing_extensions import Final as FinalT
from typing import Final as FinalT

DEADLINE_HEAP_MIN_PRUNE_THRESHOLD: FinalT = 1000

Expand Down Expand Up @@ -1312,7 +1312,7 @@ def raise_cancel():


class RunContext(threading.local):
runner: "Runner"
runner: Runner
task: Task


Expand Down
2 changes: 1 addition & 1 deletion trio/_tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def no_hidden(symbols):
cache_json = json.loads(cache_file.read())

# skip a bunch of file-system activity (probably can un-memoize?)
@functools.lru_cache()
@functools.lru_cache
def lookup_symbol(symbol):
topname, *modname, name = symbol.split(".")
version = next(cache.glob("3.*/"))
Expand Down
2 changes: 1 addition & 1 deletion trio/_unix_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import trio

if TYPE_CHECKING:
from typing_extensions import Final as FinalType
from typing import Final as FinalType

if os.name != "posix":
# We raise an error here rather than gating the import in lowlevel.py
Expand Down

0 comments on commit 9083fa8

Please sign in to comment.