]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Type-hint stream_request_body so that the type of stream_request_body(cls) is the... 3014/head
authorAlexander Maryanovsky <msasha@gmail.com>
Mon, 12 Apr 2021 16:37:02 +0000 (19:37 +0300)
committerAlexander Maryanovsky <msasha@gmail.com>
Sun, 4 Jul 2021 11:55:32 +0000 (14:55 +0300)
tornado/web.py

index ddf1de746e0329ec6ff0f4951d51fa4e8ac41853..06e37c281cffe941d0f464759c35dbb957e73974 100644 (file)
@@ -118,6 +118,7 @@ from typing import (
     Iterable,
     Generator,
     Type,
+    TypeVar,
     cast,
     overload,
 )
@@ -1818,7 +1819,10 @@ class RequestHandler(object):
             self.clear_header(h)
 
 
-def stream_request_body(cls: Type[RequestHandler]) -> Type[RequestHandler]:
+RequestHandlerType = TypeVar("RequestHandlerType", bound=RequestHandler)
+
+
+def stream_request_body(cls: Type[RequestHandlerType]) -> Type[RequestHandlerType]:
     """Apply to `RequestHandler` subclasses to enable streaming body support.
 
     This decorator implies the following changes: