bwhmather / ssort

Tool for automatically sorting python statements within a module
MIT License
360 stars 10 forks source link

Support traversal of TypeAlias for Python 3.12 #115

Closed ericbn closed 5 months ago

ericbn commented 5 months ago

Also update tox and GitHub Actions to use Python 3.12 by default.

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 8745231098

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ssort/_parsing.py 8 9 88.89%
<!-- Total: 82 83 98.8% -->
Totals Coverage Status
Change from base Build 7702612545: 0.002%
Covered Lines: 1356
Relevant Lines: 1380

💛 - Coveralls
bwhmather commented 5 months ago

I think this is just about done. Should have time this evening to do a full read through then will merge and bake a release.

ericbn commented 5 months ago

Cool! I've reverted _optional_nested_brackets. The reason I didn't want to hoist it was because I thought it would have a weird signature, as if depends on both token and tokens, and mutates token:

    token = _optional_nested_brackets(token, tokens, "[", "]")
    token = _optional_nested_brackets(token, tokens, "(", ")")

Instead, I think this would be better refactored as a having split_class become a class and _optional_nested_brackets a private method, with token and tokens being instance attributes. I tried a similar effect first by having _optional_nested_brackets as a closure.