§
    'ê[fÅ,  ã                  ó^  — d dl mZ d dlZd dlZd dlZd dlmZ	 ddl
mZ ej        rddlmZ  G d„ d¦  «        Z G d„ d	¦  «        Z G d
„ de¦  «        Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ d¦  «        Zdd„Zdd„Z G d„ deee	j        ¦  «        Z G d„ dee	j        ¦  «        ZdS ) é    )ÚannotationsNé   )ÚQuery)Ú
SQLAlchemyc                  ó   — e Zd ZdZd
d„Zd	S )Ú_QueryPropertyzRA class property that creates a query object for a model.

    :meta private:
    ÚobjúModel | NoneÚclsútype[Model]Úreturnr   c                ó^   — |                      ||j                             ¦   «         ¬¦  «        S )N)Úsession)Úquery_classÚ__fsa__r   )Úselfr	   r   s      úJ/var/www/piapp/venv/lib/python3.11/site-packages/flask_sqlalchemy/model.pyÚ__get__z_QueryProperty.__get__   s0   € Ø�ŠØ˜œ×,Ò,Ñ.Ô.ð ñ 
ô 
ð 	
ó    N)r	   r
   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r   r      s2   € € € € € ðð ð

ð 
ð 
ð 
ð 
ð 
r   r   c                  óX   — e Zd ZU dZded<   	 eZded<   	  e¦   «         Zded<   	 dd
„Z	dS )ÚModela€  The base class of the :attr:`.SQLAlchemy.Model` declarative model class.

    To define models, subclass :attr:`db.Model <.SQLAlchemy.Model>`, not this. To
    customize ``db.Model``, subclass this and pass it as ``model_class`` to
    :class:`.SQLAlchemy`. To customize ``db.Model`` at the metaclass level, pass an
    already created declarative model class as ``model_class``.
    zt.ClassVar[SQLAlchemy]r   zt.ClassVar[type[Query]]r   zt.ClassVar[Query]Úqueryr   Ústrc                ó.  — t          j        | ¦  «        }|€J ‚|j        rdt          | ¦  «        › d�}nH|j        rdt          | ¦  «        › d�}n-d                     t          t          |j        ¦  «        ¦  «        }dt          | ¦  «        j
        › d|› d�S )Nz(transient ú)z	(pending z, Ú<Ú Ú>)ÚsaÚinspectÚ	transientÚidÚpendingÚjoinÚmapr   ÚidentityÚtyper   )r   ÚstateÚpks      r   Ú__repr__zModel.__repr__8   s    € Ý”
