@@ -274,32 +274,6 @@ def __init__(self, service_name: Optional[str] = None):
274274 def dispatch (cls , * args : Any , ** kwargs : Any ) -> Any : # type: ignore[misc]
275275 return cls ()._dispatch (* args , ** kwargs )
276276
277- @classmethod
278- def method_dispatch ( # type: ignore[misc]
279- cls , to_call : Callable [[ResponseShape , Any , str , Any ], TYPE_RESPONSE ]
280- ) -> Callable [[Any , str , Any ], TYPE_RESPONSE ]:
281- """
282- Takes a given unbound function (part of a Response class) and executes it for a new instance of this
283- response class.
284- Can be used wherever we want to specify different methods for dispatching in urls.py
285- :param to_call: Unbound method residing in this Response class
286- :return: A wrapper executing the given method on a new instance of this class
287- """
288-
289- @functools .wraps (to_call ) # type: ignore
290- def _inner (request : Any , full_url : str , headers : Any ) -> TYPE_RESPONSE : # type: ignore[misc]
291- response = getattr (cls (), to_call .__name__ )(request , full_url , headers )
292- if isinstance (response , str ):
293- status = 200
294- body = response
295- headers = {}
296- else :
297- status , headers , body = response
298- headers , body = cls ._enrich_response (headers , body )
299- return status , headers , body
300-
301- return _inner
302-
303277 def setup_class (
304278 self , request : Any , full_url : str , headers : Any , use_raw_body : bool = False
305279 ) -> None :
0 commit comments