diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-28 11:53:19 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-28 11:54:50 +0200 |
commit | bb633e29ea74428e0d278c865e098c6822d9c145 (patch) | |
tree | e33222735f9dffe5a5cca80a5452b0590d15bef8 | |
parent | items: Add JSONItemCache (diff) | |
download | rtems-central-bb633e29ea74428e0d278c865e098c6822d9c145.tar.bz2 |
items: Simplify code
-rw-r--r-- | rtemsspec/items.py | 10 |
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"]: |