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

Function normalize_module

crates/vm/src/warn.rs:249–257  ·  view source on GitHub ↗
(filename: &Py<PyStr>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

247}
248
249fn normalize_module(filename: &Py<PyStr>, vm: &VirtualMachine) -> PyObjectRef {
250 match filename.byte_len() {
251 0 => vm.new_pyobj("<unknown>"),
252 len if len >= 3 && filename.as_bytes().ends_with(b".py") => {
253 vm.new_pyobj(&filename.as_wtf8()[..len - 3])
254 }
255 _ => filename.as_object().to_owned(),
256 }
257}
258
259/// Search the global filters list for a matching action.
260// TODO: split into filter_search() + get_filter() and support

Callers 1

warn_explicitFunction · 0.85

Calls 7

new_pyobjMethod · 0.80
ends_withMethod · 0.80
byte_lenMethod · 0.45
as_bytesMethod · 0.45
as_wtf8Method · 0.45
to_ownedMethod · 0.45
as_objectMethod · 0.45

Tested by

no test coverage detected