1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
U
¸ý°dMã    @stUdZddlmZddlZddlZddlmZddlZddlZddl    Z    ddl
Z
ddl Z ddl Z ddl Z ddlZddlZddlmZddlmZddlmZddlmZdd    lmZdd
lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddl%Z%ddl&m'Z'ddl&m(Z(ddl)m*Z*ddlm+Z+ddl&m,Z,e#d ƒZ-e#d!d"d#Z.e#d$ed%efd&Z/e#d'd(d&Z0e#d)d*d&Z1e#d+d,d&Z2e#d-d.d&Z3e(j4rd/d0d1œd2d3„Z5nd/d0d1œd4d3„Z5d/d5d6œd7d8„Z6Gd9d:„d:ƒZ7d;d<d=œd>d?„Z8d/d5d@œdAdB„Z9dCd5d=œdDdE„Z:dFdGdHdIœdJdK„Z;dLdMdNœdOdP„Z<dQd5dRdSœdTdU„Z=dVdWdXdYœdZd[„Z>e#d\dGd&Z?dGd]d^œd_d`„Z@dadb„ZAdcddd5dGdeœdfdg„ZBe#dhƒZCe#diƒZDGdjdk„dkƒZEdldm„ZFedd%dnœdodpdqdrdsœdtdu„ƒZGeddvdnœdodpdHdpdsœdwdu„ƒZGddvdnœdodpdHdpdsœdxdu„ZGdGdydzœd{d|„ZHd2dGdHdHd}d~œdd€„ZId3ddHd‚dƒœd„d…„ZJd4d†d‡„ZKd5dCd5d5dQdQdQd‰dŠœd‹dŒ„ZLddŽ„ZMdd„ZNd6d/d‘d’dQd5d“œd”d•„ZOGd–d—„d—ƒZPd˜d™„ZQdšd›„ZRd7ddž„ZSdŸd „ZTd8d¡d¢„ZUe#d£d¤d&ZVGd¥d¦„d¦ee.ƒZWGd§d¨„d¨eWe.ƒZXGd©dª„dªeWe.ƒZYe"rªeWZZeWZ[e\Z]e\Z^neYZZZ]eXZ[Z^d$d$d«œd¬d­„Z_Gd®d¯„d¯ƒZ`e"räe\Zane`jbZaGd°d±„d±ƒZcd/dHd1œd²d³„Zdd5d´dµœd¶d·„Zed/d¸d¹œdºd»„Zfd9ddd5dCdHd¼d½d¾œd¿dÀ„Zgd/dCdMdÁœdÂdÄZhd d;d/d/d dĜdÅdƄZidÇdȜdÉdʄZjd:d/dËdËd̜dÍd΄Zkd/dÏd5d/dМdÑd҄ZldÓdԄZmGdÕdքdÖe\ƒZnGd×d؄dØee-ƒZoGdÙdڄdÚee-ƒZpGdÛd܄dÜee-ƒZqGdÝdބdÞerƒZsGdßdà„dàetƒZuGdádâ„dâeudãZve"rBddälmwZwewZxnevZxe#dåejyd&Zzd;d/dæd5dHdçdèœdédê„Z{da|d/d½dëœdìdí„Z}dGd/d/d/dîœdïdð„Z~d<dòdó„ZGdôdõ„dõe€ƒZd=d5död½d÷œdødù„Z‚d5dúd½dûœdüdý„ZƒiZ„dþe…dÿ<d5dddœdd„Z†e  ‡d¡Zˆd>dddWd½dœd    d
„Z‰d dHd d œdd„ZŠe  ‡d¡Z‹e  ‡d¡ZŒeŒe‹fdydddydœdd„ZetdƒZސdd„ZGdd„dƒZGdd„dƒZ‘dd„Z’dd„Z“d/d5dd œd!d"„Z”d5d5dµœd#d$„Z•död5dWd5d%œd&d'„Z–e  ‡d(¡Z—d5d)d5d*œd+d,„Z˜dydöd-œd.d/„Z™d?d0d1„ZšdS(@z…Routines to help with the creation, loading and introspection of
modules, classes, hierarchies, attributes, functions, and methods.
 
é)Ú annotationsN©Úupdate_wrapper)ÚCodeType)ÚAny)ÚCallable)Úcast)ÚDict)Ú    FrozenSet)ÚGeneric)ÚIterator)ÚList)ÚMapping)ÚNoReturn)ÚOptional)Úoverload)ÚSequence)ÚSet)ÚTuple)ÚType)Ú TYPE_CHECKING)ÚTypeVar)ÚUnioné)Ú _collections)Úcompat)ÚHAS_CYEXTENSION)ÚLiteralé)ÚexcÚ_TÚ_T_coT)Ú    covariantÚ_F.)ÚboundÚ_MPzmemoized_property[Any]Ú_MAz#HasMemoized.memoized_attribute[Any]Ú_HPzhybridproperty[Any]Ú_HMzhybridmethod[Any]rúMapping[str, Any]©ÚobjÚreturncCs
t |¡S©N)ÚinspectÚget_annotations©r+©r1úRd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/util/langhelpers.pyr/Bsr/cCsBt|tƒr|j dd¡}n t|ddƒ}|dkr4tjStd|ƒSdS)NÚ__annotations__r))Ú
isinstanceÚtypeÚ__dict__ÚgetÚgetattrrÚ
EMPTY_DICTr)r+Úannr1r1r2r/Gs 
 Ústr)Úxr,cCs$| d¡}t ¡}| |¡| ¡S)Nzutf-8)ÚencodeÚhashlibÚmd5ÚupdateÚ    hexdigest)r<Úmr1r1r2Úmd5_hexXs
 
rCc@s@eZdZUdZdZded<ddœdd„Zd    d
d d d œdd„ZdS)Ú safe_reraiseaReraise an exception after invoking some
    handler code.
 
    Stores the existing exception info before
    invoking so that it is maintained across a potential
    coroutine context switch.
 
    e.g.::
 
        try:
            sess.commit()
        except:
            with safe_reraise():
                sess.rollback()
 
    TODO: we should at some point evaluate current behaviors in this regard
    based on current greenlet, gevent/eventlet implementations in Python 3, and
    also see the degree to which our own asyncio (based on greenlet also) is
    impacted by this. .rollback() will cause IO / context switch to occur in
    all these scenarios; what happens to the exception context from an
    "except:" block if we don't explicitly store it? Original issue was #2703.
 
    )Ú    _exc_infozfUnion[None, Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[(None, None, None)]]rEÚNone©r,cCst ¡|_dSr-)ÚsysÚexc_inforE©Úselfr1r1r2Ú    __enter__„szsafe_reraise.__enter__zOptional[Type[BaseException]]zOptional[BaseException]zOptional[types.TracebackType]r)Útype_ÚvalueÚ    tracebackr,cCs`|jdk    st‚|dkr@|j\}}}|dk    s.t‚d|_| |¡‚nd|_|dk    sRt‚| |¡‚dSr-)rEÚAssertionErrorÚwith_traceback)rKrMrNrOÚexc_typeÚ    exc_valueÚexc_tbr1r1r2Ú__exit__‡s    zsafe_reraise.__exit__N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú    __slots__r3rLrUr1r1r1r2rD_s
 
 
rDzType[_T]zIterator[Type[_T]])Úclsr,ccsHtƒ}|g}|rD| ¡}||kr$q n
| |¡| | ¡¡|Vq dSr-)ÚsetÚpopÚaddÚextendÚ__subclasses__)r[ÚseenÚstackr1r1r2Úwalk_subclassesšs
rc)Úelementr,cCs:t|tƒr|Sz
t|ƒWStk
r4d|YSXdS)Nzunprintable element %r)r4r;Ú    Exception)rdr1r1r2Ústring_or_unprintable¨s 
 
rfz    Type[Any]cCsd dd„t d|j¡Dƒ¡S)Nú css|]}| ¡VqdSr-)Úlower)Ú.0Únr1r1r2Ú    <genexpr>³sz(clsname_as_plain_name.<locals>.<genexpr>z([A-Z][a-z]+|SQL))ÚjoinÚreÚfindallrV©r[r1r1r2Úclsname_as_plain_name²s
 ÿrpzUnion[Type[Any], object]úCallable[..., Any]Úbool)Úinstance_or_clsÚagainst_methodr,cCs.t|tƒs|j}n|}|j}t||ƒ}||kS)z1Return True if the two class methods don't match.)r4r5Ú    __class__rVr8)rsrtZ current_clsÚ method_nameZcurrent_methodr1r1r2Úmethod_is_overridden¸s 
 
rwÚslicezTuple[Any, ...])Úslcr,cCs>g}|j|j|jfD] }t|dƒr*| ¡}| |¡qt|ƒS)zrdecode a slice object as sent to __getitem__.
 
    takes into account the 2.5 __index__() method, basically.
 
    Ú    __index__)ÚstartÚstopÚstepÚhasattrrzÚappendÚtuple)ryÚretr<r1r1r2Ú decode_sliceÊs 
 r‚z Sequence[str]z Iterator[str])ÚusedÚbasesr,c'sht|ƒ}|D]V‰t ˆft‡fdd„tdƒƒ¡}|D] }||kr4| |¡|Vq q4tdˆƒ‚q dS)Ncs ˆt|ƒSr-©r;)Úi©Úbaser1r2Ú<lambda>Ýóz!_unique_symbols.<locals>.<lambda>ièz&exhausted namespace for symbol base %s)r\Ú    itertoolsÚchainÚmapÚranger^Ú    NameError)rƒr„Zused_setÚpoolÚsymr1r‡r2Ú_unique_symbolsØsþ
r’zCallable[[int], Any]Úintz Iterator[Any])Úfnrjr,ccs*|r&||d@}||ƒV||N}qdS)z6Call the given function given each nonzero bit from n.rNr1)r”rjÚbr1r1r2Úmap_bitsès
r–Ú_FnzCallable[[_Fn], _Fn])Útargetr,csdddœ‡fdd„ }t|ˆƒS)z'A signature-matching decorator factory.r—©r”r,c
s(t |¡st |¡stdƒ‚t |¡}i}t||ƒ}ttd|dƒƒtd|dd…ƒ|j    f}t
|ddƒ\}}t ||d}|  t |d    d
¡|j    |d <d t|dƒkr²d |}nd|}tj|j}|  t|ƒ¡|  |ˆ||d|ji¡ttjt|||j    ƒƒ}    t|d|ƒj|    _||    _ttt|    |ƒƒS)Nznot a decoratable functionzTuple[str, ...]rrér˜r”)r˜r”F©ÚgroupedÚnameÚ__zKdef %(name)s%(grouped_args)s:
    return %(target)s(%(fn)s, %(apply_pos)s)
zJdef %(name)s%(grouped_args)s:
    return %(target)s(%(fn)s, %(apply_kw)s)
rVÚ__func__)r.Ú
isfunctionÚismethodrerÚinspect_getfullargspecÚ!_update_argspec_defaults_into_envr€rrVr’Údictr@Úformat_argspec_plusÚreprrHÚmodulesrWÚvarsÚtypesÚ FunctionTypeÚ_exec_code_in_envr8Ú __defaults__Ú __wrapped__r—r)
r”ÚspecÚenvÚnamesZ    targ_nameÚfn_nameÚmetadataÚcodeÚmodZ    decorated©r˜r1r2ÚdecorateùsD
 
ÿþÿ 
 
üÿ    üÿ  þzdecorator.<locals>.decorater)r˜r¶r1rµr2Ú    decoratorös:r·cCs||jrtg}d}|jD]@}t|ƒjdkrJd|}|||<| |¡|d7}q| |¡qt|ƒ}t|ƒ|d<tj|ŽS|SdS)zCgiven a FullArgSpec, convert defaults to be symbol names in an env.r)ÚbuiltinsÚ __builtin__zx%drršN)Údefaultsr5rWrÚlistr€rÚ FullArgSpec)r®r¯Z new_defaultsr†ÚargrÚelemr1r1r2r£6s
 
 
 
r£zUnion[str, types.CodeType]úDict[str, Any])r³r¯r±r,cCst||ƒ||Sr-)Úexec)r³r¯r±r1r1r2r«Ks
r«Ú_PFÚ_TEc@sJeZdZddddœdd„Zdd„Zdd    d
œd d „Zdddd dœdd„ZdS)Ú PluginLoaderNr;zOptional[Callable[..., Any]])ÚgroupÚauto_fncCs||_i|_||_dSr-)rÄÚimplsrÅ)rKrÄrÅr1r1r2Ú__init__WszPluginLoader.__init__cCs|j ¡dSr-)rÆÚclearrJr1r1r2rÈ^szPluginLoader.clearr)rr,cCs†||jkr|j|ƒS|jr:| |¡}|r:||j|<|ƒSt |j¡D]&}|j|krF|j|j|<| ¡SqFt d|j|f¡‚dS)NzCan't load plugin: %s:%s)    rÆrÅrZimportlib_metadata_getrÄrÚloadrZNoSuchModuleError)rKrÚloaderÚimplr1r1r2rÉas
 
 
 
  ÿzPluginLoader.loadrF)rÚ
modulepathÚobjnamer,cs‡‡fdd„}||j|<dS)Ncs4tˆƒ}ˆ d¡dd…D]}t||ƒ}qt|ˆƒS)NÚ.r)Ú
__import__Úsplitr8)r´Útoken©rÌrÍr1r2rÉus z#PluginLoader.register.<locals>.load)rÆ)rKrrÌrÍrÉr1rÒr2ÚregistertszPluginLoader.register)N)rVrWrXrÇrÈrÉrÓr1r1r1r2rÃVs
ÿrÃcCsnz
tj}Wn2tk
r<t |¡}|dt|dƒfYSX|j}|j}t|j    d|…ƒt|j
|@ƒfSdS)Nrr) r.ÚCO_VARKEYWORDSÚAttributeErrorrr¢rrÚ__code__Ú co_argcountr»Ú co_varnamesÚco_flags)r”Zco_varkeywordsr®ÚcoÚnargsr1r1r2Ú_inspect_func_args~s
 
 þrÜ)Ú_setÚraiseerrr5zOptional[Set[str]]z Literal[True]zSet[str])r[rÝrÞr,cCsdSr-r1©r[rÝrÞr1r1r2Úget_cls_kwargs’sràFcCsdSr-r1rßr1r1r2ràœsc    CsÂ|dk}|rtƒ}|dk    st‚|j dd¡}|oHt|tjƒoHt|jtjƒ}|rˆt    |ƒ\}}| 
|¡|sŒ|sŒ|r‚t d|›dƒ‚qŒdSnd}|r”|r´|j D]}t ||ddkršq´qš| d¡|S)aeReturn the full set of inherited kwargs for the given `cls`.
 
    Probes a class's __init__ method, collecting all named arguments.  If the
    __init__ defines a \**kwargs catch-all, then the constructor is presumed
    to pass along unrecognized keywords to its base classes, and the
    collection process is repeated recursively on each of the bases.
 
    Uses a subset of inspect.getfullargspec() to cut down on method overhead,
    as this is used within the Core typing system to create copies of type
    objects which is a performance-sensitive operation.
 
    No anonymous tuple arguments please !
 
    NrÇFz
given cls z  doesn't have an __init__ method)rÝrK)r\rPr6r7r4r©rªrÖrrÜr@Ú    TypeErrorÚ    __bases__ràÚdiscard)    r[rÝrÞÚtoplevelZctrZhas_initr°Zhas_kwÚcr1r1r2rà£s4 
ÿ ý 
 
ÿ
 
z    List[str]©Úfuncr,cCst |¡dS)zƒReturn the set of legal kwargs for the given `func`.
 
    Uses getargspec so is safe to call for methods, functions,
    etc.
 
    r)rr¢©rçr1r1r2Úget_func_kwargsØsrézcompat.FullArgSpec)r”Úno_selfÚ_is_initr,c    CsDt |¡rtd|ƒ‚n&t |¡rn|rb|rbt |¡}t |jdd…|j|j    |j
|j |j |j ¡St |¡SnÒt |¡rÌ|r¾|s†|jr¾t |j¡}t |jdd…|j|j    |j
|j |j |j ¡St |j¡Sntt |¡ræt|j|ddSt|dƒrþt |j¡St|dƒr4t |j¡r&t|j|dStd    |ƒ‚n td    |ƒ‚dS)
zþReturn the argument signature for any callable.
 
    All pure-Python callables are accepted, including
    functions, methods, classes, objects with __call__;
    builtins and other edge cases like functools.partial() objects
    raise a TypeError.
 
    zCan't inspect builtin: %srNT)rêrërŸÚ__call__)rêzCan't inspect callable: %s)r.Ú    isbuiltinrár rr¢r¼ÚargsÚvarargsÚvarkwrºÚ
kwonlyargsÚkwonlydefaultsrr¡Ú__self__rŸÚisclassÚget_callable_argspecrÇr~rì)r”rêrër®r1r1r2rõãsX
 
 
 ù
 
  ù
 
ÿ   ÿrõz-Union[Callable[..., Any], compat.FullArgSpec]zDict[str, Optional[str]])r”rœr,c     Csºt|ƒrt |¡}n|}tj|Ž}t |d|d|dd|d¡}|dr„|dd}t |ddd…|d|dd|d¡}n"|držd|d}|}nd}|}d}|drÌ|tttt|dƒƒ7}|drä|t|dƒ7}|d|d}|r |d|d…}    nd}    tj||d|d|    d    d
„d }
|drdtj|dd…|d|d|    d d
„d } n|
} |r‚t||||
|| d St|||dd…|
dd…|dd…| dd…d SdS)aReturns a dictionary of formatted, introspected function arguments.
 
    A enhanced variant of inspect.formatargspec to support code generation.
 
    fn
       An inspectable callable or tuple of inspect getargspec() results.
    grouped
      Defaults to True; include (parens, around, argument) lists
 
    Returns:
 
    args
      Full inspect.formatargspec for fn
    self_arg
      The name of the first positional argument, varargs[0], or None
      if the function defines no positional arguments.
    apply_pos
      args, re-written in calling rather than receiving syntax.  Arguments are
      passed positionally.
    apply_kw
      Like apply_pos, except keyword-ish args are passed as keywords.
    apply_pos_proxied
      Like apply_pos but omits the self/cls argument
 
    Example::
 
      >>> format_argspec_plus(lambda self, a, b, c=3, **d: 123)
      {'grouped_args': '(self, a, b, c=3, **d)',
       'self_arg': 'self',
       'apply_kw': '(self, a, b, c=c, **d)',
       'apply_pos': '(self, a, b, c, **d)'}
 
    rrrNéz%s[0]ršr1cSs dt|ƒS©Nú=r…©r<r1r1r2r‰prŠz%format_argspec_plus.<locals>.<lambda>)Ú formatvaluecSs dt|ƒSr÷r…rùr1r1r2r‰yrŠ)Ú grouped_argsÚself_argÚ    apply_posÚapply_kwÚapply_pos_proxiedÚapply_kw_proxiedéÿÿÿÿ)    Úcallablerr¢Úinspect_formatargspecÚlenrrrr¤) r”rœr®rîrýrürÿÚ num_defaultsZ    name_argsZdefaulted_valsrþrr1r1r2r¥s†$ 
ÿ ÿ û
 
ûú    
 
 
 
úr¥cCs||tjkr(d}|rdnd}|r"dnd}n@zt||dWStk
rfd}|rR|nd}|r^dnd    }YnXtd|||||d
S) a format_argspec_plus with considerations for typical __init__ methods
 
    Wraps format_argspec_plus with error handling strategies for typical
    __init__ cases::
 
      object.__init__ -> (self)
      other unreflectable (usually C) -> (self, *args, **kwargs)
 
    z(self)rKz()Úr›z(self, *args, **kwargs)zself, *args, **kwargsz(*args, **kwargs)z*args, **kwargs)rürûrýrþrÿr)ÚobjectrÇr¥rár¤)ÚmethodrœrûrîZproxiedr1r1r2Úformat_argspec_init’s$
 
  úr    r1zCallable[[_T], _T])Ú
target_clsÚtarget_cls_sphinx_nameÚproxy_cls_sphinx_nameÚ classmethodsÚmethodsÚ
attributesr,cCs dd„}|S)aSA class decorator indicating attributes should refer to a proxy
    class.
 
    This decorator is now a "marker" that does nothing at runtime.  Instead,
    it is consumed by the tools/generate_proxy_methods.py script to
    statically generate proxy methods and attributes that are fully
    recognized by typing tools such as mypy.
 
    cSs|Sr-r1ror1r1r2r¶Ãsz&create_proxy_methods.<locals>.decorater1)r
r r r rrr¶r1r1r2Úcreate_proxy_methods±srcCsTz t |¡WStk
rN|tjkr8dgdddfYSdgdddfYSYnXdS)zúinspect.getargspec with considerations for typical __init__ methods
 
    Wraps inspect.getargspec with error handling for typical __init__ cases::
 
      object.__init__ -> (self)
      other unreflectable (usually C) -> (self, *args, **kwargs)
 
    rKNrîÚkwargs)rr¢rárrÇ)rr1r1r2Úgetargspec_initÉs      
rcCs t|tjƒr|js|jS|SdS)zSAdjust the incoming callable such that a 'self' argument is not
    required.
 
    N)r4r©Ú
MethodTyperórŸ)Z func_or_clsr1r1r2Úunbound_method_to_callableÛsrzSequence[Tuple[str, Any]]z%Optional[Union[object, List[object]]])r+Ú additional_kwÚ
to_inspectÚ
omit_kwargr,c    sV|dkrˆg}n
t |¡}tƒ‰g}t ¡}d}t|ƒD]æ\}}zt |j¡}    Wntk
rhYq8Yq8X|    j    rzt
|    j    ƒnd}
|dkrÄ|    j r’|    j }|
r®|  |    j d|
…¡qè|  |    j dd…¡n$| ‡fdd„|    j d|
…Dƒ¡|
r8|    j    söt‚| dd„t|    j |
d…|    j    ƒDƒ¡q8g} |   ‡fdd„|Dƒ¡|dk    rltˆ|ƒrl|   d    d„tˆ|ƒDƒ¡| ¡D]f\} } | |krАqtz6tˆ| ˆƒ}|ˆk    r¾|| kr¾|  d
| |f¡Wntk
rÖYnXqt|r@|D]X\} } z6tˆ| ˆƒ}|ˆk    r"|| kr"|  d
| |f¡Wntk
r:YnXqæd ˆjjd  | ¡fS) z}Produce a __repr__() based on direct association of the __init__()
    specification vs. same-named attributes present.
 
    Nrrcsg|] }|ˆf‘qSr1r1©rir½)Úmissingr1r2Ú
<listcomp> sz generic_repr.<locals>.<listcomp>cSsg|]\}}||f‘qSr1r1)rir½Údefaultr1r1r2rsÿc3s|]}ttˆ|dƒƒVqdSr-)r¦r8rr0r1r2rkszgeneric_repr.<locals>.<genexpr>cSsg|] }t|ƒ‘qSr1©r¦)riÚvalr1r1r2rsz%s=%rz%s(%s)ú, )rÚto_listrÚ OrderedDictÚ    enumeraterr¢rÇrárºrrïr_rîr@rPÚzipr~r8ÚitemsrrerurVrl)r+rrrZpos_argsZkw_argsZvargsr†Zinspr®Z default_lenÚoutputr½Zdefvalrr1)rr+r2Ú generic_reprçsl
 
 
ÿ
ÿþÿ
 
 
r%c@s6eZdZdZdZdd„Zdd„Zd dd    „Zd
d „Zd S)Úportable_instancemethodz_Turn an instancemethod into a (parent, name) pair
    to produce a serializable callable.
 
    )r˜rrÚ __weakref__cCs|j|j|jdœS)N©r˜rrr(rJr1r1r2Ú __getstate__=sýz$portable_instancemethod.__getstate__cCs&|d|_|d|_| dd¡|_dS)Nr˜rrr1)r˜rr7r)rKÚstater1r1r2Ú __setstate__Ds
 
z$portable_instancemethod.__setstate__r1cCs|j|_|j|_||_dSr-)rór˜rVrr)rKÚmethrr1r1r2rÇIsz portable_instancemethod.__init__cOs | |j¡t|j|jƒ||ŽSr-)r@rr8r˜r)rKr½Úkwr1r1r2rìNs z portable_instancemethod.__call__N)r1)    rVrWrXrYrZr)r+rÇrìr1r1r1r2r&5s 
r&cs²|h‰t|jƒ}|rª| ¡}‡fdd„|jDƒ}|D]}| |¡ˆ |¡q4|jdkst|dƒsdq‡fdd„t|t    ƒs€| 
¡n| 
|¡DƒD]}| |¡ˆ |¡qŽqtˆƒS)a'Return an unordered sequence of all classes related to cls.
 
    Traverses diamond hierarchies.
 
    Fibs slightly: subclasses of builtin types are not returned.  Thus
    class_hierarchy(class A(object)) returns (A, object), not A plus every
    class systemwide that derives from object.
 
    c3s|]}|ˆkr|VqdSr-r1©riÚ_©Zhierr1r2rkbsz"class_hierarchy.<locals>.<genexpr>r¸r`csg|]}|ˆkr|‘qSr1r1r.r0r1r2rksúz#class_hierarchy.<locals>.<listcomp>) r»Ú__mro__r]rârr^rWr~Ú
