+
    Bi                        R t ^ RIt^ RIt^ RIt^ RIHt ^ RIt^ RIt^ RIH	t	H
t
Ht ^RIHtHt ^RIHtHtHtHtHtHtHt ^RIHtHtHt ^RIHtHtHtHtHt RR R	 llt RR
 R llt! ! R R4      t"R R lt#RR R llt$R# )z5
The main Pooch class and a factory function for it.
NPath)UnionOptionalAny)hash_matches	file_hash)check_version
get_loggermake_local_storagecache_locationtemporary_fileos_cacheunique_file_name)DOIDownloaderchoose_downloaderdoi_to_repository)PathTypePathInputType	Processor
DownloaderActionc                    V ^8  d   QhR\         R\        \         ,          R\        \         ,          R\        \        ,          R\        \        ,          R\        \        ,          R\
        R\         /# )	   url
known_hashfnamepath	processor
downloaderprogressbarreturn)strr   r   r   r   bool)formats   "H/var/www/html/photoedit/myenv/lib/python3.14/site-packages/pooch/core.py__annotate__r&   "   sy     ^ ^	^^ C=^ 8
	^
 	"^ $^ ^ 	^    c                   Vf   \        R4      pVf   \        V 4      p\        VRRR7      pVP                  4       V,          p\	        Wq4      w  rVR9   d   \        V4       \        4       P                  RV	V \        V4      4       Vf   \        WR7      p\        WWRR7       Vf-   \        4       P                  R\        \        V4      4      4       Ve   V! \        V4      VR4      # \        V4      # )	a-  
Download and cache a single file locally.

Uses HTTP or FTP by default, depending on the protocol in the given *url*.
Other download methods can be controlled through the *downloader* argument
(see below).

The file will be downloaded to a temporary location first and its hash will
be compared to the given *known_hash*. This is done to ensure that the
download happened correctly and securely. If the hash doesn't match, the
file will be deleted and an exception will be raised.

If the file already exists locally, its hash will be compared to
*known_hash*. If they are not the same, this is interpreted as the file
needing to be updated and it will be downloaded again.

You can bypass these checks by passing ``known_hash=None``. If this is
done, the SHA256 hash of the downloaded file will be logged to the screen.
It is highly recommended that you copy and paste this hash as *known_hash*
so that future downloads are guaranteed to be the exact same file. This is
crucial for reproducible computations.

If the file exists in the given *path* with the given *fname* and the hash
matches, it will not be downloaded and the absolute path to the file will
be returned.

.. note::

    This function is meant for downloading single files. If you need to
    manage the download and caching of several files, with versioning, use
    :func:`pooch.create` and :class:`pooch.Pooch` instead.

Parameters
----------
url : str
    The URL to the file that is to be downloaded. Ideally, the URL should
    end in a file name.
known_hash : str or None
    A known hash (checksum) of the file. Will be used to verify the
    download or check if an existing file needs to be updated. By default,
    will assume it's a SHA256 hash. To specify a different hashing method,
    prepend the hash with ``algorithm:``, for example
    ``md5:pw9co2iun29juoh`` or ``sha1:092odwhi2ujdp2du2od2odh2wod2``. If
    None, will NOT check the hash of the downloaded file or check if an
    existing file needs to be updated.
