
    wBf                         d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ dd
lmZ ddlmZmZmZ  ee      Z G d de      Zy)zODefines local filesystem transport adapter for CondaSession (requests.Session).    N)
formatdate)	getLogger)
guess_type)stat)SpooledTemporaryFile   )ensure_binary)url_to_path   )BaseAdapterCaseInsensitiveDictResponsec                       e Zd Z	 ddZd Zy)LocalFSAdapterNc                    t        |j                        }t               }d|_        |j                  |_        	 t	        |      }	t        |	j                  d      }
t        |      d   xs d}t        ||	j                  |
d      |_
        t        |d      |_        |j                  j                  |_        |S # t        $ r}d|_        d	|t        |      d
}t!               }|j#                  t%        t'        j(                  |                   |j+                  d       ||_        |j                  j                  |_        Y d }~|S d }~ww xY w)N   T)usegmtr   z
text/plain)zContent-TypezContent-LengthzLast-Modifiedrbi  zfile does not exist)errorpath	exception)r
   urlr   status_coder   r   st_mtimer   r   st_sizeheadersopenrawcloseOSErrorreprr   writer	   jsondumpsseek)selfrequeststreamtimeoutverifycertproxiespathnamerespstatsmodifiedcontent_typeexcmessagefhs                  Jlib/python3.12/site-packages/conda/gateways/connection/adapters/localfs.pysendzLocalFSAdapter.send   s    w{{+z;;	(NE "%..>H%h/2BlL.$0&+mm%-DL Hd+DHDJ3  	("D. !#YG
 &'BHH]4::g#678GGAJDHDJJ 3	(s   B9 9	EB EEc                      y )N )r&   s    r5   r   zLocalFSAdapter.close:   s        )NNNNN)__name__
__module____qualname__r6   r   r8   r9   r5   r   r      s    RV$Lr9   r   )__doc__r#   email.utilsr   loggingr   	mimetypesr   osr   tempfiler   common.compatr	   common.pathr
    r   r   r   r:   logr   r8   r9   r5   <module>rG      s?    V  "     ) + ' 9 9([ (r9   