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

Method new

crates/stdlib/src/pyexpat.rs:122–160  ·  view source on GitHub ↗
(
            namespace_separator: Option<String>,
            intern: Option<PyObjectRef>,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

120 #[pyclass]
121 impl PyExpatLikeXmlParser {
122 fn new(
123 namespace_separator: Option<String>,
124 intern: Option<PyObjectRef>,
125 vm: &VirtualMachine,
126 ) -> PyResult<PyExpatLikeXmlParserRef> {
127 let intern_dict = intern.unwrap_or_else(|| vm.ctx.new_dict().into());
128 Ok(Self {
129 namespace_separator,
130 start_element: MutableObject::new(vm.ctx.none()),
131 end_element: MutableObject::new(vm.ctx.none()),
132 character_data: MutableObject::new(vm.ctx.none()),
133 entity_decl: MutableObject::new(vm.ctx.none()),
134 buffer_text: MutableObject::new(vm.ctx.new_bool(false).into()),
135 namespace_prefixes: MutableObject::new(vm.ctx.new_bool(false).into()),
136 ordered_attributes: MutableObject::new(vm.ctx.new_bool(false).into()),
137 specified_attributes: MutableObject::new(vm.ctx.new_bool(false).into()),
138 intern: MutableObject::new(intern_dict),
139 // Additional handlers (stubs for compatibility)
140 processing_instruction: MutableObject::new(vm.ctx.none()),
141 unparsed_entity_decl: MutableObject::new(vm.ctx.none()),
142 notation_decl: MutableObject::new(vm.ctx.none()),
143 start_namespace_decl: MutableObject::new(vm.ctx.none()),
144 end_namespace_decl: MutableObject::new(vm.ctx.none()),
145 comment: MutableObject::new(vm.ctx.none()),
146 start_cdata_section: MutableObject::new(vm.ctx.none()),
147 end_cdata_section: MutableObject::new(vm.ctx.none()),
148 default: MutableObject::new(vm.ctx.none()),
149 default_expand: MutableObject::new(vm.ctx.none()),
150 not_standalone: MutableObject::new(vm.ctx.none()),
151 external_entity_ref: MutableObject::new(vm.ctx.none()),
152 start_doctype_decl: MutableObject::new(vm.ctx.none()),
153 end_doctype_decl: MutableObject::new(vm.ctx.none()),
154 xml_decl: MutableObject::new(vm.ctx.none()),
155 element_decl: MutableObject::new(vm.ctx.none()),
156 attlist_decl: MutableObject::new(vm.ctx.none()),
157 skipped_entity: MutableObject::new(vm.ctx.none()),
158 }
159 .into_ref(&vm.ctx))
160 }
161
162 #[extend_class]
163 fn extend_class_with_fields(ctx: &Context, class: &'static Py<PyType>) {

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
new_dictMethod · 0.80
noneMethod · 0.80
into_refMethod · 0.45
new_boolMethod · 0.45

Tested by

no test coverage detected