Browse Source

ref: fix incompatible default for argument mypy errors (#66981)

<!-- Describe your PR here. -->
anthony sottile 1 year ago
parent
commit
c1f8754612

+ 1 - 0
.github/workflows/backend.yml

@@ -310,6 +310,7 @@ jobs:
           ! grep "'Settings' object has no attribute" .artifacts/mypy-all
           ! grep 'Cannot override class variable' .artifacts/mypy-all
           ! grep 'Exception type must be derived from BaseException' .artifacts/mypy-all
+          ! grep 'Incompatible default for argument' .artifacts/mypy-all
           ! grep 'Incompatible return value type (got "HttpResponseBase"' .artifacts/mypy-all
           ! grep 'Incompatible types in "yield"' .artifacts/mypy-all
           ! grep 'Module "sentry.*has no attribute' .artifacts/mypy-all

+ 1 - 1
src/sentry/api/paginator.py

@@ -773,7 +773,7 @@ class CallbackPaginator:
         self.callback = callback
         self.on_results = on_results
 
-    def get_result(self, limit: int, cursor: Cursor = None):
+    def get_result(self, limit: int, cursor: Cursor | None = None):
         if cursor is None:
             cursor = Cursor(0, 0, 0)
 

+ 1 - 1
src/sentry/incidents/logic.py

@@ -666,7 +666,7 @@ def update_alert_rule(
     user=None,
     event_types=None,
     comparison_delta=NOT_SET,
-    monitor_type: AlertRuleMonitorType = None,
+    monitor_type: AlertRuleMonitorType | None = None,
     **kwargs,
 ):
     """

+ 1 - 1
src/sentry/testutils/cases.py

@@ -2069,7 +2069,7 @@ class MetricsEnhancedPerformanceTestCase(BaseMetricsLayerTestCase, TestCase):
         self.login_as(user=self.user)
         self._index_metric_strings()
 
-    def do_request(self, data: dict[str, Any], features: dict[str, bool] = None) -> Response:
+    def do_request(self, data: dict[str, Any], features: dict[str, bool] | None = None) -> Response:
         """Set up self.features and self.url in the inheriting classes.
         You can pass your own features if you do not want to use the default used by the subclass.
         """

+ 1 - 1
src/sentry/testutils/factories.py

@@ -418,7 +418,7 @@ class Factories:
 
     @staticmethod
     @assume_test_silo_mode(SiloMode.CONTROL)
-    def create_user_auth_token(user, scope_list: list[str] = None, **kwargs) -> ApiToken:
+    def create_user_auth_token(user, scope_list: list[str] | None = None, **kwargs) -> ApiToken:
         if scope_list is None:
             scope_list = []
         return ApiToken.objects.create(

+ 1 - 1
src/sentry/testutils/fixtures.py

@@ -205,7 +205,7 @@ class Fixtures:
             project = self.project
         return Factories.create_release(project=project, user=user, *args, **kwargs)
 
-    def create_group_release(self, project: Project = None, *args, **kwargs) -> GroupRelease:
+    def create_group_release(self, project: Project | None = None, *args, **kwargs) -> GroupRelease:
         if project is None:
             project = self.project
         return Factories.create_group_release(project, *args, **kwargs)