U af@sZddlZddlZddlmZdddddd Zdd d ZddZddZddZddZ dS)N)_make_nez==z>=)eqltlegtgeT Comparablec sdgtgtdd}d}|dk r>d}td|d<td <|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|tfifdd} |r| jt d|krdkrnn|s d} t | 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. Args: eq (typing.Callable | None): Callable used to evaluate equality of two objects. lt (typing.Callable | None): Callable used to evaluate whether one object is less than another object. le (typing.Callable | None): Callable used to evaluate whether one object is less than or equal to another object. gt (typing.Callable | None): Callable used to evaluate whether one object is greater than another object. ge (typing.Callable | None): Callable used to evaluate whether one object is greater than or equal to another object. require_same_type (bool): When `True`, equality and ordering methods will return `NotImplemented` if objects are not of the same type. class_name (str | None): 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 |SN)update)nsbody:/opt/nydus/tmp/pip-target-53d1vnqk/lib/python/attr/_cmp.py]zcmp_using..zDeq must be define is order to complete ordering from lt, le, gt, ge.) _make_initr_make_operatorrtypes new_classobjectrappend_check_same_type ValueError functoolstotal_ordering) rrrr r Zrequire_same_type class_nameZnum_order_functionsZhas_eq_functiontype_msgrrr cmp_using sJ0    r.cCs dd}|S)z! Create __init__ method. cSs ||_dS)z1 Initialize object with *value*. N)r )selfr rrrrusz_make_init..__init__r)rrrrr!psr!cs0fdd}d|d|_dt|d|_|S)z! Create operator method. cs,||stS|j|j}|tkr(tS|Sr)rNotImplementedr )r/otherresultfuncrrmethods  z_make_operator..method__z Return a z b. Computed by attrs.)__name___operation_names__doc__)namer4r5rr3rr"~s  r"cstfddjDS)z8 Check whether `other` is comparable to `self`. c3s|]}|VqdSrr).0r4r1r/rr sz$_is_comparable_to..)allrr/r1rr<rrsrcCs|jj|jjkS)zR Return True if *self* and *other* are of the same type, False otherwise. )r __class__r?rrrr'sr')NNNNNTr ) r)r#_makerr8r.r!r"rr'rrrrs  c