Skip to content
Myr

remove deprecated code

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 6a12b19 · Browse files · 7 files+3 added−225 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+3 added−225 removed

  • other:+3 added−225 removed

7 files+3 added−225 removed

modified:docs/api.rst-5 removed
517 unmodified lines
518 message_flashed.connect(record, app)519520 .. versionadded:: 0.10521522.. data:: signals.signals_available522524 .. deprecated:: 2.3525 Will be removed in Flask 2.4. Signals are always available526527523Class-Based Views524-----------------525526.. versionadded:: 0.7
191 unmodified lines
modified:src/flask/__init__.py-61 removed
37 unmodified lines
38from .templating import stream_template as stream_template39from .templating import stream_template_string as stream_template_string4041__version__ = "3.0.0.dev"424344def __getattr__(name):45 if name == "_app_ctx_stack":46 import warnings47 from .globals import __app_ctx_stack4849 warnings.warn(50 "'_app_ctx_stack' is deprecated and will be removed in Flask 2.4.",51 DeprecationWarning,52 stacklevel=2,53 )54 return __app_ctx_stack5556 if name == "_request_ctx_stack":57 import warnings58 from .globals import __request_ctx_stack5960 warnings.warn(61 "'_request_ctx_stack' is deprecated and will be removed in Flask 2.4.",62 DeprecationWarning,63 stacklevel=2,64 )65 return __request_ctx_stack6667 if name == "escape":68 import warnings69 from markupsafe import escape7071 warnings.warn(72 "'flask.escape' is deprecated and will be removed in Flask 2.4. Import"73 " 'markupsafe.escape' instead.",74 DeprecationWarning,75 stacklevel=2,76 )77 return escape7879 if name == "Markup":80 import warnings81 from markupsafe import Markup8283 warnings.warn(84 "'flask.Markup' is deprecated and will be removed in Flask 2.4. Import"85 " 'markupsafe.Markup' instead.",86 DeprecationWarning,87 stacklevel=2,88 )89 return Markup9091 if name == "signals_available":92 import warnings9394 warnings.warn(95 "'signals_available' is deprecated and will be removed in Flask 2.4."96 " Signals are always available",97 DeprecationWarning,98 stacklevel=2,99 )100 return True101102 raise AttributeError(name)
modified:src/flask/app.py-19 removed
570 unmodified lines
571 effect.572 """573 return self.create_jinja_environment()574575 @property576 def got_first_request(self) -> bool:577 """This attribute is set to ``True`` if the application started578 handling the first request.579580 .. deprecated:: 2.3581 Will be removed in Flask 2.4.582583 .. versionadded:: 0.8584 """585 import warnings586587 warnings.warn(588 "'got_first_request' is deprecated and will be removed in Flask 2.4.",589 DeprecationWarning,590 stacklevel=2,591 )592 return self._got_first_request593575 def make_config(self, instance_relative: bool = False) -> Config:576 """Used to create the config attribute by the Flask constructor.577 The `instance_relative` parameter is passed in from the constructor578 of Flask (there named `instance_relative_config`) and indicates if
1616 unmodified lines
modified:src/flask/globals.py-45 removed
12 unmodified lines
13 from .sessions import SessionMixin14 from .wrappers import Request151617class _FakeStack:18 def __init__(self, name: str, cv: ContextVar[t.Any]) -> None:19 self.name = name20 self.cv = cv2122 @property23 def top(self) -> t.Any | None:24 import warnings2526 warnings.warn(27 f"'_{self.name}_ctx_stack' is deprecated and will be removed in Flask 2.4."28 f" Use 'g' to store data, or '{self.name}_ctx' to access the current"29 " context.",30 DeprecationWarning,31 stacklevel=2,32 )33 return self.cv.get(None)343517_no_app_msg = """\18Working outside of application context.1920This typically means that you attempted to use functionality that needed21the current application. To solve this, set up an application context22with app.app_context(). See the documentation for more information.\23"""24_cv_app: ContextVar[AppContext] = ContextVar("flask.app_ctx")44__app_ctx_stack = _FakeStack("app", _cv_app)25app_ctx: AppContext = LocalProxy( # type: ignore[assignment]26 _cv_app, unbound_message=_no_app_msg27)28current_app: Flask = LocalProxy( # type: ignore[assignment]
10 unmodified lines
39an active HTTP request. Consult the documentation on testing for40information about how to avoid this problem.\41"""42_cv_request: ContextVar[RequestContext] = ContextVar("flask.request_ctx")63__request_ctx_stack = _FakeStack("request", _cv_request)43request_ctx: RequestContext = LocalProxy( # type: ignore[assignment]44 _cv_request, unbound_message=_no_req_msg45)46request: Request = LocalProxy( # type: ignore[assignment]
1 unmodified line
48)49session: SessionMixin = LocalProxy( # type: ignore[assignment]50 _cv_request, "session", unbound_message=_no_req_msg51)737475def __getattr__(name: str) -> t.Any:76 if name == "_app_ctx_stack":77 import warnings7879 warnings.warn(80 "'_app_ctx_stack' is deprecated and will be removed in Flask 2.4.",81 DeprecationWarning,82 stacklevel=2,83 )84 return __app_ctx_stack8586 if name == "_request_ctx_stack":87 import warnings8889 warnings.warn(90 "'_request_ctx_stack' is deprecated and will be removed in Flask 2.4.",91 DeprecationWarning,92 stacklevel=2,93 )94 return __request_ctx_stack9596 raise AttributeError(name)
modified:src/flask/helpers.py+1 added-79 removed
1from __future__ import annotations23import importlib.util4import os5import socket5import sys6import typing as t8import warnings7from datetime import datetime8from functools import lru_cache9from functools import update_wrapper12from threading import RLock1011import werkzeug.utils12from werkzeug.exceptions import abort as _wz_abort13from werkzeug.utils import redirect as _wz_redirect
474 unmodified lines
488 :meth:`Flask.get_send_file_max_age`.489490 .. versionchanged:: 0.7491 MIME guessing and etag support for file-like objects was495 deprecated because it was unreliable. Pass a filename if you are492 removed because it was unreliable. Pass a filename if you are493 able to, otherwise attach an etag yourself.494495 .. versionchanged:: 0.5496 The ``add_etags``, ``cache_timeout`` and ``conditional``
115 unmodified lines
612 # filepath is import_name.py for a module, or __init__.py for a package.613 return os.path.dirname(os.path.abspath(filepath))614615619class locked_cached_property(werkzeug.utils.cached_property):620 """A :func:`property` that is only evaluated once. Like621 :class:`werkzeug.utils.cached_property` except access uses a lock622 for thread safety.623624 .. deprecated:: 2.3625 Will be removed in Flask 2.4. Use a lock inside the decorated function if626 locking is needed.627628 .. versionchanged:: 2.0629 Inherits from Werkzeug's ``cached_property`` (and ``property``).630 """631632 def __init__(633 self,634 fget: t.Callable[[t.Any], t.Any],635 name: str | None = None,636 doc: str | None = None,637 ) -> None:638 import warnings639640 warnings.warn(641 "'locked_cached_property' is deprecated and will be removed in Flask 2.4."642 " Use a lock inside the decorated function if locking is needed.",643 DeprecationWarning,644 stacklevel=2,645 )646 super().__init__(fget, name=name, doc=doc)647 self.lock = RLock()648649 def __get__(self, obj: object, type: type = None) -> t.Any: # type: ignore650 if obj is None:651 return self652653 with self.lock:654 return super().__get__(obj, type=type)655656 def __set__(self, obj: object, value: t.Any) -> None:657 with self.lock:658 super().__set__(obj, value)659660 def __delete__(self, obj: object) -> None:661 with self.lock:662 super().__delete__(obj)663664665def is_ip(value: str) -> bool:666 """Determine if the given string is an IP address.667668 :param value: value to check669 :type value: str670671 :return: True if string is an IP address672 :rtype: bool673674 .. deprecated:: 2.3675 Will be removed in Flask 2.4.676 """677 warnings.warn(678 "The 'is_ip' function is deprecated and will be removed in Flask 2.4.",679 DeprecationWarning,680 stacklevel=2,681 )682683 for family in (socket.AF_INET, socket.AF_INET6):684 try:685 socket.inet_pton(family, value)686 except OSError:687 pass688 else:689 return True690691 return False692693616@lru_cache(maxsize=None)617def _split_blueprint_path(name: str) -> list[str]:618 out: list[str] = [name]619
4 unmodified lines
modified:src/flask/signals.py-16 removed
1from __future__ import annotations23import typing as t4import warnings53from blinker import Namespace45# This namespace is only for signals provided by Flask itself.6_signals = Namespace()
7 unmodified lines
14appcontext_tearing_down = _signals.signal("appcontext-tearing-down")15appcontext_pushed = _signals.signal("appcontext-pushed")16appcontext_popped = _signals.signal("appcontext-popped")17message_flashed = _signals.signal("message-flashed")212223def __getattr__(name: str) -> t.Any:24 if name == "signals_available":25 warnings.warn(26 "The 'signals_available' attribute is deprecated and will be removed in"27 " Flask 2.4. Signals are always available.",28 DeprecationWarning,29 stacklevel=2,30 )31 return True3233 raise AttributeError(name)
modified:CHANGES.rst+2 added
1 unmodified line
2-------------34Unreleased56- Remove previously deprecated code. :pr:`5223`789Version 2.3.310-------------1112Unreleased
1512 unmodified lines