Fixes Pyright type errors for src/flask/helpers.py
This commit is contained in:
parent
8a6cdf1e2a
commit
b156cd2d5e
2 changed files with 3 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ Version 3.1.0
|
||||||
- ``Flask.open_resource``/``open_instance_resource`` and
|
- ``Flask.open_resource``/``open_instance_resource`` and
|
||||||
``Blueprint.open_resource`` take an ``encoding`` parameter to use when
|
``Blueprint.open_resource`` take an ``encoding`` parameter to use when
|
||||||
opening in text mode. It defaults to ``utf-8``. :issue:`5504`
|
opening in text mode. It defaults to ``utf-8``. :issue:`5504`
|
||||||
|
- Fixes Pyright type errors in ``src/flask/helpers.py``. :issue:`5547`
|
||||||
|
|
||||||
Version 3.0.3
|
Version 3.0.3
|
||||||
-------------
|
-------------
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import importlib.abc
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -586,7 +587,7 @@ def get_root_path(import_name: str) -> str:
|
||||||
if loader is None:
|
if loader is None:
|
||||||
return os.getcwd()
|
return os.getcwd()
|
||||||
|
|
||||||
if hasattr(loader, "get_filename"):
|
if isinstance(loader, (importlib.abc.FileLoader, importlib.abc.ExecutionLoader)):
|
||||||
filepath = loader.get_filename(import_name)
|
filepath = loader.get_filename(import_name)
|
||||||
else:
|
else:
|
||||||
# Fall back to imports.
|
# Fall back to imports.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue