Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix handler argument annotations #3655

Closed
wants to merge 1 commit into from

Conversation

Hanaasagi
Copy link
Member

This pull request wants to make handler annotation correct.

When using Mypy to check following code,

from aiohttp import web


class MyView(web.View):
    async def get(self):
        return web.Response(text="Hello world")


app = web.Application()
app.add_routes([web.view('/', MyView)])  # line 10
web.run_app(app)

It will report

t.py:10: error: Argument 2 to "view" has incompatible type "Type[MyView]"; expected "AbstractView"                                                                                           

web.view accepts subclass of AbstractView type variable as handler, instead of an instance.

resolve #3653

@Hanaasagi Hanaasagi requested a review from asvetlov as a code owner March 18, 2019 13:14
@Hanaasagi
Copy link
Member Author

It seems like a small change, I will add changelog if you really need.

@kornicameister
Copy link
Contributor

@Hanaasagi check out #3633 . Seems you've duplicated my work ;-)

@Hanaasagi
Copy link
Member Author

Oh, I'm Sorry for this.

@Hanaasagi Hanaasagi closed this Mar 20, 2019
@kornicameister
Copy link
Contributor

@Hanaasagi no biggie ;-).

@lock lock bot added the outdated label Mar 21, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

web.view should accept Type[AbstractView] as handler instead of AbstractView
3 participants