fix: stylize examples

This commit is contained in:
firedotguy
2026-02-10 15:49:06 +03:00
parent d49fb2d4cb
commit 51518ce0d7
3 changed files with 48 additions and 58 deletions

View File

@@ -1,4 +1,3 @@
# from warnings import deprecated
from uuid import UUID
from _io import BufferedReader
from typing import cast, Iterator
@@ -994,8 +993,9 @@ class Client:
return File.model_validate(res.json())
# @deprecated # Этот декоратор появился в 3.13, а наша библиотека поддерживает с 3.9
def update_banner(self, name: str) -> UserProfileUpdate:
"""Обновить банер (шорткат из upload_file + update_profile)
"""[DEPRECATED] Обновить банер (шорткат из upload_file + update_profile)
Args:
name (str): Имя файла
@@ -1006,6 +1006,19 @@ class Client:
id = self.upload_file(name, cast(BufferedReader, open(name, 'rb'))).id
return self.update_profile(banner_id=id)
def update_banner_new(self, name: str) -> tuple[File, UserProfileUpdate]:
"""Обновить банер (шорткат из upload_file + update_profile)
Args:
name (str): Имя файла
Returns:
File: Загруженный файл
UserProfileUpdate: Обновленный профиль
"""
file = self.upload_file(name, cast(BufferedReader, open(name, 'rb')))
return file, self.update_profile(banner_id=file.id)
@refresh_on_error
def restore_post(self, post_id: UUID) -> None:
"""Восстановить удалённый пост
@@ -1088,6 +1101,7 @@ class Client:
return res.json()['pin']
@refresh_on_error
def stream_notifications(self) -> Iterator[StreamConnect | StreamNotification]:
"""Слушать SSE поток уведомлений