zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
U
¸ý°dSûã
@s@dZddlmZddlZddlmZddlZddlZddlZddl    Z    ddl    m
Z
ddl    m Z ddl    m Z ddl    m Z dd    l    mZdd
l    mZdd l    mZdd l    mZdd l    mZddl    mZddl    mZddl    mZddl    mZddl    mZddl    mZddl    mZddl    mZddl    mZddlZddlmZddlmZddl m!Z!ddl m"Z"ddl#m$Z$ddl#m%Z%ddl#m&Z&ddl#m'Z'dd l#m(Z(dd!l#m)Z)dd"l#m*Z*dd#l#m+Z+dd$l,m-Z-dd%l,m.Z.dd&l,m/Z/dd'l,m0Z0dd(l,m1Z1dd)l,m2Z2dd*l,m3Z3dd+l,m4Z4dd,l5m6Z6dd-l5m7Z7dd.l5m8Z8d/d0lm9Z:d/d1lm;Z;d/d2lm<Z<d/d3lm=Z=d/d4lm>Z>d/d5lm5Z5d/d6l?mZd/d7l>m@Z@d/d8l>mAZAd/d9l>mBZBd/d:l>mCZCd/d;l>mDZDd/d<lEmFZFd/d=lEmGZGd/d>lHmIZId/d?lHmJZJd/d@lKmLZLd/dAlKmMZMd/dBlKmNZNd/dClKmOZOd/dDlKmPZPd/dElKmQZQd/dFlKmRZRd/dGlSmTZTd/dHlSmUZUd/dIlSmVZVe    jWràddJl mXZXddKl mYZYddLl mZZZddMl m[Z[ddNl m\Z\ddOl m]Z]ddPl m^Z^ddQl#m_Z_ddRl`maZaddSl`mbZbddTlcmdZdddUlemfZfddVlgmhZhddWlimjZjddXlkmlZlddYlmmnZnddZlompZpdd[l5mqZqdd\l5mrZrd/d]lEmsZsd/d^lEmtZtd/d_lEmuZud/d`lvmwZwd/dalHmxZxd/dblHmyZyd/dclHmzZzd/ddl{m|Z|d/del}m~Z~d/dflSmZd/dglSm€Z€edhe
diZedje
diZ‚edke
diZƒedle
diZ„edme
diZ…ee†eee geefdndoe gdnfe gdoffZ‡eUdpZˆee†eFe‰fZŠedqe†e gdqffZ‹eeUdre†eFe
e geeJe
feee†eFe
ffZŒee†ee†ee†e
fffZeeIe
eGeCjŽdsfZee†eee geefe gefefZedteFe
diZ‘edudvdiZ’eeeJe
eJe
fZ“eeeJe
eJe
fZ”eeeJe
eJe
fZ•dtdtdwœdxdy„Z–dtdtdwœdzd{„Z—ej˜Gd|d}„d}ee‚eƒfƒƒZ™Gd~d„deƒZše<j›Gd€d„de.e4ee<jœƒƒZdud‚dudƒœd„d…„ZžGd†d‡„d‡ƒZŸGdˆd‰„d‰ƒZ GdŠd‹„d‹eee$ee+ee'eƒZ¡dS)Œa
Heuristics related to join conditions as used in
:func:`_orm.relationship`.
 
Provides the :class:`.JoinCondition` object, which encapsulates
SQL annotation and aliasing behavior focused on the `primaryjoin`
and `secondaryjoin` aspects of :func:`_orm.relationship`.
 
é)Ú annotationsN)Úabc)ÚAny)ÚCallable)Úcast)Ú
Collection)ÚDict)ÚGeneric)ÚIterable)ÚIterator)ÚList)Ú
NamedTuple)ÚNoReturn)ÚOptional)ÚSequence)ÚSet)ÚTuple)ÚType)ÚTypeVar)ÚUnioné)Ú
attributes)Ústrategy_options)Úinsp_is_aliased_class)Úis_has_collection_adapter)Ú_DeclarativeMapped)Ú_is_mapped_class)Ú class_mapper)Ú DynamicMapped)ÚLoaderCallableStatus)Ú PassiveFlag)Ú    state_str)ÚWriteOnlyMapped)Ú_AttributeOptions)Ú_IntrospectsAnnotations)Ú
MANYTOMANY)Ú    MANYTOONE)Ú    ONETOMANY)ÚPropComparator)ÚRelationshipDirection)ÚStrategizedProperty)Ú _orm_annotate)Ú_orm_deannotate)ÚCascadeOptionsé)Úexc)ÚExists)Úlog)Úschema)Úsql)Úutil)Úinspect)Ú    coercions)Ú
expression)Ú    operators)Úroles)Úvisitors)Ú_ColumnExpressionArgument)Ú_HasClauseElement)Ú ColumnClause)Ú ColumnElement)Ú_deep_deannotate)Ú_shallow_annotate)Úadapt_criterion_to_null)Ú ClauseAdapter)Újoin_condition)Úselectables_overlap©Úvisit_binary_product)Úde_optionalize_union_types)ÚLiteral)Úresolve_name_to_real_class_name)Ú _EntityType)Ú_ExternalEntityType)Ú_IdentityKeyType)Ú _InstanceDict)Ú_InternalEntityType)Ú_O)Ú _RegistryType)ÚMapped)Ú_class_resolver)Ú_ModNS)Ú_ClassScanMapperConfig)ÚDependencyProcessor)ÚMapper)ÚQuery)ÚSession)Ú InstanceState)Ú
LazyLoader)Ú AliasedClass)Ú AliasedInsp)Ú_CoreAdapterProto)Ú_EquivalentColumnMap)Ú    _InfoType)Ú_AnnotationDict)ÚBinaryExpression)Ú BindParameter)Ú ClauseElement)ÚTable)Ú
FromClause)Ú_AnnotationScanType)ÚRODescriptorReferenceÚ_T)ÚboundÚ_T1Ú_T2Ú_PTÚ_PT2ú
Mapper[_T]zAliasedClass[_T]) ÚselectZjoinedZselectinZsubqueryÚraiseZ raise_on_sqlZnoloadZ    immediateÚ
write_onlyÚdynamicTFNreFz Mapped[Any]Ú_CEAÚ_CEúColumnElement[Any])ÚexprÚreturncCstt tj|¡ddiƒS)aAnnotate a portion of a primaryjoin expression
    with a 'remote' annotation.
 
    See the section :ref:`relationship_custom_foreign` for a
    description of use.
 
    .. seealso::
 
        :ref:`relationship_custom_foreign`
 
        :func:`.foreign`
 
    ÚremoteT©Ú_annotate_columnsr6Úexpectr9ÚColumnArgumentRole©rv©r~úSd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/orm/relationships.pyrxÉs ÿrxcCstt tj|¡ddiƒS)aAnnotate a portion of a primaryjoin expression
    with a 'foreign' annotation.
 
    See the section :ref:`relationship_custom_foreign` for a
    description of use.
 
    .. seealso::
 
        :ref:`relationship_custom_foreign`
 
        :func:`.remote`
 
    ÚforeignTryr}r~r~rr€Üs ÿr€c@sLeZdZUdZdZded<ded<ded<d    d
œd d „Zd ddœdd„ZdS)Ú_RelationshipArgztstores a user-defined parameter value that must be resolved and
    parsed later at mapper configuration time.
 
    )ÚnameÚargumentÚresolvedÚstrr‚rjrƒz Optional[_T2]r„Úbool©rwcCs
|jdk    S©N)rƒ©Úselfr~r~rÚ _is_populatedüsz_RelationshipArg._is_populatedú&Callable[[str, bool], _class_resolver]ÚNone)Úclsregistry_resolverrwcCsJ|j}t|tƒr&|||jdkƒƒ|_n t|ƒr@t|ƒs@|ƒ|_n||_dS)NÚ    secondary)rƒÚ
isinstancer…r‚r„Úcallabler)rŠrŽÚ
attr_valuer~r~rÚ_resolve_against_registryÿs
ÿ
 
z*_RelationshipArg._resolve_against_registryN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú    __slots__Ú__annotations__r‹r“r~r~r~rrðs
rc@sBeZdZUdZded<ded<ded<ded<d    ed
<d    ed <d S) Ú_RelationshipArgszWstores user-passed parameters that are resolved at mapper configuration
    time.
 
    zP_RelationshipArg[Optional[_RelationshipSecondaryArgument], Optional[FromClause]]rz\_RelationshipArg[Optional[_RelationshipJoinConditionArgument], Optional[ColumnElement[Any]]]Ú primaryjoinÚ secondaryjoinzd_RelationshipArg[_ORMOrderByArgument, Union[Literal[(None, False)], Tuple[ColumnElement[Any], ...]]]Úorder_byzN_RelationshipArg[Optional[_ORMColCollectionArgument], Set[ColumnElement[Any]]]Ú foreign_keysÚ remote_sideN)r”r•r–r—r™r~r~r~rršs
ršc'sTeZdZUdZejZdZdZdZ    de
d<de
d<e ddddddZ d    Z d
e
d <d e
d <de
d<de
d<de
d<de
d<de
d<de
d<de
d<de
d<de
d<de
d<de
d<d e
d!<d"e
d#<dÁd    d    d    d    d    dd    d    dd$dd    d%ddddd    d    d    d    ddd    dd    d    d    d    d    ddd    dd&œ"d'd(d)d*d+d+d,d-d.d,d/d0d/d1d2d3d/d/d/d4d4d5d6d/d/d)d/d7d8d9d)d,d:d;dd/d<œ$‡fd=d>„Zd?d@dAœdBdC„ZdDd@dEœdFdG„ZGdHdI„dIejeeƒZdÂdJd/dKd dLœdMdN„ZdÃd?d/dOd/d dPœdQdR„ZdDdSdTdUdVdWœdXdY„ZdÄd/dOd dZœd[d\„Zd0d]œd^d_„Zd`dSdTdSdTd/dadbd@dcœ    ddde„ZejfdfdTd0dgdhdiœdjdk„ZdÅd0dSdTdldmdndoœdpdq„Ze d/d]œdrds„ƒZ!e"dtdtd@duœdvdw„ƒZ#d0d@dxœdydz„Z$ej%d{d]œd|d}„ƒZ&ej%d~d]œdd€„ƒZ'd@d]œ‡fdd‚„ Z(d@d]œdƒd„„Z)d@d]œd…d†„Z*d‡dˆd‰d,d0dŠd‹d‹d/d@dŒœ
ddŽ„Z+e ,d¡dÆd?d@dœd‘d’„ƒZ-d@d]œd“d”„Z.e d•d]œd–d—„ƒZ/e d˜d]œd™dš„ƒZ0ej%e ,d›¡dœd]œddž„ƒƒZ1d@d]œdŸd „Z2e d¡d]œd¢d£„ƒZ3e3j4d¤d@d¥œd¦d£„ƒZ3d¤d@d§œd¨d©„Z5d¡d@d¥œdªd«„Z6dDd/dEœd¬d­„Z7dUd/d®œd¯d°„Z8d@d]œd±d²„Z9e ,d³¡d@d]œd´dµ„ƒZ:ej%d/d]œd¶d·„ƒZ;ej%d/d]œd¸d¹„ƒZ<dÇd/ddd»d/d¼d½d¾œd¿dÀ„Z=‡Z>S)ÈÚRelationshipPropertyzÿDescribes an object property that holds a single item or list
    of items that correspond to a related database table.
 
    Public constructor is the :func:`_orm.relationship` function.
 
    .. seealso::
 
        :ref:`relationship_config_toplevel`
 
    Tz Sequence[str]Ú    _overlapsrZÚ_lazy_strategyF©Úpassive_deletesÚpassive_updatesÚenable_typechecksÚactive_historyÚcascade_backrefsNzOptional[DependencyProcessor]Ú_dependency_processorúColumnElement[bool]r›úOptional[ColumnElement[bool]]rœúOptional[FromClause]rÚ JoinConditionÚ_join_conditionz5Union[Literal[False], Tuple[ColumnElement[Any], ...]]rúSet[ColumnElement[Any]]Ú_user_defined_foreign_keysÚ_calculated_foreign_keysrŸÚ local_columnsÚ _ColumnPairsÚsynchronize_pairsúOptional[_ColumnPairs]Úsecondary_synchronize_pairsÚlocal_remote_pairsr)Ú    directionršÚ
