| 647 | |
| 648 | # Implements the Mapping protocol without explicitly inheriting from collections.abc.Mapping. |
| 649 | class BareMappingLike: |
| 650 | def __init__(self, **kwargs): |
| 651 | self.data = dict(kwargs) |
| 652 | |
| 653 | def __len__(self): |
| 654 | return len(self.data) |
| 655 | |
| 656 | def __getitem__(self, key): |
| 657 | return self.data[key] |
| 658 | |
| 659 | def __iter__(self): |
| 660 | yield from self.data |
| 661 | |
| 662 | # Implements the Mapping protocol by reusing BareMappingLike's implementation. |
| 663 | # Additionally, inherits from collections.abc.Mapping. |
no outgoing calls