Ë
    ðmxi<  ã                  ó4  — d dl mZ d dlm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 ej                  r6d
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 ddlmZ  G d„ d«      Z	 	 	 	 	 	 	 	 dd„Z y)é    )Úannotations)Ú
attrgetterN)ÚAny)ÚCallable)Úcast)ÚOptional)ÚType)ÚUnioné   )Úurlé   )Úutil)ÚEngine)Ú_CoreAnyExecuteParams)ÚCoreExecuteOptionsParameter)ÚDialect)ÚURL)Ú
Executable)ÚInvokeDDLBase)ÚHasSchemaAttr)Ú	Visitablec                  óê   — e Zd ZU dd„Z ee ed„ «      «      Zded<    ee e e	d«      «      «      Z
ded<    ee ed„ «      «      Zd	ed
<   dd„Zdd„Zdd„Z	 	 	 	 	 	 	 	 dd„Z	 	 d	 	 	 	 	 	 	 dd„Zy)ÚMockConnectionÚdialectr   c                ó    — || _         || _        y ©N)Ú_dialectÚ_execute_impl)Úselfr   Úexecutes      úM/home/htdocs/ttos/venv/lib/python3.12/site-packages/sqlalchemy/engine/mock.pyÚ__init__zMockConnection.__init__$   s   € ØˆŒØ$ˆÕó    c                ó   — | S r   © ©Úss    r!   ú<lambda>zMockConnection.<lambda>(   s   € °!€ r#   r   Úenginer   c                ó.   — | j                   j                  S r   )r   Únamer&   s    r!   r(   zMockConnection.<lambda>*   s   € ¨Q¯Z©Z¯_©_€ r#   Ústrr+   c                ó   — | S r   r%   )r   Úkwargss     r!   ÚconnectzMockConnection.connect,   ó   € Øˆr#   c                ó   — |j                   S r   )Úschema)r   Úobjs     r!   Úschema_for_objectz MockConnection.schema_for_object/   s   € Ø�z‰zÐr#   c                ó   — | S r   r%   )r   Úkws     r!   Úexecution_optionsz MockConnection.execution_options2   r0   r#   c                óV   — d|d<    |d| j                   | dœ|¤Žj                  |«       y )NFÚ
checkfirst)r   Ú
connectionr%   )r   Útraverse_single)r   ÚvisitorcallableÚelementr.   s       r!   Ú_run_ddl_visitorzMockConnection._run_ddl_visitor5   s6   € ð  %ˆˆ|ÑÙð 	
Ø—L‘L¨Tñ	
Ø5;ñ	
ç
‰/˜'Õ
"r#   Nc                ó&   — | j                  ||«      S r   )r   )r   r3   Ú
parametersr7   s       r!   r    zMockConnection.execute@   s   € ð ×!Ñ! # zÓ2Ð2r#   )r   r   r    zCallable[..., Any])r.   r   Úreturnr   )r3   r   rA   zOptional[str])r6   r   rA   r   )r<   zType[InvokeDDLBase]r=   r   r.   r   rA   ÚNone)NN)r3   r   r@   zOptional[_CoreAnyExecuteParams]r7   z%Optional[CoreExecuteOptionsParameter]rA   r   )Ú__name__Ú
__module__Ú__qualname__r"   r   r   Úpropertyr)   Ú__annotations__r   r   r+   r/   r4   r7   r>   r    r%   r#   r!   r   r   #   s¿   … ó%ñ ˜#™x©Ó4Ó5€FˆFÓ5Ù˜C¡©*°ZÓ*@Ó!AÓB€GˆWÓBÙ�S™(Ñ#<Ó=Ó>€Dˆ#Ó>óóóð	#à,ð	#ð ð	#ð ð		#ð
 
ó	#ð 7;ØCGð	3àð3ð 4ð3ð Að	3ð
 
ô3r#   r   c                óÞ   — t        j                  | «      }|j                  «       }i }t        j                  |«      D ]  }||v sŒ|j                  |«      ||<   Œ  |di |¤Ž}t        ||«      S )a?  Create a "mock" engine used for echoing DDL.

    This is a utility function used for debugging or storing the output of DDL
    sequences as generated by :meth:`_schema.MetaData.create_all`
    and related methods.

    The function accepts a URL which is used only to determine the kind of
    dialect to be used, as well as an "executor" callable function which
    will receive a SQL expression object and parameters, which can then be
    echoed or otherwise printed.   The executor's return value is not handled,
    nor does the engine allow regular string statements to be invoked, and
    is therefore only useful for DDL that is sent to the database without
    receiving any results.

    E.g.::

        from sqlalchemy import create_mock_engine


        def dump(sql, *multiparams, **params):
            print(sql.compile(dialect=engine.dialect))


        engine = create_mock_engine("postgresql+psycopg2://", dump)
        metadata.create_all(engine, checkfirst=False)

    :param url: A string URL which typically needs to contain only the
     database backend name.

    :param executor: a callable which receives the arguments ``sql``,
     ``*multiparams`` and ``**params``.  The ``sql`` parameter is typically
     an instance of :class:`.ExecutableDDLElement`, which can then be compiled
     into a string using :meth:`.ExecutableDDLElement.compile`.

    .. versionadded:: 1.4 - the :func:`.create_mock_engine` function replaces
       the previous "mock" engine strategy used with
       :func:`_sa.create_engine`.

    .. seealso::

        :ref:`faq_ddl_as_string`

    r%   )Ú_urlÚmake_urlÚget_dialectr   Úget_cls_kwargsÚpopr   )r   Úexecutorr6   ÚuÚdialect_clsÚdialect_argsÚkr   s           r!   Úcreate_mock_enginerS   I   sq   € ô` 	�‰�cÓ€Aà—-‘-“/€Kà€Lä× Ñ  Ó-ò (ˆØ�Š7Ø Ÿf™f Q›iˆL˜ŠOð(ñ
 Ñ)˜LÑ)€Gä˜' 8Ó,Ð,r#   )r   zUnion[str, URL]rN   r   r6   r   rA   r   )!Ú
__future__r   Úoperatorr   Útypingr   r   r   r   r	   r
   Ú r   rI   r   ÚTYPE_CHECKINGÚbaser   Ú
interfacesr   r   r   r   Úsql.baser   Úsql.ddlr   Ú
sql.schemar   Úsql.visitorsr   r   rS   r%   r#   r!   ú<module>r_      s~   ðõ #å Û Ý Ý Ý Ý Ý Ý å Ý ð 
×ÒÝÝ1Ý7Ý#ÝÝ%Ý'Ý*Ý(÷#3ñ #3ðL=-Ø	ð=-Ø$'ð=-Ø/2ð=-àô=-r#   