File size: 604 Bytes
1e3ce4c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """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)."
)
|