zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
U
¸ý°d˜ùã@spUdZddlmZddlmZddlZddlZddl    Z    ddl
Z
ddl Z ddl m Z ddl mZddl mZddl mZddl mZdd    l mZdd
l mZdd l mZdd l mZdd l mZddl mZddl mZddl mZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl#m%Z%ddl#m&Z&ddl'm(Z(ddlm)Z)ddlm*Z*ddlm+Z,ddl"m-Z-dd l"m.Z.dd!l"m/Z/dd"l"m0Z0dd#l"m1Z1dd$l"m2Z2dd%l"m3Z3dd&l4m5Z5d'd(lm6Z6d'd)lm7Z7d'd*lm8Z8d'd+lm9Z9d'd,l:m;Z;d'd-l9m<Z<d'd.l9m=Z=d'd/l>m?Z?d'd0l>m@Z@d'd1l>mAZAerÈdd2lBmCZCdd3lBmDZDdd4l mEZEdd5lFmGZGdd6l"mHZHdd7l"mIZIdd8l"mJZJdd9l"mKZKd'd:lLmMZMed;d<d=ZNed>e d=ZOed?d@d=ZPGdAdB„dBe2ƒZQGdCdD„dDe2ƒZRGdEdF„dFe2ƒZSGdGdH„dHeRe1eTƒZUGdIdJ„dJeUƒZVGdKdL„dLeUƒZWGdMdN„dNeVƒZXGdOdP„dPeQe1eYƒZZGdQdR„dReZƒZ[GdSdT„dTeZƒZ\edUeej]e^fd=Z_GdVdW„dWeQe1e_ƒZ`GdXdY„dYe`e_ƒZaGdZd[„d[eae_ƒZbGd\d]„d]ƒZcGd^d_„d_eceQe1ejƒZdGd`da„daeceQe1ejeƒZfGdbdc„dceceQe1ejgƒZhGddde„dee1eiƒZjGdfdg„dgejƒZkGdhdi„die&e2ƒZlGdjdk„dkeUele-e1eeTe    jmfƒZmGdldm„dme0enƒZoGdndo„doele-e1epƒZqGdpdq„dqeQe1ejrƒZsGdrds„dse-ese0ejrƒZtGdtdu„dueSe1e ƒZuGdvdw„dwe&eSeRe1ee ƒZvGdxdy„dye1ee dzfƒZwGd{d|„d|eae_ƒZxGd}d~„d~eae_ƒZyGdd€„d€ebe_ƒZzGdd‚„d‚ebe_ƒZ{Gdƒd„„d„e`e_ƒZ|Gd…d†„d†e`e_ƒZ}Gd‡dˆ„dˆeZƒZ~e~ZGd‰dŠ„dŠe[ƒZ€Gd‹dŒ„dŒe\ƒZGddŽ„dŽedƒZ‚Gdd„dedƒZƒGd‘d’„d’efƒZ„Gd“d”„d”ehƒZ…Gd•d–„d–eVƒZ†Gd—d˜„d˜eVƒZ‡Gd™dš„dšeUƒZˆGd›dœ„dœeWƒZ‰Gddž„džeUƒZŠGdŸd „d eWƒZ‹Gd¡d¢„d¢ekƒZŒGd£d¤„d¤ejƒZGd¥d¦„d¦ejƒZŽGd§d¨„d¨eqƒZGd©dª„dªe1dƒZGd«d¬„d¬e(e1e ƒZ‘Gd­d®„d®eqƒZ’ed¯eTeƒZ“Gd°d±„d±e1e“ƒZ”Gd²d³„d³e”e“ƒZeƒZ•eqƒZ–eUƒZ—eZƒZ˜e`ƒZ™d´ešdµ<e’ƒZ›e‘ƒZœedd¶d·Zehd¶d·Zže\ƒZŸedƒZ ehƒZ¡eUƒZ¢eWƒZ£eYeZƒe^eaƒepe–ee”ƒej]e`ƒejeefƒeje ejge¡ejretƒe¤dƒe•eiekƒeTe¢e    jmeme    jmƒe@eme    jmƒiZ¥d¸ešd¹<e¥j¦Z§d<d@dºœd»d¼„Z¨e–e"_–e—e"_—e˜e"_˜e•e"_•e™e"_™e›e"_›eSe"_©Z©eœe"_œe¨e"_¨dS)½zSQL specific types.
 
é)Ú annotationsN)ÚAny)ÚCallable)Úcast)ÚDict)ÚList)ÚOptional)Úoverload)ÚSequence)ÚTuple)ÚType)Ú TYPE_CHECKING)ÚTypeVar)ÚUnion)ÚUUIDé)Ú    coercions©Úelements)Ú    operators)Úroles)Útype_api)Ú
_NONE_NAME)ÚNO_ARG)ÚSchemaEventTarget)Ú HasCacheKey)Ú quoted_name)ÚSlice)Ú
TypeCoerce)ÚEmulated)ÚNativeForEmulated)Ú to_instance)Ú TypeDecorator)Ú
TypeEngine)ÚTypeEngineMixin)ÚVariant)ÚInternalTraversalé)Úevent)Úexc)Ú
inspection)Úutil)Ú
processors)Ú langhelpers)Ú OrderedDict)Ú
is_literal)ÚLiteral)Útyping_get_args)Ú_ColumnExpressionArgument)Ú_TypeEngineArgument)Ú OperatorType)ÚMetaData)Ú_BindProcessorType)Ú_ComparatorFactory)Ú_MatchedOnType)Ú_ResultProcessorType)ÚDialectÚ_Tr)ÚboundÚ_CTÚ_TEúTypeEngine[Any]c@s@eZdZUdZedd„ƒZGdd„dejeƒZeZ    de
d<dS)    ÚHasExpressionLookupz¾Mixin expression adaptations based on lookup tables.
 
    These rules are currently used by the numeric, integer and date types
    which have detailed cross-expression coercion rules.
 
    cCs
tƒ‚dS©N©ÚNotImplementedError©Úself©rFúNd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/sql/sqltypes.pyÚ_expression_adaptations[sz+HasExpressionLookup._expression_adaptationsc@s(eZdZdZejZddddœdd„ZdS)    zHasExpressionLookup.ComparatorrFr4úTypeEngine.Comparator[Any]ú$Tuple[OperatorType, TypeEngine[Any]]©ÚopÚother_comparatorÚreturncCsp|jj}trt|jtƒst‚|jj ||j¡ ||j¡}||krJ||jfS||jjkr`||jfS|t    |ƒfSdSrA)
ÚtypeÚ_type_affinityr Ú
isinstancer@ÚAssertionErrorrHÚgetÚ _blank_dictr!)rErLrMZ    othertypeÚlookuprFrFrGÚ_adapt_expressiondsÿþ
 
z0HasExpressionLookup.Comparator._adapt_expressionN)Ú__name__Ú
__module__Ú __qualname__Ú    __slots__r+Ú
EMPTY_DICTrTrVrFrFrFrGÚ
Comparator_sr\ú_ComparatorFactory[Any]Úcomparator_factoryN) rWrXrYÚ__doc__ÚpropertyrHr#r\r=r^Ú__annotations__rFrFrFrGr@Rs
 
 
r@c@s4eZdZUdZGdd„dejeƒZeZded<dS)Ú ConcatenablezOA mixin that marks a type as supporting 'concatenation',
    typically strings.cs*eZdZdZddddœ‡fdd„ Z‡ZS)zConcatenable.ComparatorrFr4rIrJrKcs<|tjkr*t|tjtjfƒr*tj|jjfSt    ƒ 
||¡SdSrA) rÚaddrQrbr\ÚNullTypeÚ    concat_opÚexprrOÚsuperrV©rErLrM©Ú    __class__rFrGrVs  
þz)Concatenable.Comparator._adapt_expression)rWrXrYrZrVÚ __classcell__rFrFrirGr\~sr\r]r^N©    rWrXrYr_r#r\r;r^rarFrFrFrGrbys
rbc@s4eZdZUdZGdd„dejeƒZeZded<dS)Ú    IndexablezhA mixin that marks a type as supporting indexing operations,
    such as array or JSON structures.
 
    c@s eZdZdZdd„Zdd„ZdS)zIndexable.ComparatorrFcCs
tƒ‚dSrArB)rEÚindexrFrFrGÚ_setup_getitemšsz#Indexable.Comparator._setup_getitemcCs | |¡\}}}|j|||dS)N)Ú result_type)roZoperate)rErnZ adjusted_opZadjusted_right_exprrprFrFrGÚ __getitem__süÿz Indexable.Comparator.__getitem__N)rWrXrYrZrorqrFrFrFrGr\—sr\r]r^NrlrFrFrFrGrm‘s
rmc@sZeZdZdZdZddddœdd„Zd    d
„Zd d „Zd d„Zdd„Z    e
dd„ƒZ dd„Z dS)ÚStringzûThe base for all string and character types.
 
    In SQL, corresponds to VARCHAR.
 
    The `length` field is usually required when the `String` type is
    used within a CREATE TABLE statement, as VARCHAR requires a length
    on most databases.
 
    ÚstringNú Optional[int]ú Optional[str]©ÚlengthÚ    collationcCs||_||_dS)a
        Create a string-holding type.
 
        :param length: optional, a length for the column for use in
          DDL and CAST expressions.  May be safely omitted if no ``CREATE
          TABLE`` will be issued.  Certain databases may require a
          ``length`` for use in DDL, and will raise an exception when
          the ``CREATE TABLE`` DDL is issued if a ``VARCHAR``
          with no length is included.  Whether the value is
          interpreted as bytes or characters is database specific.
 
        :param collation: Optional, a column-level collation for
          use in DDL and CAST expressions.  Renders using the
          COLLATE keyword supported by SQLite, MySQL, and PostgreSQL.
          E.g.:
 
          .. sourcecode:: pycon+sql
 
            >>> from sqlalchemy import cast, select, String
            >>> print(select(cast('some string', String(collation='utf8'))))
            {printsql}SELECT CAST(:param_1 AS VARCHAR COLLATE utf8) AS anon_1
 
          .. note::
 
            In most cases, the :class:`.Unicode` or :class:`.UnicodeText`
            datatypes should be used for a :class:`_schema.Column` that expects
            to store non-ascii data. These datatypes will ensure that the
            correct types are used on the database.
 
        Nrv)rErwrxrFrFrGÚ__init__¸s$zString.__init__cCs| ¡r tStSdSrA)ÚisasciiÚ_STRINGÚ_UNICODE©rEÚvaluerFrFrGÚ_resolve_for_literalßszString._resolve_for_literalcs‡fdd„}|S)Ncs(| dd¡}ˆjjr | dd¡}d|S)Nú'ú''ú%z%%ú'%s')ÚreplaceZidentifier_preparerZ_double_percents©r~©ÚdialectrFrGÚprocessés  z)String.literal_processor.<locals>.processrF©rEr‡rˆrFr†rGÚliteral_processorès zString.literal_processorcCsdSrArF©rEr‡rFrFrGÚbind_processorószString.bind_processorcCsdSrArF©rEr‡ÚcoltyperFrFrGÚresult_processoröszString.result_processorcCstSrA©ÚstrrDrFrFrGÚ python_typeùszString.python_typecCs|jSrA)ÚSTRING©rEÚdbapirFrFrGÚget_dbapi_typeýszString.get_dbapi_type)NN) rWrXrYr_Ú__visit_name__ryrrŠrŒrr`r’r–rFrFrFrGrrªs
ý'     
rrc@seZdZdZdZdS)ÚTextzåA variably sized string type.
 
    In SQL, usually corresponds to CLOB or TEXT.  In general, TEXT objects
    do not have a length; while some databases will accept a length
    argument here, it will be rejected by others.
 
    ÚtextN©rWrXrYr_r—rFrFrFrGr˜sr˜cs&eZdZdZdZd‡fdd„    Z‡ZS)ÚUnicodeaA variable length Unicode string type.
 
    The :class:`.Unicode` type is a :class:`.String` subclass that assumes
    input and output strings that may contain non-ASCII characters, and for
    some backends implies an underlying column type that is explicitly
    supporting of non-ASCII data, such as ``NVARCHAR`` on Oracle and SQL
    Server.  This will impact the output of ``CREATE TABLE`` statements and
    ``CAST`` functions at the dialect level.
 
    The character encoding used by the :class:`.Unicode` type that is used to
    transmit and receive data to the database is usually determined by the
    DBAPI itself. All modern DBAPIs accommodate non-ASCII strings but may have
    different methods of managing database encodings; if necessary, this
    encoding should be configured as detailed in the notes for the target DBAPI
    in the :ref:`dialect_toplevel` section.
 
    In modern SQLAlchemy, use of the :class:`.Unicode` datatype does not
    imply any encoding/decoding behavior within SQLAlchemy itself.  In Python
    3, all string objects are inherently Unicode capable, and SQLAlchemy
    does not produce bytestring objects nor does it accommodate a DBAPI that
    does not return Python Unicode objects in result sets for string values.
 
    .. warning:: Some database backends, particularly SQL Server with pyodbc,
       are known to have undesirable behaviors regarding data that is noted
       as being of ``NVARCHAR`` type as opposed to ``VARCHAR``, including
       datatype mismatch errors and non-use of indexes.  See the section
       on :meth:`.DialectEvents.do_setinputsizes` for background on working
       around unicode character issues for backends like SQL Server with
       pyodbc as well as cx_Oracle.
 
    .. seealso::
 
        :class:`.UnicodeText` - unlengthed textual counterpart
        to :class:`.Unicode`.
 
        :meth:`.DialectEvents.do_setinputsizes`
 
 
    ÚunicodeNc stƒjfd|i|—ŽdS)zs
        Create a :class:`.Unicode` object.
 
        Parameters are the same as that of :class:`.String`.
 
        rwN©rgry©rErwÚkwargsrirFrGry:szUnicode.__init__)N©rWrXrYr_r—ryrkrFrFrirGr›s(r›cs&eZdZdZdZd‡fdd„    Z‡ZS)Ú UnicodeTexta#An unbounded-length Unicode string type.
 
    See :class:`.Unicode` for details on the unicode
    behavior of this object.
 
    Like :class:`.Unicode`, usage the :class:`.UnicodeText` type implies a
    unicode-capable type being used on the backend, such as
    ``NCLOB``, ``NTEXT``.
 
    Z unicode_textNc stƒjfd|i|—ŽdS)z†
        Create a Unicode-converting Text type.
 
        Parameters are the same as that of :class:`_expression.TextClause`.
 
        rwNrržrirFrGrySszUnicodeText.__init__)Nr rFrFrirGr¡Ds r¡c@s^eZdZdZdZer(ejddœdd„ƒZdd„Z    e
d    d
„ƒZ d d „Z d d„Z ejdd„ƒZdS)ÚIntegerzA type for ``int`` integers.Úintegerz Type[Integer]©rNcCsdSrArFrDrFrFrGrPeszInteger._type_affinitycCs|jSrA©ÚNUMBERr”rFrFrGr–iszInteger.get_dbapi_typecCstSrA)ÚintrDrFrFrGr’lszInteger.python_typecCs| ¡dkrtS|SdS)Né )Ú
bit_lengthÚ _BIGINTEGERr}rFrFrGrps zInteger._resolve_for_literalcCs dd„}|S)NcSs tt|ƒƒSrA)r‘r§r…rFrFrGrˆwsz*Integer.literal_processor.<locals>.processrFr‰rFrFrGrŠvszInteger.literal_processorc CsZtjttt|jttitjttt|jttitjttttitj    t|jttitj
t|jttiiSrA) rrcÚDater¢rjÚNumericÚmulÚIntervalÚtruedivÚfloordivÚsubrDrFrFrGrH|s.ýý
  ózInteger._expression_adaptationsN)rWrXrYr_r—r r+Úro_memoized_propertyrPr–r`r’rrŠÚmemoized_propertyrHrFrFrFrGr¢]s
r¢c@seZdZdZdZdS)Ú SmallIntegerz¥A type for smaller ``int`` integers.
 
    Typically generates a ``SMALLINT`` in DDL, and otherwise acts like
    a normal :class:`.Integer` on the Python side.
 
    Z small_integerNršrFrFrFrGr´sr´c@seZdZdZdZdS)Ú
BigIntegerz¢A type for bigger ``int`` integers.
 
    Typically generates a ``BIGINT`` in DDL, and otherwise acts like
    a normal :class:`.Integer` on the Python side.
 
    Z big_integerNršrFrFrFrGrµ›srµÚ_Nc@sÄeZdZdZdZer(ejddœdd„ƒZdZ    e
d%d    d
d
d
d d œd d„ƒZ e
d&dd
d
d
dd œdd„ƒZ d'd
d
d
ddœdd„Z e dd„ƒZ dd„Zdd„Ze dd„ƒZdd „Zd!d"„Zejd#d$„ƒZdS)(r¬aêBase for non-integer numeric types, such as
    ``NUMERIC``, ``FLOAT``, ``DECIMAL``, and other variants.
 
    The :class:`.Numeric` datatype when used directly will render DDL
    corresponding to precision numerics if available, such as
    ``NUMERIC(precision, scale)``.  The :class:`.Float` subclass will
    attempt to render a floating-point datatype such as ``FLOAT(precision)``.
 
    :class:`.Numeric` returns Python ``decimal.Decimal`` objects by default,
    based on the default value of ``True`` for the
    :paramref:`.Numeric.asdecimal` parameter.  If this parameter is set to
    False, returned values are coerced to Python ``float`` objects.
 
    The :class:`.Float` subtype, being more specific to floating point,
    defaults the :paramref:`.Float.asdecimal` flag to False so that the
    default Python datatype is ``float``.
 
    .. note::
 
        When using a :class:`.Numeric` datatype against a database type that
        returns Python floating point values to the driver, the accuracy of the
        decimal conversion indicated by :paramref:`.Numeric.asdecimal` may be
        limited.   The behavior of specific numeric/floating point datatypes
        is a product of the SQL datatype in use, the Python :term:`DBAPI`
        in use, as well as strategies that may be present within
        the SQLAlchemy dialect in use.   Users requiring specific precision/
        scale are encouraged to experiment with the available datatypes
        in order to determine the best results.
 
    ÚnumericzType[Numeric[_N]]r¤cCsdSrArFrDrFrFrGrPÏszNumeric._type_affinityé
.úNumeric[decimal.Decimal]rtú Literal[True]©rEÚ    precisionÚscaleÚdecimal_return_scaleÚ    asdecimalcCsdSrArFr»rFrFrGryÕszNumeric.__init__zNumeric[float]úLiteral[False]cCsdSrArFr»rFrFrGryßsNTÚbool©r¼r½r¾r¿cCs||_||_||_||_dS)aw
        Construct a Numeric.
 
        :param precision: the numeric precision for use in DDL ``CREATE
          TABLE``.
 
        :param scale: the numeric scale for use in DDL ``CREATE TABLE``.
 
        :param asdecimal: default True.  Return whether or not
          values should be sent as Python Decimal objects, or
          as floats.   Different DBAPIs send one or the other based on
          datatypes - the Numeric type will ensure that return values
          are one or the other across DBAPIs consistently.
 
        :param decimal_return_scale: Default scale to use when converting
         from floats to Python decimals.  Floating point values will typically
         be much longer due to decimal inaccuracy, and most floating point
         database types don't have a notion of "scale", so by default the
         float type looks for the first ten decimal places when converting.
         Specifying this value will override that length.  Types which
         do include an explicit ".scale" value, such as the base
         :class:`.Numeric` as well as the MySQL float types, will use the
         value of ".scale" as the default for decimal_return_scale, if not
         otherwise specified.
 
        When using the ``Numeric`` type, care should be taken to ensure
        that the asdecimal setting is appropriate for the DBAPI in use -
        when Numeric applies a conversion from Decimal->float or float->
        Decimal, this conversion incurs an additional performance overhead
        for all result columns received.
 
        DBAPIs that return Decimal natively (e.g. psycopg2) will have
        better accuracy and higher performance with a setting of ``True``,
        as the native translation to Decimal reduces the amount of floating-
        point issues at play, and the Numeric type itself doesn't need
        to apply any further conversions.  However, another DBAPI which
        returns floats natively *will* incur an additional conversion
        overhead, and is still subject to floating point data loss - in
        which case ``asdecimal=False`` will at least remove the extra
        conversion overhead.
 
        NrÂr»rFrFrGryés1cCs0|jdk    r|jSt|ddƒdk    r&|jS|jSdS)Nr½)r¾Úgetattrr½Ú_default_decimal_return_scalerDrFrFrGÚ_effective_decimal_return_scales
 
z'Numeric._effective_decimal_return_scalecCs|jSrAr¥r”rFrFrGr–(szNumeric.get_dbapi_typecCs dd„}|S)NcSst|ƒSrArr…rFrFrGrˆ,sz*Numeric.literal_processor.<locals>.processrFr‰rFrFrGrŠ+szNumeric.literal_processorcCs|jr tjStSdSrA)r¿ÚdecimalÚDecimalÚfloatrDrFrFrGr’1szNumeric.python_typecCs|jr
dStjSdSrA)Úsupports_native_decimalr,Úto_floatr‹rFrFrGrŒ8szNumeric.bind_processorcCsF|jr2|jrdSt tj|jdk    r(|jn|j¡Sn|jr>tjSdSdSrA)    r¿rÉr,Úto_decimal_processor_factoryrÆrÇr½rÄrÊrrFrFrGr>sÿüzNumeric.result_processorc CsPtjttt|jt|jitjt|jt|jitjt|jt|jitjt|jt|jiiSrA)    rr­r®r¬rjr¢r¯rcr±rDrFrFrGrHQs&ýþõzNumeric._expression_adaptations)....)....)NNNT)rWrXrYr_r—r r+r²rPrÄr    ryr`rÅr–rŠr’rŒrr³rHrFrFrFrGr¬ªsBû    û û6
 
r¬c@sjeZdZdZdZdZeddddddœd    d
„ƒZedd dd ddœd d
„ƒZddddddœdd
„Zdd„ZdS)ÚFloata Type representing floating point types, such as ``FLOAT`` or ``REAL``.
 
    This type returns Python ``float`` objects by default, unless the
    :paramref:`.Float.asdecimal` flag is set to True, in which case they
    are coerced to ``decimal.Decimal`` objects.
 
 
    rÈN.z Float[float]rtrÀ©rEr¼r¿r¾cCsdSrArFrÍrFrFrGryqszFloat.__init__zFloat[decimal.Decimal]rºcCsdSrArFrÍrFrFrGryzsFz    Float[_N]rÁcCs||_||_||_dS)a<
        Construct a Float.
 
        :param precision: the numeric precision for use in DDL ``CREATE
           TABLE``. Backends **should** attempt to ensure this precision
           indicates a number of digits for the generic
           :class:`_sqltypes.Float` datatype.
 
           .. note:: For the Oracle backend, the
              :paramref:`_sqltypes.Float.precision` parameter is not accepted
              when rendering DDL, as Oracle does not support float precision
              specified as a number of decimal places. Instead, use the
              Oracle-specific :class:`_oracle.FLOAT` datatype and specify the
              :paramref:`_oracle.FLOAT.binary_precision` parameter. This is new
              in version 2.0 of SQLAlchemy.
 
              To create a database agnostic :class:`_types.Float` that
              separately specifies binary precision for Oracle, use
              :meth:`_types.TypeEngine.with_variant` as follows::
 
                    from sqlalchemy import Column
                    from sqlalchemy import Float
                    from sqlalchemy.dialects import oracle
 
                    Column(
                        "float_data",
                        Float(5).with_variant(oracle.FLOAT(binary_precision=16), "oracle")
                    )
 
        :param asdecimal: the same flag as that of :class:`.Numeric`, but
          defaults to ``False``.   Note that setting this flag to ``True``
          results in floating point conversion.
 
        :param decimal_return_scale: Default scale to use when converting
         from floats to Python decimals.  Floating point values will typically
         be much longer due to decimal inaccuracy, and most floating point
         database types don't have a notion of "scale", so by default the
         float type looks for the first ten decimal places when converting.
         Specifying this value will override that length.  Note that the
         MySQL float types, which do include "scale", will use "scale"
         as the default for decimal_return_scale, if not otherwise specified.
 
        N)r¼r¿r¾rÍrFrFrGryƒs1cCs*|jrt tj|j¡S|jr"tjSdSdSrA)r¿r,rËrÆrÇrÅrÉrÊrrFrFrGr¸sÿzFloat.result_processor)...)...)NFN)    rWrXrYr_r—r½r    ryrrFrFrFrGrÌbs$    üü
ü5rÌc@seZdZdZdZdS)ÚDoublezåA type for double ``FLOAT`` floating point types.
 
    Typically generates a ``DOUBLE`` or ``DOUBLE_PRECISION`` in DDL,
    and otherwise acts like a normal :class:`.Float` on the Python
    side.
 
    .. versionadded:: 2.0
 
    ÚdoubleNršrFrFrFrGrÎÃs
rÎc@s.eZdZdd„Zdd„Zdd„Zd
dd    „ZdS) Ú_RenderISO8601NoTcCs | |d¡SrA©Ú_literal_processor_portionr‹rFrFrGÚ_literal_processor_datetimeÒsz-_RenderISO8601NoT._literal_processor_datetimecCs | |d¡S)NrrÑr‹rFrFrGÚ_literal_processor_dateÕsz)_RenderISO8601NoT._literal_processor_datecCs | |d¡S)NéÿÿÿÿrÑr‹rFrFrGÚ_literal_processor_timeØsz)_RenderISO8601NoT._literal_processor_timeNcs.ˆdks t‚ˆdk    r"‡fdd„}ndd„}|S)N)NrrÕcs&|dk    r"d| ¡ d¡ˆ›d}|S)Nr€ÚT)Ú    isoformatÚsplitr…©Ú_portionrFrGrˆßsz=_RenderISO8601NoT._literal_processor_portion.<locals>.processcSs$|dk    r d| ¡ dd¡›d}|S)Nr€r×ú )rØr„r…rFrFrGrˆæs)rR)rEr‡rÛrˆrFrÚrGrÒÛs
 z,_RenderISO8601NoT._literal_processor_portion)N)rWrXrYrÓrÔrÖrÒrFrFrFrGrÐÑsrÐc@sVeZdZdZdZdddœdd„Zdd    „Zd
d „Zd d „Ze    dd„ƒZ
e j dd„ƒZ dS)ÚDateTimeaÿA type for ``datetime.datetime()`` objects.
 
    Date and time types return objects from the Python ``datetime``
    module.  Most DBAPIs have built in support for the datetime
    module, with the noted exception of SQLite.  In the case of
    SQLite, date and time types are stored as strings which are then
    converted back to datetime objects when rows are returned.
 
    For the time representation within the datetime type, some
    backends include additional options, such as timezone support and
    fractional seconds support.  For fractional seconds, use the
    dialect-specific datatype, such as :class:`.mysql.TIME`.  For
    timezone support, use at least the :class:`_types.TIMESTAMP` datatype,
    if not the dialect-specific datatype object.
 
    ÚdatetimeFrÁ©ÚtimezonecCs
||_dS)aöConstruct a new :class:`.DateTime`.
 
        :param timezone: boolean.  Indicates that the datetime type should
         enable timezone support, if available on the
         **base date/time-holding type only**.   It is recommended
         to make use of the :class:`_types.TIMESTAMP` datatype directly when
         using this flag, as some databases include separate generic
         date/time-holding types distinct from the timezone-capable
         TIMESTAMP datatype, such as Oracle.
 
 
        Nrß©rEràrFrFrGrys zDateTime.__init__cCs|jSrA©ÚDATETIMEr”rFrFrGr–szDateTime.get_dbapi_typecCs |jdk    }|r|jstS|SdSrA)ÚtzinforàÚDATETIME_TIMEZONE©rEr~Z with_timezonerFrFrGrs
 
