The key in `container` the YAML key ended up as, or a sentinel when it isn't there.
(container, key)
| 196 | |
| 197 | |
| 198 | def _resolve_key(container, key): |
| 199 | """The key in `container` the YAML key ended up as, or a sentinel when it isn't there.""" |
| 200 | if isinstance(container, (list, tuple)): |
| 201 | return key if isinstance(key, int) and 0 <= key < len(container) else _MISSING |
| 202 | if dict.__contains__(container, key): |
| 203 | return key |
| 204 | found = container._comment_resolve(key) # only Box / BoxList containers get here |
| 205 | return found if dict.__contains__(container, found) else _MISSING |
| 206 | |
| 207 | |
| 208 | _MISSING = object() |
no test coverage detected