Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ruff and typing updates #1476

Merged
merged 4 commits into from Apr 18, 2023
Merged

Conversation

henryiii
Copy link
Contributor

This adds a couple of Ruff checks, and updates typing. The deprecated typing generic aliases are replaced by proper collections.abc counterparts, checked by an added Ruff check. And list/set/dict have been updated to Protocols when used as an input.

  • chore: touch up Ruff, add exe check
  • chore: add Ruff logging format check
  • chore: update typing to collections.abc
  • chore: update typing to be generic on function args

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused by the typing.Something -> collections.abc.Something change. Are abstract base classes the same as protocols? My understanding is that a protocol is something that anything can conform to, as long as it has the right interface and regardless of its class hierarchy, but an ABC needs to be subclassed to be considered a match. By that logic Protocols seems more appropriate, I think.

Hmm. I just found PEP 585, it seems I have some reading to do!

@joerick
Copy link
Contributor

joerick commented Apr 18, 2023

Ahh, I see that these types were always aliases to collections.abc, even before Python 3.9. So my point around Protocols is invalid. Still not totally sure I understand why typing works this way, but I see that this PR does indeed fix the use of the deprecated types, so it seems good to me.

@joerick joerick merged commit dfbc6c3 into pypa:main Apr 18, 2023
24 checks passed
@henryiii henryiii deleted the henryiii/chore/ruff_ex branch April 18, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants