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

Method get

crates/stdlib/src/contextvars.rs:202–214  ·  view source on GitHub ↗
(
            &self,
            key: PyRef<ContextVar>,
            default: OptionalArg<PyObjectRef>,
        )

Source from the content-addressed store, hash-verified

200
201 #[pymethod]
202 fn get(
203 &self,
204 key: PyRef<ContextVar>,
205 default: OptionalArg<PyObjectRef>,
206 ) -> PyResult<Option<PyObjectRef>> {
207 let found = self.get_inner(&key);
208 let result = if let Some(found) = found {
209 Some(found.to_owned())
210 } else {
211 default.into_option()
212 };
213 Ok(result)
214 }
215
216 // TODO: wrong return type
217 #[pymethod]

Callers 15

nextMethod · 0.45
a2b_uuFunction · 0.45
b2a_uuFunction · 0.45
_servername_callbackFunction · 0.45
_msg_callbackFunction · 0.45
convert_openssl_errorFunction · 0.45
from_tuple_ipv6Method · 0.45
acquireMethod · 0.45
enterMethod · 0.45
exitMethod · 0.45
containsMethod · 0.45

Calls 15

into_optionMethod · 0.80
borrow_varsMethod · 0.80
SomeClass · 0.50
ErrClass · 0.50
get_innerMethod · 0.45
to_ownedMethod · 0.45
lastMethod · 0.45
as_ptrMethod · 0.45
loadMethod · 0.45
get_idMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected