
    jp                     v    S SK r S SKJrJrJr  S SKJr  S SKJr   " S S\5      r	 " S S\	5      r
S	 rS
 rS rg)    N)BytesIOStringIOUnsupportedOperation)FileProxyMixin)cached_propertyc                       \ rS rSrSrSS jrS rS rS rS r	\
S	 5       rSS
 jrSS jrS rS rS rSS jrS rSrg)File   i   Nc                     Xl         Uc  [        USS 5      nX l        [        US5      (       a  UR                  U l        g g )Nnamemode)filegetattrr   hasattrr   )selfr   r   s      N/var/www/html/KUNJ/venv/lib/python3.13/site-packages/django/core/files/base.py__init__File.__init__   s<    	<4.D	4  		DI !    c                 ,    U R                   =(       d    S$ )N r   r   s    r   __str__File.__str__   s    yyBr   c                 f    SU R                   R                  < SU R                  =(       d    S< S3$ )N<z: None>)	__class____name__r   r   s    r   __repr__File.__repr__   s#    !^^44dii6I66IJJr   c                     g)NT r   s    r   __bool__File.__bool__   s    r   c                     U R                   $ Nsizer   s    r   __len__File.__len__   s    yyr   c                    [        U R                  S5      (       a  U R                  R                  $ [        U R                  S5      (       a4   [        R                  R                  U R                  R                  5      $ [        U R                  S5      (       a  [        U R                  S5      (       a{  U R                  R                  5       nU R                  R                  S[        R                  5        U R                  R                  5       nU R                  R                  U5        U$ [        S5      e! [        [        4 a     Nf = f)Nr+   r   tellseekr   z$Unable to determine the file's size.)r   r   r+   ospathgetsizer   OSError	TypeErrorr/   r0   SEEK_ENDAttributeError)r   posr+   s      r   r+   	File.size   s    499f%%99>>!499f%%wwtyy~~66 499f%%'$))V*D*D)).."CIINN1bkk*99>>#DIINN3KCDD Y' s   2D= =EEc              #      #    U=(       d    U R                   n U R                  S5         U R	                  U5      nU(       d  gUv   M  ! [        [        4 a     N2f = f7f)zc
Read the file and yield chunks of ``chunk_size`` bytes (defaults to
``File.DEFAULT_CHUNK_SIZE``).
r   N)DEFAULT_CHUNK_SIZEr0   r7   r   read)r   
chunk_sizedatas      r   chunksFile.chunks0   sc     
  :4#:#:
	IIaL 99Z(DJ	   45 		s'   A A
  A 
AA AA c                 F    U R                   U=(       d    U R                  :  $ )z
Return ``True`` if you can expect multiple chunks.

NB: If a particular file representation is in memory, subclasses should
always return ``False`` -- there's no good reason to read from memory
in chunks.
)r+   r;   )r   r=   s     r   multiple_chunksFile.multiple_chunksA   s     yyJA$*A*ABBr   c              #   Z  #    / nU R                  5        H  nUR                  S5       H  nU(       a[  [        US   5      (       a7  [        U5      (       d'  [	        US   5      " 5       R                  U5      v   / nOUR                  U5        U(       d)  [        U5      (       a  Uv   M  UR                  U5        M  [        U5      (       d  M  [	        US   5      " 5       R                  U5      v   / nM     M     U(       a%  [	        US   5      " 5       R                  U5      v   g g 7f)NTr   )r?   
splitlinesendswith_cr	equals_lftypejoinappendendswith_lf)r   buffer_chunklines       r   __iter__File.__iter__K   s     [[]E((."72;//	$"71:.055g>>"$
  t,"4(("
t, &&wqz*,11':: G+ / #0 wqz"$))'22 s   C
D+AD+c                     U $ r)   r%   r   s    r   	__enter__File.__enter__i   s    r   c                 $    U R                  5         g r)   )close)r   exc_type	exc_valuetbs       r   __exit__File.__exit__l   s    

r   c                 F   U R                   (       d  U R                  S5        U $ U R                  (       ab  [        R                  R                  U R                  5      (       a4  [        U R                  U=(       d    U R                  /UQ70 UD6U l        U $ [        S5      e)Nr   zThe file cannot be reopened.)
closedr0   r   r1   r2   existsopenr   r   
ValueError)r   r   argskwargss       r   r_   	File.openo   st    {{IIaL
 	 YY277>>$))44TYY(9		KDKFKDI  ;<<r   c                 8    U R                   R                  5         g r)   )r   rV   r   s    r   rV   
File.closex   s    		r   )r   r   r   r)   )r!   
__module____qualname____firstlineno__r;   r   r   r"   r&   r,   r   r+   r?   rB   rP   rS   rZ   r_   rV   __static_attributes__r%   r   r   r	   r	      s\    #"K E E "C3<r   r	   c                   L   ^  \ rS rSrSrS	U 4S jjrS rS	S jrS rS r	Sr
U =r$ )
ContentFile|   zM
A File-like object that takes just raw content, rather than an actual file.
c                    > [        U[        5      (       a  [        O[        n[        TU ]  U" U5      US9  [        U5      U l        g )Nr   )
isinstancestrr   r   superr   lenr+   )r   contentr   stream_classr    s       r   r   ContentFile.__init__   s8    #-gs#;#;xg.T:L	r   c                     g)NzRaw contentr%   r   s    r   r   ContentFile.__str__   s    r   c                 (    U R                  S5        U $ )Nr   )r0   )r   r   s     r   r_   ContentFile.open   s    		!r   c                     g r)   r%   r   s    r   rV   ContentFile.close   s    r   c                 p    U R                   R                  SS 5        U R                  R                  U5      $ )Nr+   )__dict__popr   write)r   r>   s     r   r~   ContentFile.write   s)    &$'yyt$$r   r*   r)   )r!   rf   rg   rh   __doc__r   r   r_   rV   r~   ri   __classcell__)r    s   @r   rk   rk   |   s&    !
% %r   rk   c                 Z    U R                  [        U [        5      (       a  S5      $ S5      $ )z9Return True if line (a text or bytestring) ends with ''.   endswithrn   ro   rO   s    r   rG   rG      %    ==D#!6!6BBEBBr   c                 Z    U R                  [        U [        5      (       a  S5      $ S5      $ )z9Return True if line (a text or bytestring) ends with '
'.
   
r   r   s    r   rL   rL      r   r   c                 >    U [        U [        5      (       a  S:H  $ S:H  $ )z6Return True if line (a text or bytestring) equals '
'.r   r   )rn   ro   r   s    r   rH   rH      s!    JtS11D==u==r   )r1   ior   r   r   django.core.files.utilsr   django.utils.functionalr   r	   rk   rG   rL   rH   r%   r   r   <module>r      s@    	 6 6 2 3q> qh%$ %2C
C
>r   