
    6hdc                       S SK Jr  S SKrS SKrS SKrSSKJrJrJr  SSKJ	r	  \R                  r
SrSr\R                  " S	S
5      r " S S5      r " S S5      r\" 5       r " S S5      r " S S5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r\R3                  \" 5       5         " S S\5      r\R3                  \" 5       5         " S S \5      r\R3                  \" 5       5         " S! S"\5      r\R3                  \" 5       5         " S# S$\5      r\R3                  \" 5       5        S% r\" 5       R?                  5       r g)&    )annotationsN   )errori18npycompat   )
stringutils   servers   clientcompenginewireprotosupport)nameserverpriorityclientpriorityc                  *    \ rS rSrS rSS jrS rSrg)propertycache!   c                2    Xl         UR                  U l        g N)func__name__r   )selfr   s     =/usr/lib/python3/dist-packages/mercurial/utils/compression.py__init__propertycache.__init__"   s    	MM	    Nc                J    U R                  U5      nU R                  X5        U$ r   )r   
cachevalue)r   objtyperesults       r   __get__propertycache.__get__&   s     3$r   c                4    X!R                   U R                  '   g r   )__dict__r   )r   r   values      r   r   propertycache.cachevalue+   s    "'TYYr   )r   r   r   )r   
__module____qualname____firstlineno__r   r   r   __static_attributes__ r   r   r   r   !   s    "
(r   r   c                  x    \ rS rSrSrS rS rS rS rS r	\
S 5       r\
S	 5       rS
 rS rSS jrS rS rSrg)compressormanager0   a/  Holds registrations of various compression engines.

This class essentially abstracts the differences between compression
engines to allow new compression formats to be added easily, possibly from
extensions.

