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

mypy AbstractMatchInfo has no attribute "route" #4748

Closed
Dreamsorcerer opened this issue May 16, 2020 · 1 comment · Fixed by #6135
Closed

mypy AbstractMatchInfo has no attribute "route" #4748

Dreamsorcerer opened this issue May 16, 2020 · 1 comment · Fixed by #6135
Labels

Comments

@Dreamsorcerer
Copy link
Member

When running mypy, I get the error:
error: "AbstractMatchInfo" has no attribute "route" [attr-defined]

From this code:

        match_info = await request.app.router.resolve(request_clone)
        if isinstance(match_info.route, web.ResourceRoute):

But, looking at the code, it looks to me like everything is actually returning a UrlMappingMatchInfo, which does have this attribute.

Would it make sense to just change the return to UrlMappingMatchInfo? I can't see why you would get another type returned from this function.

@asvetlov
Copy link
Member

Sorry for the late response.

Historically, I thought that AbstractMatchInfo can work with custom URL resolvers in additional to the default UrlDispatcher.
For example, sometimes a traversal-based resolver can look attractive.

The idea has failed for several reasons but the ABC class was not updated.
Please feel free to publish a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants