From 35b53435424855af0b72f5d1bf6d12827d733423 Mon Sep 17 00:00:00 2001 From: Matthew Batema Date: Fri, 11 Apr 2025 10:15:50 -0700 Subject: [PATCH] Use forward reference instead of py311+ `Self` --- fastapi/datastructures.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fastapi/datastructures.py b/fastapi/datastructures.py index 47412ab1f..403b0d470 100644 --- a/fastapi/datastructures.py +++ b/fastapi/datastructures.py @@ -5,7 +5,6 @@ from typing import ( Dict, Iterable, Optional, - Self, Type, TypeVar, cast, @@ -75,8 +74,8 @@ class UploadFile(StarletteUploadFile): @classmethod def from_starlette( - cls: type[Self], starlette_uploadfile: StarletteUploadFile - ) -> Self: + cls: type["UploadFile"], starlette_uploadfile: StarletteUploadFile + ) -> "UploadFile": return cls( file=starlette_uploadfile.file, size=starlette_uploadfile.size,