ó
    Ì›‘hé  ã                   óv   • S SK r S SKrS SKJr  S SKJr   " S S\ R                  5      rS rS r	S
S jr
SS	 jrg)é    N)Úerror)Úunivc                   ó�   • \ rS rSrSrS rS rS rS\R                  4S jr
SS jr\S	 5       r\R                  S
 5       rS rSrg)ÚCachingStreamWrapperé   a  Wrapper around non-seekable streams.

Note that the implementation is tied to the decoder,
not checking for dangerous arguments for the sake
of performance.

The read bytes are kept in an internal cache until
setting _markedPosition which may reset the cache.
c                 óR   • Xl         [        R                  " 5       U l        SU l        g ©Nr   )Ú_rawÚioÚBytesIOÚ_cacheÚ_markedPosition)ÚselfÚraws     ÚZC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\pyasn1/codec/streaming.pyÚ__init__ÚCachingStreamWrapper.__init__   s   € ØŒ	Ü—j’j“lˆŒØ ˆÕó    c                 ó�   • U R                  U5      nU R                  R                  [        U5      * [        R
                  5        U$ ©N)Úreadr   ÚseekÚlenÚosÚSEEK_CUR)r   ÚnÚresults      r   ÚpeekÚCachingStreamWrapper.peek   s2   € Ø—‘˜1“ˆØ�‰×Ñœ#˜f›+˜¤r§{¡{Ô3Øˆr   c                 ó   • g)NT© ©r   s    r   ÚseekableÚCachingStreamWrapper.seekable!   s   € Ør   éÿÿÿÿc                 ó8   • U R                   R                  X5      $ r   )r   r   )r   r   Úwhences      r   r   ÚCachingStreamWrapper.seek$   s   € à�{‰{×Ñ Ó*Ð*r   c                 óæ   • U R                   R                  U5      nUS:w  a  U[        U5      -  nU(       d  U$ U R                  R                  U5      nU R                   R	                  U5        X#-   $ )Nr%   )r   r   r   r
   Úwrite)r   r   Úread_from_cacheÚread_from_raws       r   r   ÚCachingStreamWrapper.read(   sb   € ØŸ+™+×*Ñ*¨1Ó-ˆØ�‹7Ø”�_Ó%Ñ%ˆAÞØ&Ð&àŸ	™	Ÿ™ qÓ)ˆà�‰×Ñ˜-Ô(àÑ.Ð.r   c                 ó   • U R                   $ )zùPosition where the currently processed element starts.