_init_argszsave-update, mergero)"ÚuselistÚcollection_classr›rœÚback_populatesrÚbackrefÚoverlapsÚ post_updateÚcascadeÚviewonlyÚattribute_optionsÚlazyr¤r¥r§r¦ržrŸÚ
join_depthÚcomparator_factoryÚ single_parentÚ    innerjoinÚdistinct_target_keyÚload_on_pendingÚ query_classÚinfoÚ    omit_joinÚ sync_backrefÚdocÚ bake_queriesr¨Ú_local_remote_pairsÚ_legacy_inactive_history_stylez'Optional[_RelationshipArgumentType[_T]]z(Optional[_RelationshipSecondaryArgument]zOptional[bool]zEOptional[Union[Type[Collection[Any]], Callable[[], Collection[Any]]]]z,Optional[_RelationshipJoinConditionArgument]z Optional[str]Ú_ORMOrderByArgumentzOptional[ORMBackrefArgument]r†r…zOptional[_AttributeOptions]Ú_LazyLoadArgumentTypezUnion[Literal['all'], bool]z#Optional[_ORMColCollectionArgument]z Optional[int]z4Optional[Type[RelationshipProperty.Comparator[Any]]]zOptional[Type[Query[Any]]]zOptional[_InfoType]zLiteral[(None, False)]z Literal[True]zLiteral[False])$rƒrrºr»r›rœr¼rr½r¾r¿rÀrÁrÂrÃr¤r¥r§r¦ržrŸrÄrÅrÆrÇrÈrÉrÊrËrÌrÍrÎrÏr¨rÐrÑc"%
s²tƒj|d||_||_ttd|dƒtd|dƒtd|dƒtd|dƒtd|dƒtd|dƒƒ|_| |_| |_| r‚|j    |||||"d| r”|r”t
  d    ¡‚||_ ||_ ||_||_||_|"rÀt
  d
¡‚||_||_||_||_||_| |_||_|$|_||_|rt d ¡||_|#|_||_|p"tj |_!t "|¡|dk    rF|j# $|¡d |j ff|_%t&ƒ|_'|
rvt&t( )d |
¡ƒ|_*nd|_*| |_+||_,|j,r¨|    r t
  d¡‚d|_-n|    |_-dS)N)rÂrr›rœrržrŸr£z-sync_backref and viewonly cannot both be TruezSThe 'cascade_backrefs' parameter passed to relationship() may only be set to False.zæsetting omit_join to True is not supported; selectin loading of this relationship may not work correctly if this flag is set explicitly.  omit_join optimization is automatically detected for conditions under which it is supported.rÃz\s*,\s*r~zCbackref and back_populates keyword arguments are mutually exclusive).ÚsuperÚ__init__rºrƒršrr¹r¿rÁÚ _warn_for_persistence_only_flagsÚsa_excÚ ArgumentErrorrÍrÃrÆr»r¤r¥r¦rÊrÇrÈrÎr§rÑrÄr4ÚwarnrÌr·rÉr Ú
ComparatorrÅZset_creation_orderrËÚupdateÚ strategy_keyÚsetÚ_reverse_propertyÚreÚsplitr¡rÀr¼r½)%rŠrƒrrºr»r›rœr¼rr½r¾r¿rÀrÁrÂrÃr¤r¥r§r¦ržrŸrÄrÅrÆrÇrÈrÉrÊrËrÌrÍrÎrÏr¨rÐrѩڠ   __class__r~rrÕesŠ,
 
 
 
 
 
ú    ûÿÿÿ
ÿ
 
 ÿzRelationshipProperty.__init__rr)ÚkwrwcKs4| ¡D]&\}}||j|krt d|f¡qdS)NzÖSetting %s on relationship() while also setting viewonly=True does not make sense, as a viewonly=True relationship does not perform persistence operations. This configuration may raise an error in a future release.)ÚitemsÚ_persistence_onlyr4rÙ)rŠrãÚkÚvr~r~rrÖïsüÿz5RelationshipProperty._warn_for_persistence_only_flagsz Mapper[Any])ÚmapperrwcCs&tj|j|j| ||¡||jddS)N)Z
comparatorÚ parententityrÎ)rZregister_descriptorÚclass_ÚkeyrÅrΩrŠrèr~r~rÚinstrument_classs
ûz%RelationshipProperty.instrument_classc@sVeZdZUdZdZded<ded<dHd    d
d dd d œdd„Zdddœdd„Zded<ded<ddœdd„Zddœdd„Z    ddœdd „Z
d!dœd"d#„Z d$d%d&œd'd(„Z d)d*d+œd,d-„Z d.d/d0œd1d2„ZdZd.d!d0œd3d4„ZdId5d.d6d7œd8d9„ZdJd5d.d!d7œd:d;„ZdKd5d.d!d7œd<d=„Zd>d.d!d?œd@dA„Zd.d!d0œdBdC„Zd.d!d0œdDdE„Zd    dœdFdG„ZdS)LzRelationshipProperty.ComparatoraØProduce boolean, comparison, and other operators for
        :class:`.RelationshipProperty` attributes.
 
        See the documentation for :class:`.PropComparator` for a brief
        overview of ORM level operator definition.
 
        .. seealso::
 
            :class:`.PropComparator`
 
            :class:`.ColumnProperty.Comparator`
 
            :class:`.ColumnOperators`
 
            :ref:`types_operators`
 
            :attr:`.TypeEngine.comparator_factory`
 
        )ÚentityrèÚpropertyÚ_of_typeÚ_extra_criteriaz0RODescriptorReference[RelationshipProperty[_PT]]ÚpropzOptional[_EntityType[_PT]]rðNr~zRelationshipProperty[_PT]z_InternalEntityType[Any]zOptional[AliasedInsp[Any]]úTuple[ColumnElement[bool], ...])ròÚ parentmapperÚadapt_to_entityÚof_typeÚextra_criteriacCs.||_||_||_|r||_nd|_||_dS)zConstruction of :class:`.RelationshipProperty.Comparator`
            is internal to the ORM's attribute mechanics.
 
            N)ròÚ _parententityÚ_adapt_to_entityrðrñ)rŠròrôrõrör÷r~r~rrÕ*s z(RelationshipProperty.Comparator.__init__zAliasedInsp[Any]z$RelationshipProperty.Comparator[Any])rõrwcCs|j|j|j||jdS)N)rõrö)râròrørð)rŠrõr~r~rrõ?s üz/RelationshipProperty.Comparator.adapt_to_entityz_InternalEntityType[_PT]rîz Mapper[_PT]rèr‡cCs|jrt|jƒS|jjSdSrˆ)rðr5ròrîr‰r~r~rÚ_memoized_attr_entity^s
z5RelationshipProperty.Comparator._memoized_attr_entitycCs|jjSrˆ©rîrèr‰r~r~rÚ_memoized_attr_mapperdsz5RelationshipProperty.Comparator._memoized_attr_mapperrecCs|jr|jjS|jjjSdSrˆ)rùÚ
selectablerïÚparentÚ_with_polymorphic_selectabler‰r~r~rÚ_source_selectablegsz2RelationshipProperty.Comparator._source_selectablerªc    CsZ| ¡}|jrt|jƒ}nd}|jj|d|d|jd\}}}}}}|dk    rR||@S|SdS)NT)Úsource_selectableÚsource_polymorphicÚof_type_entityÚalias_secondaryr÷)rrðr5ròÚ _create_joinsrñ)    rŠZ
adapt_fromrÚpjÚsjÚsourceÚdestrÚtarget_adapterr~r~rÚ__clause_element__ms*     ûùz2RelationshipProperty.Comparator.__clause_element__z_EntityType[Any]zPropComparator[_PT])rêrwcCstj|j|j|j||jdS)zˆRedefine this object in terms of a polymorphic subclass.
 
            See :meth:`.PropComparator.of_type` for an example.
 
 
            ©rõrör÷)r rÚròrørùrñ)rŠrêr~r~rrö‡sûz'RelationshipProperty.Comparator.of_typez_ColumnExpressionArgument[bool]zPropComparator[Any])ÚcriteriarwcGs:tdd„t |¡Dƒƒ}tj|j|j|j|j|j    |dS)z€Add AND criteria.
 
            See :meth:`.PropComparator.and_` for an example.
 
            .. versionadded:: 1.4
 
            css|]}t tj|¡VqdSrˆ)r6r{r9ÚWhereHavingRole)Ú.0Úclauser~r~rÚ    <genexpr> sÿz7RelationshipProperty.Comparator.and_.<locals>.<genexpr>r )
Útupler4Zcoerce_generator_argr rÚròrørùrðrñ)rŠr Úexprsr~r~rÚand_–s
þûz$RelationshipProperty.Comparator.and_rr)ÚotherrwcCs tdƒ‚dS)z…Produce an IN clause - this is not implemented
            for :func:`_orm.relationship`-based attributes at this time.
 
            zvin_() not yet supported for relationships.  For a simple many-to-one, use in_() against the set of foreign key values.N)ÚNotImplementedError©rŠrr~r~rÚin_­sÿz#RelationshipProperty.Comparator.in_cCst|dkst|tjƒrF|jjttfkr.| ¡St|jj    d|j
