+
    &h&                     z    R t ^ RIt^ RIt^ RItRtRR.t]RR3R lt  ! R R4      t]R8X  d   R	 t	]	! 4        R# R# )
z``jsonutils`` aims to provide various helpers for working with
JSON. Currently it focuses on providing a reliable and intuitive means
of working with `JSON Lines`_-formatted files.

.. _JSON Lines: http://jsonlines.org/

N   JSONLIteratorreverse_iter_linesTc              #  J  "    T;'       g    V P                   pRpT p VP                  4       p RRRrvpV'       d!   V P                  ^ \        P                  4       TpV P                  4       p	^ V	8  d   \        W4      p
W,          p	V P                  V	\        P                  4       V P                  V
4      pW,           pVP                  4       p\        V4      ^8  g   V^ ,          V8X  d   K  VRR V8X  d   V'       d   TMTx  VR^ R1,           F   pV'       d   VP                  V4      MTx  K"  	  V^ ,          pK  V'       d    V'       d   VP                  V4      MTx  R# R#   \         d    Rp ELai ; i  \        \        P                  3 d     ELpi ; i5i)a  Returns an iterator over the lines from a file object, in
reverse order, i.e., last line first, first line last. Uses the
:meth:`file.seek` method of file objects, and is tested compatible with
:class:`file` objects, as well as :class:`StringIO.StringIO`.

Args:
    file_obj (file): An open file object. Note that
        ``reverse_iter_lines`` mutably reads from the file and
        other functions should not mutably interact with the file
        object after being passed. Files can be opened in bytes or
        text mode.
    blocksize (int): The block size to pass to
      :meth:`file.read()`. Warning: keep this a fairly large
      multiple of 2, defaults to 4096.
    preseek (bool): Tells the function whether or not to automatically
        seek to the end of the file. Defaults to ``True``.
        ``preseek=False`` is useful in cases when the
        file cursor is already in position, either at the end of
        the file or in the middle for relative reverse line
        generation.

zutf-8N       
 )encodingAttributeErrordetachioUnsupportedOperationseekosSEEK_ENDtellminSEEK_SETread
splitlineslendecode)file_obj	blocksizepreseekr
   orig_objempty_bytesnewline_bytes
empty_textbuffcur_pos	read_sizecurlineslines   &&&&          1lib/python3.14/site-packages/boltons/jsonutils.pyr   r   3   sl    000x00
  H??$ .1%
Ka%DmmoG
g+	+	gr{{+mmI&z!u:>U1X49% (*k9%1R%LLD+3$++h'= !Qx'/dkk(#T9 E   B334 s]   F#E- F#F CF#AF#F#F#-E>:F#=E>>F#F F#F  F#c                   Z   a  ] tR t^{t o RtR
R lt]R 4       tR tR t	R t
R t]tR	tV tR# )r   a  The ``JSONLIterator`` is used to iterate over JSON-encoded objects
stored in the `JSON Lines format`_ (one object per line).

Most notably it has the ability to efficiently read from the
bottom of files, making it very effective for reading in simple
append-only JSONL use cases. It also has the ability to start from
anywhere in the file and ignore corrupted lines.

Args:
    file_obj (file): An open file object.
    ignore_errors (bool): Whether to skip over lines that raise an error on
        deserialization (:func:`json.loads`).
    reverse (bool): Controls the direction of the iteration.
        Defaults to ``False``. If set to ``True`` and *rel_seek*
        is unset, seeks to the end of the file before iteration
        begins.
    rel_seek (float): Used to preseek the start position of
        iteration. Set to 0.0 for the start of the file, 1.0 for the
        end, and anything in between.

.. _JSON Lines format: http://jsonlines.org/
Nc                   \        V4      V n        Wn        W n        Vf   V'       d   RpM3RTu;8  d   R8  g   M \	        RV,          4      hV^ 8  d
   RV,
          pW@n        RV n        Ve   V P                  4        V P                  '       d*   \        V P                  V P                  RR7      V n	        R # \        V P                  4      V n	        R # )N      ?z8'rel_seek' expected a float between -1.0 and 1.0, not %rr   F)r   r   g      )bool_reverse	_file_objignore_errors
ValueError	_rel_seek
_blocksize_init_rel_seekr   
_line_iteriter)selfr   r-   reverserel_seeks   &&&&&r&   __init__JSONLIterator.__init__   s    W!*&3& 57?@ A A\X~H!!===0;???9>@DO #4>>2DOr   c                6    V P                   P                  4       # )zBA property representing where in the file the iterator is reading.)r,   r   r4   s   &r&   cur_byte_posJSONLIterator.cur_byte_pos   s     ~~""$$r   c                ,   V P                   V P                  r!R^ rCVP                  4       pRV9  d   VP                  V4      pWB,          pK"   VP	                  R4      V,           V,
          pTP                  YV,           4       R#   \
         d    h i ; i)z6Aligns the file object's position to the next newline.r   