Compressors are registered against the global instance by calling its
``register()`` method.
c                J    0 U l         0 U l        0 U l        0 U l        0 U l        g r   )_engines_bundlenames_bundletypes_revlogheaders
_wiretypesr   s    r   r   compressormanager.__init__;   s(     r   c                     U R                   U   $ r   r.   r   keys     r   __getitem__compressormanager.__getitem__F   s    }}S!!r   c                    XR                   ;   $ r   r6   r7   s     r   __contains__compressormanager.__contains__I   s    mm##r   c                H    [        U R                  R                  5       5      $ r   )iterr.   keysr3   s    r   __iter__compressormanager.__iter__L   s    DMM&&())r   c                   [        U[        5      (       d  [        [        S5      5      eUR	                  5       nX R
                  ;   a"  [        R                  " [        S5      U-  5      eUR                  5       nU(       a  Uu  pEX@R                  ;   a"  [        R                  " [        S5      U-  5      eXPR                  ;   a0  [        R                  " [        S5      XPR                  U   4-  5      eU(       a  X R                  U'   X R                  U'   UR                  5       nU(       aY  UR                  nXpR                  ;   a0  [        R                  " [        S5      XpR                  U   4-  5      eX R                  U'   UR                  5       nU(       a?  XR                  ;   a0  [        R                  " [        S5      XR                  U   4-  5      eU(       a  X R                  U'   XR
                  U'   g)zhRegister a compression engine with the manager.

The argument must be a ``compressionengine`` instance.
s$   argument must be a compressionengines(   compression engine %s already registereds!   bundle name %s already registereds'   bundle type %s already registered by %ss5   wire protocol compression %s already registered by %ss)   revlog header %s already registered by %sN)
isinstancecompressionengine
ValueError_r   r.   r   Abort
bundletyper/   r0   wireprotosupportr2   revlogheaderr1   )	r   enginer   
bundleinfo
bundlenamerI   wiresupportwiretyperK   s	            r   registercompressormanager.registerO   s   
 &"344QFGHH{{}== ++=>E  &&(
%/"J...kk:;jH  ...kk@A!#4#4Z#@AB  04!!*-,0j)--/"''H??*kk,  !:;	<  )-OOH%**,L,?,??++>?!4!4\!BCD 
 04-$dr   c                H    [        U R                  R                  5       5      $ r   )setr/   r@   r3   s    r   supportedbundlenames&compressormanager.supportedbundlenames       4$$))+,,r   c                H    [        U R                  R                  5       5      $ r   )rT   r0   r@   r3   s    r   supportedbundletypes&compressormanager.supportedbundletypes   rW   r   c                    U R                   U R                  U      nUR                  5       (       d0  [        R                  " [        S5      UR                  5       -  5      eU$ )zObtain a compression engine registered to a bundle name.

Will raise KeyError if the bundle type isn't registered.

Will abort if the engine is known but not available.
)   compression engine %s could not be loaded)r.   r/   	availabler   rH   rG   r   )r   rN   rL   s      r   forbundlenamecompressormanager.forbundlename   X     t00<=!!++>?&++-O  r   c                    U R                   U R                  U      nUR                  5       (       d0  [        R                  " [        S5      UR                  5       -  5      eU$ )zObtain a compression engine registered to a bundle type.

Will raise KeyError if the bundle type isn't registered.

Will abort if the engine is known but not available.
r\   )r.   r0   r]   r   rH   rG   r   )r   rI   rL   s      r   forbundletypecompressormanager.forbundletype   r`   r   c                R  ^ U[         [        4;   d   eU[         :X  a  SOSmU R                  R                  5        Vs/ s H  o0R                  U   PM     nnU(       a(  U Vs/ s H  o3R                  5       (       d  M  UPM     nnU4S jn[        [        XES95      $ s  snf s  snf )zObtain compression engines that support the wire protocol.

Returns a list of engines in prioritized order, most desired first.

If ``onlyavailable`` is set, filter out engines that can't be
loaded.
r   r   c                Z   > U R                  5       nS[        UT5      -  UR                  4$ )N)rJ   getattrr   )ewattrs     r   getkey6compressormanager.supportedwireengines.<locals>.getkey   s.     ""$A4((!&&00r   )r8   )
SERVERROLE
CLIENTROLEr2   valuesr.   r]   listsorted)r   roleonlyavailablerh   enginesrk   rj   s         @r   supportedwireengines&compressormanager.supportedwireengines   s     
J////#':#5;K-1__-C-C-EF-E==#-EF");'Q[[]q'G;	1 F7/00 G;s   B#B$?B$c                    U R                   U R                  U      nUR                  5       (       d0  [        R                  " [        S5      UR                  5       -  5      eU$ )Nr\   )r.   r2   r]   r   rH   rG   r   )r   rP   rL   s      r   forwiretypecompressormanager.forwiretype   sT    tx89!!++>?&++-O  r   c                :    U R                   U R                  U      $ )z}Obtain a compression engine registered to a revlog header.

Will raise KeyError if the revlog header value isn't registered.
)r.   r1   )r   headers     r   forrevlogheader!compressormanager.forrevlogheader   s    
 }}T00899r   )r/   r0   r.   r1   r2   N)T)r   r%   r&   r'   __doc__r   r9   r<   rA   rQ   propertyrU   rY   r^   rb   ru   rx   r|   r(   r)   r   r   r+   r+   0   sb    	"$*;%z - - - -12:r   r+   c                  P    \ rS rSrSrS rS rS rS rS r	SS	 jr
S
 rSS jrSrg)rE      zmBase class for compression engines.

Compression engines must implement the interface defined by this class.
c                    [        5       e)zReturns the name of the compression engine.

This is the key the engine is registered under.

This method must be implemented.
NotImplementedErrorr3   s    r   r   compressionengine.name        "##r   c                    g)zWhether the compression engine is available.

The intent of this method is to allow optional compression engines
that may not be available in all installations (such as engines relying
on C extensions that may not be present).
Tr)   r3   s    r   r]   compressionengine.available   s     r   c                    g)aU  Describes bundle identifiers for this engine.

If this compression engine isn't supported for bundles, returns None.

If this engine can be used for bundles, returns a 2-tuple of strings of
the user-facing "bundle spec" compression name and an internal
identifier used to denote the compression format within bundles. To
exclude the name from external usage, set the first element to ``None``.

If bundle compression is supported, the class must also implement
``compressstream`` and `decompressorreader``.

