backends: Fix a type: ignore issue.

I checked that this does not interfere with the MRO of the auth
backends:

In [1]: import zproject.backends; zproject.backends.GitHubAuthBackend.__mro__
Out[1]:
(zproject.backends.GitHubAuthBackend,
 zproject.backends.SocialAuthMixin,
 zproject.backends.ZulipAuthMixin,
 zproject.backends.ExternalAuthMethod,
 abc.ABC,
 social_core.backends.github.GithubOAuth2,
 social_core.backends.oauth.BaseOAuth2,
 social_core.backends.oauth.OAuthAuth,
 social_core.backends.base.BaseAuth,
 object)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-06-23 13:36:55 -07:00
parent 8667e632c8
commit 229e08c1d9
1 changed files with 2 additions and 2 deletions

View File

@ -1364,7 +1364,7 @@ def social_auth_finish(backend: Any,
# then call login_or_register_remote_user. # then call login_or_register_remote_user.
return redirect_and_log_into_subdomain(result) return redirect_and_log_into_subdomain(result)
class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod): class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod, BaseAuth):
# Whether we expect that the full_name value obtained by the # Whether we expect that the full_name value obtained by the
# social backend is definitely how the user should be referred to # social backend is definitely how the user should be referred to
# in Zulip, which in turn determines whether we should always show # in Zulip, which in turn determines whether we should always show
@ -1388,7 +1388,7 @@ class SocialAuthMixin(ZulipAuthMixin, ExternalAuthMethod):
""" """
try: try:
# Call the auth_complete method of social_core.backends.oauth.BaseOAuth2 # Call the auth_complete method of social_core.backends.oauth.BaseOAuth2
return super().auth_complete(*args, **kwargs) # type: ignore[misc] # monkey-patching return super().auth_complete(*args, **kwargs)
except (AuthFailed, HTTPError) as e: except (AuthFailed, HTTPError) as e:
# When a user's social authentication fails (e.g. because # When a user's social authentication fails (e.g. because
# they did something funny with reloading in the middle of # they did something funny with reloading in the middle of