@mtprotoclientscommits · Post #3431 · 21.02.2026 г., 21:21
LonamiWebs/Telethon/v1 • dab6bc4 • 1 files, +4/-0 Migrate off GitHub #telethon
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #418 · 9 мар.
Оператор pipe позволяет писать более компактный код, реализуя логику объединения данных (Union). Важно помнить, что его поведение зависит от контекста. Побитовые операции (логическое OR) result = 5 | 3 # 5 (0101) | 3 (0011) = 7 (0111) Самое главное - не путать с оператором or, это другое! Объединение множеств set_a = {1, 2, 3} set_b = {3, 4, 5} set_c = set_a | set_b # {1, 2, 3, 4, 5} set_c |= {5, 6} # {1, 2, 3, 4, 5, 6} Слияние словарей dict_1 = {"a": 1, "b": 2} dict_2 = {"b": 3, "c": 4} merged = dict_1 | dict_2 # {'a': 1, 'b': 3, 'c': 4} merged |= {"d": 5} # {'a': 1, 'b': 3, 'c': 4, 'd': 5} Аннотации типов, заменяет Union def process_data(value: int | str) -> None: print(value) Допустимо использовать в isinstance или issubclass isinstance(3, int | float) # True Паттерн-матчинг status_code = 404 match status_code: case 200 | 201 | 204: print("OK") case 400 | 404 | 500: print("ERROR") Для использования в своих классах требуется переопределить метод __or__ Так же нашел библиотеку pipe которая добавляет еще много возможностей. Рекомендую ознакомиться ;) #basic
Hashtags
Пребарај: #telethon
@mtprotoclientscommits · Post #3431 · 21.02.2026 г., 21:21
LonamiWebs/Telethon/v1 • dab6bc4 • 1 files, +4/-0 Migrate off GitHub #telethon
Hashtags
@mtprotoclientscommits · Post #3430 · 12.02.2026 г., 21:36
LonamiWebs/Telethon/v1 • 6e9bf16 • 1 files, +1/-0 Add error code for sending videos in chat (#4741) #telethon
Hashtags
@mtprotoclientscommits · Post #3429 · 11.02.2026 г., 19:06
LonamiWebs/Telethon/v1 • 295c736 • 1 files, +5/-1 Fix InvalidBuffedError on incomplete recv data (#4740) Co-authored-by: Maksym Veremchuk <[email protected]> #telethon
Hashtags
@mtprotoclientscommits · Post #3428 · 07.02.2026 г., 19:51
LonamiWebs/Telethon/v1 • 208ac30 • 1 files, +45/-31 Update to layer 222 #telethon
Hashtags
@mtprotoclientscommits · Post #3427 · 01.02.2026 г., 19:51
LonamiWebs/Telethon/v1 • d57be74 • 1 files, +22/-0 Catch-all unknown RPCError and treat them as transient during getDifference Can be considered to close #4739. #telethon
Hashtags
@mtprotoclientscommits · Post #3426 · 12.01.2026 г., 16:36
LonamiWebs/Telethon/v1 • 416570f • 2 files, +3/-3 Fix doc typos on some raw API types (#4732) #telethon
Hashtags
@mtprotoclientscommits · Post #3425 · 04.01.2026 г., 16:51
LonamiWebs/Telethon/v1 • 980a2c0 • 2 files, +15/-3 Update to layer 221 #telethon
Hashtags
@mtprotoclientscommits · Post #3424 · 03.01.2026 г., 18:36
LonamiWebs/Telethon/v1 • f3bd039 • 1 files, +3/-0 Add errors for chat restrictions (#4729) #telethon
Hashtags
@mtprotoclientscommits · Post #3422 · 30.12.2025 г., 10:21
LonamiWebs/Telethon/v1 • 5efa1fe • 6 files, +20/-51 Update proxy docs and warn if python-socks is not installed As suggested in #4505. #telethon
Hashtags
@mtprotoclientscommits · Post #3420 · 18.12.2025 г., 16:51
LonamiWebs/Telethon/v1 • 05b8488 • 1 files, +12/-3 Fix Telethon could not be imported without sqlite3 Closes #4723. #telethon
Hashtags
@mtprotoclientscommits · Post #3419 · 17.12.2025 г., 07:21
LonamiWebs/Telethon/v1 • 664ceba • 1 files, +4/-3 Fix TestSyncifyAsyncContext.test_sync_acontext on Python 3.14 (#4722) `asyncio.get_event_loop` fails on Python 3.14 if there is no current event loop. For this particular test of sync behaviour, it seems to make most sense to explicitly create one. #telethon
Hashtags
@mtprotoclientscommits · Post #3418 · 06.12.2025 г., 21:51
LonamiWebs/Telethon/v1 • 676c436 • 1 files, +46/-15 Update to layer 220 #telethon
Hashtags