zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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
U
L±dã@sZddlZddlZddlmZdddddd    œZdd d „Zdd„Zdd„Zdd„Zdd„Z    dS)éNé)Ú_make_nez==ú<z<=ú>z>=)ÚeqÚltÚleÚgtÚgeTÚ
Comparablec
sdgtƒgtdœ‰d}d}|dk    r>d}td|ƒˆd<tƒˆd    <|dk    r\|d
7}td |ƒˆd <|dk    rz|d
7}td |ƒˆd<|dk    r˜|d
7}td|ƒˆd<|dk    r¶|d
7}td|ƒˆd<t |tfi‡fdd„¡}    |rà|    j t    ¡d|krödkrnn|st
dƒ‚t   |    ¡}    |    S)a˜
    Create a class that can be passed into `attrs.field`'s ``eq``, ``order``,
    and ``cmp`` arguments to customize field comparison.
 
    The resulting class will have a full set of ordering methods if at least
    one of ``{lt, le, gt, ge}`` and ``eq``  are provided.
 
    :param Optional[callable] eq: `callable` used to evaluate equality of two
        objects.
    :param Optional[callable] lt: `callable` used to evaluate whether one
        object is less than another object.
    :param Optional[callable] le: `callable` used to evaluate whether one
        object is less than or equal to another object.
    :param Optional[callable] gt: `callable` used to evaluate whether one
        object is greater than another object.
    :param Optional[callable] ge: `callable` used to evaluate whether one
        object is greater than or equal to another object.
 
    :param bool require_same_type: When `True`, equality and ordering methods
        will return `NotImplemented` if objects are not of the same type.
 
    :param Optional[str] class_name: Name of class. Defaults to 'Comparable'.
 
    See `comparison` for more details.
 
    .. versionadded:: 21.1.0
    Úvalue)Ú    __slots__Ú__init__Ú _requirementsÚ_is_comparable_torFNTrÚ__eq__Ú__ne__rrÚ__lt__rÚ__le__r    Ú__gt__r
Ú__ge__cs
| ˆ¡S©N)Úupdate)Úns©Úbody©ú@d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\attr/_cmp.pyÚ<lambda>Sózcmp_using.<locals>.<lambda>ézDeq must be define is order to complete ordering from lt, le, gt, ge.) Ú
_make_initrÚ_make_operatorrÚtypesÚ    new_classÚobjectrÚappendÚ_check_same_typeÚ
ValueErrorÚ    functoolsÚtotal_ordering)
rrrr    r
Zrequire_same_typeÚ
class_nameZnum_order_functionsZhas_eq_functionÚtype_rrrÚ    cmp_using sL&ü
 
ÿ ÿ
r-cCs dd„}|S)z!
    Create __init__ method.
    cSs
||_dS)z1
        Initialize object with *value*.
        N)r )Úselfr rrrrmsz_make_init.<locals>.__init__r)rrrrr!hsr!cs0‡fdd„}d|›d|_dt|›d|_|S)z!
    Create operator method.
    cs,| |¡stSˆ|j|jƒ}|tkr(tS|Sr)rÚNotImplementedr )r.ÚotherÚresult©ÚfuncrrÚmethod{s 
z_make_operator.<locals>.methodÚ__z    Return a z b.  Computed by attrs.)Ú__name__Ú_operation_namesÚ__doc__)Únamer3r4rr2rr"vs
 
ÿr"cCs |jD]}|||ƒsdSqdS)z8
    Check whether `other` is comparable to `self`.
    FT)r)r.r0r3rrrrs
 
rcCs|jj|jjkS)zR
    Return True if *self* and *other* are of the same type, False otherwise.
    )r Ú    __class__)r.r0rrrr'—sr')NNNNNTr )
r)r#Ú_makerr7r-r!r"rr'rrrrÚ<module>s ù
[