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

Резултати

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

Пребарај: #crank

当前筛选 #crank清除筛选
Libreware

@libreware · Post #1007 · 05.11.2021 г., 00:54

We just pushed the V1.2 of the Beechat Crank to our GitHub @beechatnetwork2 Beechat Crank is a human-powered, open-hardware, fully-waterproof, electricity generator. The project was born out of the need to power electronics in all off-grid scenarios. We needed a way to power our devices in all weather conditions, and making a human-powered generator meant that problem could be solved. When we looked for a solution, we didn't find what we were looking for, so we decided to make it, and make it open source! https://github.com/BeechatNetworkSystemsLtd/BeechatCrank/ Features High power (3A) USB-C IPX8 output 18650 3600 mAh battery (LG M36) Charging time of 4 hrs 24 min. to full charge with 10% efficiency loss at 4.5 Watts. Overcharge protection Parts Beechat Crank is composed of the main device, which we call the Heart. It contains the battery, the generator and all the electronics (the handle is detachable) The Pedal Case is an assembly which the Heart can be attached in. which dramatically speeds up the charging from 2.5 hours to 25-30 minutes. This is achieved with reduction gears to, with the same revolutions per minute, generate more electricity. Generator part We have chosen the 35L048B1B motor with a mass of 88 grams, giving us us 450 mA for each phase of the coil and works at 5V. The wire leads are connected via female Molex connectors to the charging PCB board. New modifications: * Added a Molex type connector to the PCB to connect the motor. * The Zener diodes were changed, by means of a rectifier bridge. * A new and improved Texas Instruments brand battery management chip was selected. * Added a boost converter to allow different voltage batteries. * New Portescap brand two-phase generator with 90% efficiency and peak power of 4.5 Watts was selected. #crank#beechat

Видеотека 📼

@videotekashow · Post #14048 · 26.07.2025 г., 18:17

«Вообще, фильм «Карты, деньги, два ствола» был единственной причиной, по которой я поменял профессию». Джейсону Стэйтему сегодня исполнилось 58 лет. #ВИДЕОТЕКА #JasonStatham #LockStockAndTwoSmockingBarrels #Snatch #TheTransporter #Crank #TheExpendables #KillerElite #Safe #Parker #WrathOfMan #AWorkingMan