fname : str or None
    The name that will be used to save the file. Should NOT include the
    full path, just the file name (it will be appended to *path*). If
    None, will create a unique file name using a combination of the last
    part of the URL (assuming it's the file name) and the MD5 hash of the
    URL. For example, ``81whdo2d2e928yd1wi22-data-file.csv``. This ensures
    that files from different URLs never overwrite each other, even if they
    have the same name.
path : str or PathLike or None
    The location of the cache folder on disk. This is where the file will
    be saved. If None, will save to a ``pooch`` folder in the default cache
    location for your operating system (see :func:`pooch.os_cache`).
processor : None or callable
    If not None, then a function (or callable object) that will be called
    before returning the full path and after the file has been downloaded
    (if required). See :ref:`processors` for details.
downloader : None or callable
    If not None, then a function (or callable object) that will be called
    to download a given URL to a provided local file name. See
    :ref:`downloaders` for details.
progressbar : bool or an arbitrary progress bar object
    If True, will print a progress bar of the download to standard error
    (stderr). Requires `tqdm <https://github.com/tqdm/tqdm>`__ to be
    installed. Alternatively, an arbitrary progress bar object can be
    passed. See :ref:`custom-progressbar` for details.

Returns
-------
full_path : str
    The absolute path (including the file name) of the file in the local
    storage.

Examples
--------

Download one of the data files from the Pooch repository on GitHub:

>>> import os
>>> from pooch import __version__, check_version, retrieve
>>> # Make a URL for the version of pooch we have installed
>>> url = "https://github.com/fatiando/pooch/raw/{}/data/tiny-data.txt"
>>> url = url.format(check_version(__version__, fallback="main"))
>>> # Download the file and save it locally. Will check the MD5 checksum of
>>> # the downloaded file against the given value to make sure it's the
>>> # right file. You can use other hashes by specifying different
>>> # algorithm names (sha256, sha1, etc).
>>> fname = retrieve(
...     url, known_hash="md5:70e2afd3fd7e336ae478b1e740a5f08e",
... )
>>> with open(fname) as f:
...     print(f.read().strip())
# A tiny data file for test purposes only
1  2  3  4  5  6
>>> # Running again won't trigger a download and only return the path to
>>> # the existing file.
>>> fname2 = retrieve(
...     url, known_hash="md5:70e2afd3fd7e336ae478b1e740a5f08e",
... )
>>> print(fname2 == fname)
True
>>> os.remove(fname)

Files that are compressed with gzip, xz/lzma, or bzip2 can be automatically
decompressed by passing using the :class:`pooch.Decompress` processor:

>>> from pooch import Decompress
>>> # URLs to a gzip compressed version of the data file.
>>> url = ("https://github.com/fatiando/pooch/raw/{}/"
...        + "pooch/tests/data/tiny-data.txt.gz")
>>> url = url.format(check_version(__version__, fallback="main"))
>>> # By default, you would have to decompress the file yourself
>>> fname = retrieve(
...     url,
...     known_hash="md5:8812ba10b6c7778014fdae81b03f9def",
... )
>>> print(os.path.splitext(fname)[1])
.gz
>>> # Use the processor to decompress after download automatically and
>>> # return the path to the decompressed file instead.
>>> fname2 = retrieve(
...     url,
...     known_hash="md5:8812ba10b6c7778014fdae81b03f9def",
...     processor=Decompress(),
... )
>>> print(fname2 == fname)
False
>>> with open(fname2) as f:
...     print(f.read().strip())
# A tiny data file for test purposes only
1  2  3  4  5  6
>>> os.remove(fname)
>>> os.remove(fname2)

When downloading archives (zip or tar), it can be useful to unpack them
after download to avoid having to do that yourself. Use the processors
:class:`pooch.Unzip` or :class:`pooch.Untar` to do this automatically:

>>> from pooch import Unzip
>>> # URLs to a zip archive with a single data file.
>>> url = ("https://github.com/fatiando/pooch/raw/{}/"
...        + "pooch/tests/data/tiny-data.zip")
>>> url = url.format(check_version(__version__, fallback="main"))
>>> # By default, you would get the path to the archive
>>> fname = retrieve(
...     url,
...     known_hash="md5:e9592cb46cf3514a1079051f8a148148",
... )
>>> print(os.path.splitext(fname)[1])
.zip
>>> os.remove(fname)
>>> # Using the processor, the archive will be unzipped and a list with the
>>> # path to every file will be returned instead of a single path.
>>> fnames = retrieve(
...     url,
...     known_hash="md5:e9592cb46cf3514a1079051f8a148148",
...     processor=Unzip(),
... )
>>> # There was only a single file in our archive.
>>> print(len(fnames))
1
>>> with open(fnames[0]) as f:
...     print(f.read().strip())
# A tiny data file for test purposes only
1  2  3  4  5  6
>>> for f in fnames:
...     os.remove(f)


Npooch)envversionz%s data from '%s' to file '%s'.r    )r)   zSHA256 hash of downloaded file: %s
Use this value as the 'known_hash' argument of 'pooch.retrieve' to ensure that the file hasn't changed if it is downloaded again in the future.downloadupdate)r   r   r   resolvedownload_actionr   r
   infor"   r   stream_downloadr   )
r   r   r   r   r   r   r    	full_pathactionverbs
   &&&&&&&   r%   retriever7   "   s    n | } %$D$7D&I"99LF'' 	4 -	N		
 *3HJ
dKL" #i.) Y66y>r'   c                    V ^8  d   QhR\         R\        R\        \        ,          R\        R\        \        ,          R\        \        ,          R\        \        ,          R\        R	\
        \        \        3,          /	# )
r   r   base_urlr+   version_devr*   registryurlsretry_if_failedallow_updates)r   r"   r   dictintr   r#   )r$   s   "r%   r&   r&     s     t t
tt c]t 	t
 
#t tnt 4.t t s#tr'   c	           	     B   Ve   \        W#R7      pVP                  VR7      p\        WV4      p \        V\        4      '       d2   \
        P                  P                  VR4      P                  4       R8g  pVP                  R4      R,           p\        V VVVVVR7      p	V	# )a  
Create a :class:`~pooch.Pooch` with sensible defaults to fetch data files.

If a version string is given, the Pooch will be versioned, meaning that the
local storage folder and the base URL depend on the project version. This
is necessary if your users have multiple versions of your library installed
(using virtual environments) and you updated the data files between
versions. Otherwise, every time a user switches environments would trigger
a re-download of the data. The version string will be appended to the local
storage path (for example, ``~/.mypooch/cache/v0.1``) and inserted into the
base URL (for example,
``https://github.com/fatiando/pooch/raw/v0.1/data``). If the version string
contains ``+XX.XXXXX``, it will be interpreted as a development version.

Does **not** create the local data storage folder. The folder will only be
created the first time a download is attempted with
:meth:`pooch.Pooch.fetch`. This makes it safe to use this function at the
module level (so it's executed on ``import`` and the resulting
:class:`~pooch.Pooch` is a global variable).

Parameters
----------
path : str, PathLike, list or tuple
    The path to the local data storage folder. If this is a list or tuple,
    we'll join the parts with the appropriate separator. The *version* will
    be appended to the end of this path. Use :func:`pooch.os_cache` for a
    sensible default.
base_url : str
    Base URL for the remote data source. All requests will be made relative
    to this URL. The string should have a ``{version}`` formatting mark in
    it. We will call ``.format(version=version)`` on this string. If the
    URL does not end in a ``'/'``, a trailing ``'/'`` will be added
    automatically.
version : str or None
    The version string for your project. Should be PEP440 compatible. If
    None is given, will not attempt to format *base_url* and no subfolder
    will be appended to *path*.
version_dev : str
    The name used for the development version of a project. If your data is
    hosted on Github (and *base_url* is a Github raw link), then
    ``"master"`` is a good choice (default). Ignored if *version* is None.
env : str or None
    An environment variable that can be used to overwrite *path*. This
    allows users to control where they want the data to be stored. We'll
    append *version* to the end of this value as well.
registry : dict or None
    A record of the files that are managed by this Pooch. Keys should be
    the file names and the values should be their hashes. Only files
    in the registry can be fetched from the local storage. Files in
    subdirectories of *path* **must use Unix-style separators** (``'/'``)
    even on Windows.
urls : dict or None
    Custom URLs for downloading individual files in the registry. A
    dictionary with the file names as keys and the custom URLs as values.
    Not all files in *registry* need an entry in *urls*. If a file has an
    entry in *urls*, the *base_url* will be ignored when downloading it in
    favor of ``urls[fname]``.
retry_if_failed : int
    Retry a file download the specified number of times if it fails because
    of a bad connection or a hash mismatch. By default, downloads are only
    attempted once (``retry_if_failed=0``). Initially, will wait for 1s
    between retries and then increase the wait time by 1s with each retry
    until a maximum of 10s.
allow_updates : bool or str
    Whether existing files in local storage that have a hash mismatch with
    the registry are allowed to update from the remote URL. If a string is
    passed, we will assume it's the name of an environment variable that
    will be checked for the true/false value. If ``False``, any mismatch
    with hashes in the registry will result in an error. Defaults to
    ``True``.

Returns
-------
pooch : :class:`~pooch.Pooch`
    The :class:`~pooch.Pooch` initialized with the given arguments.

Examples
--------

Create a :class:`~pooch.Pooch` for a release (v0.1):

>>> pup = create(path="myproject",
...              base_url="http://some.link.com/{version}/",
...              version="v0.1",
...              registry={"data.txt": "9081wo2eb2gc0u..."})
>>> print(pup.path.parts)  # The path is a pathlib.Path
('myproject', 'v0.1')
>>> # The local folder is only created when a dataset is first downloaded
>>> print(pup.path.exists())
False
>>> print(pup.base_url)
http://some.link.com/v0.1/
>>> print(pup.registry)
{'data.txt': '9081wo2eb2gc0u...'}
>>> print(pup.registry_files)
['data.txt']

If this is a development version (12 commits ahead of v0.1), then the
``version_dev`` will be used (defaults to ``"master"``):

>>> pup = create(path="myproject",
...              base_url="http://some.link.com/{version}/",
...              version="v0.1+12.do9iwd")
>>> print(pup.path.parts)
('myproject', 'master')
>>> print(pup.base_url)
http://some.link.com/master/

Versioning is optional (but highly encouraged):

>>> pup = create(path="myproject",
...              base_url="http://some.link.com/",
...              registry={"data.txt": "9081wo2eb2gc0u..."})
>>> print(pup.path.parts)  # The path is a pathlib.Path
('myproject',)
>>> print(pup.base_url)
http://some.link.com/

To place the storage folder at a subdirectory, pass in a list and we'll
join the path for you using the appropriate separator for your operating
system:

>>> pup = create(path=["myproject", "cache", "data"],
...              base_url="http://some.link.com/{version}/",
...              version="v0.1")
>>> print(pup.path.parts)
('myproject', 'cache', 'data', 'v0.1')

The user can overwrite the storage path by setting an environment variable:

>>> # The variable is not set so we'll use *path*
>>> pup = create(path=["myproject", "not_from_env"],
...              base_url="http://some.link.com/{version}/",
...              version="v0.1",
...              env="MYPROJECT_DATA_DIR")
>>> print(pup.path.parts)
('myproject', 'not_from_env', 'v0.1')
>>> # Set the environment variable and try again
>>> import os
>>> os.environ["MYPROJECT_DATA_DIR"] = os.path.join("myproject", "env")
>>> pup = create(path=["myproject", "not_env"],
...              base_url="http://some.link.com/{version}/",
...              version="v0.1",
...              env="MYPROJECT_DATA_DIR")
>>> print(pup.path.parts)
('myproject', 'env', 'v0.1')

)fallback)r+   truefalse/)r   r9   r;   r<   r=   r>   )r	   r$   r   
isinstancer"   osenvirongetlowerrstripPooch)
r   r9   r+   r:   r*   r;   r<   r=   r>   pups
   &&&&&&&&& r%   createrN     s    ~ >??7?3 $W-D-%%

}f=CCEPs#c)H
'#C Jr'   c                      a  ] tR tRt o RtRV 3R lR llt]V 3R lR l4       t]V 3R lR	 l4       tRV 3R
 lR llt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltRV 3R lR lltRtV tR# )rL   i  a  
