Loading README.md +1 −0 Changes for README.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -823,6 +823,7 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). ### 18.8b0 * fix parsing of `__future__` imports with renames (#389) * fix scope of `# fmt: off` when directly preceding `yield` and other nodes (#385) ### 18.6b4 Loading black.py +1 −13 Changes for black.py: 1 added line, 13 removed lines. Original line number Diff line number Diff line Loading @@ -797,18 +797,6 @@ def show(cls, code: Union[str, Leaf, Node]) -> None: syms.testlist_gexp, syms.testlist_star_expr, } SURROUNDED_BY_BRACKETS = { syms.typedargslist, syms.arglist, syms.subscriptlist, syms.vfplist, syms.import_as_names, syms.yield_expr, syms.testlist_gexp, syms.testlist_star_expr, syms.listmaker, syms.dictsetmaker, } TEST_DESCENDANTS = { syms.test, syms.lambdef, Loading Loading @@ -1853,7 +1841,7 @@ def container_of(leaf: Leaf) -> LN: if parent.type == syms.file_input: break if parent.type in SURROUNDED_BY_BRACKETS: if parent.prev_sibling is not None and parent.prev_sibling.type in BRACKETS: break container = parent Loading tests/data/fmtonoff.py +72 −0 Changes for tests/data/fmtonoff.py: 72 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -48,6 +48,39 @@ def spaces2(result= _core.Value(None)): # fmt: off key: 'value', } def subscriptlist(): atom[ # fmt: off 'some big and', 'complex subscript', # fmt: on goes + here, andhere, ] def import_as_names(): # fmt: off from hello import a, b 'unformatted' # fmt: on def testlist_star_expr(): # fmt: off a , b = *hello 'unformatted' # fmt: on def yield_expr(): # fmt: off yield hello 'unformatted' # fmt: on 'formatted' # fmt: off ( yield hello ) 'unformatted' # fmt: on def example(session): # fmt: off result = session\ Loading Loading @@ -142,6 +175,7 @@ def single_literal_yapf_disable(): xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5 ) # fmt: off yield 'hello' # No formatting to the end of the file l=[1,2,3] d={'a':1, Loading Loading @@ -219,6 +253,43 @@ def spaces2(result=_core.Value(None)): } def subscriptlist(): atom[ # fmt: off 'some big and', 'complex subscript', # fmt: on goes + here, andhere, ] def import_as_names(): # fmt: off from hello import a, b 'unformatted' # fmt: on def testlist_star_expr(): # fmt: off a , b = *hello 'unformatted' # fmt: on def yield_expr(): # fmt: off yield hello 'unformatted' # fmt: on "formatted" # fmt: off ( yield hello ) 'unformatted' # fmt: on def example(session): # fmt: off result = session\ Loading Loading @@ -327,6 +398,7 @@ def single_literal_yapf_disable(): xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5, ) # fmt: off yield 'hello' # No formatting to the end of the file l=[1,2,3] d={'a':1, Loading Loading
README.md +1 −0 Changes for README.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -823,6 +823,7 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). ### 18.8b0 * fix parsing of `__future__` imports with renames (#389) * fix scope of `# fmt: off` when directly preceding `yield` and other nodes (#385) ### 18.6b4 Loading
black.py +1 −13 Changes for black.py: 1 added line, 13 removed lines. Original line number Diff line number Diff line Loading @@ -797,18 +797,6 @@ def show(cls, code: Union[str, Leaf, Node]) -> None: syms.testlist_gexp, syms.testlist_star_expr, } SURROUNDED_BY_BRACKETS = { syms.typedargslist, syms.arglist, syms.subscriptlist, syms.vfplist, syms.import_as_names, syms.yield_expr, syms.testlist_gexp, syms.testlist_star_expr, syms.listmaker, syms.dictsetmaker, } TEST_DESCENDANTS = { syms.test, syms.lambdef, Loading Loading @@ -1853,7 +1841,7 @@ def container_of(leaf: Leaf) -> LN: if parent.type == syms.file_input: break if parent.type in SURROUNDED_BY_BRACKETS: if parent.prev_sibling is not None and parent.prev_sibling.type in BRACKETS: break container = parent Loading
tests/data/fmtonoff.py +72 −0 Changes for tests/data/fmtonoff.py: 72 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -48,6 +48,39 @@ def spaces2(result= _core.Value(None)): # fmt: off key: 'value', } def subscriptlist(): atom[ # fmt: off 'some big and', 'complex subscript', # fmt: on goes + here, andhere, ] def import_as_names(): # fmt: off from hello import a, b 'unformatted' # fmt: on def testlist_star_expr(): # fmt: off a , b = *hello 'unformatted' # fmt: on def yield_expr(): # fmt: off yield hello 'unformatted' # fmt: on 'formatted' # fmt: off ( yield hello ) 'unformatted' # fmt: on def example(session): # fmt: off result = session\ Loading Loading @@ -142,6 +175,7 @@ def single_literal_yapf_disable(): xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5 ) # fmt: off yield 'hello' # No formatting to the end of the file l=[1,2,3] d={'a':1, Loading Loading @@ -219,6 +253,43 @@ def spaces2(result=_core.Value(None)): } def subscriptlist(): atom[ # fmt: off 'some big and', 'complex subscript', # fmt: on goes + here, andhere, ] def import_as_names(): # fmt: off from hello import a, b 'unformatted' # fmt: on def testlist_star_expr(): # fmt: off a , b = *hello 'unformatted' # fmt: on def yield_expr(): # fmt: off yield hello 'unformatted' # fmt: on "formatted" # fmt: off ( yield hello ) 'unformatted' # fmt: on def example(session): # fmt: off result = session\ Loading Loading @@ -327,6 +398,7 @@ def single_literal_yapf_disable(): xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5, ) # fmt: off yield 'hello' # No formatting to the end of the file l=[1,2,3] d={'a':1, Loading