Skip to content

Commit

Permalink
fix: circular import from Entitlement
Browse files Browse the repository at this point in the history
  • Loading branch information
plun1331 committed Aug 28, 2024
1 parent 2227382 commit 32ebc62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions discord/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

from .audit_logs import AuditLogEntry
from .errors import NoMoreItems
from .monetization import Entitlement
from .object import Object
from .utils import maybe_coroutine, snowflake_time, time_snowflake

Expand Down Expand Up @@ -1012,6 +1011,11 @@ def _get_retrieve(self):
self.retrieve = r
return r > 0

async def create_entitlement(self, data):
from .monetization import Entitlement

return Entitlement(data=data, state=self.state)

async def fill_entitlements(self):
if not self._get_retrieve():
return
Expand Down Expand Up @@ -1042,7 +1046,7 @@ async def fill_entitlements(self):
self.after = Object(id=int(data[-1]["id"]))

for element in reversed(data):
await self.entitlements.put(Entitlement(data=element, state=self.state))
await self.entitlements.put(self.create_entitlement(element))


class SubscriptionIterator(_AsyncIterator["Subscription"]):
Expand Down

0 comments on commit 32ebc62

Please sign in to comment.