
    h                        S SK Jr  S SKJrJr  S SKJrJr  S SKJ	r	  S SK
Jr  S SKJrJrJr  SSKJrJrJrJrJrJr  SS	KJrJr   " S
 S\5      r " S S5      r " S S\\5      r " S S\\5      rg)    )annotations)CallableMapping)SEEK_SETUnsupportedOperation)PathLike)Path)AnyBinaryIOcast   )BrokenResourceErrorClosedResourceErrorEndOfStreamTypedAttributeSet	to_threadtyped_attribute)ByteReceiveStreamByteSendStreamc                  ^    \ rS rSr% \" 5       rS\S'   \" 5       rS\S'   \" 5       rS\S'   Sr	g	)
FileStreamAttribute   r   filer	   pathintfileno N)
__name__
__module____qualname____firstlineno__r   r   __annotations__r   r   __static_attributes__r       D/var/www/html/env/lib/python3.13/site-packages/anyio/streams/file.pyr   r      s)    $&D(& "D$"!#FC#r$   r   c                  <    \ rS rSrSS jrSS jr\S	S j5       rSrg)
_BaseFileStream   c                    Xl         g N_file)selfr   s     r%   __init___BaseFileStream.__init__   s    
r$   c                t   #    [         R                  " U R                  R                  5      I S h  vN   g  N7fr*   )r   run_syncr,   closer-   s    r%   aclose_BaseFileStream.aclose!   s#       !1!1222s   .868c                  ^  [         R                  U 4S j0n[        T R                  S5      (       a  U 4S jU[         R                  '    T R                  R                  5         U 4S jU[         R
                  '   U$ ! [         a     U$ f = f)Nc                    > T R                   $ r*   r+   r3   s   r%   <lambda>2_BaseFileStream.extra_attributes.<locals>.<lambda>'   s	    djjr$   namec                 B   > [        T R                  R                  5      $ r*   )r	   r,   r:   r3   s   r%   r8   r9   +   s    4

;Pr$   c                 8   > T R                   R                  5       $ r*   )r,   r   r3   s   r%   r8   r9   2   s    TZZ=N=N=Pr$   )r   r   hasattrr,   r   r   r   )r-   
attributess   ` r%   extra_attributes _BaseFileStream.extra_attributes$   s      $$&84

 4::v&&3PJ*//0	QJJ 6QJ*112 $ 	 	s   A> >
BBr+   N)r   r   )returnNone)rA   zMapping[Any, Callable[[], Any]])	r   r   r    r!   r.   r4   propertyr?   r#   r   r$   r%   r'   r'      s     3  r$   r'   c                  T    \ rS rSrSr\S	S j5       rS
SS jjr\4SS jjr	SS jr
Srg)FileReadStream7   z
A byte stream that reads from a file in the file system.

:param file: a file that has been opened for reading in binary mode

.. versionadded:: 3.0
c                   #    [         R                  " [        U5      R                  S5      I Sh  vN nU " [	        [
        U5      5      $  N7f)zc
Create a file read stream by opening the given file.

:param path: path of the file to read from

rbNr   r1   r	   openr   r   )clsr   r   s      r%   	from_pathFileReadStream.from_path@   s;      ''T
>>4$'(( ?s   .AAAc                   #     [         R                  " U R                  R                  U5      I S h  vN nU(       a  U$ [        e N! [         a    [
        S e[         a  n[        UeS nAff = f7fr*   )	r   r1   r,   read
ValueErrorr   OSErrorr   r   )r-   	max_bytesdataexcs       r%   receiveFileReadStream.receiveK   sd     	/"++DJJOOYGGD K H 	0%4/ 	/%3.	/s7   A1.A AA A1A A."A))A..A1c                t   #    [         R                  " U R                  R                  X5      I Sh  vN $  N7f)a5  
Seek the file to the given position.

.. seealso:: :meth:`io.IOBase.seek`

.. note:: Not all file descriptors are seekable.

:param position: position to seek the file to
:param whence: controls how ``position`` is interpreted
:return: the new absolute position
:raises OSError: if the file is not seekable

N)r   r1   r,   seek)r-   positionwhences      r%   rX   FileReadStream.seekX   s(      ''

JJJJs   /868c                r   #    [         R                  " U R                  R                  5      I Sh  vN $  N7f)z
Return the current stream position.

.. note:: Not all file descriptors are seekable.

:return: the current absolute position
:raises OSError: if the file is not seekable

N)r   r1   r,   tellr3   s    r%   r]   FileReadStream.tellh   s&      ''

8888s   .757r   N)r   str | PathLike[str]rA   rE   )i   )rR   r   rA   bytes)rY   r   rZ   r   rA   r   )rA   r   )r   r   r    r!   __doc__classmethodrL   rU   r   rX   r]   r#   r   r$   r%   rE   rE   7   s0     ) ) 7? K 
9r$   rE   c                  F    \ rS rSrSr\ S     SS jj5       rS	S jrSrg)
FileWriteStreamu   z
A byte stream that writes to a file in the file system.

:param file: a file that has been opened for writing in binary mode

.. versionadded:: 3.0
c                   #    U(       a  SOSn[         R                  " [        U5      R                  U5      I Sh  vN nU " [	        [
        U5      5      $  N7f)z
Create a file write stream by opening the given file for writing.

:param path: path of the file to write to
:param append: if ``True``, open the file for appending; if ``False``, any
    existing file at the given path will be truncated

abwbNrI   )rK   r   appendmoder   s        r%   rL   FileWriteStream.from_path~   sD      t4''T
>>4$'(( ?s   9AAAc                   #     [         R                  " U R                  R                  U5      I S h  vN   g  N! [         a    [
        S e[         a  n[        UeS nAff = f7fr*   )r   r1   r,   writerP   r   rQ   r   )r-   itemrT   s      r%   sendFileWriteStream.send   sQ     	/$$TZZ%5%5t<<< 	0%4/ 	/%3.	/s1   A#.: 8: A#: A AA  A#r   N)F)r   r_   ri   boolrA   rd   )rn   r`   rA   rB   )	r   r   r    r!   ra   rb   rL   ro   r#   r   r$   r%   rd   rd   u   s;     7<)&)04)	) )/r$   rd   N)
__future__r   collections.abcr   r   ior   r   osr   pathlibr	   typingr
   r   r    r   r   r   r   r   r   abcr   r   r   r'   rE   rd   r   r$   r%   <module>rz      s^    " - -   & &  4$+ $ 4;9_&7 ;9|/o~ /r$   