From 6d30e3203c96203cfea1f052c5e66a0632152dfd Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sun, 13 Dec 2020 14:33:47 +0100 Subject: items: Remove unused ItemCache.top_level --- rtemsspec/items.py | 8 -------- rtemsspec/tests/test_items_itemcache.py | 4 +--- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/rtemsspec/items.py b/rtemsspec/items.py index 85a713f0..7a789c7a 100644 --- a/rtemsspec/items.py +++ b/rtemsspec/items.py @@ -539,7 +539,6 @@ class ItemCache: """ This class provides a cache of specification items. """ def __init__(self, config: Any): self._items = {} # type: ItemMap - self._top_level = {} # type: ItemMap self._updates = 0 self._load_items(config) spec_root = config["spec-type-root-uid"] @@ -566,11 +565,6 @@ class ItemCache: """ Returns the map of all specification items. """ return self._items - @property - def top_level(self) -> ItemMap: - """ Returns the map of top-level specification items. """ - return self._top_level - def add_volatile_item(self, path: str, uid: str) -> Item: """ Adds an item stored in the specified file to the cache and returns it. @@ -587,8 +581,6 @@ class ItemCache: def _add_item(self, uid: str, data: Any) -> Item: item = Item(self, uid, data) self._items[uid] = item - if not item["links"]: - self._top_level[uid] = item return item def _load_items_in_dir(self, base: str, path: str, cache_file: str, diff --git a/rtemsspec/tests/test_items_itemcache.py b/rtemsspec/tests/test_items_itemcache.py index d90b1e04..0dbe0c69 100644 --- a/rtemsspec/tests/test_items_itemcache.py +++ b/rtemsspec/tests/test_items_itemcache.py @@ -45,9 +45,7 @@ def test_load(tmpdir): assert os.path.exists(os.path.join(cache_dir, "spec", "d", "spec.pickle")) assert item_cache["/d/c"]["v"] == "c" assert item_cache["/p"]["v"] == "p" - t = item_cache.top_level - assert len(t) == 1 - p = t["/p"] + p = item_cache["/p"] assert p["v"] == "p" assert p.map("/p") == p assert p.map("p") == p -- cgit v1.2.3