zDateTime._resolve_for_literalcCs
| |¡SrA)rÓr‹rFrFrGrŠszDateTime.literal_processorcCstjSrA)ÚdtrÞrDrFrFrGr’!szDateTime.python_typecCs tjt|jitjt|jttiiSrA)rrcr®rjr±rÝrDrFrFrGrH%s
 þz DateTime._expression_adaptationsN)F)rWrXrYr_r—ryr–rrŠr`r’r+r³rHrFrFrFrGrÝîs
rÝc@s>eZdZdZdZdd„Zedd„ƒZdd„Ze    j
d    d
„ƒZ d S) r«z'A type for ``datetime.date()`` objects.ÚdatecCs|jSrArâr”rFrFrGr–7szDate.get_dbapi_typecCstjSrA)rçrèrDrFrFrGr’:szDate.python_typecCs
| |¡SrA)rÔr‹rFrFrGrŠ>szDate.literal_processorc Cs0tjt|jttttitjt|jttttttiiSrA)    rrcr¢rjr®rÝÚTimer±r«rDrFrFrGrHAs&ý÷úzDate._expression_adaptationsN) rWrXrYr_r—r–r`r’rŠr+r³rHrFrFrFrGr«1s
r«c@sVeZdZdZdZdddœdd„Zdd    „Zed
d „ƒZd d „Z    e
j dd„ƒZ dd„Z dS)réz'A type for ``datetime.time()`` objects.ÚtimeFrÁrßcCs
||_dSrArßrárFrFrGry`sz Time.__init__cCs|jSrArâr”rFrFrGr–cszTime.get_dbapi_typecCstjSrA)rçrêrDrFrFrGr’fszTime.python_typecCs |jdk    }|r|jstS|SdSrA)räràÚ TIME_TIMEZONErærFrFrGrjs
 
zTime._resolve_for_literalcCs$tjttt|jitjttt|jiiSrA)rrcr«rÝr®rjr±rérDrFrFrGrHqs
  þzTime._expression_adaptationscCs
| |¡SrA)rÖr‹rFrFrGrŠ{szTime.literal_processorN)F)rWrXrYr_r—ryr–r`r’rr+r³rHrŠrFrFrFrGréZs
 
    récs\eZdZdZdddœdd„Zdd„Zed    d
„ƒZd d „Zd d„Z    ‡fdd„Z
dd„Z ‡Z S)Ú_Binaryz&Define base behavior for binary types.Nrt©rwcCs
||_dSrArí©rErwrFrFrGryƒsz_Binary.__init__cs‡fdd„}|S)Ncs| ˆj¡ dd¡}d|S)Nr€rrƒ)ÚdecodeZ$_legacy_binary_type_literal_encodingr„r…r†rFrGrˆ‡sÿþz*_Binary.literal_processor.<locals>.processrFr‰rFr†rGrІs z_Binary.literal_processorcCstSrA©ÚbytesrDrFrFrGr’‘sz_Binary.python_typecs&|jdkrdS|jj‰‡fdd„}|S)Ncs|dk    rˆ|ƒSdSdSrArFr…©Z DBAPIBinaryrFrGrˆsz'_Binary.bind_processor.<locals>.process)r•ÚBinaryr‰rFròrGrŒ—s
 
 z_Binary.bind_processorcCs|jr
dSdd„}|S)NcSs|dk    rt|ƒ}|SrArðr…rFrFrGrˆ¬sz)_Binary.result_processor.<locals>.process)Zreturns_native_bytes©rEr‡rŽrˆrFrFrGr¨sz_Binary.result_processorcs t|tƒr|Stƒ ||¡SdS©z@See :meth:`.TypeEngine.coerce_compared_value` for a description.N©rQr‘rgÚcoerce_compared_value©rErLr~rirFrGr÷³s
z_Binary.coerce_compared_valuecCs|jSrA)ÚBINARYr”rFrFrGr–»sz_Binary.get_dbapi_type)N) rWrXrYr_ryrŠr`r’rŒrr÷r–rkrFrFrirGrìs 
 rìc@s$eZdZdZdZdddœdd„ZdS)    Ú LargeBinarya A type for large binary byte data.
 
    The :class:`.LargeBinary` type corresponds to a large and/or unlengthed
    binary type for the target platform, such as BLOB on MySQL and BYTEA for
    PostgreSQL.  It also handles the necessary conversions for the DBAPI.
 
    Z large_binaryNrtrícCstj||ddS)zã
        Construct a LargeBinary type.
 
        :param length: optional, a length for the column for use in
          DDL statements, for those binary types that accept a length,
          such as the MySQL BLOB type.
 
        ríN)rìryrîrFrFrGryËs    zLargeBinary.__init__)N)rWrXrYr_r—ryrFrFrFrGrú¿srúc    sÜeZdZUdZdZded<d/ddddd    dd
d œd d „Zdd„Zdd„Zdd„Z    dd„Z
e ddddœdd„ƒZ e ddddœdd„ƒZ ddddœ‡fd d„ Z d0d!d"„Z d1d#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Z‡ZS)2Ú
SchemaTypea‚Add capabilities to a type which allow for schema-level DDL to be
    associated with a type.
 
    Supports types that must be explicitly created/dropped (i.e. PG ENUM type)
    as well as types that are complimented by table or schema level
    constraints, triggers, and other rules.
 
    :class:`.SchemaType` classes can also be targets for the
    :meth:`.DDLEvents.before_parent_attach` and
    :meth:`.DDLEvents.after_parent_attach` events, where the events fire off
    surrounding the association of the type object with a parent
    :class:`_schema.Column`.
 
    .. seealso::
 
        :class:`.Enum`
 
        :class:`.Boolean`
 
 
    TruÚnameNFzOptional[MetaData]rÁzOptional[bool]úOptional[SchemaType]©rüÚschemaÚmetadataÚinherit_schemaÚquoteÚ_create_eventsÚ _adapted_fromcCs†|dk    rt||ƒ|_nd|_||_||_||_||_|rn|jrnt |jdt     |j
¡¡t |jdt     |j ¡¡|r‚|j   |j ¡|_ dS)NÚ before_createÚ
after_drop)rrürÿrrrr(Úlistenr+Úportable_instancemethodÚ_on_metadata_createÚ_on_metadata_dropÚdispatchÚ_join)rErürÿrrrrrrFrFrGryós(
 
 
ý
ýzSchemaType.__init__cKs| t |j¡¡dSrA)Z_on_table_attachr+rÚ
_set_table)rEÚcolumnÚkwrFrFrGÚ _set_parentszSchemaType._set_parentcCs(|jjr t|jjƒ}|j|d<nd}|S)NÚ_default)rOZ_variant_mappingÚdict)rErÚvariant_mappingrFrFrGÚ_variant_mapping_for_set_table%s
  z)SchemaType._variant_mapping_for_set_tablec    CsÈ|jr|j|_n"|jr2|jdkr2|jjr2|jj|_|js<dS| |¡}t |dt |j    d|i¡¡t |dt |j
d|i¡¡|jdkrÄt |jdt |j d|i¡¡t |jdt |j d|i¡¡dS)Nrrr) rrÿrrrr(rr+rÚ_on_table_createÚ_on_table_dropr    r
)rErÚtablerrFrFrGr -sP
 
 
ÿýÿý
þýþýzSchemaType._set_tablecKs|jtd|jƒddS)NzType[TypeEngine[Any]]T)r)Úadaptrrj©rErrFrFrGÚcopy[s
þzSchemaType.copyz    Type[_TE]rr>)ÚclsrrNcKsdSrArF©rErrrFrFrGraszSchemaType.adaptzType[TypeEngineMixin]r?cKsdSrArFrrFrFrGresz-Type[Union[TypeEngine[Any], TypeEngineMixin]]c s(| dd¡| d|¡tƒj|f|ŽS)NrFr)Ú
setdefaultrgrrrirFrGris  cCs4| |j¡}t|tƒr0|j|jk    r0|j||ddS)z.Issue CREATE DDL for this type, if applicable.©Ú
checkfirstN)Ú dialect_implr‡rQrûrjÚcreate©rEÚbindrÚtrFrFrGr!ps zSchemaType.createcCs4| |j¡}t|tƒr0|j|jk    r0|j||ddS)z,Issue DROP DDL for this type, if applicable.rN)r r‡rQrûrjÚdropr"rFrFrGr%ws zSchemaType.dropcKsH| |j|¡sdS| |j¡}t|tƒrD|j|jk    rD|j||f|ŽdSrA)Ú_is_impl_for_variantr‡r rQrûrjr©rEÚtargetr#rr$rFrFrGr~s
 zSchemaType._on_table_createcKsH| |j|¡sdS| |j¡}t|tƒrD|j|jk    rD|j||f|ŽdSrA)r&r‡r rQrûrjrr'rFrFrGr†s
 zSchemaType._on_table_dropcKsH| |j|¡sdS| |j¡}t|tƒrD|j|jk    rD|j||f|ŽdSrA)r&r‡r rQrûrjr    r'rFrFrGr    Žs
 zSchemaType._on_metadata_createcKsH| |j|¡sdS| |j¡}t|tƒrD|j|jk    rD|j||f|ŽdSrA)r&r‡r rQrûrjr
r'rFrFrGr
–s
 zSchemaType._on_metadata_dropcsV| dd¡}|sdS‡fdd„}|j|kr<|||jƒr<dS|j|krR||dƒSdS)NrTcs|ˆkpt|tƒo|jˆkSrA)rQÚARRAYÚ    item_type)ÚtyprDrFrGÚ_we_are_the_impl¯s
ýz9SchemaType._is_impl_for_variant.<locals>._we_are_the_implr)Úpoprü)rEr‡rrr,rFrDrGr&žs   ÿ
zSchemaType._is_impl_for_variant)NNNFNTN)F)F)rWrXrYr_Z_use_schema_mapraryrrr rr    rr!r%rrr    r
r&rkrFrFrirGrû×s6
ø".
 
rûcs:eZdZdZdZdddœdd„Zedd    „ƒZ‡fd
d „Zd d „Z    dddœdd„Z
dddddœdd„Z dd„Z edd„ƒZ edd„ƒZdd„ZGdd „d ejeƒZeZd!d"„Zd#d$„Zd=d&d'„Zd(d)„Zd*d+„Z‡fd,d-„Zd.d/„Ze d0¡d1d2„ƒZ‡fd3d4„Z‡fd5d6„Z‡fd7d8„Z d9d:„Z!e‡fd;d<„ƒZ"‡Z#S)>ÚEnuma Generic Enum Type.
 
    The :class:`.Enum` type provides a set of possible string values
    which the column is constrained towards.
 
    The :class:`.Enum` type will make use of the backend's native "ENUM"
    type if one is available; otherwise, it uses a VARCHAR datatype.
    An option also exists to automatically produce a CHECK constraint
    when the VARCHAR (so called "non-native") variant is produced;
    see the  :paramref:`.Enum.create_constraint` flag.
 
    The :class:`.Enum` type also provides in-Python validation of string
    values during both read and write operations.  When reading a value
    from the database in a result set, the string value is always checked
    against the list of possible values and a ``LookupError`` is raised
    if no match is found.  When passing a value to the database as a
    plain string within a SQL statement, if the
    :paramref:`.Enum.validate_strings` parameter is
    set to True, a ``LookupError`` is raised for any string value that's
    not located in the given list of possible values; note that this
    impacts usage of LIKE expressions with enumerated values (an unusual
    use case).
 
    The source of enumerated values may be a list of string values, or
    alternatively a PEP-435-compliant enumerated class.  For the purposes
    of the :class:`.Enum` datatype, this class need only provide a
    ``__members__`` method.
 
    When using an enumerated class, the enumerated objects are used
    both for input and output, rather than strings as is the case with
    a plain-string enumerated type::
 
        import enum
        from sqlalchemy import Enum
 
        class MyEnum(enum.Enum):
            one = 1
            two = 2
            three = 3
 
        t = Table(
            'data', MetaData(),
            Column('value', Enum(MyEnum))
        )
 
        connection.execute(t.insert(), {"value": MyEnum.two})
        assert connection.scalar(t.select()) is MyEnum.two
 
    Above, the string names of each element, e.g. "one", "two", "three",
    are persisted to the database; the values of the Python Enum, here
    indicated as integers, are **not** used; the value of each enum can
    therefore be any kind of Python object whether or not it is persistable.
 
    In order to persist the values and not the names, the
    :paramref:`.Enum.values_callable` parameter may be used.   The value of
    this parameter is a user-supplied callable, which  is intended to be used
    with a PEP-435-compliant enumerated class and  returns a list of string
    values to be persisted.   For a simple enumeration that uses string values,
    a callable such as  ``lambda x: [e.value for e in x]`` is sufficient.
 
    .. seealso::
 
        :ref:`orm_declarative_mapped_column_enums` - background on using
        the :class:`_sqltypes.Enum` datatype with the ORM's
        :ref:`ORM Annotated Declarative <orm_declarative_mapped_column>`
        feature.
 
        :class:`_postgresql.ENUM` - PostgreSQL-specific type,
        which has additional functionality.
 
        :class:`.mysql.ENUM` - MySQL-specific type
 
    ÚenumÚobjectr)ÚenumsrcOs| ||¡dS)a¸Construct an enum.
 
        Keyword arguments which don't apply to a specific backend are ignored
        by that backend.
 
        :param \*enums: either exactly one PEP-435 compliant enumerated type
           or one or more string labels.
 
        :param create_constraint: defaults to False.  When creating a
           non-native enumerated type, also build a CHECK constraint on the
           database against the valid values.
 
           .. note:: it is strongly recommended that the CHECK constraint
              have an explicit name in order to support schema-management
              concerns.  This can be established either by setting the
              :paramref:`.Enum.name` parameter or by setting up an
              appropriate naming convention; see
              :ref:`constraint_naming_conventions` for background.
 
           .. versionchanged:: 1.4 - this flag now defaults to False, meaning
              no CHECK constraint is generated for a non-native enumerated
              type.
 
        :param metadata: Associate this type directly with a ``MetaData``
           object. For types that exist on the target database as an
           independent schema construct (PostgreSQL), this type will be
           created and dropped within ``create_all()`` and ``drop_all()``
           operations. If the type is not associated with any ``MetaData``
           object, it will associate itself with each ``Table`` in which it is
           used, and will be created when any of those individual tables are
           created, after a check is performed for its existence. The type is
           only dropped when ``drop_all()`` is called for that ``Table``
           object's metadata, however.
 
           The value of the :paramref:`_schema.MetaData.schema` parameter of
           the :class:`_schema.MetaData` object, if set, will be used as the
           default value of the :paramref:`_types.Enum.schema` on this object
           if an explicit value is not otherwise supplied.
 
           .. versionchanged:: 1.4.12 :class:`_types.Enum` inherits the
              :paramref:`_schema.MetaData.schema` parameter of the
              :class:`_schema.MetaData` object if present, when passed using
              the :paramref:`_types.Enum.metadata` parameter.
 
        :param name: The name of this type. This is required for PostgreSQL
           and any future supported database which requires an explicitly
           named type, or an explicitly named constraint in order to generate
           the type and/or a table that uses it. If a PEP-435 enumerated
           class was used, its name (converted to lower case) is used by
           default.
 
        :param native_enum: Use the database's native ENUM type when
           available. Defaults to True. When False, uses VARCHAR + check
           constraint for all backends. When False, the VARCHAR length can be
           controlled with :paramref:`.Enum.length`; currently "length" is
           ignored if native_enum=True.
 
        :param length: Allows specifying a custom length for the VARCHAR
           when a non-native enumeration datatype is used.  By default it uses
           the length of the longest value.
 
           .. versionchanged:: 2.0.0 The :paramref:`.Enum.length` parameter
              is used unconditionally for ``VARCHAR`` rendering regardless of
              the :paramref:`.Enum.native_enum` parameter, for those backends
              where ``VARCHAR`` is used for enumerated datatypes.
 
 
        :param schema: Schema name of this type. For types that exist on the
           target database as an independent schema construct (PostgreSQL),
           this parameter specifies the named schema in which the type is
           present.
 
           If not present, the schema name will be taken from the
           :class:`_schema.MetaData` collection if passed as
           :paramref:`_types.Enum.metadata`, for a :class:`_schema.MetaData`
           that includes the :paramref:`_schema.MetaData.schema` parameter.
 
           .. versionchanged:: 1.4.12 :class:`_types.Enum` inherits the
              :paramref:`_schema.MetaData.schema` parameter of the
              :class:`_schema.MetaData` object if present, when passed using
              the :paramref:`_types.Enum.metadata` parameter.
 
           Otherwise, if the :paramref:`_types.Enum.inherit_schema` flag is set
           to ``True``, the schema will be inherited from the associated
           :class:`_schema.Table` object if any; when
           :paramref:`_types.Enum.inherit_schema` is at its default of
           ``False``, the owning table's schema is **not** used.
 
 
        :param quote: Set explicit quoting preferences for the type's name.
 
        :param inherit_schema: When ``True``, the "schema" from the owning
           :class:`_schema.Table`
           will be copied to the "schema" attribute of this
           :class:`.Enum`, replacing whatever value was passed for the
           ``schema`` attribute.   This also takes effect when using the
           :meth:`_schema.Table.to_metadata` operation.
 
        :param validate_strings: when True, string values that are being
           passed to the database in a SQL statement will be checked
           for validity against the list of enumerated values.  Unrecognized
           values will result in a ``LookupError`` being raised.
 
        :param values_callable: A callable which will be passed the PEP-435
           compliant enumerated type, which should then return a list of string
           values to be persisted. This allows for alternate usages such as
           using the string value of an enum to be persisted to the database
           instead of its name.
 
           .. versionadded:: 1.2.3
 
        :param sort_key_function: a Python callable which may be used as the
           "key" argument in the Python ``sorted()`` built-in.   The SQLAlchemy
           ORM requires that primary key columns which are mapped must
           be sortable in some way.  When using an unsortable enumeration
           object such as a Python 3 ``Enum`` object, this parameter may be
           used to set a default sort key function for the objects.  By
           default, the database value of the enumeration is used as the
           sorting function.
 
           .. versionadded:: 1.3.8
 
        :param omit_aliases: A boolean that when true will remove aliases from
           pep 435 enums. defaults to ``True``.
 
           .. versionchanged:: 2.0 This parameter now defaults to True.
 
        N)Ú
_enum_init)rEr1rrFrFrGry sz Enum.__init__cCs|jdk    r|jgS|jSdSrA)Ú
enum_classr1rDrFrFrGÚ_enums_argumentŽs
zEnum._enums_argumentc sr| dd¡|_| dd¡|_| dd¡|_| dt¡|_| dt¡}| d    d¡|_| d
d¡}| ||¡\}}| |||¡| d d¡|_    |j
r¬t d d „|j
Dƒƒ|_ }n
d|_ }|tk    rÞ|sÚ||krÚt d||fƒ‚|}d|jd<|jd<tƒj|d|jr| d|jj ¡¡tj|| dd¡| dd¡| dd¡| dd¡| dd¡| dd¡| dd¡ddS)zéinternal init for :class:`.Enum` and subclasses.
 
        friendly init helper used by subclasses to remove
        all the Enum-specific keyword arguments from kw.  Allows all
        other arguments in kw to pass through.
 
        Ú native_enumTÚcreate_constraintFÚvalues_callableNÚsort_key_functionrwÚ omit_aliasesÚ_disable_warningsÚvalidate_stringscss|]}t|ƒVqdSrA)Úlen©Ú.0ÚxrFrFrGÚ    <genexpr>ªsz"Enum._enum_init.<locals>.<genexpr>rz`When provided, length must be larger or equal than the length of the longest enum value. %s < %srírürÿrrrrrrþ)r-r5r6r7rÚ_sort_key_functionÚ _omit_aliasesÚ_parse_into_valuesÚ_setup_for_valuesr;r1ÚmaxÚ_default_lengthÚ
