Skip to content

Commit

Permalink
Enable import following in MYPY (now MYPYINDUCTOR) (#113830)
Browse files Browse the repository at this point in the history
Summary:
Skipping importing some packages for now to make this change more
tractable.

For some reason, lintrunner on CI raises errors in all imported `.pyi` files,
even though it doesn't on my local machine. The errors are all from missing
generic types, as the MYPYINDUCTOR config has `disallow_any_generics`
set. I have thus added `disable-error-code` comments to the relevant files,
though I fixed a few that were easy enough.

X-link: pytorch/pytorch#113830
Approved by: https://github.com/Skylion007
ghstack dependencies: #113722, #113721

Reviewed By: huydhn

Differential Revision: D51444167

Pulled By: int3

fbshipit-source-id: 0f221fed326a448c59e4f7c1196ee2127ca47663
  • Loading branch information
int3 authored and facebook-github-bot committed Nov 19, 2023
1 parent 10d61e8 commit 1b2034e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,7 @@ def get_fake_value(node, tx, allow_non_graph_fake=False):
If `True`, you must be prepared to deal with such return values, ideally
by further wrapping them as this graph's fakes.
"""
from torch.utils._sympy.value_ranges import ValueRangeError
from .exc import (
TorchRuntimeError,
unimplemented,
Expand Down Expand Up @@ -1518,7 +1519,7 @@ def get_fake_value(node, tx, allow_non_graph_fake=False):
f"constrain_as_value OR constrain_as_size APIs. {cause}",
case_name="constrain_as_size_example",
)
elif isinstance(cause, torch.utils._sympy.value_ranges.ValueRangeError):
elif isinstance(cause, ValueRangeError):
raise UserError(UserErrorType.CONSTRAINT_VIOLATION, e.args[0]) from e
raise TorchRuntimeError(str(e)).with_traceback(e.__traceback__) from None

Expand Down

0 comments on commit 1b2034e

Please sign in to comment.