| """Internal mutation token. Only pixel_cursor.* should import this module.""" | |
| from __future__ import annotations | |
| class _Token: | |
| __slots__ = () | |
| def __repr__(self) -> str: | |
| return "<pixel_cursor mutation token>" | |
| _MUTATION_TOKEN = _Token() | |
| def _verify(token: object) -> None: | |
| if token is not _MUTATION_TOKEN: | |
| raise PermissionError( | |
| "Artifact construction requires the pixel_cursor mutation token. " | |
| "All Artifact creation and mutation must go through a PixelCursor " | |
| "(see pixel_cursor.open_cursor and cursor.write_* methods)." | |
| ) | |