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

Method new_module

crates/vm/src/vm/vm_new.rs:47–60  ·  view source on GitHub ↗
(
        &self,
        name: &str,
        dict: PyDictRef,
        doc: Option<PyStrRef>,
    )

Source from the content-addressed store, hash-verified

45 }
46
47 pub fn new_module(
48 &self,
49 name: &str,
50 dict: PyDictRef,
51 doc: Option<PyStrRef>,
52 ) -> PyRef<PyModule> {
53 let module = PyRef::new_ref(
54 PyModule::new(),
55 self.ctx.types.module_type.to_owned(),
56 Some(dict),
57 );
58 module.init_dict(self.ctx.intern_str(name), doc, self);
59 module
60 }
61
62 pub fn new_scope_with_builtins(&self) -> Scope {
63 Scope::with_builtins(None, self.ctx.new_dict(), self)

Callers 4

inject_moduleMethod · 0.45
inject_js_moduleMethod · 0.45
import_code_objFunction · 0.45
new_scope_with_mainMethod · 0.45

Calls 5

newFunction · 0.85
init_dictMethod · 0.80
intern_strMethod · 0.80
SomeClass · 0.50
to_ownedMethod · 0.45

Tested by

no test coverage detected