Change generator formatting dummy to include NOT_YET_IMPLEMENTED (#5464)

## Summary

Change generator formatting dummy to include `NOT_YET_IMPLEMENTED`. This
makes it easier to correctly identify them as dummies

## Test Plan

This is a dummy change
This commit is contained in:
konsti 2023-07-03 09:11:14 +02:00 committed by GitHub
parent 94ac2c4e1b
commit ca6ff72404
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 138 additions and 90 deletions

View file

@ -11,7 +11,12 @@ pub struct FormatExprGeneratorExp;
impl FormatNodeRule<ExprGeneratorExp> for FormatExprGeneratorExp {
fn fmt_fields(&self, _item: &ExprGeneratorExp, f: &mut PyFormatter) -> FormatResult<()> {
write!(f, [not_yet_implemented_custom_text("(i for i in [])")])
write!(
f,
[not_yet_implemented_custom_text(
"(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])"
)]
)
}
}

View file

@ -11,7 +11,12 @@ pub struct FormatExprListComp;
impl FormatNodeRule<ExprListComp> for FormatExprListComp {
fn fmt_fields(&self, _item: &ExprListComp, f: &mut PyFormatter) -> FormatResult<()> {
write!(f, [not_yet_implemented_custom_text("[i for i in []]")])
write!(
f,
[not_yet_implemented_custom_text(
"[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]"
)]
)
}
}

View file

@ -79,7 +79,7 @@ def something():
```diff
--- Black
+++ Ruff
@@ -1,90 +1,48 @@
@@ -1,90 +1,50 @@
long_kwargs_single_line = my_function(
foo="test, this is a sample value",
- bar=(
@ -157,21 +157,21 @@ def something():
- )
- for some_boolean_variable in some_iterable
-)
+generator_expression = (i for i in [])
+generator_expression = (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
def limit_offset_sql(self, low_mark, high_mark):
"""Return LIMIT/OFFSET SQL clause."""
limit, offset = self._get_limit_offset_params(low_mark, high_mark)
- return " ".join(
return " ".join(
- sql
- for sql in (
- "LIMIT %d" % limit if limit else None,
- ("OFFSET %d" % offset) if offset else None,
- )
- if sql
- )
+ return " ".join((i for i in []))
+ (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
)
def something():
@ -221,13 +221,15 @@ def weird_default_argument(
nested = NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
generator_expression = (i for i in [])
generator_expression = (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
def limit_offset_sql(self, low_mark, high_mark):
"""Return LIMIT/OFFSET SQL clause."""
limit, offset = self._get_limit_offset_params(low_mark, high_mark)
return " ".join((i for i in []))
return " ".join(
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
)
def something():

View file

@ -134,7 +134,7 @@ with match() as match:
def get_grammars(target_versions: Set[TargetVersion]) -> List[Grammar]:
@@ -23,13 +23,9 @@
@@ -23,13 +23,11 @@
pygram.python_grammar,
]
@ -146,11 +146,13 @@ with match() as match:
+ NOT_YET_IMPLEMENTED_StmtMatch
- if all(version.is_python2() for version in target_versions):
+ if all((i for i in [])):
+ if all(
+ (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
+ ):
# Python 2-only code, so try Python 2 grammars.
return [
# Python 2.7 with future print_function import
@@ -41,13 +37,11 @@
@@ -41,13 +39,11 @@
re.match()
match = a
with match() as match:
@ -166,7 +168,7 @@ with match() as match:
self.assertIs(x, False)
self.assertEqual(y, 0)
self.assertIs(z, x)
@@ -72,16 +66,12 @@
@@ -72,16 +68,12 @@
def test_patma_155(self):
x = 0
y = None
@ -185,7 +187,7 @@ with match() as match:
# At least one of the above branches must have been taken, because every Python
# version has exactly one of the two 'ASYNC_*' flags
@@ -91,7 +81,7 @@
@@ -91,7 +83,7 @@
def lib2to3_parse(src_txt: str, target_versions: Iterable[TargetVersion] = ()) -> Node:
"""Given a string with source, return the lib2to3 Node."""
if not src_txt.endswith("\n"):
@ -194,7 +196,7 @@ with match() as match:
grammars = get_grammars(set(target_versions))
@@ -99,9 +89,9 @@
@@ -99,9 +91,9 @@
re.match()
match = a
with match() as match:
@ -238,7 +240,9 @@ def get_grammars(target_versions: Set[TargetVersion]) -> List[Grammar]:
NOT_YET_IMPLEMENTED_StmtMatch
if all((i for i in [])):
if all(
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
):
# Python 2-only code, so try Python 2 grammars.
return [
# Python 2.7 with future print_function import

View file

@ -27,7 +27,7 @@ f(x, (a := b + c for c in range(10)), y=z, **q)
```diff
--- Black
+++ Ruff
@@ -1,15 +1,15 @@
@@ -1,15 +1,20 @@
# Unparenthesized walruses are now allowed in indices since Python 3.10.
-x[a:=0]
-x[a:=0, b:=1]
@ -38,7 +38,7 @@ f(x, (a := b + c for c in range(10)), y=z, **q)
# Walruses are allowed inside generator expressions on function calls since 3.10.
-if any(match := pattern_error.match(s) for s in buffer):
+if any((i for i in [])):
+if any((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])):
if match.group(2) == data_not_available:
# Error OK to ignore.
pass
@ -47,10 +47,15 @@ f(x, (a := b + c for c in range(10)), y=z, **q)
-f((a := b + c for c in range(10)), x)
-f(y=(a := b + c for c in range(10)))
-f(x, (a := b + c for c in range(10)), y=z, **q)
+f((i for i in []))
+f((i for i in []), x)
+f(y=(i for i in []))
+f(x, (i for i in []), y=z, **q)
+f((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []))
+f((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []), x)
+f(y=(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []))
+f(
+ x,
+ (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []),
+ y=z,
+ **q,
+)
```
## Ruff Output
@ -62,15 +67,20 @@ x[NOT_YET_IMPLEMENTED_ExprNamedExpr, NOT_YET_IMPLEMENTED_ExprNamedExpr]
x[5, NOT_YET_IMPLEMENTED_ExprNamedExpr]
# Walruses are allowed inside generator expressions on function calls since 3.10.
if any((i for i in [])):
if any((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])):
if match.group(2) == data_not_available:
# Error OK to ignore.
pass
f((i for i in []))
f((i for i in []), x)
f(y=(i for i in []))
f(x, (i for i in []), y=z, **q)
f((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []))
f((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []), x)
f(y=(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []))
f(
x,
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []),
y=z,
**q,
)
```
## Black Output

View file

@ -47,7 +47,7 @@ def make_arange(n):
def f():
- return (i * 2 async for i in arange(42))
+ return (i for i in [])
+ return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
def g():
@ -55,7 +55,7 @@ def make_arange(n):
- something_long * something_long
- async for something_long in async_generator(with_an_argument)
- )
+ return (i for i in [])
+ return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
async def func():
@ -66,17 +66,17 @@ def make_arange(n):
- self.async_inc, arange(8), batch_size=3
- )
- ]
+ out_batched = [i for i in []]
+ out_batched = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
def awaited_generator_value(n):
- return (await awaitable for awaitable in awaitable_list)
+ return (i for i in [])
+ return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
def make_arange(n):
- return (i * 2 for i in range(n) if await wrap(i))
+ return (i for i in [])
+ return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
```
## Ruff Output
@ -86,24 +86,24 @@ def make_arange(n):
def f():
return (i for i in [])
return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
def g():
return (i for i in [])
return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
async def func():
if test:
out_batched = [i for i in []]
out_batched = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
def awaited_generator_value(n):
return (i for i in [])
return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
def make_arange(n):
return (i for i in [])
return (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
```
## Black Output

View file

@ -76,7 +76,7 @@ while x := f(x):
-y0 = (y1 := f(x))
-foo(x=(y := f(x)))
+[NOT_YET_IMPLEMENTED_ExprNamedExpr, y**2, y**3]
+filtered_data = [i for i in []]
+filtered_data = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+(NOT_YET_IMPLEMENTED_ExprNamedExpr)
+y0 = NOT_YET_IMPLEMENTED_ExprNamedExpr
+foo(x=(NOT_YET_IMPLEMENTED_ExprNamedExpr))
@ -117,7 +117,7 @@ while x := f(x):
+len(NOT_YET_IMPLEMENTED_ExprNamedExpr)
+foo(NOT_YET_IMPLEMENTED_ExprNamedExpr, cat="vector")
+foo(cat=(NOT_YET_IMPLEMENTED_ExprNamedExpr))
+if any((i for i in [])):
+if any((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])):
print(longline)
-if env_base := os.environ.get("PYTHONUSERBASE", None):
+if NOT_YET_IMPLEMENTED_ExprNamedExpr:
@ -150,7 +150,7 @@ if (NOT_YET_IMPLEMENTED_ExprNamedExpr) is None:
if NOT_YET_IMPLEMENTED_ExprNamedExpr:
pass
[NOT_YET_IMPLEMENTED_ExprNamedExpr, y**2, y**3]
filtered_data = [i for i in []]
filtered_data = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
(NOT_YET_IMPLEMENTED_ExprNamedExpr)
y0 = NOT_YET_IMPLEMENTED_ExprNamedExpr
foo(x=(NOT_YET_IMPLEMENTED_ExprNamedExpr))
@ -176,7 +176,7 @@ x = NOT_YET_IMPLEMENTED_ExprNamedExpr
len(NOT_YET_IMPLEMENTED_ExprNamedExpr)
foo(NOT_YET_IMPLEMENTED_ExprNamedExpr, cat="vector")
foo(cat=(NOT_YET_IMPLEMENTED_ExprNamedExpr))
if any((i for i in [])):
if any((NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])):
print(longline)
if NOT_YET_IMPLEMENTED_ExprNamedExpr:
return env_base

View file

@ -248,9 +248,9 @@ instruction()#comment with bad spacing
- # right
- if element is not None
- ]
+ lcomp = [i for i in []]
+ lcomp2 = [i for i in []]
+ lcomp3 = [i for i in []]
+ lcomp = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+ lcomp2 = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+ lcomp3 = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
while True:
if False:
continue
@ -404,9 +404,9 @@ short
# yup
arg3=True,
)
lcomp = [i for i in []]
lcomp2 = [i for i in []]
lcomp3 = [i for i in []]
lcomp = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
lcomp2 = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
lcomp3 = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
while True:
if False:
continue

View file

@ -72,7 +72,7 @@ def func():
- # right
- if element is not None
- ]
+ lcomp3 = [i for i in []]
+ lcomp3 = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
# Capture each of the exceptions in the MultiError along with each of their causes and contexts
if isinstance(exc_value, MultiError):
embedded = []
@ -98,7 +98,7 @@ def func():
x = """
a really long string
"""
lcomp3 = [i for i in []]
lcomp3 = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
# Capture each of the exceptions in the MultiError along with each of their causes and contexts
if isinstance(exc_value, MultiError):
embedded = []

View file

@ -384,10 +384,10 @@ last_call()
+{NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}
+{NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}
+{NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}
+[i for i in []]
+[i for i in []]
+[i for i in []]
+[i for i in []]
+[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
+{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
@ -486,10 +486,10 @@ last_call()
-((i**2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
-(((i**2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
-(*starred,)
+(i for i in [])
+(i for i in [])
+(i for i in [])
+(i for i in [])
+(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
+(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
+(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
+(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
+(*NOT_YET_IMPLEMENTED_ExprStarred,)
{
"id": "1",
@ -507,7 +507,7 @@ last_call()
)
what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
vars_to_remove
-)
)
-result = (
- session.query(models.Customer.id)
- .filter(
@ -515,7 +515,7 @@ last_call()
- )
- .order_by(models.Customer.id.asc())
- .all()
)
-)
-result = (
- session.query(models.Customer.id)
- .filter(
@ -537,7 +537,7 @@ last_call()
Ø = set()
authors.łukasz.say_thanks()
mapping = {
@@ -237,29 +231,27 @@
@@ -237,29 +231,29 @@
def gen():
@ -574,11 +574,13 @@ last_call()
for y in ():
...
-for z in (i for i in (1, 2, 3)):
+for z in (i for i in []):
+for (
+ z
+) in (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []):
...
for i in call():
...
@@ -328,13 +320,18 @@
@@ -328,13 +322,18 @@
):
return True
if (
@ -600,7 +602,7 @@ last_call()
^ aaaaaaaa.i << aaaaaaaa.k >> aaaaaaaa.l**aaaaaaaa.m // aaaaaaaa.n
):
return True
@@ -342,7 +339,8 @@
@@ -342,7 +341,8 @@
~aaaaaaaaaaaaaaaa.a
+ aaaaaaaaaaaaaaaa.b
- aaaaaaaaaaaaaaaa.c * aaaaaaaaaaaaaaaa.d @ aaaaaaaaaaaaaaaa.e
@ -714,10 +716,10 @@ NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
{NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}
{NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}
{NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}
[i for i in []]
[i for i in []]
[i for i in []]
[i for i in []]
[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
[NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
{NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
@ -802,10 +804,10 @@ NOT_IMPLEMENTED_true if NOT_IMPLEMENTED_cond else NOT_IMPLEMENTED_false
(SomeName)
SomeName
(Good, Bad, Ugly)
(i for i in [])
(i for i in [])
(i for i in [])
(i for i in [])
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
(*NOT_YET_IMPLEMENTED_ExprStarred,)
{
"id": "1",
@ -868,7 +870,9 @@ for (x,) in (1,), (2,), (3,):
...
for y in ():
...
for z in (i for i in []):
for (
z
) in (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []):
...
for i in call():
...

View file

@ -87,7 +87,7 @@ return np.divide(
i = funcs.f() ** 5
j = super().name ** 5
-k = [(2**idx, value) for idx, value in pairs]
+k = [i for i in []]
+k = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
m = [([2**63], [1, 2**63])]
n = count <= 10**5
@ -95,7 +95,7 @@ return np.divide(
-p = {(k, k**2): v**2 for k, v in pairs}
-q = [10**i for i in range(6)]
+p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
+q = [i for i in []]
+q = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
r = x**y
a = 5.0**~4.0
@ -110,7 +110,7 @@ return np.divide(
i = funcs.f() ** 5.0
j = super().name ** 5.0
-k = [(2.0**idx, value) for idx, value in pairs]
+k = [i for i in []]
+k = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
m = [([2.0**63.0], [1.0, 2**63.0])]
n = count <= 10**5.0
@ -118,7 +118,7 @@ return np.divide(
-p = {(k, k**2): v**2.0 for k, v in pairs}
-q = [10.5**i for i in range(6)]
+p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
+q = [i for i in []]
+q = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
# WE SHOULD DEFINITELY NOT EAT THESE COMMENTS (https://github.com/psf/black/issues/2873)
@ -164,13 +164,13 @@ g = a.b**c.d
h = 5 ** funcs.f()
i = funcs.f() ** 5
j = super().name ** 5
k = [i for i in []]
k = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
m = [([2**63], [1, 2**63])]
n = count <= 10**5
o = settings(max_examples=10**6)
p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
q = [i for i in []]
q = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
r = x**y
a = 5.0**~4.0
@ -183,13 +183,13 @@ g = a.b**c.d
h = 5.0 ** funcs.f()
i = funcs.f() ** 5.0
j = super().name ** 5.0
k = [i for i in []]
k = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
m = [([2.0**63.0], [1.0, 2**63.0])]
n = count <= 10**5.0
o = settings(max_examples=10**6.0)
p = {NOT_IMPLEMENTED_dict_key: NOT_IMPLEMENTED_dict_value for key, value in NOT_IMPLEMENTED_dict}
q = [i for i in []]
q = [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
# WE SHOULD DEFINITELY NOT EAT THESE COMMENTS (https://github.com/psf/black/issues/2873)

View file

@ -43,7 +43,7 @@ ham[lower + offset : upper + offset]
```diff
--- Black
+++ Ruff
@@ -4,28 +4,28 @@
@@ -4,28 +4,34 @@
slice[d::d]
slice[0]
slice[-1]
@ -65,13 +65,19 @@ ham[lower + offset : upper + offset]
slice[not so_simple : 1 < val <= 10]
-slice[(1 for i in range(42)) : x]
-slice[:: [i for i in range(42)]]
+slice[(i for i in []) : x]
+slice[ :: [i for i in []]]
+slice[
+ (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []) : x
+]
+slice[
+ :: [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
+]
async def f():
- slice[await x : [i async for i in arange(42)] : 42]
+ slice[await x : [i for i in []] : 42]
+ slice[
+ await x : [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []] : 42
+ ]
# These are from PEP-8:
@ -103,12 +109,18 @@ slice[lambda x: True : lambda x: True]
slice[lambda x: True :, None::]
slice[1 or 2 : True and False]
slice[not so_simple : 1 < val <= 10]
slice[(i for i in []) : x]
slice[ :: [i for i in []]]
slice[
(NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []) : x
]
slice[
:: [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
]
async def f():
slice[await x : [i for i in []] : 42]
slice[
await x : [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []] : 42
]
# These are from PEP-8:

View file

@ -277,8 +277,14 @@ aaaaaaaaaaaaaa + {
dddddddddddddddd,
eeeeeee,
}
aaaaaaaaaaaaaa + [i for i in []]
aaaaaaaaaaaaaa + (i for i in [])
(
aaaaaaaaaaaaaa
+ [NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []]
)
(
aaaaaaaaaaaaaa
+ (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in [])
)
aaaaaaaaaaaaaa + {NOT_IMPLEMENTED_set_value for value in NOT_IMPLEMENTED_set}
# Wraps it in parentheses if it needs to break both left and right

View file

@ -121,7 +121,7 @@ with (
# currently unparsable by black: https://github.com/psf/black/issues/3678
with (i for i in []):
with (NOT_YET_IMPLEMENTED_generator_key for NOT_YET_IMPLEMENTED_generator_key in []):
pass
with (a, *NOT_YET_IMPLEMENTED_ExprStarred):
pass