11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
33#
4- # Copyright (c) 2017-2023 - Chris Griffith - MIT License
4+ # Copyright (c) 2017-2026 - Chris Griffith - MIT License
55import copy
66import re
77from os import PathLike
@@ -98,7 +98,7 @@ def __setitem__(self, key, value):
9898 self .extend ([None ] * (pos - len (self ) + 1 ))
9999 if len (list_pos .group ()) == len (key ):
100100 return super ().__setitem__ (pos , value )
101- children = key [len (list_pos .group ()):].lstrip ("." )
101+ children = key [len (list_pos .group ()) :].lstrip ("." )
102102 if self .box_options .get ("default_box" ):
103103 if children [0 ] == "[" :
104104 super ().__setitem__ (pos , box .BoxList (** self .box_options ))
@@ -258,6 +258,7 @@ def to_yaml(
258258 default_flow_style : bool = False ,
259259 encoding : str = "utf-8" ,
260260 errors : str = "strict" ,
261+ width : int = 120 ,
261262 ** yaml_kwargs ,
262263 ):
263264 """
@@ -267,6 +268,7 @@ def to_yaml(
267268 :param default_flow_style: False will recursively dump dicts
268269 :param encoding: File encoding
269270 :param errors: How to handle encoding errors
271+ :param width: Line width for YAML output
270272 :param yaml_kwargs: additional arguments to pass to yaml.dump
271273 :return: string of YAML or return of `yaml.dump`
272274 """
@@ -276,6 +278,7 @@ def to_yaml(
276278 default_flow_style = default_flow_style ,
277279 encoding = encoding ,
278280 errors = errors ,
281+ width = width ,
279282 ** yaml_kwargs ,
280283 )
281284
@@ -318,6 +321,7 @@ def to_yaml(
318321 default_flow_style : bool = False ,
319322 encoding : str = "utf-8" ,
320323 errors : str = "strict" ,
324+ width : int = 120 ,
321325 ** yaml_kwargs ,
322326 ):
323327 raise BoxError ('yaml is unavailable on this system, please install the "ruamel.yaml" or "PyYAML" package' )
0 commit comments