Add python proxy/filter models

This commit is contained in:
miruka
2020-05-06 00:26:52 -04:00
parent 1a69ae684e
commit eee198b238
4 changed files with 168 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ from . import SyncId
if TYPE_CHECKING:
from .model_item import ModelItem
from .proxy import ModelProxy # noqa
class Model(MutableMapping):
@@ -29,6 +30,10 @@ class Model(MutableMapping):
Items in the model are kept sorted using the `ModelItem` subclass `__lt__`.
"""
instances: Dict[SyncId, "Model"] = {}
proxies: Dict[SyncId, "ModelProxy"] = {}
def __init__(self, sync_id: Optional[SyncId]) -> None:
self.sync_id: Optional[SyncId] = sync_id
self._data: Dict[Any, "ModelItem"] = {}