Repository: aio-libs/aiohttp

Issue:
web.view should accept Type[AbstractView] as handler instead of AbstractView
## Long story short

according to [aiohttp's documents](https://docs.aiohttp.org/en/stable/web_quickstart.html#class-based-views), `web.view(path, handler)` hanlder should be a `class` inherit from `web.View`

https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_routedef.py#L123 
```python
def view(path: str, handler: AbstractView, **kwargs: Any) -> RouteDef:
    return route(hdrs.METH_ANY, path, handler, **kwargs)
```
but type annotation means that `handler` should be a instance of `AbstractView` instead of a class.

## Expected behaviour

`web.view`'s handler annotation should be `Type[AbstractView]`

## Actual behaviour

`web.view`'s handler annotation should be `AbstractView`

## Steps to reproduce

no

## Your environment

server: aiohttp==3.5.4



Discussion:

Resolving patch:
diff --git a/aiohttp/web_routedef.py b/aiohttp/web_routedef.py
--- a/aiohttp/web_routedef.py
+++ b/aiohttp/web_routedef.py
@@ -10,6 +10,7 @@
     List,
     Optional,
     Sequence,
+    Type,
     Union,
     overload,
 )
@@ -40,7 +41,7 @@ def register(self, router: UrlDispatcher) -> None:
 
 
 _SimpleHandler = Callable[[Request], Awaitable[StreamResponse]]
-_HandlerType = Union[AbstractView, _SimpleHandler]
+_HandlerType = Union[Type[AbstractView], _SimpleHandler]
 
 
 @attr.s(frozen=True, repr=False, slots=True)
@@ -120,7 +121,7 @@ def delete(path: str, handler: _HandlerType, **kwargs: Any) -> RouteDef:
     return route(hdrs.METH_DELETE, path, handler, **kwargs)
 
 
-def view(path: str, handler: AbstractView, **kwargs: Any) -> RouteDef:
+def view(path: str, handler: Type[AbstractView], **kwargs: Any) -> RouteDef:
     return route(hdrs.METH_ANY, path, handler, **kwargs)
 
 
diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py
--- a/aiohttp/web_urldispatcher.py
+++ b/aiohttp/web_urldispatcher.py
@@ -27,6 +27,7 @@
     Set,
     Sized,
     Tuple,
+    Type,
     Union,
     cast,
 )
@@ -123,7 +124,7 @@ def raw_match(self, path: str) -> bool:
 class AbstractRoute(abc.ABC):
 
     def __init__(self, method: str,
-                 handler: Union[_WebHandler, AbstractView], *,
+                 handler: Union[_WebHandler, Type[AbstractView]], *,
                  expect_handler: _ExpectHandler=None,
                  resource: AbstractResource=None) -> None:
 
@@ -296,7 +297,7 @@ def __init__(self, *, name: Optional[str]=None) -> None:
         self._routes = []  # type: List[ResourceRoute]
 
     def add_route(self, method: str,
-                  handler: Union[AbstractView, _WebHandler], *,
+                  handler: Union[Type[AbstractView], _WebHandler], *,
                   expect_handler: Optional[_ExpectHandler]=None
                   ) -> 'ResourceRoute':
 
@@ -825,7 +826,7 @@ class ResourceRoute(AbstractRoute):
     """A route with resource"""
 
     def __init__(self, method: str,
-                 handler: Union[_WebHandler, AbstractView],
+                 handler: Union[_WebHandler, Type[AbstractView]],
                  resource: AbstractResource, *,
                  expect_handler: Optional[_ExpectHandler]=None) -> None:
         super().__init__(method, handler, expect_handler=expect_handler,
@@ -1025,7 +1026,7 @@ def add_resource(self, path: str, *,
         return resource
 
     def add_route(self, method: str, path: str,
-                  handler: Union[_WebHandler, AbstractView],
+                  handler: Union[_WebHandler, Type[AbstractView]],
                   *, name: Optional[str]=None,
                   expect_handler: Optional[_ExpectHandler]=None
                   ) -> AbstractRoute:
@@ -1112,7 +1113,7 @@ def add_delete(self, path: str, handler: _WebHandler,
         """
         return self.add_route(hdrs.METH_DELETE, path, handler, **kwargs)
 
-    def add_view(self, path: str, handler: AbstractView,
+    def add_view(self, path: str, handler: Type[AbstractView],
                  **kwargs: Any) -> AbstractRoute:
         """
         Shortcut for add_route with ANY methods for a class-based view


Test patch: