Browse Source

ref: rename some modules to avoid no-redef mypy warning (#51855)

it's not clear to me why -- there are other modules like this in the
codebase. I suspect some weird import cycle thing due to `__init__.py`
causes mypy's analysis to give up

even weirder is there were 4 distinct errors that mentioned modules like
this -- but I only needed to fix two of them to make the errors go away?
strange.
anthony sottile 1 year ago
parent
commit
fadca686dd

+ 1 - 3
pyproject.toml

@@ -764,7 +764,6 @@ module = [
     "sentry.pipeline.base",
     "sentry.pipeline.views.base",
     "sentry.pipeline.views.nested",
-    "sentry.plugins.base.bindings",
     "sentry.plugins.base.notifier",
     "sentry.plugins.base.urls",
     "sentry.plugins.bases.data_forwarding",
@@ -931,7 +930,7 @@ module = [
     "sentry.tasks.integrations.migrate_repo",
     "sentry.tasks.integrations.slack.find_channel_id_for_rule",
     "sentry.tasks.integrations.slack.link_slack_user_identities",
-    "sentry.tasks.integrations.sync_assignee_outbound",
+    "sentry.tasks.integrations.sync_assignee_outbound_impl",
     "sentry.tasks.integrations.sync_status_inbound",
     "sentry.tasks.integrations.sync_status_outbound",
     "sentry.tasks.integrations.update_comment",
@@ -1557,7 +1556,6 @@ disable_error_code = [
     "list-item",
     "method-assign",
     "misc",
-    "no-redef",
     "operator",
     "override",
     "return",

+ 1 - 1
src/sentry/plugins/base/__init__.py

@@ -1,4 +1,4 @@
-from .bindings import BindingManager
+from .binding_manager import BindingManager
 from .manager import PluginManager
 from .notifier import *  # NOQA
 from .response import *  # NOQA

+ 5 - 1
src/sentry/plugins/base/bindings.py → src/sentry/plugins/base/binding_manager.py

@@ -1,8 +1,12 @@
+from __future__ import annotations
+
+from typing import Any, Type
+
 from sentry.plugins.providers import IntegrationRepositoryProvider, RepositoryProvider
 
 
 class ProviderManager:
-    type = None
+    type: Type[Any] | None = None
 
     def __init__(self):
         self._items = {}

+ 14 - 15
src/sentry/tasks/integrations/__init__.py

@@ -33,27 +33,26 @@ __all__ = (
     "vsts_subscription_check",
 )
 
-_tasks_list = (
-    "create_comment",
-    "github.pr_comment",
-    "kick_off_status_syncs",
-    "migrate_issues",
-    "migrate_repo",
-    "sync_assignee_outbound",
-    "sync_metadata",
-    "sync_status_inbound",
-    "sync_status_outbound",
-    "update_comment",
-    "vsts.kickoff_subscription_check",
-    "vsts.subscription_check",
+settings.CELERY_IMPORTS += (
+    "sentry.tasks.integrations.create_comment",
+    "sentry.tasks.integrations.github.pr_comment",
+    "sentry.tasks.integrations.kick_off_status_syncs",
+    "sentry.tasks.integrations.migrate_issues",
+    "sentry.tasks.integrations.migrate_repo",
+    "sentry.tasks.integrations.sync_assignee_outbound_impl",
+    "sentry.tasks.integrations.sync_metadata",
+    "sentry.tasks.integrations.sync_status_inbound",
+    "sentry.tasks.integrations.sync_status_outbound",
+    "sentry.tasks.integrations.update_comment",
+    "sentry.tasks.integrations.vsts.kickoff_subscription_check",
+    "sentry.tasks.integrations.vsts.subscription_check",
 )
-settings.CELERY_IMPORTS += tuple(f"sentry.tasks.integrations.{task}" for task in _tasks_list)
 
 from .create_comment import create_comment
 from .kick_off_status_syncs import kick_off_status_syncs
 from .migrate_issues import migrate_issues
 from .migrate_repo import migrate_repo
-from .sync_assignee_outbound import sync_assignee_outbound
+from .sync_assignee_outbound_impl import sync_assignee_outbound
 from .sync_metadata import sync_metadata
 from .sync_status_inbound import sync_status_inbound
 from .sync_status_outbound import sync_status_outbound

+ 0 - 0
src/sentry/tasks/integrations/sync_assignee_outbound.py → src/sentry/tasks/integrations/sync_assignee_outbound_impl.py