# Path: src/circular/template/observer.py
# class ListProxy(list):
#     """
#         A wrapper around list objects for making them observable
#     """
# 
#     def __init__(self, lst):
#         this = []
#         for item in lst:
#             if isinstance(item, list):
#                 this.append(ListProxy(item))
#             elif isinstance(item, dict):
#                 this.append(DictProxy(item))
#             else:
#                 this.append(item)
#         super().__init__(this)
# 
# class DictProxy(dict):
#     """
#         A wrapper around dict objects for making them observable
#     """
# 
#     def __init__(self, dct):
#         this = {}
#         for key, val in dct.items():
#             if isinstance(val, list):
#                 this[key] = ListProxy(val)
#             elif isinstance(val, dict):
#                 this[key] = DictProxy(val)
#             else:
#                 this[key] = val
#         super().__init__(this)


import asyncio
from .observer import ListProxy, DictProxy
        if name in self._dct:
            return self._dct[name]
        if isinstance(self._base, Context):
            return self._base._get(name)
        return self._base[name]

    def _set(self, name, val):
        if isinstance(val, list):
            self._dct[name] = ListProxy(val)
        elif isinstance(val, dict):
            self._dct[name] = DictProxy(val)
        else:
            self._dct[name] = val

    def _clear(self):
        self._dct.clear()

    def _save(self, name):
        """ If the identifier @name is present, saves its value on
            the saved stack """
        if name not in self._dct:
            return
        if name not in self._saved:
            self._saved[name] = []
        self._saved[name].append(self._dct[name])

    def _restore(self, name):
        """ If the identifier @name is present in the saved stack
            restores its value to the last value on the saved stack."""
        if name in self._saved:

# Path: src/circular/template/observer.py
# class ListProxy(list):
#     """
#         A wrapper around list objects for making them observable
#     """
# 
#     def __init__(self, lst):
#         this = []
#         for item in lst:
#             if isinstance(item, list):
#                 this.append(ListProxy(item))
#             elif isinstance(item, dict):
#                 this.append(DictProxy(item))
#             else:
#                 this.append(item)
#         super().__init__(this)
# 
# class DictProxy(dict):
#     """
#         A wrapper around dict objects for making them observable
#     """
# 
#     def __init__(self, dct):
#         this = {}
#         for key, val in dct.items():
#             if isinstance(val, list):
#                 this[key] = ListProxy(val)
#             elif isinstance(val, dict):
#                 this[key] = DictProxy(val)
#             else:
#                 this[key] = val
#         super().__init__(this)


# Path: src/circular/template/context.py
import asyncio
from .observer import ListProxy, DictProxy

        if name in self._dct:
            return self._dct[name]
        if isinstance(self._base, Context):
            return self._base._get(name)
        return self._base[name]

    def _set(self, name, val):
        if isinstance(val, list):
            self._dct[name] = ListProxy(val)
        elif isinstance(val, dict):
            self._dct[name] = DictProxy(val)
        else:
            self._dct[name] = val

    def _clear(self):
        self._dct.clear()

    def _save(self, name):
        """ If the identifier @name is present, saves its value on
            the saved stack """
        if name not in self._dct:
            return
        if name not in self._saved:
            self._saved[name] = []
        self._saved[name].append(self._dct[name])

    def _restore(self, name):
        """ If the identifier @name is present in the saved stack
            restores its value to the last value on the saved stack."""
        if name in self._saved:

            self._dct[name] = self._saved[name].pop()