Skip to content

Commit 173f224

Browse files
ezyangfacebook-github-bot
authored andcommitted
Turn on F401: Unused import warning. (#18598)
Summary: Pull Request resolved: #18598 ghimport-source-id: c74597e Stack from [ghstack](https://github.com/ezyang/ghstack): * **#18598 Turn on F401: Unused import warning.** This was requested by someone at Facebook; this lint is turned on for Facebook by default. "Sure, why not." I had to noqa a number of imports in __init__. Hypothetically we're supposed to use __all__ in this case, but I was too lazy to fix it. Left for future work. Be careful! flake8-2 and flake8-3 behave differently with respect to import resolution for # type: comments. flake8-3 will report an import unused; flake8-2 will not. For now, I just noqa'd all these sites. All the changes were done by hand. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: D14687478 fbshipit-source-id: 30d532381e914091aadfa0d2a5a89404819663e3
1 parent 96456bf commit 173f224

File tree

131 files changed

+175
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+175
-333
lines changed

.circleci/cimodel/lib/visualization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def handle_missing_graphviz(f):
2222
calls to the draw() method of the returned object to do nothing.
2323
"""
2424
try:
25-
import pygraphviz
25+
import pygraphviz # noqa: F401
2626
return f
2727

2828
except ModuleNotFoundError:

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ max-line-length = 120
77
# C408 ignored because we like the dict keyword argument syntax
88
# E501 is not flexible enough, we're using B950 instead
99
ignore =
10-
E203,E305,E402,E501,E721,E741,F401,F403,F405,F821,F841,F999,W503,W504,C408,
10+
E203,E305,E402,E501,E721,E741,F403,F405,F821,F841,F999,W503,W504,C408,
1111
# these ignores are from flake8-bugbear; please fix!
1212
B007,B008,
1313
# these ignores are from flake8-comprehensions; please fix!

.jenkins/pytorch/perf_test/compare_with_baseline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22
import json
33
import math
4-
import numpy
54
import argparse
65

76
parser = argparse.ArgumentParser()

benchmarks/fastrnns/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .cells import *
2-
from .factory import *
1+
from .cells import * # noqa: F401
2+
from .factory import * # noqa: F401
33

44
# (output, next_state) = cell(input, state)
55
seqLength = 100

benchmarks/fastrnns/profile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import os
32
import subprocess
43
import sys
54
import time

benchmarks/fastrnns/test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import torch
33
import torch.nn as nn
44

5-
from .cells import lstm_cell
65
from .factory import pytorch_lstm_creator, varlen_pytorch_lstm_creator
76
from .runner import get_nn_runners
87

docs/cpp/source/conf.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020
import os
2121
# sys.path.insert(0, os.path.abspath('.'))
2222

23-
import sys
2423
import textwrap
2524

26-
import pytorch_sphinx_theme
27-
2825
# -- General configuration ------------------------------------------------
2926

3027
# If your documentation needs a minimal Sphinx version, state it here.

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import torch
2727
try:
28-
import torchvision
28+
import torchvision # noqa: F401
2929
except ImportError:
3030
import warnings
3131
warnings.warn('unable to load "torchvision" package')

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
# we will search for libraries in these paths
143143

144144
from __future__ import print_function
145-
from setuptools import setup, Extension, distutils, Command, find_packages
145+
from setuptools import setup, Extension, distutils, find_packages
146146
from distutils import core, dir_util
147147
from distutils.core import Distribution
148148
from distutils.errors import DistutilsArgError
@@ -151,7 +151,6 @@
151151
import distutils.command.clean
152152
import distutils.sysconfig
153153
import filecmp
154-
import platform
155154
import subprocess
156155
import shutil
157156
import sys

test/common_methods_invocations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import torch
2-
from torch._six import inf, nan, istuple
3-
from functools import reduce, wraps
2+
from torch._six import inf, istuple
3+
from functools import reduce
44
from operator import mul, itemgetter
55
import collections
6-
from torch.autograd import Variable, Function, detect_anomaly
6+
from torch.autograd import Variable
77
from torch.testing import make_non_contiguous
88
from common_utils import (skipIfNoLapack,
99
prod_single_zero, random_square_matrix_of_rank,

0 commit comments

Comments
 (0)