forked from Pycord-Development/pycord
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
Remove AsyncIterators subclasses accross the lib to start using yield item.
What is the feature request for?
The core library
The Problem
Currently, the library has to mantain a bunch of custom AsyncIterator subclasses used for paginated endpoints, such as Messageable.pins, Guild.bans, etc.
The Ideal Solution
This should change to be typed as (typing or collections.abc).AsyncIterator[YieldType], be converted into async def functions, and simply yield the items.
This would also remove everything related to .flatten so it is better used as l = [i async for i in asynciterator].
An example from Guild.bans:
async def bans(self, params) -> AsyncIterator[Ban]:
# process stuff
for result in ...: # converted mapping of bans for example
yield resultThe Current Solution
No response
Additional Context
No response