This is used for back-tracking in SingleItemDecoder.__call__
and (indefLen)ValueDecoder and should not be used for other purposes.
The client is not supposed to ever seek before this position.
)r   r"   s    r   ÚmarkedPositionÚ#CachingStreamWrapper.markedPosition5   s   € ð ×#Ñ#Ð#r   c                 óÞ   • Xl         U R                  R                  5       [        R                  :”  a;  [        R
                  " U R                  R                  5       5      U l        SU l         g g r	   )r   r   Útellr   ÚDEFAULT_BUFFER_SIZEr   r   )r   Úvalues     r   r/   r0   ?   sQ   € ð
  %Ôð
 �;‰;×ÑÓ¤× 6Ñ 6Ó6ÜŸ*š* T§[¡[×%5Ñ%5Ó%7Ó8ˆDŒKØ#$ˆDÕ ð 7r   c                 ó6   • U R                   R                  5       $ r   )r   r2   r"   s    r   r2   ÚCachingStreamWrapper.tellM   s   € Ø�{‰{×ÑÓ!Ð!r   )r   r   r
   N©r%   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r#   r   ÚSEEK_SETr   r   Úpropertyr/   Úsetterr2   Ú__static_attributes__r!   r   r   r   r      s^   † ñò!ò
ò
ð  §¡ô +ô/ð ñ$ó ð$ð ×Ññ%ó ð%õ"r   r   c                 óâ  • [        U [        R                  5      (       a  U $ [        U [        5      (       a  [        R                  " U 5      $ [        U [        R
                  5      (       a$  [        R                  " U R                  5       5      $  U R                  5       (       a  U $ [        U 5      $ ! [         a1    [        R                  " SU R                  R                  -   S-   5      ef = f)a=  Convert object to seekable byte-stream.

Parameters
----------
substrate: :py:class:`bytes` or :py:class:`io.IOBase` or :py:class:`univ.OctetString`

Returns
-------
: :py:class:`io.IOBase`

Raises
------
: :py:class:`~pyasn1.error.PyAsn1Error`
    If the supplied substrate cannot be converted to a seekable stream.
zCannot convert z to a seekable bit stream.)Ú
isinstancer   r   Úbytesr   ÚOctetStringÚasOctetsr#   r   ÚAttributeErrorr   ÚUnsupportedSubstrateErrorÚ	__class__r8   )Ú	substrates    r   ÚasSeekableStreamrJ   Q   sÅ   € ô  �)œRŸZ™Z×(Ñ(ØÐä	�Iœu×	%Ñ	%Ü�zŠz˜)Ó$Ð$ä	�Iœt×/Ñ/×	0Ñ	0Ü�zŠz˜)×,Ñ,Ó.Ó/Ð/ð	*Ø×Ñ×ÑØÐä'¨	Ó2Ð2øäó *Ü×-Ò-Ø 	× 3Ñ 3× <Ñ <Ñ<Ø(ñ)ó*ð 	*ð*ús   ÂB3 Â(
B3 Â3;C.c              #   óª  #   • [        U [        R                  5      (       ah  U R                  5       nU R	                  S[
        R                  5        U R                  5       U:H  nU R	                  U[
        R                  5        Uv •  gU R                  S5      nUc  Sv •  U(       a   U R	                  S[
        R                  5        U(       + v •  g7f)zëCheck whether we have reached the end of a stream.

Although it is more effective to read and catch exceptions, this
function

Parameters
----------
substrate: :py:class:`IOBase`
    Stream to check

Returns
-------
: :py:class:`bool`
r   é   Nr%   )
rB   r   r   r2   r   r   ÚSEEK_ENDr=   r   r   )rI   Úcpr   Úreceiveds       r   ÚisEndOfStreamrP   v   s”   é € ô �)œRŸZ™Z×(Ñ(Ø�^‰^ÓˆØ�‰�qœ"Ÿ+™+Ô&Ø—‘Ó! RÑ'ˆØ�‰�rœ2Ÿ;™;Ô'Ø‹ð —>‘> !Ó$ˆØÑÛæØ�N‰N˜2œrŸ{™{Ô+àŒlÓùs   ‚CCc              #   óL  #   • [        U S5      (       aA  U R                  U5      nUc  Sv •  [        U5      U:  a  Sv •  [        U5      U:  a  M  Uv •  gU R                  5       n [	        X5       H  nUv •  M	     U R                  U5        g! U R                  U5        f = f7f)a  Peek into stream.

Parameters
----------
substrate: :py:class:`IOBase`
    Stream to read from.

size: :py:class:`int`
    How many bytes to peek (-1 = all available)

Returns
-------
: :py:class:`bytes` or :py:class:`str`
    The return type depends on Python major version
r   N)Úhasattrr   r   r2   ÚreadFromStreamr   )rI   ÚsizerO   Úcurrent_positionÚchunks        r   ÚpeekIntoStreamrW   —   s“   é € ô  ˆy˜&×!Ñ!Ø—>‘> $Ó'ˆØÑÛä�(‹m˜dÓ"Ûô �(‹m˜dÕ"ð ‹ð %Ÿ>™>Ó+Ðð	-Ü'¨	Ö8�Ø”ñ 9ð �N‰NÐ+Õ,øˆI�N‰NÐ+Õ,üs$   ‚AB$ÁB$Á&B Á<B$ÂB!Â!B$c              #   óT  #   •  U R                  U5      nUc  [        R                  " US9v •  OrU(       d  US:w  a  [        R                  " US9e[	        U5      U:  aA  U R                  [	        U5      * [        R                  5        [        R                  " US9v •  OOMŸ  Uv •  g7f)a¶  Read from the stream.

Parameters
----------
substrate: :py:class:`IOBase`
    Stream to read from.

Keyword parameters
------------------
size: :py:class:`int`
    How many bytes to read (-1 = all available)

context: :py:class:`dict`
    Opaque caller context will be attached to exception objects created
    by this function.

Yields
------
: :py:class:`bytes` or :py:class:`str` or :py:class:`SubstrateUnderrunError`
    Read data or :py:class:`~pyasn1.error.SubstrateUnderrunError`
    object if no `size` bytes is readily available in the stream. The
    data type depends on Python major version

Raises
------
: :py:class:`~pyasn1.error.EndOfStreamError`
    Input stream is exhausted
N)Úcontextr   )r   r   ÚSubstrateUnderrunErrorÚEndOfStreamErrorr   r   r   r   )rI   rT   rY   rO   s       r   rS   rS   »   s‘   é € ð: à—>‘> $Ó'ˆØÑÜ×.Ò.°wÑ?Ó?æ˜d a›iÜ×(Ò(°Ñ9Ð9ä�‹]˜TÓ!Ø�N‰NœC ›M˜>¬2¯;©;Ô7ô ×.Ò.°wÑ?Ó?ð ñ! ð$ ƒNùs   ‚B&B(r7   )r%   N)r   r   Úpyasn1r   Úpyasn1.typer   ÚIOBaser   rJ   rP   rW   rS   r!   r   r   Ú<module>r_      s=   ðó 
Û 	å Ý ôA"˜2Ÿ9™9ô A"òH"*òJôB!-õH/r   