ruff/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP028_0.py
2023-09-20 08:38:27 +02:00

83 lines
1.3 KiB
Python

def f():
for x in y:
yield x
def g():
for x, y in z:
yield (x, y)
def h():
for x in [1, 2, 3]:
yield x
def i():
for x in {x for x in y}:
yield x
def j():
for x in (1, 2, 3):
yield x
def k():
for x, y in {3: "x", 6: "y"}:
yield x, y
def f(): # Comment one\n'
# Comment two\n'
for x, y in { # Comment three\n'
3: "x", # Comment four\n'
# Comment five\n'
6: "y", # Comment six\n'
}: # Comment seven\n'
# Comment eight\n'
yield x, y # Comment nine\n'
# Comment ten',
def f():
for x, y in [{3: (3, [44, "long ss"]), 6: "y"}]:
yield x, y
def f():
for x, y in z():
yield x, y
def f():
def func():
# This comment is preserved\n'
for x, y in z(): # Comment one\n'
# Comment two\n'
yield x, y # Comment three\n'
# Comment four\n'
# Comment\n'
def g():
print(3)
def f():
for x in y:
yield x
for z in x:
yield z
def f():
for x, y in z():
yield x, y
x = 1
# Regression test for: https://github.com/astral-sh/ruff/issues/7103
def _serve_method(fn):
for h in (
TaggedText.from_file(args.input)
.markup(highlight=args.region)
):
yield h