From 06b3125207877a94f98eed8b2401f60c7ece48e4 Mon Sep 17 00:00:00 2001 From: bre-17387639 <425026+bre-17387639@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:18:34 -0600 Subject: [PATCH] Fixes Pyright type errors for `src/flask/blueprint.py` --- CHANGES.rst | 1 + src/flask/blueprints.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 985c8a0d..afea5b28 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ Version 3.1.0 - ``Flask.open_resource``/``open_instance_resource`` and ``Blueprint.open_resource`` take an ``encoding`` parameter to use when opening in text mode. It defaults to ``utf-8``. :issue:`5504` +- Fixes Pyright type errors in ``src/flask/blueprint.py``. :issue:`5545` Version 3.0.3 ------------- diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py index 86c5d59a..6e5dc858 100644 --- a/src/flask/blueprints.py +++ b/src/flask/blueprints.py @@ -3,6 +3,7 @@ from __future__ import annotations import os import typing as t from datetime import timedelta +from io import BufferedReader from .cli import AppGroup from .globals import current_app @@ -103,7 +104,7 @@ class Blueprint(SansioBlueprint): def open_resource( self, resource: str, mode: str = "rb", encoding: str | None = "utf-8" - ) -> t.IO[t.AnyStr]: + ) -> t.IO[t.AnyStr] | BufferedReader: """Open a resource file relative to :attr:`root_path` for reading. The blueprint-relative equivalent of the app's :meth:`~.Flask.open_resource` method.