Add expand_pairlist method

This commit is contained in:
Matthias
2020-12-30 09:55:44 +01:00
parent 2fdda8e448
commit 704cf14383
4 changed files with 60 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
import re
from typing import List
def expand_pairlist(wildcardpl: List[str], available_pairs: List[str]) -> List[str]:
"""
TODO: Add docstring here
"""
result = []
for pair_wc in wildcardpl:
try:
comp = re.compile(pair_wc)
result += [
pair for pair in available_pairs if re.match(comp, pair)
]
except re.error as err:
raise ValueError(f"Wildcard error in {pair_wc}, {err}")
return result