§
    2?ÄjMF  ã                   óž  — d Z ddlmZ ddlZddlZddlZddlZddlZddl	Z	ddl
Z
 e
j        d¦  «        Zdej        v Zej                             ej                             e¦  «        ¦  «        Zd„ Zdd„Zdd	„Z G d
„ dej        ¦  «        ZeZd„ Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zdd„Zd„ Z d„ Z!d„ Z"d„ Z#dS )z
Various utilities for imageio
é    )ÚOrderedDictNÚimageioÚ__pypy__c                  ó\   — 	 ddl m} n# t          $ r t          d¦  «        ‚w xY w || i |¤ŽS )zžCompatibility function for the urlopen function. Raises an
    RuntimeError if urlopen could not be imported (which can occur in
    frozen applications.
    r   )ÚurlopenzCould not import urlopen.)Úurllib.requestr   ÚImportErrorÚRuntimeError)ÚargsÚkwargsr   s      úBC:\Projects\Historical\venv\Lib\site-packages\imageio/core/util.pyr   r      s[   € ð
8Ø*Ð*Ð*Ð*Ð*Ð*Ð*øÝð 8ð 8ð 8ÝÐ6Ñ7Ô7Ð7ð8øøøàˆ7�DÐ#˜FÐ#Ð#Ð#s   ‚	 ‰#Ú c                 ój   — d}t                                |                     | |||¦  «        ¦  «         d S )Nz`Lossy conversion from {} to {}. {} Convert image to {} prior to saving to suppress this warning.)ÚloggerÚwarningÚformat)Úp1Úp2ÚextraÚts       r   Ú_precision_warnr   #   s8   € ð	+ð õ ‡N‚N�1—8’8˜B  E¨2Ñ.Ô.Ñ/Ô/Ð/Ð/Ð/ó    c                 óú  — |sd}t          | t          j        ¦  «        st          d¦  «        ‚|dk    rt          j        }n"|dk    rt          j        }nt          d¦  «        ‚t          | j        ¦  «        }|j        }| j        t          j        k    r|dk    s| j        t          j        k    r|dk    r| S | 	                    d¦  «        r~t          j
        | ¦  «        dk    rft          j        | ¦  «        dk    rNt          ||d¦  «         |                      t          j        ¦  «        t          j        d	|¦  «        dz
  z  d
z   } �nØ| j        t          j        k    r.|dk    r(t          ||d¦  «         t          j        | d¦  «        } �n•| j        t          j        k    rAt          ||d                     d|z
  ¦  «        ¦  «         t          j        | d|z
  ¦  «        } �n?| j        t          j        k    r@t          ||d                     d|z
  ¦  «        ¦  «         t          j        | d|z
  ¦  «        } nêt          j
        | ¦  «        }t          j        | ¦  «        }t          j        |¦  «        st          d¦  «        ‚t          j        |¦  «        st          d¦  «        ‚||k    r|                      |¦  «        S t          ||d                     ||¦  «        ¦  «         |                      d¦  «        } | |z
  ||z
  z  t          j        d	|¦  «        dz
  z  d
z   } t          j
        | ¦  «        dk    sJ ‚t          j        | ¦  «        t          j        d	|¦  «        k     sJ ‚|                      |¦  «        S )a¹  Convert the given image to uint (default: uint8)

    If the dtype already matches the desired format, it is returned
    as-is. If the image is float, and all values are between 0 and 1,
    the values are multiplied by np.power(2.0, bitdepth). In all other
    situations, the values are scaled such that the minimum value
    becomes 0 and the maximum value becomes np.power(2.0, bitdepth)-1
    (255 for 8-bit and 65535 for 16-bit).
    é   zImage must be a numpy arrayé   zBitdepth must be either 8 or 16Úfloatr   é   zRange [0, 1].g       @gAíþÿÿß?zLosing 8 bits of resolution.zLosing {} bits of resolution.é    é@   z!Minimum image value is not finitez!Maximum image value is not finitezRange [{}, {}].Úfloat64)Ú
isinstanceÚnpÚndarrayÚ
ValueErrorÚuint8Úuint16ÚstrÚdtypeÚ__name__Ú
startswithÚnanminÚnanmaxr   Úastyper    ÚpowerÚright_shiftÚuint32r   Úuint64Úisfinite)ÚimÚbitdepthÚout_typeÚ
dtype_str1Ú
dtype_str2ÚmiÚmas          r   Úimage_as_uintr:   +   s<  € ð ð ØˆÝ�b�"œ*Ñ%Ô%ð 8ÝÐ6Ñ7Ô7Ð7Ø�1‚}€}Ý”8ˆˆØ	�RŠˆÝ”9ˆˆåÐ:Ñ;Ô;Ð;Ý�R”X‘”€JØÔ"€JØ
Œ•B”HÒÐ ¨Q¢ Ø
Œ•B”IÒÐ (¨b¢. .ð ˆ	Ø×Ò˜WÑ%Ô%ð !Q­"¬)°B©-¬-¸1Ò*<Ð*<ÅÄÈ2ÁÄÐRSÒASÐASÝ˜
 J°Ñ@Ô@Ð@Ø�YŠY•r”zÑ"Ô"¥b¤h¨s°HÑ&=Ô&=ÀÑ&AÑBÀ[ÑPˆ‰Ø	Œ•R”YÒ	Ð	 8¨q¢= =Ý˜
 JÐ0NÑOÔOÐOÝŒ^˜B Ñ"Ô"ˆ‰Ø	Œ•R”YÒ	Ð	ÝØØØ+×2Ò2°2¸±=ÑAÔAñ	
ô 	
ð 	
õ
 Œ^˜B  X¡Ñ.Ô.ˆ‰Ø	Œ•R”YÒ	Ð	ÝØØØ+×2Ò2°2¸±=ÑAÔAñ	
ô 	
ð 	
õ
 Œ^˜B  X¡Ñ.Ô.ˆˆåŒY�r‰]Œ]ˆÝŒY�r‰]Œ]ˆÝŒ{˜2‰Œð 	BÝÐ@ÑAÔAÐAÝŒ{˜2‰Œð 	BÝÐ@ÑAÔAÐAØ�Š8ˆ8Ø—9’9˜XÑ&Ô&Ð&Ý˜
 JÐ0A×0HÒ0HÈÈRÑ0PÔ0PÑQÔQÐQà�YŠY�yÑ!Ô!ˆà�2‰g˜"˜r™'Ñ"¥b¤h¨s°HÑ&=Ô&=ÀÑ&AÑBÀ[ÑPˆÝŒ9�R‰=Œ=˜AÒÐÐÐÝŒ9�R‰=Œ=�2œ8 C¨Ñ2Ô2Ò2Ð2Ð2Ð2Ø�9Š9�XÑÔÐr   c                   óD   — e Zd ZdZd	d„Zd„ Zed„ ¦   «         Zd„ Zd
d„Z	dS )ÚArrayzÙArray(array, meta=None)

    A subclass of np.ndarray that has a meta attribute. Get the dictionary
    that contains the meta data using ``im.meta``. Convert to a plain numpy
    array using ``np.asarray(im)``.

    Nc                 óJ  — t          |t          j        ¦  «        st          d¦  «        ‚|�$t          |t          ¦  «        st          d¦  «        ‚|�|nt          |di ¦  «        }	 |                     | ¦  «        }n# t          $ r |cY S w xY w|                     |¦  «         |S )NzArray expects a numpy array.z%Array expects meta data to be a dict.Úmeta)	r!   r"   r#   r$   ÚdictÚgetattrÚviewÚAttributeErrorÚ
_copy_meta)ÚclsÚarrayr>   Úobs       r   Ú__new__zArray.__new__v   s´   € å˜%¥¤Ñ,Ô,ð 	=ÝÐ;Ñ<Ô<Ð<Ø�¥
¨4µÑ 6Ô 6�ÝÐDÑEÔEÐEàÐ'ˆtˆt­W°U¸FÀBÑ-GÔ-Gˆð	Ø—’˜C‘”ˆBˆBøÝð 	ð 	ð 	àˆLˆLˆLð	øøøð 	�Š�dÑÔÐØˆ	s   Á&A< Á<BÂ
Bc                 ó¼   — t          ¦   «         | _        |                     ¦   «         D ]3\  }}t          |t          ¦  «        rt          |¦  «        }|| j        |<   Œ4dS )z0Make a 2-level deep copy of the meta dictionary.N)ÚDictÚ_metaÚitemsr!   r?   )Úselfr>   ÚkeyÚvals       r   rC   zArray._copy_meta†   s\   € å‘V”VˆŒ
ØŸ
š
™œð 	"ð 	"‰HˆC�Ý˜#�tÑ$Ô$ð  Ý˜3‘i”i�Ø!ˆDŒJ�s‰OˆOð	"ð 	"r   c                 ó   — | j         S )z*The dict with the meta data of this image.)rJ   ©rL   s    r   r>   z
Array.metaŽ   s   € ð ŒzÐr   c                 ó’   — t          |t          ¦  «        r|                      |j        ¦  «         dS |                      i ¦  «         dS )zWSo the meta info is maintained when doing calculations with
        the array.
        N)r!   r<   rC   r>   )rL   rF   s     r   Ú__array_finalize__zArray.__array_finalize__“   sH   € õ �b�%Ñ Ô ð 	 Ø�OŠO˜BœGÑ$Ô$Ð$Ð$Ð$à�OŠO˜BÑÔÐÐÐr   Fc                 ó   — |s|j         s|j                             |¦  «        S |j         | j         k    r |                     t          j        ¬¦  «        S t          |t          ¦  «        st          || j        ¦  «        S |S )z‚So that we return a native numpy array (or scalar) when a
        reducting ufunc is applied (such as sum(), std(), etc.)
        ©Útype)	Úshaper(   rU   rA   r"   r#   r!   r<   r>   )rL   ÚoutÚcontextÚreturn_scalars       r   Ú__array_wrap__zArray.__array_wrap__œ   sw   € ð ð 	 ¤	ð 	Ø”9—>’> #Ñ&Ô&Ð&ØŒY˜$œ*Ò$Ð$Ø—8’8¥¤�8Ñ,Ô,Ð,Ý˜C¥Ñ'Ô'ð 	Ý˜˜dœiÑ(Ô(Ð(àˆJr   ©N©NF)
r)   Ú
__module__Ú__qualname__Ú__doc__rG   rC   Úpropertyr>   rR   rZ   © r   r   r<   r<   m   s   € € € € € ðð ðð ð ð ð "ð "ð "ð ðð ñ „Xðð ð  ð  ðð ð ð ð ð r   r<   c                 óØ   — t          | t          j        ¦  «        r=t          r|                      ¦   «         } |                      t          j        ¬¦  «        }|S t          j        | ¦  «        S )z�Pypy-safe version of np.asarray. Pypy's np.asarray consumes a
    *lot* of memory if the given array is an ndarray subclass. This
    function does not.
    rT   )r!   r"   r#   ÚIS_PYPYÚcopyrA   Úasarray)ÚaÚplains     r   re   re   ­   sU   € õ
 �!•R”ZÑ Ô ð Ýð 	Ø—’‘”ˆAØ—’�BœJ�Ñ'Ô'ˆØˆÝŒ:�a‰=Œ=Ðr   c                   óp   — e Zd ZdZ e e¦   «         ¦  «        Z e e¦   «         ¦  «        Zd„ Z	d„ Z
d„ ZdS )rI   aš  A dict in which the keys can be get and set as if they were
    attributes. Very convenient in combination with autocompletion.

    This Dict still behaves as much as possible as a normal dict, and
    keys can be anything that are otherwise valid keys. However,
    keys that are not valid identifiers or that are names of the dict
    class (such as 'items' and 'copy') cannot be get/set as attributes.
    c                 ót   — 	 t                                | |¦  «        S # t          $ r || v r
| |         cY S ‚ w xY wr[   )ÚobjectÚ__getattribute__rB   )rL   rM   s     r   rk   zDict.__getattribute__Ç   sT   € ð	Ý×*Ò*¨4°Ñ5Ô5Ð5øÝð 	ð 	ð 	Ø�dˆ{ˆ{Ø˜C”yÐ Ð Ð àð		øøøs   ‚ �7µ7c                 óž   — |t           j        v r9|t           j        vrt          j        | ||¦  «        S t          dd|z  z   ¦  «        ‚|| |<   d S )Nz!Reserved name, this key can only zbe set via ``d[%r] = X``)rI   Ú__reserved_names__Ú__pure_names__r   Ú__setattr__rB   )rL   rM   rN   s      r   ro   zDict.__setattr__Ð   sd   € Ø•$Ô)Ð)Ð)à�$Ô-Ð-Ð-Ý"Ô.¨t°S¸#Ñ>Ô>Ð>å$Ø7Ø0°3Ñ6ñ7ñô ð ð ˆD�‰IˆIˆIr   c                 óh   ‡— d„ Šˆfd„|                       ¦   «         D ¦   «         }t          j        |z   S )Nc                 ó\   — t          t          j        d| t          j        ¦  «        ¦  «        S )Nz
[a-z_]\w*$)ÚboolÚreÚmatchÚI)Úxs    r   Úisidentifierz"Dict.__dir__.<locals>.isidentifierß   s    € Ý�œ °µ2´4Ñ8Ô8Ñ9Ô9Ð9r   c                 óT   •— g | ]$}t          |t          ¦  «        ¯ ‰|¦  «        ¯"|‘Œ%S ra   )r!   r'   )Ú.0Úkrw   s     €r   ú
<listcomp>z Dict.__dir__.<locals>.<listcomp>â   s6   ø€ ÐTÐTÐT�q­J°q½#Ñ,>Ô,>ÐTÀ<À<ÐPQÁ?Ä?ÐT�ÐTÐTÐTr   )ÚkeysrI   rm   )rL   Únamesrw   s     @r   Ú__dir__zDict.__dir__Þ   sD   ø€ ð	:ð 	:ð 	:ð UÐTÐTÐT˜DŸIšI™KœKÐTÑTÔTˆÝÔ&¨Ñ.Ð.r   N)r)   r]   r^   r_   Údirr   rm   r?   rn   rk   ro   r~   ra   r   r   rI   rI   º   sv   € € € € € ðð ð ˜˜[˜[™]œ]Ñ+Ô+ÐØ�S˜˜™œ‘[”[€Nðð ð ðð ð ð/ð /ð /ð /ð /r   rI   c                   ób   — e Zd ZdZd„ Zdd„Zd„ Zdd„Zd	„ Zdd„Z	dd„Z
d„ Zd„ Zd„ Zd„ Zd„ Zd
S )ÚBaseProgressIndicatoraÓ  BaseProgressIndicator(name)

    A progress indicator helps display the progress of a task to the
    user. Progress can be pending, running, finished or failed.

    Each task has:
      * a name - a short description of what needs to be done.
      * an action - the current action in performing the task (e.g. a subtask)
      * progress - how far the task is completed
      * max - max number of progress units. If 0, the progress is indefinite
      * unit - the units in which the progress is counted
      * status - 0: pending, 1: in progress, 2: finished, 3: failed

    This class defines an abstract interface. Subclasses should implement
    _start, _stop, _update_progress(progressText), _write(message).
    c                 óZ   — || _         d| _        d| _        d| _        d| _        d| _        d S )Nr   r   )Ú_nameÚ_actionÚ_unitÚ_maxÚ_statusÚ_last_progress_update)rL   Únames     r   Ú__init__zBaseProgressIndicator.__init__ø   s3   € ØˆŒ
ØˆŒØˆŒ
ØˆŒ	ØˆŒØ%&ˆÔ"Ð"Ð"r   r   r   c                 ó²   — | j         dk    r|                      ¦   «          || _        || _        || _        d| _        d| _         |                      ¦   «          dS )z’start(action='', unit='', max=0)

        Start the progress. Optionally specify an action, a unit,
        and a maximum progress value.
        r   r   N)r‡   Úfinishr„   r…   r†   Ú	_progressÚ_start)rL   ÚactionÚunitÚmaxs       r   ÚstartzBaseProgressIndicator.start   sR   € ð Œ<˜1ÒÐØ�KŠK‰MŒMˆMØˆŒØˆŒ
ØˆŒ	àˆŒØˆŒØ�Š‰Œˆˆˆr   c                 ó   — | j         S )zvstatus()

        Get the status of the progress - 0: pending, 1: in progress,
        2: finished, 3: failed
        )r‡   rP   s    r   ÚstatuszBaseProgressIndicator.status  s   € ð Œ|Ðr   Fc                 óž  — || _         |s!t          j        ¦   «         | j        z
  dk    sdS t          j        ¦   «         | _        | j        pd}d}|dk    rd|z  }n^| j        dk    r)dt          |¦  «        z  | j        z  }d|| j        ||fz  }n*|dk    r$t          |t
          ¦  «        rd	||fz  }nd
||fz  }|                      |¦  «         dS )zôset_progress(progress=0, force=False)

        Set the current progress. To avoid unnecessary progress updates
        this will only have a visual effect if the time since the last
        update is > 0.1 seconds, or if force is True.
        gš™™™™™¹?Nr   ú%z%2.1f%%r   éd   z%i/%i %s (%2.1f%%)z%0.4g %sz%i %s)r�   Útimerˆ   r…   r†   r   r!   Ú_update_progress)rL   ÚprogressÚforcer�   ÚprogressTextÚpercents         r   Úset_progressz"BaseProgressIndicator.set_progress  sò   € ð "ˆŒàð 	�$œ)™+œ+¨Ô(BÑBÀSÒHÐHØˆFÝ%)¤Y¡[¤[ˆÔ"àŒzÐ˜RˆØˆØ�3Š;ˆ;Ø$ xÑ/ˆLˆLØŒY˜Š]ˆ]Ø�E (™OœOÑ+¨d¬iÑ7ˆGØ/°8¸T¼YÈÈgÐ2VÑVˆLˆLØ˜Š\ˆ\Ý˜(¥EÑ*Ô*ð :Ø)¨X°tÐ,<Ñ<��à&¨(°DÐ)9Ñ9�à×Ò˜lÑ+Ô+Ð+Ð+Ð+r   c                 ó@   — |                       | j        |z   ¦  «         dS )z^increase_progress(extra_progress)

        Increase the progress by a certain amount.
        N)rž   r�   )rL   Úextra_progresss     r   Úincrease_progressz'BaseProgressIndicator.increase_progress4  s%   € ð
 	×Ò˜$œ.¨>Ñ9Ñ:Ô:Ð:Ð:Ð:r   Nc                 ó¤   — |                       | j        d¦  «         d| _        |                      ¦   «          |�|                      |¦  «         dS dS )z“finish(message=None)

        Finish the progress, optionally specifying a message. This will
        not set the progress to the maximum.
        Té   N©rž   r�   r‡   Ú_stopÚ_write©rL   Úmessages     r   rŒ   zBaseProgressIndicator.finish;  sV   € ð 	×Ò˜$œ.¨$Ñ/Ô/Ð/ØˆŒØ�
Š
‰ŒˆØÐØ�KŠK˜Ñ Ô Ð Ð Ð ð Ðr   c                 óª   — |                       | j        d¦  «         d| _        |                      ¦   «          d|pdz   }|                      |¦  «         dS )zgfail(message=None)

        Stop the progress with a failure, optionally specifying a message.
        Té   zFAIL r   Nr¤   r§   s     r   ÚfailzBaseProgressIndicator.failG  sV   € ð
 	×Ò˜$œ.¨$Ñ/Ô/Ð/ØˆŒØ�
Š
‰ŒˆØ˜W˜]¨Ñ+ˆØ�Š�GÑÔÐÐÐr   c                 ón   — | j         t          k    rt          |¦  «         dS |                      |¦  «        S )zUwrite(message)

        Write a message during progress (such as a warning).
        N)Ú	__class__r�   Úprintr¦   r§   s     r   ÚwritezBaseProgressIndicator.writeR  s3   € ð
 Œ>Õ2Ò2Ð2å�'‰NŒNˆNˆNˆNà—;’;˜wÑ'Ô'Ð'r   c                 ó   — d S r[   ra   rP   s    r   rŽ   zBaseProgressIndicator._start_  ó   € Øˆr   c                 ó   — d S r[   ra   rP   s    r   r¥   zBaseProgressIndicator._stopb  r±   r   c                 ó   — d S r[   ra   )rL   rœ   s     r   r™   z&BaseProgressIndicator._update_progresse  r±   r   c                 ó   — d S r[   ra   r§   s     r   r¦   zBaseProgressIndicator._writeh  r±   r   )r   r   r   )r   Fr[   )r)   r]   r^   r_   rŠ   r’   r”   rž   r¡   rŒ   r«   r¯   rŽ   r¥   r™   r¦   ra   r   r   r�   r�   æ   sæ   € € € € € ðð ð"'ð 'ð 'ðð ð ð ð ð ð ð,ð ,ð ,ð ,ð8;ð ;ð ;ð
!ð 
!ð 
!ð 
!ð	ð 	ð 	ð 	ð	(ð 	(ð 	(ðð ð ðð ð ðð ð ðð ð ð ð r   r�   c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚStdoutProgressIndicatorz±StdoutProgressIndicator(name)

    A progress indicator that shows the progress in stdout. It
    assumes that the tty can appropriately deal with backspace
    characters.
    c                 ó  — d\  | _         | _        | j        r| j        ›d| j        ›d�| _         nd| j        z  | _         t          j                             | j         ¦  «         t          j                             ¦   «          d S )N)r   r   z (z): z%s: )Ú_chars_prefixÚ_charsr„   rƒ   ÚsysÚstdoutr¯   ÚflushrP   s    r   rŽ   zStdoutProgressIndicator._startt  sy   € Ø*0Ñ'ˆÔ˜DœKàŒ<ð 	5Ø04´
°
°
¸D¼L¸L¸LÐ!IˆDÔÐà!'¨$¬*Ñ!4ˆDÔÝŒ
×Ò˜Ô+Ñ,Ô,Ð,ÝŒ
×ÒÑÔÐÐÐr   c                 ó(  — |s,d\  }}}}||||||||i}|                      | j        |¦  «        }dt          | j        ¦  «        z  }|| _        t          j                             || j        z   ¦  «         t          j                             ¦   «          d S )Nz-\|/ú)Úgetr¹   Úlenrº   r»   r¯   r¼   )rL   rœ   Úi1Úi2Úi3Úi4ÚMÚdelCharss           r   r™   z(StdoutProgressIndicator._update_progress~  s”   € àð 	2Ø$‰NˆB��B˜Ø�R˜˜R  R¨¨RÐ0ˆAØŸ5š5 ¤¨bÑ1Ô1ˆLà�#˜dœkÑ*Ô*Ñ*ˆØ"ˆŒÝŒ
×Ò˜ D¤KÑ/Ñ0Ô0Ð0ÝŒ
×ÒÑÔÐÐÐr   c                 óœ   — dx| _         | _        t          j                             d¦  «         t          j                             ¦   «          d S )Nr   ú
)r¹   r¸   rº   r»   r¯   r¼   rP   s    r   r¥   zStdoutProgressIndicator._stopŠ  sA   € Ø+-Ð-ˆŒ�dÔ(ÝŒ
×Ò˜ÑÔÐÝŒ
×ÒÑÔÐÐÐr   c                 ó(  — dt          | j        | j        z   ¦  «        z  }t          j                             |dz   |z   dz   ¦  «         t          j                             | j        | j        z   ¦  «         t          j                             ¦   «          d S )Nr¾   z  rÈ   )rÀ   r¸   r¹   rº   r»   r¯   r¼   )rL   r¨   rÆ   s      r   r¦   zStdoutProgressIndicator._write�  s|   € à�#˜dÔ0°4´;Ñ>Ñ?Ô?Ñ?ˆÝŒ
×Ò˜ D™¨7Ñ2°TÑ9Ñ:Ô:Ð:åŒ
×Ò˜Ô+¨d¬kÑ9Ñ:Ô:Ð:ÝŒ
×ÒÑÔÐÐÐr   N)r)   r]   r^   r_   rŽ   r™   r¥   r¦   ra   r   r   r¶   r¶   l  sZ   € € € € € ðð ðð ð ð
ð 
ð 
ðð ð ð
ð ð ð ð r   r¶   Fc                 ó¬  — t          j        dd¦  «        }|€@t           j                             d¦  «        }t           j                             |¦  «        sd}d}t
          j                             d¦  «        r3t          j        d¦  «        t          j        d¦  «        }}|r|p|n|p|}n@t
          j                             d¦  «        r!t           j                             |d	d
