Skip to content

Commit

Permalink
Remove all the unused imports.
Browse files Browse the repository at this point in the history
Added that check to the 'fatal' part of the flake8 check.
  • Loading branch information
Andy Chu committed Feb 2, 2018
1 parent 45bdc29 commit 1dee824
Show file tree
Hide file tree
Showing 40 changed files with 36 additions and 76 deletions.
1 change: 0 additions & 1 deletion asdl/arith_ast_test.py
Expand Up @@ -6,7 +6,6 @@
import cStringIO
import unittest

from asdl import format as fmt
from asdl import py_meta
from asdl import asdl_
from asdl import const
Expand Down
2 changes: 1 addition & 1 deletion asdl/arith_parse.py
Expand Up @@ -7,7 +7,7 @@
import sys

from asdl import tdop
from asdl.tdop import Node, CompositeNode
from asdl.tdop import CompositeNode
from asdl import arith_ast

op_id = arith_ast.op_id_e # TODO: Rename this back.
Expand Down
6 changes: 4 additions & 2 deletions asdl/asdl_demo.py
Expand Up @@ -12,7 +12,9 @@
from asdl import format as fmt

from core.id_kind import Id
from core.util import log
from core import util

log = util.log


def main(argv):
Expand Down Expand Up @@ -41,7 +43,7 @@ def main(argv):
# demo.
py_meta.MakeTypes(module, root, type_lookup)

print('Dynamically created a Python module with these types:')
log('Dynamically created a Python module with these types:')
for name in dir(root):
print('\t' + name)

Expand Down
2 changes: 0 additions & 2 deletions asdl/encode.py
Expand Up @@ -2,8 +2,6 @@
encode.py
"""

import sys

from asdl import asdl_ as asdl
from asdl import py_meta
from asdl import const
Expand Down
1 change: 0 additions & 1 deletion asdl/format.py
Expand Up @@ -16,7 +16,6 @@
"""

import re
import sys

from asdl import asdl_ as asdl
from core import util
Expand Down
3 changes: 0 additions & 3 deletions asdl/format_test.py
Expand Up @@ -4,12 +4,9 @@
"""

import cStringIO
import sys
import unittest


from asdl import format as fmt
from asdl import asdl_

from asdl import arith_ast # module under test

Expand Down
1 change: 0 additions & 1 deletion asdl/gen_cpp.py
Expand Up @@ -28,7 +28,6 @@
import sys

from asdl import asdl_ as asdl
from asdl import py_meta
from asdl import encode

TABSIZE = 2
Expand Down
12 changes: 4 additions & 8 deletions asdl/py_meta.py
Expand Up @@ -26,13 +26,13 @@
put: an op is Add() and not Add, an instance of a class, not an integer value.
"""

import sys

from asdl import asdl_ as asdl
from asdl import const
from asdl import format as fmt
from core import util

log = util.log


def _CheckType(value, expected_desc):
"""Is value of type expected_desc?
Expand Down Expand Up @@ -86,12 +86,8 @@ def _CheckType(value, expected_desc):
if asdl.is_simple(expected_desc):
return actual_desc is expected_desc
else:
for cons in expected_desc.types:
#print("CHECKING desc %s against %s" % (desc, cons))

# It has to be one of the alternatives
from core.util import log
#log('Checking %s against %s', actual_desc, cons)
for cons in expected_desc.types: # It has to be one of the alternatives
#log("CHECKING desc %s against %s" % (desc, cons))
if actual_desc is cons:
return True
return False
Expand Down
5 changes: 3 additions & 2 deletions asdl/py_meta_test.py
Expand Up @@ -3,13 +3,14 @@
py_meta_test.py: Tests for py_meta.py
"""

import re
import unittest

from asdl import py_meta # module under test

class AsdlTest(unittest.TestCase):
pass

def testPyMeta(self):
print py_meta


