(self, other=None, **kwargs)
| 29 | super().__setitem__(key, value) |
| 30 | |
| 31 | def update(self, other=None, **kwargs): |
| 32 | updates = {} |
| 33 | if other: |
| 34 | if isinstance(other, dict): |
| 35 | updates.update(other) |
| 36 | else: |
| 37 | updates.update(dict(other)) |
| 38 | updates.update(kwargs) |
| 39 | |
| 40 | for key, value in updates.items(): |
| 41 | if key not in self.__allowed_keys__: |
| 42 | raise KeyError( |
| 43 | f"Key '{key}' not allowed. Allowed keys: {self.__allowed_keys__}" |
| 44 | ) |
| 45 | if not isinstance(value, int): |
| 46 | raise TypeError( |
| 47 | f"Value for '{key}' must be int, got {type(value).__name__}" |
| 48 | ) |
| 49 | self[key] = self.get(key, 0) + value |
| 50 | |
| 51 | |
| 52 | def concurrent_map( |
no outgoing calls