[rtems-central commit] items: Remove unused ItemCache.top_level

Sebastian Huber sebh at rtems.org
Mon Dec 14 11:05:09 UTC 2020


Module:    rtems-central
Branch:    master
Commit:    6d30e3203c96203cfea1f052c5e66a0632152dfd
Changeset: http://git.rtems.org/rtems-central/commit/?id=6d30e3203c96203cfea1f052c5e66a0632152dfd

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sun Dec 13 14:33:47 2020 +0100

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 85a713f..7a789c7 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 d90b1e0..0dbe0c6 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



More information about the vc mailing list