TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #402 · 22 дек.

Отдельно разберём 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

Hashtags

Резултати

Пронајдени 95 слични објави

Пребарај: #cholera

当前筛选 #cholera清除筛选

As of 29th September, over 10,000 suspected cases of #cholera have been recorded from the 36 States + FCT. The ongoing cholera outbreak has been worsened by limited access to clean water, open defecation, & poor hygiene practices in affected communities. 🔗Download the situation report https://ncdc.gov.ng/diseases/sitreps/?cat=7&name=An%20update%20of%20Cholera%20outbreak%20in%20Nigeria

Hashtags

In reporting week 32, the number of suspected cases of #cholera increased to 121 cases. Our weekly situation report provides an update on the current #cholera epidemiological situation in Nigeria and our response activities. 🔗 Download via: https://ncdc.gov.ng/diseases/sitreps/?cat=7&name=An%20update%20of%20Cholera%20outbreak%20in%20Nigeria

Hashtags

Our weekly #cholera situation report for weeks 28 and 29 has been uploaded. The reports provide an update on the current #cholera epidemiological situation in Nigeria and our response activities. 🔗 Download via: https://ncdc.gov.ng/diseases/sitreps/?cat=7&name=An%20update%20of%20Cholera%20outbreak%20in%20Nigeria

Hashtags

Your actions, no matter how small can limit the risk of #cholera infection. 🚫Do not defecate in open areas 🧤Clear your drainages ✅Only drink water from safe sources ✅Dispose of refuse properly in waste disposal sites Public health advisory⬇️ 🔗https://ncdc.gov.ng/news/513/stop-cholera%3A-public-health-advisory

Hashtags

Our weekly #cholera situation report for week 27 has been uploaded. The report provides an update on the current #cholera epidemiological situation in Nigeria and our response activities. 🔗 Download via: https://ncdc.gov.ng/diseases/sitreps/?cat=7&name=An%20update%20of%20Cholera%20outbreak%20in%20Nigeria

Hashtags

Our #cholera situation reports are now weekly. The reports provide an update on the #cholera epidemiological situation in Nigeria and our response activities. 🔗 Download via: https://ncdc.gov.ng/diseases/sitreps/?cat=7&name=An%20update%20of%20Cholera%20outbreak%20in%20Nigeria

Hashtags

The bacteria, Vibrio cholerae, that causes #cholera is commonly found in contaminated water and food. Protect yourself. Read our public health advisory on measures to take to prevent yourself from getting infected. ⬇️ 🔗 https://ncdc.gov.ng/news/513/stop-cholera%3A-public-health-advisory

Hashtags

#Cholera Situation Report Our monthly Cholera Situation Report for May 2024 has been published on our website. 🔗You can download, read and share via https://ncdc.gov.ng/diseases/sitreps/?cat=7&name=An%20update%20of%20Cholera%20outbreak%20in%20Nigeria

Hashtags

Unwashed hands, untreated water, and uncovered food are some of the ways #Cholera germs are spread. Personal and environmental hygiene remains one of the best ways to STOP #Cholera. Watch this little boy's story on cholera: https://www.youtube.com/watch?v=jG1VNSCsP5Q

Hashtags

123•••78
ПретходнаСтраница 1 од 8Следна