From 6e812946853e4ecb9b4c502dd71e6e78cd482ce4 Mon Sep 17 00:00:00 2001 From: monosans Date: Sun, 19 Jan 2025 01:35:44 +0000 Subject: [PATCH] fix: change the `Downloadable` protocol to be non-writable to shut up type checking that checks code that uses the `bot.download(...)` method (#1628) * fix: don't require Downloadable.file_id to be writable * docs: add changelog * Update CHANGES/1628.bugfix.rst Co-authored-by: Alex Root Junior --------- Co-authored-by: Alex Root Junior --- CHANGES/1628.bugfix.rst | 1 + aiogram/types/downloadable.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 CHANGES/1628.bugfix.rst diff --git a/CHANGES/1628.bugfix.rst b/CHANGES/1628.bugfix.rst new file mode 100644 index 00000000..ee5d7299 --- /dev/null +++ b/CHANGES/1628.bugfix.rst @@ -0,0 +1 @@ +Change the :code:`Downloadable` protocol to be non-writable to shut up type checking that checks code that uses the :code:`bot.download(...)` method diff --git a/aiogram/types/downloadable.py b/aiogram/types/downloadable.py index be808293..080caf64 100644 --- a/aiogram/types/downloadable.py +++ b/aiogram/types/downloadable.py @@ -2,4 +2,5 @@ from typing import Protocol class Downloadable(Protocol): - file_id: str + @property + def file_id(self) -> str: ...