ValueErrorÚ _valid_lookupÚ_object_lookuprgryr3rrWÚlowerrû)rEr1rZ
length_argr:ÚvaluesÚobjectsrwrirFrGr2•sF  
 þÿ
 
 
 
 
 
 
øzEnum._enum_initcs°|sd|kr| d¡}t|ƒdkržt|ddƒrž|d|_|jj}|jdkrdtdd„| ¡Dƒƒ‰n|‰|jr|| |j¡}nt    ˆƒ}‡fdd    „ˆDƒ}||fSd|_||fSdS)
NÚ_enumsrrÚ __members__Tcss$|]\}}|j|kr||fVqdSrA)rü)r>ÚnÚvrFrFrGr@Ós
z*Enum._parse_into_values.<locals>.<genexpr>csg|] }ˆ|‘qSrFrF)r>Úk©ÚmembersrFrGÚ
<listcomp>Üsz+Enum._parse_into_values.<locals>.<listcomp>)
r-r<Úhasattrr3rNrBr.Úitemsr7Úlist)rEr1rZ_membersrKrLrFrRrGrCÈs" 
 
 
ÿ
zEnum._parse_into_values©r~rNcCs&t|ƒ}| |||¡}|dk    s"t‚|SrA)rOÚ_resolve_for_python_typerR)rEr~Útvr+rFrFrGrâs zEnum._resolve_for_literalz    Type[Any]r8zOptional[Enum])r’Ú
matched_onÚmatched_on_flattenedrNc    Csì|jtjgk}d}|s&||kr&|j}nnt|ƒrpt|ƒ}dd„|Dƒ}|rjt dd dd„|Dƒ¡›d¡‚d}n$t|t    ƒrŽt
|tjƒrŽ|g}n|j}|  i¡}|  d    d¡|dkrºd|d
<|j d krÈtn|j |d <tt|jfd |i|—ŽƒS)NcSsg|]}t|tƒs|‘qSrF)rQr‘)r>ÚargrFrFrGrTs
z1Enum._resolve_for_python_type.<locals>.<listcomp>z@Can't create string-based Enum datatype from non-string values: ú, css|]}t|ƒVqdSrA)Úreprr=rFrFrGr@sz0Enum._resolve_for_python_type.<locals>.<genexpr>z@.  Please provide an explicit Enum datatype for this Python typeFrür5rrwrM)r4r/r.r/r1r)Ú ArgumentErrorÚjoinrQrOÚ
issubclassÚ _make_enum_kwr-rwrrÚ_generic_type_affinity)    rEr’r[r\Zwe_are_generic_formr5Z    enum_argsZbad_argsrrFrFrGrYès6
 ÿ ÿ
 þzEnum._resolve_for_python_typecsPt|ƒˆ_ttt|ƒt|ƒƒƒˆ_tt||ƒƒˆ_ˆj ‡fdd„|Dƒ¡dS)Ncs g|]}|ˆjˆj|f‘qSrF)rHrI)r>r~rDrFrGrT(sÿz*Enum._setup_for_values.<locals>.<listcomp>)rWr1rÚzipÚreversedrHrIÚupdate)rErKrLrrFrDrGrD s
 
þÿzEnum._setup_for_valuescCs|jtkr|jS|jSdSrA)rArÚ_db_value_for_elemrDrFrFrGr8.s
zEnum.sort_key_functioncCs|jSrA)r5rDrFrFrGÚnative5sz Enum.nativec
Csnz |j|WStk
rh}z>|js:t|tƒr:|WY¢$Std||jt |j    ¡fƒ|‚W5d}~XYnXdS©NzM'%s' is not among the defined enum values. Enum name: %s. Possible values: %s)
rHÚKeyErrorr;rQr‘Ú LookupErrorrür-Úrepr_tuple_namesr1©rEÚelemÚerrrFrFrGrh9s      
ýþÿøzEnum._db_value_for_elemcs4eZdZUdZded<ddddœ‡fdd    „ Z‡ZS)
zEnum.ComparatorrFrrrOr4rIrJrKcs0tƒ ||¡\}}|tjkr(t|jjƒ}||fSrA)rgrVrrerrrOrw)rErLrMr+rirFrGrVWs
 z!Enum.Comparator._adapt_expression)rWrXrYrZrarVrkrFrFrirGr\Rs
r\c
CsRz |j|WStk
rL}z"td||jt |j¡fƒ|‚W5d}~XYnXdSrj)rIrkrlrür-rmr1rnrFrFrGÚ_object_value_for_elemcs 
ýþÿøzEnum._object_value_for_elemcCs tj|ddd|jfgttgdS)N)r5T)r6Frw)Z additional_kwZ
to_inspect)r+Z generic_reprrFr.rûrDrFrFrGÚ__repr__qsýùz Enum.__repr__FcCs4t|dƒr|j}ntdƒ‚tj||jf|žddiŽS)Nr1zpTypeEngine.as_generic() heuristic is undefined for types that inherit Enum but do not have an `enums` attribute.r:T)rUr1rCr+Zconstructor_copyrd)rEZallow_nulltypeÚargsrFrFrGÚ
as_generic|s
ÿÿÿÿzEnum.as_genericcCs| d|j¡| d|j¡| d|j¡| d|j¡| d|j¡| d|j¡| d|j¡| d|j¡| d    |j    ¡| d
|j
¡|S) Nr;rürÿrrr5r7r6rwr9) rr;rürÿrrr5r7r6rwrBrrFrFrGrcŠszEnum._make_enum_kwcKs4| |¡d|d<| dd¡d|ks*t‚|f|ŽS)NTr:rFrM)rcrrR©rEZimpltyperrFrFrGÚadapt_to_emulated—s
 
  zEnum.adapt_to_emulatedc s"|j|d<d|d<tƒj|f|ŽS)NrMTr:)r4rgrrurirFrGržs
z
Enum.adaptcKs$| |j|¡sdS|j p"|jj S©NF)r&r‡r5Zsupports_native_enum©rEÚcompilerrrFrFrGÚ_should_create_constraint£sÿzEnum._should_create_constraintúsqlalchemy.sql.schemacCs|tjj}t |||¡|js dS| |¡}|jt|t    ƒƒ 
|j ¡|j dkrNt n|j t |jd|i¡dd}|j|ksxt‚dS)NrT©rüZ _create_ruleZ _type_bound)r+Ú    preloadedÚ
sql_schemarûr r6rÚCheckConstraintÚ type_coercerrÚin_r1rürrrzrrR©rErrrÿrÚerFrFrGr ªs
þù    zEnum._set_tablecstƒ |¡‰‡‡fdd„}|S)Ncsˆ |¡}ˆrˆ|ƒ}|SrA©rhr…©Zparent_processorrErFrGrˆÂs
z'Enum.literal_processor.<locals>.process)rgrŠr‰rir…rGrŠ¿s zEnum.literal_processorcstƒ |¡‰‡‡fdd„}|S)Ncsˆ |¡}ˆrˆ|ƒ}|SrAr„r…r…rFrGrˆÍs
z$Enum.bind_processor.<locals>.process)rgrŒr‰rir…rGrŒÊs zEnum.bind_processorcs tƒ ||¡‰‡‡fdd„}|S)Ncsˆr ˆ|ƒ}ˆ |¡}|SrA)rqr…r…rFrGrˆØs
z&Enum.result_processor.<locals>.process)rgrrôrir…rGrÕszEnum.result_processorcKstj|f|ŽSrA)rûrrrFrFrGrász    Enum.copycs|jr |jStƒjSdSrA)r3rgr’rDrirFrGr’äszEnum.python_type)F)$rWrXrYr_r—ryr`r4r2rCrrYrDr8rirhrrr\r‘r^rqrrrtrcrvrrzr+Úpreload_moduler rŠrŒrrr’rkrFrFrirGr.¾sBJ
 38
 
 
 
 r.cs`eZdZdZeZdZejdddfdddddœ‡fd    d
„ Z    d d „Z
d d„Z dd„Z dd„Z ‡ZS)Ú
PickleTypea©Holds Python objects, which are serialized using pickle.
 
    PickleType builds upon the Binary type to apply Python's
    ``pickle.dumps()`` to incoming objects, and ``pickle.loads()`` on
    the way out, allowing any pickleable Python object to be stored as
    a serialized binary field.
 
    To allow ORM change events to propagate for elements associated
    with :class:`.PickleType`, see :ref:`mutable_toplevel`.
 
    TNr§rz$Optional[Callable[[Any, Any], bool]]z"Optional[_TypeEngineArgument[Any]])ÚprotocolÚpicklerÚ
