Charlie Marsh
5df0326bc8
Treat parameters-with-newline as empty in function formatting ( #7550 )
...
## Summary
If a function has no parameters (and no comments within the parameters'
`()`), we're supposed to wrap the return annotation _whenever_ it
breaks. However, our `empty_parameters` test didn't properly account for
the case in which the parameters include a newline (but no other
content), like:
```python
def get_dashboards_hierarchy(
) -> Dict[Type['BaseDashboard'], List[Type['BaseDashboard']]]:
"""Get hierarchy of dashboards classes.
Returns:
Dict of dashboards classes.
"""
dashboards_hierarchy = {}
```
This PR fixes that detection. Instead of lexing, it now checks if the
parameters itself is empty (or if it contains comments).
Closes https://github.com/astral-sh/ruff/issues/7457 .
2023-09-20 16:20:22 -04:00
..
2023-08-30 04:11:58 +00:00
2023-06-30 06:32:50 +00:00
2023-08-01 08:26:30 +02:00
2023-08-31 20:55:05 +00:00
2023-08-14 12:28:58 +00:00
2023-08-01 08:26:30 +02:00
2023-07-11 16:40:28 +02:00
2023-08-24 09:47:57 +00:00
2023-06-30 06:32:50 +00:00
2023-08-01 08:26:30 +02:00
2023-08-16 15:05:51 +00:00
2023-07-29 10:06:26 -04:00
2023-08-28 08:09:17 +00:00
2023-08-26 14:45:44 +00:00
2023-07-19 13:01:58 +02:00
2023-07-24 07:04:40 +00:00
2023-06-30 06:32:50 +00:00
2023-08-15 07:15:33 -04:00
2023-09-01 06:34:51 +00:00
2023-07-31 16:58:15 -04:00
2023-08-30 16:03:17 +02:00
2023-08-30 16:03:17 +02:00
2023-08-14 12:28:58 +00:00
2023-09-14 08:43:53 +00:00
2023-08-14 15:57:36 +00:00
2023-08-31 20:55:05 +00:00
2023-08-31 20:55:05 +00:00
2023-08-31 20:55:05 +00:00
2023-07-11 16:51:24 +02:00
2023-08-01 15:30:59 +00:00
2023-08-04 13:58:01 +00:00
2023-07-26 16:21:23 +00:00
2023-08-15 18:59:18 +00:00
2023-08-30 08:07:11 +00:00
2023-07-10 21:23:49 +02:00
2023-07-19 11:47:56 +00:00
2023-08-15 18:59:18 +00:00
2023-09-01 06:34:51 +00:00
2023-08-24 14:09:25 +02:00
2023-07-31 10:46:40 +02:00
2023-06-30 10:13:23 +02:00
2023-09-19 16:16:40 +02:00
2023-09-18 06:08:10 +00:00
2023-09-18 06:08:10 +00:00
2023-09-18 06:08:10 +00:00
2023-09-18 06:08:10 +00:00
2023-07-11 16:40:28 +02:00
2023-09-14 05:05:37 -04:00
2023-09-18 09:56:41 -04:00
2023-09-12 09:49:51 +02:00
2023-09-20 08:39:25 +02:00
2023-09-12 06:39:57 +00:00
2023-09-19 16:16:40 +02:00
2023-09-16 16:21:45 +02:00
2023-09-14 08:43:53 +00:00
2023-09-19 19:17:21 +00:00
2023-09-19 19:17:21 +00:00
2023-09-01 16:27:32 +00:00
2023-09-08 10:53:34 +02:00
2023-08-30 04:11:58 +00:00
2023-09-19 15:23:51 -04:00
2023-09-16 17:19:34 +00:00
2023-08-25 00:18:05 -04:00
2023-08-21 16:29:26 +02:00
2023-07-20 10:07:22 +00:00
2023-09-14 13:04:14 +02:00
2023-08-11 17:58:42 +00:00
2023-08-16 13:41:07 +00:00
2023-09-19 16:16:40 +02:00
2023-09-14 05:05:37 -04:00
2023-08-30 08:07:11 +00:00
2023-09-16 13:07:38 -04:00
2023-09-20 08:39:25 +02:00
2023-07-21 12:07:51 +00:00
2023-09-16 14:46:56 -04:00
2023-08-15 08:00:35 +02:00
2023-08-14 15:57:36 +00:00
2023-09-19 16:16:40 +02:00
2023-08-14 15:57:36 +00:00
2023-09-19 16:16:40 +02:00
2023-08-14 15:57:36 +00:00
2023-09-19 16:16:40 +02:00
2023-08-31 20:55:05 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-17 05:58:19 +00:00
2023-08-17 05:58:19 +00:00
2023-08-25 19:03:37 +00:00
2023-08-17 06:05:41 +00:00
2023-08-17 06:05:41 +00:00
2023-08-21 17:45:23 +02:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-08-31 20:55:05 +00:00
2023-09-04 10:57:04 +01:00
2023-09-12 06:39:57 +00:00
2023-08-23 00:44:33 +00:00
2023-08-23 00:40:18 -04:00
2023-09-19 16:16:40 +02:00
2023-07-13 10:51:25 +00:00
2023-09-20 08:39:25 +02:00
2023-09-19 16:16:40 +02:00
2023-09-16 16:21:45 +02:00
2023-07-13 10:51:25 +00:00
2023-06-26 14:15:55 +02:00
2023-08-30 08:20:28 +02:00
2023-08-30 08:07:11 +00:00
2023-08-23 14:01:14 +00:00
2023-08-22 12:18:59 +02:00
2023-08-31 20:55:05 +00:00
2023-08-02 19:55:00 +00:00
2023-08-11 11:21:16 +00:00
2023-08-15 07:15:33 -04:00
2023-08-22 12:27:40 -04:00
2023-08-30 09:52:51 -04:00
2023-09-17 14:56:41 +00:00
2023-08-02 19:55:00 +00:00
2023-08-15 18:59:18 +00:00
2023-09-20 16:20:22 -04:00
2023-08-29 08:30:05 +02:00
2023-08-15 09:33:57 +02:00
2023-08-21 09:02:23 +02:00
2023-08-30 08:07:11 +00:00
2023-08-02 20:40:32 +00:00
2023-08-30 08:07:11 +00:00
2023-08-18 03:30:38 +00:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-09-19 16:16:40 +02:00
2023-09-01 14:52:59 +02:00
2023-06-26 14:15:55 +02:00