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 URL

  • cache_file (Optional[str]) – see fetch_url()

  • cache_dir (Optional[str]) – see fetch_url()

  • force_download (bool) – see fetch_url()

  • session (Optional[Session]) – see fetch_url()

  • cache_layout (str) – see fetch_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