mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-19 16:22:10 +00:00
Dodana procedura asynchronicznej generacji iteratora oraz komentarz w
jaki sposob inaczej przerobic fora na asynchroniczny. Przydatne ze wzgledu na to ze szukajka nadal blokuje heartbeat bota - co skutkuje warningnami i wyjatkami
This commit is contained in:
@@ -580,6 +580,21 @@ async def get_file(ctx, source, link):
|
|||||||
logger.error("Wrong link provided youtube: {}".format(link))
|
logger.error("Wrong link provided youtube: {}".format(link))
|
||||||
return "", None
|
return "", None
|
||||||
|
|
||||||
|
# define an asynchronous generator
|
||||||
|
async def async_iterator_generator(range):
|
||||||
|
# normal loop
|
||||||
|
for i in range:
|
||||||
|
# yield the result
|
||||||
|
yield i
|
||||||
|
|
||||||
|
''' Alternatywna wersja przerobienia fora na asynchroniczny
|
||||||
|
# traverse the iterable of awaitables
|
||||||
|
for item in coros:
|
||||||
|
# await and get the result from the awaitable
|
||||||
|
result = await item
|
||||||
|
# report the results
|
||||||
|
print(result)
|
||||||
|
'''
|
||||||
|
|
||||||
async def wyszukaj(ctx, how_many=0):
|
async def wyszukaj(ctx, how_many=0):
|
||||||
# TODO: Potem dorobić wyszukiwania po kawałkach słów i sieć neuronową z możliwością wyrażenia opinii o dopasowaniu.
|
# TODO: Potem dorobić wyszukiwania po kawałkach słów i sieć neuronową z możliwością wyrażenia opinii o dopasowaniu.
|
||||||
|
|||||||
Reference in New Issue
Block a user