Browse Source

Use forward reference instead of py311+ `Self`

pull/13605/head
Matthew Batema 4 months ago
committed by Matthew Batema
parent
commit
35b5343542
  1. 5
      fastapi/datastructures.py

5
fastapi/datastructures.py

@ -5,7 +5,6 @@ from typing import (
Dict, Dict,
Iterable, Iterable,
Optional, Optional,
Self,
Type, Type,
TypeVar, TypeVar,
cast, cast,
@ -75,8 +74,8 @@ class UploadFile(StarletteUploadFile):
@classmethod @classmethod
def from_starlette( def from_starlette(
cls: type[Self], starlette_uploadfile: StarletteUploadFile cls: type["UploadFile"], starlette_uploadfile: StarletteUploadFile
) -> Self: ) -> "UploadFile":
return cls( return cls(
file=starlette_uploadfile.file, file=starlette_uploadfile.file,
size=starlette_uploadfile.size, size=starlette_uploadfile.size,

Loading…
Cancel
Save