Use configuration in foursquare module
This commit is contained in:
parent
e11adb3a09
commit
661218ebe9
2 changed files with 28 additions and 4 deletions
14
my/common.py
14
my/common.py
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue