Skip to content

Commit

Permalink
Relax mypy in prototype namespace (#7091)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeier authored Jan 16, 2023
1 parent f71c430 commit 8985b59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
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.*]
[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)

# 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

0 comments on commit 8985b59

Please sign in to comment.