Skip to content

Commit a3abfa5

Browse files
XuehaiPanpytorchmergebot
authored andcommitted
[BE][Easy][1/19] enforce style for empty lines in import segments (pytorch#129752)
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#129752 Approved by: https://github.com/ezyang, https://github.com/malfet
1 parent 5e617d7 commit a3abfa5

31 files changed

+33
-11
lines changed

.circleci/codegen_validation/normalize_yaml_fragment.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import yaml
77

8+
89
# Need to import modules that lie on an upward-relative path
910
sys.path.append(os.path.join(sys.path[0], ".."))
1011

.circleci/scripts/trigger_azure_pipeline.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import requests
1010

11+
1112
AZURE_PIPELINE_BASE_URL = "https://aiinfra.visualstudio.com/PyTorch/"
1213
AZURE_DEVOPS_PAT_BASE64 = os.environ.get("AZURE_DEVOPS_PAT_BASE64_SECRET", "")
1314
PIPELINE_ID = "911"

android/pytorch_android/generate_test_torchscripts.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import torch
44
from torch import Tensor
55

6+
67
OUTPUT_DIR = "src/androidTest/assets/"
78

89

android/test_app/make_assets.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import torch
44

5+
56
print(torch.version.__version__)
67

78
resnet18 = models.resnet18(weights=models.ResNet18_Weights.IMAGENET1K_V1)

android/test_app/make_assets_custom.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import torch
1111

12+
1213
# Download and trace the model.
1314
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
1415
model.eval()

aten/src/ATen/native/quantized/cpu/qnnpack/deps/clog/configure.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import confu
1010

11+
1112
parser = confu.standard_parser("clog configuration script")
1213

1314

aten/src/ATen/native/transformers/cuda/flash_attn/kernels/generate_kernels.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pathlib import Path
88
from typing import List, Optional
99

10+
1011
DTYPE_MAP = {
1112
"fp16": "cutlass::half_t",
1213
"bf16": "cutlass::bfloat16_t",

aten/src/ATen/native/transformers/cuda/mem_eff_attention/kernels/generate_kernels.py

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from pathlib import Path
1616
from typing import Dict, List, Optional, Tuple, TypeVar
1717

18+
1819
DTYPES = {
1920
"f32": "float",
2021
"f16": "cutlass::half_t",

docs/cpp/source/conf.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
# NB: C++ API doc generation using doxygen / breathe / exhale is currently only
1919
# enabled on nightlies (and not trunk or on PRs) due to OOM errors in CI.
2020
# See https://github.com/pytorch/pytorch/issues/79992.
21+
2122
import os
23+
import textwrap
24+
2225

2326
# sys.path.insert(0, os.path.abspath('.'))
2427

25-
import textwrap
2628

2729
# -- General configuration ------------------------------------------------
2830

docs/source/conf.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
# source code directory, relative to this file, for sphinx-autobuild
2626
# sys.path.insert(0, os.path.abspath('../..'))
27-
2827
import torch
2928

29+
3030
try:
3131
import torchvision # noqa: F401
3232
except ImportError:
@@ -38,6 +38,7 @@
3838

3939
import pytorch_sphinx_theme
4040

41+
4142
# -- General configuration ------------------------------------------------
4243

4344
# If your documentation needs a minimal Sphinx version, state it here.
@@ -3475,6 +3476,7 @@
34753476

34763477
from sphinx.ext.coverage import CoverageBuilder
34773478

3479+
34783480
# NB: Due to some duplications of the following modules/functions, we keep
34793481
# them as expected failures for the time being instead of return 1
34803482
ignore_duplicated_modules = {
@@ -3722,11 +3724,11 @@ def visit_reference(self, node):
37223724

37233725
# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
37243726
# See http://stackoverflow.com/a/41184353/3343043
3725-
37263727
from docutils import nodes
37273728
from sphinx import addnodes
37283729
from sphinx.util.docfields import TypedField
37293730

3731+
37303732
# Without this, doctest adds any example with a `>>>` as a test
37313733
doctest_test_doctest_blocks = ""
37323734
doctest_default_flags = sphinx.ext.doctest.doctest.ELLIPSIS

docs/source/scripts/build_activation_images.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import torch
1313

14+
1415
matplotlib.use("Agg")
1516

1617

docs/source/scripts/build_opsets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import torch
66
import torch._prims as prims
7-
87
from torchgen.gen import parse_native_yaml
98

9+
1010
ROOT = Path(__file__).absolute().parent.parent.parent.parent
1111
NATIVE_FUNCTION_YAML_PATH = ROOT / Path("aten/src/ATen/native/native_functions.yaml")
1212
TAGS_YAML_PATH = ROOT / Path("aten/src/ATen/native/tags.yaml")

docs/source/scripts/exportdb/generate_example_rst.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import torch
77
import torch._dynamo as torchdynamo
8-
98
from torch._export.db.case import ExportCase
109
from torch._export.db.examples import all_examples
1110
from torch.export import export

docs/source/scripts/onnx/build_onnx_torchscript_supported_aten_op_csv_table.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from torch.onnx import _onnx_supported_ops
1010

11+
1112
# Constants
1213
BUILD_DIR = "build/onnx"
1314
SUPPORTED_OPS_CSV_FILE = "auto_gen_supported_op_list.csv"

ios/TestApp/benchmark/coreml_backend.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from torchvision import models
22

33
import torch
4-
54
from torch.backends._coreml.preprocess import CompileSpec, CoreMLComputeUnit, TensorSpec
65

76

ios/TestApp/benchmark/trace_model.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import torch
44
from torch.utils.mobile_optimizer import optimize_for_mobile
55

6+
67
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
78
model.eval()
89
example = torch.rand(1, 3, 224, 224)

ios/TestApp/custom_build/custom_build.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import torch
55

6+
67
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
78
model.eval()
89
example = torch.rand(1, 3, 224, 224)

ios/TestApp/run_on_aws_devicefarm.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import boto3
1313
import requests
1414

15+
1516
POLLING_DELAY_IN_SECOND = 5
1617
MAX_UPLOAD_WAIT_IN_SECOND = 600
1718

scripts/analysis/format_test_csv.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import subprocess
2121
import sys
2222

23+
2324
parser = argparse.ArgumentParser(
2425
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
2526
)

scripts/compile_tests/common.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import warnings
44

5+
56
try:
67
import lxml.etree
78

scripts/compile_tests/failures_histogram.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import re
33

44
from common import download_reports, get_testcases, key, open_test_results, skipped_test
5-
65
from passrate import compute_pass_rate
76

87

scripts/compile_tests/passrate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
key,
88
open_test_results,
99
)
10-
1110
from download_reports import download_reports
1211

12+
1313
"""
1414
Usage: passrate.py commit_sha
1515

scripts/compile_tests/update_failures.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
key,
1313
open_test_results,
1414
)
15-
1615
from download_reports import download_reports
1716

17+
1818
"""
1919
Usage: update_failures.py /path/to/dynamo_test_failures.py /path/to/test commit_sha
2020

scripts/diagnose_protobuf.py

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import re
1818
from subprocess import PIPE, Popen
1919

20+
2021
# Get python protobuf version.
2122
try:
2223
import google.protobuf

scripts/export/update_schema.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from torch._export.serde import schema_check
77

8+
89
if __name__ == "__main__":
910
parser = argparse.ArgumentParser(prog="update_schema")
1011
parser.add_argument(

scripts/get_python_cmake_flags.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import sysconfig
1818

19+
1920
flags = [
2021
f"-DPython_EXECUTABLE:FILEPATH={sys.executable}",
2122
]

scripts/jit/log_extract.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
run_nvfuser,
1212
)
1313

14+
1415
"""
1516
Usage:
1617
1. Run your script and pipe into a log file

scripts/release_notes/apply_categories.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import commitlist
88

9+
910
category_csv = "results/category_data.csv"
1011
commitlist_csv = "results/commitlist.csv"
1112

scripts/release_notes/namespace_check.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import torch
66

7+
78
# Import all utils so that getattr below can find them
89

910
all_submod_list = [

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
import os
202202
import sys
203203

204+
204205
if sys.platform == "win32" and sys.maxsize.bit_length() == 31:
205206
print(
206207
"32-bit Windows Python runtime is not supported. Please switch to 64-bit Python."
@@ -209,6 +210,7 @@
209210

210211
import platform
211212

213+
212214
BUILD_LIBTORCH_WHL = os.getenv("BUILD_LIBTORCH_WHL", "0") == "1"
213215
BUILD_PYTHON_ONLY = os.getenv("BUILD_PYTHON_ONLY", "0") == "1"
214216

@@ -236,7 +238,6 @@
236238
import setuptools.command.sdist
237239
from setuptools import Extension, find_packages, setup
238240
from setuptools.dist import Distribution
239-
240241
from tools.build_pytorch_libs import build_caffe2
241242
from tools.generate_torch_version import get_torch_version
242243
from tools.setup_helpers.cmake import CMake

tools/linter/adapters/ufmt_linter.py

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
fnmatch.translate,
3030
[
3131
# **
32-
"**",
3332
# .ci/**
3433
".ci/**",
3534
# .github/**

0 commit comments

Comments
 (0)