comparatorÚimplcs2||_|p t|_||_tƒ ¡|r.t|ƒ|_dS)a×
        Construct a PickleType.
 
        :param protocol: defaults to ``pickle.HIGHEST_PROTOCOL``.
 
        :param pickler: defaults to pickle.  May be any object with
          pickle-compatible ``dumps`` and ``loads`` methods.
 
        :param comparator: a 2-arg callable predicate used
          to compare values of this type.  If left as ``None``,
          the Python "equals" operator is used to compare values.
 
        :param impl: A binary-storing :class:`_types.TypeEngine` class or
          instance to use in place of the default :class:`_types.LargeBinary`.
          For example the :class: `_mysql.LONGBLOB` class may be more effective
          when using MySQL.
 
          .. versionadded:: 1.4.20
 
        N)rˆÚpickler‰rŠrgryr!r‹)rErˆr‰rŠr‹rirFrGryüs 
 
zPickleType.__init__cCst|jd|jffSrA)r‡rˆrŠrDrFrFrGÚ
__reduce__!szPickleType.__reduce__csF|j |¡}|jj‰|j‰|r4|‰‡‡‡fdd„}n‡‡fdd„}|S)Ncs|dk    rˆ|ˆƒ}ˆ|ƒSrArFr…©ÚdumpsÚfixed_impl_processorrˆrFrGrˆ+s
z*PickleType.bind_processor.<locals>.processcs|dk    rˆ|ˆƒ}|SrArFr…)rrˆrFrGrˆ2s
)Ú impl_instancerŒr‰rrˆ©rEr‡Úimpl_processorrˆrFrŽrGrŒ$s zPickleType.bind_processorcs>|j ||¡}|jj‰|r.|‰‡‡fdd„}n ‡fdd„}|S)Ncsˆ|ƒ}|dkrdSˆ|ƒSrArFr…©rÚloadsrFrGrˆ?sz,PickleType.result_processor.<locals>.processcs|dkr dSˆ|ƒSrArFr…)r•rFrGrˆGs)r‘rr‰r•©rEr‡rŽr“rˆrFr”rGr9s zPickleType.result_processorcCs|jr| ||¡S||kSdSrA)rŠ©rEr?ÚyrFrFrGÚcompare_valuesNs zPickleType.compare_values)rWrXrYr_rúr‹Úcache_okrŒÚHIGHEST_PROTOCOLryrrŒrr™rkrFrFrirGr‡ìs û%r‡c@s‚eZdZdZdZdZdddddd    œd
d „Zd d „Ze     d¡dd„ƒZ
e dd„ƒZ e dddgƒZdd„Zdd„Zdd„Zdd„ZdS)ÚBooleanaÇA bool datatype.
 
    :class:`.Boolean` typically uses BOOLEAN or SMALLINT on the DDL side,
    and on the Python side deals in ``True`` or ``False``.
 
    The :class:`.Boolean` datatype currently has two levels of assertion
    that the values persisted are simple true/false values.  For all
    backends, only the Python values ``None``, ``True``, ``False``, ``1``
    or ``0`` are accepted as parameter values.   For those backends that
    don't support a "native boolean" datatype, an option exists to
    also create a CHECK constraint on the target column
 
    .. versionchanged:: 1.2 the :class:`.Boolean` datatype now asserts that
       incoming Python values are already in pure boolean form.
 
 
    ÚbooleanTFNrÁrurý)r6rürrcCs*||_||_||_|r&|j |j¡|_dS)aˆConstruct a Boolean.
 
        :param create_constraint: defaults to False.  If the boolean
          is generated as an int/smallint, also create a CHECK constraint
          on the table that ensures 1 or 0 as a value.
 
          .. note:: it is strongly recommended that the CHECK constraint
             have an explicit name in order to support schema-management
             concerns.  This can be established either by setting the
             :paramref:`.Boolean.name` parameter or by setting up an
             appropriate naming convention; see
             :ref:`constraint_naming_conventions` for background.
 
          .. versionchanged:: 1.4 - this flag now defaults to False, meaning
             no CHECK constraint is generated for a non-native enumerated
             type.
 
        :param name: if a CHECK constraint is generated, specify
          the name of the constraint.
 
        N)r6rürr r )rEr6rürrrFrFrGryls
zBoolean.__init__cKs$| |j|¡sdS|jj o"|jjSrw)r&r‡Úsupports_native_booleanZ#non_native_boolean_check_constraintrxrFrFrGrzŽs
 
þz!Boolean._should_create_constraintr{cCsntjj}|jsdS| |¡}|jt||ƒ ddg¡|jdkr@t    n|jt 
|j d|i¡dd}|j |ksjt ‚dS)NrrrTr|)r+r}r~r6rrr€rrürrrzrrRr‚rFrFrGr –s
þù    zBoolean._set_tablecCstSrA)rÁrDrFrFrGr’©szBoolean.python_typecCs6||jkr2t|tƒs$td|fƒ‚ntd|fƒ‚|S)NzNot a boolean value: %rz$Value %r is not None, True, or False)Ú _strict_boolsrQr§Ú    TypeErrorrGr}rFrFrGÚ_strict_as_bool¯s
 
ÿzBoolean._strict_as_boolcs4| |d¡}| d¡‰| d¡‰‡‡‡fdd„}|S)Ncsˆ |¡rˆSˆSrA)r¡r…©ÚfalserEÚtruerFrGrˆ¾sz*Boolean.literal_processor.<locals>.process)Zstatement_compilerZ
visit_trueZ visit_false)rEr‡ryrˆrFr¢rGrйs
 
 
zBoolean.literal_processorcs(|j‰|jrt‰nt‰‡‡fdd„}|S)Ncsˆ|ƒ}|dk    rˆ|ƒ}|SrArFr…©Z_coercer¡rFrGrˆÍsz'Boolean.bind_processor.<locals>.process)r¡ržrÁr§r‰rFr¥rGrŒÃs zBoolean.bind_processorcCs|jr
dStjSdSrA)ržr,Zint_to_booleanrrFrFrGrÕszBoolean.result_processor)FNTN)rWrXrYr_r—riryrzr+r†r r`r’Ú    frozensetrŸr¡rŠrŒrrFrFrFrGrœUs$û"
 
 
 
rœc@s.eZdZejdd„ƒZejddœdd„ƒZdS)Ú_AbstractIntervalc    Cs@tjttt|jttttitjt|jitjt    |jitj
t    |jiiSrA) rrcr«rÝr®rjrér±r­r¬r¯rDrFrFrGrHÝs"ü÷z)_AbstractInterval._expression_adaptationszType[Interval]r¤cCstSrA)r®rDrFrFrGrPîsz _AbstractInterval._type_affinityN)rWrXrYr+r³rHZro_non_memoized_propertyrPrFrFrFrGr§Üs
r§cs eZdZdZeZej d¡Z    dZ
dddddœ‡fdd    „ Z Gd
d „d e j eej eƒZ e Zed d „ƒZdd„Zdd„Zdddœdd„Zddddœdd„Z‡ZS)r®a«A type for ``datetime.timedelta()`` objects.
 
    The Interval type deals with ``datetime.timedelta`` objects.  In
    PostgreSQL, the native ``INTERVAL`` type is used; for others, the
    value is stored as a date which is relative to the "epoch"
    (Jan. 1, 1970).
 
    Note that the ``Interval`` type does not currently provide date arithmetic
    operations on platforms which do not support interval types natively. Such
    operations usually require transformation of both sides of the expression
    (such as, conversion of both sides into integer epoch values first) which
    currently is a manual procedure (such as via
    :attr:`~sqlalchemy.sql.expression.func`).
 
    rTNrÁrt)riÚsecond_precisionÚ day_precisioncs tƒ ¡||_||_||_dS)a;Construct an Interval object.
 
        :param native: when True, use the actual
          INTERVAL type provided by the database, if
          supported (currently PostgreSQL, Oracle).
          Otherwise, represent the interval data as
          an epoch value regardless.
 
        :param second_precision: For native interval types
          which support a "fractional seconds precision" parameter,
          i.e. Oracle and PostgreSQL
 
        :param day_precision: for native interval types which
          support a "day precision" parameter, i.e. Oracle.
 
        N)rgryrir¨r©)rErir¨r©rirFrGry    s
zInterval.__init__c@seZdZdZdS)zInterval.ComparatorrFN)rWrXrYrZrFrFrFrGr\$sr\cCstjSrA)rçÚ    timedeltarDrFrFrGr’,szInterval.python_typecKstj||f|ŽSrA)r§rrurFrFrGrv0szInterval.adapt_to_emulatedcCs|j ||¡SrA)r‘r÷rørFrFrGr÷3szInterval.coerce_compared_valuer:z _BindProcessorType[dt.timedelta])r‡rNcs^trt|jtƒst‚|j |¡}|j‰|rF|‰dddœ‡‡fdd„ }ndddœ‡fdd„ }|S)NúOptional[dt.timedelta]rrXcs|dk    rˆ|}nd}ˆ|ƒSrArF©r~Zdt_value©ÚepochrrFrGrˆ@s
z(Interval.bind_processor.<locals>.processcs|dk    rˆ|}nd}|SrArFr¬©r®rFrGrˆKs
)r rQr‘rÝrRrŒr®r’rFr­rGrŒ6s      zInterval.bind_processorrz"_ResultProcessorType[dt.timedelta])r‡rŽrNcs`trt|jtƒst‚|j ||¡}|j‰|rH|‰dddœ‡‡fdd„ }ndddœ‡fdd„ }|S)Nrr«rXcsˆ|ƒ}|dkrdS|ˆSrArFr¬r­rFrGrˆ`sz*Interval.result_processor.<locals>.processcs|dkr dS|ˆSrArFr…r¯rFrGrˆhs)r rQr‘rÝrRrr®r–rFr­rGrVszInterval.result_processor)TNN)rWrXrYr_rÝr‹rçrÞÚutcfromtimestampr®ršryr"r\r=r§r^r`r’rvr÷rŒrrkrFrFrirGr®ós& ü
þ
 r®c@sôeZdZdZdZdZe d¡Zd"ddœdd„Z    Gdd    „d    e
e ƒZ Gd
d „d e ƒZ Gd d „d e ƒZGdd„de ƒZGdd„de ƒZGdd„dejeejeƒZeZedd„ƒZedd„ƒZejdd„ƒZejdd„ƒZdd„Zdd„Zdd „Zd!S)#ÚJSONaƒRepresent a SQL JSON type.
 
    .. note::  :class:`_types.JSON`
       is provided as a facade for vendor-specific
       JSON types.  Since it supports JSON SQL operations, it only
       works on backends that have an actual JSON type, currently:
 
       * PostgreSQL - see :class:`sqlalchemy.dialects.postgresql.JSON` and
         :class:`sqlalchemy.dialects.postgresql.JSONB` for backend-specific
         notes
 
       * MySQL - see
         :class:`sqlalchemy.dialects.mysql.JSON` for backend-specific notes
 
       * SQLite as of version 3.9 - see
         :class:`sqlalchemy.dialects.sqlite.JSON` for backend-specific notes
 
       * Microsoft SQL Server 2016 and later - see
         :class:`sqlalchemy.dialects.mssql.JSON` for backend-specific notes
 
    :class:`_types.JSON` is part of the Core in support of the growing
    popularity of native JSON datatypes.
 
    The :class:`_types.JSON` type stores arbitrary JSON format data, e.g.::
 
        data_table = Table('data_table', metadata,
            Column('id', Integer, primary_key=True),
            Column('data', JSON)
        )
 
        with engine.connect() as conn:
            conn.execute(
                data_table.insert(),
                {"data": {"key1": "value1", "key2": "value2"}}
            )
 
    **JSON-Specific Expression Operators**
 
    The :class:`_types.JSON`
    datatype provides these additional SQL operations:
 
    * Keyed index operations::
 
        data_table.c.data['some key']
 
    * Integer index operations::
 
        data_table.c.data[3]
 
    * Path index operations::
 
        data_table.c.data[('key_1', 'key_2', 5, ..., 'key_n')]
 
    * Data casters for specific JSON element types, subsequent to an index
      or path operation being invoked::
 
        data_table.c.data["some key"].as_integer()
 
      .. versionadded:: 1.3.11
 
    Additional operations may be available from the dialect-specific versions
    of :class:`_types.JSON`, such as
    :class:`sqlalchemy.dialects.postgresql.JSON` and
    :class:`sqlalchemy.dialects.postgresql.JSONB` which both offer additional
    PostgreSQL-specific operations.
 
    **Casting JSON Elements to Other Types**
 
    Index operations, i.e. those invoked by calling upon the expression using
    the Python bracket operator as in ``some_column['some key']``, return an
    expression object whose type defaults to :class:`_types.JSON` by default,
    so that
    further JSON-oriented instructions may be called upon the result type.
    However, it is likely more common that an index operation is expected
    to return a specific scalar element, such as a string or integer.  In
    order to provide access to these elements in a backend-agnostic way,
    a series of data casters are provided:
 
    * :meth:`.JSON.Comparator.as_string` - return the element as a string
 
    * :meth:`.JSON.Comparator.as_boolean` - return the element as a boolean
 
    * :meth:`.JSON.Comparator.as_float` - return the element as a float
 
    * :meth:`.JSON.Comparator.as_integer` - return the element as an integer
 
    These data casters are implemented by supporting dialects in order to
    assure that comparisons to the above types will work as expected, such as::
 
        # integer comparison
        data_table.c.data["some_integer_key"].as_integer() == 5
 
        # boolean comparison
        data_table.c.data["some_boolean"].as_boolean() == True
 
    .. versionadded:: 1.3.11 Added type-specific casters for the basic JSON
       data element types.
 
    .. note::
 
        The data caster functions are new in version 1.3.11, and supersede
        the previous documented approaches of using CAST; for reference,
        this looked like::
 
           from sqlalchemy import cast, type_coerce
           from sqlalchemy import String, JSON
           cast(
               data_table.c.data['some_key'], String
           ) == type_coerce(55, JSON)
 
        The above case now works directly as::
 
            data_table.c.data['some_key'].as_integer() == 5
 
        For details on the previous comparison approach within the 1.3.x
        series, see the documentation for SQLAlchemy 1.2 or the included HTML
        files in the doc/ directory of the version's distribution.
 
    **Detecting Changes in JSON columns when using the ORM**
 
    The :class:`_types.JSON` type, when used with the SQLAlchemy ORM, does not
    detect in-place mutations to the structure.  In order to detect these, the
    :mod:`sqlalchemy.ext.mutable` extension must be used, most typically
    using the :class:`.MutableDict` class.  This extension will
    allow "in-place" changes to the datastructure to produce events which
    will be detected by the unit of work.  See the example at :class:`.HSTORE`
    for a simple example involving a dictionary.
 
    Alternatively, assigning a JSON structure to an ORM element that
    replaces the old one will always trigger a change event.
 
    **Support for JSON null vs. SQL NULL**
 
    When working with NULL values, the :class:`_types.JSON` type recommends the
    use of two specific constants in order to differentiate between a column
    that evaluates to SQL NULL, e.g. no value, vs. the JSON-encoded string of
    ``"null"``. To insert or select against a value that is SQL NULL, use the
    constant :func:`.null`. This symbol may be passed as a parameter value
    specifically when using the :class:`_types.JSON` datatype, which contains
    special logic that interprets this symbol to mean that the column value
    should be SQL NULL as opposed to JSON ``"null"``::
 
        from sqlalchemy import null
        conn.execute(table.insert(), {"json_value": null()})
 
    To insert or select against a value that is JSON ``"null"``, use the
    constant :attr:`_types.JSON.NULL`::
 
        conn.execute(table.insert(), {"json_value": JSON.NULL})
 
    The :class:`_types.JSON` type supports a flag
    :paramref:`_types.JSON.none_as_null` which when set to True will result
    in the Python constant ``None`` evaluating to the value of SQL
    NULL, and when set to False results in the Python constant
    ``None`` evaluating to the value of JSON ``"null"``.    The Python
    value ``None`` may be used in conjunction with either
    :attr:`_types.JSON.NULL` and :func:`.null` in order to indicate NULL
    values, but care must be taken as to the value of the
    :paramref:`_types.JSON.none_as_null` in these cases.
 
    **Customizing the JSON Serializer**
 
    The JSON serializer and deserializer used by :class:`_types.JSON`
    defaults to
    Python's ``json.dumps`` and ``json.loads`` functions; in the case of the
    psycopg2 dialect, psycopg2 may be using its own custom loader function.
 
    In order to affect the serializer / deserializer, they are currently
    configurable at the :func:`_sa.create_engine` level via the
    :paramref:`_sa.create_engine.json_serializer` and
    :paramref:`_sa.create_engine.json_deserializer` parameters.  For example,
    to turn off ``ensure_ascii``::
 
        engine = create_engine(
            "sqlite://",
            json_serializer=lambda obj: json.dumps(obj, ensure_ascii=False))
 
    .. versionchanged:: 1.3.7
 
        SQLite dialect's ``json_serializer`` and ``json_deserializer``
        parameters renamed from ``_json_serializer`` and
        ``_json_deserializer``.
 
    .. seealso::
 
        :class:`sqlalchemy.dialects.postgresql.JSON`
 
        :class:`sqlalchemy.dialects.postgresql.JSONB`
 
        :class:`sqlalchemy.dialects.mysql.JSON`
 
        :class:`sqlalchemy.dialects.sqlite.JSON`
 
    FZ    JSON_NULLrÁ©Ú none_as_nullcCs
