MCPcopy Create free account
hub / github.com/NVIDIA-NeMo/Switchyard / _classifier_mapping

Function _classifier_mapping

switchyard/cli/route_bundle.py:1136–1156  ·  view source on GitHub ↗
(
    raw: object,
    defaults: Mapping[str, object],
    *,
    allowed_keys: frozenset[str],
    where: str,
)

Source from the content-addressed store, hash-verified

1134
1135
1136def _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
1159def _target_mapping(

Callers 3

_stage_router_switchyardFunction · 0.85

Calls 3

_require_mappingFunction · 0.85
_validate_allowed_keysFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected