
    ZVfk              	           d dl mZ d dl mZ d dl mZ d dlmZ	 d dl
mZmZ g dZeefZdedefd	Zdefd
Zdedeeef   fdZddedededefdZ	 ddedededefdZddededefdZddededefdZdedefdZy)    )	b64decode)	b64encode)encodebytes)Error)AnyUnion)_get_simd_name_get_simd_pathr   r   b64encode_as_stringr   flagsreturnc                     | dk(  sJ y)Nr   fallback )r   s    [/var/www/html/software/conda/envs/catlas/lib/python3.12/site-packages/pybase64/_fallback.pyr	   r	      s    A::    c                       y)Nr   r   r   r   r   r
   r
      s    r   sc                 ,   t        | t              r	 | j                  d      S t        | t
              r| S 	 t        |       j                         S # t        $ r t	        d      w xY w# t        $ r# t        d| j                  j                  z        w xY w)Nasciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r)
isinstancestrencodeUnicodeEncodeError
ValueError_bytes_types
memoryviewtobytes	TypeError	__class____name__r   s    r   
_get_bytesr#      s    !S	X88G$$ !\"
!}$$&& " 	XVWW	X  
 {{334
 	

s   A A' A$',BNaltcharsvalidatec                    |rt        |       dz  dk7  rt        d      t        |       } |Pt        |      }t        |      dk(  sJ t        |             t        j                  |d      }| j                  |      } t        | |d      }d}t        |       dkD  r| d	   d
v r|dz   }t        |       dkD  r| d   d
v r|dz   }dt        |       dz  z  |z
  t        |      k7  rt        d      |S t        | |d      S )a  Decode bytes encoded with the standard Base64 alphabet.

    Argument ``s`` is a :term:`bytes-like object` or ASCII string to
    decode.

    Optional ``altchars`` must be a :term:`bytes-like object` or ASCII
    string of length 2 which specifies the alternative alphabet used instead
    of the '+' and '/' characters.

    If ``validate`` is ``False`` (the default), characters that are neither in
    the normal base-64 alphabet nor the alternative alphabet are discarded
    prior to the padding check.
    If ``validate`` is ``True``, these non-alphabet characters in the input
    result in a :exc:`binascii.Error`.

    The result is returned as a :class:`bytes` object.

    A :exc:`binascii.Error` is raised if ``s`` is incorrectly padded.
       r   zIncorrect padding   s   +/F)r%      )   ==      zNon-base64 digit found)lenBinAsciiErrorr#   reprbytes	maketrans	translatebuiltin_decode)r   r$   r%   mapresultpaddings         r   r   r   .   s   ( q6A:? 344qM!(+Hx=A%5tH~5%//(E2CC A8e< q6A:!B%:-kGq6A:!B%:-kGA
g%V4 899!X66r   c                 0    t        t        | ||            S )a  Decode bytes encoded with the standard Base64 alphabet.

    Argument ``s`` is a :term:`bytes-like object` or ASCII string to
    decode.

    Optional ``altchars`` must be a :term:`bytes-like object` or ASCII
    string of length 2 which specifies the alternative alphabet used instead
    of the '+' and '/' characters.

    If ``validate`` is ``False`` (the default), characters that are neither in
    the normal base-64 alphabet nor the alternative alphabet are discarded
    prior to the padding check.
    If ``validate`` is ``True``, these non-alphabet characters in the input
    result in a :exc:`binascii.Error`.

    The result is returned as a :class:`bytearray` object.

    A :exc:`binascii.Error` is raised if ``s`` is incorrectly padded.
    )r$   r%   )	bytearrayr   )r   r$   r%   s      r   b64decode_as_bytearrayr;   Y   s    , Yq8hGHHr   c                 p    |)t        |      }t        |      dk(  sJ t        |             t        | |      S )a  Encode bytes using the standard Base64 alphabet.

    Argument ``s`` is a :term:`bytes-like object` to encode.

    Optional ``altchars`` must be a byte string of length 2 which specifies
    an alternative alphabet for the '+' and '/' characters.  This allows an
    application to e.g. generate url or filesystem safe Base64 strings.

    The result is returned as a :class:`bytes` object.
    r(   )r#   r/   r1   builtin_encoder   r$   s     r   r   r   r   s<     h'8}!14>1!!X&&r   c                 8    t        | |      j                  d      S )a  Encode bytes using the standard Base64 alphabet.

    Argument ``s`` is a :term:`bytes-like object` to encode.

    Optional ``altchars`` must be a byte string of length 2 which specifies
    an alternative alphabet for the '+' and '/' characters.  This allows an
    application to e.g. generate url or filesystem safe Base64 strings.

    The result is returned as a :class:`str` object.
    r   )r   decoder>   s     r   r   r      s     Q!((11r   c                     t        |       S )a-  Encode bytes into a bytes object with newlines (b'\\n') inserted after
    every 76 bytes of output, and ensuring that there is a trailing newline,
    as per :rfc:`2045` (MIME).

    Argument ``s`` is a :term:`bytes-like object` to encode.

    The result is returned as a :class:`bytes` object.
    )builtin_encodebytesr"   s    r   r   r      s     q!!r   )NF)N)base64r   r5   r   r=   r   rB   binasciir   r0   typingr   r   __all__r2   r:   r   intr   r	   r
   r#   boolr;   r   r   r   r   <module>rI      s    . . 5 +  y!# # 
 
# 
%y 01 
"(7 (7 (7d (7u (7X 49I
II,0II2' ' 'u '"23 2# 2 2	"3 	"5 	"r   