The docstring of this method is used in the help system to tell users
about this engine.
Nr)   r3   s    r   rI   compressionengine.bundletype   s      r   c                    g)a  Declare support for this compression format on the wire protocol.

If this compression engine isn't supported for compressing wire
protocol payloads, returns None.

Otherwise, returns ``compenginewireprotosupport`` with the following
fields:

* String format identifier
* Integer priority for the server
* Integer priority for the client

The integer priorities are used to order the advertisement of format
support by server and client. The highest integer is advertised
first. Integers with non-positive values aren't advertised.

The priority values are somewhat arbitrary and only used for default
ordering. The relative order can be changed via config options.

If wire protocol compression is supported, the class must also implement
``compressstream`` and ``decompressorreader``.
Nr)   r3   s    r   rJ   "compressionengine.wireprotosupport  s    . r   c                    g)a(  Header added to revlog chunks that identifies this engine.

If this engine can be used to compress revlogs, this method should
return the bytes used to identify chunks compressed with this engine.
Else, the method should return ``None`` to indicate it does not
participate in revlog compression.
Nr)   r3   s    r   rK   compressionengine.revlogheader  s     r   Nc                    [        5       e)aS  Compress an iterator of chunks.

The method receives an iterator (ideally a generator) of chunks of
bytes to be compressed. It returns an iterator (ideally a generator)
of bytes of chunks representing the compressed output.

Optionally accepts an argument defining how to perform compression.
Each engine treats this argument differently.
r   r   itoptss      r   compressstream compressionengine.compressstream)  s     "##r   c                    [        5       e)zPerform decompression on a file object.

Argument is an object with a ``read(size)`` method that returns
compressed data. Return value is an object with a ``read(size)`` that
returns uncompressed data.
r   r   fhs     r   decompressorreader$compressionengine.decompressorreader5  r   r   c                    [        5       e)a  Obtain an object that can be used to compress revlog entries.

The object has a ``compress(data)`` method that compresses binary
data. This method returns compressed binary data or ``None`` if
the data could not be compressed (too small, not compressible, etc).
The returned data should have a header uniquely identifying this
compression format so decompression can be routed to this engine.
This header should be identified by the ``revlogheader()`` return
value.

The object has a ``decompress(data)`` method that decompresses
data. The method will only be called if ``data`` begins with
``revlogheader()``. The method should return the raw, uncompressed
data or raise a ``StorageError``.

