uranusjr commented on code in PR #33535: URL: https://github.com/apache/airflow/pull/33535#discussion_r1299568930
########## airflow/www/views.py: ########## @@ -181,6 +181,11 @@ def sanitize_args(args: dict[str, str]) -> dict[str, str]: ) +def _sorted_groupby(it, key: Callable | None = None, reverse: bool = False): + """Helper around `itertools.groupby`, which pre-sort iterable by the same key.""" + yield from itertools.groupby(sorted(it, key=key, reverse=reverse), key=key) Review Comment: I’d put this function closer to its usage, maybe nested in `duration` directly. This is more than 3,000 lines apart! ########## airflow/www/views.py: ########## @@ -181,6 +181,11 @@ def sanitize_args(args: dict[str, str]) -> dict[str, str]: ) +def _sorted_groupby(it, key: Callable | None = None, reverse: bool = False): + """Helper around `itertools.groupby`, which pre-sort iterable by the same key.""" + yield from itertools.groupby(sorted(it, key=key, reverse=reverse), key=key) Review Comment: I’d put this function closer to its usage, maybe nested in `duration` directly. This is more than 3,000 lines apart! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
