+
    Brh/                         ^ RI t ^ RIHt ^ RIHtHtHt ^ RIHt Rt	^ t
^t^tR t ! R R]P                  4      tRRRR	RR
RRRRRRR/R lltR# )    N)PathLike)ZstdCompressorZstdDecompressorZSTD_DStreamOutSize)_streamsZstdFilec                    \        V \        \        34      '       d   \        V 4      # \	        V 4      ;_uu_ 4       pVP
                  uuR R R 4       #   + '       g   i     R # ; iN)
isinstancebytes	bytearraylen
memoryviewnbytes)datmvs   " 7/usr/local/lib/python3.14/compression/zstd/_zstdfile.py_nbytesr      s;    #y)**3x	CByy 
s   AA#	c                   .  a  ] tR t^t o Rt]P                  t]P                  tRRRRRRR/R lltR t	R t
]3R	 ltRR
 ltRR ltR tR tRR lt]P$                  3R ltRR ltR tR tR t]R 4       t]R 4       t]R 4       tR tR tR tRtV t R# )r   aD  A file-like object providing transparent Zstandard (de)compression.

A ZstdFile can act as a wrapper for an existing file object, or refer
directly to a named file on disk.

ZstdFile provides a *binary* file interface. Data is read and returned as
bytes, and may only be written to objects that support the Buffer Protocol.
levelNoptions	zstd_dictc                 RV n         RV n        \        V n        RV n        \        V\        4      '       g   \        R4      hVe"   \        V\        4      '       g   \        R4      hVP                  R4      pVR8X  d   Ve   \        R4      h\        V n        M`VR9   dK   Ve"   \        V\        4      '       g   \        R4      h\        V n        \        W4VR	7      V n        ^ V n        M\        R
V: 24      h\        V\        \"        \$        34      '       d'   \&        P(                  ! W R24      V n         RV n        MDVR8X  d   \+        VR4      '       g   VR8w  d   \+        VR4      '       d   Wn         M\        R4      hV P                  \        8X  dF   \,        P.                  ! V P                   \0        VVR7      p\&        P2                  ! V4      V n        R# R# )a  Open a Zstandard compressed file in binary mode.

*file* can be either an file-like object, or a file name to open.

*mode* can be 'r' for reading (default), 'w' for (over)writing, 'x' for
creating exclusively, or 'a' for appending. These can equivalently be
given as 'rb', 'wb', 'xb' and 'ab' respectively.

*level* is an optional int specifying the compression level to use,
or COMPRESSION_LEVEL_DEFAULT if not given.

*options* is an optional dict for advanced compression parameters.
See CompressionParameter and DecompressionParameter for the possible
options.

*zstd_dict* is an optional ZstdDict object, a pre-trained Zstandard
dictionary. See train_dict() to train ZstdDict on sample data.
NFzmode must be a strzoptions must be a dict or Nonebrzlevel is illegal in read modezlevel must be int or Noner   r   r   Invalid mode: TreadwritezCfile must be a file-like object or a str, bytes, or PathLike object)r   r   >   awx)_fp	_close_fp_MODE_CLOSED_mode_bufferr   str
ValueErrordict	TypeErrorremovesuffix
_MODE_READint_MODE_WRITEr   _compressor_posr   r   ioopenhasattrr   DecompressReaderr   BufferedReader)selffilemoder   r   r   raws   ""&$$$ r   __init__ZstdFile.__init__!   s   ( !
$$$122z'4'@'@<==  %3;  ?@@#DJ_$ E3)?)? ;<<$DJ-E8A CDDI~dX677dS%233wwtvQZ0DH!DNs{wtV44CKGD'$:$:H B C C ::#++ #	C ,,S1DL $    c                   V P                   f   R#  V P                  \        8X  d6   \        V RR4      '       d"   V P                  P                  4        RV n        M7V P                  \        8X  d#   V P                  V P                  4       RV n	        \        V n         V P                  '       d   V P                   P                  4        RV n         RV n        R#   RT n         RT n        i ; i  \        T n         T P                  '       d   T P                   P                  4        RT n         RT n        i   RT n         RT n        i ; i; i)zFlush and close the file.

May be called multiple times. Once the file has been closed,
any other operation on it will raise ValueError.
Nr'   F)r#   r&   r-   getattrr'   closer/   flushFLUSH_FRAMEr0   r%   r$   r7   s   &r   r@   ZstdFile.close`   s     88	'zzZ'4D11LL&&(#'DL{*

4++,#' %DJ'>>>HHNN$!&  !& &DJ'>>>HHNN$!&  !&s0   BC. ,C C+.E	;,D6'E	6EE	c                   V P                  4        \        V4      pV P                  P                  V4      pV P                  P                  V4       V ;P                  V,          un        V# )a  Write a bytes-like object *data* to the file.

Returns the number of uncompressed bytes written, which is
always the length of data in bytes. Note that due to buffering,
the file on disk may not reflect the data written until .flush()
or .close() is called.
)_check_can_writer   r0   compressr#   r   r1   )r7   datalength
compresseds   ""  r   r   ZstdFile.writey   sR     	%%..t4
z"		V	r=   c                   V P                   \        8X  d   R# V P                  4        WP                  V P                  09  d   \        R4      hV P                  P                  V8X  d   R# V P                  P                  V4      pV P                  P                  V4       \        V P                  R4      '       d   V P                  P                  4        R# R# )a_  Flush remaining data to the underlying stream.

The mode argument can be FLUSH_BLOCK or FLUSH_FRAME. Abuse of this
method will reduce compression ratio, use it only when necessary.

If the program is interrupted afterwards, all data can be recovered.
To ensure saving to disk, also need to use os.fsync(fd).

This method does nothing in reading mode.
NzSInvalid mode argument, expected either ZstdFile.FLUSH_FRAME or ZstdFile.FLUSH_BLOCKrA   )r&   r-   _check_not_closedFLUSH_BLOCKrB   r)   r0   	last_moderA   r#   r   r4   )r7   r9   rH   s   && r   rA   ZstdFile.flush   s     ::# (($*:*:;; 4 5 5 %%-%%d+t488W%%HHNN &r=   c                d    Vf   RpV P                  4        V P                  P                  V4      # )zRead up to size uncompressed bytes from the file.

If size is negative or omitted, read until EOF is reached.
Returns b'' if the file is already at EOF.
)_check_can_readr'   r   r7   sizes   &&r   r   ZstdFile.read   s/     <D||  &&r=   c                r    V P                  4        V^ 8  d   \        pV P                  P                  V4      # )zRead up to size uncompressed bytes, while trying to avoid
making multiple reads from the underlying stream. Reads up to a
buffer's worth of data if size is negative.

Returns b'' if the file is at EOF.
)rS   r   r'   read1rT   s   &&r   rX   ZstdFile.read1   s3     	!8 'D||!!$''r=   c                X    V P                  4        V P                  P                  V4      # )zBRead bytes into b.

Returns the number of bytes read (0 for EOF).
)rS   r'   readintor7   r   s   &&r   r[   ZstdFile.readinto   s%    
 	||$$Q''r=   c                X    V P                  4        V P                  P                  V4      # )zRead bytes into b, while trying to avoid making multiple reads
from the underlying stream.

Returns the number of bytes read (0 for EOF).
)rS   r'   	readinto1r\   s   &&r   r_   ZstdFile.readinto1   s%     	||%%a((r=   c                X    V P                  4        V P                  P                  V4      # )zRead a line of uncompressed bytes from the file.

The terminating newline (if present) is retained. If size is
non-negative, no more than size bytes will be read (in which
case the line may be incomplete). Returns b'' if already at EOF.
)rS   r'   readlinerT   s   &&r   rb   ZstdFile.readline   s%     	||$$T**r=   c                X    V P                  4        V P                  P                  W4      # )a  Change the file position.

The new position is specified by offset, relative to the
position indicated by whence. Possible values for whence are:

    0: start of stream (default): offset must not be negative
    1: current stream position
    2: end of stream; offset must not be positive

Returns the new file position.

Note that seeking is emulated, so depending on the arguments,
this operation may be extremely slow.
)rS   r'   seek)r7   offsetwhences   &&&r   re   ZstdFile.seek   s'     	 ||  00r=   c                X    V P                  4        V P                  P                  V4      # )zReturn buffered data without advancing the file position.