if __name__ == '__main__':
Expand Down
1 change: 0 additions & 1 deletion bin/oil.py
Expand Up @@ -51,7 +51,6 @@ def _tlog(msg):

import errno
import platform
import re
#import traceback # for debugging

# Set in Modules/main.c.
Expand Down
2 changes: 0 additions & 2 deletions core/builtin.py
Expand Up @@ -30,13 +30,11 @@
import sys

from core import args
from core import legacy
from core import lexer
from core import runtime
from core import util
from core import state
from core import word_compile
from core.id_kind import Id

from osh import lex

Expand Down
1 change: 0 additions & 1 deletion core/builtin_test.py
Expand Up @@ -6,7 +6,6 @@
import unittest

from core import legacy
from core import lexer
from core import builtin # module under test


Expand Down
2 changes: 0 additions & 2 deletions core/cmd_exec.py
Expand Up @@ -17,7 +17,6 @@

import os
import resource
import stat
import sys
import time

Expand Down Expand Up @@ -1007,7 +1006,6 @@ def _Dispatch(self, node, fork_external):
if not b:
break

do_continue = False
try:
status = self._Execute(node.body)
except _ControlFlow as e:
Expand Down
4 changes: 0 additions & 4 deletions core/cmd_exec_test.py
Expand Up @@ -9,19 +9,15 @@
cmd_exec_test.py: Tests for cmd_exec.py
"""

import os
import unittest

from core import alloc
from core import builtin
from core import cmd_exec # module under test
from core.cmd_exec import *
from core.id_kind import Id
from core import completion
from core import legacy
from core import ui
from core import word_eval
from core import runtime
from core import process
from core import test_lib

Expand Down
3 changes: 0 additions & 3 deletions core/completion.py
Expand Up @@ -33,7 +33,6 @@
import fnmatch
import readline
import os
import stat
import sys
import time
import traceback
Expand All @@ -45,7 +44,6 @@
from core import state
from core import ui
from core import util
from core.id_kind import Id

command_e = ast.command_e
value_e = runtime.value_e
Expand Down Expand Up @@ -786,7 +784,6 @@ def Init(pool, builtins, mem, funcs, comp_lookup, status_out, ev):

if __name__ == '__main__':
from core import builtin
from core import cmd_exec
from core import state

status_lines = ui.MakeStatusLines()
Expand Down
2 changes: 0 additions & 2 deletions core/completion_test.py
Expand Up @@ -12,11 +12,9 @@
import unittest

from core import alloc
from core import cmd_exec
from core import cmd_exec_test
from core import completion # module under test
from core import legacy
from core import lexer
from core import state
from core import test_lib
from core import word_eval
Expand Down
3 changes: 2 additions & 1 deletion core/glob_.py
Expand Up @@ -10,7 +10,8 @@
except ImportError:
from benchmarks import fake_libc as libc

from core.util import log
from core import util
log = util.log


def LooksLikeGlob(s):
Expand Down
2 changes: 1 addition & 1 deletion core/lexer.py
Expand Up @@ -16,7 +16,7 @@
from core.id_kind import Id
from osh import ast_ as ast

from core.util import log
log = util.log


def C(pat, tok_type):
Expand Down
3 changes: 1 addition & 2 deletions core/lexer_gen_test.py
@@ -1,11 +1,10 @@
#!/usr/bin/python -S
"""
lex_gen_test.py: Tests for lex_gen.py
lexer_gen_test.py: Tests for lexer_gen.py
"""

import unittest

from osh import lex
from core import lexer_gen # module under test


Expand Down
2 changes: 2 additions & 0 deletions core/libstr_test.py
Expand Up @@ -11,6 +11,8 @@
class LibStrTest(unittest.TestCase):

def testUnarySuffixOpDemo(self):
print libstr

s = 'abcd'
n = len(s)

Expand Down
2 changes: 1 addition & 1 deletion core/process.py
Expand Up @@ -18,7 +18,7 @@

from core import runtime
from core import util
from core.id_kind import Id, REDIR_DEFAULT_FD
from core.id_kind import Id

redirect_e = runtime.redirect_e
e_die = util.e_die
Expand Down
3 changes: 0 additions & 3 deletions core/process_test.py
Expand Up @@ -4,7 +4,6 @@
"""

import os
import sys
import unittest

from core.id_kind import Id
Expand Down Expand Up @@ -49,12 +48,10 @@ def testStdinRedirect(self):

r = runtime.PathRedirect(Id.Redir_Less, 0, PATH)
fd_state.Push([r], waiter)
#line1 = sys.stdin.readline()
line1 = builtin.ReadLineFromStdin()
fd_state.Pop()

fd_state.Push([r], waiter)
#line2 = sys.stdin.readline()
line2 = builtin.ReadLineFromStdin()
fd_state.Pop()

Expand Down
1 change: 1 addition & 0 deletions core/reader.py
Expand Up @@ -12,6 +12,7 @@
import cStringIO

from core import util
log = util.log


class _Reader(object):
Expand Down
1 change: 0 additions & 1 deletion core/test_builtin.py
Expand Up @@ -8,7 +8,6 @@

from core import id_kind
from core import expr_eval
from core import word
from core import runtime
from core import util

Expand Down
1 change: 0 additions & 1 deletion core/word.py
Expand Up @@ -2,7 +2,6 @@
word.py -- Functions for using words as "tokens".
"""

import sys
from osh import ast_ as ast
from core.id_kind import Id, Kind, LookupKind
from core import util
Expand Down
1 change: 0 additions & 1 deletion core/word_eval.py
Expand Up @@ -7,7 +7,6 @@

from core import braces
from core import expr_eval
from core import legacy
from core import libstr
from core import glob_
from core.id_kind import Id, Kind, LookupKind
Expand Down
4 changes: 3 additions & 1 deletion core/word_eval_test.py
Expand Up @@ -15,7 +15,9 @@


class WordEvalTest(unittest.TestCase):
pass

def testWordEval(self):
print word_eval


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion core/word_test.py
Expand Up @@ -11,7 +11,7 @@
class WordTest(unittest.TestCase):

def testFoo(self):
print('Hello from word_test.py')
print word


if __name__ == '__main__':
Expand Down
2 changes: 0 additions & 2 deletions osh/arith_parse.py
Expand Up @@ -3,8 +3,6 @@
arith_parse.py - Parse shell arithmetic, which is based on C.
"""

import sys

from core import tdop
from core import util
from core.id_kind import Id
Expand Down
5 changes: 0 additions & 5 deletions osh/arith_parse_test.py
Expand Up @@ -13,9 +13,7 @@

from core import expr_eval
from core import legacy
from core import tdop
from core import word_eval
from core import cmd_exec
from core import state
from core import test_lib

Expand All @@ -30,9 +28,6 @@ class ExprSyntaxError(Exception):
def ParseAndEval(code_str):
arena = test_lib.MakeArena('<arith_parse_test.py>')
w_parser, _ = parse_lib.MakeParserForCompletion(code_str, arena)
#spec = arith_parse.MakeShellSpec()
#a_parser = tdop.TdopParser(spec, w_parser) # Calls ReadWord(lex_mode_e.ARITH)
#anode = a_parser.Parse()
anode = w_parser._ReadArithExpr() # need the right lex state?

if not anode:
Expand Down
1 change: 0 additions & 1 deletion osh/ast_gen.py
Expand Up @@ -5,7 +5,6 @@

import sys

from core import util
from osh import ast_ as ast
from asdl import gen_cpp

Expand Down
2 changes: 0 additions & 2 deletions osh/bool_parse.py
Expand Up @@ -32,8 +32,6 @@
BINARY_OP: -gt, -ot, ==, etc.
"""

import sys

from osh import ast_ as ast

from core import word
Expand Down

0 comments on commit 1dee824

Please sign in to comment.