From 738149c9bfb9965d013d01ef99f9bb1c2819e7e8 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Tue, 15 Jun 2010 14:28:22 +0000 Subject: Imported Upstream version 2.0.0 --- bin/Command.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/Command.py') 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) -- cgit v1.2.3