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

Method getstate

crates/stdlib/src/random.rs:110–120  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

108
109 #[pymethod]
110 fn getstate(&self, vm: &VirtualMachine) -> PyTupleRef {
111 let rng = self.rng.lock();
112 vm.new_tuple(
113 rng.get_state()
114 .iter()
115 .copied()
116 .chain([rng.get_index() as u32])
117 .map(|i| vm.ctx.new_int(i).into())
118 .collect::<Vec<PyObjectRef>>(),
119 )
120 }
121
122 #[pymethod]
123 fn setstate(&self, state: PyTupleRef, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 8

chainMethod · 0.80
get_indexMethod · 0.80
lockMethod · 0.45
new_tupleMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
get_stateMethod · 0.45
new_intMethod · 0.45

Tested by

no test coverage detected