||_dS)aƒConstruct a :class:`_types.JSON` type.
 
        :param none_as_null=False: if True, persist the value ``None`` as a
         SQL NULL value, not the JSON encoding of ``null``. Note that when this
         flag is False, the :func:`.null` construct can still be used to
         persist a NULL value, which may be passed directly as a parameter
         value that is specially interpreted by the :class:`_types.JSON` type
         as SQL NULL::
 
             from sqlalchemy import null
             conn.execute(table.insert(), {"data": null()})
 
         .. note::
 
              :paramref:`_types.JSON.none_as_null` does **not** apply to the
              values passed to :paramref:`_schema.Column.default` and
              :paramref:`_schema.Column.server_default`; a value of ``None``
              passed for these parameters means "no default present".
 
              Additionally, when used in SQL comparison expressions, the
              Python value ``None`` continues to refer to SQL null, and not
              JSON NULL.  The :paramref:`_types.JSON.none_as_null` flag refers
              explicitly to the **persistence** of the value within an
              INSERT or UPDATE statement.   The :attr:`_types.JSON.NULL`
              value should be used for SQL expressions that wish to compare to
              JSON null.
 
         .. seealso::
 
              :attr:`.types.JSON.NULL`
 
        Nr²)rEr³rFrFrGryc    s!z JSON.__init__c@s<eZdZdZeƒZeƒZdd„Zdd„Z    dd„Z
dd    „Z d
S) zJSON.JSONElementTypez?Common function for index / path elements in a JSON expression.cCs |j |¡SrA)Ú_stringÚ_cached_bind_processorr‹rFrFrGÚstring_bind_processorŒ    sz*JSON.JSONElementType.string_bind_processorcCs |j |¡SrA)r´Ú_cached_literal_processorr‹rFrFrGÚstring_literal_processor    sz-JSON.JSONElementType.string_literal_processorcs(|j |¡‰| |¡‰‡‡fdd„}|S)Ncs2ˆrt|tƒrˆ|ƒ}nˆr.t|tƒr.ˆ|ƒ}|SrA©rQr§r‘r…©Z int_processorZstring_processorrFrGrˆ–    s
 
z4JSON.JSONElementType.bind_processor.<locals>.process)Ú_integerrµr¶r‰rFrºrGrŒ’    s 
z#JSON.JSONElementType.bind_processorcs(|j |¡‰| |¡‰‡‡fdd„}|S)Ncs2ˆrt|tƒrˆ|ƒ}nˆr.t|tƒr.ˆ|ƒ}|SrAr¹r…rºrFrGrˆ£    s
 
z7JSON.JSONElementType.literal_processor.<locals>.process)r»r·r¸r‰rFrºrGrŠŸ    s 
z&JSON.JSONElementType.literal_processorN) rWrXrYr_r¢r»rrr´r¶r¸rŒrŠrFrFrFrGÚJSONElementType†    s r¼c@seZdZdZdS)zJSON.JSONIndexTypeúŸPlaceholder for the datatype of a JSON index value.
 
        This allows execution-time processing of JSON index values
        for special syntaxes.
 
        N©rWrXrYr_rFrFrFrGÚ JSONIndexType¬    sr¿c@seZdZdZdS)zJSON.JSONIntIndexTyper½Nr¾rFrFrFrGÚJSONIntIndexType´    srÀc@seZdZdZdS)zJSON.JSONStrIndexTyper½Nr¾rFrFrFrGÚJSONStrIndexType¼    srÁc@seZdZdZdZdS)zJSON.JSONPathTypez£Placeholder type for JSON path operations.
 
        This allows execution-time processing of a path-based
        index value into a specific SQL syntax.
 
        Z    json_pathNršrFrFrFrGÚ JSONPathTypeÄ    srÂc@sVeZdZdZdZdd„Zdd„Zdd„Zd    d
„Zd d „Z    ddd„Z
dd„Z dd„Z dS)zJSON.Comparatorz6Define comparison operations for :class:`_types.JSON`.rFcCsxt|tƒs:t|tjƒr:tjtj||jt    j
t j d}t    j
}n2tjtj||jt    j t|tƒr\t jnt jd}t    j }|||jfS)N)rfÚoperatorÚbindparam_type)rQr‘Úcollections_abcr
rÚexpectrÚBinaryElementRolerfrÚjson_path_getitem_opr±rÂÚjson_getitem_opr§rÀrÁrO)rErnrÃrFrFrGroÓ    s. ÿûÿù    zJSON.Comparator._setup_getitemcCs| tƒd¡S)aDCast an indexed value as boolean.
 
            e.g.::
 
                stmt = select(
                    mytable.c.json_column['some_data'].as_boolean()
                ).where(
                    mytable.c.json_column['some_data'].as_boolean() == True
                )
 
            .. versionadded:: 1.3.11
 
            Ú
as_boolean)Ú_binary_w_typerœrDrFrFrGrÊî    szJSON.Comparator.as_booleancCs| tƒd¡S)a^Cast an indexed value as string.
 
            e.g.::
 
                stmt = select(
                    mytable.c.json_column['some_data'].as_string()
                ).where(
                    mytable.c.json_column['some_data'].as_string() ==
                    'some string'
                )
 
            .. versionadded:: 1.3.11
 
            Ú    as_string)rËr›rDrFrFrGrÌþ    szJSON.Comparator.as_stringcCs| tƒd¡S)aACast an indexed value as integer.
 
            e.g.::
 
                stmt = select(
                    mytable.c.json_column['some_data'].as_integer()
                ).where(
                    mytable.c.json_column['some_data'].as_integer() == 5
                )
 
            .. versionadded:: 1.3.11
 
            Ú
as_integer)rËr¢rDrFrFrGrÍ
szJSON.Comparator.as_integercCs| tƒd¡S)a?Cast an indexed value as float.
 
            e.g.::
 
                stmt = select(
                    mytable.c.json_column['some_data'].as_float()
                ).where(
                    mytable.c.json_column['some_data'].as_float() == 29.75
                )
 
            .. versionadded:: 1.3.11
 
            Úas_float)rËrÌrDrFrFrGrÎ
szJSON.Comparator.as_floatTcCs| t|||dd¡S)amCast an indexed value as numeric/decimal.
 
            e.g.::
 
                stmt = select(
                    mytable.c.json_column['some_data'].as_numeric(10, 6)
                ).where(
                    mytable.c.
                    json_column['some_data'].as_numeric(10, 6) == 29.75
                )
 
            .. versionadded:: 1.4.0b2
 
            )r¿Ú
as_numeric)rËr¬)rEr¼r½r¿rFrFrGrÏ/
s ÿzJSON.Comparator.as_numericcCs|jS)a€Cast an indexed value as JSON.
 
            e.g.::
 
                stmt = select(mytable.c.json_column['some_data'].as_json())
 
            This is typically the default behavior of indexed elements in any
            case.
 
            Note that comparison of full JSON structures may not be
            supported by all backends.
 
            .. versionadded:: 1.3.11
 
            )rfrDrFrFrGÚas_jsonB
szJSON.Comparator.as_jsoncCsHt|jtjƒr"|jjtjtjfkr4t     d||f¡‚|j 
¡}||_ |S)Nz[The JSON cast operator JSON.%s() only works with a JSON index expression e.g. col['q'].%s()) rQrfrÚBinaryExpressionrÃrrÉrÈr)ZInvalidRequestErrorZ_clonerO)rEr+Ú method_namerfrFrFrGrËT
s"ÿþþþÿ
zJSON.Comparator._binary_w_typeN)T) rWrXrYr_rZrorÊrÌrÍrÎrÏrÐrËrFrFrFrGr\Π   s
r\cCstSrA)rrDrFrFrGr’f
szJSON.python_typecCs|j S)z)Alias of :attr:`_types.JSON.none_as_null`r²rDrFrFrGÚshould_evaluate_nonej
szJSON.should_evaluate_nonecCs | |_dSrAr²r}rFrFrGrÓo
scCstƒSrA)rrrDrFrFrGÚ    _str_impls
szJSON._str_implcs(ˆr‡‡‡fdd„}n‡‡fdd„}|S)Ncs>|ˆjkrd}nt|tjƒs*|dkr.ˆjr.dSˆ|ƒ}ˆ|ƒSrA©ÚNULLrQrZNullr³)r~Z
serialized©Újson_serializerrEÚstring_processrFrGrˆz
s
 ÿÿz*JSON._make_bind_processor.<locals>.processcs6|ˆjkrd}nt|tjƒs*|dkr.ˆjr.dSˆ|ƒSrArÕr…)rØrErFrGrˆ‡
s
 ÿÿrF)rErÙrØrˆrFr×rGÚ_make_bind_processorw
