Ticket #91 (reopened enhancement)

Opened 3 years ago

Last modified 3 weeks ago

emit no anchors and aliases

Reported by: Andrey Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc: w@…

Description

Hi, is it possible to avoid using anchors and aliases? So to output

[1, 1]

as

- 1
- 1

and not as

- &id1 1
- *id1

Attachments

Change History

Changed 3 years ago by xi

  • status changed from new to closed
  • resolution set to worksforme

It works for me:

>>> import yaml
>>> print yaml.dump([1,1], default_flow_style=False)
- 1
- 1

Could you post a code snippet that produces the output with aliases?

Changed 21 months ago by iand@…

  • status changed from closed to reopened
  • resolution worksforme deleted

I can reproduce this with the following input, regardless of flow style. Having the option to disable anchors & aliases would be extremely handy for me.

import yaml print yaml.dump([1L, 1L])

Changed 6 months ago by anonymous

+1 - yaml loses a lot of usefulness when it isn't human readable, and having hundreds of aliases in a document with names like id001 is hard for me to parse.

Changed 3 weeks ago by w@…

  • cc w@… added

This is actually really easy, it's just not documented:

class CustomDumper?(SafeDumper?):

A custom YAML dumper that never emits aliases"

def ignore_aliases(self, _data):

return True

Can this please be documented?

Add/Change #91 (emit no anchors and aliases)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as reopened
as The resolution will be set. Next status will be 'closed'
to The owner will change from xi. Next status will be 'new'
 
Note: See TracTickets for help on using tickets.