1# Change Log 2# All notable changes to this project will be documented in this file. 3# This project adheres to [Semantic Versioning](http://semver.org/). 4 5## (0.41.0) UNRELEASED 6### Added 7- New `DISABLE_SPLIT_LIST_WITH_COMMENT` flag. 8 `DISABLE_SPLIT_LIST_WITH_COMMENT` is a new knob that changes the 9 behavior of splitting a list when a comment is present inside the list. 10 11 Before, we split a list containing a comment just like we split a list 12 containing a trailing comma: Each element goes on its own line (unless 13 `DISABLE_ENDING_COMMA_HEURISTIC` is true). 14 15 This new flag allows you to control the behavior of a list with a comment 16 *separately* from the behavior when the list contains a trailing comma. 17 18 This mirrors the behavior of clang-format, and is useful for e.g. forming 19 "logical groups" of elements in a list. 20 21 Without this flag: 22 23 ``` 24 [ 25 a, 26 b, # 27 c 28 ] 29 ``` 30 31 With this flag: 32 33 ``` 34 [ 35 a, b, # 36 c 37 ] 38 ``` 39 40 Before we had one flag that controlled two behaviors. 41 42 - `DISABLE_ENDING_COMMA_HEURISTIC=false` (default): 43 - Split a list that has a trailing comma. 44 - Split a list that contains a comment. 45 - `DISABLE_ENDING_COMMA_HEURISTIC=true`: 46 - Don't split on trailing comma. 47 - Don't split on comment. 48 49 Now we have two flags. 50 51 - `DISABLE_ENDING_COMMA_HEURISTIC=false` and `DISABLE_SPLIT_LIST_WITH_COMMENT=false` (default): 52 - Split a list that has a trailing comma. 53 - Split a list that contains a comment. 54 Behavior is unchanged from the default before. 55 - `DISABLE_ENDING_COMMA_HEURISTIC=true` and `DISABLE_SPLIT_LIST_WITH_COMMENT=false` : 56 - Don't split on trailing comma. 57 - Do split on comment. **This is a change in behavior from before.** 58 - `DISABLE_ENDING_COMMA_HEURISTIC=false` and `DISABLE_SPLIT_LIST_WITH_COMMENT=true` : 59 - Split on trailing comma. 60 - Don't split on comment. 61 - `DISABLE_ENDING_COMMA_HEURISTIC=true` and `DISABLE_SPLIT_LIST_WITH_COMMENT=true` : 62 - Don't split on trailing comma. 63 - Don't split on comment. 64 **You used to get this behavior just by setting one flag, but now you have to set both.** 65 66 Note the behavioral change above; if you set 67 `DISABLE_ENDING_COMMA_HEURISTIC=true` and want to keep the old behavior, you 68 now also need to set `DISABLE_SPLIT_LIST_WITH_COMMENT=true`. 69### Changes 70- Remove dependency on importlib-metadata 71- Remove dependency on tomli when using >= py311 72- Format '.pyi' type sub files. 73### Fixed 74- Fix SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED for one-item named argument lists 75 by taking precedence over SPLIT_BEFORE_NAMED_ASSIGNS. 76- Fix SPLIT_ALL_COMMA_SEPARATED_VALUES and SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES 77 being too agressive for lambdas and unpacking. 78 79## [0.40.2] 2023-09-22 80### Changes 81- The verification module has been removed. NOTE: this changes the public APIs 82 by removing the "verify" parameter. 83- Changed FORCE_MULTILINE_DICT to override SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES. 84- Adopt pyproject.toml (PEP 517) for build system 85### Fixed 86- Do not treat variables named `match` as the match keyword. 87- Fix SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED for one-item argument lists. 88- Fix trailing backslash-newline on Windows when using stdin. 89 90## [0.40.1] 2023-06-20 91### Fixed 92- Corrected bad distribution v0.40.0 package. 93 94## [0.40.0] 2023-06-13 [YANKED - [#1107](https://github.com/google/yapf/issues/1107)] 95### Added 96- Support for Python 3.11 97- Add the `--print-modified` flag to print out file names of modified files when 98 running in in-place mode. 99### Changes 100- Replace the outdated and no-longer-supported lib2to3 with a fork of blib2to3, 101 Black's version of lib2to3. 102### Removed 103- Support for Python versions < 3.7 are no longer supported. 104 105## [0.33.0] 2023-04-18 [YANKED - [#1154](https://github.com/google/yapf/issues/1154)] 106### Added 107- Add a new Python parser to generate logical lines. 108- Added support for `# fmt: on` and `# fmt: off` pragmas. 109### Changes 110- Moved 'pytree' parsing tools into its own subdirectory. 111- Add support for Python 3.10. 112- Format generated dicts with respect to same rules as regular dicts 113- Generalized the ending comma heuristic to subscripts. 114- Supports "pyproject.toml" by default. 115### Fixed 116- Split line before all comparison operators. 117 118## [0.32.0] 2021-12-26 119### Added 120- Look at the 'pyproject.toml' file to see if it contains ignore file information 121 for YAPF. 122- New entry point `yapf_api.FormatTree` for formatting lib2to3 concrete 123 syntax trees. 124- Add CI via GitHub Actions. 125### Changes 126- Change tests to support "pytest". 127- Reformat so that "flake8" is happy. 128- Use GitHub Actions instead of Travis for CI. 129- Clean up the FormatToken interface to limit how much it relies upon the 130 pytree node object. 131- Rename "unwrapped_line" module to "logical_line." 132- Rename "UnwrappedLine" class to "LogicalLine." 133### Fixed 134- Added pyproject extra to install toml package as an optional dependency. 135- Enable `BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF` knob for "pep8" style, so 136 method definitions inside a class are surrounded by a single blank line as 137 prescribed by PEP8. 138- Fixed the '...' token to be spaced after a colon. 139 140## [0.31.0] 2021-03-14 141### Added 142- Renamed 'master' branch to 'main'. 143- Add 'BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES' to support setting 144 a custom number of blank lines between top-level imports and variable 145 definitions. 146- Ignore end of line `# copybara:` directives when checking line length. 147- Look at the 'pyproject.toml' file to see if it contains style information for 148 YAPF. 149### Changed 150- Do not scan excluded directories. Prior versions would scan an excluded 151 folder then exclude its contents on a file by file basis. Preventing the 152 folder being scanned is faster. 153### Fixed 154- Exclude directories on Windows. 155 156## [0.30.0] 2020-04-23 157### Added 158- Added `SPACES_AROUND_LIST_DELIMITERS`, `SPACES_AROUND_DICT_DELIMITERS`, 159 and `SPACES_AROUND_TUPLE_DELIMITERS` to add spaces after the opening- 160 and before the closing-delimiters for lists, dicts, and tuples. 161- Adds `FORCE_MULTILINE_DICT` knob to ensure dictionaries always split, 162 even when shorter than the max line length. 163- New knob `SPACE_INSIDE_BRACKETS` to add spaces inside brackets, braces, and 164 parentheses. 165- New knob `SPACES_AROUND_SUBSCRIPT_COLON` to add spaces around the subscript / 166 slice operator. 167### Changed 168- Renamed "chromium" style to "yapf". Chromium will now use PEP-8 directly. 169- `CONTINUATION_ALIGN_STYLE` with `FIXED` or `VALIGN-RIGHT` now works with 170 space indentation. 171### Fixed 172- Honor a disable directive at the end of a multiline comment. 173- Don't require splitting before comments in a list when 174 `SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES` is set. The knob is meant for 175 values, not comments, which may be associated with the current line. 176- Don't over-indent a parameter list when not needed. But make sure it is 177 properly indented so that it doesn't collide with the lines afterwards. 178- Don't split between two-word comparison operators: "is not", "not in", etc. 179 180## [0.29.0] 2019-11-28 181### Added 182- Add the `--quiet` flag to suppress output. The return code is 1 if there are 183 changes, similarly to the `--diff` flag. 184- Add the `indent_closing_brackets` option. This is the same as the 185 `dedent_closing_brackets` option except the brackets are indented the same 186 as the previous line. 187### Changed 188- Collect a parameter list into a single object. This allows us to track how a 189 parameter list is formatted, keeping state along the way. This helps when 190 supporting Python 3 type annotations. 191- Catch and report `UnicodeDecodeError` exceptions. 192- Improved description of .yapfignore syntax. 193### Fixed 194- Format subscript lists so that splits are essentially free after a comma. 195- Don't add a space between a string and its subscript. 196- Extend discovery of '.style.yapf' & 'setup.cfg' files to search the root 197 directory as well. 198- Make sure we have parameters before we start calculating penalties for 199 splitting them. 200- Indicate if a class/function is nested to ensure blank lines when needed. 201- Fix extra indentation in async-for else statement. 202- A parameter list with no elements shouldn't count as exceeding the column 203 limit. 204- When splitting all comma separated values, don't treat the ending bracket as 205 special. 206- The "no blank lines between nested classes or functions" knob should only 207 apply to the first nested class or function, not all of them. 208 209## [0.28.0] 2019-07-11 210### Added 211- New knob `SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES` is a variation on 212 `SPLIT_ALL_COMMA_SEPARATED_VALUES` in which, if a subexpression with a comma 213 fits in its starting line, then the subexpression is not split (thus avoiding 214 unnecessary splits). 215### Changed 216- Set `INDENT_DICTIONARY_VALUE` for Google style. 217- Set `JOIN_MULTIPLE_LINES = False` for Google style. 218### Fixed 219- `BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF=False` wasn't honored because the 220 number of newlines was erroneously calculated beforehand. 221- Lambda expressions shouldn't have an increased split penalty applied to the 222 'lambda' keyword. This prevents them from being properly formatted when they're 223 arguments to functions. 224- A comment with continuation markers (??) shouldn't mess with the lineno count. 225- Only emit unformatted if the "disable long line" is at the end of the line. 226 Otherwise we could mess up formatting for containers which have them 227 interspersed with code. 228- Fix a potential race condition by using the correct style for opening a file 229 which may not exist. 230 231## [0.27.0] 2019-04-07 232### Added 233- `SPLIT_BEFORE_ARITHMETIC_OPERATOR` splits before an arithmetic operator when 234 set. `SPLIT_PENALTY_ARITHMETIC_OPERATOR` allows you to set the split penalty 235 around arithmetic operators. 236### Changed 237- Catch lib2to3's "TokenError" exception and output a nicer message. 238### Fixed 239- Parse integer lists correctly, removing quotes if the list is within a 240 string. 241- Adjust the penalties of bitwise operands for '&' and '^', similar to '|'. 242- Avoid splitting after opening parens if SPLIT_BEFORE_FIRST_ARGUMENT is set 243 to False. 244- Adjust default SPLIT_PENALTY_AFTER_OPENING_BRACKET. 245- Re-enable removal of extra lines on the boundaries of formatted regions. 246- Adjust list splitting to avoid splitting before a dictionary element, because 247 those are likely to be split anyway. If we do split, it leads to horrible 248 looking code. 249- Dictionary arguments were broken in a recent version. It resulted in 250 unreadable formatting, where the remaining arguments were indented far more 251 than the dictionary. Fixed so that if the dictionary is the first argument in 252 a function call and doesn't fit on a single line, then it forces a split. 253- Improve the connectiveness between items in a list. This prevents random 254 splitting when it's not 100% necessary. 255- Don't remove a comment attached to a previous object just because it's part 256 of the "prefix" of a function/class node. 257 258## [0.26.0] 2019-02-08 259### Added 260- `ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS` allows us to split before 261 default / named assignments. 262- `ARITHMETIC_PRECEDENCE_INDICATION` removes spacing around binary operators 263 if they have higher precedence than other operators in the same expression. 264### Changed 265- `SPACES_BEFORE_COMMENT` can now be assigned to a specific value (standard 266 behavior) or a list of column values. When assigned to a list, trailing 267 comments will be horizontally aligned to the first column value within 268 the list that is greater than the maximum line length in the block. 269- Don't modify the vertical spacing of a line that has a comment "pylint: 270 disable=line-too-long". The line is expected to be too long. 271- improved `CONTINUATION_ALIGN_STYLE` to accept quoted or underline-separated 272 option value for passing option with command line arguments. 273### Fixed 274- When retrieving the opening bracket make sure that it's actually an opening 275 bracket. 276- Don't completely deny a lambda formatting if it goes over the column limit. 277 Split only if absolutely necessary. 278- Bump up penalty for splitting before a dot ('.'). 279- Ignore pseudo tokens when calculating split penalties. 280- Increase the penalty for splitting before the first bit of a subscript. 281- Improve splitting before dictionary values. Look more closely to see if the 282 dictionary entry is a container. If so, then it's probably split over 283 multiple lines with the opening bracket on the same line as the key. 284 Therefore, we shouldn't enforce a split because of that. 285- Increase split penalty around exponent operator. 286- Correct spacing when using binary operators on strings with the 287 `NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS` option enabled. 288 289## [0.25.0] 2018-11-25 290### Added 291- Added `INDENT_BLANK_LINES` knob to select whether the blank lines are empty 292 or indented consistently with the current block. 293- Support additional file exclude patterns in .yapfignore file. 294### Fixed 295- Correctly determine if a scope is the last in line. It avoids a wrong 296 computation of the line end when determining if it must split after the 297 opening bracket with `DEDENT_CLOSING_BRACKETS` enabled. 298 299## [0.24.0] 2018-09-07 300### Added 301- Added 'SPLIT_BEFORE_DOT' knob to support "builder style" calls. The "builder 302 style" option didn't work as advertised. Lines would split after the dots, 303 not before them regardless of the penalties. 304### Changed 305- Support Python 3.7 in the tests. The old "comp_for" and "comp_if" nodes are 306 now "old_comp_for" and "old_comp_if" in lib2to3. 307### Fixed 308- Don't count inner function calls when marking arguments as named assignments. 309- Make sure that tuples and the like are formatted nicely if they all can't fit 310 on a single line. This is similar to how we format function calls within an 311 argument list. 312- Allow splitting in a subscript if it goes over the line limit. 313- Increase the split penalty for an if-expression. 314- Increase penalty for splitting in a subscript so that it's more likely to 315 split in a function call or other data literal. 316- Cloning a pytree node doesn't transfer its a annotations. Make sure we do 317 that so that we don't lose information. 318- Revert change that broke the "no_spaces_around_binary_operators" option. 319- The "--style-help" option would output string lists and sets in Python types. 320 If the output was used as a style, then it wouldn't parse those values 321 correctly. 322 323## [0.23.0] 2018-08-27 324### Added 325- `DISABLE_ENDING_COMMA_HEURISTIC` is a new knob to disable the heuristic which 326 splits a list onto separate lines if the list is comma-terminated. 327### Fixed 328- There's no need to increase N_TOKENS. In fact, it causes other things which 329 use lib2to3 to fail if called from YAPF. 330- Change the exception message instead of creating a new one that's just a 331 clone. 332- Make sure not to reformat when a line is disabled even if the --lines option 333 is specified. 334- The "no spaces around operators" flag wasn't correctly converting strings to 335 sets. Changed the regexp to handle it better. 336 337## [0.22.0] 2018-05-15 338### Added 339- The `BLANK_LINE_BEFORE_MODULE_DOCSTRING` knob adds a blank line before a 340 module's docstring. 341- The `SPLIT_ALL_COMMA_SEPARATED_VALUES` knob causes all lists, tuples, dicts 342 function defs, etc... to split on all values, instead of maximizing the 343 number of elements on each line, when not able to fit on a single line. 344### Changed 345- Improve the heuristic we use to determine when to split at the start of a 346 function call. First check whether or not all elements can fit in the space 347 without wrapping. If not, then we split. 348- Check all of the elements of a tuple. Similarly to how arguments are 349 analyzed. This allows tuples to be split more rationally. 350- Adjust splitting penalties around arithmetic operators so that the code can 351 flow more freely. The code must flow! 352- Try to meld an argument list's closing parenthesis to the last argument. 353### Fixed 354- Attempt to determine if long lambdas are allowed. This can be done on a 355 case-by-case basis with a "pylint" disable comment. 356- A comment before a decorator isn't part of the decorator's line. 357- Only force a new wrapped line after a comment in a decorator when it's the 358 first token in the decorator. 359 360## [0.21.0] 2018-03-18 361### Added 362- Introduce a new option of formatting multiline literals. Add 363 `SPLIT_BEFORE_CLOSING_BRACKET` knob to control whether closing bracket should 364 get their own line. 365- Added `CONTINUATION_ALIGN_STYLE` knob to choose continuation alignment style 366 when `USE_TABS` is enabled. 367- Add 'BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION' knob to control the number 368 of blank lines between top-level function and class definitions. 369### Fixed 370- Don't split ellipses. 371 372## [0.20.2] 2018-02-12 373### Changed 374- Improve the speed at which files are excluded by ignoring them earlier. 375- Allow dictionaries to stay on a single line if they only have one entry 376### Fixed 377- Use tabs when constructing a continuation line when `USE_TABS` is enabled. 378- A dictionary entry may not end in a colon, but may be an "unpacking" 379 operation: `**foo`. Take that into account and don't split after the 380 unpacking operator. 381 382## [0.20.1] 2018-01-13 383### Fixed 384- Don't treat 'None' as a keyword if calling a function on it, like '__ne__()'. 385- use_tabs=True always uses a single tab per indentation level; spaces are 386 used for aligning vertically after that. 387- Relax the split of a paren at the end of an if statement. With 388 `dedent_closing_brackets` option requires that it be able to split there. 389 390## [0.20.0] 2017-11-14 391### Added 392- Improve splitting of comprehensions and generators. Add 393 `SPLIT_PENALTY_COMPREHENSION` knob to control preference for keeping 394 comprehensions on a single line and `SPLIT_COMPLEX_COMPREHENSION` to enable 395 splitting each clause of complex comprehensions onto its own line. 396### Changed 397- Take into account a named function argument when determining if we should 398 split before the first argument in a function call. 399- Split before the first argument in a function call if the arguments contain a 400 dictionary that doesn't fit on a single line. 401- Improve splitting of elements in a tuple. We want to split if there's a 402 function call in the tuple that doesn't fit on the line. 403### Fixed 404- Enforce spaces between ellipses and keywords. 405- When calculating the split penalty for a "trailer", process the child nodes 406 afterwards because their penalties may change. For example if a list 407 comprehension is an argument. 408- Don't enforce a split before a comment after the opening of a container if it 409 doesn't it on the current line. We try hard not to move such comments around. 410- Use a TextIOWrapper when reading from stdin in Python3. This is necessary for 411 some encodings, like cp936, used on Windows. 412- Remove the penalty for a split before the first argument in a function call 413 where the only argument is a generator expression. 414 415## [0.19.0] 2017-10-14 416### Added 417- Added `SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN` that enforces a split 418 after the opening paren of an expression that's surrounded by parens. 419### Changed 420- Split before the ending bracket of a comma-terminated tuple / argument list 421 if it's not a single element tuple / arg list. 422### Fixed 423- Prefer to split after a comma in an argument list rather than in the middle 424 of an argument. 425- A non-multiline string may have newlines if it contains continuation markers 426 itself. Don't add a newline after the string when retaining the vertical 427 space. 428- Take into account the "async" keyword when determining if we must split 429 before the first argument. 430- Increase affinity for "atom" arguments in function calls. This helps prevent 431 lists from being separated when they don't need to be. 432- Don't place a dictionary argument on its own line if it's the last argument 433 in the function call where that function is part of a builder-style call. 434- Append the "var arg" type to a star in a star_expr. 435 436## [0.18.0] 2017-09-18 437### Added 438- Option `ALLOW_SPLIT_BEFORE_DICT_VALUE` allows a split before a value. If 439 False, then it won't be split even if it goes over the column limit. 440### Changed 441- Use spaces around the '=' in a typed name argument to align with 3.6 syntax. 442### Fixed 443- Allow semicolons if the line is disabled. 444- Fix issue where subsequent comments at decreasing levels of indentation 445 were improperly aligned and/or caused output with invalid syntax. 446- Fix issue where specifying a line range removed a needed line before a 447 comment. 448- Fix spacing between unary operators if one is 'not'. 449- Indent the dictionary value correctly if there's a multi-line key. 450- Don't remove needed spacing before a comment in a dict when in "chromium" 451 style. 452- Increase indent for continuation line with same indent as next logical line 453 with 'async with' statement. 454 455## [0.17.0] 2017-08-20 456### Added 457- Option `NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS` prevents adding spaces 458 around selected binary operators, in accordance with the current style guide. 459### Changed 460- Adjust blank lines on formatting boundaries when using the `--lines` option. 461- Return 1 if a diff changed the code. This is in line with how GNU diff acts. 462- Add `-vv` flag to print out file names as they are processed 463### Fixed 464- Corrected how `DEDENT_CLOSING_BRACKETS` and `COALESCE_BRACKETS` interacted. 465- Fix return value to return a boolean. 466- Correct vim plugin not to clobber edited code if yapf returns an error. 467- Ensured comma-terminated tuples with multiple elements are split onto separate lines. 468 469## [0.16.3] 2017-07-13 470### Changed 471- Add filename information to a ParseError exception. 472### Fixed 473- A token that ends in a continuation marker may have more than one newline in 474 it, thus changing its "lineno" value. This can happen if multiple 475 continuation markers are used with no intervening tokens. Adjust the line 476 number to account for the lines covered by those markers. 477- Make sure to split after a comment even for "pseudo" parentheses. 478 479## [0.16.2] 2017-05-19 480### Fixed 481- Treat expansion operators ('*', '**') in a similar way to function calls to 482 avoid splitting directly after the opening parenthesis. 483- Increase the penalty for splitting after the start of a tuple. 484- Increase penalty for excess characters. 485- Check that we have enough children before trying to access them all. 486- Remove trailing whitespaces from comments. 487- Split before a function call in a list if the full list isn't able to fit on 488 a single line. 489- Trying not to split around the '=' of a named assign. 490- Changed split before the first argument behavior to ignore compound 491 statements like if and while, but not function declarations. 492- Changed coalesce brackets not to line split before closing bracket. 493 494## [0.16.1] 2017-03-22 495### Changed 496- Improved performance of cloning the format decision state object. This 497 improved the time in one *large* case from 273.485s to 234.652s. 498- Relax the requirement that a named argument needs to be on one line. Going 499 over the column limit is more of an issue to pylint than putting named args 500 on multiple lines. 501- Don't make splitting penalty decisions based on the original formatting. This 502 can and does lead to non-stable formatting, where yapf will reformat the same 503 code in different ways. 504### Fixed 505- Ensure splitting of arguments if there's a named assign present. 506- Prefer to coalesce opening brackets if it's not at the beginning of a 507 function call. 508- Prefer not to squish all of the elements in a function call over to the 509 right-hand side. Split the arguments instead. 510- We need to split a dictionary value if the first element is a comment anyway, 511 so don't force the split here. It's forced elsewhere. 512- Ensure tabs are used for continued indentation when USE_TABS is True. 513 514## [0.16.0] 2017-02-05 515### Added 516- The `EACH_DICT_ENTRY_ON_SEPARATE_LINE` knob indicates that each dictionary 517 entry should be in separate lines if the full dictionary isn't able to fit on 518 a single line. 519- The `SPLIT_BEFORE_DICT_SET_GENERATOR` knob splits before the `for` part of a 520 dictionary/set generator. 521- The `BLANK_LINE_BEFORE_CLASS_DOCSTRING` knob adds a blank line before a 522 class's docstring. 523- The `ALLOW_MULTILINE_DICTIONARY_KEYS` knob allows dictionary keys to span 524 more than one line. 525### Fixed 526- Split before all entries in a dict/set or list maker when comma-terminated, 527 even if there's only one entry. 528- Will now try to set O_BINARY mode on stdout under Windows and Python 2. 529- Avoid unneeded newline transformation when writing formatted code to 530 output on (affects only Python 2) 531 532## [0.15.2] 2017-01-29 533### Fixed 534- Don't perform a global split when a named assign is part of a function call 535 which itself is an argument to a function call. I.e., don't cause 'a' to 536 split here: 537 538 func(a, b, c, d(x, y, z=42)) 539- Allow splitting inside a subscript if it's a logical or bitwise operating. 540 This should keep the subscript mostly contiguous otherwise. 541 542## [0.15.1] 2017-01-21 543### Fixed 544- Don't insert a space between a type hint and the '=' sign. 545- The '@' operator can be used in Python 3 for matrix multiplication. Give the 546 '@' in the decorator a DECORATOR subtype to distinguish it. 547- Encourage the formatter to split at the beginning of an argument list instead 548 of in the middle. Especially if the middle is an empty parameter list. This 549 adjusts the affinity of binary and comparison operators. In particular, the 550 "not in" and other such operators don't want to have a split after it (or 551 before it) if at all possible. 552 553## [0.15.0] 2017-01-12 554### Added 555- Keep type annotations intact as much as possible. Don't try to split the over 556 multiple lines. 557### Fixed 558- When determining if each element in a dictionary can fit on a single line, we 559 are skipping dictionary entries. However, we need to ignore comments in our 560 calculations and implicitly concatenated strings, which are already placed on 561 separate lines. 562- Allow text before a "pylint" comment. 563- Also allow text before a "yapf: (disable|enable)" comment. 564 565## [0.14.0] 2016-11-21 566### Added 567- formatting can be run in parallel using the "-p" / "--parallel" flags. 568### Fixed 569- "not in" and "is not" should be subtyped as binary operators. 570- A non-Node dictionary value may have a comment before it. In those cases, we 571 want to avoid encompassing only the comment in pseudo parens. So we include 572 the actual value as well. 573- Adjust calculation so that pseudo-parentheses don't count towards the total 574 line length. 575- Don't count a dictionary entry as not fitting on a single line in a 576 dictionary. 577- Don't count pseudo-parentheses in the length of the line. 578 579## [0.13.2] 2016-10-22 580### Fixed 581- REGRESSION: A comment may have a prefix with newlines in it. When calculating 582 the prefix indent, we cannot take the newlines into account. Otherwise, the 583 comment will be misplaced causing the code to fail. 584 585## [0.13.1] 2016-10-17 586### Fixed 587- Correct emitting a diff that was accidentally removed. 588 589## [0.13.0] 2016-10-16 590### Added 591- Added support to retain the original line endings of the source code. 592 593### Fixed 594- Functions or classes with comments before them were reformatting the comments 595 even if the code was supposed to be ignored by the formatter. We now don't 596 adjust the whitespace before a function's comment if the comment is a 597 "disabled" line. We also don't count "# yapf: {disable|enable}" as a disabled 598 line, which seems logical. 599- It's not really more readable to split before a dictionary value if it's part 600 of a dictionary comprehension. 601- Enforce two blank lines after a function or class definition, even before a 602 comment. (But not between a decorator and a comment.) This is related to PEP8 603 error E305. 604- Remove O(n^2) algorithm from the line disabling logic. 605 606## [0.12.2] 2016-10-09 607### Fixed 608- If `style.SetGlobalStyle(<create pre-defined style>)` was called and then 609 `yapf_api.FormatCode` was called, the style set by the first call would be 610 lost, because it would return the style created by `DEFAULT_STYLE_FACTORY`, 611 which is set to PEP8 by default. Fix this by making the first call set which 612 factory we call as the "default" style. 613- Don't force a split before non-function call arguments. 614- A dictionary being used as an argument to a function call and which can exist 615 on a single line shouldn't be split. 616- Don't rely upon the original line break to determine if we should split 617 before the elements in a container. Especially split if there's a comment in 618 the container. 619- Don't add spaces between star and args in a lambda expression. 620- If a nested data structure terminates in a comma, then split before the first 621 element, but only if there's more than one element in the list. 622 623## [0.12.1] 2016-10-02 624### Changed 625- Dictionary values will be placed on the same line as the key if *all* of the 626 elements in the dictionary can be placed on one line. Otherwise, the 627 dictionary values will be placed on the next line. 628 629### Fixed 630- Prefer to split before a terminating r-paren in an argument list if the line 631 would otherwise go over the column limit. 632- Split before the first key in a dictionary if the dictionary cannot fit on a 633 single line. 634- Don't count "pylint" comments when determining if the line goes over the 635 column limit. 636- Don't count the argument list of a lambda as a named assign in a function 637 call. 638 639## [0.12.0] 2016-09-25 640### Added 641- Support formatting of typed names. Typed names are formatted a similar way to 642 how named arguments are formatted, except that there's a space after the 643 colon. 644- Add a knob, 'SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN', to allow adding spaces 645 around the assign operator on default or named assigns. 646 647## Changed 648- Turn "verification" off by default for external APIs. 649- If a function call in an argument list won't fit on the current line but will 650 fit on a line by itself, then split before the call so that it won't be split 651 up unnecessarily. 652 653## Fixed 654- Don't add space after power operator if the next operator's a unary operator. 655 656## [0.11.1] 2016-08-17 657### Changed 658- Issue #228: Return exit code 0 on success, regardless of whether files were 659 changed. (Previously, 0 meant success with no files 660 modified, and 2 meant success with at least one file modified.) 661 662### Fixed 663- Enforce splitting each element in a dictionary if comma terminated. 664- It's okay to split in the middle of a dotted name if the whole expression is 665 going to go over the column limit. 666- Asynchronous functions were going missing if they were preceded by a comment 667 (a what? exactly). The asynchronous function processing wasn't taking the 668 comment into account and thus skipping the whole function. 669- The splitting of arguments when comma terminated had a conflict. The split 670 penalty of the closing bracket was set to the maximum, but it shouldn't be if 671 the closing bracket is preceded by a comma. 672 673## [0.11.0] 2016-07-17 674### Added 675- The COALESCE_BRACKETS knob prevents splitting consecutive brackets when 676 DEDENT_CLOSING_BRACKETS is set. 677- Don't count "pylint" directives as exceeding the column limit. 678 679### Changed 680- We split all of the arguments to a function call if there's a named argument. 681 In this case, we want to split after the opening bracket too. This makes 682 things look a bit better. 683 684### Fixed 685- When retaining format of a multiline string with Chromium style, make sure 686 that the multiline string doesn't mess up where the following comma ends up. 687- Correct for when 'lib2to3' smooshes comments together into the same DEDENT 688 node. 689 690## [0.10.0] 2016-06-14 691### Added 692- Add a knob, 'USE_TABS', to allow using tabs for indentation. 693 694### Changed 695- Performance enhancements. 696 697### Fixed 698- Don't split an import list if it's not surrounded by parentheses. 699 700## [0.9.0] 2016-05-29 701### Added 702- Added a knob (SPLIT_PENALTY_BEFORE_IF_EXPR) to adjust the split penalty 703 before an if expression. This allows the user to place a list comprehension 704 all on one line. 705- Added a knob (SPLIT_BEFORE_FIRST_ARGUMENT) that encourages splitting before 706 the first element of a list of arguments or parameters if they are going to 707 be split anyway. 708- Added a knob (SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED) splits arguments to a 709 function if the list is terminated by a comma. 710 711### Fixed 712- Don't split before a first element list argument as we would before a first 713 element function call. 714- Don't penalize when we must split a line. 715- Allow splitting before the single argument in a function call. 716 717## [0.8.2] 2016-05-21 718### Fixed 719- Prefer not to split after the opening of a subscript. 720- Don't add space before the 'await' keyword if it's preceded by an opening 721 paren. 722- When we're setting the split penalty for a continuous list, we don't want to 723 mistake a comment at the end of that list as part of the list. 724- When calculating blank lines, don't assume the last seen object was a class 725 or function when we're in a class or function. 726- Don't count the closing scope when determining if the current scope is the 727 last scope on the line. 728 729## [0.8.1] 2016-05-18 730### Fixed 731- 'SPLIT_BEFORE_LOGICAL_OPERATOR' wasn't working correctly. The penalty was 732 being set incorrectly when it was part of a larger construct. 733- Don't separate a keyword, like "await", from a left paren. 734- Don't rely upon the original tokens' line number to determine if we should 735 perform splitting in Facebook mode. The line number isn't the line number of 736 the reformatted token, but the line number where it was in the original code. 737 Instead, we need to carefully determine if the line is liabel to be split and 738 act accordingly. 739 740## [0.8.0] 2016-05-10 741### Added 742- Add a knob, 'SPACES_AROUND_POWER_OPERATOR', to allow adding spaces around the 743 power operator. 744 745### Fixed 746- There shouldn't be a space between a decorator and an intervening comment. 747- If we split before a bitwise operator, then we assume that the programmer 748 knows what they're doing, more or less, and so we enforce a split before said 749 operator if one exists in the original program. 750- Strengthen the bond between a keyword and value argument. 751- Don't add a blank line after a multiline string. 752- If the "for" part of a list comprehension can exist on the starting line 753 without going over the column limit, then let it remain there. 754 755## [0.7.1] 2016-04-21 756### Fixed 757- Don't rewrite the file if there are no changes. 758- Ensure the proper number of blank lines before an async function. 759- Split after a bitwise operator when in PEP 8 mode. 760- Retain the splitting within a dictionary data literal between the key and 761 value. 762- Try to keep short function calls all on one line even if they're part of a 763 larger series of tokens. This stops us from splitting too much. 764 765## [0.7.0] 2016-04-09 766### Added 767- Support for Python 3.5. 768- Add 'ALLOW_MULTILINE_LAMBDAS' which allows lambdas to be formatted onto 769 multiple lines. 770 771### Fixed 772- Lessen penalty for splitting before a dictionary keyword. 773- Formatting of trailing comments on disabled formatting lines. 774- Disable / enable formatting at end of multi-line comment. 775 776## [0.6.3] 2016-03-06 777### Changed 778- Documentation updated. 779 780### Fixed 781- Fix spacing of multiline comments when formatting is disabled. 782 783## [0.6.2] 2015-11-01 784### Changed 785- Look at the 'setup.cfg' file to see if it contains style information for 786 YAPF. 787- Look at the '~/.config/yapf/style' file to see if it contains global style 788 information for YAPF. 789 790### Fixed 791- Make lists that can fit on one line more likely to stay together. 792- Correct formatting of '*args' and '**kwargs' when there are default values in 793 the argument list. 794 795## [0.6.1] 2015-10-24 796### Fixed 797- Make sure to align comments in data literals correctly. Also make sure we 798 don't count a "#." in a string as an i18n comment. 799- Retain proper vertical spacing before comments in a data literal. 800- Make sure that continuations from a compound statement are distinguished from 801 the succeeding line. 802- Ignore preceding comments when calculating what is a "dictionary maker". 803- Add a small penalty for splitting before a closing bracket. 804- Ensure that a space is enforced after we remove a pseudo-paren that's between 805 two names, keywords, numbers, etc. 806- Increase the penalty for splitting after a pseudo-paren. This could lead to 807 less readable code in some circumstances. 808 809## [0.6.0] 2015-10-18 810### Added 811- Add knob to indent the dictionary value if there is a split before it. 812 813### Changed 814- No longer check that a file is a "Python" file unless the '--recursive' flag 815 is specified. 816- No longer allow the user to specify a directory unless the '--recursive' flag 817 is specified. 818 819### Fixed 820- When determining if we should split a dictionary's value to a new line, use 821 the longest entry instead of the total dictionary's length. This allows the 822 formatter to reformat the dictionary in a more consistent manner. 823- Improve how list comprehensions are formatted. Make splitting dependent upon 824 whether the "comp_for" or "comp_if" goes over the column limit. 825- Don't over indent if expression hanging indents if we expect to dedent the 826 closing bracket. 827- Improve splitting heuristic when the first argument to a function call is 828 itself a function call with arguments. In cases like this, the remaining 829 arguments to the function call would look badly aligned, even though they are 830 technically correct (the best kind of correct!). 831- Improve splitting heuristic more so that if the first argument to a function 832 call is a data literal that will go over the column limit, then we want to 833 split before it. 834- Remove spaces around '**' operator. 835- Retain formatting of comments in the middle of an expression. 836- Don't add a newline to an empty file. 837- Over indent a function's parameter list if it's not distinguished from the 838 body of the function. 839 840## [0.5.0] 2015-10-11 841### Added 842- Add option to exclude files/directories from formatting. 843- Add a knob to control whether import names are split after the first '('. 844 845### Fixed 846- Indent the continuation of an if-then statement when it's not distinguished 847 from the body of the if-then. 848- Allow for sensible splitting of array indices where appropriate. 849- Prefer to not split before the ending bracket of an atom. This produces 850 better code in most cases. 851- Corrected how horizontal spaces were presevered in a disabled region. 852 853## [0.4.0] 2015-10-07 854### Added 855- Support for dedenting closing brackets, "facebook" style. 856 857### Fixed 858- Formatting of tokens after a multiline string didn't retain their horizontal 859 spacing. 860 861## [0.3.1] 2015-09-30 862### Fixed 863- Format closing scope bracket correctly when indentation size changes. 864 865## [0.3.0] 2015-09-20 866### Added 867- Return a 2 if the source changed, 1 on error, and 0 for no change. 868 869### Fixed 870- Make sure we format if the "lines" specified are in the middle of a 871 statement. 872 873## [0.2.9] - 2015-09-13 874### Fixed 875- Formatting of multiple files. It was halting after formatting the first file. 876 877## [0.2.8] - 2015-09-12 878### Added 879- Return a non-zero exit code if the source was changed. 880- Add bitwise operator splitting penalty and prefer to split before bitwise 881 operators. 882 883### Fixed 884- Retain vertical spacing between disabled and enabled lines. 885- Split only at start of named assign. 886- Retain comment position when formatting is disabled. 887- Honor splitting before or after logical ops. 888