Отдельно разберём 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
¡New build available!
#Matrixx | #diting
Device: Xiaomi 12T Pro | Redmi K50 Ultra
Build Date:2024-03-14
Downloads:
Link |
Changelog:
ROM LOG
- Include genshin fire animation
- Fixed some jittering and lags
- improve the performance
- Sync with last source of matrix
- Bug fixes
- Now ota works
Notes
• Gapps are included
• FW included , meme cam
• Remebering, Don't report bugs without logs.
• CTS pass by default
By @TeamMEX_XDA
Donate PayPal
¡New build available!
#Matrixx | #diting
Device: Xiaomi 12T Pro | Redmi K50 Ultra
MD5SUM:a9a8f235f3a97a076ff3271f145d62c9
Build Date:2024-02-01
Downloads:
Link |
Changelog:
- Fixed eSIM issues (now eSIM should work without more problems)
- Fixed recovery issues no more fstboot when u try to reboot to recovery
- Fixed some internal crashes
Notes
• Gapps are included
• FW included , meme cam
• Remebering, Don't report bugs without logs.
• CTS pass by default
• Clean flash required
Thnks to @Mohammadnt96 for help me with some ideas and tests.
By @TeamMEX_XDA
Donate PayPal
¡New build available!
#Matrixx | #diting
Device: Xiaomi 12T Pro | Redmi K50 Ultra
MD5SUM:423c046d9878a3fc6ca7682639ee2ba1
Build Date:2024-01-19
Downloads:
Link |
Changelog:link
Notes
• Gapps are included
• GTX8_SPI for not working
• Remebering, Don't report bugs without logs.
• CTS pass by default
By @TeamMEX_XDA
Donate PayPal
¡New build available!
#Matrixx | #diting
Device: Xiaomi 12T Pro | Redmi K50 Ultra
MD5SUM:f576c0244e8cc653468173e082e9d96c
Build Date:2024-01-12
Downloads:
Link |
Changelog:
- Fixed codecs issues
- Screenrecord issue was fixed
- Netflix HDR is now working
- Fixed Netflix play issue
- revert some blobs to miui
- Introduce displayfeature color service and use MIUI color modes
- Set standard display color mode in AOD
Notes
• Gapps are included
• GTX8_SPI for not working
• Remebering, Don't report bugs without logs.
• CTS pass by default
By @TeamMEX_XDA
Donate PayPal
¡New build available!
#Matrixx | #diting
Device:Xiaomi 12T Pro | Redmi K50 Ultra
MD5SUM:35348bd7a59d0bf34e4219382862d476
Build Date:2023-12-27
Downloads:
Link |
Changelog:
- Initial public release
- Sepolicy enforcing
Notes
• Gapps are included
• FOD Not working on gtx8_spi touch screen
• Remebering, Don't report bugs without logs.
• CTS pass by default
By @TeamMEX_XDA
Donate PayPal