Ë
    £�Dj   ã                   óB   — d Z ddlmZ ddlmZ  G d„ d«      Zd„ Zd	d„Zy)
z$
Handle file opening for read/write
é    )ÚPath)Ú_is_string_likec                   ó(   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zy)ÚEmptyContextManagerzw
    This class is needed to allow file-like object to be used as
    context manager, but without getting closed.
    c                 ó   — || _         y ©N©Ú_obj)ÚselfÚobjs     ú^C:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\statsmodels/iolib/openfile.pyÚ__init__zEmptyContextManager.__init__   s	   € Øˆ�	ó    c                 ó   — | j                   S )z)When entering, return the embedded objectr	   )r   s    r   Ú	__enter__zEmptyContextManager.__enter__   s   € à�y‰yÐr   c                  ó   — y)zDo not hide anythingF© )r   Úargss     r   Ú__exit__zEmptyContextManager.__exit__   s   € àr   c                 ó.   — t        | j                  |«      S r   )Úgetattrr
   )r   Únames     r   Ú__getattr__zEmptyContextManager.__getattr__   s   € Ü�t—y‘y $Ó'Ð'r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   	   s   „ ñò
òòó(r   r   c                 óp   — | j                  d«      rdd l}|j                  | ||¬«      S t        | ||¬«      S )Nz.gzr   ©Úencoding)ÚendswithÚgzipÚopen)ÚfnameÚmoder    r"   s       r   Ú_openr&      s5   € Ø‡~�~�eÔÛà�y‰y˜ ¨xˆyÓ8Ð8ä�E˜4¨(Ô3Ð3r   Nc                 ó€  — t        | «      rt        | «      } t        | t        «      r| j                  ||¬«      S t	        | d«      r| j                  ||¬«      S 	 t        | ||¬«      S # t
        $ rL 	 d|v r| j                   d|v sd|v r| j                   n# t        $ r t        d«      ‚w xY wt        | «      cY S w xY w)aT  
    Light wrapper to handle strings, path objects and let files (anything else)
    pass through.

    It also handle '.gz' files.

    Parameters
    ----------
    fname : str, path object or file-like object
        File to open / forward
    mode : str
        Argument passed to the 'open' or 'gzip.open' function
    encoding : str
        For Python 3 only, specify the encoding of the file

    Returns
    -------
    A file-like object that is always a context-manager. If the `fname` was
    already a file-like object, the returned context manager *will not
    close the file*.
    )r%   r    r#   r   ÚrÚwÚaz,fname must be a string or a file-like object)r   r   Ú
isinstancer#   ÚhasattrÚ	TypeErrorÚreadÚwriteÚAttributeErrorÚ
ValueErrorr   )r$   r%   r    s      r   Úget_file_objr2   '   sÂ   € ô. �uÔÜ�U“ˆÜ�%œÔØ�z‰z˜t¨hˆzÓ7Ð7Ü	�˜Ô	Ø�z‰z˜t¨hˆzÓ7Ð7ð*Ü�E˜4¨(Ô3Ð3øÜò 	*ð	Mà�d‰{Ø—
’
Ø�d‰{˜c T™kØ—’ùÜò 	MÜÐKÓLÐLð	Múä" 5Ó)Ò)ð	*ús*   ÁA( Á(	B=Á2$BÂB=ÂB,Â,B=Â<B=)r(   N)r   Úpathlibr   Únumpy.lib._iotoolsr   r   r&   r2   r   r   r   ú<module>r5      s&   ðñõ å .÷(ñ (ò*4ô(*r   