Manager for a local data storage that can fetch from a remote source.

Avoid creating ``Pooch`` instances directly. Use :func:`pooch.create`
instead.

Parameters
----------
path : str
    The path to the local data storage folder. The path must exist in the
    file system.
base_url : str
    Base URL for the remote data source. All requests will be made relative
    to this URL.
registry : dict or None
    A record of the files that are managed by this good boy. Keys should be
    the file names and the values should be their hashes. Only files
    in the registry can be fetched from the local storage. Files in
    subdirectories of *path* **must use Unix-style separators** (``'/'``)
    even on Windows.
urls : dict or None
    Custom URLs for downloading individual files in the registry. A
    dictionary with the file names as keys and the custom URLs as values.
    Not all files in *registry* need an entry in *urls*. If a file has an
    entry in *urls*, the *base_url* will be ignored when downloading it in
    favor of ``urls[fname]``.
retry_if_failed : int
    Retry a file download the specified number of times if it fails because
    of a bad connection or a hash mismatch. By default, downloads are only
    attempted once (``retry_if_failed=0``). Initially, will wait for 1s
    between retries and then increase the wait time by 1s with each retry
    until a maximum of 10s.
allow_updates : bool
    Whether existing files in local storage that have a hash mismatch with
    the registry are allowed to update from the remote URL. If ``False``,
    any mismatch with hashes in the registry will result in an error.
    Defaults to ``True``.