issubclassr5r`)r[Úprocessrår„r•Úsr1r0r2Úclass_hierarchySs$ 
 
 
ÿ
û
    
r5ccs@t|ƒ}|D].}|jD]"}||jkr||j|fVq qq dS)zÍiterate all the keys and attributes associated
    with a class, without using getattr().
 
    Does not use getattr() so that class-sensitive
    descriptors (i.e. property.__get__()) are not called.
 
    N)Údirr1r6)r[ÚkeysÚkeyrår1r1r2Úiterate_attributesys 
 
r9ú
self.proxyc    s<|r
|}n$ˆdkrd‰‡‡fdd„t|ƒDƒ}|D]}z4t||ƒ}t|dƒsRWq2t|d|ƒ}ttj|ƒ}    Wntk
r„Yq2YnXz2t |    ¡}
t     |
d¡} t     |
ddd…¡} Wnt
k
rÔd    } d
} YnXd t ƒ} |dk    rð||ipòi}t | |ƒz|    j ||_ Wntk
r$YnXtˆ|||ƒq2dS) z9Automates delegation of __specials__ for a proxying type.N)rZÚ__del__Ú__getattribute__Ú __metaclass__r)r+cs6g|].}| d¡r| d¡rtˆ|ƒs|ˆkr|‘qS)rž)Ú
startswithÚendswithr~©rirB©Úinto_clsÚskipr1r2rŸs 
 
 
úz0monkeypatch_proxied_specials.<locals>.<listcomp>rìrŸrrz(self, *args, **kw)z (*args, **kw)z?def %(method)s%(fn_args)s: return %(name)s.%(method)s%(d_args)s)r6r8r~rr©rªrÕrr¢rráÚlocalsrÀr¬Úsetattr)rBZfrom_clsrCÚonlyrZ from_instanceZdundersrZmaybe_fnr”r®Zfn_argsZd_argsÚpyr¯r1rAr2Úmonkeypatch_proxied_specials‰sF
 þ
 
 
 
 
 
ÿÿÿ
rHcCst|d|ƒt|d|ƒkS)z;Return True if the two methods are the same implementation.rŸ)r8)Zmeth1Zmeth2r1r1r2Úmethods_equivalentÌs
 ÿrIc Csp|s|stdƒ‚t|tƒr(t||ƒr(|St|p>dd„t|ƒDƒƒ}tt|ƒƒ}tj}t|tƒrd|}n|svtƒ}tj}nt|ƒ}|| |¡|ƒr’|St|t    ƒsÆ|tjkrªdp¬d}td||d 
|¡fƒ‚Gdd    „d    ƒ}|räd
|j |_ tƒ}    t |ƒD]R\}
} |
|krtd |
ƒ‚t | ƒs*td |
| fƒ‚t||
t| ƒƒ|     |
¡qò||    |ƒrV|Std d 
||    ¡ƒ‚dS)aŽEnsure basic interface compliance for an instance or dict of callables.
 
    Checks that ``obj`` implements public methods of ``cls`` or has members
    listed in ``methods``. If ``required`` is not supplied, implementing at
    least one interface method is sufficient. Methods present on ``obj`` that
    are not in the interface are ignored.
 
    If ``obj`` is a dict and ``dict`` does not meet the interface
    requirements, the keys of the dictionary are inspected. Keys present in
    ``obj`` that are not in the interface will raise TypeErrors.
 
    Raises TypeError if ``obj`` does not meet the interface criteria.
 
    In all passing cases, an object with callable members is returned.  In the
    simple case, ``obj`` is returned as-is; if dict processing kicks in then
    an anonymous class is returned.
 
    obj
      A type, instance, or dictionary of callables.
    cls
      Optional, a type.  All public methods of cls are considered the
      interface.  An ``obj`` instance of cls will always pass, ignoring
      ``required``..
    methods
      Optional, a sequence of method names to consider as the interface.
    required
      Optional, a sequence of mandatory implementations. If omitted, an
      ``obj`` that provides at least one interface method is considered
      sufficient.  As a convenience, required may be a type, in which case
      all public methods of the type are required.
 
    z2a class or collection of method names are requiredcSsg|]}| d¡s|‘qS)r/)r>r@r1r1r2rûs
z as_interface.<locals>.<listcomp>zany ofzall ofz%r does not implement %s: %src@seZdZdZdS)z(as_interface.<locals>.AnonymousInterfacezA callable-holding shell.N©rVrWrXrYr1r1r1r2ÚAnonymousInterfacesrKZ    Anonymousz%r: unknown in this interfacez%r=%r is not callablez,dictionary does not contain required keys %sN)rár4r5r\r6ÚoperatorÚgeÚgtÚ intersectionr¤rlrVÚdictlike_iteritemsrrEÚ staticmethodr^) r+r[rÚrequiredZ    interfaceZ implementedZcompliesZ    qualifierrKÚfoundrrËr1r1r2Ú as_interfaceÔsP! 
 
ÿÿ 
 
   ÿÿrTÚ_GFDzgeneric_fn_descriptor[Any]c@sÊeZdZUdZded<ded<ded<d$ddd    œd
d „Zed d dd dœdd„ƒZeddddœdd„ƒZd ddddœdd„Zer ddd dœdd„Z    dd dœdd„Z
dd dœdd „Z e ddd d!œd"d#„ƒZ dS)%Úgeneric_fn_descriptoragDescriptor which proxies a function when the attribute is not
    present in dict
 
    This superclass is organized in a particular way with "memoized" and
    "non-memoized" implementation classes that are hidden from type checkers,
    as Mypy seems to not be able to handle seeing multiple kinds of descriptor
    classes used for the same attribute.
 
    zCallable[..., _T_co]Úfgetú Optional[str]rYr;rVN©rWÚdoccCs||_|p|j|_|j|_dSr-©rWrYrV©rKrWrZr1r1r2rÇ<s zgeneric_fn_descriptor.__init__rUrFr©rKr+r[r,cCsdSr-r1©rKr+r[r1r1r2Ú__get__Aszgeneric_fn_descriptor.__get__rr!©r+r[r,cCsdSr-r1r^r1r1r2r_EszUnion[_GFD, _T_co]cCs
tƒ‚dSr-©ÚNotImplementedErrorr^r1r1r2r_Is©ÚinstancerNr,cCsdSr-r1©rKrdrNr1r1r2Ú__set__Nszgeneric_fn_descriptor.__set__©rdr,cCsdSr-r1)rKrdr1r1r2Ú
__delete__Qsz generic_fn_descriptor.__delete__r*cCs
tƒ‚dSr-ra©rKr+r1r1r2Ú_resetTszgeneric_fn_descriptor._reset)r+rr,cCs
tƒ‚dSr-ra©r[r+rr1r1r2ÚresetWszgeneric_fn_descriptor.reset)N)rVrWrXrYr3rÇrr_rrfrhrjÚ classmethodrlr1r1r1r2rV-s 
 
rVc@seZdZdZesdd„ZdS)Ú_non_memoized_propertyzÉa plain descriptor that proxies a function.
 
    primary rationale is to provide a plain attribute that's
    compatible with memoized_property which is also recognized as equivalent
    by mypy.
 
    cCs|dkr |S| |¡Sr-©rWr^r1r1r2r_gsz_non_memoized_property.__get__N)rVrWrXrYrr_r1r1r1r2rn\srnc@s0eZdZdZesdd„Zdd„Zedd„ƒZdS)    Ú_memoized_propertyz2A read-only @property that is only evaluated once.cCs&|dkr |S| |¡|j|j<}|Sr-)rWr6rV©rKr+r[Úresultr1r1r2r_rsz_memoized_property.__get__cCst ||j¡dSr-)rprlrVrir1r1r2rjxsz_memoized_property._resetcCs|j |d¡dSr-)r6r]rkr1r1r2rl{sz_memoized_property.resetN)    rVrWrXrYrr_rjrmrlr1r1r1r2rpms rpr™cs‡fdd„}t|ˆƒS)zàDecorate a method memoize its return value.
 
    Best applied to no-arg methods: memoization is not sensitive to
    argument values, and will always return the same value even when
    called with different arguments.
 
    cs<ˆ|f|ž|މ‡fdd„}ˆj|_ˆj|_||jˆj<ˆS)NcsˆSr-r1©Úar-©rrr1r2Úmemo©sz6memoized_instancemethod.<locals>.oneshot.<locals>.memo)rVrYr6©rKrîr-rv©r”rur2Úoneshot¦s   z(memoized_instancemethod.<locals>.oneshotr)r”ryr1rxr2Úmemoized_instancemethods     rzc@s~eZdZUdZesdZeƒZded<ddœdd„Z    ddœd    d
„Z
d d dd œdd„Z Gdd„de e ƒZedddœdd„ƒZdS)Ú HasMemoizedzA mixin class that maintains the names of memoized elements in a
    collection for easy cache clearing, generative, etc.
 
    r1zFrozenSet[str]Ú_memoized_keysrFrGcCs|jD]}|j |d¡qdSr-)r|r6r]©rKr¾r1r1r2Ú_reset_memoizationsÁs
zHasMemoized._reset_memoizationscCs|jD]}||jkst‚qdSr-)r|r6rPr}r1r1r2Ú_assert_no_memoizationsÅs
z#HasMemoized._assert_no_memoizationsr;r)r8rNr,cCs||j|<|j|hO_dSr-)r6r|)rKr8rNr1r1r2Ú_set_memoized_attributeÉs
z#HasMemoized._set_memoized_attributec@sreZdZUdZded<ded<ded<dddd    œd
d „Zed d dd dœdd„ƒZeddddœdd„ƒZdd„ZdS)zHasMemoized.memoized_attributezTA read-only @property that is only evaluated once.
 
        :meta private:
 
        úCallable[..., _T]rWrXrYr;rVNrYcCs||_|p|j|_|j|_dSr-r[r\r1r1r2rÇØs z'HasMemoized.memoized_attribute.__init__r&rFrr]cCsdSr-r1r^r1r1r2r_Þsz&HasMemoized.memoized_attribute.__get__r r`cCsdSr-r1r^r1r1r2r_âscCs8|dkr |S| |¡|j|j<}|j|jhO_|Sr-)rWr6rVr|rqr1r1r2r_æs
)N)rVrWrXrYr3rÇrr_r1r1r1r2Úmemoized_attributeÍs
r‚r#r™cs"dddddœ‡fdd„ }t|ˆƒS)zMDecorate a method memoize its return value.
 
        :meta private:
 
        r)rKrîr-r,csNˆ|f|ž|މ‡fdd„}ˆj|_ˆj|_||jˆj<|jˆjhO_ˆS)NcsˆSr-r1rsrur1r2rvøszBHasMemoized.memoized_instancemethod.<locals>.oneshot.<locals>.memo)rVrYr6r|rwrxrur2ryõs  z4HasMemoized.memoized_instancemethod.<locals>.oneshotr)r[r”ryr1rxr2rzís z#HasMemoized.memoized_instancemethodN)rVrWrXrYrrZÚ    frozensetr|r3r~rr€Úmemoized_propertyr r‚rmrzr1r1r1r2r{´s
 r{c@s,eZdZdZdZdd„Zdddœdd    „Zd
S) Ú MemoizedSlotszÇApply memoized items to an object using a __getattr__ scheme.
 
    This allows the functionality of memoized_property and
    memoized_instancemethod to be available to a class using __slots__.
 
    r1cCs t|ƒ‚dSr-)rÕ)rKr8r1r1r2Ú_fallback_getattrszMemoizedSlots._fallback_getattrr;r)r8r,csžˆ d¡sˆ d¡rtˆƒ‚n|tˆjdˆ›ƒrRtˆdˆ›ƒƒ}tˆˆ|ƒ|Stˆjdˆ›ƒrtˆdˆ›ƒ‰‡‡‡fdd„}ˆj|_|Sˆ ˆ¡SdS)NZ_memoized_attr_Z_memoized_method_cs6ˆ||މ‡fdd„}ˆj|_ˆj|_tˆˆ|ƒˆS)NcsˆSr-r1rsrur1r2rv)sz8MemoizedSlots.__getattr__.<locals>.oneshot.<locals>.memo)rVrYrE)rîr-rv©r”r8rKrur2ry&s 
  z*MemoizedSlots.__getattr__.<locals>.oneshot)r>rÕr~rur8rErYr†)rKr8rNryr1r‡r2Ú __getattr__sÿ
  zMemoizedSlots.__getattr__N)rVrWrXrYrZr†rˆr1r1r1r2r…