dƒSn*|jj rZt   d¡‚nt|jj    ||j
dƒSdS)aImplement the ``==`` operator.
 
            In a many-to-one context, such as::
 
              MyClass.some_prop == <some object>
 
            this will typically produce a
            clause such as::
 
              mytable.related_id == <some id>
 
            Where ``<some id>`` is the primary key of the given
            object.
 
            The ``==`` operator provides partial functionality for non-
            many-to-one comparisons:
 
            * Comparisons against collections are not supported.
              Use :meth:`~.Relationship.Comparator.contains`.
            * Compared to a scalar one-to-many, will produce a
              clause that compares the target columns in the parent to
              the given target.
            * Compared to a scalar many-to-many, an alias
              of the association table will be rendered as
              well, forming a natural join that is part of the
              main body of the query. This will not work for
              queries that go beyond simple AND conjunctions of
              comparisons, such as those which use OR. Use
              explicit joins, outerjoins, or
              :meth:`~.Relationship.Comparator.has` for
              more comprehensive non-many-to-one scalar
              membership tests.
            * Comparisons against ``None`` given in a one-to-many
              or many-to-many context produce a NOT EXISTS clause.
 
            N©Ú adapt_sourceú]Can't compare a collection to an object or collection; use contains() to test for membership.)rr7ÚNullrïr¸r'r%Ú_criterion_existsr+Ú_optimized_compareÚadapterrºr×ÚInvalidRequestErrorrr~r~rÚ__eq__¼s&%
ÿÿÿÿÿz&RelationshipProperty.Comparator.__eq__z)Optional[_ColumnExpressionArgument[bool]]r0)Ú    criterionÚkwargsrwcKs¸|dk    rt tj|¡nd}t|ddƒrŒt|jƒ}|dk    s<t‚|j|j    |j
}}}|j j rf|sf|  ¡}|j}|dk    r”|dk    r†||@}q”|}nd}d}|jr¤| ¡}    nd}    |j j||    d\}
} } } }}|D]2}t|j jj|ƒ||k}|dkrò|}qÈ||@}qÈ| dk    rt|
ƒ| @}nt|
|j jd}|dk    rD|rD|sD| |¡}|dk    r\| ddi¡}|tj |¡@}|dk    r˜t d¡ |¡ | |¡ | |¡}nt d¡ |¡ | ¡ | ¡}|S)NrðF)Údest_selectabler)ÚexcludeÚno_replacement_traverseTr)r6r{r9rÚgetattrr5rðÚAssertionErrorrèrýÚis_aliased_classrïÚ_is_self_referentialÚ_anonymous_fromclauseÚ_single_table_criterionrrrrêr+rŸÚtraverseÚ    _annotater3ZTrue_Z_ifnoneÚexistsÚwhereÚ select_fromZcorrelate_except)rŠr"r#Zwhere_criteriarËZ target_mapperZ to_selectabler)Ú single_critrrrrr    rr
ræÚcritÚjÚexr~r~rrös˜ÿý ÿ ý
 
 
    þù
 
ÿþý
 
ÿ
 
ÿþýÿ
ÿþýÿz1RelationshipProperty.Comparator._criterion_existscKs |jjst d¡‚|j|f|ŽS)aSProduce an expression that tests a collection against
            particular criterion, using EXISTS.
 
            An expression like::
 
                session.query(MyClass).filter(
                    MyClass.somereference.any(SomeRelated.x==2)
                )
 
 
            Will produce a query like::
 
                SELECT * FROM my_table WHERE
                EXISTS (SELECT 1 FROM related WHERE related.my_id=my_table.id
                AND related.x=2)
 
            Because :meth:`~.Relationship.Comparator.any` uses
            a correlated subquery, its performance is not nearly as
            good when compared against large target tables as that of
            using a join.
 
            :meth:`~.Relationship.Comparator.any` is particularly
            useful for testing for empty collections::
 
                session.query(MyClass).filter(
                    ~MyClass.somereference.any()
                )
 
            will produce::
 
                SELECT * FROM my_table WHERE
                NOT (EXISTS (SELECT 1 FROM related WHERE
                related.my_id=my_table.id))
 
            :meth:`~.Relationship.Comparator.any` is only
            valid for collections, i.e. a :func:`_orm.relationship`
            that has ``uselist=True``.  For scalar references,
            use :meth:`~.Relationship.Comparator.has`.
 
            z9'any()' not implemented for scalar attributes. Use has().©rïrºr×r r©rŠr"r#r~r~rÚany]s
-ÿz#RelationshipProperty.Comparator.anycKs |jjrt d¡‚|j|f|ŽS)aÎProduce an expression that tests a scalar reference against
            particular criterion, using EXISTS.
 
            An expression like::
 
                session.query(MyClass).filter(
                    MyClass.somereference.has(SomeRelated.x==2)
                )
 
 
            Will produce a query like::
 
                SELECT * FROM my_table WHERE
                EXISTS (SELECT 1 FROM related WHERE
                related.id==my_table.related_id AND related.x=2)
 
            Because :meth:`~.Relationship.Comparator.has` uses
            a correlated subquery, its performance is not nearly as
            good when compared against large target tables as that of
            using a join.
 
            :meth:`~.Relationship.Comparator.has` is only
            valid for scalar references, i.e. a :func:`_orm.relationship`
            that has ``uselist=False``.  For collection references,
            use :meth:`~.Relationship.Comparator.any`.
 
            z4'has()' not implemented for collections.  Use any().r6r7r~r~rÚhas’s
 ÿz#RelationshipProperty.Comparator.hasz_ColumnExpressionArgument[Any])rr#rwcKs@|jjst d¡‚|jj||jd}|jjdk    r<| |¡|_|S)a­    Return a simple expression that tests a collection for
            containment of a particular item.
 
            :meth:`~.Relationship.Comparator.contains` is
            only valid for a collection, i.e. a
            :func:`_orm.relationship` that implements
            one-to-many or many-to-many with ``uselist=True``.
 
            When used in a simple one-to-many context, an
            expression like::
 
                MyClass.contains(other)
 
            Produces a clause like::
 
                mytable.id == <some id>
 
            Where ``<some id>`` is the value of the foreign key
            attribute on ``other`` which refers to the primary
            key of its parent object. From this it follows that
            :meth:`~.Relationship.Comparator.contains` is
            very useful when used with simple one-to-many
            operations.
 
            For many-to-many operations, the behavior of
            :meth:`~.Relationship.Comparator.contains`
            has more caveats. The association table will be
            rendered in the statement, producing an "implicit"
            join, that is, includes multiple tables in the FROM
            clause which are equated in the WHERE clause::
 
                query(MyClass).filter(MyClass.contains(other))
 
            Produces a query like::
 
                SELECT * FROM my_table, my_association_table AS
                my_association_table_1 WHERE
                my_table.id = my_association_table_1.parent_id
                AND my_association_table_1.child_id = <some id>
 
            Where ``<some id>`` would be the primary key of
            ``other``. From the above, it is clear that
            :meth:`~.Relationship.Comparator.contains`
            will **not** work with many-to-many collections when
            used in queries that move beyond simple AND
            conjunctions, such as multiple
            :meth:`~.Relationship.Comparator.contains`
            expressions joined by OR. In such cases subqueries or
            explicit "outer joins" will need to be used instead.
            See :meth:`~.Relationship.Comparator.any` for
            a less-performant alternative using EXISTS, or refer
            to :meth:`_query.Query.outerjoin`
            as well as :ref:`orm_queryguide_joins`
            for more details on constructing outer joins.
 
            kwargs may be ignored by this operator but are required for API
            conformance.
            z9'contains' not implemented for scalar attributes.  Use ==rN)    ròrºr×r rrrœÚ'_Comparator__negated_contains_or_equalsZnegation_clause)rŠrr#rr~r~rÚcontains¸s=ÿÿ ÿz(RelationshipProperty.Comparator.containscs ˆjjtkrjt |¡‰dddddœ‡fdd„ ‰dddœ‡fd    d
„ ‰ˆjjrjtj‡‡‡fd d „ˆjj    DƒŽStjd d „t
ˆjj j ˆjj   |¡ƒDƒŽ}ˆ |¡S)NruúInstanceState[Any]úBindParameter[Any])Ú    local_colÚstateÚ
remote_colrwc
s.|j}tj|j|jdˆj ˆjj|||¡dS)NT)Útype_ÚuniqueZ    callable_)Údictr3Ú    bindparamrëÚtyperòÚ_get_attr_w_warn_on_nonerè)r>r?r@Údict_r‰r~rÚstate_bindparam sÿüzURelationshipProperty.Comparator.__negated_contains_or_equals.<locals>.state_bindparamrt)Úcolrwcsˆjrˆ |¡S|SdSrˆ)r©rIr‰r~rÚadapts
zKRelationshipProperty.Comparator.__negated_contains_or_equals.<locals>.adaptc    s8g|]0\}}t ˆ|ƒˆˆ|ƒˆ|ƒkˆ|ƒdk¡‘qSrˆ)r3Úor_©rÚxÚy)rKr?rHr~rÚ
<listcomp>#sûÿ
ýzPRelationshipProperty.Comparator.__negated_contains_or_equals.<locals>.<listcomp>cSsg|]\}}||k‘qSr~r~rMr~r~rrP.sÿ)ròr¸r&rÚinstance_staterïÚ_use_getr3rr·ÚziprèZ primary_keyZprimary_key_from_instancer)rŠrr"r~)rKrŠr?rHrZ__negated_contains_or_equalss& 
úÿ  þþÿ
z<RelationshipProperty.Comparator.__negated_contains_or_equalscCsh|dkst|tjƒrB|jjtkr8t|jjd|jdƒS|     ¡Sn"|jj
rVt   d¡‚nt|  |¡ƒSdS)aImplement the ``!=`` operator.
 
            In a many-to-one context, such as::
 
              MyClass.some_prop != <some object>
 
            This will typically produce a clause such as::
 
              mytable.related_id != <some id>
 
            Where ``<some id>`` is the primary key of the
            given object.
 
            The ``!=`` operator provides partial functionality for non-
            many-to-one comparisons:
 
            * Comparisons against collections are not supported.
              Use
              :meth:`~.Relationship.Comparator.contains`
              in conjunction with :func:`_expression.not_`.
            * Compared to a scalar one-to-many, will produce a
              clause that compares the target columns in the parent to
              the given target.
            * Compared to a scalar many-to-many, an alias
              of the association table will be rendered as
              well, forming a natural join that is part of the
              main body of the query. This will not work for
              queries that go beyond simple AND conjunctions of
              comparisons, such as those which use OR. Use
              explicit joins, outerjoins, or
              :meth:`~.Relationship.Comparator.has` in
              conjunction with :func:`_expression.not_` for
              more comprehensive non-many-to-one scalar
              membership tests.
            * Comparisons against ``None`` given in a one-to-many
              or many-to-many context produce an EXISTS clause.
 
            Nrr)rr7rrïr¸r&r+rrrrºr×r r:rr~r~rÚ__ne__9s' ÿÿ
