Method: flask.config.Config.from_mapping
Calls: 5, Exceptions: 0, Paths: 2Back
Path 1: 3 calls (0.6)
{'TEST_KEY': 'foo', 'SECRET_KEY': 'config'} (1) {'SECRET_KEY': 'config', 'TEST_KEY': 'foo'} (1) list (1)
{} (3)
True (3)
1def from_mapping(
2 self, mapping: t.Mapping[str, t.Any] | None = None, **kwargs: t.Any
3 ) -> bool:
4 """Updates the config like :meth:`update` ignoring items with
5 non-upper keys.
6
7 :return: Always returns ``True``.
8
9 .. versionadded:: 0.11
10 """
11 mappings: dict[str, t.Any] = {}
12 if mapping is not None:
13 mappings.update(mapping)
14 mappings.update(kwargs)
15 for key, value in mappings.items():
16 if key.isupper():
17 self[key] = value
18 return True
Path 2: 2 calls (0.4)
None (2)
{'SECRET_KEY': 'config', 'TEST_KEY': 'foo'} (1) {'SECRET_KEY': 'config', 'TEST_KEY': 'foo', 'skip_key': 'skip'} (1)
True (2)
1def from_mapping(
2 self, mapping: t.Mapping[str, t.Any] | None = None, **kwargs: t.Any
3 ) -> bool:
4 """Updates the config like :meth:`update` ignoring items with
5 non-upper keys.
6
7 :return: Always returns ``True``.
8
9 .. versionadded:: 0.11
10 """
11 mappings: dict[str, t.Any] = {}
12 if mapping is not None:
13 mappings.update(mapping)
14 mappings.update(kwargs)
15 for key, value in mappings.items():
16 if key.isupper():
17 self[key] = value
18 return True