Path 1: 518 calls (0.62)

'/static/' (439) '/jsonify_basic_types' (10) '/bp/error' (8) '/' (8) '/foo/bar' (5) '/parent/child/' (5) '/foo/' (2) '/<...

'static' (442) 'test.index' (12) '/jsonify_basic_types' (10) 'bp.bp_error' (7) 'parent.child.index' (6) 'index' (3) 'bp.something' (2) 'bp.bp_index' (...

Flask.__init__.. def (442) test_blueprint_prefix_slash..index def (11) test_jsonify_basic_types.. def (10) _as...

None (518)

{'host': None} (441) dict (60) {} (16) {'host': 'example.com'} (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 2: 240 calls (0.29)

'/' (121) '/error' (13) '/abort' (8) '/view' (7) '/methodview' (7) '/custom' (5) '/forbidden' (4) '/raise' (4) '/get' (3) '/key' (3)

None (240)

View.as_view..view def (26) _async_app..error def (7) test_exception_propagation..index def (4) TestGenericHandlers.app.

None (240)

{} (234) {'subdomain': 'foo'} (2) {'subdomain': ''} (2) {'subdomain': 'test'} (1) {'subdomain': ''} (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 3: 47 calls (0.06)

'/' (18) '/home' (7) '/json' (4) '/set' (2) '/more' (1) '/login' (1) '/ignored' (1) '/fail' (1) '/hello/' (1) '/accept' (1)

None (47)

_async_app..index def (14) test_method_route..hello def (5) View.as_view..view def (3) test_bad_request_debug_message....

None (47)

dict (47)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 4: 14 calls (0.02)

'/bp/' (7) '/more' (1) '/a/' (1) '/a/error' (1) '/a/a/' (1) '/b/' (1) '/b/error' (1) '/b/a/' (1)

'bp.bp_index' (7) 'more' (1) 'bp.index' (1) 'bp.error' (1) 'bp.sub.index2' (1) 'alt.index' (1) 'alt.error' (1) 'alt.sub.index2' (1)

_async_app..bp_index def (7) test_blueprint_renaming..index def (2) test_blueprint_renaming..error def (2) test_blueprint_rena...

None (14)

dict (14)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 5: 6 calls (0.01)

'/get_post//' (3) '/zzz_post' (3)

'yyy_get_post' (3) 'aaa_post' (3)

None (6)

None (6)

dict (6)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 6: 5 calls (0.01)

'/a' (2) '/b' (2) '/' (1)

'a' (2) 'b' (2) 'index' (1)

None (5)

None (5)

{'subdomain': 'a'} (1) {'subdomain': 'b'} (1) {'host': 'a'} (1) {'host': 'b'} (1) {} (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 7: 3 calls (0.0)

'/' (3)

None (3)

View.as_view..view def (2) test_provide_automatic_options_attr..index def (1)

None (3)

{} (3)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 8: 1 calls (0.0)

'/' (1)

None (1)

test_provide_automatic_options_attr..index2 def (1)

None (1)

dict (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 9: 1 calls (0.0)

'/' (1)

None (1)

test_provide_automatic_options_kwarg..index def (1)

False (1)

{} (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 10: 1 calls (0.0)

'/more' (1)

None (1)

test_provide_automatic_options_kwarg..more def (1)

False (1)

dict (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 11: 1 calls (0.0)

'/' (1)

'test' (1)

None (1)

None (1)

{'methods': 'GET POST'} (1)

TypeError (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 12: 1 calls (0.0)

'/options' (1)

'options' (1)

test_url_mapping..options def (1)

None (1)

dict (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func
            

Path 13: 1 calls (0.0)

'/' (1)

None (1)

View.as_view..view def (1)

None (1)

{} (1)

AssertionError (1)

1@setupmethod
2    def add_url_rule(
3        self,
4        rule: str,
5        endpoint: str | None = None,
6        view_func: ft.RouteCallable | None = None,
7        provide_automatic_options: bool | None = None,
8        **options: t.Any,
9    ) -> None:
10        if endpoint is None:
11            endpoint = _endpoint_from_view_func(view_func)  # type: ignore
12        options["endpoint"] = endpoint
13        methods = options.pop("methods", None)
14
15        # if the methods are not given and the view_func object knows its
16        # methods we can use that instead.  If neither exists, we go with
17        # a tuple of only ``GET`` as default.
18        if methods is None:
19            methods = getattr(view_func, "methods", None) or ("GET",)
20        if isinstance(methods, str):
21            raise TypeError(
22                "Allowed methods must be a list of strings, for"
23                ' example: @app.route(..., methods=["POST"])'
24            )
25        methods = {item.upper() for item in methods}
26
27        # Methods that should always be added
28        required_methods = set(getattr(view_func, "required_methods", ()))
29
30        # starting with Flask 0.8 the view_func object can disable and
31        # force-enable the automatic options handling.
32        if provide_automatic_options is None:
33            provide_automatic_options = getattr(
34                view_func, "provide_automatic_options", None
35            )
36
37        if provide_automatic_options is None:
38            if "OPTIONS" not in methods:
39                provide_automatic_options = True
40                required_methods.add("OPTIONS")
41            else:
42                provide_automatic_options = False
43
44        # Add the required methods now.
45        methods |= required_methods
46
47        rule = self.url_rule_class(rule, methods=methods, **options)
48        rule.provide_automatic_options = provide_automatic_options  # type: ignore
49
50        self.url_map.add(rule)
51        if view_func is not None:
52            old_func = self.view_functions.get(endpoint)
53            if old_func is not None and old_func != view_func:
54                raise AssertionError(
55                    "View function mapping is overwriting an existing"
56                    f" endpoint function: {endpoint}"
57                )
58            self.view_functions[endpoint] = view_func