Skip to content

Commit

Permalink
[BE][Easy][1/19] enforce style for empty lines in import segments (py…
Browse files Browse the repository at this point in the history
…torch#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
  • Loading branch information
XuehaiPan authored and pytorchmergebot committed Jul 16, 2024
1 parent 5e617d7 commit a3abfa5
Show file tree
Hide file tree
Showing 31 changed files with 33 additions and 11 deletions.
1 change: 1 addition & 0 deletions .circleci/codegen_validation/normalize_yaml_fragment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import yaml


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

Expand Down
1 change: 1 addition & 0 deletions .circleci/scripts/trigger_azure_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import requests


AZURE_PIPELINE_BASE_URL = "https://aiinfra.visualstudio.com/PyTorch/"
AZURE_DEVOPS_PAT_BASE64 = os.environ.get("AZURE_DEVOPS_PAT_BASE64_SECRET", "")
PIPELINE_ID = "911"
Expand Down
1 change: 1 addition & 0 deletions android/pytorch_android/generate_test_torchscripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import torch
from torch import Tensor


OUTPUT_DIR = "src/androidTest/assets/"


Expand Down
1 change: 1 addition & 0 deletions android/test_app/make_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import torch


print(torch.version.__version__)

resnet18 = models.resnet18(weights=models.ResNet18_Weights.IMAGENET1K_V1)
Expand Down
1 change: 1 addition & 0 deletions android/test_app/make_assets_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import torch


# Download and trace the model.
model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
model.eval()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import confu


parser = confu.standard_parser("clog configuration script")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path
from typing import List, Optional


DTYPE_MAP = {
"fp16": "cutlass::half_t",
"bf16": "cutlass::bfloat16_t",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pathlib import Path
from typing import Dict, List, Optional, Tuple, TypeVar


DTYPES = {
"f32": "float",
"f16": "cutlass::half_t",
Expand Down
4 changes: 3 additions & 1 deletion docs/cpp/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
# NB: C++ API doc generation using doxygen / breathe / exhale is currently only
# enabled on nightlies (and not trunk or on PRs) due to OOM errors in CI.
# See https://github.com/pytorch/pytorch/issues/79992.

import os
import textwrap


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

import textwrap

# -- General configuration ------------------------------------------------

Expand Down
6 changes: 4 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

# source code directory, relative to this file, for sphinx-autobuild
# sys.path.insert(0, os.path.abspath('../..'))

import torch


try:
import torchvision # noqa: F401
except ImportError:
Expand All @@ -38,6 +38,7 @@

import pytorch_sphinx_theme


# -- General configuration ------------------------------------------------

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

from sphinx.ext.coverage import CoverageBuilder


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

# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
# See http://stackoverflow.com/a/41184353/3343043

from docutils import nodes
from sphinx import addnodes
from sphinx.util.docfields import TypedField


# Without this, doctest adds any example with a `>>>` as a test
doctest_test_doctest_blocks = ""
doctest_default_flags = sphinx.ext.doctest.doctest.ELLIPSIS
Expand Down
1 change: 1 addition & 0 deletions docs/source/scripts/build_activation_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import torch


matplotlib.use("Agg")


Expand Down
2 changes: 1 addition & 1 deletion docs/source/scripts/build_opsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import torch
import torch._prims as prims

from torchgen.gen import parse_native_yaml


ROOT = Path(__file__).absolute().parent.parent.parent.parent
NATIVE_FUNCTION_YAML_PATH = ROOT / Path("aten/src/ATen/native/native_functions.yaml")
TAGS_YAML_PATH = ROOT / Path("aten/src/ATen/native/tags.yaml")
Expand Down
1 change: 0 additions & 1 deletion docs/source/scripts/exportdb/generate_example_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import torch
import torch._dynamo as torchdynamo

from torch._export.db.case import ExportCase
from torch._export.db.examples import all_examples
from torch.export import export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from torch.onnx import _onnx_supported_ops


# Constants
BUILD_DIR = "build/onnx"
SUPPORTED_OPS_CSV_FILE = "auto_gen_supported_op_list.csv"
Expand Down
1 change: 0 additions & 1 deletion ios/TestApp/benchmark/coreml_backend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from torchvision import models

import torch

from torch.backends._coreml.preprocess import CompileSpec, CoreMLComputeUnit, TensorSpec


Expand Down
1 change: 1 addition & 0 deletions ios/TestApp/benchmark/trace_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import torch
from torch.utils.mobile_optimizer import optimize_for_mobile


model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
model.eval()
example = torch.rand(1, 3, 224, 224)
Expand Down
1 change: 1 addition & 0 deletions ios/TestApp/custom_build/custom_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import torch


model = models.mobilenet_v2(weights=models.MobileNet_V2_Weights.IMAGENET1K_V1)
model.eval()
example = torch.rand(1, 3, 224, 224)
Expand Down
1 change: 1 addition & 0 deletions ios/TestApp/run_on_aws_devicefarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import boto3
import requests


POLLING_DELAY_IN_SECOND = 5
MAX_UPLOAD_WAIT_IN_SECOND = 600

Expand Down
1 change: 1 addition & 0 deletions scripts/analysis/format_test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import subprocess
import sys


parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
)
Expand Down
1 change: 1 addition & 0 deletions scripts/compile_tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import warnings


try:
import lxml.etree

Expand Down
1 change: 0 additions & 1 deletion scripts/compile_tests/failures_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import re

from common import download_reports, get_testcases, key, open_test_results, skipped_test

from passrate import compute_pass_rate


Expand Down
2 changes: 1 addition & 1 deletion scripts/compile_tests/passrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
key,
open_test_results,
)

from download_reports import download_reports


"""
Usage: passrate.py commit_sha
Expand Down
2 changes: 1 addition & 1 deletion scripts/compile_tests/update_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
key,
open_test_results,
)

from download_reports import download_reports


"""
Usage: update_failures.py /path/to/dynamo_test_failures.py /path/to/test commit_sha
Expand Down
1 change: 1 addition & 0 deletions scripts/diagnose_protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import re
from subprocess import PIPE, Popen


# Get python protobuf version.
try:
import google.protobuf
Expand Down
1 change: 1 addition & 0 deletions scripts/export/update_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from torch._export.serde import schema_check


if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="update_schema")
parser.add_argument(
Expand Down
1 change: 1 addition & 0 deletions scripts/get_python_cmake_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
import sysconfig


flags = [
f"-DPython_EXECUTABLE:FILEPATH={sys.executable}",
]
Expand Down
1 change: 1 addition & 0 deletions scripts/jit/log_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
run_nvfuser,
)


"""
Usage:
1. Run your script and pipe into a log file
Expand Down
1 change: 1 addition & 0 deletions scripts/release_notes/apply_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import commitlist


category_csv = "results/category_data.csv"
commitlist_csv = "results/commitlist.csv"

Expand Down
1 change: 1 addition & 0 deletions scripts/release_notes/namespace_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import torch


# Import all utils so that getattr below can find them

all_submod_list = [
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
import os
import sys


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

import platform


BUILD_LIBTORCH_WHL = os.getenv("BUILD_LIBTORCH_WHL", "0") == "1"
BUILD_PYTHON_ONLY = os.getenv("BUILD_PYTHON_ONLY", "0") == "1"

Expand Down Expand Up @@ -236,7 +238,6 @@
import setuptools.command.sdist
from setuptools import Extension, find_packages, setup
from setuptools.dist import Distribution

from tools.build_pytorch_libs import build_caffe2
from tools.generate_torch_version import get_torch_version
from tools.setup_helpers.cmake import CMake
Expand Down
1 change: 0 additions & 1 deletion tools/linter/adapters/ufmt_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
fnmatch.translate,
[
# **
"**",
# .ci/**
".ci/**",
# .github/**
Expand Down

0 comments on commit a3abfa5

Please sign in to comment.