| 1589 | yield decl |
| 1590 | |
| 1591 | def _add_decl(self, decl, key=None): |
| 1592 | if key: |
| 1593 | if type(key) not in (str, tuple): |
| 1594 | raise NotImplementedError((key, decl)) |
| 1595 | # Any partial key will be turned into a full key, but that |
| 1596 | # same partial key will still match a key lookup. |
| 1597 | resolved, _ = self._resolve_key(key) |
| 1598 | if not resolved[2]: |
| 1599 | raise ValueError(f'expected name in key, got {key!r}') |
| 1600 | key = resolved |
| 1601 | # XXX Also add with the decl-derived key if not the same? |
| 1602 | else: |
| 1603 | key, _ = self._resolve_key(decl) |
| 1604 | self._decls[key] = decl |
| 1605 | |
| 1606 | def _extend(self, decls): |
| 1607 | decls = iter(decls) |