sr…cCsBt|tƒr:| ¡ ¡}|dkr"dS|dkr.dStd|ƒ‚t|ƒS)N)ÚtrueÚyesÚonÚyÚtÚ1T)ÚfalseÚnoÚoffrjÚfÚ0FzString is not true/false: %r)r4r;ÚstriprhÚ
ValueErrorrrr0r1r1r2Úasbool8s
  r–z!Callable[[str], Union[str, bool]])Útextr,csdddœ‡fdd„ }|S)zqReturn a callable that will evaluate a string as
    boolean, or one of a set of "alternate" string values.
 
    r;zUnion[str, bool]r*cs|ˆkr |St|ƒSdSr-)r–r0©r—r1r2Ú bool_or_valueJsz"bool_or_str.<locals>.bool_or_valuer1)r—r™r1r˜r2Ú bool_or_strDsršú Optional[int])rNr,cCs|dkr |St|ƒS)zCoerce to integer.N)r“)rNr1r1r2ÚasintSsrœzOptional[Dict[str, Any]]rF)r-r8rMÚ
flexi_boolÚdestr,cCsj|dkr |}||krft|tƒr,t|||ƒsf||dk    rf|tkrV|rVt||ƒ||<n|||ƒ||<dS)zµIf 'key' is present in dict 'kw', coerce its value to type 'type\_' if
    necessary.  If 'flexi_bool' is True, the string '0' is considered false
    when coercing to boolean.
    N)r4r5rrr–)r-r8rMrržr1r1r2Úcoerce_kw_type[s ÿþ þ
ý rŸr`cs$t|ƒ}|ft‡fdd„|DƒƒS)zbProduce a tuple structure that is cacheable using the __dict__ of
    obj to retrieve values
 
    c3s&|]}|ˆjkr|ˆj|fVqdSr-©r6©riÚkr0r1r2rk{s
z"constructor_key.<locals>.<genexpr>)ràr€)r+r[r°r1r0r2Úconstructor_keyusÿr£)r+r[rîr-r,cs0t|ƒ}| ‡fdd„| |¡Dƒ¡|||ŽS)z„Instantiate cls using the __dict__ of obj as constructor arguments.
 
    Uses inspect to match the named arguments of ``cls``.
 
    c3s&|]}|ˆjkr|ˆj|fVqdSr-r r¡r0r1r2rkˆs
z#constructor_copy.<locals>.<genexpr>)ràr@Ú
difference)r+r[rîr-r°r1r0r2Úconstructor_copy€s
ÿr¥zCallable[[], int]rGcs$t ¡‰t d¡‰‡‡fdd„}|S)z%Return a threadsafe counter function.rc
s$ˆtˆƒW5QR£SQRXdSr-)Únextr1©ÚcounterÚlockr1r2Ú_next•szcounter.<locals>._next)Ú    threadingÚLockr‹Úcount)rªr1r§r2r¨Žs
r¨zOptional[Type[Any]])Úspecimenrr,cCs˜t|dƒr*|jdk    r$t|jtƒr$tS|jSt|tƒr8tnt}||tƒrJtS||tƒrXtS||tƒrftSt|dƒrttSt|dƒr‚tSt|dƒrtS|SdS)zÄGiven an instance or class, guess if it is or is acting as one of
    the basic collection types: list, set and dict.  If the __emulates__
    property is present, return that preferentially.
    Ú __emulates__Nrr^r\)r~r¯r2r\r4r5r»r¤)r®rZisar1r1r2Úduck_type_collectionœs*
 ÿ
 
 
 
 
 
r°z'Union[Tuple[Type[Any], ...], Type[Any]])r½Úargtyperr,cCs^t||ƒr|St|tƒrBt d|d dd„|Dƒ¡t|ƒf¡‚nt d||t|ƒf¡‚dS)Nz8Argument '%s' is expected to be one of type %s, got '%s'z or css|]}d|VqdS)z'%s'Nr1)rirtr1r1r2rkÈsz"assert_arg_type.<locals>.<genexpr>z6Argument '%s' is expected to be of type '%s', got '%s')r4r€rÚ ArgumentErrorrlr5)r½r±rr1r1r2Úassert_arg_type¿s
 
ÿÿ ÿÿr³cstˆdƒrtˆ ¡ƒStˆdtˆddƒƒ‰ˆdkr>tdˆƒ‚tˆdƒr\‡‡fdd„}|ƒStˆd    ƒr€t‡fd
d „ˆ ¡DƒƒStdˆƒ‚dS) z?Return a (key, value) iterator for almost any dict-like object.r#Ú __getitem__r7NzObject '%r' is not dict-likeÚiterkeysc3s,ˆ ¡D]}ˆdk    st‚|ˆ|ƒfVqdSr-)rµrP)r8©ÚdictlikeÚgetterr1r2ÚiteratorÝs  z$dictlike_iteritems.<locals>.iteratorr7c3s|]}|ˆ|ƒfVqdSr-r1)rir8)r¸r1r2rkäsz%dictlike_iteritems.<locals>.<genexpr>)r~r»r#r8ráÚiterr7)r·r¹r1r¶r2rPÑs
 
 
rPcsHeZdZUdZded<ddddœ‡fdd„ Zd dd    dd
œd d „Z‡ZS)Ú classpropertyaAA decorator that behaves like @property except that operates
    on classes rather than instances.
 
    The decorator is currently special when using the declarative
    module, but note that the
    :class:`~.sqlalchemy.ext.declarative.declared_attr`
    decorator should be used for this purpose with declarative.
 
    zCallable[[Any], Any]rWr)rWr½r-cs tƒj|f|ž|Ž|j|_dSr-)ÚsuperrÇrY)rKrWr½r-©rur1r2rÇöszclassproperty.__init__NzOptional[type]r`cCs
| |¡Sr-ror^r1r1r2r_úszclassproperty.__get__)N)rVrWrXrYr3rÇr_Ú __classcell__r1r1r½r2r»és
 