ÿz&RelationshipProperty.Comparator.__ne__cCs|jj ¡|jSrˆ)ròrþÚ_check_configurer‰r~r~rÚ_memoized_attr_propertyss z7RelationshipProperty.Comparator._memoized_attr_property)NNr~)N)N)N)r”r•r–r—r˜r™rÕrõrúrürr rörrÚ__hash__r!rr8r9r;r:rTrVr~r~r~rrÚ
s<
ú
      <þiþ7þ&N3:rÚÚobjectzOptional[_EntityType[Any]])ÚinstancerÚ from_entityrwcCsN|dk    s t‚d}|dk    r<t|ƒ}|dk    s,t‚t|ƒr<|jj}|j|d||dS)NT)Úvalue_is_parentrr)r(r5rZ_adapterZ adapt_clauser)rŠrYrrZrZinspr~r~rÚ _with_parentws  üz!RelationshipProperty._with_parentzOptional[_CoreAdapterProto])r?r[rrrwcsˆdk    rRz tˆƒ‰Wntjk
r.d‰YnXˆdksDtˆddƒsRt dˆ¡‚| }ˆdkrnˆj||dS|s†ˆjjˆjj}‰nˆjj    ˆjj
}‰|r¤ˆj ‰nˆj ‰t  ˆ ¡¡‰dddœ‡‡‡‡‡fdd    „ }ˆjdk    rö|rötˆj ¡ƒ |¡}t |id
|i¡}|r||ƒ}|S) NZ is_instanceFzÃMapped instance expected for relationship comparison to object.   Classes, queries and other SQL elements are not accepted in this context; for comparison with a subquery, use %s.has(**criteria).rr=r)rDrwcs&|jˆkr"ˆ ˆˆˆˆ|j¡|_dSrˆ)Z_identifying_keyrFr‘)rD©Ú bind_to_colrGrèrŠr?r~rÚvisit_bindparam¹s
üz@RelationshipProperty._optimized_compare.<locals>.visit_bindparamrD)r5r×ÚNoInspectionAvailabler'rØÚ_lazy_none_clauser¢Ú
_lazywhereÚ _bind_to_colÚ_rev_lazywhereÚ_rev_bind_to_colrèrþrÚ instance_dictÚobjrrBr+r-r:Úcloned_traverse)rŠr?r[rrÚreverse_directionr"r_r~r]rr‹sV 
üÿÿþþ    ÿþÿz'RelationshipProperty._optimized_comparer<rMruzCallable[[], Any])rèr?rGÚcolumnrwcs<ˆ ˆ¡‰ˆ ˆj¡ˆj‰ddœ‡‡‡‡‡‡fdd„ }|S)aKCreate the callable that is used in a many-to-one expression.
 
        E.g.::
 
            u1 = s.query(User).get(5)
 
            expr = Address.user == u1
 
        Above, the SQL should be "address.user_id = 5". The callable
        returned by this method produces the value "5" based on the identity
        of ``u1``.
 
        rr‡cs´ˆdk    s t‚ˆˆj}}|tjk    }ˆjˆˆˆˆjr:tjn
tjtj    Ad}|tj
krp|sšt   dˆt ˆƒf¡‚n*|tjkr–|sšt   dˆt ˆƒf¡‚n|}|dkr°t dˆ¡|S)N©ÚpassivezUCan't resolve value for column %s on object %s; no value has been set for this columnz`Can't resolve value for column %s on object %s; the object is detached and the value was expiredz Got None for value of column %s; this is unsupported for a relationship comparison and will not currently produce an IS comparison (but may in a future release))r(rërZNO_VALUEZ_get_state_attr_by_columnÚ
persistentr Ú PASSIVE_OFFZPASSIVE_NO_FETCHZINIT_OKZ    NEVER_SETr×r r!ÚPASSIVE_NO_RESULTr4rÙ)Z
last_knownZ    to_returnZexisting_is_availableZ current_value©rjrGZ    lkv_fixedrèròr?r~rÚ_go    sD ÿÿ
ú    
 
þÿ
 
þÿýÿz:RelationshipProperty._get_attr_w_warn_on_none.<locals>._go)Zget_property_by_columnZ_track_last_known_valuerëZ_last_known_values)rŠrèr?rGrjrqr~rprrFÏs
1
 -z-RelationshipProperty._get_attr_w_warn_on_none)rirrwcCsD|s|jj|jj}}n|jj|jj}}t||ƒ}|r@||ƒ}|Srˆ)r¢rbrcrdrerA)rŠrirr"r^r~r~rra8sþþ
z&RelationshipProperty._lazy_none_clauser‡cCst|jjjƒd|jS)NÚ.)r…rþrêr”rër‰r~r~rÚ__str__NszRelationshipProperty.__str__rXzDict[Any, object]z#Dict[_IdentityKeyType[Any], object])    ÚsessionÚ source_stateÚ source_dictÚ
dest_stateÚ    dest_dictÚloadÚ
_recursiveÚ_resolve_conflict_maprwc    CsÎ|r"|jD]}    ||    f|kr
dSq
d|jkr0dS|j|kr>dS|jrR| |j¡}
t|
ƒs^t‚|
 ||¡} |
jrx| j    r€nds€t‚|rž| |j¡j
||t j dg} | D]J} t  | ¡}t  | ¡}d|||f<|j|||||d}|dk    r¦|  |¡q¦|s t  |||j¡}| D]}| |¡q n0| |j¡}t|ƒs:t‚|j||| dt j dnx||j} | dk    rœt  | ¡}t  | ¡}d|||f<|j|||||d}nd}|s²|||j<n| |j¡ |||d¡dS)NÚmergeTrk)ryrzr{F)Z_adaptrl)rÞÚ_cascaderërºZget_implrr(Úget_collectionÚ
collectionÚemptyÚgetr Z PASSIVE_MERGErrQrfZ_mergeÚappendZinit_state_collectionZappend_without_eventrÝ)rŠrtrurvrwrxryrzr{ÚrÚimplZinstances_iterableZ    dest_listÚcurrentZ current_stateZ current_dictrgZcollÚcZ    dest_implr~r~rr|QsŽ 
 
 
    ÿ
 
 û ÿ û
 
 
 
 û  ÿzRelationshipProperty.mergezInstanceState[_O]r z&Sequence[Tuple[InstanceState[_O], _O]])r?rGrërlrwcCsj|j|j}|j|||d}|tjks.|dkr2gSt|ƒrVdd„|j||||dDƒSt |¡|fgSdS)z”Return a list of tuples (state, obj) for the given
        key.
 
        returns an empty list if the value is None/empty/PASSIVE_NO_RESULT
        rkNcSsg|]}t |¡|f‘qSr~)rrQ)rÚor~r~rrPÅsÿz;RelationshipProperty._value_as_iterable.<locals>.<listcomp>)    Úmanagerr„rrrorr~rrQ)rŠr?rGrërlr„rNr~r~rÚ_value_as_iterable³s þz'RelationshipProperty._value_as_iterablezSet[InstanceState[Any]]z.Optional[Callable[[InstanceState[Any]], bool]]zDIterator[Tuple[Any, Mapper[Any], InstanceState[Any], _InstanceDict]])rAr?rGÚvisited_statesÚhalt_onrwc cs|dks|jrtj}n tjtjB}|dkrB|j|jj ||¡}n|j    |||j|d}|dkofd|j
k}|D]–\}    }
|    |kr~ql|
dkrˆql|    dk    s”t ‚t   |
¡} |r¬||    ƒr¬ql|r¸|    js¸ql|    jj} |  |jjj¡sêt d|j|jj|
jfƒ‚| |    ¡|
| |    | fVqldS)NÚdeletez save-updaterkzrefresh-expireú delete-orphanz@Attribute '%s' on class '%s' doesn't handle objects of type '%s')r¤r ZPASSIVE_NO_INITIALIZErnZNO_RAISErˆrër„Zget_all_pendingr‰r}r(rrfrèZisaZ class_managerrþrêrâÚadd) rŠrAr?rGrŠr‹rlZtuplesZ skip_pendingrQr†rfZinstance_mapperr~r~rÚcascade_iteratorÌsB  ÿÿ  
 
ýÿ
z%RelationshipProperty.cascade_iteratorcCs|jr
dS|jdk    SdS)NF)rÁrÍr‰r~r~rÚ_effective_sync_backref    sz,RelationshipProperty._effective_sync_backrefúRelationshipProperty[Any])Úrel_aÚrel_brwcCs>|jr|jrt d||f¡‚|jr:|js:|jdk    r:d|_dS)NzQRelationship %s cannot specify sync_backref=True since %s includes viewonly=True.F)rÁrÍr×r )r’r“r~r~rÚ_check_sync_backrefs ÿÿÿþýz(RelationshipProperty._check_sync_backref)rërwcCsÄ|jj|dd}t|tƒs,t d||f¡‚| ||¡| ||¡|j |¡|j |¡|     ¡|j 
|j ¡sŠt  d||||j f¡‚|j rÀ|jttfkrÀ|j|jkrÀt  d|||jf¡‚dS)NF)Z_configure_mappersz¶back_populates on relationship '%s' refers to attribute '%s' that is not a relationship.  The back_populates parameter should refer to the name of a relationship on the target class.zereverse_property %r on relationship %s references relationship %s, which does not reference mapper %szv%s and back-reference %s are both of the same direction %r.  Did you mean to set remote_side on the many-to-one side ?)rèZ get_propertyrr r×r r”rÞrŽÚ _setup_entityÚ common_parentrþrØZ_configure_startedr¸r'r&)rŠrërr~r~rÚ_add_reverse_property s:
ýÿ
    ýÿÿ þ
ý
ýÿz*RelationshipProperty._add_reverse_propertyz_InternalEntityType[_T]cCs|j ¡|jS)z€Return the target mapped entity, which is an inspect() of the
        class or aliased class that is referred towards.
 
        )rþrUrîr‰r~r~rrîLs
zRelationshipProperty.entityrncCs|jjS)zcReturn the targeted :class:`_orm.Mapper` for this
        :class:`.RelationshipProperty`.
 
        rûr‰r~r~rrèUszRelationshipProperty.mappercsn| ¡| ¡| ¡| ¡| ¡| |j¡| ¡| ¡|j     
¡t ƒ  ¡t d| d¡ƒ|_dS)NrZ))rÃro)Ú_check_conflictsÚ_process_dependent_argumentsr•Ú_setup_registry_dependenciesÚ_setup_join_conditionsÚ_check_cascade_settingsr}Ú
_post_initÚ_generate_backrefr®Ú"_warn_for_conflicting_sync_targetsrÔÚdo_initrZ _get_strategyr¢r‰rár~rr ]s 
 
ÿzRelationshipProperty.do_initcCs|jjj |jjj¡dSrˆ)rþrèÚregistryZ_set_depends_onrîr‰r~r~rršls
ÿz1RelationshipProperty._setup_registry_dependenciescCs|j}dD]}t||ƒ}| |jd¡q
dD]4}t||ƒ}|j}|dk    r.ttjtj    ||dƒ|_q.|j
j}|dk    rŽt |ƒrŽt   d||f¡‚|jjdk    rÆ|jjdk    rÆtdd    „t |jj¡Dƒƒ|_nd|_t d
d    „t |jj¡Dƒ¡|_t d d    „t |jj¡Dƒ¡|_dS) zŠConvert incoming configuration arguments to their
        proper form.
 
        Callables are resolved, ORM annotations removed.
 
        )rr›rœrržrŸr)r›rœN©Úargnamezåsecondary argument %s passed to to relationship() %s must be a Table object or other FROM clause; can't send a mapped class directly as rows in 'secondary' are persisted independently of a class that is mapped to that same table.Fcss |]}tjtj|ddVqdS)rr¢N©r6r{r9r|©rrNr~r~rr§s ýÿzDRelationshipProperty._process_dependent_arguments.<locals>.<genexpr>css |]}tjtj|ddVqdS)ržr¢Nr¤r¥r~r~rr°s ýÿcss |]}tjtj|ddVqdS)rŸr¢Nr¤r¥r~r~rr·s ýÿ)r¹r'r“Ú_clsregistry_resolversr„r,r6r{r9r|rrr×rØrrr4Zto_listÚ
column_setZ to_column_setržr°rŸ)rŠZ    init_argsÚattrZrel_argÚvalrr~r~rr™qsH     
 
