MCPcopy Index your code
hub / github.com/secdev/scapy / EDecimal

Class EDecimal

scapy/utils.py:113–180  ·  view source on GitHub ↗

Extended Decimal This implements arithmetic and comparison with float for backward compatibility

Source from the content-addressed store, hash-verified

111
112
113class EDecimal(Decimal):
114 """Extended Decimal
115
116 This implements arithmetic and comparison with float for
117 backward compatibility
118 """
119
120 def __add__(self, other, context=None):
121 # type: (_Decimal, Any) -> EDecimal
122 return EDecimal(Decimal.__add__(self, Decimal(other)))
123
124 def __radd__(self, other):
125 # type: (_Decimal) -> EDecimal
126 return EDecimal(Decimal.__add__(self, Decimal(other)))
127
128 def __sub__(self, other):
129 # type: (_Decimal) -> EDecimal
130 return EDecimal(Decimal.__sub__(self, Decimal(other)))
131
132 def __rsub__(self, other):
133 # type: (_Decimal) -> EDecimal
134 return EDecimal(Decimal.__rsub__(self, Decimal(other)))
135
136 def __mul__(self, other):
137 # type: (_Decimal) -> EDecimal
138 return EDecimal(Decimal.__mul__(self, Decimal(other)))
139
140 def __rmul__(self, other):
141 # type: (_Decimal) -> EDecimal
142 return EDecimal(Decimal.__mul__(self, Decimal(other)))
143
144 def __truediv__(self, other):
145 # type: (_Decimal) -> EDecimal
146 return EDecimal(Decimal.__truediv__(self, Decimal(other)))
147
148 def __floordiv__(self, other):
149 # type: (_Decimal) -> EDecimal
150 return EDecimal(Decimal.__floordiv__(self, Decimal(other)))
151
152 def __divmod__(self, other):
153 # type: (_Decimal) -> Tuple[EDecimal, EDecimal]
154 r = Decimal.__divmod__(self, Decimal(other))
155 return EDecimal(r[0]), EDecimal(r[1])
156
157 def __mod__(self, other):
158 # type: (_Decimal) -> EDecimal
159 return EDecimal(Decimal.__mod__(self, Decimal(other)))
160
161 def __rmod__(self, other):
162 # type: (_Decimal) -> EDecimal
163 return EDecimal(Decimal.__rmod__(self, Decimal(other)))
164
165 def __pow__(self, other, modulo=None):
166 # type: (_Decimal, Optional[_Decimal]) -> EDecimal
167 return EDecimal(Decimal.__pow__(self, Decimal(other), modulo))
168
169 def __eq__(self, other):
170 # type: (Any) -> bool

Callers 15

i2hMethod · 0.90
__add__Method · 0.85
__radd__Method · 0.85
__sub__Method · 0.85
__rsub__Method · 0.85
__mul__Method · 0.85
__rmul__Method · 0.85
__truediv__Method · 0.85
__floordiv__Method · 0.85
__divmod__Method · 0.85
__mod__Method · 0.85
__rmod__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected