MCPcopy Index your code
hub / github.com/dgrunwald/rust-cpython / eval

Method eval

src/python.rs:252–259  ·  view source on GitHub ↗

Evaluates a Python expression in the given context and returns the result. If `globals` is `None`, it defaults to Python module `__main__`. If `locals` is `None`, it defaults to the value of `globals`.

(
        self,
        code: &str,
        globals: Option<&PyDict>,
        locals: Option<&PyDict>,
    )

Source from the content-addressed store, hash-verified

250 /// If `globals` is `None`, it defaults to Python module `__main__`.
251 /// If `locals` is `None`, it defaults to the value of `globals`.
252 pub fn eval(
253 self,
254 code: &str,
255 globals: Option<&PyDict>,
256 locals: Option<&PyDict>,
257 ) -> PyResult<PyObject> {
258 self.run_code(code, ffi::Py_eval_input, globals, locals)
259 }
260
261 /// Executes one or more Python statements in the given context.
262 ///

Callers 11

test_bytes_bufferFunction · 0.80
test_evalFunction · 0.80
test_extract_byte_strFunction · 0.80
test_extract_umlautFunction · 0.80
helloFunction · 0.80

Calls 1

run_codeMethod · 0.80

Tested by 10

test_bytes_bufferFunction · 0.64
test_evalFunction · 0.64
test_extract_byte_strFunction · 0.64
test_extract_umlautFunction · 0.64