Add 3.13 to our CI (#11926)

This commit is contained in:
Alex Waygood
2024-05-19 16:18:49 -04:00
committed by GitHub
parent 347f8a96b5
commit b8d144d491
8 changed files with 48 additions and 15 deletions

View File

@@ -1,9 +1,14 @@
import sys
from _typeshed import SupportsItems, SupportsKeysAndGetItem
from _typeshed.wsgi import WSGIEnvironment
from cgi import FieldStorage
from collections.abc import Collection, Iterable, Iterator, MutableMapping
from typing import Any, Literal, TypeVar, overload
from typing_extensions import Self
from typing_extensions import Self, TypeAlias
if sys.version_info >= (3, 13):
_FieldStorage: TypeAlias = Any
else:
from cgi import FieldStorage as _FieldStorage
_T = TypeVar("_T")
_KT = TypeVar("_KT")
@@ -19,7 +24,7 @@ class MultiDict(MutableMapping[_KT, _VT]):
@classmethod
def view_list(cls, lst: list[tuple[_KT, _VT]]) -> MultiDict[_KT, _VT]: ...
@classmethod
def from_fieldstorage(cls, fs: FieldStorage) -> MultiDict[str, str | FieldStorage]: ...
def from_fieldstorage(cls, fs: _FieldStorage) -> MultiDict[str, str | _FieldStorage]: ...
def __getitem__(self, key: _KT) -> _VT: ...
def __setitem__(self, key: _KT, value: _VT) -> None: ...
def add(self, key: _KT, value: _VT) -> None: ...

View File

@@ -1,8 +1,8 @@
import datetime
import io
import sys
from _typeshed import ExcInfo, ReadableBuffer, SupportsItems, SupportsKeysAndGetItem, SupportsNoArgReadline, SupportsRead
from _typeshed.wsgi import WSGIApplication, WSGIEnvironment
from cgi import FieldStorage
from collections.abc import Iterable, Mapping
from re import Pattern
from tempfile import _TemporaryFileWrapper
@@ -19,6 +19,11 @@ from webob.headers import EnvironHeaders
from webob.multidict import GetDict, MultiDict, NestedMultiDict, NoVars
from webob.response import Response, _HTTPHeader
if sys.version_info >= (3, 13):
_FieldStorage: TypeAlias = Any
else:
from cgi import FieldStorage as _FieldStorage
_T = TypeVar("_T")
_HTTPMethod: TypeAlias = Literal["GET", "HEAD", "POST", "PUT", "DELETE", "PATCH"]
_ListOrTuple: TypeAlias = list[_T] | tuple[_T, ...]
@@ -34,7 +39,9 @@ class _RequestCacheControlDict(TypedDict, total=False):
no_transform: bool
max_age: int
class _FieldStorageWithFile(FieldStorage):
# On py313 this subclasses `Any`, hence the type: ignore.
# This is needed for the regr_test.py script, which uses --disallow-subclassing-any
class _FieldStorageWithFile(_FieldStorage): # type: ignore[misc]
file: IO[bytes]
filename: str
@@ -244,4 +251,4 @@ class Transcoder:
errors: str
def __init__(self, charset: str, errors: str = "strict") -> None: ...
def transcode_query(self, q: str) -> str: ...
def transcode_fs(self, fs: FieldStorage, content_type: str) -> io.BytesIO: ...
def transcode_fs(self, fs: _FieldStorage, content_type: str) -> io.BytesIO: ...