mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
feat: input.hadrons._get_files optimized
This commit is contained in:
parent
5bd8e8402b
commit
8c95ca8318
1 changed files with 2 additions and 8 deletions
|
@ -10,16 +10,10 @@ from ..npr import Npr_matrix
|
|||
|
||||
|
||||
def _get_files(path, filestem):
|
||||
ls = []
|
||||
for (dirpath, dirnames, filenames) in os.walk(path):
|
||||
ls.extend(filenames)
|
||||
break
|
||||
ls = os.listdir(path)
|
||||
|
||||
# Clean up file list
|
||||
files = []
|
||||
for line in ls:
|
||||
if line.startswith(filestem):
|
||||
files.append(line)
|
||||
files = list(filter(lambda x: x.startswith(filestem), ls))
|
||||
|
||||
if not files:
|
||||
raise Exception('No files starting with', filestem, 'in folder', path)
|
||||
|
|
Loading…
Add table
Reference in a new issue