Browse Source

ref: type src/sentry/auth/view.py (#41505)

<!-- Describe your PR here. -->
anthony sottile 2 years ago
parent
commit
7c1cdbb3e3
2 changed files with 17 additions and 7 deletions
  1. 1 0
      mypy.ini
  2. 16 7
      src/sentry/auth/view.py

+ 1 - 0
mypy.ini

@@ -38,6 +38,7 @@ files = fixtures/mypy-stubs,
         src/sentry/auth/access.py,
         src/sentry/auth/helper.py,
         src/sentry/auth/provider.py,
+        src/sentry/auth/view.py,
         src/sentry/constants.py,
         src/sentry/db/models/base.py,
         src/sentry/db/models/fields/bounded.py,

+ 16 - 7
src/sentry/auth/view.py

@@ -1,12 +1,18 @@
-__all__ = ["AuthView", "ConfigureView"]
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
 
 from rest_framework.request import Request
 
 from sentry.plugins.base.view import PluggableViewMixin
 from sentry.web.frontend.base import BaseView
 
+if TYPE_CHECKING:
+    from sentry.models.authprovider import AuthProvider
+    from sentry.models.organization import Organization
 
-class AuthView(BaseView):
+
+class AuthView(BaseView):  # type: ignore[misc]
     """
     A segment of Provider's auth pipeline.
 
@@ -16,13 +22,16 @@ class AuthView(BaseView):
     auth_required = False
     sudo_required = False
 
-    def get_ident(self):
+    def get_ident(self) -> str:
         cls = type(self)
         return f"{cls.__module__}.{cls.__name__}"
 
 
-class ConfigureView(BaseView, PluggableViewMixin):
-    """ """
-
-    def dispatch(self, request: Request, organization, auth_provider):
+class ConfigureView(BaseView, PluggableViewMixin):  # type: ignore[misc]
+    def dispatch(
+        self, request: Request, organization: Organization, auth_provider: AuthProvider
+    ) -> str:
         return ""
+
+
+__all__ = ["AuthView", "ConfigureView"]