Nc                   < V ^8  d   QhRS[ RS[RS[S[S[S[3,          ,          RS[S[S[S[3,          ,          RS[RS[RR/# )	r   r   r9   r;   r<   r=   r>   r!   N)r   r"   r   r?   r@   r#   )r$   __classdict__s   "r%   r&   Pooch.__annotate__  sk     + ++ + 4S>*	+
 tCH~&+ + + 
+r'   c                z    Wn         W n        Vf   / pW0n        Vf   / p\        V4      V n        WPn        W`n        R # N)r   r9   r;   r?   r<   r=   r>   )selfr   r9   r;   r<   r=   r>   s   &&&&&&&r%   __init__Pooch.__init__  s?     	 H <DJ	.*r'   c                    < V ^8  d   QhRS[ /# r   r!   r   )r$   rQ   s   "r%   r&   rR     s     I I Ir'   c           	         \        \        P                  P                  \        P                  P	                  \        V P                  4      4      4      4      # )z"Absolute path to the local storage)r   rG   r   abspath
expanduserr"   rU   s   &r%   r[   Pooch.abspath  s3     BGGOOBGG$6$6s499~$FGHHr'   c                0   < V ^8  d   QhRS[ S[,          /# rY   )listr"   )r$   rQ   s   "r%   r&   rR     s     # #S	 #r'   c                ,    \        V P                  4      # )z"List of file names on the registry)r`   r;   r]   s   &r%   registry_filesPooch.registry_files  s     DMM""r'   c          
      X   < V ^8  d   QhRS[ RS[S[,          RS[S[,          RS[RS[ /# )r   r   r   r   r    r!   )r"   r   r   r   r#   )r$   rQ   s   "r%   r&   rR     sN     a aa I&a Z(	a
 a 
ar'   c           	     B   V P                  V4       V P                  V4      pV P                  V,          pV P                  V,          p\	        Wg4      w  rVR8X  d$   V P
                  '       g   \        V RV R24      hVR9   dz   \        \        V P                  4      4       \        4       P                  RV	VV\        V P                  4      4       Vf   \        WTR7      p\        VVVVV V P                  R7       Ve   V! \        V4      W4      # \        V4      # )a  
Get the absolute path to a file in the local storage.

If it's not in the local storage, it will be downloaded. If the hash of
the file in local storage doesn't match the one in the registry, will
download a new copy of the file. This is considered a sign that the
file was updated in the remote storage. If the hash of the downloaded
file still doesn't match the one in the registry, will raise an
exception to warn of possible file corruption.

Post-processing actions sometimes need to be taken on downloaded files
(unzipping, conversion to a more efficient format, etc). If these
actions are time or memory consuming, it would be best to do this only
once right after the file is downloaded. Use the *processor* argument
to specify a function that is executed after the download to perform
these actions. See :ref:`processors` for details.

Custom file downloaders can be provided through the *downloader*
argument. By default, Pooch will determine the download protocol from
the URL in the registry. If the server for a given file requires
authentication (username and password), use a downloader that support
these features. Downloaders can also be used to print custom messages
(like a progress bar), etc. See :ref:`downloaders` for details.

Parameters
----------
fname : str
    The file name (relative to the *base_url* of the remote data
    storage) to fetch from the local storage.
processor : None or callable
    If not None, then a function (or callable object) that will be
    called before returning the full path and after the file has been
    downloaded. See :ref:`processors` for details.
downloader : None or callable
    If not None, then a function (or callable object) that will be
    called to download a given URL to a provided local file name. See
    :ref:`downloaders` for details.
progressbar : bool or an arbitrary progress bar object
    If True, will print a progress bar of the download to standard
    error (stderr). Requires `tqdm <https://github.com/tqdm/tqdm>`__ to
    be installed. Alternatively, an arbitrary progress bar object can
    be passed. See :ref:`custom-progressbar` for details.

Returns
-------
full_path : str
    The absolute path (including the file name) of the file in the
    local storage.

r/   z needs to update z but updates are disallowed.z%s file '%s' from '%s' to '%s'.r,   )r)   r=   r-   )_assert_file_in_registryget_urlr[   r;   r1   r>   
ValueErrorr   r"   r
   r2   r   r3   r=   )
rU   r   r   r   r    r   r4   r   r5   r6   s
   &&&&&     r%   fetchPooch.fetch  s   r 	%%e,ll5!LL5(	]]5)
&y=Xd&8&8&8'*9+5QR  ++ s4<<01L1DLL! !.sL
 $ 4 4  S^V::9~r'   c                $   < V ^8  d   QhRS[ RR/# r   r   r!   Nr"   )r$   rQ   s   "r%   r&   rR   d  s     H Hc Hd Hr'   c                D    WP                   9  d   \        RV R24      hR# )zO
Check if a file is in the registry and raise :class:`ValueError` if
it's not.
zFile 'z' is not in the registry.N)r;   rh   rU   r   s   &&r%   rf   Pooch._assert_file_in_registryd  s(    
 %veW,EFGG &r'   c                &   < V ^8  d   QhRS[ RS[ /# )r   r   r!   rm   )r$   rQ   s   "r%   r&   rR   l  s     E ES ES Er'   c                    V P                  V4       V P                  P                  VRP                  V P                  V.4      4      # )z
Get the full URL to download a file in the registry.

Parameters
----------
fname : str
    The file name (relative to the *base_url* of the remote data
    storage) to fetch from the local storage.

 )rf   r<   rI   joinr9   ro   s   &&r%   rg   Pooch.get_urll  s9     	%%e,yy}}UBGGT]]E,B$CDDr'   c                $   < V ^8  d   QhRS[ RR/# rl   )r   )r$   rQ   s   "r%   r&   rR   z  s     1E 1E8 1E 1Er'   c                   \         P                  ! 4       ;_uu_ 4       p\        VR4      '       d   TpMVP                  \	        VRR7      4      p\        V4       EF  w  rE\        V\        4      '       d   VP                  R4      pVP                  4       pVP                  R4      '       d   KV  \        P                  ! V4      p\        V4      R9   g)   \        RV RV^,            R\        V4       RV R	2	4      hV'       g   K  V^ ,          pV^,          p\        V4      ^8X  d   V^,          p	WP                  V&   VP!                  4       V P"                  V&   EK  	  R
R
R
4       R
#   + '       g   i     R
# ; i)aJ  
Load entries from a file and add them to the registry.

Use this if you are managing many files.

Each line of the file should have file name and its hash separated by
a space. Hash can specify checksum algorithm using "alg:hash" format.
In case no algorithm is provided, SHA256 is used by default.
Only one file per line is allowed. Custom download URLs for individual
files can be specified as a third element on the line. Line comments
can be added and must be prepended with ``#``.

Parameters
----------
fname : str | fileobj
    Path (or open file object) to the registry file.

readzutf-8)encoding#z&Invalid entry in Pooch registry file 'z$': expected 2 or 3 elements in line z	 but got z. Offending entry: ''N)    r      )
contextlib	ExitStackhasattrenter_contextopen	enumeraterF   bytesdecodestrip
startswithshlexsplitlenOSErrorr<   rJ   r;   )
rU   r   stackfinlinenumlineelements	file_namefile_checksumfile_urls
   &&        r%   load_registryPooch.load_registryz  s?   & !!##uuf%%  ))$uw*GH!*3dE**;;w/Dzz|??3'' ;;t,8}	1!@ H<<CaK=	x=/)=dV1F 
 8 (I$,QKM8})#+A;/7		),/</B/B/DDMM),- "0 $###s   BE./AE.	AE..E?	c                   < V ^8  d   QhRR/# )r   r!   N )r$   rQ   s   "r%   r&   rR     s     !2 !2 !2r'   c                N   \        V P                  4      p\        V\        4      '       g!   \	        RV P                   R2R,           4      hV P                  P                  RR4      p\        V3RVP                  RVP                  /VP                  B pVP                  V 4      # )ar  
Populate the registry using the data repository API

Fill the registry with all the files available in the data repository,
along with their hashes. It will make a request to the data repository
API to retrieve this information. No file is downloaded during this
process.

.. important::

    This method is intended to be used only when the ``base_url`` is
    a DOI.
zInvalid base_url 'z': z9Pooch.load_registry_from_doi is only implemented for DOIszdoi:rs   headerstimeout)r   r9   rF   r   rh   replacer   r   r   kwargspopulate_registry)rU   r   doi
repositorys   &   r%   load_registry_from_doiPooch.load_registry_from_doi  s      't}}5
*m44$T]]O37MN  mm##FB/&
&&
 &&
 	

 ++D11r'   c                6   < V ^8  d   QhRS[ RS[S[,          /# )r   r   r   )r"   r   r   )r$   rQ   s   "r%   r&   rR     s      " "# "8J3G "r'   c                    V P                  V4       V P                  V4      pVf   \        V4      p V! VRV RR7      pV#   \         d!   pR\	        T4       R2p\        T4      ThRp?ii ; i)a5  
Check availability of a remote file without downloading it.

Use this method when working with large files to check if they are
available for download.

Parameters
----------
fname : str
    The file name (relative to the *base_url* of the remote data
    storage).
downloader : None or callable
    If not None, then a function (or callable object) that will be
    called to check the availability of the file on the server. See
    :ref:`downloaders` for details.

Returns
-------
status : bool
    True if the file is available for download. False otherwise.

NT)
check_onlyzDownloader 'z'' does not support availability checks.)rf   rg   r   	TypeErrorr"   NotImplementedError)rU   r   r   r   	availableerror	error_msgs   &&&    r%   is_availablePooch.is_available  s    . 	%%e,ll5!*3/J	<"3dtDI   	<s://VW  &i0e;		<s   A A,A''A,)r>   r9   r   r;   r=   r<   )NNr|   T)NNFrT   )__name__
__module____qualname____firstlineno____doc__rV   propertyr[   rb   ri   rf   rg   r   r   r   __static_attributes____classdictcell__)rQ   s   @r%   rL   rL     s     &P+ +( I I # #a aFH HE E1E 1Ef!2 !2F" " "r'   rL   c                t    V ^8  d   QhR\         R\        \        ,          R\        \        \        3,          /# )r   r   r   r!   )r   r   r"   tupler   )r$   s   "r%   r&   r&     s.      $ HSM eFCK>P r'   c                p    V P                  4       '       g   R# \        \        V 4      V4      '       g   R# R# )aR  
Determine the action that is needed to get the file on disk.

Parameters
----------
path : PathLike
    The path to the file on disk.
known_hash : str
    A known hash (checksum) of the file. Will be used to verify the
    download or check if an existing file needs to be updated. By default,
    will assume it's a SHA256 hash. To specify a different hashing method,
    prepend the hash with ``algorithm:``, for example
    ``md5:pw9co2iun29juoh`` or ``sha1:092odwhi2ujdp2du2od2odh2wod2``.

Returns
-------
action, verb : str
    The action that must be taken and the English verb (infinitive form of
    *action*) used in the log:
    * ``'download'``: File does not exist locally and must be downloaded.
    * ``'update'``: File exists locally but needs to be updated.
    * ``'fetch'``: File exists locally and only need to inform its path.


)r.   Downloading)r/   Updating)ri   Fetching)existsr   r"   )r   r   s   &&r%   r1   r1     s2    4 ;;==((D	:..##r'   c                    V ^8  d   QhR\         R\        R\        \         ,          R\        R\        \        ,          R\
        RR/# )	r   r   r   r   r   r)   r=   r!   N)r"   r   r   r   rL   r@   )r$   s   "r%   r&   r&     sV     0- 0-	0-0- 0- 	0-
 E?0- 0- 
