summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2014-06-01 17:56:30 -0700
committerjquast <contact@jeffquast.com>2014-06-01 17:56:30 -0700
commit8cfc5188e0a9cff7a584c83e7ee16ef7023b3cd5 (patch)
tree0b9fc2a5fd2ee51783c9795cfa4b36e9f51a91ab
parent8807914872e9694f62656505f83997f46e63ffaa (diff)
downloadpexpect-8cfc5188e0a9cff7a584c83e7ee16ef7023b3cd5.tar.gz
remove all unnecessary imports
-rwxr-xr-xexamples/astat.py7
-rwxr-xr-xexamples/chess.py3
-rwxr-xr-xexamples/chess2.py4
-rwxr-xr-xexamples/chess3.py3
-rwxr-xr-xexamples/hive.py1
-rwxr-xr-xtests/depricated_test_filedescriptor.py1
-rwxr-xr-xtests/echo_wait.py4
-rwxr-xr-xtests/pexpectTest.py4
-rw-r--r--tests/platform_tests/pexqa.py11
-rwxr-xr-xtests/platform_tests/test.py5
-rwxr-xr-xtests/platform_tests/test2.py4
-rwxr-xr-xtests/platform_tests/test_handler.py8
-rwxr-xr-xtests/platform_tests/test_read.py2
-rwxr-xr-xtests/platform_tests/test_signals.py6
-rwxr-xr-xtests/test_constructor.py1
-rwxr-xr-xtests/test_expect.py3
-rwxr-xr-xtests/test_isalive.py3
-rwxr-xr-xtests/test_misc.py1
-rw-r--r--tests/test_replwrap.py3
-rwxr-xr-xtools/merge_templates.py9
-rwxr-xr-xtools/testsweep.py1
-rwxr-xr-xtools/tweak_files.py3
-rwxr-xr-xtools/websync.py4
23 files changed, 45 insertions, 46 deletions
diff --git a/examples/astat.py b/examples/astat.py
index ef5c3a9..a083fe1 100755
--- a/examples/astat.py
+++ b/examples/astat.py
@@ -34,8 +34,11 @@ from __future__ import print_function
from __future__ import absolute_import
-import os, sys, time, re, getopt, getpass
-import pexpect, pxssh
+import os
+import sys
+import getopt
+import getpass
+import pxssh
try:
diff --git a/examples/chess.py b/examples/chess.py
index 8e33d9b..421727d 100755
--- a/examples/chess.py
+++ b/examples/chess.py
@@ -27,7 +27,6 @@ from __future__ import print_function
from __future__ import absolute_import
import pexpect
-import string
import ANSI
REGEX_MOVE = '(?:[a-z]|\x1b\[C)(?:[0-9]|\x1b\[C)(?:[a-z]|\x1b\[C)(?:[0-9]|\x1b\[C)'
@@ -95,7 +94,7 @@ class Chess:
def quit(self):
self.child.sendline ('quit')
-import sys, os
+import sys
print('Starting...')
white = Chess()
white.child.echo = 1
diff --git a/examples/chess2.py b/examples/chess2.py
index ae5fcea..b92509e 100755
--- a/examples/chess2.py
+++ b/examples/chess2.py
@@ -27,9 +27,9 @@ from __future__ import print_function
from __future__ import absolute_import
import pexpect
-import string
import ANSI
-import sys, os, time
+import sys
+import time
class Chess:
diff --git a/examples/chess3.py b/examples/chess3.py
index 5080dcb..dc02663 100755
--- a/examples/chess3.py
+++ b/examples/chess3.py
@@ -27,7 +27,6 @@ from __future__ import print_function
from __future__ import absolute_import
import pexpect
-import string
import ANSI
REGEX_MOVE = '(?:[a-z]|\x1b\[C)(?:[0-9]|\x1b\[C)(?:[a-z]|\x1b\[C)(?:[0-9]|\x1b\[C)'
@@ -98,7 +97,7 @@ class Chess:
def quit(self):
self.child.sendline ('quit')
-import sys, os
+import sys
print('Starting...')
white = Chess()
white.do_move('b2b4')
diff --git a/examples/hive.py b/examples/hive.py
index 6edd9b0..00ddbea 100755
--- a/examples/hive.py
+++ b/examples/hive.py
@@ -88,7 +88,6 @@ import sys
import os
import re
import optparse
-import types
import time
import getpass
import readline
diff --git a/tests/depricated_test_filedescriptor.py b/tests/depricated_test_filedescriptor.py
index 7ed0ca4..6b0ef3e 100755
--- a/tests/depricated_test_filedescriptor.py
+++ b/tests/depricated_test_filedescriptor.py
@@ -21,7 +21,6 @@ PEXPECT LICENSE
import pexpect
import unittest
import PexpectTestCase
-import sys
import os
class ExpectTestCase(PexpectTestCase.PexpectTestCase):
diff --git a/tests/echo_wait.py b/tests/echo_wait.py
index 8ccf13f..e152059 100755
--- a/tests/echo_wait.py
+++ b/tests/echo_wait.py
@@ -18,7 +18,9 @@ PEXPECT LICENSE
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'''
-import signal, time, struct, fcntl, termios, os, sys
+import time
+import termios
+import sys
# a dumb PAM will print the password prompt first then set ECHO
# False. What it should do it set ECHO False first then print the
diff --git a/tests/pexpectTest.py b/tests/pexpectTest.py
index c080d7e..6839a2f 100755
--- a/tests/pexpectTest.py
+++ b/tests/pexpectTest.py
@@ -19,7 +19,9 @@ PEXPECT LICENSE
'''
-import os, time, pexpect, sys
+import time
+import pexpect
+import sys
def getProcessResults(cmd, timeLimit=20):
'''
diff --git a/tests/platform_tests/pexqa.py b/tests/platform_tests/pexqa.py
index 193411c..89e90f4 100644
--- a/tests/platform_tests/pexqa.py
+++ b/tests/platform_tests/pexqa.py
@@ -1,17 +1,8 @@
-import os, sys
-import select
-import signal
-import traceback
+import os
import time
-import re
-import struct
from types import *
-import posix
import pty
-import tty
-import termios
-import fcntl
class s:
def __init__(self, command, args=None, timeout=30):
diff --git a/tests/platform_tests/test.py b/tests/platform_tests/test.py
index a285ee2..b41755a 100755
--- a/tests/platform_tests/test.py
+++ b/tests/platform_tests/test.py
@@ -1,5 +1,8 @@
#!/usr/bin/env python
-import signal, os, time, errno, pty
+import signal
+import os
+import time
+import pty
def signal_handler (signum, frame):
print 'Signal handler called with signal:', signum
diff --git a/tests/platform_tests/test2.py b/tests/platform_tests/test2.py
index bbf125a..0a7d5f8 100755
--- a/tests/platform_tests/test2.py
+++ b/tests/platform_tests/test2.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
-import signal, os, time, errno
+import signal
+import os
+import time
def signal_handler (signum, frame):
print 'Signal handler called with signal:', signum
diff --git a/tests/platform_tests/test_handler.py b/tests/platform_tests/test_handler.py
index 715a2b3..c0633eb 100755
--- a/tests/platform_tests/test_handler.py
+++ b/tests/platform_tests/test_handler.py
@@ -1,5 +1,11 @@
#!/usr/bin/env python
-import signal, os, time, errno, pty, sys, fcntl, tty
+import signal
+import os
+import time
+import pty
+import sys
+import fcntl
+import tty
GLOBAL_SIGCHLD_RECEIVED = 0
def nonblock (fd):
diff --git a/tests/platform_tests/test_read.py b/tests/platform_tests/test_read.py
index 1e16ed4..9598aa7 100755
--- a/tests/platform_tests/test_read.py
+++ b/tests/platform_tests/test_read.py
@@ -1,4 +1,4 @@
-import os, sys
+import os
filename = os.tmpnam()
print 'filename:', filename
diff --git a/tests/platform_tests/test_signals.py b/tests/platform_tests/test_signals.py
index d5c14ee..d45bc8a 100755
--- a/tests/platform_tests/test_signals.py
+++ b/tests/platform_tests/test_signals.py
@@ -1,5 +1,9 @@
#!/usr/bin/env python
-import signal, os, time, errno, pty, sys
+import signal
+import os
+import time
+import pty
+import sys
GLOBAL_SIGCHLD_RECEIVED = 0
def signal_handler (signum, frame):
diff --git a/tests/test_constructor.py b/tests/test_constructor.py
index 8a98c28..9611274 100755
--- a/tests/test_constructor.py
+++ b/tests/test_constructor.py
@@ -20,7 +20,6 @@ PEXPECT LICENSE
'''
import pexpect
import unittest
-import time
import PexpectTestCase
class TestCaseConstructor(PexpectTestCase.PexpectTestCase):
diff --git a/tests/test_expect.py b/tests/test_expect.py
index d5d0c9c..6c4fa10 100755
--- a/tests/test_expect.py
+++ b/tests/test_expect.py
@@ -24,9 +24,7 @@ import unittest
import subprocess
import time
import PexpectTestCase
-import sys
import signal
-#import pdb
# Many of these test cases blindly assume that sequential directory
# listings of the /bin directory will yield the same results.
@@ -274,7 +272,6 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase):
'''This tests that mixed list of regex strings, TIMEOUT, and EOF all
return the correct index when matched.
'''
- #pdb.set_trace()
p = pexpect.spawn('cat')
self._expect_index(p)
diff --git a/tests/test_isalive.py b/tests/test_isalive.py
index 5386bac..d725631 100755
--- a/tests/test_isalive.py
+++ b/tests/test_isalive.py
@@ -21,7 +21,8 @@ PEXPECT LICENSE
import pexpect
import unittest
import signal
-import sys, os, time
+import sys
+import time
import PexpectTestCase
class IsAliveTestCase(PexpectTestCase.PexpectTestCase):
diff --git a/tests/test_misc.py b/tests/test_misc.py
index cbc01eb..3a9e12a 100755
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -23,7 +23,6 @@ import unittest
import PexpectTestCase
import os
import sys
-import string
import tempfile
import re
import signal
diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py
index 835bf63..febf221 100644
--- a/tests/test_replwrap.py
+++ b/tests/test_replwrap.py
@@ -1,4 +1,3 @@
-import sys
import unittest
import pexpect
@@ -36,4 +35,4 @@ class REPLWrapTestCase(unittest.TestCase):
assert res.startswith('/'), res
if __name__ == '__main__':
- unittest.main() \ No newline at end of file
+ unittest.main()
diff --git a/tools/merge_templates.py b/tools/merge_templates.py
index accc8e9..b4fab18 100755
--- a/tools/merge_templates.py
+++ b/tools/merge_templates.py
@@ -24,14 +24,9 @@ PEXPECT LICENSE
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'''
-import sys, os, re
+import os
+import re
import pyed
-try:
- import pexpect
-except:
- # this happens if Pexpect was never installed to begin with.
- sys.path.insert(0, '.')
- import pexpect
# extract the version number from the pexpect.py source.
d = pyed.pyed()
diff --git a/tools/testsweep.py b/tools/testsweep.py
index 0f2c4d5..8100d99 100755
--- a/tools/testsweep.py
+++ b/tools/testsweep.py
@@ -20,7 +20,6 @@ PEXPECT LICENSE
"""
import pexpect
-import sys
import getpass
def test_platform (platform_menu, platform_python_path):
diff --git a/tools/tweak_files.py b/tools/tweak_files.py
index 4ab8b22..08481a2 100755
--- a/tools/tweak_files.py
+++ b/tools/tweak_files.py
@@ -20,7 +20,8 @@ PEXPECT LICENSE
'''
import pyed
-import sys, os, re
+import os
+import re
# extract the version number from the pexpect.py source.
d = pyed.pyed()
diff --git a/tools/websync.py b/tools/websync.py
index a4ee141..b7723e5 100755
--- a/tools/websync.py
+++ b/tools/websync.py
@@ -26,9 +26,9 @@ PEXPECT LICENSE
'''
-import pexpect, pyed
+import pexpect
import getpass
-import sys, os
+import sys
X = getpass.getpass('Password: ')
pp_pattern=["(?i)password:", "(?i)enter passphrase for key '.*?':"]