s 
zJSON._make_bind_processorcCs$|j |¡}|jptj}| ||¡SrA)rÔrŒZ_json_serializerÚjsonrrÚ)rEr‡rÙrØrFrFrGrŒ“
s  zJSON.bind_processorcs,|j ||¡‰|jptj‰‡‡fdd„}|S)Ncs |dkr dSˆrˆ|ƒ}ˆ|ƒSrArFr…©Zjson_deserializerrÙrFrGrˆ
s
z&JSON.result_processor.<locals>.process)rÔrZ_json_deserializerrÛr•rôrFrÜrGr™
s zJSON.result_processorN)F)rWrXrYr_r—Úhashabler+ÚsymbolrÖryr#rr¼r¿rÀrÁrÂrmr\r;rbr^r`r’rÓÚsetterr³rÔrÚrŒrrFrFrFrGr±ps2D
,#&

 
 
 
r±cs¦eZdZdZdZdZdZGdd„deje    e
e je    e
ƒZeZ dddd    dd
œd d „Z ed d„ƒZedd„ƒZdd„Zddd„Z‡fdd„Zdd„Zdd„Z‡ZS)r)aèRepresent a SQL Array type.
 
    .. note::  This type serves as the basis for all ARRAY operations.
       However, currently **only the PostgreSQL backend has support for SQL
       arrays in SQLAlchemy**. It is recommended to use the PostgreSQL-specific
       :class:`sqlalchemy.dialects.postgresql.ARRAY` type directly when using
       ARRAY types with PostgreSQL, as it provides additional operators
       specific to that backend.
 
    :class:`_types.ARRAY` is part of the Core in support of various SQL
    standard functions such as :class:`_functions.array_agg`
    which explicitly involve
    arrays; however, with the exception of the PostgreSQL backend and possibly
    some third-party dialects, no other SQLAlchemy built-in dialect has support
    for this type.
 
    An :class:`_types.ARRAY` type is constructed given the "type"
    of element::
 
        mytable = Table("mytable", metadata,
                Column("data", ARRAY(Integer))
            )
 
    The above type represents an N-dimensional array,
    meaning a supporting backend such as PostgreSQL will interpret values
    with any number of dimensions automatically.   To produce an INSERT
    construct that passes in a 1-dimensional array of integers::
 
        connection.execute(
                mytable.insert(),
                {"data": [1,2,3]}
        )
 
    The :class:`_types.ARRAY` type can be constructed given a fixed number
    of dimensions::
 
        mytable = Table("mytable", metadata,
                Column("data", ARRAY(Integer, dimensions=2))
            )
 
    Sending a number of dimensions is optional, but recommended if the
    datatype is to represent arrays of more than one dimension.  This number
    is used:
 
    * When emitting the type declaration itself to the database, e.g.
      ``INTEGER[][]``
 
    * When translating Python values to database values, and vice versa, e.g.
      an ARRAY of :class:`.Unicode` objects uses this number to efficiently
      access the string values inside of array structures without resorting
      to per-row type inspection
 
    * When used with the Python ``getitem`` accessor, the number of dimensions
      serves to define the kind of type that the ``[]`` operator should
      return, e.g. for an ARRAY of INTEGER with two dimensions::
 
          >>> expr = table.c.column[5]  # returns ARRAY(Integer, dimensions=1)
          >>> expr = expr[6]  # returns Integer
 
    For 1-dimensional arrays, an :class:`_types.ARRAY` instance with no
    dimension parameter will generally assume single-dimensional behaviors.
 
    SQL expressions of type :class:`_types.ARRAY` have support for "index" and
    "slice" behavior.  The Python ``[]`` operator works normally here, given
    integer indexes or slices.  Arrays default to 1-based indexing.
    The operator produces binary expression
    constructs which will produce the appropriate SQL, both for
    SELECT statements::
 
        select(mytable.c.data[5], mytable.c.data[2:7])
 
    as well as UPDATE statements when the :meth:`_expression.Update.values`
    method
    is used::
 
        mytable.update().values({
            mytable.c.data[5]: 7,
            mytable.c.data[2:7]: [1, 2, 3]
        })
 
    The :class:`_types.ARRAY` type also provides for the operators
    :meth:`.types.ARRAY.Comparator.any` and
    :meth:`.types.ARRAY.Comparator.all`. The PostgreSQL-specific version of
    :class:`_types.ARRAY` also provides additional operators.
 
    .. container:: topic
 
        **Detecting Changes in ARRAY columns when using the ORM**
 
        The :class:`_sqltypes.ARRAY` type, when used with the SQLAlchemy ORM,
        does not detect in-place mutations to the array. In order to detect
        these, the :mod:`sqlalchemy.ext.mutable` extension must be used, using
        the :class:`.MutableList` class::
 
            from sqlalchemy import ARRAY
            from sqlalchemy.ext.mutable import MutableList
 
            class SomeOrmClass(Base):
                # ...
 
                data = Column(MutableList.as_mutable(ARRAY(Integer)))
 
        This extension will allow "in-place" changes such to the array
        such as ``.append()`` to produce events which will be detected by the
        unit of work.  Note that changes to elements **inside** the array,
        including subarrays that are mutated in place, are **not** detected.
 
        Alternatively, assigning a new array value to an ORM element that
        replaces the old one will always trigger a change event.
 
    .. seealso::
 
        :class:`sqlalchemy.dialects.postgresql.ARRAY`
 
    TFc@sVeZdZUdZdZded<dd„Zdd„Ze     d    ¡dd d „ƒZ
e     d    ¡dd d„ƒZ d
S)zARRAY.ComparatorzÆDefine comparison operations for :class:`_types.ARRAY`.
 
        More operators are available on the dialect-specific form
        of this type.  See :class:`.postgresql.ARRAY.Comparator`.
 
        rFr)rOcCs²|j}t|tƒrZ|}|jr4t|jd|jd|jƒ}t|j|j|j|jj    d}t
j ||fS|jrh|d7}|j dks||j dkr„|j }nd|j di}|j|jf|Ž}t
j ||fSdS)Nr)Ú_nameÚ
dimensions)rOrQÚsliceÚ zero_indexesÚstartÚstopÚsteprrfÚkeyrÚgetitemrár*rrj)rErnÚarr_typeÚ return_typeZslice_Zadapt_kwrFrFrGro6 s.
ÿ ÿÿzARRAY.Comparator._setup_getitemcOs tdƒ‚dS)NzdARRAY.contains() not implemented for the base ARRAY type; please use the dialect-specific ARRAY typerB)rEr]rrFrFrGÚcontainsQ sÿzARRAY.Comparator.containszsqlalchemy.sql.elementsNc    CsJtjj}|r|ntj}|j}| tjt    j
|||j |j d|j  |j ¡|¡S)aSReturn ``other operator ANY (array)`` clause.
 
            .. note:: This method is an :class:`_types.ARRAY` - specific
                construct that is now superseded by the :func:`_sql.any_`
                function, which features a different calling style. The
                :func:`_sql.any_` function is also mirrored at the method level
                via the :meth:`_sql.ColumnOperators.any_` method.
 
            Usage of array-specific :meth:`_types.ARRAY.Comparator.any`
            is as follows::
 
                from sqlalchemy.sql import operators
 
                conn.execute(
                    select(table.c.data).where(
                            table.c.data.any(7, operator=operators.lt)
                        )
                )
 
            :param other: expression to be compared
            :param operator: an operator object from the
             :mod:`sqlalchemy.sql.operators`
             package, defaults to :func:`.operators.eq`.
 
            .. seealso::
 
                :func:`_expression.any_`
 
                :meth:`.types.ARRAY.Comparator.all`
 
            ©ÚelementrÃrfrÄ)r+r}Ú sql_elementsrÚeqrOrÑrrÆrrÇrfr*ÚCollectionAggregateZ _create_any©rEÚotherrÃrrérFrFrGÚanyW s!û ÷zARRAY.Comparator.anyc    CsJtjj}|r|ntj}|j}| tjt    j
|||j |j d|j  |j ¡|¡S)aSReturn ``other operator ALL (array)`` clause.
 
            .. note:: This method is an :class:`_types.ARRAY` - specific
                construct that is now superseded by the :func:`_sql.any_`
                function, which features a different calling style. The
                :func:`_sql.any_` function is also mirrored at the method level
                via the :meth:`_sql.ColumnOperators.any_` method.
 
            Usage of array-specific :meth:`_types.ARRAY.Comparator.all`
            is as follows::
 
                from sqlalchemy.sql import operators
 
                conn.execute(
                    select(table.c.data).where(
                            table.c.data.all(7, operator=operators.lt)
                        )
                )
 
            :param other: expression to be compared
            :param operator: an operator object from the
             :mod:`sqlalchemy.sql.operators`
             package, defaults to :func:`.operators.eq`.
 
            .. seealso::
 
                :func:`_expression.all_`
 
                :meth:`.types.ARRAY.Comparator.any`
 
            rì)r+r}rîrrïrOrÑrrÆrrÇrfr*rðZ _create_allrñrFrFrGÚall‹ s!û ÷zARRAY.Comparator.all)N)N) rWrXrYr_rZrarorër+r†rórôrFrFrFrGr\& s
 3r\Nú_TypeEngineArgument[Any]rÁrt)r*Úas_tuplerárãcCs>t|tƒrtdƒ‚t|tƒr"|ƒ}||_||_||_||_dS)aýConstruct an :class:`_types.ARRAY`.
 
        E.g.::
 
          Column('myarray', ARRAY(Integer))
 
        Arguments are:
 
        :param item_type: The data type of items of this array. Note that
          dimensionality is irrelevant here, so multi-dimensional arrays like
          ``INTEGER[][]``, are constructed as ``ARRAY(Integer)``, not as
          ``ARRAY(ARRAY(Integer))`` or such.
 
        :param as_tuple=False: Specify whether return results
          should be converted to tuples from lists.  This parameter is
          not generally needed as a Python list corresponds well
          to a SQL array.
 
        :param dimensions: if non-None, the ARRAY will assume a fixed
         number of dimensions.   This impacts how the array is declared
         on the database, how it goes about interpreting Python and
         result values, as well as how expression behavior in conjunction
         with the "getitem" operator works.  See the description at
         :class:`_types.ARRAY` for additional detail.
 
        :param zero_indexes=False: when True, index values will be converted
         between Python zero-based and SQL one-based indexes, e.g.
         a value of one will be added to all index values before passing
         to the database.
 
        zUDo not nest ARRAY types; ARRAY(basetype) handles multi-dimensional arrays of basetypeN)rQr)rGrOr*rörárã)rEr*rörárãrFrFrGryÁ s&
ÿ
zARRAY.__init__cCs|jSrA)rörDrFrFrGrÝó szARRAY.hashablecCstSrA)rWrDrFrFrGr’÷ szARRAY.python_typecCs||kSrArFr—rFrFrGr™û szARRAY.compare_valuescKs$|s t|jtƒr |jj|f|ŽdS)úSupport SchemaEventTargetN)rQr*rr)rErÚouterrrFrFrGrþ szARRAY._set_parentcs,tƒj|ddt|jtƒr(|j |¡dS)r÷T)røN)rgÚ_set_parent_with_dispatchrQr*r)rEÚparentrirFrGrù s zARRAY._set_parent_with_dispatchcs:ˆj |¡ |¡‰ˆdkrdSdd„‰‡‡‡fdd„}|S)NcSsdd |¡›dS)Nú[r^ú])rarrFrFrGÚto_str sz'ARRAY.literal_processor.<locals>.to_strcsˆ |ˆˆjˆ¡}|SrA)Ú_apply_item_processorrá)r~Úinner©Z    item_procrErýrFrGrˆ sÿz(ARRAY.literal_processor.<locals>.process)r*r rŠr‰rFrrGrŠ s ÿzARRAY.literal_processorcszˆdkrt|ƒ}ˆdks6ˆdkrZ|r6t|dttfƒsZˆrPˆ‡fdd„|DƒƒSˆ|ƒSnˆ‡‡‡‡fdd„|DƒƒSdS)aAHelper method that can be used by bind_processor(),
        literal_processor(), etc. to apply an item processor to elements of
        an array value, taking into account the 'dimensions' for this
        array type.
 
        See the Postgresql ARRAY datatype for usage examples.
 
        .. versionadded:: 2.0
 
        Nrrc3s|]}ˆ|ƒVqdSrArFr=)ÚitemprocrFrGr@8 sz.ARRAY._apply_item_processor.<locals>.<genexpr>c3s:|]2}|dk    r.ˆ |ˆˆdk    r&ˆdndˆ¡ndVqdS)Nr)rþr=©Úcollection_callableÚdimrrErFrGr@< s    þúü)rWrQÚtuple)rEZarrrrrrFrrGrþ s  ÿþùø 
    ÷zARRAY._apply_item_processor)FNF)F)rWrXrYr_r—Z    _is_arrayrãrmr\r