0-r'   c                B   ^ RI pVP                  P                  4       '       g*   \        P                  ! \        VP                  4      4       ^V,           p^
p\        V4       F  p	 \        \        VP                  4      R7      ;_uu_ 4       p
V! W
V4       \        WR\        VP                  4      R7       \        P                  ! V
\        V4      4       RRR4        R# 	  R#   + '       g   i     L; i  \        TP                  P                  3 d    Y^,
          8X  d   h Yy^,           ,
          p\        4       P!                  R\        TP                  4      TT^8  d   RMR4       \"        P$                  ! \'        T	^,           T4      4        EK9  i ; i)a  
Stream the file and check that its hash matches the known one.

The file is first downloaded to a temporary file name in the cache folder.
It will be moved to the desired file name only if the hash matches the
known hash. Otherwise, the temporary file is deleted.

If the download fails for either a bad connection or a hash mismatch, we
will retry the download the specified number of times in case the failure
was due to a network error.
N)r   T)strictsourcezHFailed to download '%s'. Will attempt the download again %d more time%s.srs   )requests.exceptionsparentr   rG   makedirsr"   ranger   r   nameshutilmoverh   
exceptionsRequestExceptionr
   r2   timesleepmin)r   r   r   r   r)   r=   requestsdownload_attemptsmax_waititmpretries_lefts   &&&&&&      r%   r3   r3     s8   (  <<  
C%&O+H$%	-  S%67733U+ST#ejj/RCU, 8  & 87
 H//@@A 	-)),A6LLBEJJ#a'R JJs1q5(+,,	-s,   ('C<AC)C<)C94C<<BFF)NNNNNF)NmasterNNNr|   T)Nr|   )%r   rG   r   r~   pathlibr   r   r   typingr   r   r   hashesr   r   utilsr	   r
   r   r   r   r   r   downloadersr   r   r   r   r   r   r   r   r7   rN   rL   r1   r3   r   r'   r%   <module>r      sr    
      ' ' ,   M L J J^Btnx xv	B0- 0-r'   