r»c@s<eZdZddœdd„Zddddœdd    „Zd
d d œd d„ZdS)ÚhybridpropertyrrècCs||_||_dSr-)rçÚclslevel©rKrçr1r1r2rÇÿszhybridproperty.__init__rr ©rdÚownerr,cCs$|dkr| |¡}|S| |¡SdSr-©rÀrç©rKrdrÃZclsvalr1r1r2r_s
zhybridproperty.__get__rqzhybridproperty[_T]ræcCs
||_|Sr-©rÀrÁr1r1r2Ú
classlevel
szhybridproperty.classlevelN)rVrWrXrÇr_rÇr1r1r1r2r¿þsr¿c@s^eZdZddœdd„Zddddœdd    „Zddd
d œd d „Zdddœdd„Zdddœdd„ZdS)Úrw_hybridpropertyrrècCs||_||_d|_dSr-)rçrÀÚsetfnrÁr1r1r2rÇszrw_hybridproperty.__init__rr rÂcCs$|dkr| |¡}|S| |¡SdSr-rÄrÅr1r1r2r_s
zrw_hybridproperty.__get__rFrccCs|jdk    st‚| ||¡dSr-)rÉrPrer1r1r2rfszrw_hybridproperty.__set__rqzrw_hybridproperty[_T]ræcCs
||_|Sr-)rÉrÁr1r1r2Úsetter szrw_hybridproperty.settercCs
||_|Sr-rÆrÁr1r1r2rÇ$szrw_hybridproperty.classlevelN)rVrWrXrÇr_rfrÊrÇr1r1r1r2rÈs
rÈc@s@eZdZdZddœdd„Zddddœdd    „Zd
d d œd d„ZdS)Ú hybridmethodz/Decorate a function as cls- or instance- level.rrècCs||_|_||_dSr-)rçrŸrÀrÁr1r1r2rÇ,s zhybridmethod.__init__rrÂcCs*|dkr|j ||j¡S|j ||¡SdSr-)rÀr_rurç)rKrdrÃr1r1r2r_0szhybridmethod.__get__rqzhybridmethod[_T]ræcCs
||_|Sr-rÆrÁr1r1r2rÇ6szhybridmethod.classlevelN)rVrWrXrYrÇr_rÇr1r1r1r2rË)srËc@s\eZdZUdZded<iZded<e ¡Zdddddd    œd
d „Z    d d „Z
dd„Z dd„Z dS)ÚsymbolaIA constant symbol.
 
    >>> symbol('foo') is symbol('foo')
    True
    >>> symbol('foo')
    <symbol 'foo>
 
    A slight refinement of the MAGICCOOKIE=object() pattern.  The primary
    advantage of symbol() is its repr().  They are also singletons.
 
    Repeated calls of symbol('name') will all return the same instance.
 
    r;rzDict[str, symbol]ÚsymbolsNrXr›)rrZÚ    canonicalr,c
