MCPcopy
hub / github.com/scrapy/scrapy / _map_keys

Function _map_keys

scrapy/utils/conf.py:35–50  ·  view source on GitHub ↗
(compdict: Mapping[Any, Any])

Source from the content-addressed store, hash-verified

33 )
34
35 def _map_keys(compdict: Mapping[Any, Any]) -> BaseSettings | dict[Any, Any]:
36 if isinstance(compdict, BaseSettings):
37 compbs = BaseSettings()
38 for k, v in compdict.items():
39 prio = compdict.getpriority(k)
40 assert prio is not None
41 if compbs.getpriority(convert(k)) == prio:
42 raise ValueError(
43 f"Some paths in {list(compdict.keys())!r} "
44 "convert to the same "
45 "object, please update your settings"
46 )
47 compbs.set(convert(k), v, priority=prio)
48 return compbs
49 _check_components(compdict)
50 return {convert(k): v for k, v in compdict.items()}
51
52 def _validate_values(compdict: Mapping[Any, Any]) -> None:
53 """Fail if a value in the components dict is not a real number or None."""

Callers 1

build_component_listFunction · 0.85

Calls 6

getpriorityMethod · 0.95
setMethod · 0.95
BaseSettingsClass · 0.90
_check_componentsFunction · 0.85
itemsMethod · 0.80
keysMethod · 0.80

Tested by

no test coverage detected