Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pass over ellipsis in non-function/class contexts #8049

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading