This commit is contained in:
John Lancaster
2026-02-21 23:29:45 -06:00
parent 3281c7c1ea
commit 2da2002cb9
2 changed files with 8 additions and 9 deletions

View File

@@ -1,10 +1,9 @@
from collections.abc import MutableMapping, MutableSequence, Sequence
from collections.abc import MutableMapping, Sequence
from copy import copy
from typing import TypeVar
from . import events as e
from .common import HookedContainer, MutableNesting
from .sequence import HookedList
T = TypeVar("T")
@@ -28,9 +27,9 @@ class HookedMapping(HookedContainer[T], MutableMapping[T, MutableNesting[T]]):
new_path.append(key)
match value:
case MutableMapping() as mapping:
return HookedMapping(hook=self.hook, existing=mapping, path=new_path)
case MutableSequence() as seq:
return HookedList(hook=self.hook, existing=seq, path=new_path)
return HookedMapping(mapping, self.hook, path=new_path)
case HookedContainer() as seq:
return type(self)(seq, self.hook, path=new_path)
case _ as item:
return item