Csœ|jŒ|j |¡}|dkrbt|tƒs*t‚|dkr:t|ƒ}t t    |¡}||_
|rV||_ ||j|<n |r‚||kr‚t d|›d|›ƒ‚|W5QR£SQRXdS)Nz#Can't replace canonical symbol for z with new int value ) Ú_lockrÍr7r4r;rPÚhashr“Ú__new__rÌrrYrá)r[rrZrÎr‘r1r1r2rÑOs     ÿzsymbol.__new__cCst|jdt|ƒffS)Nr<)rÌrr“rJr1r1r2Ú
__reduce__mszsymbol.__reduce__cCst|ƒSr-rrJr1r1r2Ú__str__pszsymbol.__str__cCsd|j›dS)Nzsymbol(ú)©rrJr1r1r2Ú__repr__sszsymbol.__repr__)NN) rVrWrXrYr3rÍr«r¬rÏrÑrÒrÓrÖr1r1r1r2rÌ;s
 ürÌc@s0eZdZddddddœdd„Zd    d
œd d „Zd S)Ú _IntFlagMetar;zTuple[Type[Any], ...]r¿rrF)Ú    classnamer„Údict_r-r,c    Kszg|_}| ¡D]L\}}t|tƒr2t||d}n| d¡stdƒ‚nqt|||ƒ| |¡qt     
dd„|Dƒ¡|_ dS)N)rÎr/z#Expected integer values for IntFlagcSsi|] }|j|“qSr1rÕ)rir‘r1r1r2Ú
<dictcomp>Œsz)_IntFlagMeta.__init__.<locals>.<dictcomp>) Z_itemsr#r4r“rÌr>rárErrZ immutabledictÚ __members__)    r[rØr„rÙr-r#r¢Úvr‘r1r1r2rÇxs
 
 
 
   ÿz_IntFlagMeta.__init__zIterator[symbol]rGcCs tdƒ‚dS)Nz“iter not implemented to ensure compatibility with Python 3.11 IntFlag.  Please use __members__.  See https://github.com/python/cpython/issues/99304rarJr1r1r2Ú__iter__sÿz_IntFlagMeta.__iter__N)rVrWrXrÇrÝr1r1r1r2r×wsr×c@seZdZdZdS)Ú _FastIntFlagzÆAn 'IntFlag' copycat that isn't slow when performing bitwise
    operations.
 
    the ``FastIntFlag`` class will return ``enum.IntFlag`` under TYPE_CHECKING
    and ``_FastIntFlag`` otherwise.
 
    NrJr1r1r1r2rÞ—srÞ)Ú    metaclass)ÚIntFlagÚ_EzDict[_E, List[Any]]z Optional[_E])r½ÚchoicesrÚresolve_symbol_namesr,cCsn| ¡D]>\}}||kr |S|r6||jkr6|S||kr|Sq|dkrTdSt d|›d|›¡‚dS)aOGiven a user parameter, parse the parameter into a chosen value
    from a list of choice objects, typically Enum values.
 
    The user argument can be a string name that matches the name of a
    symbol, or the symbol object itself, or any number of alternate choices
    such as True/False/ None etc.
 
    :param arg: the user argument.
    :param choices: dictionary of enum values to lists of possible
        entries for each.
    :param name: name of the argument.   Used in an :class:`.ArgumentError`
        that is raised if the parameter doesn't match any available argument.
 
    NzInvalid value for 'z': )r#rrr²)r½rârrãZ
