
    HR-e                     *    d Z ddlZddgZddZd	dZdS )
zt
This module contains simple input/output related functionality that is not
part of a larger framework or standard.
    Nfnpickle
fnunpicklec                    t          | t                    rt          | d          }d}n| }d}	 |dk    r<g }t          |          D ])}|                    t          j        |                     *n^|dk     rDg }d}|s=	 |                    t          j        |                     n# t          $ r d}Y nw xY w|=nt          j        |          }|r|                                 n# |r|                                 w w xY w|S )a  Unpickle pickled objects from a specified file and return the contents.

    Parameters
    ----------
    fileorname : str or file-like
        The file name or file from which to unpickle objects. If a file object,
        it should have been opened in binary mode.
    number : int
        If 0, a single object will be returned (the first in the file). If >0,
        this specifies the number of objects to be unpickled, and a list will
        be returned with exactly that many objects. If <0, all objects in the
        file will be unpickled and returned as a list.

    Raises
    ------
    EOFError
        If ``number`` is >0 and there are fewer than ``number`` objects in the
        pickled file.

    Returns
    -------
    contents : object or list
        If ``number`` is 0, this is a individual object - the first one
        unpickled from the file. Otherwise, it is a list of objects unpickled
        from the file.

    rbTFr   )	
isinstancestropenrangeappendpickleloadEOFErrorclose)
fileornamenumberfr   resieofs          >lib/python3.11/site-packages/astropy/io/misc/pickle_helpers.pyr   r      s:   8 *c"" T""A::C6]] + +

6;q>>****+aZZCC JJv{1~~....   CCC   +a..C 	GGIII  	GGIIII	 Js0   AC% ='B% $C% %B41C% 3B44C% %C>Fc                    |t           j        }t          |t                    rt	          ||rdnd          }d}n|}d}	 t          j        | ||           |r|                                 dS dS # |r|                                 w w xY w)a  Pickle an object to a specified file.

    Parameters
    ----------
    object
        The python object to pickle.
    fileorname : str or file-like
        The filename or file into which the `object` should be pickled. If a
        file object, it should have been opened in binary mode.
    protocol : int or None
        Pickle protocol to use - see the :mod:`pickle` module for details on
        these options. If None, the most recent protocol will be used.
    append : bool
        If True, the object is appended to the end of the file, otherwise the
        file will be overwritten (if a file object is given instead of a
        file name, this has no effect).

    NabwbTF)protocol)r   HIGHEST_PROTOCOLr   r   r	   dumpr   )objectr   r   r   r   r   s         r   r   r   E   s    & **c"" V5TT66FA1111 	GGIIIII	 	5 	GGIIII	s    A1 1B
)r   )NF)__doc__r   __all__r   r        r   <module>r"      sW    
 |
$6 6 6 6r! ! ! ! ! !r!   