Skip to content

Commit

Permalink
Fix linter F821 error (pytorch#146665)
Browse files Browse the repository at this point in the history
Fixes #ISSUE_NUMBER

Pull Request resolved: pytorch#146665
Approved by: https://github.com/Skylion007

Co-authored-by: Aaron Gokaslan <[email protected]>
  • Loading branch information
2 people authored and pytorchmergebot committed Feb 8, 2025
1 parent a3ca5c7 commit 46e83bb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/test_sort_and_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def check_order(a, b):
return ((b != b) | (a <= b)).all().item()

else:
error( # noqa: F821
raise ValueError(
f'unknown order "{order}", must be "ascending" or "descending"'
)

Expand Down
4 changes: 2 additions & 2 deletions test/test_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def test_train_with_pad_and_catch_error(self, device):
encoder(test, src_key_padding_mask=pad_mask.to(torch.uint8))
except AssertionError:
continue
self.assertFalse(e, "Failed to catch unsupported uint8 type exception") # noqa: F821
self.assertFalse(e, "Failed to catch unsupported uint8 type exception")

test_train_bool = encoder(test, src_key_padding_mask=pad_mask)
encoder.eval()
Expand All @@ -335,7 +335,7 @@ def test_train_with_pad_and_catch_error(self, device):
encoder(test, src_key_padding_mask=pad_mask.to(torch.int64))
except AssertionError as e:
continue
self.assertFalse(e, "Failed to catch unsupported Long type exception") # noqa: F821
self.assertFalse(e, "Failed to catch unsupported Long type exception")

test_eval_bool = encoder(test, src_key_padding_mask=pad_mask)
l1_bool = nn.L1Loss()(test_train_bool[:, 0:2, :], test_eval_bool[:, 0:2, :]).item()
Expand Down
2 changes: 1 addition & 1 deletion torch/testing/_internal/jit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def checkScript(self,
script_outputs = scripted_fn(*recording_inputs)
with self.capture_stdout():
opt_script_outputs = scripted_fn(*recording_inputs)
with self.capture_stdout() as _python_stdout:
with self.capture_stdout():
python_outputs = python_fn(*inputs)
if not IS_WINDOWS:
self.assertExpected(script_stdout[0], subname='stdout')
Expand Down

0 comments on commit 46e83bb

Please sign in to comment.