Files
Home-AssistantConfig/deps/sqlalchemy/testing/__pycache__/engines.cpython-34.pyc

77 lines
12 KiB
Plaintext
Raw Normal View History

2016-10-11 16:42:06 +00:00
<EFBFBD>
}<7D><>W<EFBFBD>$<00>@swddlmZddlZddlmZddlmZddlmZmZddl Z ddl
Z
Gdd <00>d e <00>Z e <00>Z d
d <00>Zed d <00><00>Zedd<00><00>Zedd<00><00>Zedd<00><00>Zddd<00>ZGdd<00>de <00>Zdddd<00>Zdddd<00>Zddd<00>ZGdd<00>de <00>ZGd d!<00>d!e <00>Zeed"d#<00>ZdS)$<24>)<01>absolute_importN<74>)<01>config)<01> decorator<6F>)<02>event<6E>poolc@s<>eZdZdd<00>Zdd<00>Zdd<00>Zdd<00>Zd d
<00>Zd d <00>Zd d<00>Z dd<00>Z
dd<00>Z dd<00>Z dd<00>Z dd<00>Zdd<00>ZdS)<1C>ConnectionKillercCs.tj<00>|_tj<00>|_t<00>|_dS)N)<06>weakref<65>WeakKeyDictionary<72>
proxy_refs<EFBFBD>testing_engines<65>set<65>conns)<01>self<6C>r<00>@/tmp/pip-build-zkr322cu/sqlalchemy/sqlalchemy/testing/engines.py<70>__init__szConnectionKiller.__init__cCsd|j|<dS)NT)r )r<00>enginerrr<00>
add_engineszConnectionKiller.add_enginecCs|jj||f<00>dS)N)r<00>add)rZ
dbapi_conn<EFBFBD>
con_recordrrr<00>connectszConnectionKiller.connectcCsd|j|<dS)NT)r )r<00> dbapi_conrZ con_proxyrrr<00>checkoutszConnectionKiller.checkoutcCs|jj||f<00>dS)N)r<00>discard)rrr<00> exceptionrrr<00>
invalidate"szConnectionKiller.invalidatecCsHy |<00>Wn6tk
rC}ztjd|<16>WYdd}~XnXdS)Nz5testing_reaper couldn't rollback/close connection: %s)<03> Exception<6F>warnings<67>warn)r<00>fn<66>errr<00>_safe%s  zConnectionKiller._safecCsFx?t|j<00>D].}|dk r|jr|j|j<00>qqWdS)N)<05>listr <00>is_validr#<00>rollback)r<00>recrrr<00> rollback_all-szConnectionKiller.rollback_allcCsFx?t|j<00>D].}|dk r|jr|j|j<00>qqWdS)N)r$r r%r#Z_close)rr'rrr<00> close_all2szConnectionKiller.close_allcCs4x-t|j<00>D]\}}|j|j<00>qWdS)N)r$rr#r&)r<00>connr'rrr<00>_after_test_ctx7sz ConnectionKiller._after_test_ctxcCs'tjjr|j<00>n
|j<00>dS)N)r<00>optionsZlow_connections<6E>_stop_test_ctx_minimal<61>_stop_test_ctx_aggressive)rrrr<00>_stop_test_ctx@s  zConnectionKiller._stop_test_ctxcCsP|j<00>t<00>|_x3t|j<00>D]"}|tjk r&|j<00>q&q&WdS)N)r)rrr$r r<00>db<64>dispose)rr'rrrr-Fs

 z'ConnectionKiller._stop_test_ctx_minimalcCsw|j<00>x6t|j<00>D]%\}}|j|j<00>d|_qWt<00>|_x!t|j<00>D]}|j<00>q_WdS)N) r)r$rr#<00>close<73>
connectionrr r1)rr*r'rrrr.Os
  z*ConnectionKiller._stop_test_ctx_aggressivecCs0x)|jD]}|jr
ds(t<00>q
q
WdS)NF)r r%<00>AssertionError)rr'rrr<00>assert_all_closedYs z"ConnectionKiller.assert_all_closedN)<10>__name__<5F>
__module__<EFBFBD> __qualname__rrrrrr#r(r)r+r/r-r.r5rrrrr s          
r c Cs<>tj<00>t|d<00>r&|j<00>ntjjjsqddlm }|j
ddd<00><01>|j |<00>WdQXn |j |<00>dS)Nr2r)<01>
assertionszCan't sort tablesZassert_F) <0C>testing_reaperr)<00>hasattrr2rr0<00>dialectZsupports_alter<65>r9Zexpect_warningsZdrop_all)<03>metadata<74>bindr9rrr<00>drop_all_tablesas
 r@c
Os#z|||<00>Wdtj<00>XdS)N)r:r5)r!<00>args<67>kwrrr<00>assert_conns_closedosrCc
Os#z|||<00>Wdtj<00>XdS)zBDecorator that rolls back all open connections after fn execution.N)r:r()r!rArBrrr<00>rollback_open_connectionswsrDcOstj<00>|||<00>dS)z:Decorator that closes all connections before fn execution.N)r:r))r!rArBrrr<00> close_first<73>s
rEc
Os#z|||<00>Wdtj<00>XdS)z9Decorator that closes all connections after fn execution.N)r:r))r!rArBrrr<00>close_open_connections<6E>srFccs<>ddlj}xk|jD]`}|r7||kr7qnt||d<00>}|snttd|<16>j|<00>}n|j<00>VqWdS)Nrzsqlalchemy.databases.%s)Zsqlalchemy.databasesZ databases<65>__all__<5F>getattr<74>
__import__r<)<04>exclude<64>d<>name<6D>modrrr<00> all_dialects<74>srNc@sLeZdZdd<00>Zdd<00>Zdd<00>Zdd<00>Zd d
<00>Zd S) <0C>ReconnectFixturecCs||_g|_dS)N)<02>dbapi<70> connections)rrPrrrr<00>s zReconnectFixture.__init__cCst|j|<00>S)N)rHrP)r<00>keyrrr<00> __getattr__<5F>szReconnectFixture.__getattr__cOs)|jj||<00>}|jj|<00>|S)N)rPrrQ<00>append)rrA<00>kwargsr*rrrr<00>szReconnectFixture.connectcCsHy |<00>Wn6tk
rC}ztjd|<16>WYdd}~XnXdS)Nz.ReconnectFixture couldn't close connection: %s)rrr )rr!r"rrrr#<00>s  zReconnectFixture._safecCs7x't|j<00>D]}|j|j<00>qWg|_dS)N)r$rQr#r2)r<00>crrr<00>shutdown<77>szReconnectFixture.shutdownN)r6r7r8rrSrr#rWrrrrrO<00>s
    rOcs<>|ptjj}tjjj}|s0i}nt|<00>|d<t||<00><00><00>j<00><00><00>fdd<00>}<00>jjj<00>_ |<00>_<00>S)N<>modulecs<00>jjj<00><01><00>dS)N)r<rPrWr)<02>_disposerrrr1<00>sz$reconnecting_engine.<locals>.dispose)