enum_valueÚchoicer1r1r2Úparse_user_argument_for_enum¬s
rårgcCst|_td7adS)zÞAssign a '_creation_order' sequence to the given instance.
 
    This allows multiple instances to be sorted in order of creation
    (typically within a single thread; the counter is not particularly
    threadsafe).
 
    rN)Ú_creation_order)rdr1r1r2Úset_creation_orderÑs    rç)rçrîrr,cOs>z |||ŽWStk
r8tdt ¡dd…ƒYnXdS)zXexecutes the given function, catches all exceptions and converts to
    a warning.
 
    z%s('%s') ignoredrrN)reÚwarnrHrI)rçrîrr1r1r2Úwarn_exceptionÞs réécCsFz(t|ƒ|kr d|d|…WS|WSWntk
r@|YSXdS)Nz%s...r)rrá)rNZlen_r1r1r2Úellipses_stringés  
rëcsTeZdZUdZded<dddddœ‡fdd„ Zdd    œd
d „Zd d dœdd„Z‡ZS)Ú_hash_limit_stringa/A string subclass that can only be hashed on a maximum amount
    of unique values.
 
    This is used for warnings so that we can send out parameterized warnings
    without the __warningregistry__ of the module,  or the non-overridable
    "once" registry within warnings.py, overloading memory,
 
 
    r“Ú_hashr;ú Sequence[Any])rNÚnumrîr,cs<||d|}tƒ ||¡}td|t|ƒ|fƒ|_|S)Nz6 (this warning may be suppressed after %d occurrences)z%s_%d)r¼rÑrÐrí)r[rNrïrîZ interpolatedrKr½r1r2rÑs ÿz_hash_limit_string.__new__rGcCs|jSr-)rírJr1r1r2Ú__hash__
sz_hash_limit_string.__hash__rrr)Úotherr,cCst|ƒt|ƒkSr-)rÐ)rKrñr1r1r2Ú__eq__ sz_hash_limit_string.__eq__)    rVrWrXrYr3rÑrðròr¾r1r1r½r2rìós
 
 
 
rìrX)Úmsgr³r,cCs(|rttj||dƒn t|tjƒdS)zdIssue a warning.
 
    If msg is a string, :class:`.exc.SAWarning` is used as
    the category.
 
    )r³N)Ú_warnings_warnrÚ    SAWarning)rór³r1r1r2rèsrèrî)rórîr,cCs |rt|d|ƒ}t|tjƒdS)z\Issue a warning with a parameterized string, limiting the number
    of registrations.
 
    é
N)rìrôrrõ)rórîr1r1r2Ú warn_limiteds r÷z)Dict[CodeType, Tuple[str, Type[Warning]]]Ú _warning_tagsz Type[Warning]zCallable[[_F], _F])ÚmessageÚcategoryr,cs‡‡fdd„}|S)Ncsˆˆft|j<|Sr-)rørÖrx©rúrùr1r2Úgo.sz#tag_method_for_warnings.<locals>.gor1)rùrúrür1rûr2Útag_method_for_warnings+srýz&^(?:sqlalchemy\.(?!testing)|alembic\.)zUnion[str, Warning]zOptional[Type[Warning]])rùrúÚ
stacklevelr,cCsìzt |¡}Wn&tk
r&d}Yn’d}Yn„Xd}}|dk    r¸|sdt t|j dd¡¡sdd}|jt    kr˜d}t    |j\}}|p†|}|›d|›d}|j
}|s¬|d7}q>|r>|r>q¸q>|dk    rÖt j |||dd    nt j ||dd    dS)
NrFrVrTz (rÔr)rþ) rHÚ    _getframer•rmÚmatchÚ_not_sa_patternÚ    f_globalsr7Úf_coderøÚf_backÚwarningsrè)rùrúrþÚframeZstacklevel_foundZwarning_tag_foundÚ_suffixZ    _categoryr1r1r2rô8s4
 ÿ
 
