mirror of https://github.com/python/cpython
Remove redundant imports.
This commit is contained in:
parent
c53ae58954
commit
54540ec917
|
@ -72,7 +72,7 @@ def unix_getpass(prompt='Password: ', stream=None):
|
||||||
finally:
|
finally:
|
||||||
termios.tcsetattr(fd, tcsetattr_flags, old)
|
termios.tcsetattr(fd, tcsetattr_flags, old)
|
||||||
stream.flush() # issue7208
|
stream.flush() # issue7208
|
||||||
except termios.error as e:
|
except termios.error:
|
||||||
if passwd is not None:
|
if passwd is not None:
|
||||||
# _raw_input succeeded. The final tcsetattr failed. Reraise
|
# _raw_input succeeded. The final tcsetattr failed. Reraise
|
||||||
# instead of leaving the terminal in an unknown state.
|
# instead of leaving the terminal in an unknown state.
|
||||||
|
@ -145,8 +145,6 @@ def getuser():
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
|
for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
|
||||||
user = os.environ.get(name)
|
user = os.environ.get(name)
|
||||||
if user:
|
if user:
|
||||||
|
|
|
@ -1326,7 +1326,7 @@ def _test():
|
||||||
return doctest.testmod()
|
return doctest.testmod()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys, argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='display contents of the pickle files')
|
description='display contents of the pickle files')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
|
@ -674,7 +674,6 @@ if __name__ == '__main__':
|
||||||
return stop
|
return stop
|
||||||
return None
|
return None
|
||||||
|
|
||||||
import sys
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
initprofile = sys.argv[1]
|
initprofile = sys.argv[1]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -15,6 +15,7 @@ import tarfile
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import bz2
|
import bz2
|
||||||
|
del bz2
|
||||||
_BZ2_SUPPORTED = True
|
_BZ2_SUPPORTED = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_BZ2_SUPPORTED = False
|
_BZ2_SUPPORTED = False
|
||||||
|
|
|
@ -154,7 +154,7 @@ def addpackage(sitedir, name, known_paths):
|
||||||
if not dircase in known_paths and os.path.exists(dir):
|
if not dircase in known_paths and os.path.exists(dir):
|
||||||
sys.path.append(dir)
|
sys.path.append(dir)
|
||||||
known_paths.add(dircase)
|
known_paths.add(dircase)
|
||||||
except Exception as err:
|
except Exception:
|
||||||
print("Error processing line {:d} of {}:\n".format(n+1, fullname),
|
print("Error processing line {:d} of {}:\n".format(n+1, fullname),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
for record in traceback.format_exception(*sys.exc_info()):
|
for record in traceback.format_exception(*sys.exc_info()):
|
||||||
|
@ -241,7 +241,6 @@ def getusersitepackages():
|
||||||
return USER_SITE
|
return USER_SITE
|
||||||
|
|
||||||
from sysconfig import get_path
|
from sysconfig import get_path
|
||||||
import os
|
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
from sysconfig import get_config_var
|
from sysconfig import get_config_var
|
||||||
|
|
|
@ -1159,7 +1159,6 @@ class Misc:
|
||||||
return (e,)
|
return (e,)
|
||||||
def _report_exception(self):
|
def _report_exception(self):
|
||||||
"""Internal function."""
|
"""Internal function."""
|
||||||
import sys
|
|
||||||
exc, val, tb = sys.exc_info()
|
exc, val, tb = sys.exc_info()
|
||||||
root = self._root()
|
root = self._root()
|
||||||
root.report_callback_exception(exc, val, tb)
|
root.report_callback_exception(exc, val, tb)
|
||||||
|
@ -1663,7 +1662,7 @@ class Tk(Misc, Wm):
|
||||||
# ensure that self.tk is always _something_.
|
# ensure that self.tk is always _something_.
|
||||||
self.tk = None
|
self.tk = None
|
||||||
if baseName is None:
|
if baseName is None:
|
||||||
import sys, os
|
import os
|
||||||
baseName = os.path.basename(sys.argv[0])
|
baseName = os.path.basename(sys.argv[0])
|
||||||
baseName, ext = os.path.splitext(baseName)
|
baseName, ext = os.path.splitext(baseName)
|
||||||
if ext not in ('.py', '.pyc', '.pyo'):
|
if ext not in ('.py', '.pyc', '.pyo'):
|
||||||
|
@ -1737,7 +1736,7 @@ class Tk(Misc, Wm):
|
||||||
exec(open(base_py).read(), dir)
|
exec(open(base_py).read(), dir)
|
||||||
def report_callback_exception(self, exc, val, tb):
|
def report_callback_exception(self, exc, val, tb):
|
||||||
"""Internal function. It reports exception on sys.stderr."""
|
"""Internal function. It reports exception on sys.stderr."""
|
||||||
import traceback, sys
|
import traceback
|
||||||
sys.stderr.write("Exception in Tkinter callback\n")
|
sys.stderr.write("Exception in Tkinter callback\n")
|
||||||
sys.last_type = exc
|
sys.last_type = exc
|
||||||
sys.last_value = val
|
sys.last_value = val
|
||||||
|
|
|
@ -306,7 +306,6 @@ class _Dialog(commondialog.Dialog):
|
||||||
def _fixresult(self, widget, result):
|
def _fixresult(self, widget, result):
|
||||||
if result:
|
if result:
|
||||||
# keep directory and filename until next time
|
# keep directory and filename until next time
|
||||||
import os
|
|
||||||
# convert Tcl path objects to strings
|
# convert Tcl path objects to strings
|
||||||
try:
|
try:
|
||||||
result = result.string
|
result = result.string
|
||||||
|
@ -333,7 +332,6 @@ class Open(_Dialog):
|
||||||
# multiple results:
|
# multiple results:
|
||||||
result = tuple([getattr(r, "string", r) for r in result])
|
result = tuple([getattr(r, "string", r) for r in result])
|
||||||
if result:
|
if result:
|
||||||
import os
|
|
||||||
path, file = os.path.split(result[0])
|
path, file = os.path.split(result[0])
|
||||||
self.options["initialdir"] = path
|
self.options["initialdir"] = path
|
||||||
# don't set initialfile or filename, as we have multiple of these
|
# don't set initialfile or filename, as we have multiple of these
|
||||||
|
|
Loading…
Reference in New Issue