summaryrefslogtreecommitdiff
path: root/bin/Command.py
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2010-06-15 14:28:22 +0000
committerLuca Falavigna <dktrkranz@debian.org>2010-06-15 14:28:22 +0000
commit738149c9bfb9965d013d01ef99f9bb1c2819e7e8 (patch)
tree0397d9bf3b12c903dc73419585df231397ff343c /bin/Command.py
parente7885e3af440eaef38a9301fd92a105afc8ddebb (diff)
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'bin/Command.py')
-rw-r--r--bin/Command.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/Command.py b/bin/Command.py
index efaa356..8702f51 100644
--- a/bin/Command.py
+++ b/bin/Command.py
@@ -14,7 +14,7 @@ class Usage(Exception):
def __init__(self, msg):
self.msg = msg
-class CommandRunner:
+class CommandRunner(object):
"""
Representation of a command to be executed.
"""
@@ -44,7 +44,7 @@ class CommandRunner:
return string
def do_display(self, string):
- if type(string) == type(()):
+ if isinstance(string, tuple):
func = string[0]
args = string[1:]
s = '%s(%s)' % (func.__name__, ', '.join(map(repr, args)))
@@ -59,14 +59,14 @@ class CommandRunner:
pass
def do_execute(self, command):
- if type(command) == type(''):
+ if isinstance(command, str):
command = self.subst(command)
cmdargs = shlex.split(command)
if cmdargs[0] == 'cd':
command = (os.chdir,) + tuple(cmdargs[1:])
elif cmdargs[0] == 'mkdir':
command = (os.mkdir,) + tuple(cmdargs[1:])
- if type(command) == type(()):
+ if isinstance(command, tuple):
func = command[0]
args = command[1:]
return func(*args)