¦  «        }|rt           j                             |¦  «        s|}t
          j	        }t          t
          dd¦  «        rFt           j                             t           j                             t
          j        ¦  «        ¦  «        }dD ]å}t           j                             t           j                             ||¦  «        ¦  «        }t           j                             |¦  «        r‡	 t          t           j                             |d¦  «        d¦  «                             ¦   «          t          j        t           j                             |d¦  «        ¦  «         |} n# t"          $ r Y Œáw xY wŒæ| rs||k    rd|                      d¦  «        z   } t           j                             || ¦  «        }t           j                             |¦  «        st          j        |d¬¦  «         |S )aŽ  appdata_dir(appname=None, roaming=False)

    Get the path to the application directory, where applications are allowed
    to write user specific files (e.g. configurations). For non-user specific
    data, consider using common_appdata_dir().
    If appname is given, a subdir is appended (and created if necessary).
    If roaming is True, will prefer a roaming directory (Windows Vista/7).
    ÚIMAGEIO_USERDIRNú~z/var/tmpÚwinÚLOCALAPPDATAÚAPPDATAÚdarwinÚLibraryzApplication SupportÚfrozen)Úsettingsz../settingsz
test.writeÚwbú.T)Úexist_ok)ÚosÚgetenvÚpathÚ
expanduserÚisdirrº   Úplatformr*   ÚjoinÚprefixr@   ÚabspathÚdirnameÚ
executableÚopenÚcloseÚremoveÚIOErrorÚlstripÚmakedirs)	ÚappnameÚroamingÚuserDirrÙ   Úpath1Úpath2rÞ   ÚreldirÚ	localpaths	            r   Úappdata_dirrï   ™  so  € õ ŒiÐ)¨4Ñ0Ô0€GØ€Ý”'×$Ò$ SÑ)Ô)ˆÝŒw�}Š}˜WÑ%Ô%ð 	!Ø ˆGð €DÝ
„|×Ò˜uÑ%Ô%ð GÝ”y Ñ0Ô0µ"´)¸IÑ2FÔ2FˆuˆØ#*Ð@��˜ø°°¸%ˆˆÝ	Œ×	 Ò	  Ñ	*Ô	*ð GÝŒw�|Š|˜G YÐ0EÑFÔFˆàð •R”W—]’] 4Ñ(Ô(ð Øˆõ ŒZ€FÝ�s�H˜dÑ#Ô#ð BÝ”—’¥¤§¢µ´Ñ!@Ô!@ÑAÔAˆØ-ð 
ð 
ˆÝ”G—O’O¥B¤G§L¢L°¸Ñ$@Ô$@ÑAÔAˆ	ÝŒ7�=Š=˜Ñ#Ô#ð 	ðÝ•R”W—\’\ )¨\Ñ:Ô:¸DÑAÔA×GÒGÑIÔIÐIÝ”	�"œ'Ÿ,š, y°,Ñ?Ô?Ñ@Ô@Ð@ð !�Ø�øõ	 ð ð ð Ø�ðøøøð		ð ð -Ø�7Š?ˆ?Ø˜GŸNšN¨3Ñ/Ô/Ñ/ˆGÝŒw�|Š|˜D 'Ñ*Ô*ˆÝŒw�}Š}˜TÑ"Ô"ð 	-ÝŒK˜ tÐ,Ñ,Ô,Ð,ð €Ks   ÇA2IÉ
IÉIc                  ó,  — t          ¦   «         g} 	 |                      t          d¦  «        ¦  «         n# t          $ r Y nw xY wt	          t
          dd¦  «        rZ|                      t          j                             t          j         	                    t
          j
        ¦  «        ¦  «        ¦  «         n`t
          j        rTt
          j        d         rB|                      t          j                             t
          j        d         ¦  «        ¦  «         | S )a†  resource_dirs()

    Get a list of directories where imageio resources may be located.
    The first directory in this list is the "resources" directory in
    the package itself. The second directory is the appdata directory
    (~/.imageio on Linux). The list further contains the application
    directory (for frozen apps), and may include additional directories
    in the future.
    r   rÒ   Nr   )Úresource_package_dirÚappendrï   Ú	Exceptionr@   rº   r×   rÙ   rß   rà   rá   )Údirss    r   Úresource_dirsrõ   Ò  sß   € õ !Ñ"Ô"Ð#€DðØ�Š•K 	Ñ*Ô*Ñ+Ô+Ð+Ð+øÝð ð ð Øˆðøøøõ �s�H˜dÑ#Ô#ð 2Ø�Š•B”G—O’O¥B¤G§O¢OµC´NÑ$CÔ$CÑDÔDÑEÔEÐEÐEÝ	Œð 2•c”h˜q”kð 2Ø�Š•B”G—O’O¥C¤H¨Q¤KÑ0Ô0Ñ1Ô1Ð1Ø€Ks   ‘"4 ´
AÁ Ac                  ó^   — ddl } t          | j                             d¦  «        dz  ¦  «        S )zßpackage_dir

    Get the resources directory in the imageio package installation
    directory.

    Notes
    -----
    This is a convenience method that is used by `resource_dirs` and
    imageio entry point scripts.
    r   Nr   Ú	resources)Úimportlib.resourcesr'   r÷   Úfiles)Ú	importlibs    r   rñ   rñ   ë  s4   € ð ÐÐÐåˆyÔ"×(Ò(¨Ñ3Ô3°kÑAÑBÔBÐBr   c                  óJ  — t           j                             d¦  «        rd} nht           j                             d¦  «        rd} nFt           j                             d¦  «        rd} n$t           j                             d¦  «        rd} nd	S | t          j        d
¦  «        dz  z  S )zÜget_platform()

    Get a string that specifies the platform more specific than
    sys.platform does. The result can be: linux32, linux64, win32,
    win64, osx32, osx64. Other platforms may be added in the future.
    Úlinuxzlinux%irÍ   zwin%irÐ   zosx%iÚfreebsdz	freebsd%iNÚPr   )rº   rÜ   r*   ÚstructÚcalcsize)Úplats    r   Úget_platformr  û  sŸ   € õ „|×Ò˜wÑ'Ô'ð 	ØˆˆÝ	Œ×	 Ò	  Ñ	'Ô	'ð ØˆˆÝ	Œ×	 Ò	  Ñ	*Ô	*ð ØˆˆÝ	Œ×	 Ò	  Ñ	+Ô	+ð Øˆˆàˆtà•6”? 3Ñ'Ô'¨!Ñ+Ñ,Ð,r   c           	      óì   — ddl }|                      d¦  «        }t          t          |¦  «        ¦  «        D ]=}|j                             d                     |d|dz   …         ¦  «        ¦  «        € dS Œ>dS )z-Check to see if a python module is available.r   NrÕ   r   FT)rú   ÚsplitÚrangerÀ   ÚutilÚ	find_specrÝ   )Úmodule_namerú   Ú
name_partsÚis       r   Ú
has_moduler    s   € àÐÐÐà×"Ò" 3Ñ'Ô'€JÝ•3�z‘?”?Ñ#Ô#ð ð ˆØŒ>×#Ò# C§H¢H¨Z¸¸!¸a¹%¸Ô-@Ñ$AÔ$AÑBÔBÐJØ�5�5ð Kàˆ4r   )r   r[   r\   )$r_   Úcollectionsr   Únumpyr"   r×   rs   rÿ   rº   r˜   ÚloggingÚ	getLoggerr   Úbuiltin_module_namesrc   rÙ   rß   rà   Ú__file__ÚTHIS_DIRr   r   r:   r#   r<   ÚImagere   rI   rj   r�   r¶   rï   rõ   rñ   r  r  ra   r   r   ú<module>r     s  ððð ð $Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ø 	€	€	€	Ø 	€	€	€	Ø €€€Ø 
€
€
€
Ø €€€Ø €€€à	ˆÔ	˜9Ñ	%Ô	%€à
˜Ô0Ð
0€ØŒ7�?Š?˜2œ7Ÿ?š?¨8Ñ4Ô4Ñ5Ô5€ð	$ð 	$ð 	$ð0ð 0ð 0ð 0ð?ð ?ð ?ð ?ðD:ð :ð :ð :ð :ˆBŒJñ :ô :ð :ðz 	€ð
ð 
ð 
ð)/ð )/ð )/ð )/ð )/ˆ;ñ )/ô )/ð )/ðXCð Cð Cð Cð C˜Fñ Cô Cð CðL)ð )ð )ð )ð )Ð3ñ )ô )ð )ðZ6ð 6ð 6ð 6ðrð ð ð2Cð Cð Cð -ð -ð -ð,ð ð ð ð r   