rrbr^ryr`rÝr’r™rrùrŠrþrkrFrFrirGr)§
s.t
  þû2
 
 
 r)cs^eZdZUdZdZded<ddœdd„Zd    d
d d œ‡fd d„ Zd
ddœdd„Zdd„Z    ‡Z
S)Ú    TupleTypez(represent the composite type of a Tuple.TzList[TypeEngine[Any]]Útypesrõ)rcGst|k|_dd„|Dƒ|_dS)NcSs g|]}t|tƒr|ƒn|‘qSrF)rQrO)r>r*rFrFrGrTR sÿz&TupleType.__init__.<locals>.<listcomp>)ÚNULLTYPEÚ _fully_typedr)rErrFrFrGryP s
þzTupleType.__init__zOptional[OperatorType]rr?)rLr~rNcs:|tjkrtƒ ˆ|¡St‡fdd„t|j|ƒDƒŽSdS)Ncsg|]\}}| ˆ|¡‘qSrF)r÷©r>r+ro©rLrFrGrT_ sÿz3TupleType.coerce_compared_value.<locals>.<listcomp>)rZ_NO_VALUE_IN_LISTrgr÷rrerrørir rGr÷W s
 
 
þÿzTupleType.coerce_compared_valuerXcCs(|jr
|Stdd„t|j|ƒDƒŽSdS)NcSs$g|]\}}|tkrt|ƒn|‘qSrF)rÚ_resolve_value_to_typer
rFrFrGrTj sÿz6TupleType._resolve_values_to_types.<locals>.<listcomp>)r    rrerr}rFrFrGÚ_resolve_values_to_typese s
þÿz"TupleType._resolve_values_to_typescCs tdƒ‚dS)NzJThe tuple type does not support being fetched as a column in a result row.rBrrFrFrGrp sÿzTupleType.result_processor) rWrXrYr_Z_is_tuple_typeraryr÷r rrkrFrFrirGrI s
 r.c@seZdZdZdZdS)ÚREALzlThe SQL REAL type.
 
    .. seealso::
 
        :class:`_types.Float` - documentation for the base type.
 
    NršrFrFrFrGrw src@seZdZdZdZdS)ÚFLOATzmThe SQL FLOAT type.
 
    .. seealso::
 
        :class:`_types.Float` - documentation for the base type.
 
    NršrFrFrFrGr„ src@seZdZdZdZdS)ÚDOUBLEzŠThe SQL DOUBLE type.
 
    .. versionadded:: 2.0
 
    .. seealso::
 
        :class:`_types.Double` - documentation for the base type.
 
    NršrFrFrFrGr‘ s
rc@seZdZdZdZdS)ÚDOUBLE_PRECISIONz”The SQL DOUBLE PRECISION type.
 
    .. versionadded:: 2.0
 
    .. seealso::
 
        :class:`_types.Double` - documentation for the base type.
 
    NršrFrFrFrGrŸ s
rc@seZdZdZdZdS)ÚNUMERICzqThe SQL NUMERIC type.
 
    .. seealso::
 
        :class:`_types.Numeric` - documentation for the base type.
 
    NršrFrFrFrGr­ src@seZdZdZdZdS)ÚDECIMALzqThe SQL DECIMAL type.
 
    .. seealso::
 
        :class:`_types.Numeric` - documentation for the base type.
 
    NršrFrFrFrGrº src@seZdZdZdZdS)ÚINTEGERzxThe SQL INT or INTEGER type.
 
    .. seealso::
 
        :class:`_types.Integer` - documentation for the base type.
 
    NršrFrFrFrGrÇ src@seZdZdZdZdS)ÚSMALLINTzwThe SQL SMALLINT type.
 
    .. seealso::
 
        :class:`_types.SmallInteger` - documentation for the base type.
 
    NršrFrFrFrGr× src@seZdZdZdZdS)ÚBIGINTzsThe SQL BIGINT type.
 
    .. seealso::
 
        :class:`_types.BigInteger` - documentation for the base type.
 
    NršrFrFrFrGrä srcs4eZdZdZdZd    ddœ‡fdd„ Zdd„Z‡ZS)
Ú    TIMESTAMPaThe SQL TIMESTAMP type.
 
    :class:`_types.TIMESTAMP` datatypes have support for timezone
    storage on some backends, such as PostgreSQL and Oracle.  Use the
    :paramref:`~types.TIMESTAMP.timezone` argument in order to enable
    "TIMESTAMP WITH TIMEZONE" for these backends.
 
    FrÁrßcstƒj|ddS)amConstruct a new :class:`_types.TIMESTAMP`.
 
        :param timezone: boolean.  Indicates that the TIMESTAMP type should
         enable timezone support, if available on the target database.
         On a per-dialect basis is similar to "TIMESTAMP WITH TIMEZONE".
         If the target database does not support timezones, this flag is
         ignored.
 
 
        rßNrrárirFrGryþ s zTIMESTAMP.__init__cCs|jSrA)rr”rFrFrGr– szTIMESTAMP.get_dbapi_type)F)rWrXrYr_r—ryr–rkrFrFrirGrñ s     rc@seZdZdZdZdS)rãzThe SQL DATETIME type.NršrFrFrFrGrã srãc@seZdZdZdZdS)ÚDATEzThe SQL DATE type.NršrFrFrFrGr src@seZdZdZdZdS)ÚTIMEzThe SQL TIME type.NršrFrFrFrGr src@seZdZdZdZdS)ÚTEXTzThe SQL TEXT type.NršrFrFrFrGr$ src@seZdZdZdZdS)ÚCLOBzCThe CLOB type.
 
    This type is found in Oracle and Informix.
    NršrFrFrFrGr+ src@seZdZdZdZdS)ÚVARCHARzThe SQL VARCHAR type.NršrFrFrFrGr5 src@seZdZdZdZdS)ÚNVARCHARzThe SQL NVARCHAR type.NršrFrFrFrGr< src@seZdZdZdZdS)ÚCHARzThe SQL CHAR type.NršrFrFrFrGrC src@seZdZdZdZdS)ÚNCHARzThe SQL NCHAR type.NršrFrFrFrGrJ src@seZdZdZdZdS)ÚBLOBzThe SQL BLOB type.NršrFrFrFrGr Q sr c@seZdZdZdZdS)rùzThe SQL BINARY type.NršrFrFrFrGrùX srùc@seZdZdZdZdS)Ú    VARBINARYzThe SQL VARBINARY type.NršrFrFrFrGr!_ sr!c@seZdZdZdZdS)ÚBOOLEANzThe SQL BOOLEAN type.NršrFrFrFrGr"f sr"c@s:eZdZdZdZdZdd„ZGdd„deje    ƒZeZ
dS)    rdaAn unknown type.
 
    :class:`.NullType` is used as a default type for those cases where
    a type cannot be determined, including:
 
    * During table reflection, when the type of a column is not recognized
      by the :class:`.Dialect`
    * When constructing SQL expressions using plain Python objects of
      unknown types (e.g. ``somecolumn == my_special_object``)
    * When a new :class:`_schema.Column` is created,
      and the given type is passed
      as ``None`` or is not passed at all.
 
    The :class:`.NullType` can be used within SQL expression invocation
    without issue, it just has no behavior either at the expression
    construction level or at the bind-parameter/result processing level.
    :class:`.NullType` will result in a :exc:`.CompileError` if the compiler
    is asked to render the type itself, such as if it is used in a
    :func:`.cast` operation or within a schema creation operation such as that
    invoked by :meth:`_schema.MetaData.create_all` or the
    :class:`.CreateTable`
    construct.
 
    ÚnullTcCsdSrArFr‹rFrFrGrŠŒ szNullType.literal_processorc@s"eZdZdZddddœdd„ZdS)    zNullType.ComparatorrFr4rIrJrKcCs2t|tjƒst |¡s"||jjfS| ||¡SdSrA)rQrdr\rZis_commutativerfrOrVrhrFrFrGrV’ sÿþ z%NullType.Comparator._adapt_expressionN)rWrXrYrZrVrFrFrFrGr\ sr\N) rWrXrYr_r—Z_isnullrŠr#r\r;r^rFrFrFrGrdm s rdc@s.eZdZdZdZdejfgZddœdd„ZdS)    ÚTableValueTypezRefers to a table value type.TÚ    _elementsz*Union[str, _ColumnExpressionArgument[Any]]rcGsdd„|Dƒ|_dS)NcSsg|]}t tj|¡‘qSrF)rrÆrZStrAsPlainColumnRole)r>rorFrFrGrT« sÿz+TableValueType.__init__.<locals>.<listcomp>)r%)rErrFrFrGryª sþzTableValueType.__init__N)    rWrXrYr_Z_is_table_valuer&Zdp_clauseelement_listZ_traverse_internalsryrFrFrFrGr$¡ s
ÿr$c@seZdZdZdS)Ú    MatchTypea'Refers to the return type of the MATCH operator.
 
    As the :meth:`.ColumnOperators.match` is probably the most open-ended
    operator in generic SQLAlchemy Core, we can't assume the return type
    at SQL evaluation time, as MySQL returns a floating point, not a boolean,
    and other backends might do something different.    So this type
    acts as a placeholder, currently subclassing :class:`.Boolean`.
    The type allows dialects to inject result-processing functionality
    if needed, and on MySQL will return floating-point values.
 
    Nr¾rFrFrFrGr&± sr&Ú _UUID_RETURNcs˜eZdZUdZdZdZded<edddd    d
œd d „ƒZedd dd    d
œdd „ƒZdd    d    dœdd „Ze    dd„ƒZ
‡fdd„Z dd„Z dd„Z dd„Z‡ZS) ÚUuidaúRepresent a database agnostic UUID datatype.
 
    For backends that have no "native" UUID datatype, the value will
    make use of ``CHAR(32)`` and store the UUID as a 32-character alphanumeric
    hex string.
 
    For backends which are known to support ``UUID`` directly or a similar
    uuid-storing datatype such as SQL Server's ``UNIQUEIDENTIFIER``, a
    "native" mode enabled by default allows these types will be used on those
    backends.
 
    In its default mode of use, the :class:`_sqltypes.Uuid` datatype expects
    **Python uuid objects**, from the Python
    `uuid <https://docs.python.org/3/library/uuid.html>`_
    module::
 
        import uuid
 
        from sqlalchemy import Uuid
        from sqlalchemy import Table, Column, MetaData, String
 
 
        metadata_obj = MetaData()
 
        t = Table(
            "t",
            metadata_obj,
            Column('uuid_data', Uuid, primary_key=True),
            Column("other_data", String)
        )
 
        with engine.begin() as conn:
            conn.execute(
                t.insert(),
                {"uuid_data": uuid.uuid4(), "other_data", "some data"}
            )
 
    To have the :class:`_sqltypes.Uuid` datatype work with string-based
    Uuids (e.g. 32 character hexadecimal strings), pass the
    :paramref:`_sqltypes.Uuid.as_uuid` parameter with the value ``False``.
 
    .. versionadded:: 2.0
 
    .. seealso::
 
        :class:`_sqltypes.UUID` - represents exactly the ``UUID`` datatype
        without any backend-agnostic behaviors.
 
    ÚuuidNrurx.zUuid[_python_UUID]rºrÁ©rEÚas_uuidÚ native_uuidcCsdSrArFr*rFrFrGryú sz Uuid.__init__z    Uuid[str]rÀcCsdSrArFr*rFrFrGrysT©r+r,cCs||_||_dS)a^Construct a :class:`_sqltypes.Uuid` type.
 
        :param as_uuid=True: if True, values will be interpreted
         as Python uuid objects, converting to/from string via the
         DBAPI.
 
         .. versionchanged: 2.0 ``as_uuid`` now defaults to ``True``.
 
        :param native_uuid=True: if True, backends that support either the
         ``UUID`` datatype directly, or a UUID-storing value
         (such as SQL Server's ``UNIQUEIDENTIFIER`` will be used by those
         backends.   If False, a ``CHAR(32)`` datatype will be used for
         all backends regardless of native support.
 
        Nr-r*rFrFrGry
scCs|jr
tStSrA)r+Ú _python_UUIDr‘rDrFrFrGr’szUuid.python_typecs t|tƒr|Stƒ ||¡SdSrõrörørirFrGr÷!s
zUuid.coerce_compared_valuecCs<|j p|j }|r4|jr&dd„}|Sdd„}|SndSdS)NcSs|dk    r|j}|SrA©Úhexr…rFrFrGrˆ1sz$Uuid.bind_processor.<locals>.processcSs|dk    r| dd¡}|S)Nú-Ú©r„r…rFrFrGrˆ9s ©Zsupports_native_uuidr,r+©rEr‡Úcharacter_based_uuidrˆrFrFrGrŒ)sÿzUuid.bind_processorcCsN|j p|j }|r4|jr&dd„}|Sdd„}|Sn|jsFdd„}|SdSdS)NcSs|dk    rt|ƒ}|SrA)r.r…rFrFrGrˆJsz&Uuid.result_processor.<locals>.processcSs|dk    rtt|ƒƒ}|SrA)r‘r.r…rFrFrGrˆRs cSs|dk    rt|ƒ}|SrArr…rFrFrGrˆ\sr4)rEr‡rŽr6rˆrFrFrGrBsÿzUuid.result_processorcCsB|j p|j }|js"dd„}|S|r2dd„}|Sdd„}|SdS)NcSs(|dk    r$d| dd¡ dd¡›d}|S)Nr€r1r2rr3r…rFrFrGrˆlsÿz'Uuid.literal_processor.<locals>.processcSs|dk    rd|j›d}|S)Nr€r/r…rFrFrGrˆwscSs$|dk    r dt|ƒ dd¡›d}|S)Nr€r)r‘r„r…rFrFrGrˆsr4r5rFrFrGrŠesÿzUuid.literal_processor)..)..)TT)rWrXrYr_r—rxrar    ryr`r’r÷rŒrrŠrkrFrFrirGr( s$
2 ýý
 #r(c@sPeZdZdZdZeddddœdd„ƒZeddd    dœd
d„ƒZdd d œdd„ZdS)ra™Represent the SQL UUID type.
 
    This is the SQL-native form of the :class:`_types.Uuid` database agnostic
    datatype, and is backwards compatible with the previous PostgreSQL-only
    version of ``UUID``.
 
    The :class:`_sqltypes.UUID` datatype only works on databases that have a
    SQL datatype named ``UUID``. It will not function for backends which don't
    have this exact-named type, including SQL Server. For backend-agnostic UUID
    values with native support, including for SQL Server's ``UNIQUEIDENTIFIER``
    datatype, use the :class:`_sqltypes.Uuid` datatype.
 
    .. versionadded:: 2.0
 
    .. seealso::
 
        :class:`_sqltypes.Uuid`
 
    .zUUID[_python_UUID]rº©rEr+cCsdSrArFr7rFrFrGryŸsz UUID.__init__z    UUID[str]rÀcCsdSrArFr7rFrFrGry£sTrÁ)r+cCs||_d|_dS)aConstruct a :class:`_sqltypes.UUID` type.
 
 
        :param as_uuid=True: if True, values will be interpreted
         as Python uuid objects, converting to/from string via the
         DBAPI.
 
         .. versionchanged: 2.0 ``as_uuid`` now defaults to ``True``.
 
        TNr-r7rFrFrGry§s N).).)T)rWrXrYr_r—r    ryrFrFrFrGr‡srr¹Ú NUMERICTYPETrßz Dict[Type[Any], TypeEngine[Any]]Ú    _type_maprXcCsltt|ƒdƒ}|dkr"t|ddƒ}|dkr^t |d¡}|dk    rZ|jtjkrZt d|f¡‚t    S| 
|¡SdS)NFZ__sa_type_engine__z-Object %r is not legal as a SQL literal value) Ú _type_map_getrOrÃr*ÚinspectrjZ _registrarsr)r`rr)r~Z _result_typeZinsprFrFrGr Ús   ÿ
ûÿÿr )ªr_Ú
__future__rÚcollections.abcÚabcrÅrÞrçrÆr/rÛrŒÚtypingrrrrrrr    r
r r r rrr)rr.r2rrrrrÚbaserrrÚ    cache_keyrrrrr€rr r!r"r#r$r%Zvisitorsr&r(r)r*r+Zenginer,r-r.Z util.typingr/r0r1Ú_typingr2r3r4rÿr5r6r7r8r9Zengine.interfacesr:r;r=r>r@rbrmr‘rrr˜r›r¡r§r¢r´rµrÇrÈr¶r¬rÌrÎrÐrÝrèr«rêrérñrìrúrûr.r0r‡rÁrœrªr§r®r±r)rrrrrrrrÚINTrrrrãrrrrrrrrr rùr!r"rdr$r&r'r(rZ BOOLEANTYPEZ
STRINGTYPEZ INTEGERTYPEr8raZ    MATCHTYPEZ
TABLEVALUErårërªZ    _DATETIMEZ_TIMEr{r|rOr9rSr:r Z    INDEXABLErFrFrFrGÚ<module>    s’                                                          'W 62  9a
ÿC)%@h$2i};
 
ÿ%.       
4 F/
 
ò