anchor.py 500 B

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