Force sorted order in plots rendering (#6601)

* Force sorted order in plots

* Fix type hint

* Fixed mypy

* Updates test_plots

* Removed reduntant test

* Removed unused import
This commit is contained in:
David de la Iglesia Castro
2021-09-16 14:25:03 +08:00
committed by GitHub
parent 198cdeec06
commit 21585d18ab
2 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -1,13 +1,14 @@
import os.path
from typing import Dict, List, Set
from typing import Dict, List
def get_files(data: Dict) -> Set:
def get_files(data: Dict) -> List:
files = set()
for rev in data.keys():
for file in data[rev].get("data", {}).keys():
files.add(file)
return files
sorted_files = sorted(files)
return sorted_files
def group_by_filename(plots_data: Dict) -> List[Dict]:
+3 -3
View File
@@ -28,9 +28,9 @@ def test_plots_order(tmp_dir, dvc):
name="stage2",
)
assert get_files(dvc.plots.show()) == {
assert get_files(dvc.plots.show()) == [
"p.json",
os.path.join("sub", "p4.json"),
"p1.json",
os.path.join("sub", "p3.json"),
}
os.path.join("sub", "p4.json"),
]