Skip to content

Relax mypy in prototype namespace #7091

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

Merged
merged 3 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ allow_redefinition = True
no_implicit_optional = True
warn_redundant_casts = True

[mypy-torchvision.prototype.features.*]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Driveby

[mypy-torchvision.prototype.datapoints.*]

; untyped definitions and calls
disallow_untyped_defs = True
Expand All @@ -17,7 +17,6 @@ no_implicit_optional = True

; warnings
warn_unused_ignores = True
warn_return_any = True

; miscellaneous strictness flags
allow_redefinition = True
Expand Down Expand Up @@ -46,8 +45,6 @@ no_implicit_optional = True

; warnings
warn_unused_ignores = True
warn_return_any = True
warn_unreachable = True

; miscellaneous strictness flags
allow_redefinition = True
Expand Down
2 changes: 1 addition & 1 deletion torchvision/prototype/datapoints/_datapoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __torch_function__(
# `args = (torch.Tensor(), datapoints.Image())` first. Without this guard, the original `torch.Tensor` would
# be wrapped into a `datapoints.Image`.
if wrapper and isinstance(args[0], cls):
return wrapper(cls, args[0], output) # type: ignore[no-any-return]
return wrapper(cls, args[0], output)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No longer needed without the extra strictness.


# Inplace `func`'s, canonically identified with a trailing underscore in their name like `.add_(...)`,
# will retain the input type. Thus, we need to unwrap here.
Expand Down