(filename: &Py<PyStr>, vm: &VirtualMachine)
| 247 | } |
| 248 | |
| 249 | fn 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 |