The object is reusable but is not thread safe.
r   r   r   s     r   revlogcompressor"compressionengine.revlogcompressor>  s    $ "##r   r)   r   )r   r%   r&   r'   r~   r   r]   rI   rJ   rK   r   r   r   r(   r)   r   r   rE   rE      s/    
$$2
$$$r   rE   c                  &    \ rS rSrS rS rS rSrg)_CompressedStreamReaderiS  c                    [        US5      (       a  UR                  U l        OUR                  U l        / U l        SU l        SU l        g )Nunbufferedreadr   F)hasattrr   _readerread_pending_pos_eofr   s     r   r    _CompressedStreamReader.__init__T  s=    2'((,,DL77DL		r   c                    [        5       er   r   )r   chunks     r   _decompress#_CompressedStreamReader._decompress]  s    !##r   c                z   / n U R                   (       Ga&  [        U R                   S   5      XR                  -   :  a_  U R                   S   nUR                  X0R                  U R                  U-    5        U =R                  U-  sl        SR	                  U5      $ U R                   R                  S5      nU R                  (       a9  UR                  X0R                  S  5        U[        U5      U R                  -
  -  nOUR                  U5        U[        U5      -  nSU l        U R                   (       a  GM&  U R                  (       a  SR	                  U5      $ U R                  S5      nU R                  U5        U(       d3  U R                   (       d"  U R                  (       d  SR	                  U5      $ GM  )Nr   r   i   )	r   lenr   appendjoinpopr   r   r   )r   lbufnewbufr   s        r   r   _CompressedStreamReader.read`  s=   ---t}}Q'(1yy=8!]]1-FJJvii$))a-@AIINI88C=(**1-99JJviik23Vtyy00AJJv&V$A	 ---  yyxx}$LL'EU#tyyxx}$/ r   )r   r   r   r   N)r   r%   r&   r'   r   r   r   r(   r)   r   r   r   r   S  s    $%r   r   c                  .   ^  \ rS rSrU 4S jrS rSrU =r$ )_GzipCompressedStreamReaderi|  c                X   > [         TU ]  U5        [        R                  " 5       U l        g r   )superr   zlibdecompressobj
_decompobjr   r   	__class__s     r   r   $_GzipCompressedStreamReader.__init__}  s     ,,.r   c                Z   U R                   R                  U5      nU(       a  U R                  R                  U5        U R                   R	                  5       n UR                  S5        UR                  5         UR                  S:X  a  SU l        g g ! [        R                   a     g f = f)N   xT)
r   
decompressr   r   copyflushunused_datar   r   r   )r   r   r   ds       r   r   '_GzipCompressedStreamReader._decompress  s    ++E2MM  (OO  "	LLGGI}}$ 	 %zz 		s   8B B*)B*r   r   r   r%   r&   r'   r   r   r(   __classcell__r   s   @r   r   r   |  s    / r   r   c                  .   ^  \ rS rSrU 4S jrS rSrU =r$ )_BZ2CompressedStreamReaderi  c                X   > [         TU ]  U5        [        R                  " 5       U l        g r   )r   r   bz2BZ2Decompressorr   r   s     r   r   #_BZ2CompressedStreamReader.__init__  s     --/r   c                0   U R                   R                  U5      nU(       a  U R                  R                  U5          U R                   R                  S5      nU(       a  U R                  R                  U5        Og MA  ! [         a
    SU l         g f = fNTr   )r   r   r   r   EOFErrorr   r   r   r   s      r   r   &_BZ2CompressedStreamReader._decompress  s|    ++E2MM  (	33C8MM((0   	DI	s   ?B ?B BBr   r   r   s   @r   r   r     s    0 r   r   c                  (   ^  \ rS rSrU 4S jrSrU =r$ )#_TruncatedBZ2CompressedStreamReaderi  c                   > [         TU ]  U5        U R                  R                  S5      nU(       a  U R                  R                  U5        g g )N   BZ)r   r   r   r   r   r   )r   r   r   r   s      r   r   ,_TruncatedBZ2CompressedStreamReader.__init__  s>    ++E2MM  ( r   r)   )r   r%   r&   r'   r   r(   r   r   s   @r   r   r     s    ) )r   r   c                  .   ^  \ rS rSrU 4S jrS rSrU =r$ )_ZstdCompressedStreamReaderi  c                v   > [         TU ]  U5        X l        UR                  5       R	                  5       U l        g r   )r   r   _zstdZstdDecompressorr   r   )r   r   zstdr   s      r   r   $_ZstdCompressedStreamReader.__init__  s.    
//1??Ar   c                P   U R                   R                  U5      nU(       a  U R                  R                  U5          U R                   R                  S5      nU(       a  U R                  R                  U5        Og MA  ! U R                  R
                   a
    SU l         g f = fr   )r   r   r   r   r   	ZstdErrorr   r   s      r   r   '_ZstdCompressedStreamReader._decompress  s    ++E2MM  (	33C8MM((0  zz## 	DI	s   ?B ?B !B%$B%)r   r   r   r   r   s   @r   r   r     s    B
 r   r   c                  Z    \ rS rSrS rS rS rS rSS jrS r	 " S	 S
5      r
SS jrSrg)_zlibenginei  c                    g)N   zlibr)   r3   s    r   r   _zlibengine.name      r   c                    g)zzlib compression using the DEFLATE algorithm.

