Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/flask/__init__.py: 92%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

48 statements  

1from __future__ import annotations 

2 

3import typing as t 

4 

5from . import json as json 

6from .app import Flask as Flask 

7from .blueprints import Blueprint as Blueprint 

8from .config import Config as Config 

9from .ctx import after_this_request as after_this_request 

10from .ctx import copy_current_request_context as copy_current_request_context 

11from .ctx import has_app_context as has_app_context 

12from .ctx import has_request_context as has_request_context 

13from .globals import current_app as current_app 

14from .globals import g as g 

15from .globals import request as request 

16from .globals import session as session 

17from .helpers import abort as abort 

18from .helpers import flash as flash 

19from .helpers import get_flashed_messages as get_flashed_messages 

20from .helpers import get_template_attribute as get_template_attribute 

21from .helpers import make_response as make_response 

22from .helpers import redirect as redirect 

23from .helpers import send_file as send_file 

24from .helpers import send_from_directory as send_from_directory 

25from .helpers import stream_with_context as stream_with_context 

26from .helpers import url_for as url_for 

27from .json import jsonify as jsonify 

28from .signals import appcontext_popped as appcontext_popped 

29from .signals import appcontext_pushed as appcontext_pushed 

30from .signals import appcontext_tearing_down as appcontext_tearing_down 

31from .signals import before_render_template as before_render_template 

32from .signals import got_request_exception as got_request_exception 

33from .signals import message_flashed as message_flashed 

34from .signals import request_finished as request_finished 

35from .signals import request_started as request_started 

36from .signals import request_tearing_down as request_tearing_down 

37from .signals import template_rendered as template_rendered 

38from .templating import render_template as render_template 

39from .templating import render_template_string as render_template_string 

40from .templating import stream_template as stream_template 

41from .templating import stream_template_string as stream_template_string 

42from .wrappers import Request as Request 

43from .wrappers import Response as Response 

44 

45 

46def __getattr__(name: str) -> t.Any: 

47 if name == "__version__": 

48 import importlib.metadata 

49 import warnings 

50 

51 warnings.warn( 

52 "The '__version__' attribute is deprecated and will be removed in" 

53 " Flask 3.1. Use feature detection or" 

54 " 'importlib.metadata.version(\"flask\")' instead.", 

55 DeprecationWarning, 

56 stacklevel=2, 

57 ) 

58 return importlib.metadata.version("flask") 

59 

60 raise AttributeError(name)