(
raw: object,
defaults: Mapping[str, object],
*,
allowed_keys: frozenset[str],
where: str,
)
| 1134 | |
| 1135 | |
| 1136 | def _classifier_mapping( |
| 1137 | raw: object, |
| 1138 | defaults: Mapping[str, object], |
| 1139 | *, |
| 1140 | allowed_keys: frozenset[str], |
| 1141 | where: str, |
| 1142 | ) -> dict[str, object]: |
| 1143 | classifier = { |
| 1144 | key: value |
| 1145 | for key, value in defaults.items() |
| 1146 | if key in _CLASSIFIER_DEFAULT_KEYS |
| 1147 | } |
| 1148 | classifier_mapping = _require_mapping(raw, where) |
| 1149 | _validate_allowed_keys(classifier_mapping, allowed_keys, where) |
| 1150 | classifier.update(classifier_mapping) |
| 1151 | if "timeout" in classifier_mapping and "timeout_secs" not in classifier_mapping: |
| 1152 | classifier["timeout_secs"] = classifier_mapping["timeout"] |
| 1153 | elif "timeout_secs" not in classifier and "timeout" in classifier: |
| 1154 | classifier["timeout_secs"] = classifier["timeout"] |
| 1155 | classifier.pop("timeout", None) |
| 1156 | return classifier |
| 1157 | |
| 1158 | |
| 1159 | def _target_mapping( |
no test coverage detected