better new_path

This commit is contained in:
John Lancaster
2026-02-22 20:54:05 -06:00
parent 2efdf19ee1
commit 05ba036346

View File

@@ -1,6 +1,5 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from collections.abc import Container, Iterable, MutableMapping, MutableSequence, Sized from collections.abc import Container, Iterable, MutableMapping, MutableSequence, Sized
from copy import copy
from typing import Protocol, TypeVar from typing import Protocol, TypeVar
from . import events as e from . import events as e
@@ -57,9 +56,7 @@ class HookedContainer(ABC, Sized, Iterable[T], Container[T]):
# Custom Methods # Custom Methods
def new_path(self, key): def new_path(self, key):
new_path = copy(self._path) return (*self._path, key)
new_path.append(key)
return new_path
def get_nested(self, keys): def get_nested(self, keys):
"""Recursively call __getitem__ with each key in the iterable.""" """Recursively call __getitem__ with each key in the iterable."""