From a379ccf5f491cb35a5c84b50fccfb27d88f8eefa Mon Sep 17 00:00:00 2001 From: David Brochart Date: Mon, 18 Nov 2024 10:55:46 +0100 Subject: [PATCH] Use HasFileno from typeshed --- src/anyio/_backends/_selector_thread.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/anyio/_backends/_selector_thread.py b/src/anyio/_backends/_selector_thread.py index cfa39ca4..1aff007e 100644 --- a/src/anyio/_backends/_selector_thread.py +++ b/src/anyio/_backends/_selector_thread.py @@ -14,6 +14,7 @@ import threading import typing from typing import ( + TYPE_CHECKING, Any, Callable, Union, @@ -22,14 +23,10 @@ from ._asyncio import find_root_task -if typing.TYPE_CHECKING: - from typing_extensions import Protocol +if TYPE_CHECKING: + from _typeshed import HasFileno - class _HasFileno(Protocol): - def fileno(self) -> int: - pass - - _FileDescriptorLike = Union[int, _HasFileno] + _FileDescriptorLike = HasFileno | int # registry of asyncio loop : selector thread