Fix instability with await fluent style (#8676)
Fix an instability where await was followed by a breaking fluent style
expression:
```python
test_data = await (
Stream.from_async(async_data)
.flat_map_async()
.map()
.filter_async(is_valid_data)
.to_list()
)
```
Note that this technically a minor style change (see ecosystem check)
This commit is contained in:
@@ -93,7 +93,7 @@ async def main():
|
||||
```diff
|
||||
--- Black
|
||||
+++ Ruff
|
||||
@@ -21,7 +21,9 @@
|
||||
@@ -21,11 +21,15 @@
|
||||
|
||||
# Check comments
|
||||
async def main():
|
||||
@@ -103,6 +103,13 @@ async def main():
|
||||
+ )
|
||||
|
||||
|
||||
async def main():
|
||||
- await asyncio.sleep(1) # Hello
|
||||
+ await (
|
||||
+ asyncio.sleep(1) # Hello
|
||||
+ )
|
||||
|
||||
|
||||
async def main():
|
||||
```
|
||||
|
||||
@@ -138,7 +145,9 @@ async def main():
|
||||
|
||||
|
||||
async def main():
|
||||
await asyncio.sleep(1) # Hello
|
||||
await (
|
||||
asyncio.sleep(1) # Hello
|
||||
)
|
||||
|
||||
|
||||
async def main():
|
||||
|
||||
@@ -54,6 +54,15 @@ await (
|
||||
# comment
|
||||
[foo]
|
||||
)
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/8644
|
||||
test_data = await (
|
||||
Stream.from_async(async_data)
|
||||
.flat_map_async()
|
||||
.map()
|
||||
.filter_async(is_valid_data)
|
||||
.to_list()
|
||||
)
|
||||
```
|
||||
|
||||
## Output
|
||||
@@ -122,6 +131,15 @@ await (
|
||||
# comment
|
||||
[foo]
|
||||
)
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/8644
|
||||
test_data = await (
|
||||
Stream.from_async(async_data)
|
||||
.flat_map_async()
|
||||
.map()
|
||||
.filter_async(is_valid_data)
|
||||
.to_list()
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user