Always returns at least one byte of data, unless at EOF.
The exact number of bytes returned is unspecified.
)rS   r'   peekrT   s   &&r   rj   ZstdFile.peek   s%     	||  &&r=   c                V    V P                   P                  4       ;p'       d   V# \        hr
   )r'   rb   StopIteration)r7   rets   & r   __next__ZstdFile.__next__   s%    ,,''))3)Jr=   c                    V P                  4        V P                  \        8X  d   V P                  P	                  4       # V P                  \
        8X  d   V P                  # R# )z!Return the current file position.N)rM   r&   r-   r'   tellr/   r1   rC   s   &r   rr   ZstdFile.tell   sH     ::#<<$$&&ZZ;&99 'r=   c                V    V P                  4        V P                  P                  4       # )z3Return the file descriptor for the underlying file.)rM   r#   filenorC   s   &r   ru   ZstdFile.fileno  s     xx  r=   c                N    V P                  4        V P                  P                  # r
   )rM   r#   namerC   s   &r   rx   ZstdFile.name
  s     xx}}r=   c                4    V P                   \        8X  d   R # R# )wbrb)r&   r/   rC   s   &r   r9   ZstdFile.mode  s    zz[0t:d:r=   c                (    V P                   \        8H  # )zTrue if this file is closed.)r&   r%   rC   s   &r   closedZstdFile.closed  s     zz\))r=   c                f    V P                  4       ;'       d    V P                  P                  4       # )z)Return whether the file supports seeking.)readabler'   seekablerC   s   &r   r   ZstdFile.seekable  s#    }}::4<<#8#8#::r=   c                H    V P                  4        V P                  \        8H  # )z/Return whether the file was opened for reading.)rM   r&   r-   rC   s   &r   r   ZstdFile.readable  s     zzZ''r=   c                H    V P                  4        V P                  \        8H  # )z/Return whether the file was opened for writing.)rM   r&   r/   rC   s   &r   writableZstdFile.writable!  s     zz[((r=   )r'   r$   r0   r#   r&   r1   )r   )rR   )!__name__
__module____qualname____firstlineno____doc__r   rN   rB   r;   r@   r   rA   r   rX   r[   r_   rb   r2   SEEK_SETre   rj   ro   rr   ru   propertyrx   r9   r   r   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s      !,,K ,,K=2=2%)=259=2~'2" % 4	'(()+ #%++ 1(	'
!
   ; ; * *;(
) )r=   r   r   r   encodingerrorsnewlinec              &   RV9   pVP                  RR4      pV'       d   RV9   d   \        RV: 24      hM-Ve   \        R4      hVe   \        R4      hVe   \        R4      h\        WW#VR7      p	V'       d   \        P                  ! WWg4      # V	# )	a  Open a Zstandard compressed file in binary or text mode.

file can be either a file name (given as a str, bytes, or PathLike object),
in which case the named file is opened, or it can be an existing file object
to read from or write to.

The mode parameter can be 'r', 'rb' (default), 'w', 'wb', 'x', 'xb', 'a',
'ab' for binary mode, or 'rt', 'wt', 'xt', 'at' for text mode.

The level, options, and zstd_dict parameters specify the settings the same
as ZstdFile.

When using read mode (decompression), the options parameter is a dict
representing advanced decompression options. The level parameter is not
supported in this case. When using write mode (compression), only one of
level, an int representing the compression level, or options, a dict
representing advanced compression options, may be passed. In both modes,
zstd_dict is a ZstdDict instance containing a trained Zstandard dictionary.

For binary mode, this function is equivalent to the ZstdFile constructor:
ZstdFile(filename, mode, ...). In this case, the encoding, errors and
newline parameters must not be provided.

For text mode, an ZstdFile object is created, and wrapped in an
io.TextIOWrapper instance with the specified encoding, error handling
behavior, and line ending(s).
t r   r   z0Argument "encoding" not supported in binary modez.Argument "errors" not supported in binary modez/Argument "newline" not supported in binary moder   )replacer)   r   r2   TextIOWrapper)
r8   r9   r   r   r   r   r   r   	text_modebinary_files
   "&$$$$$$  r   r3   r3   '  s    < tI<<R D$;~dX677  OPPMNNNOO4U%.0K vGGr=   )r   r3   )r|   )r2   osr   _zstdr   r   r   compression._commonr   __all__r%   r-   r/   r   
BaseStreamr   r3    r=   r   <module>r      st    	  G G (

P)x"" P)f2d 2D 2D 22#2-12r=   