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

Method as_number

crates/vm/src/builtins/dict.rs:545–566  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

543
544impl AsNumber for PyDict {
545 fn as_number() -> &'static PyNumberMethods {
546 static AS_NUMBER: PyNumberMethods = PyNumberMethods {
547 or: Some(|a, b, vm| {
548 if let Some(a) = a.downcast_ref::<PyDict>() {
549 PyDict::__or__(a, b.to_pyobject(vm), vm)
550 } else {
551 Ok(vm.ctx.not_implemented())
552 }
553 }),
554 inplace_or: Some(|a, b, vm| {
555 if let Some(a) = a.downcast_ref::<PyDict>() {
556 a.to_owned()
557 .__ior__(b.to_pyobject(vm), vm)
558 .map(|d| d.into())
559 } else {
560 Ok(vm.ctx.not_implemented())
561 }
562 }),
563 ..PyNumberMethods::NOT_IMPLEMENTED
564 };
565 &AS_NUMBER
566 }
567}
568
569impl Comparable for PyDict {

Callers

nothing calls this directly

Calls 6

SomeClass · 0.50
to_pyobjectMethod · 0.45
not_implementedMethod · 0.45
mapMethod · 0.45
__ior__Method · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected