Use Final for Constant Literals in the stdlib (#12332)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Max Muoto
2024-07-15 12:07:34 -05:00
committed by GitHub
parent 02b05d67c4
commit 0df6028dc8
41 changed files with 569 additions and 572 deletions

View File

@@ -3,7 +3,7 @@ import sys
from collections import deque
from collections.abc import Callable
from enum import Enum
from typing import Any, ClassVar, Literal
from typing import Any, ClassVar, Final, Literal
from typing_extensions import TypeAlias
from . import constants, events, futures, protocols, transports
@@ -29,10 +29,10 @@ if sys.version_info >= (3, 11):
def add_flowcontrol_defaults(high: int | None, low: int | None, kb: int) -> tuple[int, int]: ...
else:
_UNWRAPPED: Literal["UNWRAPPED"]
_DO_HANDSHAKE: Literal["DO_HANDSHAKE"]
_WRAPPED: Literal["WRAPPED"]
_SHUTDOWN: Literal["SHUTDOWN"]
_UNWRAPPED: Final = "UNWRAPPED"
_DO_HANDSHAKE: Final = "DO_HANDSHAKE"
_WRAPPED: Final = "WRAPPED"
_SHUTDOWN: Final = "SHUTDOWN"
if sys.version_info < (3, 11):
class _SSLPipe: