Take a python dictionary and convert it to attributes.
(&self, vm: &VirtualMachine)
| 648 | |
| 649 | /// Take a python dictionary and convert it to attributes. |
| 650 | pub fn to_attributes(&self, vm: &VirtualMachine) -> PyAttributes { |
| 651 | let mut attrs = PyAttributes::default(); |
| 652 | for (key, value) in self { |
| 653 | let key: PyRefExact<PyStr> = key.downcast_exact(vm).expect("dict has non-string keys"); |
| 654 | attrs.insert(vm.ctx.intern_str(key), value); |
| 655 | } |
| 656 | attrs |
| 657 | } |
| 658 | |
| 659 | pub fn get_item_opt<K: DictKey + ?Sized>( |
| 660 | &self, |
no test coverage detected