Skip to content
Snippets Groups Projects
Commit 5b19bd27 authored by François  LAURENT's avatar François LAURENT
Browse files

input files grouped by dirs

parent 811692c1
No related branches found
No related tags found
No related merge requests found
Pipeline #82030 passed
...@@ -4,6 +4,7 @@ import pathlib ...@@ -4,6 +4,7 @@ import pathlib
import importlib import importlib
import logging import logging
import subprocess import subprocess
from collections import defaultdict
class BackendExplorer: class BackendExplorer:
...@@ -293,7 +294,7 @@ run `poetry add {pkg}` from directory: \n ...@@ -293,7 +294,7 @@ run `poetry add {pkg}` from directory: \n
def list_model_files(self): def list_model_files(self):
return self.list_files(self.model_dir()) return self.list_files(self.model_dir())
def list_files(self, data_dir, relative=False): def list_files(self, data_dir, relative=False, group_by_directories=False):
files = [] files = []
dirs = [data_dir] dirs = [data_dir]
while dirs: while dirs:
...@@ -305,6 +306,11 @@ run `poetry add {pkg}` from directory: \n ...@@ -305,6 +306,11 @@ run `poetry add {pkg}` from directory: \n
if relative: if relative:
child = child.relative_to(data_dir) child = child.relative_to(data_dir)
files.append(child) files.append(child)
if group_by_directories:
files_ = defaultdict(list)
for file in files:
files_[file.parent.name].append(file)
files = dict(files_)
return files return files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment