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

Make default_flow_style=False #256

Closed
wants to merge 1 commit into from

Conversation

@perlpunk
Copy link
Member

@perlpunk perlpunk commented Feb 23, 2019

See #199

False will output block style always.
True will output flow style always.
None will output flow style only for the collections which consists
only of scalars.

data = dict( a=dict(aa=dict(aaa = ['x','y']), ab=42) )
print( yaml.dump( data ) )
print( yaml.dump( data, default_flow_style=True ) )
print( yaml.dump( data, default_flow_style=False ) )
print( yaml.dump( data, default_flow_style=None ) )

Output:

a:
  aa:
    aaa:
    - x
    - y
  ab: 42

{a: {aa: {aaa: [x, y]}, ab: 42}}

a:
  aa:
    aaa:
    - x
    - y
  ab: 42

a:
  aa:
    aaa: [x, y]
  ab: 42
@ingydotnet ingydotnet added this to To Do in 5.1 Release Feb 23, 2019
@ingydotnet ingydotnet moved this from Possible PRs and To Do items to Added to release/5/1 branch in 5.1 Release Feb 23, 2019
@perlpunk
Copy link
Member Author

@perlpunk perlpunk commented Mar 14, 2019

merged in 507a464

Loading

@perlpunk perlpunk closed this Mar 14, 2019
@perlpunk perlpunk deleted the perlpunk/default_flow_style branch Mar 18, 2019
ggould-tri added a commit to ggould-tri/drake that referenced this issue Jun 11, 2020
* pyyaml changed its default flow semantics in yaml/pyyaml#256
* We must override the default with the magic tribool value `None`
* Fixes 13541
ggould-tri added a commit to ggould-tri/drake that referenced this issue Jun 11, 2020
* pyyaml changed its default flow semantics in yaml/pyyaml#256
* We must override the default with the magic tribool value `None`
* Fixes 13541
ggould-tri added a commit to ggould-tri/drake that referenced this issue Jun 11, 2020
* pyyaml changed its default flow semantics in yaml/pyyaml#256
* We must override the default with the magic tribool value `None`
* Fixes RobotLocomotion#13541
ggould-tri added a commit to ggould-tri/drake that referenced this issue Jun 12, 2020
* pyyaml changed its default flow semantics in yaml/pyyaml#256
* We must override the default with the magic tribool value `None`
* Fixes RobotLocomotion#13541
ggould-tri added a commit to RobotLocomotion/drake that referenced this issue Jun 15, 2020
* Force older and newer yaml.dump to give the same output

* pyyaml changed its default flow semantics in yaml/pyyaml#256
* We must override the default with the magic tribool value `None`
* Fixes #13541
Totktonada added a commit to tarantool/test-run that referenced this issue Sep 14, 2020
Set flow style (JSON-like) explicitly instead of block style to don't
break indentation.

Before the patch (incorrect):

 | - - app-tap/iconv.test.lua
 | - null

After the patch:

 | - [app-tap/iconv.test.lua, null]

The default was changed in [1].

[1]: yaml/pyyaml#256
Totktonada added a commit to tarantool/test-run that referenced this issue Sep 14, 2020
Set flow style (JSON-like) explicitly instead of block style to don't
break indentation.

Before the patch (incorrect):

 | - - app-tap/iconv.test.lua
 | - null

After the patch:

 | - [app-tap/iconv.test.lua, null]

The default was changed in [1].

[1]: yaml/pyyaml#256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
5.1 Release
Added to release/5/1 branch
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant