From 7576bfb719d80f9bf41e231690d1e90dce12d6ee Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Sun, 22 Feb 2026 17:20:11 -0600 Subject: [PATCH] new_path method --- src/hooked_containers/container.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hooked_containers/container.py b/src/hooked_containers/container.py index fd8883b..afe727c 100644 --- a/src/hooked_containers/container.py +++ b/src/hooked_containers/container.py @@ -1,5 +1,6 @@ from abc import ABC, abstractmethod from collections.abc import Container, Iterable, MutableMapping, MutableSequence, Sized +from copy import copy from typing import Protocol, TypeVar from . import events as e @@ -47,6 +48,11 @@ class HookedContainer(ABC, Sized, Iterable[T], Container[T]): # Custom Methods + def new_path(self, key): + new_path = copy(self._path) + new_path.append(key) + return new_path + def get_nested(self, keys): """Recursively call __getitem__ with each key in the iterable.""" result = self