rôrzCallable[..., Optional[_T]])r”Úretry_on_exceptionr,cs$ˆg‰ddddœ‡‡‡fdd„ }|S)zNDecorate the given function to be a no-op after it is called exactly
    once.rz Optional[_T]©r½r-r,cs@ˆ}ˆr<ˆ ¡}z |||ŽWSˆr4ˆ d|¡‚YnXdS)Nr)r]Úinsert)r½r-Z    strong_fnZonce_fn©r”Úoncerr1r2rüts  zonly_once.<locals>.gor1)r”rrür1r r2Ú    only_oncelsr z%sqlalchemy/([a-z_]+/){0,2}[a-z_]+\.pyzunit(?:2|test2?/)zre.Pattern[str])ÚtbÚexclude_prefixÚexclude_suffixr,cCs`d}t|ƒd}||kr0| ||¡r0|d7}q||krP| ||¡rP|d8}q0|||d…S)atChop extraneous lines off beginning and end of a traceback.
 
    :param tb:
      a list of traceback lines as returned by ``traceback.format_stack()``
 
    :param exclude_prefix:
      a regular expression object matching lines to skip at beginning of
      ``tb``
 
    :param exclude_suffix:
      a regular expression object matching lines to skip at end of ``tb``
    rr)rÚsearch)rrrr{Úendr1r1r2Úchop_tracebackŠs 
 
rcCs$d|}tƒ ¡}t||ƒ|dS)Nz&def set(obj, value):    obj.%s = valuer\)rDÚcopyrÀ)Úattrnamer³r¯r1r1r2Ú
attrsetter§s
 
rcs*eZdZdZdZddœ‡fdd„ Z‡ZS)Ú
TypingOnlyz“A mixin class that marks a class as 'typing only', meaning it has
    absolutely no methods, attributes, or runtime functionality whatsoever.
 
    r1rFrGcsLt|jkr>t|jƒ dddddh¡}|r>td|›d|›dƒ‚tƒ ¡dS)    NrWrYrZÚ__orig_bases__r3zClass z< directly inherits TypingOnly but has additional attributes rÎ)rrâr\r6r¤rPr¼Ú__init_subclass__)r[Ú    remainingr½r1r2r¶s
 
ûÿ    ÿzTypingOnly.__init_subclass__)rVrWrXrYrZrr¾r1r1r½r2r®srcsDeZdZUdZded<ddœ‡fdd„ Zeddd    œd
d „ƒZ‡ZS) Ú EnsureKWArga6Apply translation of functions to accept \**kw arguments if they
    don't already.
 
    Used to ensure cross-compatibility with third party legacy code, for things
    like compiler visit methods that need to accept ``**kw`` arguments,
    but may have been copied from old code that didn't accept them.
 
    r;Ú ensure_kwargrFrGcsf|j}|j}|rX|D]B}t ||¡}|r||}t |¡}|js| |¡}t|||ƒqt    ƒ 
¡dSr-) rr6rmrrr¢rðÚ
_wrap_w_kwrEr¼r)r[Zfn_regZclsdictr8rBr”r®Úwrappedr½r1r2rÜs 
 
zEnsureKWArg.__init_subclass__rqr™cs ddddœ‡fdd„ }t|ˆƒS)Nrr    csˆ|ŽSr-r1)r½r-rxr1r2Úwrapìsz$EnsureKWArg._wrap_w_kw.<locals>.wrapr)r[r”rr1rxr2rêszEnsureKWArg._wrap_w_kw)    rVrWrXrYr3rrmrr¾r1r1r½r2rÉs
 
        rcCsjt|dƒrt||ƒS|}|jj|_t|dƒr4|j|_t|jdƒrT|jjrT|jj|_n|jrb|j|_|SdS)z‘Augment functools.update_wrapper() to work with objects with
    a ``__call__()`` method.
 
    :param fn:
      object with __call__ method
 
    rVrWrYN)r~rrurVrWrìrY)Úwrapperr”Z_fr1r1r2Ú wrap_callableòs
 
 
 
 r!cCsÈd|kr| d¡Sd}gg}d}t|ƒ}||krº||}|dkr†|dkr|||dkr|||ddkr||d d¡|d7}q°|dN}n*|dkr¢|dkr¢| g¡n|d |¡|d7}q(dd„|DƒS)aÄParse a dotted identifier with accommodation for quoted names.
 
    Includes support for SQL-style double quotes as a literal character.
 
    E.g.::
 
        >>> quoted_token_parser("name")
        ["name"]
        >>> quoted_token_parser("schema.name")
        ["schema", "name"]
        >>> quoted_token_parser('"Schema"."Name"')
        ['Schema', 'Name']
        >>> quoted_token_parser('"Schema"."Name""Foo"')
        ['Schema', 'Name""Foo']
 
    ú"rÎrrrcSsg|]}d |¡‘qS)r)rl)rirÑr1r1r2r3sz'quoted_token_parser.<locals>.<listcomp>)rÐrr)rNr*rrÚidxÚlvÚcharr1r1r2Úquoted_token_parser
s$
$
 
 
r&)Úparamsr—r,cst ˆ¡‰‡‡fdd„}|S)Ncs:|jdk    r|jpd}|r0t|‡fdd„ˆDƒƒ}||_|S)Nrcsi|]
}|ˆ“qSr1r1)riÚparamr˜r1r2rÚ<sz8add_parameter_text.<locals>.decorate.<locals>.<dictcomp>)rYÚinject_param_text)r”rZ©r'r—r1r2r¶9s
z$add_parameter_text.<locals>.decorate)rr)r'r—r¶r1r*r2Úadd_parameter_text6s
r+cCsN| dd¡}t|ƒdkr|S|\}}| d¡s@|dt |¡St |¡SdS)NÚ
rrg)rÐrr>ÚtextwrapÚdedent)r—Z
split_textÚ    firstlinerr1r1r2Ú_dedent_docstringCs  
r0)Ú given_doctextÚ
injecttextÚposr,cCsªt|pdƒ}| d¡}t|ƒdkr,| d¡t |¡ d¡}|drP| dd¡dd„t|ƒDƒ}| dd¡|t|t|ƒdƒ}|d|…|||d…}d     |¡S)Nrr,rrcSsg|]\}}| ¡s|‘qSr1)r”)rirïÚliner1r1r2rZsz)inject_docstring_text.<locals>.<listcomp>)
r0rÐrrr-r.r
r!Úminrl)r1r2r3ÚdoctextÚlinesZ injectlinesZblanksZ
inject_posr1r1r2Úinject_docstring_textOs 
 
  r8z(\s+):param (.+?):zDict[str, str])r6Ú inject_paramsr,c
Cs t | ¡¡}g}d}|r| ¡}t |¡}|dkr |rö| d¡ d¡}||krödt| d¡ƒd}|r’t     d|d¡}    |    r’dt|     d¡ƒ}|||}nV|rº| 
d|dg¡d}n<|  ¡sØ| 
||dg¡d}n|  d¡rö| 
|| ¡g¡q|  |¡qd |¡S)    NrÚ*rgrz(\s+)\Srr,z::)Ú collectionsÚdequeÚ
splitlinesÚpopleftÚ
_param_regrrÄÚlstriprrmr_Úrstripr?rrl)
r6r9Zdoclinesr7Z    to_injectr4rBr(ÚindentÚm2r1r1r2r)fs6
 
 r))r°r,cCs‚t|ƒdkrdSt|ƒdk}|r,|dd…n|dd…|dd…}dd„|Dƒ}|r`d |¡Sd    d |dd…¡|dfSdS)
zŒTrims a list of strings from the middle and return a string of up to
    four elements. Strings greater than 11 characters will be truncatedrNröršrcSs,g|]$}t|ƒdkr$d|dd…n|‘qS)é z%s..N)r)rirr1r1r2r˜sz$repr_tuple_names.<locals>.<listcomp>rz %s, ..., %s)rrl)r°ÚflagÚresr1r1r2Úrepr_tuple_names‘s  (
rGcCstrdS|rtdƒ‚ndSdS)NTzDcython extensions were expected to be installed, but are not presentF)rÚ ImportError)Zraise_r1r1r2Úhas_compiled_extŸsÿrI)FF)T)T)r1r1r1)r1Nr1)NNr:N)NNN)TN)N)F)rê)N)Nr)F)›rYÚ
__future__rr;ÚenumÚ    functoolsrr>r.r‹rLrmrHr-r«r©rÚtypingrrrr    r
r r r rrrrrrrrrrrrrrrZ_has_cyrrrr r!r#r%r&r'r(Zpy310r/rCrDrcrfrprwr‚r’r–r—r·r£r«rÁrÂrÃrÜràrérõr¥r    rrrr%r&r5r9rHrIrTrUrVrnrpr„Znon_memoized_propertyÚpropertyZro_memoized_propertyZro_non_memoized_propertyrzr{Z!HasMemoized_ro_memoized_attributer‚r…r–ršrœrŸr£r¥r¨r°r³rPr»r¿rÈrËr“rÌr5r×rÞràZ FastIntFlagÚEnumrárårærçrérër;rìrèr÷rør3rýÚcompilerrôr Z_SQLA_REZ _UNITTEST_RErZNoneTyperrrr!r&r+r0r8r?r)rGrIr1r1r1r2Ú<module>    sh                                ;
     @(ü    ÿÿ5 ÿ;ÿu #úüN&ú
C V /P.  û ÿ#< 
 ü" 
 
 
ý 4  ý  )  ,   +