
    afb
                     D    d dl Z d dlZd dlmZ ddZ G d d          ZdS )    N)SuspiciousFileOperationFc                 b   t           j                            |           dv rt          d| z            |rDt	          j        |           }|                                s	d|j        v rt          d| z            n5| t           j                            |           k    rt          d| z            | S )N>    ...z$Could not derive file name from '%s'r   z'Detected path traversal attempt in '%s'z%File name '%s' includes path elements)ospathbasenamer   pathlibPurePosixPathis_absoluteparts)nameallow_relative_pathr	   s      I/var/www/html/env/lib/python3.11/site-packages/django/core/files/utils.pyvalidate_file_namer      s    	w00%&Lt&STTT 
V $T** 	!3!3)9D@   "4 
!!$''	'	'%&MPT&TUUUK    c                      e Zd ZdZ ed           Z ed           Z ed           Z ed           Z ed           Z	 ed           Z
 ed           Z ed	           Z ed
           Z ed           Z ed           Z ed           Z ed           Z ed           Zed             Zd Zd Zd Zd ZdS )FileProxyMixinz
    A mixin class used to forward file methods to an underlying file
    object.  The internal file object has to be called "file"::

        class FileProxy(FileProxyMixin):
            def __init__(self, file):
                self.file = file
    c                     | j         j        S N)fileencodingselfs    r   <lambda>zFileProxyMixin.<lambda>%       TY%7 r   c                     | j         j        S r   )r   filenor   s    r   r   zFileProxyMixin.<lambda>&       49#3 r   c                     | j         j        S r   )r   flushr   s    r   r   zFileProxyMixin.<lambda>'   
    $)/ r   c                     | j         j        S r   )r   isattyr   s    r   r   zFileProxyMixin.<lambda>(   r    r   c                     | j         j        S r   )r   newlinesr   s    r   r   zFileProxyMixin.<lambda>)   r   r   c                     | j         j        S r   )r   readr   s    r   r   zFileProxyMixin.<lambda>*   
     r   c                     | j         j        S r   )r   readintor   s    r   r   zFileProxyMixin.<lambda>+   r   r   c                     | j         j        S r   )r   readliner   s    r   r   zFileProxyMixin.<lambda>,   r   r   c                     | j         j        S r   )r   	readlinesr   s    r   r   zFileProxyMixin.<lambda>-   s    di&9 r   c                     | j         j        S r   )r   seekr   s    r   r   zFileProxyMixin.<lambda>.   r*   r   c                     | j         j        S r   )r   tellr   s    r   r   zFileProxyMixin.<lambda>/   r*   r   c                     | j         j        S r   )r   truncater   s    r   r   zFileProxyMixin.<lambda>0   r   r   c                     | j         j        S r   )r   writer   s    r   r   zFileProxyMixin.<lambda>1   r#   r   c                     | j         j        S r   )r   
writelinesr   s    r   r   zFileProxyMixin.<lambda>2   s    ty'; r   c                 *    | j          p| j         j        S r   )r   closedr   s    r   r<   zFileProxyMixin.closed4   s    9}0	 00r   c                 t    | j         rdS t          | j        d          r| j                                        S dS )NFreadableT)r<   hasattrr   r>   r   s    r   r>   zFileProxyMixin.readable8   >    ; 	549j)) 	(9%%'''tr   c                     | j         rdS t          | j        d          r| j                                        S dt	          | j        dd          v S )NFwritablewmoder   )r<   r?   r   rB   getattrr   s    r   rB   zFileProxyMixin.writable?   sR    ; 	549j)) 	(9%%'''gdi4444r   c                 t    | j         rdS t          | j        d          r| j                                        S dS )NFseekableT)r<   r?   r   rG   r   s    r   rG   zFileProxyMixin.seekableF   r@   r   c                 *    t          | j                  S r   )iterr   r   s    r   __iter__zFileProxyMixin.__iter__M   s    DIr   N)__name__
__module____qualname____doc__propertyr   r   r"   r%   r'   r)   r,   r.   r0   r2   r4   r6   r8   r:   r<   r>   rB   rG   rJ    r   r   r   r      s         x7788HX3344FH1122EX3344Fx7788H8//00Dx7788Hx7788H99::I8//00D8//00Dx7788HH1122E;;<<J1 1 X1  5 5 5      r   r   )F)r   r   django.core.exceptionsr   r   r   rP   r   r   <module>rR      so    				  : : : : : :   (3 3 3 3 3 3 3 3 3 3r   