XjddlmZdZddlmZmZddlmZmZddl m Z ddl m Z ddl mZmZdd lmZmZmZmZmZmZdd lmZmZGd d eZGd dZGddeeZGddeeZy)) annotations)FileReadStreamFileStreamAttributeFileWriteStream)CallableMapping)SEEK_SETUnsupportedOperation)PathLike)Path)IOAny)BrokenResourceErrorClosedResourceError EndOfStreamTypedAttributeSet to_threadtyped_attribute)ByteReceiveStreamByteSendStreamcVeZdZUeZded<eZded<eZded<y)r IO[bytes]filer pathintfilenoN)__name__ __module__ __qualname__rr__annotations__rrf/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/anyio/streams/file.pyrrs)%'D)' "D$"!#FC#r#rc.eZdZddZddZeddZy)_BaseFileStreamc||_yN_file)selfrs r$__init__z_BaseFileStream.__init__$s  r#crKtj|jjd{y7wr()rrun_syncr*closer+s r$aclosez_BaseFileStream.aclose's$  !1!1222s -757c tjfdi}tjdrfd|tj< jj fd|tj <|S#t $rY|SwxYw)NcjSr(r)r0sr$z2_BaseFileStream.extra_attributes..-s djjr#namecBtjjSr()r r*r5r0sr$r4z2_BaseFileStream.extra_attributes..1s4 ;Pr#c8jjSr()r*rr0sr$r4z2_BaseFileStream.extra_attributes..8sTZZ=N=N=Pr#)rrhasattrr*rrr )r+ attributess` r$extra_attributesz _BaseFileStream.extra_attributes*s $ $&84  4::v &3PJ*// 0 Q JJ   6QJ*11 2 $    sA66 BBN)rr)returnNone)r;zMapping[Any, Callable[[], Any]])rrr r,r1propertyr:r"r#r$r&r&#s 3r#r&c@eZdZdZeddZdd dZefd dZd dZ y) rz 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 cKtjt|jdd{}||S7 w)z{ Create a file read stream by opening the given file. :param path: path of the file to read from rbNrr.r open)clsrrs r$ from_pathzFileReadStream.from_pathFs4''T >>4y?s ->< >cK|dkr td tj|jj|d{}|r|St7#t$rt dt $r }t|d}~wwxYww)Nz$max_bytes must be a positive integer) ValueErrorrr.r*readrOSErrorrr)r+ max_bytesdataexcs r$receivezFileReadStream.receiveQsx q=CD D /"++DJJOOYGGD K H 0%4 / /%3 . /s:A9-AAA A9AA6*A11A66A9ctKtj|jj||d{S7w)au 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)rr.r*seek)r+positionwhences r$rOzFileReadStream.seekas+'' 6JJJJs /868cpKtj|jjd{S7w)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)rr.r*tellr0s r$rSzFileReadStream.tellqs''' 8888s -646N)rstr | PathLike[str]r;r)i)rJrr;bytes)rPrrQrr;r)r;r) rrr __doc__ classmethodrDrMr rOrSr"r#r$rr=s0 7?K 9r#rc8eZdZdZe d ddZddZy)rz 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 cK|rdnd}tjt|j|d{}||S7 w)a 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 abwbNrA)rCrappendmoders r$rDzFileWriteStream.from_paths=t4''T >>4y?s3AA AcK tj|jj|d{y7#t$rt dt $r }t|d}~wwxYwwr()rr.r*writerGrrIr)r+itemrLs r$sendzFileWriteStream.sendsR /$$TZZ%5%5t< < < 0%4 / /%3 . /s1A -979A 9AAAA N)F)rrTr\boolr;r)r`rUr;r<)rrr rVrWrDrar"r#r$rr~s;7< & 04    /r#rN) __future__r__all__collections.abcrrior r osr pathlibr typingr rrrrrrrabcrrrr&rrr"r#r$rlsd"  .-4$+$4>9_&7>9B/o~/r#