Skip to content

Make default_flow_style=False#256

Closed
perlpunk wants to merge 1 commit intoyaml:masterfrom
perlpunk:perlpunk/default_flow_style
Closed

Make default_flow_style=False#256
perlpunk wants to merge 1 commit intoyaml:masterfrom
perlpunk:perlpunk/default_flow_style

Conversation

@perlpunk
Copy link
Copy Markdown
Member

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

@perlpunk
Copy link
Copy Markdown
Member Author

merged in 507a464

@perlpunk perlpunk closed this Mar 14, 2019
@perlpunk perlpunk deleted the perlpunk/default_flow_style branch March 18, 2019 19:10
ggould-tri added a commit to ggould-tri/drake that referenced this pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants