summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--anchor.py14
-rw-r--r--comments.py18
2 files changed, 18 insertions, 14 deletions
diff --git a/anchor.py b/anchor.py
new file mode 100644
index 0000000..e1b5432
--- /dev/null
+++ b/anchor.py
@@ -0,0 +1,14 @@
+
+
+
+anchor_attrib = '_yaml_anchor'
+
+class Anchor(object):
+ __slots__ = 'value', 'always_dump'
+ attrib = anchor_attrib
+
+ def __init__(self):
+ # type: () -> None
+ self.value = None
+ self.always_dump = False
+
diff --git a/comments.py b/comments.py
index 02a98b5..7048772 100644
--- a/comments.py
+++ b/comments.py
@@ -14,6 +14,7 @@ import copy
from ruamel.yaml.compat import ordereddict, PY2, string_types, MutableSliceableSequence
from ruamel.yaml.scalarstring import ScalarString
+from ruamel.yaml.anchor import Anchor
if PY2:
from collections import MutableSet, Sized, Set, MutableMapping, Mapping
@@ -24,15 +25,14 @@ if False: # MYPY
from typing import Any, Dict, Optional, List, Union, Optional, Iterator # NOQA
# fmt: off
-__all__ = ["CommentedSeq", "CommentedKeySeq",
- "CommentedMap", "CommentedOrderedMap",
- "CommentedSet", 'comment_attrib', 'merge_attrib']
+__all__ = ['CommentedSeq', 'CommentedKeySeq',
+ 'CommentedMap', 'CommentedOrderedMap',
+ 'CommentedSet', 'comment_attrib', 'merge_attrib']
# fmt: on
comment_attrib = '_yaml_comment'
format_attrib = '_yaml_format'
line_col_attrib = '_yaml_line_col'
-anchor_attrib = '_yaml_anchor'
merge_attrib = '_yaml_merge'
tag_attrib = '_yaml_tag'
@@ -163,16 +163,6 @@ class LineCol(object):
self.data[key] = data
-class Anchor(object):
- __slots__ = 'value', 'always_dump'
- attrib = anchor_attrib
-
- def __init__(self):
- # type: () -> None
- self.value = None
- self.always_dump = False
-
-
class Tag(object):
"""store tag information for roundtripping"""