(self, *args: Any)
| 258 | del self[key] |
| 259 | |
| 260 | def pop(self, *args: Any) -> Any: |
| 261 | # Must test this up front before (possibly) mutating self._config |
| 262 | key_existed = args and args[0] in self._config |
| 263 | # We always have a _config (whether it's a real dict or a cache of |
| 264 | # merged levels) so we can fall back to it for all the corner case |
| 265 | # handling re: args (arity, handling a default, raising KeyError, etc) |
| 266 | ret = self._config.pop(*args) |
| 267 | # If it looks like no popping occurred (key wasn't there), presumably |
| 268 | # user gave default, so we can short-circuit return here - no need to |
| 269 | # track a deletion that did not happen. |
| 270 | if not key_existed: |
| 271 | return ret |
| 272 | # Here, we can assume at least the 1st posarg (key) existed. |
| 273 | self._track_removal_of(args[0]) |
| 274 | # In all cases, return the popped value. |
| 275 | return ret |
| 276 | |
| 277 | def popitem(self) -> Any: |
| 278 | ret = self._config.popitem() |
no test coverage detected