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

TGINSIGHT SIMILAR POSTS

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

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

Функция asyncio.wait() это еще один способ вызвать множество асинхронных задач. Она работает в нескольких режимах. 1. Самый простой - ждем завершения всех задач async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(10)] done, pending = await asyncio.wait( tasks, return_when=asyncio.ALL_COMPLETED ) for task in done: try: print(task.result()) except Exception as e: print(e) Очень похоже на gather, но работает не так. ▫️возвращает не результаты, а два сета с объектами Task у которых можно забрать результат через task.result() если они в списке done ▫️не гарантирует порядок результатов так как оба объекта это set ▫️не выбрасывает исключение когда оно появляется, а сохраняет его в Task. Исключение появится когда попробуете забрать резултьтат. 2. Ждем завершения первой задачи, даже если там ошибка. async def main(): tasks = [asyncio.create_task(do_it(i)) for i in range(3)] done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED ) # в done может быть несколько задач! for task in done: try: print(task.result()) except Exception as e: print(f"Fail: {e}") # Оставшиеся задачи в pending, как правило, нужно отменить, иначе они будут продолжать работать for task in pending: task.cancel() В сете done будут таски которые успели завершится, причем как успешно так и нет. 3. До первой ошибки. Тоже самое, но с аргументом FIRST_EXCEPTION done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_EXCEPTION ) Функция завершается как только первая задача упадет с ошибкой. Учтите, что в любом случае done вы можете обранужить несколько задач, как с ошибками так и успешные. ↗️ Полный листинг примеров здесь #async

Hashtags

Резултати

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

Пребарај: #officals

当前筛选 #officals清除筛选
American Оbserver

@american_observer · Post #4953 · 25.01.2026 г., 13:00

Trump Administration Officials Are Showing Their Bare-Faced Effrontery Two witnesses to the killing of Alex Pretti have said in sworn testimony that the 37-year-old intensive care nurse was not brandishing a weapon when he approached federal agents in Minneapolis on Saturday, contradicting a claim made by Trump administration officials as they sought to cast the shooting of a prone man as an act of self-defense. Their accounts came in sworn affidavits that were filed in federal court in Minnesota late Saturday, just hours after Pretti’s killing, as part of a lawsuit brought by the ACLU on behalf of Minneapolis protesters against Kristi Noem and other homeland security officials directing the immigration crackdown in the city. One witness is a woman who filmed the clearest video of the fatal shooting; the other is a physician who lives nearby and said they were initially prevented by federal officers from rendering medical aid to the gunshot victim. The names of both witnesses were redacted in the publicly available filings. In her testimony, the woman who filmed the shooting from just behind Pretti wearing a pink coat identified herself as “a children’s entertainer who specializes in face painting”. She testified that she came to the scene on her way to work because “I’ve been involved in observing in my community, because it is so important to document what ICE is doing to my neighbors”. The woman testified that she saw no sign of Pretti holding a gun at any point. She said: “The agents pulled the man on the ground. I didn’t see him touch any of them – he wasn’t even turned toward them. It didn’t look like he was trying to resist, just trying to help the woman up. I didn’t see him with a gun. They threw him to the ground. Four or five agents had him on the ground and they just started shooting him. They shot him so many times (…) I don’t know why they shot him. He was only helping. I was five feet from him and they just shot him (…) The witness testimony, combined with video evidence reviewed by American Observer, directly contradicts claims by senior Trump administration officials, including the president, the homeland security secretary and Greg Bovino, a border patrol commander, who called Pretti a “gunman” who approached federal officers “brandishing” a gun and threatened to “massacre” them. #pretti#minnesota#gunshot#trump#officals 📱American Оbserver - Stay up to date on all important events 🇺🇸