local_copy#
- pypillometry.local_copy(source, cache_file=None, cache_dir=None, autodelete=None, force_download=False, session=None, cache_layout='flat')[source]#
Context manager that gives a local filename for source.
HTTP(S) and SSH URLs are downloaded with
fetch_url(); local paths are passed through unchanged (and never deleted).- Parameters:
source (
str) – local path, HTTP(S) URL or SSH URLcache_file (
Optional[str]) – seefetch_url()cache_dir (
Optional[str]) – seefetch_url()force_download (
bool) – seefetch_url()session (
Optional[Session]) – seefetch_url()cache_layout (
str) – seefetch_url()autodelete (
Optional[bool]) – if True, the downloaded copy (also in cache_file/cache_dir) is deleted when the context is left, i.e. after the file was read; a temporary directory is removed completely. If None (default), only a temporary directory (no cache_file/cache_dir) is removed.
- Yields:
str – local filename