All Mercurial clients should support this format. The compression
algorithm strikes a reasonable balance between compression ratio
and size.
)s   gzips   GZr)   r3   s    r   rI   _zlibengine.bundletype  s     r   c                    [        SSS5      $ )Nr      compewireprotosupportr3   s    r   rJ   _zlibengine.wireprotosupport      $Wb"55r   c                    g)Nr   r)   r3   s    r   rK   _zlibengine.revlogheader  s    r   Nc              #     #    U=(       d    0 n[         R                  " UR                  SS5      5      nU H!  nUR                  U5      nU(       d  M  Uv   M#     UR	                  5       v   g 7f)N   levelrf   )r   compressobjgetcompressr   r   r   r   zr   datas         r   r   _zlibengine.compressstream  sZ     zrTXXh34E::e$D t
  ggi   AA.A.c                    [        U5      $ r   )r   r   s     r   r   _zlibengine.decompressorreader  s    *2..r   c                  *    \ rS rSrSS jrS rS rSrg) _zlibengine.zlibrevlogcompressori  Nc                    Xl         g r   _level)r   levels     r   r   )_zlibengine.zlibrevlogcompressor.__init__  s    Kr   c                ~   [        U5      nUS:  d   eUS:  a  g US::  aV  U R                  c  [        R                  " U5      nO [        R                  " XR                  5      n[        U5      U:  a  U$ g U R                  c  [        R                  " 5       nO[        R                  " U R                  S9n/ nSnXb:  a0  US-   nUR                  UR                  XU 5      5        UnXb:  a  M0  UR                  UR                  5       5        [        [        [         U5      5      U:  a  SR                  U5      $ g )Nr   ,   @B r  i   r   )
r   r  r   r   r   r   r   summapr   )r   r   insize
compressedr   partspospos2s           r   r   )_zlibengine.zlibrevlogcompressor.compress  s   YFA::{7";;&!%t!4J!%t[[!AJz?V+%% ;;&((*A((t{{;Al;DLLDTN!;<C l QWWY's3'&088E?*r   c                     [         R                  " U5      $ ! [         R                   a;  n[        R                  " [	        S5      [
        R                  " U5      -  5      eS nAff = f)N   revlog decompress error: %s)r   r   r   StorageErrorrG   r	   forcebytestr)r   r   rh   s      r   r   +_zlibengine.zlibrevlogcompressor.decompress  sY    t,,:: ((45 --a01 s    A'6A""A'r  r   r   r%   r&   r'   r   r   r   r(   r)   r   r   zlibrevlogcompressorr    s    	 #	J	r   r  c                P    S nUb  UR                  S5      nU R                  U5      $ )Ns
   zlib.level)r   r  r   r   r  s      r   r   _zlibengine.revlogcompressor  s,    HH]+E((//r   r)   r   )r   r%   r&   r'   r   rI   rJ   rK   r   r   r  r   r(   r)   r   r   r   r     s0    6/0 0d0r   r   c                  6    \ rS rSrS rS rS rS	S jrS rSr	g)

_bz2enginei  c                    g)Ns   bz2r)   r3   s    r   r   _bz2engine.name   s    r   c                    g)a[  An algorithm that produces smaller bundles than ``gzip``.

All Mercurial clients should support this format.

This engine will likely produce smaller bundles than ``gzip`` but
will be significantly slower, both during compression and
decompression.

If available, the ``zstd`` engine can yield similar or better
compression at much higher speeds.
)   bzip2r   r)   r3   s    r   rI   _bz2engine.bundletype#  s     r   c                    [        SSS5      $ )Nr$  r   r   r3   s    r   rJ   _bz2engine.wireprotosupport3  s    $Xq!44r   Nc              #     #    U=(       d    0 n[         R                  " UR                  SS5      5      nU H!  nUR                  U5      nU(       d  M  Uv   M#     UR	                  5       v   g 7f)Nr   	   )r   BZ2Compressorr   r   r   r   s         r   r   _bz2engine.compressstream6  sX     zrdhhx34E::e$Dt
 
 ggir   c                    [        U5      $ r   )r   r   s     r   r   _bz2engine.decompressorreader@  s    )"--r   r)   r   )
r   r%   r&   r'   r   rI   rJ   r   r   r(   r)   r   r   r   r     s     5.r   r   c                  &    \ rS rSrS rS rS rSrg)_truncatedbz2engineiG  c                    g)Ns   bz2truncatedr)   r3   s    r   r   _truncatedbz2engine.nameH  s    r   c                    g)N)Ns   _truncatedBZr)   r3   s    r   rI   _truncatedbz2engine.bundletypeK  s    $r   c                    [        U5      $ r   )r   r   s     r   r   &_truncatedbz2engine.decompressorreaderP  s    2266r   r)   N)r   r%   r&   r'   r   rI   r   r(   r)   r   r   r/  r/  G  s    %
7r   r/  c                  Z    \ rS rSrS rS rS rS rSS jrS r	 " S	 S
5      r
SS jrSrg)_noopengineiW  c                    g)N   noner)   r3   s    r   r   _noopengine.nameX  r   r   c                    g)z]No compression is performed.

