Code Monkey home page Code Monkey logo

Comments (1)

mk-fg avatar mk-fg commented on May 28, 2024

Yeah, it's a feature in this module, and not in YAML format itself.

See https://github.com/mk-fg/pretty-yaml/#warning - which is the first section of the README that says:

Warning

Prime goal of this module is to produce human-readable output that can be easily
manipulated and re-used, but maybe with some occasional caveats.

One good example of such "caveat" is that e.g. {'foo': '123'} will serialize to
foo: 123, which for PyYAML would be a bug, as 123 will then be read back as an
integer from that, but here it's a feature.

So please do not rely on the thing to produce output that can always be
deserialized exactly to what was exported, at least - use PyYAML (e.g. with
options from the next section) for that.

There a plenty of such cases here, which I occasionally fix, but it'll never be safe to use this output for serialization purposes.

You can use regular pyyaml module for that though, as far as I know that module is designed to produce correct output, regardless of how it looks.
Iirc there should be some option suggestions for making its output nicer in the README too.

from pretty-yaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.