Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added flag to ignore aliases/anchors #104

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/yaml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def dump_all(documents, stream=None, Dumper=Dumper,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding='utf-8', explicit_start=None, explicit_end=None,
version=None, tags=None):
version=None, tags=None, ignore_aliases=None):
"""
Serialize a sequence of Python objects into a YAML stream.
If stream is None, return the produced string instead.
Expand All @@ -192,6 +192,11 @@ def dump_all(documents, stream=None, Dumper=Dumper,
allow_unicode=allow_unicode, line_break=line_break,
encoding=encoding, version=version, tags=tags,
explicit_start=explicit_start, explicit_end=explicit_end)

# ignore aliases/anchors if flag is set
if ignore_aliases:
dumper.ignore_aliases = lambda x: True

try:
dumper.open()
for data in documents:
Expand Down
7 changes: 6 additions & 1 deletion lib3/yaml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def dump_all(documents, stream=None, Dumper=Dumper,
canonical=None, indent=None, width=None,
allow_unicode=None, line_break=None,
encoding=None, explicit_start=None, explicit_end=None,
version=None, tags=None):
version=None, tags=None, ignore_aliases=None):
"""
Serialize a sequence of Python objects into a YAML stream.
If stream is None, return the produced string instead.
Expand All @@ -190,6 +190,11 @@ def dump_all(documents, stream=None, Dumper=Dumper,
allow_unicode=allow_unicode, line_break=line_break,
encoding=encoding, version=version, tags=tags,
explicit_start=explicit_start, explicit_end=explicit_end)

# ignore aliases/anchors if flag is set
if ignore_aliases:
dumper.ignore_aliases = lambda x: True

try:
dumper.open()
for data in documents:
Expand Down