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 some type checking errors after removing type hint ignores #567

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

YaySushi
Copy link
Contributor

This fixes (a very small) part of issue #476.

Notes:
pytest reported the same stats before and after my changes.
Some removals of # type: ignore did not result in an error from pyright (some status code comparisons)

@YaySushi
Copy link
Contributor Author

Not sure how to add reviewers (first time here), @ahal could you please review?

@jcristau jcristau requested review from a team and bhearsum September 2, 2024 05:55
Copy link
Contributor

@bhearsum bhearsum left a comment

Choose a reason for hiding this comment

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

Thank you for doing this! There's a couple of minor things I'd like to see changed before this merges, but it looks great overall!

src/taskgraph/main.py Show resolved Hide resolved
@@ -862,7 +864,10 @@ def init_taskgraph(options):
context = {"project_name": root.name, "taskgraph_version": taskgraph.__version__}

try:
repo_url = repo.get_url(remote=repo.remote_name) # type: ignore
if isinstance(repo.remote_name, str):
Copy link
Contributor

Choose a reason for hiding this comment

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

This check looks like it ought to be unnecessary. remote_name appears to be a string in all cases that don't result in an Exception. I think if you update the properties and helper function that they end up calling, that this check can go away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed (I think). Please take a look at the new changes

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me - thank you!

@@ -672,6 +673,7 @@ def handlepullerror(e):
# We only pull if we are using symbolic names or the requested revision
# doesn't exist.
havewantedrev = False
checkoutrevision = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Hooray, this fixes some cases where this is potentially undefined!

@@ -51,45 +51,57 @@ def run(self, *args: str, **kwargs):
return ""
raise

@abstractproperty
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL that abstractproperty is deprecated. Thanks for updating this!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. It seems datetime.utcnow is as well, but I have left it unchanged.

@bhearsum bhearsum merged commit 3f1ec24 into taskcluster:main Sep 3, 2024
11 checks passed
@bhearsum
Copy link
Contributor

bhearsum commented Sep 3, 2024

Thank you so much for adding so many type hints @YaySushi!

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