ndtools.operators module#

eq_by_ne(left: T, right: Any, /) T[source]#

Implement the == operator by not(!=).

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left == right.

Return type:

T

ge_by_gt(left: T, right: Any, /) T[source]#

Implement the >= operator by > or ==.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left >= right.

Return type:

T

ge_by_le(left: T, right: Any, /) T[source]#

Implement the >= operator by not(<=) or ==.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left >= right.

Return type:

T

ge_by_lt(left: T, right: Any, /) T[source]#

Implement the >= operator by not(<).

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left >= right.

Return type:

T

gt_by_ge(left: T, right: Any, /) T[source]#

Implement the > operator by >= and !=.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left > right.

Return type:

T

gt_by_le(left: T, right: Any, /) T[source]#

Implement the > operator by not(<=).

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left > right.

Return type:

T

gt_by_lt(left: T, right: Any, /) T[source]#

Implement the > operator by not(<) and !=.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left > right.

Return type:

T

le_by_ge(left: T, right: Any, /) T[source]#

Implement the <= operator by not(>=) or ==.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left <= right.

Return type:

T

le_by_gt(left: T, right: Any, /) T[source]#

Implement the <= operator by not(>).

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left <= right.

Return type:

T

le_by_lt(left: T, right: Any, /) T[source]#

Implement the <= operator by < or ==.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left <= right.

Return type:

T

lt_by_ge(left: T, right: Any, /) T[source]#

Implement the < operator by not(>=).

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left < right.

Return type:

T

lt_by_gt(left: T, right: Any, /) T[source]#

Implement the < operator by not(>) and !=.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left < right.

Return type:

T

lt_by_le(left: T, right: Any, /) T[source]#

Implement the < operator by <= and !=.

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left < right.

Return type:

T

ne_by_eq(left: T, right: Any, /) T[source]#

Implement the != operator by not(==).

Parameters:
  • left (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left != right.

Return type:

T