Use configuration in foursquare module

This commit is contained in:
Dima Gerasimov 2019-11-27 12:01:29 +00:00
parent e11adb3a09
commit 661218ebe9
2 changed files with 28 additions and 4 deletions

View file

@ -93,3 +93,17 @@ def setup_logger(logger, level=None, format=None, datefmt=None):
PathIsh = Union[Path, str]
# TODO use glob or something? see in promnesia
def get_files(pp: PathIsh, glob: str) -> List[Path]:
"""
Helper function to avoid boilerplate.
"""
path = Path(pp)
if path.is_dir():
return list(sorted(path.glob(glob)))
else:
# TODO FIXME assert matches glob??
raise RuntimeError()
return path