Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11.
Ключевые отличия
▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля
▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста
▫️ошибка автоматически отменяет незавершенные задачи,
▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно
import asyncio
import random
async def do_it() -> str:
if random.random() < 0.1:
raise ValueError('Oops')
delay = random.uniform(0.5, 1.5)
await asyncio.sleep(delay)
return delay
async def main():
try:
async with asyncio.TaskGroup() as tg:
for _ in range(10):
tasks.append(tg.create_task(do_it()))
for t in tasks:
print(t.result())
except *ValueError as e:
for err in e.exceptions:
print(err)
asyncio.run(main())
Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов
- таймауты
- отмена задач
- создание задач из другого потока
#async
goldendict-ng
下一代 GoldenDict。一款功能丰富的开源词典查找程序,支持多种词典格式和在线词典。
https://xiaoyifang.github.io/goldendict-ng/
https://forum.freemdict.com/
https://github.com/lrorpilla/jidoujisho
Japanese-Chinese dictionaries.
https://cloud.freemdict.com/index.php/s/pgKcDcbSDTCzXCs?path=%2FJAPANESE%2FJpn-Chi
recommend using that add-on for anki:
https://ankiweb.net/shared/info/1344485230
the complete guide of how to configure goldendict-ng for Japanese :
https://tatsumoto-ren.github.io/blog/setting-up-goldendict.html
create anki cards from anime
https://github.com/Ajatt-Tools/mpvacious
#dict
https://github.com/blissnd/easyxls
Convert any #spreadsheet into a Python internal #dict/#array data structure, for easy processing. Can also handle pivot tables.
For pivot table usage, header_row_start & header_col_start need to be set equal to the top left corner of the pivot table => header_row_start=8, header_col_start='c' in the included example.
Column IDs must always be lowercase chars in quotes, e.g. 'a'.
👑New Meme Contest
👑
💰Reward : 100 USDT For Top 10 People🤑
👑Contest Link : Meme Contest
⭐Steps to take Part
⭐ Follow @dict00
⭐ Like RT Quite this tweet+comments @ 3 friends
⭐ Add your #DICT meme to the comments below
⭐ Must join Telegram Channel
⭐ Send proof in Telegram group with retweet link
#MemeContest#100USDT#USDT#giveaway
🔔Note: Please do your own research (DYOR) before joining to any project.Don't send any fee or penny without doing own research
✈️Business:@ProjectPromoters✅
@lingvanexbot
Qué puede hacer este bot?
Este es un bot traductor de alta calidad basada en redes neuronales para más de 50 idiomas.
➕ Traducir cualquier texto o palabras
➕ Convertir texto a voz
➕ Dar definiciones para cualquier palabra
➕ Diccionario
➕ Buscar por ejemplos de traducciones
Idioma: Múltiple
(visto en @BotsGram_cu)
#linguistic, #translate, #define, #dictionary, #dict, #text2speech, #speech, #examples, #sentence, #words