˜4Ñ Ô ˆØÐ Ð Ð àŒ?ð 	5Ø*�r $™xœxÐ*Ð*Ð*ˆBˆBØŒ]ð 	5Ø(�R ™XœXÐ(Ð(Ð(ˆBˆBà—’�3�s E¤NÑ3Ô3Ñ4Ô4ˆBà.•4˜‘:”:Ô&Ð.Ð.¨Ð.Ð.Ð.Ð.r   N)r   r   )
r   r   r   r   Ú__annotations__r   r   r   r   r/   r   r   r   r   r      s   € € € € € € ðð ð $Ð#Ð#Ñ#ðð
 ,1€KÐ0Ð0Ð0Ñ0ðð  .˜~Ñ/Ô/€EÐ/Ð/Ð/Ñ/ðð/ð /ð /ð /ð /ð /r   r   c                  ó:   ‡ — e Zd ZU dZded<   ded<   dˆ fd„Zˆ xZS )ÚBindMetaMixina  Metaclass mixin that sets a model's ``metadata`` based on its ``__bind_key__``.

    If the model sets ``metadata`` or ``__table__`` directly, ``__bind_key__`` is
    ignored. If the ``metadata`` is the same as the parent model, it will not be set
    directly on the child model.
    r   r   úsa.MetaDataÚmetadataÚnamer   Úbasesútuple[type, ...]Údúdict[str, t.Any]Úkwargsút.Anyr   ÚNonec                óò   •— d| j         v sPd| j         v sGt          | dd ¦  «        }t          | dd ¦  «        }| j                             |¦  «        }||ur|| _         t          ¦   «         j        |||fi |¤Ž d S )Nr4   Ú	__table__Ú__bind_key__)Ú__dict__Úgetattrr   Ú_make_metadatar4   ÚsuperÚ__init__)	r   r5   r6   r8   r:   Úbind_keyÚparent_metadatar4   Ú	__class__s	           €r   rD   zBindMetaMixin.__init__Q   s�   ø€ ð ˜cœlÐ*Ð*¨k¸S¼\Ð.IÐ.IÝ˜s N°DÑ9Ô9ˆHÝ% c¨:°tÑ<Ô<ˆOØ”{×1Ò1°(Ñ;Ô;ˆHà˜Ð.Ð.Ø'�”à�‰ŒÔ˜˜u aÐ2Ð2¨6Ð2Ð2Ð2Ð2Ð2r   ©
r5   r   r6   r7   r8   r9   r:   r;   r   r<   )r   r   r   r   r0   rD   Ú__classcell__©rG   s   @r   r2   r2   F   sc   ø€ € € € € € ðð ð ÐÐÑØÐÐÑð3ð 3ð 3ð 3ð 3ð 3ð 3ð 3ð 3ð 3r   r2   c                  óJ   ‡ — e Zd ZU dZded<   ded<   edˆ fd„¦   «         Zˆ xZS )Ú	BindMixina  DeclarativeBase mixin to set a model's ``metadata`` based on ``__bind_key__``.

    If no ``__bind_key__`` is specified, the model will use the default metadata
    provided by ``DeclarativeBase`` or ``DeclarativeBaseNoMeta``.
    If the model doesn't set ``metadata`` or ``__table__`` directly
    and does set ``__bind_key__``, the model will use the metadata
    for the specified bind key.
    If the ``metadata`` is the same as the parent model, it will not be set
    directly on the child model.

    .. versionchanged:: 3.1.0
    r   r   r3   r4   r   út.Type[BindMixin]r:   út.Dict[str, t.Any]r   r<   c                ó  •— d| j         v s`d| j         v sWt          | d¦  «        rGt          | dd ¦  «        }t          | dd ¦  «        }| j                             |¦  «        }||ur|| _         t          ¦   «         j        di |¤Ž d S )Nr4   r>   r?   r   )r@   ÚhasattrrA   r   rB   r4   rC   Ú__init_subclass__)r   r:   rE   rF   r4   rG   s        €r   rQ   zBindMixin.__init_subclass__p   s    ø€ à˜cœlÐ*Ð*¨k¸S¼\Ð.IÐ.IÍwØ�ñP
ô P
Ð.Iõ ˜s N°DÑ9Ô9ˆHÝ% c¨:°tÑ<Ô<ˆOØ”{×1Ò1°(Ñ;Ô;ˆHà˜Ð.Ð.Ø'�”à!�‰ŒÔ!Ð+Ð+ FÐ+Ð+Ð+Ð+Ð+r   )r   rM   r:   rN   r   r<   )r   r   r   r   r0   ÚclassmethodrQ   rI   rJ   s   @r   rL   rL   _   sm   ø€ € € € € € ðð ð ÐÐÑØÐÐÑàð,ð ,ð ,ð ,ð ,ñ „[ð,ð ,ð ,ð ,ð ,r   rL   c                  óL   ‡ — e Zd ZU dZded<   ded<   ded<   dˆ fd„Zdd„Zˆ xZS )ÚNameMetaMixinaP  Metaclass mixin that sets a model's ``__tablename__`` by converting the
    ``CamelCase`` class name to ``snake_case``. A name is set for non-abstract models
    that do not otherwise define ``__tablename__``. If a model does not define a primary
    key, it will not generate a name or ``__table__``, for single-table inheritance.
    r3   r4   r   Ú__tablename__úsa.Tabler>   r5   r6   r7   r8   r9   r:   r;   r   r<   c                óÞ   •— t          | ¦  «        rt          | j        ¦  «        | _         t	          ¦   «         j        |||fi |¤Ž d| j        vrd| j        v r| j        d         €| `d S d S d S d S )NrU   r>   )Úshould_set_tablenameÚcamel_to_snake_caser   rU   rC   rD   r@   r>   )r   r5   r6   r8   r:   rG   s        €r   rD   zNameMetaMixin.__init__Š   s‘   ø€ õ   Ñ$Ô$ð 	BÝ 3°C´LÑ AÔ AˆCÔà�‰ŒÔ˜˜u aÐ2Ð2¨6Ð2Ð2Ð2ð  3¤<Ð/Ð/Ø˜sœ|Ð+Ð+Ø”˜[Ô)Ð1à���ð	 0Ð/Ø+Ð+Ø1Ð1r   Úargsúsa.Table | Nonec                ó¶  — |                      d¦  «        }|€	|d         }n|› d|d         › �}|| j        j        v rt          j        |i |¤ŽS |D ]P}t          |t          j        ¦  «        r|j        st          |t          j        ¦  «        rt          j        |i |¤Žc S ŒQ| j	        dd…         D ]}d|j
        v r nŒt          j        |i |¤ŽS d| j
        v r| `dS ©	a  This is called by SQLAlchemy during mapper setup. It determines the final
        table object that the model will use.

        If no primary key is found, that indicates single-table inheritance, so no table
        will be created and ``__tablename__`` will be unset.
        ÚschemaNr   ú.r   éÿÿÿÿr>   rU   ©Úgetr4   Útablesr$   ÚTableÚ
isinstanceÚColumnÚprimary_keyÚPrimaryKeyConstraintÚ__mro__r@   rU   ©r   rZ   r:   r^   ÚkeyÚargÚbases          r   Ú__table_cls__zNameMetaMixin.__table_cls__š   s2  € ð —’˜HÑ%Ô%ˆàˆ>Ø�q”'ˆCˆCàÐ'Ð'˜d 1œgÐ'Ð'ˆCð �#”,Ô%Ð%Ð%Ý”8˜TÐ, VÐ,Ð,Ð,ð ð 	1ð 	1ˆCÝ˜3¥¤	Ñ*Ô*ð 1¨s¬ð 1Å:Ø•RÔ,ñDô Dð 1õ ”x Ð0¨Ð0Ð0Ð0Ð0Ð0ð1ð ”K  " Ô%ð 	-ð 	-ˆDØ˜dœmÐ+Ð+Ø�ð ,õ ”8˜TÐ, VÐ,Ð,Ð,ð ˜cœlÐ*Ð*ØÐ!àˆtr   rH   ©rZ   r;   r:   r;   r   r[   )r   r   r   r   r0   rD   rn   rI   rJ   s   @r   rT   rT      sƒ   ø€ € € € € € ðð ð ÐÐÑØÐÐÑØÐÐÑðð ð ð ð ð ð 'ð 'ð 'ð 'ð 'ð 'ð 'ð 'r   rT   c                  ól   ‡ — e Zd ZU dZded<   ded<   ded<   edˆ fd„¦   «         Zedd„¦   «         Zˆ xZS )Ú	NameMixinau  DeclarativeBase mixin that sets a model's ``__tablename__`` by converting the
    ``CamelCase`` class name to ``snake_case``. A name is set for non-abstract models
    that do not otherwise define ``__tablename__``. If a model does not define a primary
    key, it will not generate a name or ``__table__``, for single-table inheritance.

    .. versionchanged:: 3.1.0
    r3   r4   r   rU   rV   r>   r   út.Type[NameMixin]r:   rN   r   r<   c                óØ   •— t          | ¦  «        rt          | j        ¦  «        | _         t	          ¦   «         j        di |¤Ž d| j        vrd| j        v r| j        d         €| `d S d S d S d S )NrU   r>   r   )rX   rY   r   rU   rC   rQ   r@   r>   )r   r:   rG   s     €r   rQ   zNameMixin.__init_subclass__Ñ   s‰   ø€ å Ñ$Ô$ð 	BÝ 3°C´LÑ AÔ AˆCÔà!�‰ŒÔ!Ð+Ð+ FÐ+Ð+Ð+ð  3¤<Ð/Ð/Ø˜sœ|Ð+Ð+Ø”˜[Ô)Ð1à���ð	 0Ð/Ø+Ð+Ø1Ð1r   rZ   r;   r[   c                ó¶  — |                      d¦  «        }|€	|d         }n|› d|d         › �}|| j        j        v rt          j        |i |¤ŽS |D ]P}t          |t          j        ¦  «        r|j        st          |t          j        ¦  «        rt          j        |i |¤Žc S ŒQ| j	        dd…         D ]}d|j
        v r nŒt          j        |i |¤ŽS d| j
        v r| `dS r]   ra   rj   s          r   rn   zNameMixin.__table_cls__à   s2  € ð —’˜HÑ%Ô%ˆàˆ>Ø�q”'ˆCˆCàÐ'Ð'˜d 1œgÐ'Ð'ˆCð �#”,Ô%Ð%Ð%Ý”8˜TÐ, VÐ,Ð,Ð,ð ð 	1ð 	1ˆCÝ˜3¥¤	Ñ*Ô*ð 1¨s¬ð 1Å:Ø•RÔ,ñDô Dð 1õ ”x Ð0¨Ð0Ð0Ð0Ð0Ð0ð1ð ”K  " Ô%ð 	-ð 	-ˆDØ˜dœmÐ+Ð+Ø�ð ,õ ”8˜TÐ, VÐ,Ð,Ð,ð ˜cœlÐ*Ð*ØÐ!àˆtr   )r   rr   r:   rN   r   r<   ro   )	r   r   r   r   r0   rR   rQ   rn   rI   rJ   s   @r   rq   rq   Ä   s™   ø€ € € € € € ðð ð ÐÐÑØÐÐÑØÐÐÑàðð ð ð ð ñ „[ðð ð'ð 'ð 'ñ „[ð'ð 'ð 'ð 'ð 'r   rq   r   r,   r   Úboolc                óv  — | j                              dd¦  «        sjt          | t          j        t          j        f¦  «        s&t          d„ | j        dd…         D ¦   «         ¦  «        rt          d„ | j        D ¦   «         ¦  «        rdS | j        D ]©}d|j         vrŒt          |j         d         t          j
        ¦  «        r dS || u pn|j                              dd¦  «        pSt          |t          j        ¦  «        p8t          |t          j        j        ¦  «        pt          |t          j        ¦  «          c S dS )	a  Determine whether ``__tablename__`` should be generated for a model.

    -   If no class in the MRO sets a name, one should be generated.
    -   If a declared attr is found, it should be used instead.
    -   If a name is found, it should be used if the class is a mixin, otherwise one
        should be generated.
    -   Abstract models should not have one generated.

    Later, ``__table_cls__`` will determine if the model looks like single or
    joined-table inheritance. If no primary key is found, the name will be unset.
    Ú__abstract__Fc              3  óJ   K  — | ]}t          |t          j        ¦  «        V — Œd S ©N)re   Úsa_ormÚDeclarativeMeta©Ú.0Úbs     r   ú	<genexpr>z'should_set_tablename.<locals>.<genexpr>  s/   è è € ÐWÐWÀ!�
 1¥fÔ&<Ñ=Ô=ÐWÐWÐWÐWÐWÐWr   r   Nc              3  óN   K  — | ] }|t           j        u p|t           j        u V — Œ!d S ry   )rz   ÚDeclarativeBaseÚDeclarativeBaseNoMetar|   s     r   r   z'should_set_tablename.<locals>.<genexpr>  sK   è è € ð 
ð 
àð •&Ô(Ð(ÐM¨AµÔ1MÐ,Mð
ð 
ð 
ð 
ð 
ð 
r   rU   T)r@   rb   Ú
issubclassrz   r�   r‚   Úanyri   Ú	__bases__re   Údeclared_attrr{   Údecl_apiÚDeclarativeAttributeIntercept)r   rm   s     r   rX   rX     sr  € ð 	Œ×Ò˜¨Ñ/Ô/ðõ ˜3¥Ô!7½Ô9UÐ VÑWÔWðõ ÐWÐWÀsÄ{ÐSTÐSUÐSUÄÐWÑWÔWÑWÔWð	õ ð 
ð 
à”]ð
ñ 
ô 
ñ 
ô 
ðð ˆuà”ð 
ð 
ˆØ $¤-Ð/Ð/Øå�d”m OÔ4µfÔ6JÑKÔKð 	Ø�5�5ð �CˆKð 	ØŒ}× Ò  °Ñ7Ô7ð	õ ˜4¥Ô!7Ñ8Ô8ð Bå˜d¥F¤OÔ$QÑRÔRðBõ ˜d¥FÔ$@ÑAÔAðð
ð 	
ð 	
ð 	
ð ˆ4r   r5   r   c                ó|   — t          j        dd| ¦  «        } |                      ¦   «                              d¦  «        S )z/Convert a ``CamelCase`` name to ``snake_case``.z(((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))z_\1Ú_)ÚreÚsubÚlowerÚlstrip)r5   s    r   rY   rY   ;  s2   € åŒ6Ð=¸vÀtÑLÔL€DØ�:Š:‰<Œ<×Ò˜sÑ#Ô#Ð#r   c                  ó   — e Zd ZdZdS )ÚDefaultMetaúgSQLAlchemy declarative metaclass that provides ``__bind_key__`` and
    ``__tablename__`` support.
    N©r   r   r   r   r   r   r   r�   r�   A  ó   € € € € € ðð ð ð r   r�   c                  ó   — e Zd ZdZdS )ÚDefaultMetaNoNamer‘   Nr’   r   r   r   r•   r•   G  r“   r   r•   )r   r,   r   ru   )r5   r   r   r   )Ú
__future__r   r‹   ÚtypingÚtÚ
sqlalchemyr$   Úsqlalchemy.ormÚormrz   r   r   ÚTYPE_CHECKINGÚ	extensionr   r   r   r,   r2   rL   rT   rq   rX   rY   r{   r�   r•   r   r   r   ú<module>rž      s  ðØ "Ð "Ð "Ð "Ð "Ð "à 	€	€	€	Ø Ð Ð Ð à Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð à„?ð &Ø%Ð%Ð%Ð%Ð%Ð%ð	
ð 	
ð 	
ð 	
ð 	
ñ 	
ô 	
ð 	
ð(/ð (/ð (/ð (/ð (/ñ (/ô (/ð (/ðV3ð 3ð 3ð 3ð 3�Dñ 3ô 3ð 3ð2,ð ,ð ,ð ,ð ,ñ ,ô ,ð ,ð@Bð Bð Bð Bð B�Dñ Bô Bð BðJDð Dð Dð Dð Dñ Dô Dð DðN-ð -ð -ð -ð`$ð $ð $ð $ðð ð ð ð �- °Ô0Fñ ô ð ðð ð ð ð ˜ vÔ'=ñ ô ð ð ð r   