mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[BE] Enable ruff's UP rules and autoformat tools and scripts (#105428)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/105428 Approved by: https://github.com/albanD, https://github.com/soulitzer, https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
5666d20bb8
commit
14d87bb5ff
@ -31,7 +31,7 @@ def generate_example_rst(example_case: ExportCase):
|
||||
if isinstance(model, torch.nn.Module)
|
||||
else inspect.getfile(model)
|
||||
)
|
||||
with open(source_file, "r") as file:
|
||||
with open(source_file) as file:
|
||||
source_code = file.read()
|
||||
source_code = re.sub(r"from torch\._export\.db\.case import .*\n", "", source_code)
|
||||
source_code = re.sub(r"@export_case\((.|\n)*?\)\n", "", source_code)
|
||||
@ -114,7 +114,7 @@ def generate_index_rst(example_cases, tag_to_modules, support_level_to_modules):
|
||||
|
||||
tag_names = "\n ".join(t for t in tag_to_modules.keys())
|
||||
|
||||
with open(os.path.join(PWD, "blurb.txt"), "r") as file:
|
||||
with open(os.path.join(PWD, "blurb.txt")) as file:
|
||||
blurb = file.read()
|
||||
|
||||
# Generate contents of the .rst file
|
||||
|
Reference in New Issue
Block a user