Skip to content

Commit 06c3a49

Browse files
ref: improve annotations for Outbox Managers (#73602)
<!-- Describe your PR here. -->
1 parent 77919bc commit 06c3a49

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/sentry/models/apitoken.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ class ApiToken(ReplicatedControlModel, HasApiScopes):
119119
expires_at = models.DateTimeField(null=True, default=default_expiration)
120120
date_added = models.DateTimeField(default=timezone.now)
121121

122-
objects: ClassVar[ControlOutboxProducingManager[ApiToken]] = ApiTokenManager(
123-
cache_fields=("token",)
124-
)
122+
objects: ClassVar[ApiTokenManager] = ApiTokenManager(cache_fields=("token",))
125123

126124
class Meta:
127125
app_label = "sentry"

src/sentry/models/integrations/organization_integration.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import Mapping
4-
from typing import Any, ClassVar
4+
from typing import Any, ClassVar, Self
55

66
from django.db import models
77
from django.utils import timezone
@@ -37,9 +37,7 @@ class OrganizationIntegration(ReplicatedControlModel):
3737
# After the grace period, we will mark the status as disabled.
3838
grace_period_end = models.DateTimeField(null=True, blank=True, db_index=True)
3939

40-
objects: ClassVar[
41-
ControlOutboxProducingManager[OrganizationIntegration]
42-
] = ControlOutboxProducingManager()
40+
objects: ClassVar[ControlOutboxProducingManager[Self]] = ControlOutboxProducingManager()
4341

4442
class Meta:
4543
app_label = "sentry"

src/sentry/models/organizationmemberteam.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import Mapping, MutableMapping
4-
from typing import Any, ClassVar
4+
from typing import Any, ClassVar, Self
55

66
from django.db import models
77

@@ -20,9 +20,7 @@ class OrganizationMemberTeam(ReplicatedRegionModel):
2020
Identifies relationships between organization members and the teams they are on.
2121
"""
2222

23-
objects: ClassVar[
24-
RegionOutboxProducingManager[OrganizationMemberTeam]
25-
] = RegionOutboxProducingManager()
23+
objects: ClassVar[RegionOutboxProducingManager[Self]] = RegionOutboxProducingManager()
2624

2725
__relocation_scope__ = RelocationScope.Organization
2826
category = OutboxCategory.ORGANIZATION_MEMBER_TEAM_UPDATE

0 commit comments

Comments
 (0)