anchor.py 439 B

123456789101112131415161718
  1. # coding: utf-8
  2. from typing import Any, Dict, Optional, List, Union, Optional, Iterator # NOQA
  3. anchor_attrib = '_yaml_anchor'
  4. class Anchor:
  5. __slots__ = 'value', 'always_dump'
  6. attrib = anchor_attrib
  7. def __init__(self) -> None:
  8. self.value = None
  9. self.always_dump = False
  10. def __repr__(self) -> Any:
  11. ad = ', (always dump)' if self.always_dump else ""
  12. return f'Anchor({self.value!r}{ad})'