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

Method import

crates/vm/src/vm/mod.rs:1781–1785  ·  view source on GitHub ↗
(&self, module_name: impl AsPyStr<'a>, level: usize)

Source from the content-addressed store, hash-verified

1779 /// See also [`rustpython_vm::import::import_source`] and other primitive import functions.
1780 #[inline]
1781 pub fn import<'a>(&self, module_name: impl AsPyStr<'a>, level: usize) -> PyResult {
1782 let module_name = module_name.as_pystr(&self.ctx);
1783 let from_list = self.ctx.empty_tuple_typed();
1784 self.import_inner(module_name, from_list, level)
1785 }
1786
1787 /// Call Python __import__ function caller with from_list.
1788 /// Roughly equivalent to `from module_name import item1, item2` or `from top.submodule import item1, item2`

Callers 15

runFunction · 0.45
run_fileFunction · 0.45
run_rustpythonFunction · 0.45
py_mainFunction · 0.45
mainFunction · 0.45
module_execFunction · 0.45
module_execFunction · 0.45
py_initMethod · 0.45
get_future_repr_infoFunction · 0.45
get_task_repr_infoFunction · 0.45
get_stackMethod · 0.45
print_stackMethod · 0.45

Calls 3

as_pystrMethod · 0.80
empty_tuple_typedMethod · 0.80
import_innerMethod · 0.80

Tested by

no test coverage detected