MCPcopy Index your code
hub / github.com/RustPython/RustPython / right_method_name

Method right_method_name

crates/vm/src/protocol/number.rs:235–268  ·  view source on GitHub ↗

Returns `None` for in-place ops which don't have right-side variants.

(
        self,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

233impl PyNumberBinaryOp {
234 /// Returns `None` for in-place ops which don't have right-side variants.
235 pub fn right_method_name(
236 self,
237 vm: &VirtualMachine,
238 ) -> Option<&'static crate::builtins::PyStrInterned> {
239 use PyNumberBinaryOp::*;
240 Some(match self {
241 Add => identifier!(vm, __radd__),
242 Subtract => identifier!(vm, __rsub__),
243 Multiply => identifier!(vm, __rmul__),
244 Remainder => identifier!(vm, __rmod__),
245 Divmod => identifier!(vm, __rdivmod__),
246 Lshift => identifier!(vm, __rlshift__),
247 Rshift => identifier!(vm, __rrshift__),
248 And => identifier!(vm, __rand__),
249 Xor => identifier!(vm, __rxor__),
250 Or => identifier!(vm, __ror__),
251 FloorDivide => identifier!(vm, __rfloordiv__),
252 TrueDivide => identifier!(vm, __rtruediv__),
253 MatrixMultiply => identifier!(vm, __rmatmul__),
254 // In-place ops don't have right-side variants
255 InplaceAdd
256 | InplaceSubtract
257 | InplaceMultiply
258 | InplaceRemainder
259 | InplaceLshift
260 | InplaceRshift
261 | InplaceAnd
262 | InplaceXor
263 | InplaceOr
264 | InplaceFloorDivide
265 | InplaceTrueDivide
266 | InplaceMatrixMultiply => return None,
267 })
268 }
269}
270
271#[derive(Copy, Clone)]

Callers 2

binary_op1Method · 0.80
ternary_opMethod · 0.80

Calls 1

SomeClass · 0.50

Tested by

no test coverage detected