ÿÿüÿ
ÿ
þ ü 
 ü
 
 üz1RelationshipProperty._process_dependent_argumentsrTrPz    Type[Any]zOptional[Type[Mapped[Any]]]zOptional[_AnnotationScanType])
Ú    decl_scanr¡ÚclsÚoriginating_modulerëÚmapped_containerÚ
annotationÚextracted_mapped_annotationÚis_dataclass_fieldrwc
Cs¾|}
|dkr(|jdkr$| ||¡ndS|}
|dk    s8t‚|dk    oHt|tƒ} | rbd|_d|jff|_|dk    ort|tƒ} | rŒd|_d|jff|_t|
ƒ}
t    |
dƒrh|
j
} t | t ƒrêt| t jƒrê|jdkrøt | ¡rât d| ›d¡‚| |_n| sø| sød|_|
jrTt | t ƒr&t| tjƒr&|
jd}n
|
jd    }t    |d
ƒrN|j}t||ƒ}
n|}
nt d |
›d ¡‚n:t    |
d
ƒr¢|
j}
t|
|ƒ}
|jdkr¢| s¢| s¢d|_|jdkrºtd |
ƒ|_dS)NrqrÃrrÚ
__origin__zCollection annotation type z£ cannot be instantiated; please provide an explicit 'collection_class' parameter (e.g. list, set, etc.) to the relationship() function to accompany this annotationFéÿÿÿÿrÚ__forward_arg__zGeneric alias z requires an argumentz_RelationshipArgumentType[_T])rƒZ_raise_for_requiredr(Ú
issubclassr"rÃrÜrrGÚhasattrr±rrErrr»Ú _py_inspectÚ
isabstractr×rØrºÚ__args__ÚtypingÚMappingr³rIr)rŠrªr¡r«r¬rër­r®r¯r°rƒZ is_write_onlyZ
is_dynamicZ
arg_originZtype_argZ str_argumentr~r~rÚdeclarative_scan¾sˆ 
 
ÿ
ÿ  ÿ
 
 
ÿ    ÿ 
 ÿ
ÿ ÿÿþý z%RelationshipProperty.declarative_scanzsqlalchemy.orm.mapper)Ú_RelationshipProperty__argumentrwcCsÞd|jkrdStjj}|r |}n|j}t|tƒrDtd| |¡ƒƒ}n$t    |ƒrdt|t
|j fƒsd|ƒ}n|}t|t
ƒr€t |dd}nJz t |ƒ}Wntjk
r¦d}YnXt|dƒsÊt d|jt
|ƒf¡‚||_|jj|_dS)Nrîz_ExternalEntityType[Any]F©Ú    configurerèzErelationship '%s' expects a class or a mapper argument (received: %s))Ú__dict__r4Ú    preloadedZ
orm_mapperrƒrr…rÚ_clsregistry_resolve_namer‘rErVrr5r×r`rµrØrërîÚpersist_selectableÚtarget)rŠr¼Z    mapperlibrƒZresolved_argumentrîr~r~rr•(s>
 
 
þ
ÿ
 
 
 þÿz"RelationshipProperty._setup_entitycCsºt|jj|jj|jj|jj|jjj|jjj|jj    j|jj
|j j
|j |j |j|j||j |jd|_}|j|_|j    |_    |j|_|j|_|j |_ |j|_|j|_|j|_|j|_|j|_dS)N©Úparent_persist_selectableÚchild_persist_selectableÚparent_local_selectableÚchild_local_selectabler›rrœÚparent_equivalentsÚchild_equivalentsÚconsider_as_foreign_keysr·rŸÚself_referentialròÚ support_syncÚcan_be_synced_fn)r­rþrÂrîÚ local_tabler¹r›r„rrœZ_equivalent_columnsrèr°r·rŸr*rÁÚ_columns_are_mappedr®r¸Úremote_columnsr²r´Úforeign_key_columnsr±r¶)rŠZjcr~r~rr›Xs8ð z+RelationshipProperty._setup_join_conditionsrŒcCs
|jdS)Nr©r¦r‰r~r~rÚ_clsregistry_resolve_argvsz-RelationshipProperty._clsregistry_resolve_argz>Callable[[str], Callable[[], Union[Type[Any], Table, _ModNS]]]cCs
|jdS)NrrÓr‰r~r~rrÁ|sz.RelationshipProperty._clsregistry_resolve_namezsqlalchemy.orm.clsregistryzmTuple[Callable[[str], Callable[[], Union[Type[Any], Table, _ModNS]]], Callable[[str, bool], _class_resolver]]cCstjjj}||jj|ƒSrˆ)r4rÀZorm_clsregistryÚ    _resolverrþrê)rŠrÕr~r~rr¦‚s
z+RelationshipProperty._clsregistry_resolverscCsF|jjrBt|jjdd |j¡sBt d|j|jjj|jjjf¡‚dS)zOTest that this relationship is legal, warn about
        inheritance conflicts.Fr½zÂAttempting to assign a new relationship '%s' to a non-primary mapper on class '%s'.  New relationships can only be added to the primary mapper, i.e. the very first mapper created for class '%s' N)    rþÚ non_primaryrrêÚ has_propertyrër×rØr”r‰r~r~rr˜Žs
ÿþýûÿz%RelationshipProperty._check_conflictsr-cCs|jS)z\Return the current cascade setting for this
        :class:`.RelationshipProperty`.
        )r}r‰r~r~rrÀ¡szRelationshipProperty.cascadezUnion[str, CascadeOptions])rÀrwcCs| |¡dSrˆ)Ú _set_cascade©rŠrÀr~r~rrÀ¨s)Ú cascade_argrwcCsJt|ƒ}|jrt| tj¡ƒ}d|jkr2| |¡||_|jrF||j_dS)Nrè)    r-rÁÚ intersectionZ_viewonly_cascadesr¿rœr}r©rÀ)rŠrÚrÀr~r~rrجs
ÿ
 
z!RelationshipProperty._set_cascadecCs¤|jrV|jsV|jtks |jtkrVtjd||jtkr6dnd|jjj    |j
jj    dœdd‚|j dkr~d|kspd    |kr~t d
|¡‚|jr |j
  ¡j  |j|jjf¡dS) NaíFor %(direction)s relationship %(rel)s, delete-orphan cascade is normally configured only on the "one" side of a one-to-many relationship, and not on the "many" side of a many-to-one or many-to-many relationship.  To force this relationship to allow a particular "%(relatedcls)s" object to be referred towards by only a single "%(clsname)s" object at a time via the %(rel)s relationship, which would allow delete-orphan cascade to take place in this direction, set the single_parent=True flag.z many-to-onez many-to-many)Úrelr¸ZclsnameZ
relatedclsZbbf0©ÚcodeÚallrŒrz^On %s, can't set passive_deletes='all' in conjunction with 'delete' or 'delete-orphan' cascade)Z delete_orphanrÆr¸r%r&r×rØrþrêr”rèr¤Úprimary_mapperZ_delete_orphansr‚rërÙr~r~rrœ»sDÿþýýÿúóê
ÿÿÿÿ  ÿz,RelationshipProperty._check_cascade_settingscCs|j|jko|j|j|kS)zaReturn True if this property will persist values on behalf
        of the given mapper.
 
        )rëZ relationshipsrìr~r~rÚ _persists_forçs þz"RelationshipProperty._persists_for)ÚcolsrwcGsR|jjj}|D]>}|dk    r(|j |¡r(q|jjj |¡s|jj |¡sdSqdS)zReturn True if all columns in the given collection are
        mapped by the tables referenced by this :class:`.RelationshipProperty`.
 
        NFT)r¹rr„r†Úcontains_columnrþrÂrÃ)rŠrârr†r~r~rrÐòs
 
ÿ þz(RelationshipProperty._columns_are_mappedc CsŠ|jjr dS|jdk    rr|jsrt|jtƒr:|ji}}n
|j\}}|j ¡}|js–t    | 
¡ƒ  |j ¡}|D](}|  |¡rl|jslt d|||f¡‚ql|jdk    rÂ| d|jj¡}| d|jj¡}n*| d|jj¡}| dd¡}|rìt d¡‚| d|j¡}|j ¡}    | d|j¡| d|j¡| d    |j¡| d
|j¡||_t|    |jf||||jd œ|—Ž}
|j||
d d |jr†|  |j¡dS)zlInterpret the 'backref' instruction to create a
        :func:`_orm.relationship` complementary to this one.Nz]Error creating backref '%s' on relationship '%s': property of that name exists on mapper '%s'r›rœzOCan't assign 'secondaryjoin' on a backref against a non-secondary relationship.ržrÁr¿r¥rÍ)r›rœržr¼T)Zwarn_for_existing)!rþrÖr½r¼rr…rèràZconcreterÝZiterate_to_rootÚunionZself_and_descendantsr×r×rØrÚpopr®Úsecondaryjoin_minus_localÚprimaryjoin_minus_localÚprimaryjoin_reverse_remoter r°Ú
setdefaultrÁr¿r¥rÍr rëZ_configure_propertyr—) rŠZ backref_keyr#rèÚcheckÚmrrržrþZ relationshipr~r~rržs€ 
 
 ÿýÿ
þþþ ÿÿ
þúù    ÿz&RelationshipProperty._generate_backrefzsqlalchemy.orm.dependencycCs6tjj}|jdkr|jtk    |_|js2|j |¡|_    dSrˆ)
r4rÀZorm_dependencyrºr¸r&rÁrUZfrom_relationshipr©)rŠÚ
dependencyr~r~rrRs
 ÿþzRelationshipProperty._post_initcCs |j}|jS)zPmemoize the 'use_get' attribute of this RelationshipLoader's
        lazyloader.)r¢Zuse_get)rŠZstrategyr~r~rrR]szRelationshipProperty._use_getcCs|j |j¡Srˆ)rèr–rþr‰r~r~rr*esz)RelationshipProperty._is_self_referentialr~z"Optional[_InternalEntityType[Any]]róz€Tuple[ColumnElement[bool], Optional[ColumnElement[bool]], FromClause, FromClause, Optional[FromClause], Optional[ClauseAdapter]])rrr$rrr÷rwcCsd}|r|jdk    rd}|dkr2|r2|jjr2|jj}|rP|j}|dkrV|j}d}n|j}|dkrŽ|jj}|jjrrd}|jr¦|dkr¦| ¡}d}n||jjk    s¢|jjr¦d}|j    }    |pÈ|dk    oÈ||jjk    pÈ|j
}|j   ||||    |¡\}
} } } }|dkrø|jj }|dkr
|jj }|
| ||| | fS)NFT)rrþZwith_polymorphicrÿrèrýrîr*r+r,Z _is_subqueryr®Ú join_targetsrÏ)rŠrrr$rrr÷ÚaliasedZ dest_mapperr2r›rœrr
r~r~rrisp 
ÿþÿûûú
úz"RelationshipProperty._create_joins)NN)TN)FNT)FN)N)N)FNNNFr~)?r”r•r–r—rZ_RELATIONSHIP_TOKENZstrategy_wildcard_keyÚ inherit_cacheZ_links_to_entityZ_is_relationshipr™rCrår©rÕrÖrír4Z MemoizedSlotsr(rlrÚr\rrFrarsr|r rnr‰rrïrÚ staticmethodr”r—Úmemoized_propertyrîrèr ršr™r»Zpreload_moduler•r›rÔrÁr¦r˜rÀÚsetterrØrœrárÐržrrRr*rÚ __classcell__r~r~rárr ,s
 û ýÖ\     tüûDkýgûú=,M j/
, P
ùr r`)Úelementrrwcs.dddœ‡‡fdd„ ‰|dk    r&ˆ|ƒ}d‰|S)Nrt)Úelemrwcs*t|tjƒr| ˆ ¡¡}|jˆd|S)N)Úclone)rr7r=r.ÚcopyZ_copy_internals)rõ©rrör~rrö¿s  z _annotate_columns.<locals>.cloner~)rôrr~rørrz¾s
rzc@seZdZUded<ded<ded<ded<ded    <d
ed <d
ed <d ed<ded<ded<ded<ded<ded<dddddddddddd„dœ ddddddddddddddddd œd!d"„Zd#d$œd%d&„Zd#d$œd'd(„Zd#d$œd)d*„Zedd$œd+d,„ƒZ    edd$œd-d.„ƒZ
e j dd$œd/d0„ƒZ d1d2dd3œd4d5„Ze j dd$œd6d7„ƒZe j dd$œd8d9„ƒZd#d$œd:d;„Zd#d$œd<d=„Zd#d$œd>d?„Zdd$œd@dA„Zdd$œdBdC„Zd#d$œdDdE„Zd#d$œdFdG„ZdHdd#dIœdJdK„Zd#d$œdLdM„Zd#d$œdNdO„Zd#d$œdPdQ„Zd#d$œdRdS„Zd#d$œdTdU„Zd#d$œdVdW„Zd#d$œdXdY„Zddd#dZœd[d\„Z d#d$œd]d^„Z!d_d`daœdbdc„Z"d#d$œddde„Z#e$ %¡Z&dfedg<d#d$œdhdi„Z'e j djd$œdkdl„ƒZ(e j djd$œdmdn„ƒZ)e j djd$œdodp„ƒZ*d2djdqœdrds„Z+dtdudjd3œdvdw„Z,d‚dddddydzd{œd|d}„Z-dƒdd~dœd€d„Z.dS)„r­r«Úprimaryjoin_initialrªr›rœr¬rr‘ròr³r´r¶r)r¸rerÅrÆrÇrÈrµrÐNFTcGsdS©NTr~)r†r~r~rÚ<lambda>ðózJoinCondition.<lambda>) r›rrœrÉrÊrËr·rŸrÌrÍrÎzOptional[_EquivalentColumnMap]rr†zCallable[..., bool]rÄc Csè||_||_||_||_||_|    |_||_||_||_|
|_    | |_
| |_ ||_ | |_ ||_||_| ¡|jdk    svt‚| ¡| ¡| ¡| ¡| ¡| ¡| |jd¡|jdk    rÌ| |jd¡| ¡| ¡| ¡dS©NTF)rÅrÇrÆrÈrÉrÊrùrœrrËrÐÚ _remote_sideròrÌrÍrÎÚ_determine_joinsr›r(Ú_sanitize_joinsÚ _annotate_fksÚ_annotate_remoteÚ_annotate_localÚ_annotate_parentmapperÚ _setup_pairsÚ_check_foreign_colsÚ_determine_directionÚ_check_remote_sideÚ
_log_joins)rŠrÅrÆrÇrÈr›rrœrÉrÊrËr·rŸrÌròrÍrÎr~r~rrÕÞs<
zJoinCondition.__init__rr‡cCsð|jj}| d|j|j¡| d|j|j¡| d|jd dd„|jDƒ¡¡| d|jd dd„|jpjgDƒ¡¡| d    |jd d
d„|jDƒ¡¡| d |jd d d„|j    Dƒ¡¡| d |jd dd„|j
Dƒ¡¡| d|j|j ¡dS)Nz%s setup primary join %sz%s setup secondary join %sz%s synchronize pairs [%s]ú,css|]\}}d||fVqdS©z
(%s => %s)Nr~©rÚlrƒr~r~rr    sz+JoinCondition._log_joins.<locals>.<genexpr>z#%s secondary synchronize pairs [%s]css|]\}}d||fVqdSr r~r r~r~rr"    sÿz%s local/remote pairs [%s]css|]\}}d||fVqdS)z    (%s / %s)Nr~r r~r~rr*    sz%s remote columns [%s]css|]}d|VqdS©z%sNr~©rrIr~r~rr1    sz%s local columns [%s]css|]}d|VqdSrr~rr~r~rr6    sz%s relationship direction %s) ròÚloggerrËr›rœÚjoinr´r¶r·rÑr²r¸)rŠr1r~r~rr        sF
ÿý
þý
ÿýýýzJoinCondition._log_joinscCs.t|jdd|_|jdk    r*t|jdd|_dS)a_remove the parententity annotation from our join conditions which
        can leak in here based on some declarative patterns and maybe others.
 
        "parentmapper" is relied upon both by the ORM evaluator as well as
        the use case in _join_fixture_inh_selfref_w_entity
        that relies upon it being present, see :ticket:`3364`.
 
        )réÚ    proxy_key©ÚvaluesN)r?r›rœr‰r~r~rr:    s
ÿ
ÿzJoinCondition._sanitize_joinsc
Csv|jdk    r$|jdkr$t d|j¡‚z”|jp.d}|jdk    rŠ|jdkr\t|j|j|j|d|_|j    dkr€t|j
|j|j |d|_ q¶|j    |_ n,|j    dkr®t|j
|j|j |d|_ n|j    |_ Wn¸tj k
r}z:|jdk    ròt  d|j|jf¡|‚nt  d|j¡|‚W5d}~XYn^tjk
rp}z<|jdk    rNt d|j|jf¡|‚nt d|j¡|‚W5d}~XYnXdS)zõDetermine the 'primaryjoin' and 'secondaryjoin' attributes,
        if not passed to the constructor already.
 
        This is based on analysis of the foreign key relationships
        between the parent and target mapped selectables.
 
        NzMProperty %s specified with secondary join condition but no secondary argument)Za_subsetrËa1Could not determine join condition between parent/child tables on relationship %s - there are no foreign keys linking these tables via secondary table '%s'.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify 'primaryjoin' and 'secondaryjoin' expressions.aCould not determine join condition between parent/child tables on relationship %s - there are no foreign keys linking these tables.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify a 'primaryjoin' expression.alCould not determine join condition between parent/child tables on relationship %s - there are multiple foreign key paths linking the tables via secondary table '%s'.  Specify the 'foreign_keys' argument, providing a list of those columns which should be counted as containing a foreign key reference from the secondary table to each of the parent and child tables.a'Could not determine join condition between parent/child tables on relationship %s - there are multiple foreign key paths linking the tables.  Specify the 'foreign_keys' argument, providing a list of those columns which should be counted as containing a foreign key reference to the parent table.)rœrr×rØròrËrCrÆrÈrùrÅrÇr›ZNoForeignKeysErrorZAmbiguousForeignKeysError)rŠrËZnfeZafer~r~rrÿL    s€þÿ 
 
 
ü
ü
 
 
ü
 
 
ùÿ    ÷ úÿø     
øÿ
ö úÿøzJoinCondition._determine_joinscCst|jddS©N©Úlocalrxr)r?r›r‰r~r~rrç«    sz%JoinCondition.primaryjoin_minus_localcCs|jdk    st‚t|jddSr)rœr(r?r‰r~r~rr毠   sz'JoinCondition.secondaryjoin_minus_localcCsJ|jr(ddddœdd„}t |ji|¡S|jr<t|jddSt|jƒSd    S)
a(Return the primaryjoin condition suitable for the
        "reverse" direction.
 
        If the primaryjoin was delivered here with pre-existing
        "remote" annotations, the local/remote annotations
        are reversed.  Otherwise, the local/remote annotations
        are removed.
 
        rtrú Optional[_CE]©rôrãrwc[s\d|jkr,t|jƒ}|d=d|d<| |¡Sd|jkrXt|jƒ}|d=d|d<| |¡SdS)NrxTr)Ú _annotationsrCZ_with_annotations)rôrãrçr~r~rÚreplaceÁ    s
 
 
 
 
 
z9JoinCondition.primaryjoin_reverse_remote.<locals>.replacerrN)Ú_has_remote_annotationsr:Úreplacement_traverser›Ú_has_foreign_annotationsr?)rŠrr~r~rrè´    s ÿz(JoinCondition.primaryjoin_reverse_remotercr…)rr®rwcCs&t |i¡D]}||jkr dSq dSrý)r:Úiterater)rŠrr®rIr~r~rÚ_has_annotationÙ    s
zJoinCondition._has_annotationcCs| |jd¡S©Nr€©r r›r‰r~r~rrà    sz&JoinCondition._has_foreign_annotationscCs| |jd¡S©Nrxr"r‰r~r~rrä    sz%JoinCondition._has_remote_annotationscCs&|jr
dS|jr| ¡n| ¡dS)z‘Annotate the primaryjoin and secondaryjoin
        structures with 'foreign' annotations marking columns
        considered as foreign.
 
        N)rrËÚ_annotate_from_fk_listÚ_annotate_present_fksr‰r~r~rrè    s
 
zJoinCondition._annotate_fkscsHddddœ‡fdd„ }t ˆji|¡ˆ_ˆjdk    rDt ˆji|¡ˆ_dS)Nrtrrrcs|ˆjkr| ddi¡SdS©Nr€T)rËr.©rôrãr‰r~rÚcheck_fk÷    s
z6JoinCondition._annotate_from_fk_list.<locals>.check_fk)r:rr›rœ)rŠr(r~r‰rr$ö    sÿ
ÿz$JoinCondition._annotate_from_fk_listcs„|jdk    rt |jj¡‰ntƒ‰ddddœ‡fdd„ ‰dddœ‡fd    d
„ }t |jid |i¡|_|jdk    r€t |jid |i¡|_dS) NruzOptional[ColumnElement[Any]])ÚaÚbrwcsdt|tjƒr4t|tjƒr4| |¡r&|S| |¡r4|Sˆr`|ˆkrL|ˆkrL|S|ˆkr`|ˆkr`|SdSrˆ)rr2ZColumnZ
references)r)r*)Ú secondarycolsr~rÚ
is_foreign
 
s
 
z7JoinCondition._annotate_present_fks.<locals>.is_foreignúBinaryExpression[Any]r©Úbinaryrwcst|jtjƒrt|jtjƒs dSd|jjkrŒd|jjkrŒˆ|j|jƒ}|dk    rŒ| |j¡rn|j ddi¡|_n| |j¡rŒ|j ddi¡|_dSr&)rÚleftr3r>ÚrightrÚcomparer.)r/rI)r,r~rÚ visit_binary
s&ÿ þ
ÿ
þ  ÿz9JoinCondition._annotate_present_fks.<locals>.visit_binaryr/)    rr4r§r†rÝr:rhr›rœ©rŠr3r~)r,r+rr%
s 
ÿ
ÿz#JoinCondition._annotate_present_fkscs@|j‰|j‰d‰dddœ‡‡‡fdd„ }t |jid|i¡ˆS)zvReturn True if the join condition contains column
        comparisons where both columns are in both tables.
 
        Fr-rr.cs^|j|j}}t|tjƒrZt|tjƒrZˆ |j¡rZˆ |j¡rZˆ |j¡rZˆ |j¡rZd‰dSrú)r0r1rr7r=Zis_derived_fromÚtable)r/r†Úf©ÚmtÚptÚresultr~rr3?
s
ÿ
þ
ý
ü
û
úz;JoinCondition._refers_to_parent_table.<locals>.visit_binaryr/)rÅrÆr:r-r›r4r~r7rÚ_refers_to_parent_table6
s  z%JoinCondition._refers_to_parent_tablecCst|j|jƒS)z5Return True if parent/child tables have some overlap.)rDrÅrÆr‰r~r~rÚ_tables_overlapO
sÿzJoinCondition._tables_overlapcCsl|jr
dS|jdk    r| ¡nJ|js*|jr4| ¡n4| ¡rN| dd„d¡n| ¡r`|     ¡n| 
¡dS)z¢Annotate the primaryjoin and secondaryjoin
        structures with 'remote' annotations marking columns
        considered as part of the 'remote' side.
 
        NcSs
d|jkSr!©rrJr~r~rrûe
rüz0JoinCondition._annotate_remote.<locals>.<lambda>F) rrÚ_annotate_remote_secondaryrÐrþÚ_annotate_remote_from_argsr;Ú_annotate_selfrefr<Ú_annotate_remote_with_overlapÚ%_annotate_remote_distinct_selectablesr‰r~r~rrV
s
 
 
ÿ
zJoinCondition._annotate_remotecs`|jdk    st‚|j‰ddddœ‡fdd„ }t |ji|¡|_|jdk    sJt‚t |ji|¡|_dS)z^annotate 'remote' in primaryjoin, secondaryjoin
        when 'secondary' is present.
 
        Nrtrrrcsˆj |¡r| ddi¡SdS©NrxT)r†rãr.r'©Zfixed_secondaryr~rÚreplu
s z6JoinCondition._annotate_remote_secondary.<locals>.repl)rr(r:rr›rœ©rŠrEr~rDrr>l
sÿÿz(JoinCondition._annotate_remote_secondaryz$Callable[[ColumnElement[Any]], bool])ÚfnÚremote_side_givenrwcs2dddœ‡‡‡fdd„ }t ˆjid|i¡ˆ_dS)zxannotate 'remote' in primaryjoin, secondaryjoin
        when the relationship is detected as self-referential.
 
        r-rr.csx|j |j¡}t|jtjƒrht|jtjƒrhˆ|jƒrF|j ddi¡|_ˆ|jƒrt|st|j ddi¡|_n ˆstˆ ¡dSrC)r0r2r1rr7r=r.Ú_warn_non_column_elements)r/Zequated©rGrHrŠr~rr3‹
sÿ
z5JoinCondition._annotate_selfref.<locals>.visit_binaryr/N)r:rhr›)rŠrGrHr3r~rJrr@ƒ
s  ÿzJoinCondition._annotate_selfrefcsx|jr(|jrt d¡‚dd„|jDƒ‰n|j‰| ¡rL| ‡fdd„d¡n(ddd    d
œ‡fd d „ }t |ji|¡|_d S)zannotate 'remote' in primaryjoin, secondaryjoin
        when the 'remote_side' or '_local_remote_pairs'
        arguments are used.
 
        zTremote_side argument is redundant against more detailed _local_remote_side argument.cSsg|] \}}|‘qSr~r~r r~r~rrPª
sz<JoinCondition._annotate_remote_from_args.<locals>.<listcomp>cs|ˆkSrˆr~rJ©rŸr~rrû¯
rüz:JoinCondition._annotate_remote_from_args.<locals>.<lambda>Trtrrrcs|tˆƒkr| ddi¡SdSrC)rÝr.r'rKr~rrE²
s z6JoinCondition._annotate_remote_from_args.<locals>.replN)    rÐrþr×rØr;r@r:rr›rFr~rKrr?œ
sÿÿz(JoinCondition._annotate_remote_from_argscs`dddœ‡fdd„ }ˆjdk    o,ˆjjˆjjk    ‰dddd    œ‡‡fd
d „ ‰t ˆjid |i¡ˆ_dS) zÆannotate 'remote' in primaryjoin, secondaryjoin
        when the parent/child tables have some set of
        tables in common, though is not a fully self-referential
        relationship.
 
        r-rr.cs0ˆ|j|jƒ\|_|_ˆ|j|jƒ\|_|_dSrˆ©r0r1)r/)Úproc_left_rightr~rr3Å
sÿ ÿzAJoinCondition._annotate_remote_with_overlap.<locals>.visit_binaryNruz-Tuple[ColumnElement[Any], ColumnElement[Any]])r0r1rwcs¤t|tjƒrDt|tjƒrDˆjj |¡rœˆjj |¡rœ| ddi¡}nXˆrl|j     d¡ˆj
j krl| ddi¡}n0ˆr”|j     d¡ˆj
j kr”| ddi¡}nˆ  ¡||fS)NrxTrô) rr7r=rÆr†rãrÅr.rrròrèrIrL)Úcheck_entitiesrŠr~rrMÑ
s,ÿÿ þÿþÿþzDJoinCondition._annotate_remote_with_overlap.<locals>.proc_left_rightr/)ròrèrþr:rhr›r4r~)rNrMrŠrrA½
s    ÿÿz+JoinCondition._annotate_remote_with_overlapcs,ddddœ‡fdd„ }t ˆji|¡ˆ_dS)z}annotate 'remote' in primaryjoin, secondaryjoin
        when the parent/child tables are entirely
        separate.
 
        rtrrrcs<ˆjj |¡r8ˆjj |¡r*ˆjj |¡r8| ddi¡SdSrC)rÆr†rãrÇrÈr.r'r‰r~rrEõ
s ÿ þzAJoinCondition._annotate_remote_distinct_selectables.<locals>.replN©r:rr›rFr~r‰rrBî
s ÿz3JoinCondition._annotate_remote_distinct_selectablescCst d|j¡dS)NzƒNon-simple column elements in primary join condition for property %s - consider using remote() annotations to mark the remote side.)r4rÙròr‰r~r~rrI s
þÿz'JoinCondition._warn_non_column_elementscsj| |jd¡rdS|jr0t dd„|jDƒ¡‰nt |jj¡‰ddddœ‡fd    d
„ }t |ji|¡|_dS) aCAnnotate the primaryjoin and secondaryjoin
        structures with 'local' annotations.
 
        This annotates all column elements found
        simultaneously in the parent table
        and the join condition that don't have a
        'remote' annotation set up from
        _annotate_remote() or user-defined.
 
        rNcSsg|] \}}|‘qSr~r~r r~r~rrP sz1JoinCondition._annotate_local.<locals>.<listcomp>rtrrrcs$d|jkr |ˆkr | ddi¡SdS)NrxrT)rr.r'©Z
local_sider~rÚlocals_ sz.JoinCondition._annotate_local.<locals>.locals_)    r r›rÐr4r§rÅr†r:r)rŠrQr~rPrr s ÿÿzJoinCondition._annotate_localcs,ddddœ‡fdd„ }t ˆji|¡ˆ_dS)Nrtrrrcs<d|jkr| dˆjji¡Sd|jkr8| dˆjji¡SdS)Nrxrôr)rr.ròrèrþr'r‰r~rÚparentmappers_' s
 
 
z<JoinCondition._annotate_parentmapper.<locals>.parentmappers_rO)rŠrRr~r‰rr& s ÿz$JoinCondition._annotate_parentmappercCs^|jst d|jf¡‚n@t |jj¡ |j    j¡}|jD] \}}||kr8t 
d|f¡q8dS)NaRelationship %s could not determine any unambiguous local/remote column pairs based on join condition and remote_side arguments.  Consider using the remote() annotation to accurately mark those elements of the join condition that are on the remote side of the relationship.zàExpression %s is marked as 'remote', but these column(s) are local to the local side.  The remote() annotation is needed only for a self-referential relationship where both sides of the relationship refer to the same tables.) r·r×rØròr4r§rÅr†Ú
differencerÆrÙ)rŠZ
not_targetÚ_Zrmtr~r~rr2 s$ùÿ ÿþûÿz JoinCondition._check_remote_side)rCÚprimaryrwcCs²d}| |d¡}t|ƒ}|r(t|jƒ}n
t|jƒ}|jr<|sF|jsJ|rJdS|jr„|r„|s„d|rbdpdd||jf}|d7}t |¡‚n*d|rŽdpd||jf}|d    7}t |¡‚dS)
zHCheck the foreign key columns collected and emit error
        messages.Fr€NzŒCould not locate any simple equality expressions involving locally mapped foreign key columns for %s join condition '%s' on relationship %s.rUra  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or are annotated in the join condition with the foreign() annotation. To allow comparison operators other than '==', the relationship can be marked as viewonly=True.z`Could not locate any relevant foreign key columns for %s join condition '%s' on relationship %s.z¡  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or are annotated in the join condition with the foreign() annotation.)Ú_gather_columns_with_annotationr†r´r¶rÍròr×rØ)rŠrCrUZcan_syncZ foreign_colsZ has_foreignÚerrr~r~rrO sRÿ 
ÿþýý
ýüÿ ÿ 
ýþÿ    ÿz!JoinCondition._check_foreign_colscCsþ|jdk    rt|_nèt |jj¡}t |jj¡}| |j    ¡}| |j    ¡}|rÒ|rÒ| 
|j dd¡}dd„| 
|j d¡Dƒ}|r |r |j  |j ¡}| |¡}| |¡}|r°|s°t|_qú|rÀ|sÀt|_qút d|j¡‚n(|rÞt|_n|rêt|_nt d|j¡‚dS)z[Determine if this relationship is one to many, many to one,
        many to many.
 
        Nrxr€cSsh|]}d|jkr|’qS)rxr=)rr†r~r~rÚ    <setcomp>´ s
üz5JoinCondition._determine_direction.<locals>.<setcomp>aDCan't determine relationship direction for relationship '%s' - foreign key columns within the join condition are present in both the parent and the child's mapped tables.  Ensure that only those columns referring to a parent column are marked as foreign, either via the foreign() annotation or via the foreign_keys argument.z’Can't determine relationship direction for relationship '%s' - foreign key columns are present in neither the parent nor the child's mapped tables)rœr%r¸r4r§rÅr†rÆrÛrÒrVr›rÑr²rSr'r&r×rØrò)rŠZ
parentcolsZ
targetcolsZ onetomany_fkZ manytoone_fkZonetomany_localZmanytoone_localZ self_equatedr~r~rr“ sT
      ÿÿþ ÿ
 
ùÿ
ýÿz"JoinCondition._determine_directionÚ_ColumnPairIterableÚ_MutableColumnPairs)rrwcCsdd„|DƒS)zÅprovide deannotation for the various lists of
        pairs, so that using them in hashes doesn't incur
        high-overhead __eq__() comparisons against
        original columns mapped.
 
        cSs g|]\}}| ¡| ¡f‘qSr~©Z _deannotaterMr~r~rrPî sz3JoinCondition._deannotate_pairs.<locals>.<listcomp>r~)rŠrr~r~rÚ_deannotate_pairså s    zJoinCondition._deannotate_pairscs„g}t g¡‰g}ddddœ‡‡fdd„ }ˆj|fˆj|ffD]\}}|dkrPq>|||ƒq>ˆ ˆ¡ˆ_ˆ |¡ˆ_ˆ |¡ˆ_dS)NrªrZr)Újoincondrrwcs*dddddœ‡‡‡fdd„ }t||ƒdS)Nr-rur)r/r0r1rwcs¨d|jkr.d|jkr.ˆ |¡r.ˆ ||f¡n,d|jkrZd|jkrZˆ |¡rZˆ ||f¡|jtjkr¤ˆ ||¡r¤d|jkrŒˆ ||f¡nd|jkr¤ˆ ||f¡dS)Nrxr€)rrÎrŽÚoperatorr8Úeqr‚)r/r0r1)rÚlrprŠr~rr3û s,ÿþýÿþýÿ
 
z<JoinCondition._setup_pairs.<locals>.go.<locals>.visit_binaryrE)r]rr3©r`rŠ)rrÚgo÷ sz&JoinCondition._setup_pairs.<locals>.go)r4Z
OrderedSetr›rœr\r·r´r¶)rŠZ
sync_pairsZsecondary_sync_pairsrbr]rr~rarrð s þ þ    ÿzJoinCondition._setup_pairszwweakref.WeakKeyDictionary[ColumnElement[Any], weakref.WeakKeyDictionary[RelationshipProperty[Any], ColumnElement[Any]]]Ú_track_overlapping_sync_targetsc s”|js
dSdd„|jDƒdd„|jDƒD]b\}‰ˆ|jkrVt |j|i¡|jˆ<q*g}|jˆ}| ¡D]¼\}}|jj    sl||jj
krl|j |jj krl|jj |j krld|jj krld|j krl|jj  |j ¡sl|jj |j¡sl|jj  |j¡sl|jj |j ¡sl|jj |j ks|jj  |j ¡sl| ||f¡ql|r~tjd|j|ˆd t‡fdd„|Dƒƒ¡d     td
d„|Dƒƒ¡|jfd d ||jˆ|j<q*dS) NcSsg|]\}}||f‘qSr~r~©rÚfrom_Úto_r~r~rrP4 szDJoinCondition._warn_for_conflicting_sync_targets.<locals>.<listcomp>cSsg|]\}}||f‘qSr~r~rdr~r~rrP6 sz__*arelationship '%s' will copy column %s to column %s, which conflicts with relationship(s): %s. If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="%s"' to the '%s' relationship.z, c3s |]\}}d||ˆfVqdS)z'%s' (copies %s to %s)Nr~)rÚprÚfr_©rfr~rrv sÿzCJoinCondition._warn_for_conflicting_sync_targets.<locals>.<genexpr>r
css|]\}}|jVqdSrˆ©rë)rrgÚfrr~r~rr{ sZqzyxrÝ)rÍr´r¶rcÚweakrefÚWeakKeyDictionaryròrärèZ_dispose_calledrÞrër¡rþZ
is_siblingr–r‚r4rÙrÚsorted)rŠreZ other_propsZ prop_to_fromrgrhr~rirrŸ+ sxÿÿþ
þÿ
ÿ
þ ý ü
õ ô óòñð îí þÿõóåz0JoinCondition._warn_for_conflicting_sync_targetsr¯cCs
| d¡Sr#©Ú_gather_join_annotationsr‰r~r~rrÑ‚ szJoinCondition.remote_columnscCs
| d¡S)Nrror‰r~r~rr²† szJoinCondition.local_columnscCs
| d¡Sr!ror‰r~r~rrÒŠ sz!JoinCondition.foreign_key_columns)r®rwcCs>t| |j|¡ƒ}|jdk    r0| | |j|¡¡dd„|DƒS)NcSsh|] }| ¡’qSr~r[r¥r~r~rrXš sz9JoinCondition._gather_join_annotations.<locals>.<setcomp>)rÝrVr›rœrÛ)rŠr®Úsr~r~rrpŽ s ÿ
ÿÿz&JoinCondition._gather_join_annotationsruz Iterable[str]cs"t|ƒ‰‡fdd„t |i¡DƒS)Ncs&h|]}ˆ |j¡rttt|ƒ’qSr~)Úissubsetrrr>rr©Zannotation_setr~rrX  s þz@JoinCondition._gather_columns_with_annotation.<locals>.<setcomp>)rÝr:r)rŠrr®r~rsrrVœ s
 
þz-JoinCondition._gather_columns_with_annotationr~róztTuple[ColumnElement[bool], Optional[ColumnElement[bool]], Optional[FromClause], Optional[ClauseAdapter], FromClause])rr$rîr2r÷rwc CsLt|ddiƒ}|j|j|j}}}|dk    rF|dk    r>||@}n||@}|rp|dk    rb|tj|Ž@}n|tj|Ž@}|r:|dk    râ|jdd}t|tdƒd}    t||j    d 
|    ¡}
|dk    rÖt|tdƒd 
t||j d¡}    |
  |¡}n<t|tdƒ|j    d}    |dk    r|     
t|td    ƒ|j d¡d}
|      |¡}|
p0|    } d| _ nd} |||| |fS)
a7Given a source and destination selectable, create a
        join between them.
 
        This takes into account aliasing the join clause
        to reference the appropriate corresponding columns
        in the target objects, as well as the extra child
        criterion, equivalent column sets, etc.
 
        r&TN)Zflatr)Ú
exclude_fn)Ú equivalents)rtrurx)r@r›rœrr3rr+rBÚ_ColInAnnotationsrÊÚchainrÉr-rt) rŠrr$rîr2r÷r›rœrZprimary_aliasizerZsecondary_aliasizerr
r~r~rrí¦ s€ÿý
 
 ÿÿþÿþý     ý
ýÿ
 
ûzJoinCondition.join_targetszgTuple[ColumnElement[bool], Dict[str, ColumnElement[Any]], Dict[ColumnElement[Any], ColumnElement[Any]]])rirwc    s
i‰i}|jdk    ‰ˆrLt t¡‰|jD]"\}}ˆ| ||f¡|||<q&n6ˆsj|jD]\}}|||<qVn|jD]\}}|||<qpddddœ‡‡‡‡fdd„ }|j}|jdks²ˆsÀt |i|¡}|jdk    rî|j}ˆrât |i|¡}t     
||¡}‡fdd„ˆDƒ}|||fS)    NrurzOptional[BindParameter[Any]]rcsXˆsd|jks,ˆrTˆr|ˆks,ˆsTd|jkrT|ˆkrLtjdd|jddˆ|<ˆ|SdS)NrrxT)rArB)rr3rDrEr'©ÚbindsZ has_secondaryÚlookuprir~rÚ col_to_bind% s.ÿÿþüüûûÿ
z5JoinCondition.create_lazy_clause.<locals>.col_to_bindcsi|]}ˆ|j|“qSr~rjr)ryr~rÚ
<dictcomp>F sz4JoinCondition.create_lazy_clause.<locals>.<dictcomp>) rœÚ collectionsÚ defaultdictÚlistr·r‚r›r:rr3r)    rŠriZequated_columnsr rƒr{Z    lazywhererœr^r~rxrÚcreate_lazy_clause s@
 
 
ÿ
ÿ z JoinCondition.create_lazy_clause)Nr~)F)/r”r•r–r™rÕr    rrÿrïrçrær4rñrèr rrrr$r%r;r<rr>r@r?rArBrIrrrrrr\rrlrmrcrŸrÑr²rÒrprVrír€r~r~r~rr­Ës”
    î06&_$2!1 DR 9û
Wúhÿr­c@s2eZdZdZdZddœdd„Zdddœd    d
„Zd S) rvz<Serializable object that tests for a name in c._annotations.©r‚r…cCs
||_dSrˆr)rŠr‚r~r~rrÕP sz_ColInAnnotations.__init__rcr†)r†rwcCs |j|jkSrˆ)r‚r)rŠr†r~r~rÚ__call__S sz_ColInAnnotations.__call__N)r”r•r–r—r˜rÕr‚r~r~r~rrvK srvc@seZdZdZdZdS)Ú Relationshipa‘Describes an object property that holds a single item or list
    of items that correspond to a related database table.
 
    Public constructor is the :func:`_orm.relationship` function.
 
    .. seealso::
 
        :ref:`relationship_config_toplevel`
 
    .. versionchanged:: 2.0 Added :class:`_orm.Relationship` as a Declarative
       compatible subclass for :class:`_orm.RelationshipProperty`.
 
    TN)r”r•r–r—rïr~r~r~rrƒW srƒ)¢r—Ú
__future__rr}rZ dataclassesr5r¶rßr¹rrrrrr    r
r r r rrrrrrrrrlÚrrÚ_typingrrÚbaserrrrrr r!r"Z
interfacesr#r$r%r&r'r(r)r*r4r+r,r-r/r×r0r1r2r3Z
inspectionr6r7r8r9r:Z sql._typingr;r<Z sql.elementsr=r>Zsql.utilr?r@rArBrCrDrFZ util.typingrGrHrIÚ TYPE_CHECKINGrJrKrLrMrNrOrPrQZ clsregistryrRrSZ    decl_baserTrìrUrèrVÚqueryrWrtrXr?rYZ
strategiesrZr[r\r]r^r_Zsql.annotationr`rarbrcZ
sql.schemardZsql.selectablererfrgrhrjrkrlrmr…Z_RelationshipArgumentTyperÓr†Z"_RelationshipJoinConditionArgumentZ_RelationshipSecondaryArgumentrÒZORMBackrefArgumentZ DMLColumnRoleZ_ORMColCollectionElementZ_ORMColCollectionArgumentrsrtrYr³rZrxr€Z    dataclassrršZ class_loggerZ
Identifiedr rzr­rvrƒr~r~r~rÚ<module>sŽ                                                                                                        
 
úÿ
ÿ
ÿÿüÿÿ
üÿ     
ÿ      
ü