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

Refactor _check_import_or_attribute #439

Closed
wants to merge 1 commit into from

Conversation

AlexWaygood
Copy link
Collaborator

No functional change -- just a small refactor to reduce repetition and (hopefully) make the function slightly more efficient

Copy link

github-actions bot commented Nov 2, 2023

This change has no effect on typeshed. 🤖🎉

Copy link
Collaborator

@srittau srittau 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 not super happy with either the previous version nor this new version. Both have these if/elif/else cascades with the occasional return in between, which make it hard to follow the program flow. I wonder whether extracting functions like _check_typing_attribute() and _check_typing_extensions_attribute() would make the flow easier to understand.

That said, this is already an improvement to the status quo.

@AlexWaygood
Copy link
Collaborator Author

I wonder whether extracting functions like _check_typing_attribute() and _check_typing_extensions_attribute() would make the flow easier to understand.

yeah, I wondered about that too. I'll give it a go as a separate PR, then we can decide which one we like more

@AlexWaygood
Copy link
Collaborator Author

Superseded by #440

@AlexWaygood AlexWaygood closed this Nov 3, 2023
@AlexWaygood AlexWaygood deleted the refactor-import-checks branch November 3, 2023 14:42
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