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

Fix typing of deprecated aliases #44

Merged
merged 6 commits into from
Jan 18, 2024
Merged

Fix typing of deprecated aliases #44

merged 6 commits into from
Jan 18, 2024

Conversation

TheTripleV
Copy link
Member

This fixes type hints in Pylance. The module __getattr__ throws off its checking of what types are actually available.

This hides the __getattr__ from type checkers

This fixes type hints in Pylance. The module `__getattr__` throws off its checking of what types are actually available.

This hides the `__getattr__` from type checkers
CommandScheduler.getInstance().registerSubsystem(instance)
return instance
if not TYPE_CHECKING:
def __new__(cls, *arg, **kwargs) -> "Subsystem":
Copy link
Member

Choose a reason for hiding this comment

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

This seems wrong. We should return typing.Self instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. But typing.Self was added in 3.11 according to https://docs.python.org/3/library/typing.html#typing.Self

Copy link
Member

Choose a reason for hiding this comment

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

We're already using typing_extensions in command, so let's just use it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, swapped it over

@TheTripleV
Copy link
Member Author

Here's what all the typehints are before this PR
Screenshot 2024-01-17 at 11 53 12 PM

Copy link
Member

@auscompgeek auscompgeek left a comment

Choose a reason for hiding this comment

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

LGTM with nit

commands2/__init__.py Outdated Show resolved Hide resolved
TheTripleV and others added 2 commits January 18, 2024 00:46
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
@TheTripleV TheTripleV merged commit a088f5d into main Jan 18, 2024
19 checks passed
@TheTripleV TheTripleV deleted the TheTripleV-patch-1 branch January 18, 2024 09:55
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