Create a `(text, category)` or `(text, category, 0)` key and record it in the registry via `already_warned`.
(
registry: &PyObject,
text: &PyObject,
category: &PyObject,
add_zero: bool,
vm: &VirtualMachine,
)
| 224 | /// Create a `(text, category)` or `(text, category, 0)` key and record |
| 225 | /// it in the registry via `already_warned`. |
| 226 | fn update_registry( |
| 227 | registry: &PyObject, |
| 228 | text: &PyObject, |
| 229 | category: &PyObject, |
| 230 | add_zero: bool, |
| 231 | vm: &VirtualMachine, |
| 232 | ) -> PyResult<bool> { |
| 233 | let altkey: PyObjectRef = if add_zero { |
| 234 | PyTuple::new_ref( |
| 235 | vec![ |
| 236 | text.to_owned(), |
| 237 | category.to_owned(), |
| 238 | vm.ctx.new_int(0).into(), |
| 239 | ], |
| 240 | &vm.ctx, |
| 241 | ) |
| 242 | .into() |
| 243 | } else { |
| 244 | PyTuple::new_ref(vec![text.to_owned(), category.to_owned()], &vm.ctx).into() |
| 245 | }; |
| 246 | already_warned(registry, altkey, true, vm) |
| 247 | } |
| 248 | |
| 249 | fn normalize_module(filename: &Py<PyStr>, vm: &VirtualMachine) -> PyObjectRef { |
| 250 | match filename.byte_len() { |
no test coverage detected