Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/pandas/core/roperator.py: 45%
29 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1"""
2Reversed Operations not available in the stdlib operator module.
3Defining these instead of using lambdas allows us to reference them by name.
4"""
5from __future__ import annotations
7import operator
10def radd(left, right):
11 return right + left
14def rsub(left, right):
15 return right - left
18def rmul(left, right):
19 return right * left
22def rdiv(left, right):
23 return right / left
26def rtruediv(left, right):
27 return right / left
30def rfloordiv(left, right):
31 return right // left
34def rmod(left, right):
35 # check if right is a string as % is the string
36 # formatting operation; this is a TypeError
37 # otherwise perform the op
38 if isinstance(right, str):
39 typ = type(left).__name__
40 raise TypeError(f"{typ} cannot perform the operation mod")
42 return right % left
45def rdivmod(left, right):
46 return divmod(right, left)
49def rpow(left, right):
50 return right**left
53def rand_(left, right):
54 return operator.and_(right, left)
57def ror_(left, right):
58 return operator.or_(right, left)
61def rxor(left, right):
62 return operator.xor(right, left)