Use this compression engine to explicitly disable compression.
)r9  s   UNr)   r3   s    r   rI   _noopengine.bundletype[  s    
 r   c                    [        SSS5      $ )Nr9  r   
   r   r3   s    r   rJ   _noopengine.wireprotosupporte  s    $Wa44r   c                    g)N    r)   r3   s    r   rK   _noopengine.revlogheaderj  s    r   Nc                    U$ r   r)   r   s      r   r   _noopengine.compressstreamm      	r   c                    U$ r   r)   r   s     r   r   _noopengine.decompressorreaderp  rE  r   c                      \ rS rSrS rSrg) _noopengine.nooprevlogcompressoris  c                    g r   r)   )r   r   s     r   r   )_noopengine.nooprevlogcompressor.compresst  s    r   r)   N)r   r%   r&   r'   r   r(   r)   r   r   nooprevlogcompressorrI  s  s    	r   rL  c                "    U R                  5       $ r   )rL  r   s     r   r   _noopengine.revlogcompressorw  s    ((**r   r)   r   )r   r%   r&   r'   r   rI   rJ   rK   r   r   rL  r   r(   r)   r   r   r7  r7  W  s/    5
 +r   r7  c                  p    \ rS rSrS r\S 5       rS rS rS r	S r
SS	 jrS
 r " S S5      rSS jrSrg)_zstdenginei~  c                    g)N   zstdr)   r3   s    r   r   _zstdengine.name  r   r   c                L     SSK Jn  UR                    U$ ! [         a     g f = f)Nr   )r   ) r   __version__ImportError)r   r   s     r   _module_zstdengine._module  s,    	 K 		s    
##c                ,    [        U R                  5      $ r   )boolrX  r3   s    r   r]   _zstdengine.available  s    DLL!!r   c                    g)a  A modern compression algorithm that is fast and highly flexible.

Only supported by Mercurial 4.1 and newer clients.

With the default settings, zstd compression is both faster and yields
better compression than ``gzip``. It also frequently yields better
compression than ``bzip2`` while operating at much higher speeds.

If this engine is available and backwards compatibility is not a
concern, it is likely the best available engine.
)rR  s   ZSr)   r3   s    r   rI   _zstdengine.bundletype  s     r   c                    [        SSS5      $ )NrR  2   r   r3   s    r   rJ   _zstdengine.wireprotosupport  r   r   c                    g)N   (r)   r3   s    r   rK   _zstdengine.revlogheader  r   r   Nc              #  .  #    U=(       d    0 nUR                  SS5      nUR                  SS5      nU R                  nUR                  X4S9R                  5       nU H!  nUR	                  U5      nU(       d  M  Uv   M#     UR                  5       v   g 7f)Nr      s   threadsr   )r  threads)r   rX  ZstdCompressorr   r   r   )	r   r   r   r  rg  r   r   r   r   s	            r   r   _zstdengine.compressstream  s     zr 1%((:q)||e=IIKE::e$Dt
 
 ggis   A4B:Bc                ,    [        XR                  5      $ r   )r   rX  r   s     r   r   _zstdengine.decompressorreader  s    *2||<<r   c                  *    \ rS rSrSS jrS rS rSrg) _zstdengine.zstdrevlogcompressori  c                    UR                  US9U l        UR                  5       U l        UR                  U l        UR                  U l        g )Nr  )rh  _cctxr   _dctx"COMPRESSION_RECOMMENDED_INPUT_SIZE_compinsize$DECOMPRESSION_RECOMMENDED_INPUT_SIZE_decompinsize)r   r   r  s      r   r   )_zstdengine.zstdrevlogcompressor.__init__  sE    
 ,,5,9DJ..0DJ#FFD!%!J!JDr   c                   [        U5      nUS:  d   eUS:  a  g US::  a-  U R                  R                  U5      n[        U5      U:  a  U$ g U R                  R                  5       n/ nSnXb:  aB  X`R                  -   nUR                  XU 5      nU(       a  UR                  U5        UnXb:  a  MB  UR                  UR                  5       5        [        [        [         U5      5      U:  a  SR                  U5      $ g )Nr   r`  r  r   )
r   ro  r   r   rr  r   r   r  r  r   )	r   r   r  r  r   chunksr  r  r   s	            r   r   )_zstdengine.zstdrevlogcompressor.compress  s    YFA::{7"!ZZ006
z?V+%%JJ**,l!1!11DJJt~6Ee,C l aggi(s3'(6188F++r   c                   [        U5      n U R                  R                  5       n/ nSnXR:  aB  XPR                  -   nUR	                  XU 5      nU(       a  UR                  U5        UnXR:  a  MB  SR                  U5      $ ! [         a;  n[        R                  " [        S5      [        R                  " U5      -  5      eS nAff = f)Nr   r   r  )r   rp  r   rt  r   r   r   	Exceptionr   r  rG   r	   r  )	r   r   r  dobjrw  r  r  r   rh   s	            r   r   +_zstdengine.zstdrevlogcompressor.decompress  s    YF zz//1l!3!33D OODTN;Ee,C l xx'' ((45 --a01 s   A#B 2B 
C6CC)ro  rr  rp  rt  N)rf  r  r)   r   r   zstdrevlogcompressorrm    s    	K	:	r   r}  c                    U=(       d    0 nUR                  S5      nUc  UR                  S5      nUc  SnU R                  U R                  US9$ )Ns
   zstd.levelr   rf  r  )r   r}  rX  r  s      r   r   _zstdengine.revlogcompressor  sP    zr'=HHX&E=E((U(CCr   r)   r   )r   r%   r&   r'   r   r   rX  r]   rI   rJ   rK   r   r   r}  r   r(   r)   r   r   rP  rP  ~  sJ     
 
"6$=> >@Dr   rP  c                    0 n  " S S5      n[          H  n[         U   nUR                  5       (       d  M#  UR                  5       nU(       a
  US   (       d  MF  SUS   [        R                  " UR                  5      4-  nU" 5       n[        R
                  " U5      Ul        UR                  R                  Ul        UR                  Ul        X`US   '   M     U $ )z@Obtains a list of available bundle compressions for use in help.c                      \ rS rSrSrg)*bundlecompressiontopics.<locals>.docobjecti  r)   N)r   r%   r&   r'   r(   r)   r   r   	docobjectr    s    r   r  r   s   ``%s``
    %s)	compenginesr]   rI   r   getdocsysstrr~   _origdoc	_origfunc)itemsr  r   rL   btdocr#   s          r   bundlecompressiontopicsr    s     E  T"!! A2a5(//&:K:K*L"MM ,**22 ++be# & Lr   )!
__future__r   r   collectionsr   rU  r   r   r   r	   rG   rm   rn   
namedtupler   r   r+   r  rE   r   r   r   r   r   r   rQ   r   r/  r7  rP  r  ro   i18nfunctionsr)   r   r   <module>r     s}   # 
   
  	FF 

#.. 0 ( (f: f:R  !t$ t$n&% &%R"9 &!8 ()*D )"9 *Y0# Y0x   [] #"." ".J   Z\ "
7+ 
7   (* +!+# !+H   [] #DD# DDN   [] #@ ()002r   