mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Add a trailing newline to all .py.expect files (#3156)
This just re-formats all the `.py.expect` files with Black, both to add a trailing newline and be doubly-certain that they're correctly formatted. I also ensured that we add a hard line break after each statement, and that we avoid including an extra newline in the generated Markdown (since the code should contain the exact expected newlines).
This commit is contained in:
parent
c1ddcb8a60
commit
5fd827545b
104 changed files with 182 additions and 1464 deletions
|
@ -19,4 +19,4 @@ if (10).real:
|
|||
...
|
||||
|
||||
y = 100[no]
|
||||
y = 100(no)
|
||||
y = 100(no)
|
||||
|
|
|
@ -1 +1 @@
|
|||
print("hello, world")
|
||||
print("hello, world")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
for ((x in {}) or {})["a"] in x:
|
||||
pass
|
||||
pem_spam = lambda l, spam={"x": 3}: not spam.get(l.strip())
|
||||
lambda x=lambda y={1: 3}: y["x" : lambda y: {1: 2}]: x
|
||||
lambda x=lambda y={1: 3}: y["x" : lambda y: {1: 2}]: x
|
||||
|
|
|
@ -27,4 +27,4 @@ def class_under_the_func_with_blank_parentheses():
|
|||
class NormalClass:
|
||||
def func_for_testing(self, first, second):
|
||||
sum = first + second
|
||||
return sum
|
||||
return sum
|
||||
|
|
|
@ -162,4 +162,4 @@ class ClassWithDecoInitAndVarsAndDocstringWithInner2:
|
|||
|
||||
@deco
|
||||
def __init__(self):
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -96,4 +96,4 @@ if True:
|
|||
WaiterConfig={
|
||||
"Delay": 5,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
|
|
@ -3,4 +3,4 @@ def bob(): # pylint: disable=W9016
|
|||
|
||||
|
||||
def bobtwo(): # some comment here
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -170,4 +170,4 @@ class Test:
|
|||
instruction() # comment with bad spacing
|
||||
|
||||
# END COMMENTS
|
||||
# MORE END COMMENTS
|
||||
# MORE END COMMENTS
|
||||
|
|
|
@ -45,4 +45,4 @@ def func():
|
|||
)
|
||||
|
||||
|
||||
# %%
|
||||
# %%
|
||||
|
|
|
@ -91,4 +91,4 @@ def foo3(list_a, list_b):
|
|||
db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
|
||||
)
|
||||
.filter(User.xyz.is_(None))
|
||||
)
|
||||
)
|
||||
|
|
|
@ -70,4 +70,4 @@ def g():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -115,4 +115,4 @@ call_to_some_function_asdf(
|
|||
[AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, AAAAAAAAAAAAAAAAAAAAAAA, BBBBBBBBBBBB], # type: ignore
|
||||
)
|
||||
|
||||
aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*items))) # type: ignore[arg-type]
|
||||
aaaaaaaaaaaaa, bbbbbbbbb = map(list, map(itertools.chain.from_iterable, zip(*items))) # type: ignore[arg-type]
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
# to the latter.
|
||||
|
||||
# %%
|
||||
# %%
|
||||
# %%
|
||||
|
|
|
@ -158,4 +158,4 @@ def foo():
|
|||
@decorator1
|
||||
# A standalone comment
|
||||
def bar():
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -20,4 +20,4 @@ def function(a: int = 42):
|
|||
"""
|
||||
# There's a NBSP + 3 spaces before
|
||||
# And 4 spaces on the next line
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -178,4 +178,4 @@ class C:
|
|||
key8: value8,
|
||||
key9: value9,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
|
@ -178,4 +178,4 @@ class C:
|
|||
key8: value8,
|
||||
key9: value9,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
|
@ -216,4 +216,4 @@ def stable_quote_normalization_with_immediate_inner_single_quote(self):
|
|||
"""'<text here>
|
||||
|
||||
<text here, since without another non-empty line black is stable>
|
||||
"""
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Make sure when the file ends with class's docstring,
|
||||
# It doesn't add extra blank lines.
|
||||
class ClassWithDocstring:
|
||||
"""A docstring."""
|
||||
"""A docstring."""
|
||||
|
|
|
@ -45,4 +45,4 @@ def single_quote_docstring_over_line_limit():
|
|||
|
||||
|
||||
def single_quote_docstring_over_line_limit2():
|
||||
"We do not want to put the closing quote on a new line as that is invalid (see GH-3141)."
|
||||
"We do not want to put the closing quote on a new line as that is invalid (see GH-3141)."
|
||||
|
|
|
@ -86,4 +86,4 @@ def g():
|
|||
syms.arglist,
|
||||
syms.argument,
|
||||
}:
|
||||
return NO
|
||||
return NO
|
||||
|
|
|
@ -114,7 +114,7 @@ call(
|
|||
arg,
|
||||
another,
|
||||
kwarg="hey",
|
||||
**kwargs
|
||||
**kwargs,
|
||||
) # note: no trailing comma pre-3.6
|
||||
call(*gidgets[:2])
|
||||
call(a, *gidgets[:2])
|
||||
|
@ -367,4 +367,4 @@ bbbb >> bbbb * bbbb
|
|||
^ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
last_call()
|
||||
# standalone comment at ENDMARKER
|
||||
# standalone comment at ENDMARKER
|
||||
|
|
|
@ -221,4 +221,4 @@ yield 'hello'
|
|||
# No formatting to the end of the file
|
||||
l=[1,2,3]
|
||||
d={'a':1,
|
||||
'b':2}
|
||||
'b':2}
|
||||
|
|
|
@ -37,4 +37,4 @@ def test_calculate_fades():
|
|||
(None, 4, 0, 0, 10, 0, 0, 6, 10),
|
||||
]
|
||||
|
||||
# fmt: on
|
||||
# fmt: on
|
||||
|
|
|
@ -12,4 +12,4 @@ x = [
|
|||
]
|
||||
# fmt: on
|
||||
|
||||
x = [1, 2, 3, 4]
|
||||
x = [1, 2, 3, 4]
|
||||
|
|
|
@ -17,4 +17,4 @@ def f():
|
|||
]
|
||||
)
|
||||
def f():
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -84,4 +84,4 @@ if x:
|
|||
# fmt: off
|
||||
elif unformatted:
|
||||
# fmt: on
|
||||
will_be_formatted()
|
||||
will_be_formatted()
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
a, b = 1, 2
|
||||
c = 6 # fmt: skip
|
||||
d = 5
|
||||
d = 5
|
||||
|
|
|
@ -8,4 +8,4 @@ l3 = [
|
|||
"I have",
|
||||
"trailing comma",
|
||||
"so I should be braked",
|
||||
]
|
||||
]
|
||||
|
|
|
@ -7,4 +7,4 @@ e = 5
|
|||
f = [
|
||||
"This is a very long line that should be formatted into a clearer line ",
|
||||
"by rearranging.",
|
||||
]
|
||||
]
|
||||
|
|
|
@ -4,4 +4,4 @@ l = [
|
|||
1,
|
||||
2,
|
||||
3,
|
||||
]
|
||||
]
|
||||
|
|
|
@ -6,4 +6,4 @@ if (
|
|||
):
|
||||
print("I'm good!")
|
||||
else:
|
||||
print("I'm bad")
|
||||
print("I'm bad")
|
||||
|
|
|
@ -2,4 +2,4 @@ class A:
|
|||
def f(self):
|
||||
for line in range(10):
|
||||
if True:
|
||||
pass # fmt: skip
|
||||
pass # fmt: skip
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
a = "this is some code"
|
||||
b = 5 # fmt:skip
|
||||
c = 9 # fmt: skip
|
||||
d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasuperlongstring" # fmt:skip
|
||||
d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasuperlongstring" # fmt:skip
|
||||
|
|
|
@ -59,4 +59,4 @@ with give_me_context( unformatted, args ): # fmt: skip
|
|||
|
||||
async def test_async_with():
|
||||
async with give_me_async_context( unformatted, args ): # fmt: skip
|
||||
print("Do something")
|
||||
print("Do something")
|
||||
|
|
|
@ -6,4 +6,4 @@ f'some f-string with {a} {few(""):.2f} {formatted.values!r}'
|
|||
f"{f'''{'nested'} inner'''} outer"
|
||||
f"\"{f'{nested} inner'}\" outer"
|
||||
f"space between opening braces: { {a for a in (1, 2, 3)}}"
|
||||
f'Hello \'{tricky + "example"}\''
|
||||
f'Hello \'{tricky + "example"}\''
|
||||
|
|
|
@ -145,4 +145,4 @@ def f(
|
|||
|
||||
|
||||
def __await__():
|
||||
return (yield)
|
||||
return (yield)
|
||||
|
|
|
@ -63,4 +63,4 @@ else:
|
|||
|
||||
|
||||
with hmm_but_this_should_get_two_preceding_newlines():
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -111,4 +111,4 @@ some_module.some_function(
|
|||
argument4,
|
||||
argument5,
|
||||
argument6,
|
||||
)
|
||||
)
|
||||
|
|
|
@ -61,4 +61,4 @@ __all__ = (
|
|||
+ queues.__all__
|
||||
+ streams.__all__
|
||||
+ tasks.__all__
|
||||
)
|
||||
)
|
||||
|
|
|
@ -19,4 +19,4 @@ small_list = [
|
|||
]
|
||||
list_of_types = [
|
||||
tuple[int,],
|
||||
]
|
||||
]
|
||||
|
|
|
@ -60,4 +60,4 @@ if hasattr(view, "sum_of_weights"):
|
|||
|
||||
return np.divide(
|
||||
where=view.sum_of_weights_of_weight_long**2 > view.sum_of_weights_squared, # type: ignore
|
||||
)
|
||||
)
|
||||
|
|
|
@ -18,4 +18,4 @@
|
|||
# exactly line length limit + 1, it won't be split like that.
|
||||
xxxxxxxxx_yyy_zzzzzzzz[
|
||||
xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
|
||||
] = 1
|
||||
] = 1
|
||||
|
|
|
@ -90,4 +90,4 @@ async def main():
|
|||
|
||||
|
||||
async def main():
|
||||
await (yield)
|
||||
await (yield)
|
||||
|
|
|
@ -39,4 +39,4 @@ except (
|
|||
some.really.really.really.looooooooooooooooooooooooooooooooong.module.over89.chars.Error,
|
||||
some.really.really.really.looooooooooooooooooooooooooooooooong.module.over89.chars.Error,
|
||||
) as err:
|
||||
raise err
|
||||
raise err
|
||||
|
|
|
@ -24,4 +24,4 @@ for (
|
|||
|
||||
# Test deeply nested brackets
|
||||
for k, v in d.items():
|
||||
print(k, v)
|
||||
print(k, v)
|
||||
|
|
|
@ -75,4 +75,4 @@ with open("/path/to/file.txt", mode="w") as file:
|
|||
|
||||
with open("/path/to/file.txt", mode="r") as read_file:
|
||||
with open("/path/to/output_file.txt", mode="w") as write_file:
|
||||
write_file.writelines(read_file.readlines())
|
||||
write_file.writelines(read_file.readlines())
|
||||
|
|
|
@ -82,4 +82,4 @@ def example7():
|
|||
|
||||
|
||||
def example8():
|
||||
return None
|
||||
return None
|
||||
|
|
|
@ -117,4 +117,4 @@ def foo() -> (
|
|||
int,
|
||||
]
|
||||
):
|
||||
return 2
|
||||
return 2
|
||||
|
|
|
@ -22,4 +22,4 @@ func1(arg1).func2(arg2).func3(arg3).func4(arg4).func5(arg5)
|
|||
|
||||
(a, b, c, d) = func1(arg1) and func2(arg2)
|
||||
|
||||
func(argument1, (one, two), argument4, argument5, argument6)
|
||||
func(argument1, (one, two), argument4, argument5, argument6)
|
||||
|
|
|
@ -28,4 +28,4 @@ ham[1:9], ham[1:9:3], ham[:9:3], ham[1::3], ham[1:9:]
|
|||
ham[lower:upper], ham[lower:upper:], ham[lower::step]
|
||||
# ham[lower+offset : upper+offset]
|
||||
ham[: upper_fn(x) : step_fn(x)], ham[:: step_fn(x)]
|
||||
ham[lower + offset : upper + offset]
|
||||
ham[lower + offset : upper + offset]
|
||||
|
|
|
@ -17,4 +17,4 @@ def docstring_singleline():
|
|||
def docstring_multiline():
|
||||
R"""
|
||||
clear out all of the issues opened in that time :p
|
||||
"""
|
||||
"""
|
||||
|
|
|
@ -55,4 +55,4 @@ def test(self, othr):
|
|||
assert a_function(
|
||||
very_long_arguments_that_surpass_the_limit,
|
||||
which_is_eighty_eight_in_this_case_plus_a_bit_more,
|
||||
) == {"x": "this need to pass the line limit as well", "b": "but only by a little bit"}
|
||||
) == {"x": "this need to pass the line limit as well", "b": "but only by a little bit"}
|
||||
|
|
|
@ -31,4 +31,4 @@ class A:
|
|||
4,
|
||||
3,
|
||||
) < self.connection.mysql_version < (10, 5, 2):
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -3,4 +3,4 @@ if e123456.get_tk_patchlevel() >= (8, 6, 0, "final") or (
|
|||
5,
|
||||
8,
|
||||
) <= get_tk_patchlevel() < (8, 6):
|
||||
pass
|
||||
pass
|
||||
|
|
|
@ -5,4 +5,4 @@ if True:
|
|||
"qweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweas "
|
||||
+ "qweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqwegqweasdzxcqweasdzxc.",
|
||||
"qweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqwe",
|
||||
) % {"reported_username": reported_username, "report_reason": report_reason}
|
||||
) % {"reported_username": reported_username, "report_reason": report_reason}
|
||||
|
|
|
@ -47,4 +47,4 @@ assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
|
|||
xxxxxxxxx
|
||||
).xxxxxxxxxxxxxxxxxx(), (
|
||||
"xxx {xxxxxxxxx} xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
)
|
||||
)
|
||||
|
|
|
@ -6,4 +6,4 @@ x󠄀 = 4
|
|||
Q̇_per_meter = 4
|
||||
|
||||
A᧚ = 3
|
||||
A፩ = 8
|
||||
A፩ = 8
|
||||
|
|
|
@ -4,9 +4,13 @@
|
|||
sdfjsdfjlksdljkfsdlkf,
|
||||
sdfsdjfklsdfjlksdljkf,
|
||||
sdsfsdfjskdflsfsdf,
|
||||
) = 1, 2, 3
|
||||
) = (
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
)
|
||||
|
||||
# This is as well.
|
||||
(this_will_be_wrapped_in_parens,) = struct.unpack(b"12345678901234567890")
|
||||
|
||||
(a,) = call()
|
||||
(a,) = call()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue