
    l h                    8   U d dl mZ d dlZd dlZd dlmZmZ d dlmZ d dl	m
Z
 d dlmZ ej                  Zej                  Zej"                  ZdZdZ	 d	Ze
Zd
ZdZeedZded<   eedZded<   	 	 d	 	 	 	 	 	 	 	 	 ddZddZ	 	 d	 	 	 	 	 	 	 	 	 ddZddZddZ y)    )annotationsN)AnyOptional)	ASCENDING)MAX_MESSAGE_SIZE)InvalidOperation       
i  i <   )files_idnzdict[str, Any]_C_INDEX)filename
uploadDate_F_INDEXc                     d|j                  d      rd  dd fd}d fd}|r|dz  }nrdj                  |d	      }|sst        |||
      S t        ||
      S )Create a GridIn property. DEPRECATED,GridIn property '2' is deprecated and will be removed in PyMongo 5.0c                    rt        j                  dt               r| j                  st	        dz        dk(  r| j
                  j                  d      S | j
                  j                  d       S N   
stacklevelcategoryz can only get %r on a closed filelengthr   warningswarnDeprecationWarning_closedAttributeError_filegetselfclosed_only
field_namewarn_strs    }/var/www/html/SchoolMeal/SchoolMeal/pds_admin_SchoolMeal/Backend/venv/lib/python3.12/site-packages/gridfs/grid_file_shared.pygetterz#_a_grid_in_property.<locals>.getter/   c    MM(q;MNt|| !Cj!PQQ!::>>*a00zz~~j$//r	   c                    rt        j                  dt               | j                  rt	        d      || j
                  <   y )Nr   r   zAsyncGridIn does not support __setattr__ after being closed(). Set the attribute before closing the file or use AsyncGridIn.set() instead)r    r!   r"   r#   r   r%   r(   valuer*   r+   s     r,   setterz#_a_grid_in_property.<locals>.setter9   sA    MM(q;MN<<" \  "'

:r	   

This attribute is read-only.{}

{}UThis attribute is read-only and can only be read after :meth:`close` has been called.docr(   r   returnr   r(   r   r1   r   r9   r   
startswithformatpropertyr*   	docstring	read_onlyr)   r-   r2   r+   s   `  `  @r,   _a_grid_in_propertyrB   !   s     HM*
|+]^ 	0' 77		%%
	 [I66F	**r	   c                4     d fd}|dz  }t        ||      S )Create a GridOut property.c                    | j                   st        dz        dk(  r| j                   j                  d      S | j                   j                  d       S )Nz=You must call GridOut.open() before accessing the %s propertyr   r   )r%   r   r&   )r(   r*   s    r,   a_getterz&_a_grid_out_property.<locals>.a_getterT   sT    zz"RU__  !::>>*a00zz~~j$//r	   r3   r6   r8   )r>   )r*   r@   rF   s   `  r,   _a_grid_out_propertyrG   Q   s"    0 33IH),,r	   c                     d|j                  d      rd  dd fd}d fd}|r|dz  }nrdj                  |d	      }|sst        |||
      S t        ||
      S )r   r   r   r   r   c                    rt        j                  dt               r| j                  st	        dz        dk(  r| j
                  j                  d      S | j
                  j                  d       S r   r   r'   s    r,   r-   z!_grid_in_property.<locals>.gettero   r.   r	   c                    rt        j                  dt               | j                  r9| j                  j
                  j                  d| j                  d   id|ii       || j                  <   y )Nr   r   _idz$set)r    r!   r"   r#   _collfiles
update_oner%   r0   s     r,   r2   z!_grid_in_property.<locals>.settery   s_    MM(q;MN<<JJ''

50A(BVjZ_M`Dab!&

:r	   r3   r4   r5   r6   r8   r:   r;   r?   s   `  `  @r,   _grid_in_propertyrO   b   s     HM*
|+]^ 	0' 77		%%
	 [I66F	**r	   c                j     d|j                  d      rd  dd fd}|dz  }t        ||      S )	rD   r   r   zGridOut property 'r   c                    rt        j                  dt               | j                          dk(  r| j                  j                  d      S | j                  j                  d       S )Nr   r   r   r   )r    r!   r"   openr%   r&   )r(   r*   r+   s    r,   r-   z"_grid_out_property.<locals>.getter   sT    MM(q;MN		 !::>>*a00zz~~j$//r	   r3   r6   r8   )r<   r>   )r*   r@   r-   r+   s   `  @r,   _grid_out_propertyrS      sG    HM* ,^_ 	0 33IF	**r	   c                b    | j                   j                  d      } | j                  dd|i|S )z;Clear the given database/collection object's type registry.N)type_registrycodec_options )rV   with_options)entitykwargs	codecoptss      r,   _clear_entity_type_registryr\      s6    $$111EI6AYA&AAr	   )FF)
r*   strr@   r]   rA   Optional[bool]r)   r^   r9   r   )r*   r]   r@   r]   r9   r   )rY   r   rZ   r   r9   r   )!
__future__r   osr    typingr   r   pymongor   pymongo.commonr   pymongo.errorsr   SEEK_SET	_SEEK_SETSEEK_CUR	_SEEK_CURSEEK_END	_SEEK_ENDEMPTYNEWLNDEFAULT_CHUNK_SIZE_UPLOAD_BUFFER_SIZE_UPLOAD_BUFFER_CHUNKS_CHUNK_OVERHEADr   __annotations__r   rB   rG   rO   rS   r\   rW   r	   r,   <module>rr      s   " 	     + +KK	KK	KK	 # &   (1	B. B(1K. K !&"'	-+-+-+ -+  	-+
 	-+`-( !&"'	*+*+*+ *+  	*+
 	*+Z+,Br	   