Compare commits
1 Commits
main
...
hotfix/v1.
Author | SHA1 | Date |
---|---|---|
Benjamin Dauvergne | 06ac4ed296 |
|
@ -41,17 +41,22 @@ def get_warehouses_paths():
|
|||
|
||||
|
||||
@lru_cache()
|
||||
def get_warehouse_by_path_and_mtime(path, mtime):
|
||||
warehouse = json.load(open(path))
|
||||
warehouse['path'] = path
|
||||
return Warehouse.from_json(warehouse)
|
||||
|
||||
|
||||
def get_warehouses_by_paths(paths):
|
||||
warehouses = []
|
||||
for path in paths:
|
||||
d = json.load(open(path))
|
||||
d['path'] = path
|
||||
warehouses.append(Warehouse.from_json(d))
|
||||
mtime = os.path.getmtime(path)
|
||||
warehouses.append(get_warehouse_by_path_and_mtime(path, mtime))
|
||||
return warehouses
|
||||
|
||||
|
||||
def get_warehouses():
|
||||
paths = frozenset(get_warehouses_paths())
|
||||
paths = get_warehouses_paths()
|
||||
return get_warehouses_by_paths(paths)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue