MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / __repeat__

Method __repeat__

flow-message/src/cross/python/cow_list.rs:68–84  ·  view source on GitHub ↗
(&self, count: isize)

Source from the content-addressed store, hash-verified

66 }
67
68 fn __repeat__(&self, count: isize) -> PyResult<PyObject> {
69 let gil = Python::acquire_gil();
70 let py = gil.python();
71 let mut newlist = self.as_ref().clone();
72 for _ in 0..count - 1 {
73 for data in self.as_ref() {
74 newlist.push_back(data.clone());
75 }
76 }
77 Py::new(
78 py,
79 PyCowList {
80 inner: Some(newlist),
81 },
82 )
83 .map(|list| list.to_object(py))
84 }
85}
86
87#[pyproto]

Callers

nothing calls this directly

Calls 3

as_refMethod · 0.80
to_objectMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected