Skip to content

Conversation

@tekktrik
Copy link
Member

@tekktrik tekktrik commented Jul 12, 2022

The library docs substitute things like ReadableBuffer with the full Union, and I'm wondering if typing it explicitly as a TypeAlias might help. Either way, it's more documentation.

  • Adds TypeAlias type annotation to type aliases
  • Because behind the scene importing something from typing_extnesions that is available from typing will just import it from there, I've removed the try/except block for testing, but only for simplicity.
  • TypeAlias is available in any 4.0 compatible release of typing_extensions
  • Similarly, I've removed the Python<3.7 conditional since now everything under 3.10 will need it, which is the other reason to just safely import things from typing_extensions.
  • pylint got real mad all of a sudden about unused-argument and no-self-use warnings resulting from Protocol definitions, so they've been disabled permanently. I didn't see any issue with this since this library is non-functional in purpose, but happy to change it if there's a better solution.

@tekktrik tekktrik requested a review from a team July 12, 2022 20:23
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

Looks good to me.

simplifying our imports by leveraging the internal checking is welcome I think.

Also seems fine for this library to disable those specific pylint checks since everything in here is intended for defining types rather than being function and doing things.

Thank you @tekktrik

@FoamyGuy FoamyGuy merged commit 07db7a3 into adafruit:main Aug 15, 2022
@tekktrik tekktrik deleted the dev/use-type-alias branch December 1, 2022 03:58
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.

2 participants