summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-28 11:53:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-28 11:54:50 +0200
commitbb633e29ea74428e0d278c865e098c6822d9c145 (patch)
treee33222735f9dffe5a5cca80a5452b0590d15bef8
parentitems: Add JSONItemCache (diff)
downloadrtems-central-bb633e29ea74428e0d278c865e098c6822d9c145.tar.bz2
items: Simplify code
-rw-r--r--rtemsspec/items.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index 503a92c8..b8846d5a 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -742,9 +742,8 @@ class ItemCache:
if name.endswith(".yml") and not name.startswith("."):
if not update_cache:
update_cache = mtime <= os.path.getmtime(path2)
- else:
- if stat.S_ISDIR(os.lstat(path2).st_mode):
- self._load_items_recursive(index, base, path2, cache_dir)
+ elif stat.S_ISDIR(os.lstat(path2).st_mode):
+ self._load_items_recursive(index, base, path2, cache_dir)
self._load_items_in_dir(base, path, cache_file, update_cache)
def _load_items(self, config: Any):
@@ -811,9 +810,8 @@ class JSONItemCache(ItemCache):
if name.endswith(".json") and not name.startswith("."):
uid = "/" + os.path.relpath(path2, base).replace(".json", "")
self._add_item(uid, _load_json_data(path2, uid))
- else:
- if stat.S_ISDIR(os.lstat(path2).st_mode):
- self._load_json_items(base, path2)
+ elif stat.S_ISDIR(os.lstat(path2).st_mode):
+ self._load_json_items(base, path2)
def _load_items(self, config: Any):
for path in config["paths"]: