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

Attempt to fix mypy failure on ci #8128

Closed
wants to merge 1 commit into from
Closed

Attempt to fix mypy failure on ci #8128

wants to merge 1 commit into from

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Nov 22, 2023

Copy link

pytorch-bot bot commented Nov 22, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8128

Note: Links to docs will display an error until the docs builds have been completed.

❌ 6 New Failures, 6 Unrelated Failures

As of commit 9ba6f6c with merge base 893b4ab (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

if root is not None:
self.root: str = root
else:
self.root = root # type: ignore[assignment]
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for fixing this @vfdev-5

Would it work to just write this line unconditionally?

If there's no cleaner why to please mypy here, I'd suggest to stop type-checking this part of the code-base. It's not worth wasting time on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if we can write it in single line...

Technically, mypy is right as root arg is Optional[str], so self.root type is Optional[str]. In subclasses we are passing root string, but self.root inherits the original type: Optional[str].

we can force the cast as (+/- some type ignores)

self.root: str = root

but this wont be correct.

Alternatively, as you say we can stop type checking this code and all related subclasses...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just seen that this PR is on the origin of this problem: #8124

@pmeier
Copy link
Collaborator

pmeier commented Nov 23, 2023

Superseded by #8134.

@pmeier pmeier closed this Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants