Skip to content

Commit f6838d5

Browse files
XuehaiPanpytorchmergebot
authored andcommitted
[BE][Easy][5/19] enforce style for empty lines in import segments in tools/ and torchgen/ (pytorch#129756)
See pytorch#129751 (comment). Most changes are auto-generated by linter. You can review these PRs via: ```bash git diff --ignore-all-space --ignore-blank-lines HEAD~1 ``` Pull Request resolved: pytorch#129756 Approved by: https://github.com/ezyang
1 parent ba48cf6 commit f6838d5

31 files changed

+47
-15
lines changed

tools/amd_build/build_amd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import sys
77

8+
89
sys.path.append(
910
os.path.realpath(
1011
os.path.join(
@@ -15,6 +16,7 @@
1516

1617
from hipify import hipify_python # type: ignore[import]
1718

19+
1820
parser = argparse.ArgumentParser(
1921
description="Top-level script for HIPifying, filling in most common parameters"
2022
)

tools/autograd/gen_inplace_or_view_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
OptionalCType,
2525
symIntArrayRefT,
2626
SymIntT,
27-
tensorT, # See Note [Nested Arg Types]
27+
tensorT,
2828
)
2929
from torchgen.code_template import CodeTemplate
3030
from torchgen.context import with_native_function

tools/build_libtorch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
from os.path import abspath, dirname
44

5+
56
# By appending pytorch_root to sys.path, this module can import other torch
67
# modules even when run as a standalone script. i.e., it's okay either you
78
# do `python build_libtorch.py` or `python -m tools.build_libtorch`.
@@ -11,6 +12,7 @@
1112
from tools.build_pytorch_libs import build_caffe2
1213
from tools.setup_helpers.cmake import CMake
1314

15+
1416
if __name__ == "__main__":
1517
# Placeholder for future interface. For now just gives a nice -h.
1618
parser = argparse.ArgumentParser(description="Build libtorch")

tools/linter/adapters/s3_init.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import urllib.request
1212
from pathlib import Path
1313

14+
1415
# String representing the host platform (e.g. Linux, Darwin).
1516
HOST_PLATFORM = platform.system()
1617
HOST_PLATFORM_ARCH = platform.system() + "-" + platform.processor()

tools/linter/adapters/ufmt_linter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
# functorch/**
3737
"functorch/**",
3838
# tools/**
39-
"tools/**",
4039
# torchgen/**
41-
"torchgen/**",
4240
# test/**
4341
# test/[a-c]*/**
4442
"test/[a-c]*/**",

tools/setup_helpers/gen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import os.path
44
import sys
55

6+
67
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
78
sys.path.insert(0, root)
89

910
import torchgen.gen
1011

12+
1113
torchgen.gen.main()

tools/setup_helpers/gen_unboxing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import os.path
44
import sys
55

6+
67
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
78
sys.path.insert(0, root)
89

910
import tools.jit.gen_unboxing
1011

12+
1113
tools.jit.gen_unboxing.main(sys.argv[1:])

tools/setup_helpers/generate_code.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import yaml
1010

11+
1112
try:
1213
# use faster C loader if available
1314
from yaml import CSafeLoader as YamlLoader
@@ -30,6 +31,7 @@ def generate_code(
3031
) -> None:
3132
from tools.autograd.gen_annotated_fn_args import gen_annotated
3233
from tools.autograd.gen_autograd import gen_autograd, gen_autograd_python
34+
3335
from torchgen.selective_build.selector import SelectiveBuilder
3436

3537
# Build ATen based Variable classes

tools/stats/export_test_times.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
from pathlib import Path
33

4+
45
REPO_ROOT = Path(__file__).resolve().parent.parent.parent
56
sys.path.append(str(REPO_ROOT))
67
from tools.stats.import_test_stats import get_test_class_times, get_test_times

tools/stats/import_test_stats.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from typing import Any, Callable, cast, Dict
1111
from urllib.request import urlopen
1212

13+
1314
REPO_ROOT = Path(__file__).resolve().parent.parent.parent
1415

1516

0 commit comments

Comments
 (0)