rr0<00>urlr<rPrO<00>testing_enginer1rWZ test_shutdown)rZr,rPr1r)rYrr<00>reconnecting_engine<6E>s   r\cCsTddlm}ddlm}|s/d}n|jdd<00>}|pPtjj}||<00>}|dkr<>tjdks<>|jtjjjkr<>tj }q<>i}n|||<00>}d|_
t |j t j <00>r<>d|j _d|j _n|rPtj|j dtj<00>tj|j dtj<00>tj|j d tj<00>tj|<00>n|S)
zBProduce an engine configured by --options with optional overrides.r)<01> create_engine)<01>make_urlT<6C>
use_reaperNrrr)<17>
sqlalchemyr]Zsqlalchemy.engine.urlr^<00>poprr0rZZ
drivernameZdb_optsZ _has_events<74>
isinstancerZ QueuePool<6F>_timeoutZ _max_overflowr<00>listenr:rrrr)rZr,r]r^r_rrrrr[<00>s,   '    r[cs<>ddlm}|s%tjj}ng<00><00>fdd<00>}<00>fdd<00>}<00>fdd<00>}||d d
d d |<00><02>t<00>d <00> s<>t<00><00><00>_|<00>_|<00>_ <00>S) a'Provides a mocking engine based on the current testing.db.
This is normally used to test DDL generation flow as emitted
by an Engine.
It should not be used in other cases, as assert_compile() and
assert_sql_execution() are much better choices with fewer
moving parts.
r)r]cs<00>j|<00>dS)N)rT)Zsql<71>arB)<01>bufferrr<00>executorszmock_engine.<locals>.executorcs/dd<00><00>D<>}||ks+t|<00><00>dS)NcSs+g|]!}tjddt|<00><00><00>qS)z[\n\t]r=)<03>re<72>sub<75>str)<02>.0<EFBFBD>srrr<00>
<listcomp> s z3mock_engine.<locals>.assert_sql.<locals>.<listcomp>)r4)Zstmts<74>recv)rfrr<00>
assert_sql szmock_engine.<locals>.assert_sqlcs,<00>j<00>dj<00>fdd<00><00>jD<><00>S)N<>
c3s'|]}t|jd<00><00><01>VqdS)r<N)rj<00>compile)rkrl)rKrr<00> <genexpr>sz1mock_engine.<locals>.print_sql.<locals>.<genexpr>)r<<00>join<69>mockr)r)rKr<00> print_sqls zmock_engine.<locals>.print_sqlz://Zstrategyrtrg)
r`r]rr0rLr;r4rtroru)Z dialect_namer]rgrorur)rfrr<00> mock_engine<6E>s     rvc@sIeZdZdZdd<00>Zddd<00>Zdd<00>Zd d
<00>ZdS) <0B>DBAPIProxyCursorzuProxy a DBAPI cursor.
Tests can provide subclasses of this to intercept
DBAPI-level cursor operations.
cOs+||_||_|j||<00>|_dS)N)rr3<00>cursor)rrr*rArUrrrr's  zDBAPIProxyCursor.__init__NcKs3|r|jj|||<00>S|jj||<00>SdS)N)rx<00>execute)r<00>stmtZ
parametersrBrrrry,szDBAPIProxyCursor.executecKs|jj|||<00>S)N)rx<00> executemany)rrz<00>paramsrBrrrr{2szDBAPIProxyCursor.executemanycCst|j|<00>S)N)rHrx)rrRrrrrS5szDBAPIProxyCursor.__getattr__)r6r7r8<00>__doc__rryr{rSrrrrrws
  rwc@sFeZdZdZdd<00>Zdd<00>Zdd<00>Zdd <00>Zd
S) <0B>DBAPIProxyConnectionz}Proxy a DBAPI connection.
Tests can provide subclasses of this to intercept
DBAPI-level connection operations.
cCs/|jj<00>|_|_||_||_dS)N)rZ_creatorr*Z _sqla_unwrapr<00>
cursor_cls)rrrrrrrAs zDBAPIProxyConnection.__init__cOs|j|j|j||<00>S)N)rrr*)rrArUrrrrxFszDBAPIProxyConnection.cursorcCs|jj<00>dS)N)r*r2)rrrrr2IszDBAPIProxyConnection.closecCst|j|<00>S)N)rHr*)rrRrrrrSLsz DBAPIProxyConnection.__getattr__N)r6r7r8r}rrxr2rSrrrrr~9s
   r~cs)<00><00>fdd<00>}tdi|d6<>S)zIProduce an engine that provides proxy hooks for
common methods.
cs<00>tj<00><00>S)N)rr0r)<02>conn_clsrrr<00> mock_connVsz"proxying_engine.<locals>.mock_connr,Zcreator)r[)r<>rr<>r)r<>rr<00>proxying_enginePsr<>)<1B>
__future__rr
r=r<00>utilrrrrhr<00>objectr r:r@rCrDrErFrNrOr\r[rvrwr~r<>rrrr<00><module>s,   L  
  !#*