mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-12 02:04:04 +02:00
cmdln.py: remove some reimports of sys
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
@@ -231,7 +231,6 @@ class RawCmdln(cmd.Cmd):
|
|||||||
error output. This is to provide least surprise for users used
|
error output. This is to provide least surprise for users used
|
||||||
to only the 'stdin' and 'stdout' options with cmd.Cmd.
|
to only the 'stdin' and 'stdout' options with cmd.Cmd.
|
||||||
"""
|
"""
|
||||||
import sys
|
|
||||||
if self.name is None:
|
if self.name is None:
|
||||||
self.name = os.path.basename(sys.argv[0])
|
self.name = os.path.basename(sys.argv[0])
|
||||||
if self.prompt is None:
|
if self.prompt is None:
|
||||||
@@ -315,7 +314,6 @@ class RawCmdln(cmd.Cmd):
|
|||||||
otherwise, start loop
|
otherwise, start loop
|
||||||
"""
|
"""
|
||||||
if argv is None:
|
if argv is None:
|
||||||
import sys
|
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
else:
|
else:
|
||||||
argv = argv[:] # don't modify caller's list
|
argv = argv[:] # don't modify caller's list
|
||||||
@@ -381,7 +379,6 @@ class RawCmdln(cmd.Cmd):
|
|||||||
#XXX What is the proper encoding to use here? 'utf-8' seems
|
#XXX What is the proper encoding to use here? 'utf-8' seems
|
||||||
# to work better than "getdefaultencoding" (usually
|
# to work better than "getdefaultencoding" (usually
|
||||||
# 'ascii'), on OS X at least.
|
# 'ascii'), on OS X at least.
|
||||||
#import sys
|
|
||||||
#return s.encode(sys.getdefaultencoding(), "replace")
|
#return s.encode(sys.getdefaultencoding(), "replace")
|
||||||
return s.encode("utf-8", "replace")
|
return s.encode("utf-8", "replace")
|
||||||
|
|
||||||
@@ -468,7 +465,6 @@ class RawCmdln(cmd.Cmd):
|
|||||||
opposed to programmer error in the design of the script using
|
opposed to programmer error in the design of the script using
|
||||||
cmdln.py).
|
cmdln.py).
|
||||||
"""
|
"""
|
||||||
import sys
|
|
||||||
exc_type, exc, traceback = sys.exc_info()
|
exc_type, exc, traceback = sys.exc_info()
|
||||||
if isinstance(exc, CmdlnUserError):
|
if isinstance(exc, CmdlnUserError):
|
||||||
msg = "%s %s: %s\nTry '%s help %s' for info.\n"\
|
msg = "%s %s: %s\nTry '%s help %s' for info.\n"\
|
||||||
@@ -1223,7 +1219,6 @@ class Cmdln(RawCmdln):
|
|||||||
# do_foo() takes exactly 5 arguments (6 given)
|
# do_foo() takes exactly 5 arguments (6 given)
|
||||||
# Raise CmdlnUserError for these with a suitably
|
# Raise CmdlnUserError for these with a suitably
|
||||||
# massaged error message.
|
# massaged error message.
|
||||||
import sys
|
|
||||||
tb = sys.exc_info()[2] # the traceback object
|
tb = sys.exc_info()[2] # the traceback object
|
||||||
if tb.tb_next is not None:
|
if tb.tb_next is not None:
|
||||||
# If the traceback is more than one level deep, then the
|
# If the traceback is more than one level deep, then the
|
||||||
|
Reference in New Issue
Block a user