asyncstdlib
asyncstdlib copied to clipboard
Switch itertools.groupby closures to class implementation
The itertools.groupby implementation currently follows the standard library pure-python implementation. This heavily uses closures to share state between three interlocked async generator functions.
This is confusing for code scanning (https://github.com/maxfischer2781/asyncstdlib/security/code-scanning/85, https://github.com/maxfischer2781/asyncstdlib/security/code-scanning/84) and admittedly for humans as well.
In the interest of maintainability, the code should be refactored with the goal of being more readable/understandable. Similar to other cases, prominently itertools.tee, a class based approach seems appropriate.