Skip to content

Commit

Permalink
Use pass over ellipsis in non-function/class contexts (#8049)
Browse files Browse the repository at this point in the history
Split out of #8044: In preview style, ellipsis are also collapsed in
non-stub files. This should only affect function/class contexts since
for other statements stub are generally not used. I've updated our tests
to use `pass` instead to reflect this, which makes tracking the preview
style changes much easier.
  • Loading branch information
konstin authored Oct 19, 2023
1 parent 693f957 commit 67b0434
Show file tree
Hide file tree
Showing 24 changed files with 294 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
] & aaaaaaaaaaaaaaaaaaaaaaaaaa:
...
pass

if [
aaaaaaaaaaaaa,
Expand All @@ -84,7 +84,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
] & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
...
pass

# Right only can break
if aaaaaaaaaaaaaaaaaaaaaaaaaa & [
Expand All @@ -94,7 +94,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
]:
...
pass

if aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa & [
aaaaaaaaaaaaa,
Expand All @@ -103,7 +103,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
]:
...
pass


# Left or right can break
Expand All @@ -114,7 +114,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
]:
...
pass

if [
aaaaaaaaaaaaa,
Expand All @@ -123,7 +123,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
] & [2222, 333]:
...
pass

if [
aaaaaaaaaaaaa,
Expand All @@ -132,7 +132,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
] & [fffffffffffffffff, gggggggggggggggggggg, hhhhhhhhhhhhhhhhhhhhh, iiiiiiiiiiiiiiii, jjjjjjjjjjjjj]:
...
pass

if (
# comment
Expand All @@ -152,7 +152,7 @@
]:
pass

...
pass

# Nesting
if (aaaa + b) & [
Expand All @@ -162,7 +162,7 @@
iiiiiiiiiiiiiiii,
jjjjjjjjjjjjj,
]:
...
pass

if [
fffffffffffffffff,
Expand All @@ -171,7 +171,7 @@
iiiiiiiiiiiiiiii,
jjjjjjjjjjjjj,
] & (a + b):
...
pass


if [
Expand All @@ -185,7 +185,7 @@
a
+ b
):
...
pass

if (
[
Expand All @@ -199,7 +199,7 @@
# comment
a + b
):
...
pass


# Unstable formatting in https://github.com/realtyem/synapse-unraid/blob/unraid_develop/synapse/handlers/presence.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
and self._returncode
and self._proc.poll()
):
...
pass

if (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Expand All @@ -26,14 +26,14 @@
and aaaaaaaaaaaaaaaaaaaaaaaaaa
and aaaaaaaaaaaaaaaaaaaaaaaaaaaa
):
...
pass


if (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaas
and aaaaaaaaaaaaaaaaa
):
...
pass


if [2222, 333] and [
Expand All @@ -43,7 +43,7 @@
dddddddddddddddddddd,
eeeeeeeeee,
]:
...
pass

if [
aaaaaaaaaaaaa,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

# Spacing around the colon(s)
def a():
...
pass

e00 = "e"[:]
e01 = "e"[:1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,18 @@

# Regression: https://github.com/astral-sh/ruff/issues/5338
if a and not aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
...
pass

if (
not
# comment
a):
...
pass

if (
not # comment
a):
...
pass

# Regression test for: https://github.com/astral-sh/ruff/issues/7423
if True:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
for converter in connection.ops.get_db_converters(
expression
) + expression.get_db_converters(connection):
...
pass


aaa = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
pass

else:
...
pass

for (
x,
y,
) in z: # comment
...
pass


# remove brackets around x,y but keep them around z,w
for (x, y) in (z, w):
...
pass


# type comment
for x in (): # type: int
...
pass

# Tuple parentheses for iterable.
for x in 1, 2, 3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

if x == y:
if y == z:
...
pass

if a == b:
...
pass
else: # trailing comment
...
pass

# trailing else comment

Expand All @@ -34,11 +34,11 @@
2222222222222222222222,
3333333333
]:
...
pass


else:
...
pass

# Regression test: Don't drop the trailing comment by associating it with the elif
# instead of the else.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def foo():
case (
True # trailing
):
...
pass
case False:
...
pass


match foo:
Expand Down Expand Up @@ -406,39 +406,39 @@ def foo():
case Point2D(
# own line
):
...
pass

case (
Point2D
# own line
()
):
...
pass

case Point2D( # end of line line
):
...
pass

case Point2D( # end of line
0, 0
):
...
pass

case Point2D(0, 0):
...
pass

case Point2D(
( # end of line
# own line
0
), 0):
...
pass

case Point3D(x=0, y=0, z=000000000000000000000000000000000000000000000000000000000000000000000000000000000):
...
pass

case Bar(0, a=None, b="hello"):
...
pass

case FooBar(# leading
# leading
Expand All @@ -449,7 +449,7 @@ def foo():
# trailing
# trailing
):
...
pass

case A(
b # b
Expand Down Expand Up @@ -481,26 +481,26 @@ def foo():
# own line 4
c # trailing 5
):
...
pass

case (
(a)
| # trailing
( b )
):
...
pass

case (a|b|c):
...
pass

case foo | bar | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh:
...
pass

case ( # end of line
a | b
# own line
):
...
pass


# Single-element tuples.
Expand Down
Loading

0 comments on commit 67b0434

Please sign in to comment.