N)r,   r0   r   r   indexr.   r   )r4   fobsizer#   
total_readr!   newline_offsets   &      r&   _align_to_newlineJSONLIterator._align_to_newline   s    NNDOOEaZ'')#o''%.CJ	 YYt_z9EAN 	()  		s   B Bc                   V P                   V P                  r!VR8X  d#   VP                  ^ \        P                  4       R# VP                  ^ \        P
                  4       VP                  4       pVR8X  d	   W0n        R# \        W1,          4      pVP                  V\        P                  4       V P                  4        VP                  4       V n        R# )zCSets the file object's position to the relative location set above.g        r)   N)
r/   r,   r   r   r   r   r   _cur_posintrD   )r4   rsr@   sizetargets   &    r&   r1   JSONLIterator._init_rel_seek   s    B9GGAr{{#GGAr{{#779DSy $TY,&&( "	r   c                    V # )N r:   s   &r&   __iter__JSONLIterator.__iter__   s    r   c                     \        V P                  4      P                  4       pV'       g   K.   \        P                  ! V4      pV#   \
         d    T P                  '       g   h  Kh  i ; i)zYields one :class:`dict` loaded with :func:`json.loads`, advancing
the file object by one line. Raises :exc:`StopIteration` upon reaching
the end of the file (or beginning, if ``reverse`` was set to ``True``.
)nextr2   lstripjsonloads	Exceptionr-   )r4   r%   objs   &  r&   rR   JSONLIterator.next   sa    
 (//1Djj&
 J	  )))s   A A*%A*)A*)r0   rG   r,   r2   r/   r+   r-   )FFN)__name__
__module____qualname____firstlineno____doc__r7   propertyr;   rD   r1   rO   rR   __next____static_attributes____classdictcell__)__classdict__s   @r&   r   r   {   s>     ,32 % %** " Hr   __main__c                     ^ RI p RV P                  9   g   RV P                  9   d   \        R4       R# RpRV P                  9   g   RV P                  9   d   Rp^ ^ r2V P                  R	,          pV F  pVR9   d   K  V^,          p\        VR
4      ;_uu_ 4       p\	        V4      p^ p  \        V4       T^,          pT^,          pT'       g   K)  T'       g   K3  T^d,          ^ 8X  g   KC  T P                  P                  R4       TR,          '       g   Ko  T P                  P                  RT,          4       K  	  V'       d%   \        RV,          4       \        RV,          4       R#   \         d6    \        RT^,           : RTP                  : RT: 24        RRR4        R# \         d     Mi ; iRRR4       EKT    + '       g   i     EKf  ; i)    N-h--helpz7loads one or more JSON Line files for basic validation.F-v	--verboseT:   NNrbzerror reading object #z around byte z in .i'  z%s
zfiles checked: %szobjects loaded: %s)rf   rg   rh   ri   )sysargvprintopenr   rR   r.   r;   StopIterationstdoutwrite)	rm   verbose
file_count	obj_count	filenamesfilenamer   iteratorcur_obj_counts	            r&   _mainr{      s   388x3883KL388{chh6G !1IHHRL	!H>>!OJh%%(2 !X NI!Q&Mw99SA1E

((-$u,,JJ,,Vi-?@+ ", %
23&23 & !.!2!2H4I4I8U V &% )  &%%%sZ   G+E,6GGG,'G$G,3F8	G+F8	4F8	5G7F8	8GG)
r]   r   r   rT   DEFAULT_BLOCKSIZE__all__r   r   rY   r{   rN   r   r&   <module>r~      si   > 
 	    0
1 ,=dUY =:Bg gT z#J 
GM r   