def datapath4file(filename): "Returns URLs.DATA path if file exists. Otherwise returns config path" local_path = URLs.LOCAL_PATH / 'data' / filename if local_path.exists(): return local_path else: return Config.data_path() / filename
def datapath4file(filename, folder): "Return data path to `filename`, checking locally first then in the config file." local_path = URLs.LOCAL_PATH / folder if local_path.exists(): return local_path / filename else: return Config.data_path() / folder / filename